Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings classes #24

Merged
merged 12 commits into from
Sep 6, 2016
Merged

Settings classes #24

merged 12 commits into from
Sep 6, 2016

Conversation

KitsuneRal
Copy link
Member

This is a base for the respective code in Quaternion (PR for it will come shortly) that will store and pick up settings, using facilities provided by QSettings. It is based (but can be trivially rebased if necessary) on the previous PR that removes dead code; only two last commits are subject to review here.

Closer investigation found out that there are only two actually used member functions in ConnectionPrivate - provideRoom() and resolveServer(). These two have been transferred to Connection; and data members from ConnectionPrivate found new home in Connection::Private.

Factoring out room management and user management from Connection is still a pending task.
That might be not as efficient as a solution on variadic templates; but
arguably easier to understand.
…); accessors de-virtualized

Details:
 - New: Connection::homeserver(), returns the homeserver URL from inside ConnectionData
 - New/Modify: Connection::accessToken() and ConnectionData::accessToken() - because we will also have refresh tokens eventually; deprecate token() for the same reason
 - Modify: Connection::user(), token(), accessToken() are no more virtual (they should have never been, these are plain accessors, after all)
Settings is a trivial wrapper around QSettings that makes value() and setValue() available from QML (Tensor has the same class atm). SettingsGroup is a cleaner way to reach for sections inside QSettings. It doesn't refer to another QSettings class, rather derives from it and overrides functions that deal with groups. AccountSettings, contrary to the two above, is by no means generic: it serves the specific purpose of storing settings of a single account in a uniform way. Rationale of it is that key literals like "keep_logged_in" cannot be enforced, while function names can; and the same goes for QVariants stored inside - the class enforces specific types while allowing further extension by clients.

Note that functions in QSettings are not virtual, so all these classes are not polymorphic.
@KitsuneRal
Copy link
Member Author

2 commits turned 4. To support proper logout in Quaternion (which becomes quite relevant once Quaternion starts to auto-login) we have to do proper cleanup of an ongoing syncJob. Without that, the entire old tree of data objects that belongs to Connection becomes stuck on waiting for syncJob to complete and then fires signals to all the interface elements, occasionally landing on null pointers. Saving a syncJob pointer and explicitly abandoning it allows the rest to clean away automagically.

VS2013 doesn't like 'using' statements if a base class has private constructors (as in QSettings - Q_DISABLE_COPY makes a copy constructor private and deleted). Hence a workaround.
@KitsuneRal KitsuneRal merged commit 34e7ba2 into master Sep 6, 2016
@KitsuneRal KitsuneRal deleted the kitsune-settings branch September 6, 2016 23:34
KitsuneRal added a commit that referenced this pull request Jan 5, 2018
All of these new exclusions have parameters named 'signed', 'unsigned' and 'default' which are C++ reserverd words. GTAD does not give a proper workaround for these yet (see #24) so exclude them for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant