annotate src/services/services.cc @ 187:9613d72b097e

*: multiple performance improvements like marking `static const` when it makes sense... date: change old stupid heap-based method to a structure which should make copying the thing actually make a copy. also many performance-based changes, like removing the std::tie dependency and forward-declaring nlohmann json *: replace every instance of QString::fromUtf8 to Strings::ToQString. the main difference is that our function will always convert exactly what is in the string, while some other times it would only convert up to the nearest NUL byte
author Paper <mrpapersonic@gmail.com>
date Wed, 06 Dec 2023 13:43:54 -0500
parents 80f49f623d30
children c130f47f6f48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
1 #include "services/services.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
2 #include "core/session.h"
63
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 52
diff changeset
3 #include "gui/dialog/settings.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
4 #include "services/anilist.h"
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 44
diff changeset
5 #include <QMessageBox>
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
6
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
7 namespace Services {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
8
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
9 void Synchronize() {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
10 switch (session.config.service) {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
11 case Anime::Services::ANILIST: AniList::GetAnimeList(); break;
112
80f49f623d30 locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
12 default: break;
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
13 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
14 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
15
52
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
16 void UpdateAnimeEntry(int id) {
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
17 switch (session.config.service) {
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
18 case Anime::Services::ANILIST: AniList::UpdateAnimeEntry(id); break;
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
19 default: break;
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
20 }
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
21 }
0c4138de2ea7 anime list: we are finally read-write
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
22
44
619cbd6e69f9 filesystem: fix CreateDirectories function
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
23 bool Authorize() {
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
24 switch (session.config.service) {
63
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 52
diff changeset
25 case Anime::Services::ANILIST: return AniList::AuthorizeUser();
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 52
diff changeset
26 default: return true;
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
27 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
28 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
29
44
619cbd6e69f9 filesystem: fix CreateDirectories function
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
30 }; // namespace Services