aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
AgeCommit message (Collapse)Author
2018-03-05Room: addTag() and removeTag()Kitsune Ral
Slightly changed TagRecord constructors to match.
2018-03-05Room::toJson(): Fix caching of tagsKitsune Ral
2018-03-05ReadMarkerEvent; TagEvent remade with less boilerplate codeKitsune Ral
tagevent.h -> accountdataevents.h now has a macro to define more simplistic events along the lines of simplestateevents.h but inheriting from Event instead. TagEvent and ReadMarkerEvent(m.fully_read) are defined using this macro. ReadMarkerEvent is also wired through event.* (but not further yet).
2018-03-05Support saving account data on the serverKitsune Ral
Closes #152. Saving of specific event types should be added separately.
2018-03-04Room::toJson(): Use QJsonObject/Array modern constructors; check execution timeKitsune Ral
Now that we're on Qt 5.6 we can afford brace-initialization of those objects.
2018-03-03Improve compatibility with gcc 4.9 to be able to build for Android with ↵Roman Plášil
QtCreator
2018-03-01Fix tags saving/restoring (finally)Kitsune Ral
Closes #134.
2018-02-28Profiling logs: added µs, less empty profiling log linesKitsune Ral
Closes #177.
2018-02-27Room: Save tags in the cache; isFavourite() and isLowPriority()Kitsune Ral
2018-02-26Room and Connection: support room tagsKitsune Ral
Closes #134.
2018-02-26Room: show 1-on-1 invitations in a better wayKitsune Ral
Previously it was just an "Empty room" name, now it's "Invitation from %1".
2018-02-24User/Room: signal that a user/member is about to change the nameKitsune Ral
Enables to address QMatrixClient/Quaternion#284. Also fixes a gibberish condition in Room::Private::renameMember() that led to improper warnings and a too early return.
2018-02-24Support per-room user traitsKitsune Ral
User::Private stores two new maps (for display names and avatars respectively) and is able to retrieve and store names/avatars on a per-room basis. The "most used" trait is stored separately and room lists are not kept for it (because most people have a single name and a single avatar across all or most rooms). TODO: The avatar container should be replaced with something less clumsy; the current code doesn't even compile with MSVC. A "handle" copyable structure that would hold the Avatar is one of options. Closes #141.
2018-02-23Room: user() and memberJoinState(); code cleanupKitsune Ral
Room::user() came instead of Room::Private::member() and memberJoinState() came instead of Private::hasMember.
2018-02-23Avatar: provide common logic for uploading; don't store ConnectionKitsune Ral
Although the setting part of the work is class(User or Room)-specific, the uploading part is common, so Avatar provides it now. Also: there's no need to store Connection, as it's only used in get() and upload() - just pass it as the parameter to the methods.
2018-02-03Room: urlToDownload() and urlToThumbnail()Kitsune Ral
Closes #168.
2018-02-01On Windows, make sure the downloaded file has a proper extensionKitsune Ral
Closes #287.
2018-02-01Log transferred bytes in PROFILER categoryKitsune Ral
2018-02-01Room::fileNameToDownload: get a sensible initial name for the file pickerKitsune Ral
Works (at least, should work) with both Qt Widgets and QML.
2018-02-01Add GCC 4.9.2 to the workaround path for FileTransferInfo codeKitsune Ral
Closes #161. Doesn't make GCC 4.9.2 officially supported but libqmatrixclient can be compiled with it as of now.
2018-01-30Room: setName(), setCanonicalAlias()Kitsune Ral
2018-01-30User: fullName, isGuest, better doc commentsKitsune Ral
User::fullName() is used in Room::roomMembername now. That string construction may be further cached now if it ever becomes a bottleneck.
2018-01-25Room, User: expose avatarMediaId(); declare User for the metatype systemKitsune Ral
To make it easy to use User objects and fetch room and user avatars from QML. Closes #155.
2018-01-25Room, User: const-tighten up the code, set QObject namesKitsune Ral
To make debugging (including QML debugging) more convenient.
2018-01-25Expose avatar URLs of Room and User as Q_PROPERTYKitsune Ral
This is needed for QML integration. Closes #155.
2018-01-25Room::toJson: fix invite state cachingKitsune Ral
Causes a cache version upgrade; the old cache stores the state in an incorrect place that won't be supported. Closes #159.
2018-01-25Room::Private::toJson: don't save zero numbersKitsune Ral
2018-01-22Room: emit addedMessages() before possible read marker auto-promotionKitsune Ral
Read marker auto-promotion may be bound to a dataChanged() signal in the client model, while a routine connection for addedMessages() is endInsertRows(). Emitting endInsertRows() after dataChanged() over the same rows has unpredictable consequences for representation of data in those rows - hence the fix.
2018-01-22Room::setLastReadEvent: don't update if the event is the sameKitsune Ral
2018-01-20Room: store the first displayed event as well; Room::*DisplayedMarker() methodsKitsune Ral
2018-01-18Typo fixKitsune Ral
2018-01-18Room: add properties for shown (room/event), message and members countKitsune Ral
Closes #151.
2018-01-18Move links pretty-printing code from Quaternion to libKitsune Ral
This code is useful for all clients, and extensions to pretty-printing can be later added either via making prettyPrint() virtual or even by providing a registry of additional "text transformers" or even "event content renderers" applied to visualise the event.
2018-01-17Fix a mistake reported by Clang static analyzerKitsune Ral
2018-01-17Fix an occasional crash introduced by the previous commitKitsune Ral
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-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-14RoomEvent-aware file up/downloads along with status trackingKitsune Ral
Closes #121; closes #122.
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-06Add a missing #includeKitsune Ral
std::bind belongs to <functional>, don't rely on implicitly including it from other standard headers.
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-25Room: Remove C++14 code from the header fileKitsune Ral
This will provide some backwards-compatibility to clients that are not ready to move _their_ code to C++14 (at least, it will allow them to not add C++14 requirement to their makefiles as of yet).
2017-12-25Now really switching to the new toolchain: C++14, GCC/Clang 5, Qt 5.6Kitsune Ral
Also a bit of code tightening with some C++14 (but not only) things.
2017-12-14Another fix for CI on OSXKitsune Ral
2017-12-14Add a missing header to fixing building on OSXKitsune Ral
2017-12-14Fixed building with older compilersKitsune Ral
2017-12-14Move all internal event pointers to std::unique_ptr<>Kitsune Ral
This causes the following changes along the way: - Owning<> template is decommissioned. - event.h has been rearranged, and Event/RoomEvent::fromJson static methods have been replaced with an external makeEvent<> function template. A side effect of that is that one cannot use a factory with a type other than the one it's defined for (i.e. you cannot call makeEvent<TypingEvent>) but that feature has been out of use for long anyway. - Room::doAddNewMessageEvents() and Room::doAddHistoricalMessageEvents() have been removed, giving place to Room::onAddNewTimelineEvents() and Room::onAddHistoricalTimelineEvents(). The most important difference is that all code that must be executed now resides in addNewMessageEvents() (it moved from Room to Room::Private) and classes inheriting from Room are not obliged to call the overridden function from the overriding function (they can do it but those functions have empty bodies in Room). This was a long overdue change, and owning pointers simply mandated it. Room::onAddNewTimelineEvents/onAddHistoricalTimelineEvents should not do anything with the passed range in terms of ownership, it's just a way to allow the derived class to update his data in due course. - Room::Private::dropDuplicateEvents() and Room::Private::insertEvents(), notably, have been updated to work with owning pointers. insertEvents() move()s pointers to the timeline, while dropDuplicateEvents uses remove_if instead of stable_partition and doesn't explicitly delete event objects. Also, a bugfix: Event accidentally had not virtual destructor for quite a long time. According to the standard, deleting an object through a pointer to a base class without a virtual destructor leads to UB. So the fact that libqmatrixclient clients even worked all these months is mere coincidence and compiler authors good will :-D
2017-12-14Room::markMessagesAsRead(): Move private overload to pimplKitsune Ral
2017-12-13Refactoring around Room::Private::insertEvent(s)Kitsune Ral