comparison src/gui/dialog/settings/services.cc @ 232:ff0061e75f0f

theme: add OS detection with glib
author Paper <mrpapersonic@gmail.com>
date Sat, 13 Jan 2024 11:06:16 -0500
parents 275da698697d
children 862d0d8619f6
comparison
equal deleted inserted replaced
231:69f4768a820c 232:ff0061e75f0f
64 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); 64 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
65 65
66 QVBoxLayout* layout = new QVBoxLayout(group_box); 66 QVBoxLayout* layout = new QVBoxLayout(group_box);
67 67
68 { 68 {
69 QLabel* username_entry_label = new QLabel(tr("Username: (not your email address)"), group_box);
70 layout->addWidget(username_entry_label);
71 }
72
73 {
74 /* Authorization */ 69 /* Authorization */
75 QWidget* auth_widget = new QWidget(group_box); 70 QWidget* auth_widget = new QWidget(group_box);
76 QHBoxLayout* auth_layout = new QHBoxLayout(auth_widget); 71 QHBoxLayout* auth_layout = new QHBoxLayout(auth_widget);
77 72
78 { 73 {
79 /* Username: this literally never gets used btw */
80 QLineEdit* username_entry = new QLineEdit(username, auth_widget);
81 connect(username_entry, &QLineEdit::editingFinished, this,
82 [this, username_entry] { username = username_entry->text(); });
83 auth_layout->addWidget(username_entry);
84 }
85
86 {
87 /* The actual auth button */
88 QPushButton* auth_button = new QPushButton(auth_widget); 74 QPushButton* auth_button = new QPushButton(auth_widget);
89 connect(auth_button, &QPushButton::clicked, this, [] { Services::AniList::AuthorizeUser(); }); 75 connect(auth_button, &QPushButton::clicked, this, [] { Services::AniList::AuthorizeUser(); });
90 auth_button->setText(session.config.auth.anilist.auth_token.empty() ? tr("Authorize...") : tr("Re-authorize...")); 76 auth_button->setText(session.config.auth.anilist.auth_token.empty() ? tr("Authorize...") : tr("Re-authorize..."));
91 auth_layout->addWidget(auth_button); 77 auth_layout->addWidget(auth_button);
92 } 78 }
111 return result; 97 return result;
112 } 98 }
113 99
114 void SettingsPageServices::SaveInfo() { 100 void SettingsPageServices::SaveInfo() {
115 // see services/anilist.cc for why this is commented out 101 // see services/anilist.cc for why this is commented out
116 // session.config.anilist.username = Strings::ToUtf8String(username);
117 session.config.service = service; 102 session.config.service = service;
118 } 103 }
119 104
120 SettingsPageServices::SettingsPageServices(QWidget* parent) : SettingsPage(parent, tr("Services")) { 105 SettingsPageServices::SettingsPageServices(QWidget* parent) : SettingsPage(parent, tr("Services")) {
121 // username = QString::fromUtf8(session.config.anilist.username.c_str());
122 service = session.config.service; 106 service = session.config.service;
123 AddTab(CreateMainPage(), tr("Main")); 107 AddTab(CreateMainPage(), tr("Main"));
124 AddTab(CreateAniListPage(), tr("AniList")); 108 AddTab(CreateAniListPage(), tr("AniList"));
125 } 109 }