aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-01-17Room::getPreviousContent(): Don't skip if the last job just finishedKitsune Ral
working The sequence is: RoomMessagesJob::success -> addHistoricalMessageEvents -> MessageEventModel notification -> QML notification about model reset -> MessageEventModel completes updating -> QML updates from the model but by then scrolling has already stopped at the oldest (just loaded) event -> since there's no momentum, next batch is not fetched. In order to address this, two things are done: in QML, the current position is checked in modelReset() handler; in Room (this commit), prev_batch is updated before historical messages are added (and the model gets notified, respectively), to prevent firing another job with the old prev_batch.
2018-01-17Room::downloadFile(): make sure temporary file names don't clashKitsune Ral
Particularly in case when there are two events that have an image with the same file name (image.png).
2018-01-16EventContent: inject mediaThumbnailId into content original JSONKitsune Ral
For QML to easily make URLs to thumbnails.
2018-01-15EventContent: provide mediaId in the top-level JSON, not in "info" subobjectKitsune Ral
Given that it's a sidedoor anyway, it should at least be straightforward to use.
2018-01-15DownloadFileJob: Be tolerant to request retriesKitsune Ral
2018-01-15One more fix, this time for MSVC 2015 onlyKitsune Ral
Making a structure from an initializer list seems to be a problem for it if initializers are defined in the structure.
2018-01-15EventContent: rewrite without mixinsKitsune Ral
MSVC is not good at dealing with type parameter packs of member functions, which is what the whole mixin magic in UrlBasedContent<> relied on. So it's one more level of inheritance instead of mixins now.
2018-01-14RoomEvent-aware file up/downloads along with status trackingKitsune Ral
Closes #121; closes #122.
2018-01-14Refactor EventContent; allow to easily check files out of message eventsKitsune Ral
The whole inheritance/templating structure has been considerably simplified by using a trick with mixin classes; thanks to that, *Info classes are no more templated, they are just mixed together by the almighty UrlBasedContent<> template (but the same can easily be done outside of it, as LocationContent implementation shows). RoomMessageEvent has gained hasFileContent(); it's also possible to easily get a FileInfo core object just by calling msgEvent->content()->fileInfo().
2018-01-14User: Q_PROPERTYs; setAvatar()Kitsune Ral
2018-01-14Connection: files up/downloading supportKitsune Ral
2018-01-14Connection::getThumbnail: Add an overload for QStringKitsune Ral
Connection::getThumbnail(QString,...) is better fitting to retrieve images for QML image providers - one doesn't need to create a QUrl (which if made naively ends up being incorrect) and also doesn't need to stack up "mxc://" before the mediaId. Just call Connection::getThumbnail with the id the QML engine gives you.
2018-01-14DownloadFileJobKitsune Ral
Instead of exposing a QIODevice as GetContentJob does it gets a filename and saves the incoming payload into it.
2018-01-14BaseJob: afterStart(), beforeAbandon(), up/downloadProgress()Kitsune Ral
To support the upcoming DownloadFileJob
2018-01-14Drop extraneous #include <QString>Kitsune Ral
2018-01-14BaseJob::Data -> RequestData; support QIODevice* input/outputKitsune Ral
2018-01-14Merge branch 'master' into kitsune-content-repo-create-roomKitsune Ral
2018-01-12BaseJob::maxRetries: Align the type with that of JobTimeoutConfigKitsune Ral
Fixes some signedness warnings
2018-01-12Event/RoomEvent: use Q_DECLARE_METATYPE properlyKitsune Ral
2018-01-12Qualify a bind() invocation with 'std::'; use an actual value instead of a ↵Kitsune Ral
placeholder An unqualified bind() seems to upset some build environments; also, use a User* value at hand instead of binding it at the moment of signal-slot triggering.
2018-01-09MediaThumbnailJob: Rewire to GetContentThumbnailJob; decommission ThumbnailTypeKitsune Ral
"crop" thumbnail type didn't seem to be ever used. Once GTAD is able to generate enums, the respective code will show up in GetContentThumbnailJob and this parameter can be reintroduced in MediaThumbnailJob. As of now, just rely on the default "scale" value.
2018-01-09jobs/generated: content-repo.*, create_room.*Kitsune Ral
2018-01-09jobs: expect application/json by default; set query in constructor body; ↵Kitsune Ral
properly convert numbers to strings in query The query should be set in constructor body because there's no reason to pass non-required parameters into the query. As for numbers to strings conversion - there was an attempt to use QJsonValue(a).toString() for that. That doesn't work; QJsonValue does not turn numbers to strings.
2018-01-09jobs/generated: Use BaseJob::addExpectedContentType()Kitsune Ral
2018-01-09BaseJob: Provide a simplified constructorKitsune Ral
2018-01-09BaseJob, MediaThumbnailJob: Support request and response headersKitsune Ral
Enable specifying headers in the request and checking/using headers in the response.
2018-01-09jobs/generated: Polish formatting; other minor cleanupKitsune Ral
2018-01-09BaseJob: change initial job status from NoError to PendingKitsune Ral
Otherwise isJobRunning() is of no great use.
2018-01-09Fix an occasional crash when resolving a server nameKitsune Ral
Closes #149.
2018-01-09Avatar: Use QPointer<> and isJobRunning()Kitsune Ral
2018-01-09Avatar: Mark get() as const operationKitsune Ral
With all the liberty that pimpl idiom gives it's easy to get away without proper const's; but let's be consistent :)
2018-01-09isJobRunning() facility functionKitsune Ral
2018-01-09Avatar: Use Connection::getThumbnail instead of callApi<>Kitsune Ral
2018-01-06Add a missing #includeKitsune Ral
std::bind belongs to <functional>, don't rely on implicitly including it from other standard headers.
2017-12-30BaseJob: do not suppress SSL errorsKitsune Ral
It is the application's responsibility to properly display the error and get confirmation from the user about it.
2017-12-30QMatrixClient::NetworkAccessManager (singleton Qt NAM that remembers ignored ↵Kitsune Ral
SSL errors) Closes #145.
2017-12-29Don't use generic lambdas in initialisersKitsune Ral
This seems to upset MSVC.
2017-12-29Fix building with Microsoft's standard libraryKitsune Ral
2017-12-29Allow to customize and connect to the used QNetworkAccessManager from clientsKitsune Ral
We don't really want to let the world know that we use the only instance of NAM; instead, we provide a point of customisation to whatever NAM is created in ConnectionData, in the form of a static customizeNetworkAccess() method that gets a function to run on a/the created NAM. This function can do additional configuration on NAM (such as setting a proxy factory, network configuration, or caching) and/or connect to its signals, such as sslErrors() and proxyAuthenticationRequired(). Closes #143.
2017-12-29Use std::unique_ptr instead of bare pointers; cleanup stale declarationsKitsune Ral
2017-12-28NetworkSettings: add setupApplicationProxy() accessible from QML; proxyPort ↵Kitsune Ral
is quint16 now setupApplicationProxy(), so that clients in QML could apply changes in proxy settings without going down to C++. quint16, because this is a type actually used by QNetworkProxy.
2017-12-28Switch from QPixmap to QImage; add convenience avatar() overloads to Room ↵Kitsune Ral
and User The switch is necessary because MediaThumbnailJob is supposed to return something that can be worked on in non-GUI threads (as is the case of QML image providers), and QPixmap is not supposed for usage out of the main thread.
2017-12-27Introduce StateEventBase - a non-template base for StateEvent<>Kitsune Ral
This will hold common logic for all state events, including the newly introduced repeatsState() that returns true when prev_content repeats content. This will be used to address QMatrixClient/Quaternion#245.
2017-12-27StateEvent<>: Look for prev_content in unsigned, not top-levelKitsune Ral
2017-12-26NetworkSettings: store proxy configurationKitsune Ral
No credentials, just type, host, and port.
2017-12-26Settings: factored out common declarations/definitions to macrosKitsune Ral
It cannot be made in templates because property and methods names are involved.
2017-12-25CMakeLists: Add -W to the mixKitsune Ral
2017-12-25qmake: Use QMAKE_CXX_FLAGS_WARN_ON rather than QMAKE_CXX_FLAGSKitsune Ral
Because the damn thing puts QMAKE_CXX_FLAGS before what's put by CONFIG, and CONFIG injects -W -Wall that cancels -Wno-unused-parameter.
2017-12-25Connection: change the attempt number propagated from BaseJobKitsune Ral
2017-12-25BaseJob: further minor code cleanupKitsune Ral