aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md53
-rw-r--r--ISSUE_TEMPLATE.md33
-rw-r--r--README.md161
3 files changed, 155 insertions, 92 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 37dfa77e..57edb8d1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,14 +17,14 @@ The long-read part:
## General information
For specific proposals, please provide them as
-[pull requests](https://github.com/QMatrixClient/libQMatrixClient/pulls)
+[pull requests](https://github.com/quotient-im/libQuotient/pulls)
or
-[issues](https://github.com/QMatrixClient/libqmatrxclient/issues)
+[issues](https://github.com/quotient-im/libQuotient/issues)
For general discussion, feel free to use our Matrix room:
-[#quaternion:matrix.org](https://matrix.to/#/#quaternion:matrix.org).
+[#quotient:matrix.org](https://matrix.to/#/#quotient:matrix.org).
If you're new to the project (or FLOSS in general),
-[issues tagged as easy](https://github.com/QMatrixClient/libQMatrixClient/labels/easy)
+[issues tagged as easy](https://github.com/quotient-im/libQuotient/labels/easy)
are smaller tasks that may typically take 1-3 days.
You are welcome aboard!
@@ -44,8 +44,8 @@ and
### How we handle proposals
We use GitHub to track all changes via its
-[issue tracker](https://github.com/QMatrixClient/libQMatrixClient/issues) and
-[pull requests](https://github.com/QMatrixClient/libQMatrixClient/pulls).
+[issue tracker](https://github.com/quotient-im/libQuotient/issues) and
+[pull requests](https://github.com/quotient-im/libQuotient/pulls).
Specific changes are proposed using those mechanisms.
Issues are assigned to an individual who works on it and then marks it complete.
If there are questions or objections, the conversation area of that
@@ -88,7 +88,7 @@ a commit without a DCO is an accident and the DCO still applies.
Unless a contributor explicitly specifies otherwise, we assume contributors
to agree that all contributed code is released either under *LGPL v2.1 or later*.
-This is more than just [LGPL v2.1 libQMatrixClient now uses](./COPYING)
+This is more than just [LGPL v2.1 libQuotient now uses](./COPYING)
because the project plans to switch to LGPL v3 for library code in the near future.
<!-- The below is invalid yet!
All new contributed material that is not executable, including all text when not executed, is also released under the
@@ -108,7 +108,7 @@ filename extension. Any help on fixing/extending these is more than welcome.
Where reasonable, limit yourself to Markdown that will be accepted by different
markdown processors (e.g., what is specified by CommonMark or the original
-Markdown). In practice, as long as libQMatrixClient is hosted at GitHub,
+Markdown). In practice, as long as libQuotient is hosted at GitHub,
[GFM (GitHub-flavoured Markdown)](https://help.github.com/articles/github-flavored-markdown/)
is used to show those files in a browser, so it's fine to use its extensions.
In particular, you can mark code snippets with the programming language used;
@@ -152,15 +152,15 @@ The generating sequence only works with CMake atm;
patches to enable it with qmake are (you guessed it) very welcome.
#### Why generate the code at all?
-Because before both original authors of libQMatrixClient had to do monkey business of writing boilerplate code, with the same patterns, types etc., literally, for every single API endpoint, and one of the authors got fed up with it at some point in time. By then about 15 job classes were written; the entire API counts about 100 endpoints. Besides, the existing jobs had to be updated according to changes in CS API that have been, and will keep, coming. Other considerations can be found in [this talk about API description languages that briefly touches on GTAD](https://youtu.be/W5TmRozH-rg).
+Because before both original authors of libQuotient had to do monkey business of writing boilerplate code, with the same patterns, types etc., literally, for every single API endpoint, and one of the authors got fed up with it at some point in time. By then about 15 job classes were written; the entire API counts about 100 endpoints. Besides, the existing jobs had to be updated according to changes in CS API that have been, and will keep, coming. Other considerations can be found in [this talk about API description languages that briefly touches on GTAD](https://youtu.be/W5TmRozH-rg).
#### Prerequisites for CS API code generation
1. Get the source code of GTAD and its dependencies, e.g. using the command: `git clone --recursive https://github.com/KitsuneRal/gtad.git`
-2. Build GTAD: in the source code directory, do `cmake . && cmake --build .` (you might need to pass `-DCMAKE_PREFIX_PATH=<path to Qt>`, similar to libQMatrixClient itself).
-3. Get the Matrix CS API definitions that are included in the matrix-doc repo: `git clone https://github.com/QMatrixClient/matrix-doc.git` (QMatrixClient/matrix-doc is a fork that's known to produce working code; you may want to use your own fork if you wish to alter something in the API).
+2. Build GTAD: in the source code directory, do `cmake . && cmake --build .` (you might need to pass `-DCMAKE_PREFIX_PATH=<path to Qt>`, similar to libQuotient itself).
+3. Get the Matrix CS API definitions that are included in the matrix-doc repo: `git clone https://github.com/quotient-im/matrix-doc.git` (quotient-im/matrix-doc is a fork that's known to produce working code; you may want to use your own fork if you wish to alter something in the API).
#### Generating CS API contents
-1. Pass additional configuration to CMake when configuring libQMatrixClient:
+1. Pass additional configuration to CMake when configuring libQuotient:
`-DMATRIX_DOC_PATH=<path you your matrix-doc repo> -DGTAD_PATH=<path to gtad binary (not the repo!)>`.
If everything's right, these two CMake variables will be mentioned in
CMake output and will trigger configuration of an additional build target,
@@ -175,14 +175,14 @@ Because before both original authors of libQMatrixClient had to do monkey busine
is recommended if the list of generated files has changed.
#### Changing generated code
-See the more detailed description of what GTAD is and how it works in the documentation on GTAD in its source repo. Only parts specific for libQMatrixClient are described here.
+See the more detailed description of what GTAD is and how it works in the documentation on GTAD in its source repo. Only parts specific for libQuotient are described here.
GTAD uses the following three kinds of sources:
1. OpenAPI files. Each file is treated as a separate source (because this is how GTAD works now).
2. A configuration file, in our case it's lib/csapi/gtad.yaml - this one is common for the whole API.
3. Source code template files: lib/csapi/{{base}}.*.mustache - also common.
-The mustache files have a templated (not in C++ sense) definition of a network job, deriving from BaseJob; each job class is prepended, if necessary, with data structure definitions used by this job. The look of those files is hideous for a newcomer; the fact that there's no highlighter for the combination of Mustache (originally a web templating language) and C++ doesn't help things, either. To slightly simplify things some more or less generic constructs are defined in gtad.yaml (see its "mustache:" section). Adventurous souls that would like to figure what's going on in these files should speak up in the libQMatrixClient room - I (Kitsune) will be very glad to help you out.
+The mustache files have a templated (not in C++ sense) definition of a network job, deriving from BaseJob; each job class is prepended, if necessary, with data structure definitions used by this job. The look of those files is hideous for a newcomer; the fact that there's no highlighter for the combination of Mustache (originally a web templating language) and C++ doesn't help things, either. To slightly simplify things some more or less generic constructs are defined in gtad.yaml (see its "mustache:" section). Adventurous souls that would like to figure what's going on in these files should speak up in the Quotient room - I (Kitsune) will be very glad to help you out.
The types map in `gtad.yaml` is the central switchboard when it comes to matching OpenAPI types with C++ (and Qt) ones. It uses the following type attributes aside from pretty obvious "imports:":
* `avoidCopy` - this attribute defines whether a const ref should be used instead of a value. For basic types like int this is obviously unnecessary; but compound types like `QVector` should rather be taken by reference when possible.
@@ -191,7 +191,7 @@ The types map in `gtad.yaml` is the central switchboard when it comes to matchin
* `omittedValue` - an alternative for `useOmittable`, just provide a value used for an omitted parameter. This is used for bool parameters which normally are considered false if omitted (or they have an explicit default value, passed in the "official" GTAD's `defaultValue` variable).
* `initializer` - this is a _partial_ (see GTAD and Mustache documentation for explanations but basically it's a variable that is a Mustache template itself) that specifies how exactly a default value should be passed to the parameter. E.g., the default value for a `QString` parameter is enclosed into `QStringLiteral`.
-Instead of relying on the event structure definition in the OpenAPI files, `gtad.yaml` uses pointers to libQMatrixClient's event structures: `EventPtr`, `RoomEventPtr` and `StateEventPtr`. Respectively, arrays of events, when encountered in OpenAPI definitions, are converted to `Events`, `RoomEvents` and `StateEvents` containers. When there's no way to figure the type from the definition, an opaque `QJsonObject` is used, leaving the conversion to the library and/or client code.
+Instead of relying on the event structure definition in the OpenAPI files, `gtad.yaml` uses pointers to libQuotient's event structures: `EventPtr`, `RoomEventPtr` and `StateEventPtr`. Respectively, arrays of events, when encountered in OpenAPI definitions, are converted to `Events`, `RoomEvents` and `StateEvents` containers. When there's no way to figure the type from the definition, an opaque `QJsonObject` is used, leaving the conversion to the library and/or client code.
### Library API and doc-comments
@@ -205,12 +205,12 @@ implementation details as much as possible. `_impl` namespace is reserved for
definitions that should not be used by clients and are not covered by
API guarantees.
-Note: As of now, all header files of libQMatrixClient are considered public; this may change eventually.
+Note: As of now, all header files of libQuotient are considered public; this may change eventually.
### Qt-flavoured C++
This is our primary language. A particular code style is not enforced _yet_ but
-[the PR imposing the common code style](https://github.com/QMatrixClient/libqmatrixclient/pull/295)
+[the PR imposing the common code style](https://github.com/quotient-im/libQuotient/pull/295)
is planned to arrive in version 0.6.
* 4-space indents, no tabs, no trailing spaces, no last empty lines. If you
spot the code abusing these - we'll thank you for fixing it.
@@ -231,7 +231,7 @@ is planned to arrive in version 0.6.
make sure to read about the rule of zero if you haven't before, it's not
what you might think it is.
* Qt containers are generally preferred to STL containers; however, there are
- notable exceptions, and libQMatrixClient already uses them:
+ notable exceptions, and libQuotient already uses them:
* `std::array` and `std::deque` have no direct counterparts in Qt.
* Because of COW semantics, Qt containers cannot hold uncopyable classes.
Classes without a default constructor are a problem too. Examples of that
@@ -276,14 +276,14 @@ Exercise the [principle of least privilege](https://en.wikipedia.org/wiki/Princi
Protect private information, in particular passwords and email addresses. Absolutely _don't_ spill around this information in logs - use `access_token` and similar opaque ids instead, and only display those in UI where needed. Do not forget about local access to data (in particular, be very careful when storing something in temporary files, let alone permanent configuration or state). Avoid mechanisms that could be used for tracking where possible (we do need to verify people are logged in but that's pretty much it), and ensure that third parties can't use interactions for tracking. Matrix protocols evolve towards decoupling the personally identifiable information from user activity entirely - follow this trend.
-We want the software to have decent performance for typical users. At the same time we keep libQMatrixClient single-threaded as much as possible, to keep the code simple. That means being cautious about operation complexity (read about big-O notation if you need a kickstart on the topic). This especially refers to operations on the whole timeline and the list of users - each of these can have tens of thousands of elements so even operations with linear complexity, if heavy enough, can produce noticeable GUI freezing. When you don't see a way to reduce algorithmic complexity, embed occasional `processEvents()` invocations in heavy loops (see `Connection::saveState()` to get the idea).
+We want the software to have decent performance for typical users. At the same time we keep libQuotient single-threaded as much as possible, to keep the code simple. That means being cautious about operation complexity (read about big-O notation if you need a kickstart on the topic). This especially refers to operations on the whole timeline and the list of users - each of these can have tens of thousands of elements so even operations with linear complexity, if heavy enough, can produce noticeable GUI freezing. When you don't see a way to reduce algorithmic complexity, embed occasional `processEvents()` invocations in heavy loops (see `Connection::saveState()` to get the idea).
Having said that, there's always a trade-off between various attributes; in particular, readability and maintainability of the code is more important than squeezing every bit out of that clumsy algorithm. Beware of premature optimization and have profiling data around before going into some hardcore optimization.
Speaking of profiling logs (see README.md on how to turn them on) - in order
to reduce small timespan logging spam, there's a default limit of at least
200 microseconds to log most operations with the PROFILER
-(aka libqmatrixclient.profile.debug) logging category. You can override this
+(aka quotient.profile.debug) logging category. You can override this
limit by passing the new value (in microseconds) in PROFILER_LOG_USECS to
the compiler. In the future, this parameter will be made changeable at runtime
_if_ needed.
@@ -337,7 +337,7 @@ When writing git commit messages, try to follow the guidelines in
## Reuse (libraries, frameworks, etc.)
-C++ is unfortunately not very coherent about SDK/package management, and we try to keep building the library as easy as possible. Because of that we are very conservative about adding dependencies to libQMatrixClient. That relates to additional Qt components and even more to other libraries. Fortunately, even the Qt components now in use (Qt Core and Network) are very feature-rich and provide plenty of ready-made stuff.
+C++ is unfortunately not very coherent about SDK/package management, and we try to keep building the library as easy as possible. Because of that we are very conservative about adding dependencies to libQuotient. That relates to additional Qt components and even more to other libraries. Fortunately, even the Qt components now in use (Qt Core and Network) are very feature-rich and provide plenty of ready-made stuff.
Regardless of the above paragraph (and as mentioned earlier in the text), we're now looking at possible options for futures and automated testing, so PRs onboarding those will be considered with much gratitude.
@@ -350,16 +350,15 @@ Some cases need additional explanation:
from KDE Frameworks. We don't rule this out and there's no prejudice against
KDE; it just so happened that KDE Frameworks is one of most obvious
reuse candidates but so far none of these components survived
- as libQMatrixClient deps. So we are cautious. Extra notice to KDE folks:
- I'll be happy if an addon library on top of libQMatrixClient is made using
+ as libQuotient deps. So we are cautious. Extra notice to KDE folks:
+ I'll be happy if an addon library on top of libQuotient is made using
KDE facilities, and I'm willing to take part in its evolution; but please
also respect LXDE people who normally don't have KDE frameworks installed.
-* Never forget that libQMatrixClient is aimed to be a non-visual library;
+* Never forget that libQuotient is aimed to be a non-visual library;
QtGui in dependencies is only driven by (entirely offscreen) dealing with
QImages. While there's a bunch of visual code (in C++ and QML) shared
- between libQMatrixClient-enabled _applications_, this is likely to end up
- in a separate (libQMatrixClient-enabled) library, rather than
- libQMatrixClient itself.
+ between Quotient-enabled _applications_, this is likely to end up
+ in a separate (Quotient-enabled) library, rather than libQuotient itself.
## Attribution
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index 64a80350..1e3f172b 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -13,7 +13,8 @@ Text between <!-- and --​> marks will be invisible in the report.
### Description
-Describe here the problem that you are experiencing, or the feature you are requesting.
+Describe here the problem that you are experiencing, or the feature
+you are requesting.
### Steps to reproduce
@@ -23,17 +24,25 @@ Describe here the problem that you are experiencing, or the feature you are requ
Describe how what happens differs from what you expected.
-libqmatrixclient-based clients either have a log file or dump log to the standard output.
-If you can identify any log snippets relevant to your issue, please include
-those here (please be careful to remove any personal or private data):
+libQuotient-based clients either have a log file or dump log
+to the standard output. If you can identify any log snippets relevant
+to your issue, please include those here (please be careful to remove
+any personal or private data):
### Version information
-<!-- IMPORTANT: please answer the following questions, to help us narrow down the problem -->
-
-- **The client application**: <!-- the problem might be not with the library but with the client -->
-- **libqmatrixclient version if you know it**: <!-- try to find it basing on the client version -->
-- **Qt version**: <!-- for Linux systems, it's usually installed system-wide; for other OSes,
-as well as Flatpak/AppImage/etc. containerised environments, it's a version used in the container. -->
-- **Install method**: <!-- package manager/Flatpak/archive downloaded (from which site?) -->
-- **Platform**: <!-- Operating system and anything about your platform you think can be relevant -->
+<!-- IMPORTANT: please answer the following questions,
+ to help us narrow down the problem -->
+
+- **The client application**:
+<!-- the problem might be not with the library but with the client -->
+- **libQuotient version if you know it**:
+<!-- try to find it basing on the client version -->
+- **Qt version**:
+<!-- for Linux systems, it's usually installed system-wide; for other OSes,
+as well as Flatpak/AppImage/etc. containerised environments,
+it's a version used in the container. -->
+- **Install method**:
+<!-- package manager/Flatpak/archive downloaded (from which site?) -->
+- **Platform**:
+<!-- Operating system and anything about your platform you think can be relevant -->
diff --git a/README.md b/README.md
index 787fa0df..5568101b 100644
--- a/README.md
+++ b/README.md
@@ -1,54 +1,57 @@
-# libQMatrixClient
+# libQuotient (former libQMatrixClient)
<a href='https://matrix.org'><img src='https://matrix.org/docs/projects/images/made-for-matrix.png' alt='Made for Matrix' height=64 target=_blank /></a>
-[![license](https://img.shields.io/github/license/QMatrixClient/libqmatrixclient.svg)](https://github.com/QMatrixClient/libqmatrixclient/blob/master/COPYING)
+[![license](https://img.shields.io/github/license/quotient-im/libQuotient.svg)](https://github.com/quotient-im/libQuotient/blob/master/COPYING)
![status](https://img.shields.io/badge/status-beta-yellow.svg)
-[![release](https://img.shields.io/github/release/QMatrixClient/libqmatrixclient/all.svg)](https://github.com/QMatrixClient/libqmatrixclient/releases/latest)
+[![release](https://img.shields.io/github/release/quotient-im/libQuotient/all.svg)](https://github.com/quotient-im/libQuotient/releases/latest)
[![](https://img.shields.io/cii/percentage/1023.svg?label=CII%20best%20practices)](https://bestpractices.coreinfrastructure.org/projects/1023/badge)
-![](https://img.shields.io/github/commit-activity/y/QMatrixClient/libQMatrixClient.svg)
+![](https://img.shields.io/github/commit-activity/y/quotient-im/libQuotient.svg)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
-libQMatrixClient is a Qt5-based library to make IM clients for the [Matrix](https://matrix.org) protocol. It is the backbone of [Quaternion](https://github.com/QMatrixClient/Quaternion), [Spectral](https://matrix.org/docs/projects/client/spectral.html) and some other projects.
+The Quotient project aims to produce a Qt5-based SDK to develop applications
+for [Matrix](https://matrix.org). libQuotient is a library that enables client
+applications. It is the backbone of
+[Quaternion](https://github.com/quotient-im/Quaternion),
+[Spectral](https://matrix.org/docs/projects/client/spectral.html) and
+other projects.
+Versions 0.5.x and older use the previous name - libQMatrixClient.
## Contacts
-You can find authors of libQMatrixClient in the Matrix room:
-[#qmatrixclient:matrix.org](https://matrix.to/#/#qmatrixclient:matrix.org).
+You can find Quotient developers in the Matrix room:
+[#quotient:matrix.org](https://matrix.to/#/#quotient:matrix.org).
-You can also file issues at
-[the project's issue tracker](https://github.com/QMatrixClient/libqmatrixclient/issues).
+You can file issues at
+[the project issue tracker](https://github.com/quotient-im/libQuotient/issues).
If you find what looks like a security issue, please use instructions
in SECURITY.md.
-## Building and usage
-So far the library is typically used as a git submodule of another project
-(such as Quaternion); however it can be built separately (either as a static or
-as a dynamic library). After installing the library the CMake package becomes
-available for `find_package(QMatrixClient)` to setup the client code with
-the installed library files. PRs to enable the same for qmake are most welcome.
-
-[The source code is hosted at GitHub](https://github.com/QMatrixClient/libqmatrixclient) -
-checking out a certain commit or tag (rather than downloading the archive) is
-the recommended way for one-off building. If you want to hack on the library
-as a part of another project (e.g. you are working on Quaternion but need
-to do some changes to the library code), you're advised to make a recursive
-check out of that project (in this case, Quaternion) and update
-the library submodule to its master branch.
-
-Tags consisting of digits and periods represent released versions; tags ending with `-betaN` or `-rcN` mark pre-releases. If/when packaging pre-releases, it is advised to replace a dash with a tilde.
+## Getting and using libQuotient
+Depending on your platform, the library can come as a separate package.
+Recent releases of Debian and OpenSuSE, e.g., already have the package
+(under the old name). If your Linux repo doesn't provide binary package
+(either libqmatrixclient - older - or libquotient - newer), or you're
+on Windows or macOS, your best bet is to build the library from the source
+and bundle it with your application. In
### Pre-requisites
-- a Linux, macOS or Windows system (desktop versions tried; Ubuntu Touch is known to work; mobile Windows and iOS might work too but never tried)
- - For Ubuntu flavours - zesty or later (or a derivative) is good enough out of the box; older ones will need PPAs at least for a newer Qt; in particular, if you have xenial you're advised to add Kubuntu Backports PPA for it
-- a Git client to check out this repo
-- Qt 5 (either Open Source or Commercial), version 5.6 or higher
- (5.9 or higher is strongly recommended)
-- a build configuration tool:
- - CMake (from your package management system or [the official website](https://cmake.org/download/))
+- A Linux, macOS or Windows system (desktop versions tried; Ubuntu Touch
+ is known to work; mobile Windows and iOS might work too but never tried)
+ - For Ubuntu flavours - zesty or later is good enough out of the box;
+ older ones will need PPAs at least for a newer Qt. In particular,
+ if you (still) have xenial and cannot upgrade to a newer release
+ you'll have to add Kubuntu Backports PPA for it.
+- Qt 5 (either Open Source or Commercial), 5.9 or higher.
+- A build configuration tool:
+ - CMake (from your package management system or
+ [the official website](https://cmake.org/download/))
- or qmake (comes with Qt)
-- a C++ toolchain supported by your version of Qt (see a link for your platform at [the Qt's platform requirements page](http://doc.qt.io/qt-5/gettingstarted.html#platform-requirements))
- - GCC 5 (Windows, Linux, macOS), Clang 5 (Linux), Apple Clang 8.1 (macOS) and Visual C++ 2015 (Windows) are the oldest officially supported; Clang 3.8 and GCC 4.9.2 are known to still work, maintenance patches for them are accepted
- - any build system that works with CMake and/or qmake should be fine: GNU Make, ninja (any platform), NMake, jom (Windows) are known to work.
+- A C++ toolchain with C++14 support
+ - GCC 5 (Windows, Linux, macOS), Clang 5 (Linux), Apple Clang 8.1 (macOS)
+ and Visual Studio 2017 (Windows) are the oldest officially supported;
+ Clang 3.8, GCC 4.9.2, VS 2015 may work but not actively maintained.
+- Any build system that works with CMake and/or qmake should be fine:
+ GNU Make, ninja (any platform), NMake, jom (Windows) are known to work.
#### Linux
Just install things from the list above using your preferred package manager. If your Qt package base is fine-grained you might want to run cmake/qmake and look at error messages. The library is entirely offscreen (QtCore and QtNetwork are essential) but it also depends on QtGui in order to handle avatar thumbnails.
@@ -60,35 +63,73 @@ Just install things from the list above using your preferred package manager. If
1. Install Qt5, using their official installer.
1. If you plan to build with CMake, install CMake; if you're ok with qmake, you don't need to install anything on top of Qt. The commands in further sections imply that cmake/qmake is in your PATH - otherwise you have to prepend those commands with actual paths. As an option, it's a good idea to run a `qtenv2.bat` script that can be found in `C:\Qt\<Qt version>\<toolchain>\bin` (assuming you installed Qt to `C:\Qt`); the only thing it does is adding necessary paths to PATH. You might not want to run that script on system startup but it's very handy to setup the environment before building. For CMake, setting `CMAKE_PREFIX_PATH` in the same way as for macOS (see above), also helps.
-There are no official MinGW-based 64-bit packages for Qt. If you're determined to build a 64-bit library, either use a Visual Studio toolchain or build Qt5 yourself as described in Qt documentation.
-
-### Building
-#### CMake-based
+### Using the library
+If you use CMake, `find_package(Quotient)` sets up the client code to use
+libQuotient, assuming the library development files are installed. There's no
+documented procedure to use a preinstalled library with qmake; consider
+introducing a submodule in your source tree and build it along with the rest
+of the application for now. Patches to provide .prl files for qmake
+are welcome.
+
+Building with dynamic linkage are only tested on Linux at the moment and are
+a recommended way of linking your application with libQuotient on this platform.
+Feel free
+Static linkage is the default on Windows/macOS; feel free to experiment
+with dynamic linking and submit PRs if you get reusable results.
+
+The example/test application that comes with libQuotient,
+[qmc-example](https://github.com/quotient-im/libQuotient/tree/master/examples)
+includes most common use cases such as sending messages, uploading files,
+setting room state etc.; for more extensive usage check out the source code
+of [Quaternion](https://github.com/quotient-im/Quaternion)
+(the reference client of Quotient) or [Spectral](https://gitlab.com/b0/spectral).
+
+To ease the first step, `examples/CMakeLists.txt` is a good starting point
+for your own CMake-based project using libQuotient.
+
+## Building the library
+[The source code is at GitHub](https://github.com/quotient-im/libQuotient).
+Checking out a certain commit or tag (rather than downloading the archive)
+along with submodules is strongly recommended. If you want to hack on
+the library as a part of another project (e.g. you are working on Quaternion
+but need to do some changes to the library code), it makes sense
+to make a recursive check out of that project (in this case, Quaternion)
+and update the library submodule (also recursively) to its master branch.
+
+Tags consisting of digits and periods represent released versions; tags ending
+with `-betaN` or `-rcN` mark pre-releases. If/when packaging pre-releases,
+it is advised to replace a dash with a tilde.
+
+### CMake-based
In the root directory of the project sources:
-```
+```shell script
mkdir build_dir
cd build_dir
cmake .. # Pass -DCMAKE_PREFIX_PATH and -DCMAKE_INSTALL_PREFIX here if needed
cmake --build . --target all
```
-This will get you the compiled library in `build_dir` inside your project sources. Static builds are tested on all supported platforms. Dynamic builds of libqmatrixclient are only tested on Linux at the moment; experiments with dynamic builds on Windows/macOS are welcome. Taking a look at [qmc-example](https://github.com/QMatrixClient/libqmatrixclient/tree/master/examples) (used to test the library) should give you a basic idea of using libQMatrixClient; for more extensive usage check out the source code of [Quaternion](https://github.com/QMatrixClient/Quaternion) (the reference client built on QMatrixClient).
+This will get you the compiled library in `build_dir` inside your project
+sources. Static builds are tested on all supported platforms.
You can install the library with CMake:
-```
+```shell script
cmake --build . --target install
```
-This will also install cmake package config files; once this is done, you can use `examples/CMakeLists.txt` to compile the example with the _installed_ library. This file is a good starting point for your own CMake-based project using libQMatrixClient.
-Installation of `qmc-example` application can be skipped by setting `QMATRIXCLIENT_INSTALL_EXAMPLE` to `OFF`.
+This will also install cmake package config files; once this is done, you
+should be able to use `examples/CMakeLists.txt` to compile qmc-example
+with the _installed_ library. Installation of the `qmc-example` binary
+along with the rest of the library can be skipped
+by setting `QMATRIXCLIENT_INSTALL_EXAMPLE` to `OFF`.
-#### qmake-based
+### qmake-based
The library provides a .pri file with an intention to be included from a bigger project's .pro file. As a starting point you can use `qmc-example.pro` that will build a minimal example of library usage for you. In the root directory of the project sources:
-```
+```shell script
qmake qmc-example.pro
make all
```
This will get you `debug/qmc-example` and `release/qmc-example` console executables that login to the Matrix server at matrix.org with credentials of your choosing (pass the username and password as arguments), run a sync long-polling loop and do some tests of the library API.
-Installing the library with qmake is not possible; similarly, a .prl file is not provided. A PR to fix this is welcome.
+Installing the standalone library with qmake is not implemented yet.
## Troubleshooting
@@ -105,19 +146,33 @@ CMake Warning at CMakeLists.txt:11 (find_package):
#### Logging configuration
-libqmatrixclient uses Qt's logging categories to make switching certain types of logging easier. In case of troubles at runtime (bugs, crashes) you can increase logging if you add the following to the `QT_LOGGING_RULES` environment variable:
+libQuotient uses Qt's logging categories to make switching certain types of logging easier. In case of troubles at runtime (bugs, crashes) you can increase logging if you add the following to the `QT_LOGGING_RULES` environment variable:
```
-libqmatrixclient.<category>.<level>=<flag>
+quotient.<category>.<level>=<flag>
```
where
-- `<category>` is one of: `main`, `jobs`, `jobs.sync`, `events`, `events.ephemeral`, and `profiler` (you can always find the full list in the file `logging.cpp`)
+- `<category>` is one of: `main`, `jobs`, `jobs.sync`, `events`, `events.ephemeral`, and `profiler` (you can always find the full list in the file `lib/logging.cpp`)
- `<level>` is one of `debug` and `warning`
- `<flag>` is either `true` or `false`.
-`*` can be used as a wildcard for any part between two dots, and comma is used for a separator. Latter statements override former ones, so if you want to switch on all debug logs except `jobs` you can set
+`*` can be used as a wildcard for any part between two dots, and semicolon is used for a separator. Latter statements override former ones, so if you want to switch on all debug logs except `jobs` you can set
+```shell script
+QT_LOGGING_RULES="quotient.*.debug=true;quotient.jobs.debug=false"
```
-QT_LOGGING_RULES="libqmatrixclient.*.debug=true,libqmatrixclient.jobs.debug=false"
+Note that `quotient` is a prefix that only works since version 0.6 of
+the library; 0.5.x and older used `libqmatrixclient` instead. If you happen
+to deal with both libQMatrixClient-era and Quotient-era versions,
+it's reasonable to use both prefixes, to make sure you're covered with no
+regard to the library version. For example, the above setting could look like
+```shell script
+QT_LOGGING_RULES="libqmatrixclient.*.debug=true;libqmatrixclient.jobs.debug=false;quotient.*.debug=true;quotient.jobs.debug=false"
```
#### Cache format
-In case of troubles with room state and caching it may be useful to switch cache format from binary to JSON. To do that, set the following value in your client's configuration file/registry key (you might need to create the libqmatrixclient key for that): `libqmatrixclient/cache_type` to `json`. This will make cache saving and loading work slightly slower but the cache will be in a text JSON file (very long and unindented so prepare a good JSON viewer or text editor with JSON formatting capabilities).
+In case of troubles with room state and caching it may be useful to switch
+cache format from binary to JSON. To do that, set the following value in
+your client's configuration file/registry key (you might need to create
+the libqmatrixclient key for that): `libqmatrixclient/cache_type` to `json`.
+This will make cache saving and loading work slightly slower but the cache
+will be in a text JSON file (very long and unindented so prepare a good
+JSON viewer or text editor with JSON formatting capabilities).