annotate src/gui/dialog/settings/services.cc @ 317:b1f4d1867ab1

services: VERY initial Kitsu support it only supports user authentication for now, but it's definitely a start.
author Paper <paper@paper.us.eu.org>
date Wed, 12 Jun 2024 04:07:10 -0400
parents 657fda1b9cac
children d928ec7b6a0d
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);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
96 connect(auth_button, &QPushButton::clicked, this, [email, password] {
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
97 Services::Kitsu::AuthorizeUser(Strings::ToUtf8String(email->text()), Strings::ToUtf8String(password->text()));
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
98 });
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
99 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
100 : tr("Re-authorize..."));
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
101 credentials_grid_layout->addWidget(auth_button, 1, 2);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
102 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
103
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
104 credentials_grid_layout->setContentsMargins(0, 0, 0, 0);
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 group_box_layout->addWidget(credentials_grid);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
107 }
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 {
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
110 /* Note on password storing */
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
111 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
112 note_label->setTextFormat(Qt::RichText);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
113 note_label->setWordWrap(true);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
114 note_label->setTextInteractionFlags(Qt::TextBrowserInteraction);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
115 note_label->setOpenExternalLinks(true);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
116 group_box_layout->addWidget(note_label);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
117 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
118
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
119 full_layout->addWidget(group_box);
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->setSpacing(10);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
123 full_layout->addStretch();
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 return result;
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
126 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
127
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
128 QWidget* SettingsPageServices::CreateAniListPage() {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
129 QWidget* result = new QWidget(this);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
130 result->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
131
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
132 QVBoxLayout* full_layout = new QVBoxLayout(result);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
133
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
134 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
135 /* Account */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
136 QGroupBox* group_box = new QGroupBox(tr("Account"), result);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
137 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
138
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
139 QVBoxLayout* layout = new QVBoxLayout(group_box);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
140
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
141 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
142 /* Authorization */
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
143 QWidget* auth_widget = new QWidget(group_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
144 QHBoxLayout* auth_layout = new QHBoxLayout(auth_widget);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
145
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
146 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
147 QPushButton* auth_button = new QPushButton(auth_widget);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
148 connect(auth_button, &QPushButton::clicked, this, [] { Services::AniList::AuthorizeUser(); });
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
149 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
150 : tr("Re-authorize..."));
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
151 auth_layout->addWidget(auth_button);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
152 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
153
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
154 layout->addWidget(auth_widget);
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 {
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
158 /* Note on creating new accounts... */
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
159 QLabel* note_label =
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
160 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
161 note_label->setTextFormat(Qt::RichText);
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
162 note_label->setWordWrap(true);
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
163 note_label->setTextInteractionFlags(Qt::TextBrowserInteraction);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
164 note_label->setOpenExternalLinks(true);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
165 layout->addWidget(note_label);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
166 }
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 232
diff changeset
167
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
168 full_layout->addWidget(group_box);
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
169 }
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
170
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
171 full_layout->setSpacing(10);
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
172 full_layout->addStretch();
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
173 return result;
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
174 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
175
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
176 void SettingsPageServices::SaveInfo() {
108
2004b41d4a59 *: huge commit
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
177 // see services/anilist.cc for why this is commented out
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
178 session.config.service = service;
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
179 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
180
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
181 SettingsPageServices::SettingsPageServices(QWidget* parent) : SettingsPage(parent, tr("Services")) {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
182 service = session.config.service;
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
183 AddTab(CreateMainPage(), tr("Main"));
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 279
diff changeset
184 AddTab(CreateKitsuPage(), tr("Kitsu"));
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
185 AddTab(CreateAniListPage(), tr("AniList"));
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
186 }