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