annotate src/gui/dialog/settings/services.cc @ 337:a7d4e5107531

dep/animone: REFACTOR ALL THE THINGS 1: animone now has its own syntax divergent from anisthesia, making different platforms actually have their own sections 2: process names in animone are now called `comm' (this will probably break things). this is what its called in bsd/linux so I'm just going to use it everywhere 3: the X11 code now checks for the existence of a UTF-8 window title and passes it if available 4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK! I still actually need to test the bsd code. to be honest I'm probably going to move all of the bsds into separate files because they're all essentially different operating systems at this point
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 12:51:15 -0400
parents d928ec7b6a0d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
1 #include "core/anime.h"
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
2 #include "core/session.h"
65
26721c28bf22 *: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents: 63
diff changeset
3 #include "core/strings.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
4 #include "gui/dialog/settings.h"
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
5 #include "gui/translate/anime.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
6 #include "services/anilist.h"
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
7 #include "services/kitsu.h"
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
8 #include <QComboBox>
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
9 #include <QGroupBox>
76
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
10 #include <QLabel>
3364fadc8a36 *: format source code
Paper <mrpapersonic@gmail.com>
parents: 74
diff changeset
11 #include <QLineEdit>
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
12 #include <QPushButton>
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
13 #include <QSizePolicy>
68
2417121d894e *: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents: 65
diff changeset
14 #include <QVBoxLayout>
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
15
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
16 QWidget* SettingsPageServices::CreateMainPage() {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
17 QWidget* result = new QWidget(this);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
18 result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
19
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
20 QVBoxLayout* full_layout = new QVBoxLayout(result);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
21
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
22 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
23 QGroupBox* sync_group_box = new QGroupBox(tr("Synchronization"), result);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
24 sync_group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
25
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
26 QVBoxLayout* sync_layout = new QVBoxLayout(sync_group_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
27
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
28 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
29 QLabel* sync_combo_box_label = new QLabel(tr("Active service and metadata provider:"), sync_group_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
30 sync_layout->addWidget(sync_combo_box_label);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
31 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
32
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
33 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
34 QComboBox* sync_combo_box = new QComboBox(sync_group_box);
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
35 for (const auto& service : Anime::Services)
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
36 sync_combo_box->addItem(Strings::ToQString(Translate::ToLocalString(service)), static_cast<int>(service));
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
37
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
38 connect(sync_combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
39 [this, sync_combo_box](int index) {
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
40 service = static_cast<Anime::Service>(sync_combo_box->itemData(index).toInt());
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
41 });
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
42
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
43 /* this is evil */
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
44 sync_combo_box->setCurrentIndex(static_cast<int>(service) - 1);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
45 sync_layout->addWidget(sync_combo_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
46 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
47
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
48 {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
49 QLabel* sync_note_label = new QLabel(
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
50 tr("Note: Minori is unable to synchronize multiple services at the same time."), sync_group_box);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
51 sync_layout->addWidget(sync_note_label);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
52 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
53
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
54 full_layout->addWidget(sync_group_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
55 }
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
56
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
57 full_layout->setSpacing(10);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
58 full_layout->addStretch();
68
2417121d894e *: normalize usage of layouts
Paper <mrpapersonic@gmail.com>
parents: 65
diff changeset
59
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
60 return result;
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
61 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
62
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
63 QWidget* SettingsPageServices::CreateKitsuPage() {
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
64 QWidget* result = new QWidget(this);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
65 result->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
66
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
67 QVBoxLayout* full_layout = new QVBoxLayout(result);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
68
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
69 {
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
70 /* Account */
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
71 QGroupBox* group_box = new QGroupBox(tr("Account"), result);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
72 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
73
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
74 QVBoxLayout* group_box_layout = new QVBoxLayout(group_box);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
75
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
76 {
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
77 QWidget* credentials_grid = new QWidget(group_box);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
78 QGridLayout* credentials_grid_layout = new QGridLayout(credentials_grid);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
79
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
80 /* E-mail */
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
81 QLabel* email_label = new QLabel(tr("&E-mail"), credentials_grid);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
82 QLineEdit* email = new QLineEdit(credentials_grid);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
83 email_label->setBuddy(email);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
84 credentials_grid_layout->addWidget(email_label, 0, 0);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
85 credentials_grid_layout->addWidget(email, 1, 0);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
86
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
87 QLabel* password_label = new QLabel(tr("&Password:"), credentials_grid);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
88 QLineEdit* password = new QLineEdit(credentials_grid);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
89 password->setEchoMode(QLineEdit::Password);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
90 password_label->setBuddy(password);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
91 credentials_grid_layout->addWidget(password_label, 0, 1);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
92 credentials_grid_layout->addWidget(password, 1, 1);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
93
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
94 {
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
95 QPushButton* auth_button = new QPushButton(credentials_grid);
319
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
96 connect(auth_button, &QPushButton::clicked, this, [auth_button, email, password] {
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
97 if (Services::Kitsu::AuthorizeUser(Strings::ToUtf8String(email->text()), Strings::ToUtf8String(password->text())))
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
98 auth_button->setText(tr("Re-authorize..."));
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
99 else
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
100 auth_button->setText(tr("Authorize..."));
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
101 });
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
102 auth_button->setText(session.config.auth.kitsu.access_token.empty() ? tr("Authorize...")
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
103 : tr("Re-authorize..."));
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
104 credentials_grid_layout->addWidget(auth_button, 1, 2);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
105 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
106
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
107 credentials_grid_layout->setContentsMargins(0, 0, 0, 0);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
108
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
109 group_box_layout->addWidget(credentials_grid);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
110 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
111
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
112 {
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
113 /* Note on password storing */
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
114 QLabel* note_label = new QLabel(tr("Your e-mail and password are never stored by Minori and will only be used to authorize with Kitsu.\nFor more information, see <a href=\"https://kitsu.docs.apiary.io/#introduction/authentication\">Kitsu's API documentation</a>"), group_box);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
115 note_label->setTextFormat(Qt::RichText);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
116 note_label->setWordWrap(true);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
117 note_label->setTextInteractionFlags(Qt::TextBrowserInteraction);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
118 note_label->setOpenExternalLinks(true);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
119 group_box_layout->addWidget(note_label);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
120 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
121
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
122 full_layout->addWidget(group_box);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
123 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
124
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
125 full_layout->setSpacing(10);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
126 full_layout->addStretch();
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
127
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
128 return result;
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
129 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
130
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
131 QWidget* SettingsPageServices::CreateAniListPage() {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
132 QWidget* result = new QWidget(this);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
133 result->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
134
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
135 QVBoxLayout* full_layout = new QVBoxLayout(result);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
136
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
137 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
138 /* Account */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
139 QGroupBox* group_box = new QGroupBox(tr("Account"), result);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
140 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
141
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
142 QVBoxLayout* layout = new QVBoxLayout(group_box);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
143
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
144 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
145 /* Authorization */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
146 QWidget* auth_widget = new QWidget(group_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
147 QHBoxLayout* auth_layout = new QHBoxLayout(auth_widget);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
148
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
149 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
150 QPushButton* auth_button = new QPushButton(auth_widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
151 connect(auth_button, &QPushButton::clicked, this, [] { Services::AniList::AuthorizeUser(); });
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
152 auth_button->setText(session.config.auth.anilist.auth_token.empty() ? tr("Authorize...")
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
153 : tr("Re-authorize..."));
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
154 auth_layout->addWidget(auth_button);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
155 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
156
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
157 layout->addWidget(auth_widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
158 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
159
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
160 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
161 /* Note on creating new accounts... */
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
162 QLabel* note_label =
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
163 new QLabel(tr("<a href=\"http://anilist.co/\">Create a new AniList account</a>"), group_box);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
164 note_label->setTextFormat(Qt::RichText);
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
165 note_label->setWordWrap(true);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
166 note_label->setTextInteractionFlags(Qt::TextBrowserInteraction);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
167 note_label->setOpenExternalLinks(true);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
168 layout->addWidget(note_label);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
169 }
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
170
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
171 full_layout->addWidget(group_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
172 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
173
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
174 full_layout->setSpacing(10);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
175 full_layout->addStretch();
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
176 return result;
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
177 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
178
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
179 void SettingsPageServices::SaveInfo() {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
180 // see services/anilist.cc for why this is commented out
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
181 session.config.service = service;
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
182 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
183
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
184 SettingsPageServices::SettingsPageServices(QWidget* parent) : SettingsPage(parent, tr("Services")) {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
185 service = session.config.service;
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
186 AddTab(CreateMainPage(), tr("Main"));
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
187 AddTab(CreateKitsuPage(), tr("Kitsu"));
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
188 AddTab(CreateAniListPage(), tr("AniList"));
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
189 }