Adjust login state widget placement for covers and lyrics settings
This commit is contained in:
@@ -60,6 +60,8 @@ CoversSettingsPage::CoversSettingsPage(SettingsDialog *parent) : SettingsPage(pa
|
||||
connect(ui_->button_authenticate, SIGNAL(clicked()), SLOT(AuthenticateClicked()));
|
||||
connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(LogoutClicked()));
|
||||
|
||||
ui_->login_state->AddCredentialGroup(ui_->widget_authenticate);
|
||||
|
||||
NoProviderSelected();
|
||||
DisableAuthentication();
|
||||
|
||||
@@ -203,6 +205,7 @@ void CoversSettingsPage::AuthenticateClicked() {
|
||||
CoverProvider *provider = dialog()->app()->cover_providers()->ProviderByName(ui_->providers->currentItem()->text());
|
||||
if (!provider) return;
|
||||
ui_->button_authenticate->setEnabled(false);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
connect(provider, SIGNAL(AuthenticationFailure(QStringList)), this, SLOT(AuthenticationFailure(QStringList)));
|
||||
connect(provider, SIGNAL(AuthenticationSuccess()), this, SLOT(AuthenticationSuccess()));
|
||||
provider->Authenticate();
|
||||
|
||||
@@ -106,15 +106,21 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LoginStateWidget" name="login_state" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_button_authenticate">
|
||||
<layout class="QHBoxLayout" name="layout_authenticate">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_authenticate">
|
||||
<property name="text">
|
||||
<string>Authenticate</string>
|
||||
</property>
|
||||
<widget class="LoginStateWidget" name="login_state" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_authenticate" native="true">
|
||||
<layout class="QHBoxLayout" name="layout_button_authenticate">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_authenticate">
|
||||
<property name="text">
|
||||
<string>Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -60,6 +60,8 @@ LyricsSettingsPage::LyricsSettingsPage(SettingsDialog *parent) : SettingsPage(pa
|
||||
connect(ui_->button_authenticate, SIGNAL(clicked()), SLOT(AuthenticateClicked()));
|
||||
connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(LogoutClicked()));
|
||||
|
||||
ui_->login_state->AddCredentialGroup(ui_->widget_authenticate);
|
||||
|
||||
NoProviderSelected();
|
||||
DisableAuthentication();
|
||||
|
||||
@@ -197,6 +199,7 @@ void LyricsSettingsPage::AuthenticateClicked() {
|
||||
LyricsProvider *provider = dialog()->app()->lyrics_providers()->ProviderByName(ui_->providers->currentItem()->text());
|
||||
if (!provider) return;
|
||||
ui_->button_authenticate->setEnabled(false);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
connect(provider, SIGNAL(AuthenticationFailure(QStringList)), this, SLOT(AuthenticationFailure(QStringList)));
|
||||
connect(provider, SIGNAL(AuthenticationSuccess()), this, SLOT(AuthenticationSuccess()));
|
||||
provider->Authenticate();
|
||||
|
||||
@@ -106,15 +106,21 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LoginStateWidget" name="login_state" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_button_authenticate">
|
||||
<layout class="QHBoxLayout" name="layout_authenticate">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_authenticate">
|
||||
<property name="text">
|
||||
<string>Authenticate</string>
|
||||
</property>
|
||||
<widget class="LoginStateWidget" name="login_state" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_authenticate" native="true">
|
||||
<layout class="QHBoxLayout" name="layout_button_authenticate">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_authenticate">
|
||||
<property name="text">
|
||||
<string>Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -64,11 +64,11 @@ void LoginStateWidget::SetAccountTypeText(const QString &text) {
|
||||
ui_->account_type_label->setText(text);
|
||||
}
|
||||
|
||||
void LoginStateWidget::SetAccountTypeVisible(bool visible) {
|
||||
void LoginStateWidget::SetAccountTypeVisible(const bool visible) {
|
||||
ui_->account_type->setVisible(visible);
|
||||
}
|
||||
|
||||
void LoginStateWidget::SetLoggedIn(State state, const QString &account_name) {
|
||||
void LoginStateWidget::SetLoggedIn(const State state, const QString &account_name) {
|
||||
|
||||
State last_state = state_;
|
||||
state_ = state;
|
||||
|
||||
@@ -53,13 +53,13 @@ class LoginStateWidget : public QWidget {
|
||||
|
||||
public slots:
|
||||
// Changes the "You are logged in/out" label, shows/hides any QGroupBoxes added with AddCredentialGroup.
|
||||
void SetLoggedIn(State state, const QString &account_name = QString());
|
||||
void SetLoggedIn(const State state, const QString &account_name = QString());
|
||||
|
||||
// Hides the "You are logged in/out" label completely.
|
||||
void HideLoggedInState();
|
||||
|
||||
void SetAccountTypeText(const QString &text);
|
||||
void SetAccountTypeVisible(bool visible);
|
||||
void SetAccountTypeVisible(const bool visible);
|
||||
|
||||
void SetExpires(const QDate &expires);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user