Fix various clazy warnings
This commit is contained in:
@@ -134,7 +134,7 @@ AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog)
|
||||
ui_->checkbox_system_icons->hide();
|
||||
#endif
|
||||
|
||||
Load();
|
||||
AppearanceSettingsPage::Load();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -118,27 +118,29 @@ void CoversSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
ui_->providers_up->setEnabled(row != 0);
|
||||
ui_->providers_down->setEnabled(row != ui_->providers->count() - 1);
|
||||
CoverProvider *provider = dialog()->app()->cover_providers()->ProviderByName(item_current->text());
|
||||
if (provider && provider->AuthenticationRequired()) {
|
||||
if (provider->name() == "Tidal" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Tidal settings to authenticate."));
|
||||
}
|
||||
else if (provider->name() == "Qobuz" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Qobuz settings to authenticate."));
|
||||
if (provider) {
|
||||
if (provider->AuthenticationRequired()) {
|
||||
if (provider->name() == "Tidal" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Tidal settings to authenticate."));
|
||||
}
|
||||
else if (provider->name() == "Qobuz" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Qobuz settings to authenticate."));
|
||||
}
|
||||
else {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(tr("%1 needs authentication.").arg(provider->name()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(tr("%1 needs authentication.").arg(provider->name()));
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
provider_selected_ = true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -147,7 +147,8 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
}
|
||||
#endif
|
||||
|
||||
for (const GlobalShortcutsManager::Shortcut &i : manager->shortcuts().values()) {
|
||||
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager->shortcuts().values();
|
||||
for (const GlobalShortcutsManager::Shortcut &i : shortcuts) {
|
||||
Shortcut shortcut;
|
||||
shortcut.s = i;
|
||||
shortcut.key = i.action->shortcut();
|
||||
@@ -160,7 +161,8 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
ItemClicked(ui_->list->topLevelItem(0));
|
||||
}
|
||||
|
||||
for (const Shortcut &shortcut : shortcuts_.values()) {
|
||||
QList<Shortcut> shortcuts = shortcuts_.values();
|
||||
for (const Shortcut &shortcut : shortcuts) {
|
||||
SetShortcut(shortcut.s.id, shortcut.s.action->shortcut());
|
||||
}
|
||||
|
||||
@@ -202,7 +204,8 @@ void GlobalShortcutsSettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
for (const Shortcut &shortcut : shortcuts_.values()) {
|
||||
QList<Shortcut> shortcuts = shortcuts_.values();
|
||||
for (const Shortcut &shortcut : shortcuts) {
|
||||
shortcut.s.action->setShortcut(shortcut.key);
|
||||
shortcut.s.shortcut->setKey(shortcut.key);
|
||||
s.setValue(shortcut.s.id, shortcut.key.toString());
|
||||
@@ -299,7 +302,8 @@ void GlobalShortcutsSettingsPage::ChangeClicked() {
|
||||
if (key.isEmpty()) return;
|
||||
|
||||
// Check if this key sequence is used by any other actions
|
||||
for (const QString &id : shortcuts_.keys()) {
|
||||
QStringList ids = shortcuts_.keys();
|
||||
for (const QString &id : ids) {
|
||||
if (shortcuts_[id].key == key) SetShortcut(id, QKeySequence());
|
||||
}
|
||||
|
||||
|
||||
@@ -118,18 +118,20 @@ void LyricsSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
ui_->providers_up->setEnabled(row != 0);
|
||||
ui_->providers_down->setEnabled(row != ui_->providers->count() - 1);
|
||||
LyricsProvider *provider = dialog()->app()->lyrics_providers()->ProviderByName(item_current->text());
|
||||
if (provider && provider->AuthenticationRequired()) {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(QString("%1 needs authentication.").arg(provider->name()));
|
||||
if (provider) {
|
||||
if (provider->AuthenticationRequired()) {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(QString("%1 needs authentication.").arg(provider->name()));
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(QString("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
provider_selected_ = true;
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(QString("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
provider_selected_ = true;
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
|
||||
@@ -58,7 +58,7 @@ MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog* dialog)
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("moodbar"));
|
||||
|
||||
Load();
|
||||
MoodbarSettingsPage::Load();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,8 @@ void SettingsDialog::showEvent(QShowEvent *e) {
|
||||
LoadGeometry();
|
||||
// Load settings
|
||||
loading_settings_ = true;
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Load();
|
||||
}
|
||||
loading_settings_ = false;
|
||||
@@ -212,7 +213,8 @@ void SettingsDialog::closeEvent(QCloseEvent*) {
|
||||
|
||||
void SettingsDialog::accept() {
|
||||
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Accept();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
@@ -226,7 +228,8 @@ void SettingsDialog::accept() {
|
||||
void SettingsDialog::reject() {
|
||||
|
||||
// Notify each page that user clicks on Cancel
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Reject();
|
||||
}
|
||||
SaveGeometry();
|
||||
@@ -323,7 +326,8 @@ void SettingsDialog::AddPage(Page id, SettingsPage *page, QTreeWidgetItem *paren
|
||||
|
||||
void SettingsDialog::Save() {
|
||||
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Apply();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
@@ -335,7 +339,8 @@ void SettingsDialog::DialogButtonClicked(QAbstractButton *button) {
|
||||
|
||||
// While we only connect Apply at the moment, this might change in the future
|
||||
if (ui_->buttonBox->button(QDialogButtonBox::Apply) == button) {
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Apply();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
@@ -364,7 +369,8 @@ void SettingsDialog::CurrentItemChanged(QTreeWidgetItem *item) {
|
||||
ui_->title->setText("<b>" + item->text(0) + "</b>");
|
||||
|
||||
// Display the right page
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
if (page.item_ == item) {
|
||||
ui_->stacked_widget->setCurrentWidget(page.scroll_area_);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user