Use customizeStyle() to change link colours in the SettingsDialog and notify it's widgets via slots.
Also modify the background colour of the errors messages in AccountSettings::showConnectionLabel
to always use an appropiate colour for it's custom-defined background.
Signed-off-by: Michael Schuster <michael@schuster.ms>
} else {
ui->encryptionMessage->hide();
}
+
+ customizeStyle();
}
"border-width: 1px; border-style: solid; border-color: #aaaaaa;"
"border-radius:5px;");
if (errors.isEmpty()) {
- ui->connectLabel->setText(message);
+ QString msg = message;
+ Theme::replaceLinkColorStringBackgroundAware(msg);
+ ui->connectLabel->setText(msg);
ui->connectLabel->setToolTip(QString());
ui->connectLabel->setStyleSheet(QString());
} else {
errors.prepend(message);
- const QString msg = errors.join(QLatin1String("\n"));
+ QString msg = errors.join(QLatin1String("\n"));
qCDebug(lcAccountSettings) << msg;
+ Theme::replaceLinkColorStringBackgroundAware(msg, QColor("#bb4d4d"));
ui->connectLabel->setText(msg);
ui->connectLabel->setToolTip(QString());
ui->connectLabel->setStyleSheet(errStyle);
return QWidget::event(e);
}
+void AccountSettings::slotStyleChanged()
+{
+ customizeStyle();
+}
+
+void AccountSettings::customizeStyle()
+{
+ QString msg = ui->connectLabel->text();
+ Theme::replaceLinkColorStringBackgroundAware(msg);
+ ui->connectLabel->setText(msg);
+}
+
} // namespace OCC
#include "accountsettings.moc"
void slotOpenOC();
void slotUpdateQuota(qint64, qint64);
void slotAccountStateChanged();
+ void slotStyleChanged();
AccountState *accountsState() { return _accountState; }
bool event(QEvent *) override;
void createAccountToolbox();
void openIgnoredFilesDialog(const QString & absFolderPath);
+ void customizeStyle();
/// Returns the alias of the selected folder, empty string if none
QString selectedFolderAlias() const;
connect(_ui->legalNoticeButton, &QPushButton::clicked, this, &GeneralSettings::slotShowLegalNotice);
loadMiscSettings();
- slotUpdateInfo();
+ // updater info now set in: customizeStyle
+ //slotUpdateInfo();
// misc
connect(_ui->monoIconsCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
// accountAdded means the wizard was finished and the wizard might change some options.
connect(AccountManager::instance(), &AccountManager::accountAdded, this, &GeneralSettings::loadMiscSettings);
+
+ customizeStyle();
}
GeneralSettings::~GeneralSettings()
connect(updater, &OCUpdater::downloadStateChanged, this, &GeneralSettings::slotUpdateInfo, Qt::UniqueConnection);
connect(_ui->restartButton, &QAbstractButton::clicked, updater, &OCUpdater::slotStartInstaller, Qt::UniqueConnection);
connect(_ui->restartButton, &QAbstractButton::clicked, qApp, &QApplication::quit, Qt::UniqueConnection);
- _ui->updateStateLabel->setText(updater->statusString());
+
+ QString status = updater->statusString();
+ Theme::replaceLinkColorStringBackgroundAware(status);
+ _ui->updateStateLabel->setText(status);
+
_ui->restartButton->setVisible(updater->downloadState() == OCUpdater::DownloadComplete);
} else {
// can't have those infos from sparkle currently
delete notice;
}
+void GeneralSettings::slotStyleChanged()
+{
+ customizeStyle();
+}
+
+void GeneralSettings::customizeStyle()
+{
+ // setup about section
+ QString about = Theme::instance()->about();
+ Theme::replaceLinkColorStringBackgroundAware(about);
+ _ui->aboutLabel->setText(about);
+
+ // updater info
+ slotUpdateInfo();
+}
+
} // namespace OCC
~GeneralSettings();
QSize sizeHint() const override;
+public slots:
+ void slotStyleChanged();
+
private slots:
void saveMiscSettings();
void slotToggleLaunchOnStartup(bool);
void slotShowLegalNotice();
private:
+ void customizeStyle();
+
Ui::GeneralSettings *_ui;
QPointer<IgnoreListEditor> _ignoreEditor;
QPointer<SyncLogDialog> _syncLogDialog;
GeneralSettings *generalSettings = new GeneralSettings;
_ui->stack->addWidget(generalSettings);
+ // Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching)
+ connect(this, &SettingsDialog::styleChanged, generalSettings, &GeneralSettings::slotStyleChanged);
+
QAction *networkAction = createColorAwareAction(QLatin1String(":/client/resources/network.png"), tr("Network"));
_actionGroup->addAction(networkAction);
_toolBar->addAction(networkAction);
case QEvent::PaletteChange:
case QEvent::ThemeChange:
customizeStyle();
+
+ // Notify the other widgets (Dark-/Light-Mode switching)
+ emit styleChanged();
break;
default:
break;
_actionGroupWidgets.insert(accountAction, accountSettings);
_actionForAccount.insert(s->account().data(), accountAction);
accountAction->trigger();
+
+ // Connect styleChanged event, to adapt (Dark-/Light-Mode switching)
+ connect(this, &SettingsDialog::styleChanged, accountSettings, &AccountSettings::slotStyleChanged);
connect(accountSettings, &AccountSettings::folderChanged, _gui, &ownCloudGui::slotFoldersChanged);
connect(accountSettings, &AccountSettings::openFolderAlias,
void slotAccountAvatarChanged();
void slotAccountDisplayNameChanged();
+signals:
+ void styleChanged();
+
protected:
void reject() override;
void accept() override;