return (availableLocalSpace()>remoteSize) ? QString() : tr("There isn't enough free space in the local folder!");
}
+void OwncloudAdvancedSetupPage::slotStyleChanged()
+{
+ customizeStyle();
+}
+
+void OwncloudAdvancedSetupPage::customizeStyle()
+{
+}
+
} // namespace OCC
public slots:
void setErrorString(const QString &);
+ void slotStyleChanged();
private slots:
void slotSelectFolder();
QUrl serverUrl() const;
qint64 availableLocalSpace() const;
QString checkLocalSpace(qint64 remoteSize) const;
+ void customizeStyle();
Ui_OwncloudAdvancedSetupPage _ui;
bool _checking;
return new HttpCredentialsGui(_ui.leUsername->text(), _ui.lePassword->text(), _ocWizard->_clientSslCertificate, _ocWizard->_clientSslKey);
}
+void OwncloudHttpCredsPage::slotStyleChanged()
+{
+ customizeStyle();
+}
+
+void OwncloudHttpCredsPage::customizeStyle()
+{
+}
} // namespace OCC
Q_SIGNALS:
void connectToOCUrl(const QString &);
+public slots:
+ void slotStyleChanged();
+
private:
void startSpinner();
void stopSpinner();
void setupCustomization();
+ void customizeStyle();
Ui_OwncloudHttpCredsPage _ui;
bool _connected;
connect(_ui.nextButton, &QPushButton::clicked, _ui.slideShow, &SlideShow::nextSlide);
connect(_ui.prevButton, &QPushButton::clicked, _ui.slideShow, &SlideShow::prevSlide);
- auto widgetBgLightness = OwncloudSetupPage::palette().color(OwncloudSetupPage::backgroundRole()).lightness();
- bool widgetHasDarkBg =
- (widgetBgLightness >= 125)
- ? false
- : true;
- _ui.nextButton->setIcon(theme->uiThemeIcon(QString("control-next.svg"), widgetHasDarkBg));
- _ui.prevButton->setIcon(theme->uiThemeIcon(QString("control-prev.svg"), widgetHasDarkBg));
-
- // QPushButtons are a mess when it comes to consistent background coloring without stylesheets,
- // so we do it here even though this is an exceptional styling method here
- _ui.createAccountButton->setStyleSheet("QPushButton {background-color: #0082C9; color: white}");
-
_ui.slideShow->startShow();
-
- QPalette pal = _ui.slideShow->palette();
- pal.setColor(QPalette::WindowText, theme->wizardHeaderBackgroundColor());
- _ui.slideShow->setPalette(pal);
#else
_ui.createAccountButton->hide();
_ui.loginButton->hide();
_ui.installLink->hide();
_ui.slideShow->hide();
#endif
+
+ customizeStyle();
}
void OwncloudSetupPage::setServerUrl(const QString &newUrl)
{
}
+void OwncloudSetupPage::slotStyleChanged()
+{
+ customizeStyle();
+}
+
+void OwncloudSetupPage::customizeStyle()
+{
+#ifdef WITH_PROVIDERS
+ Theme *theme = Theme::instance();
+
+ bool widgetHasDarkBg = Theme::isDarkColor(QGuiApplication::palette().base().color());
+ _ui.nextButton->setIcon(theme->uiThemeIcon(QString("control-next.svg"), widgetHasDarkBg));
+ _ui.prevButton->setIcon(theme->uiThemeIcon(QString("control-prev.svg"), widgetHasDarkBg));
+
+ // QPushButtons are a mess when it comes to consistent background coloring without stylesheets,
+ // so we do it here even though this is an exceptional styling method here
+ _ui.createAccountButton->setStyleSheet("QPushButton {background-color: #0082C9; color: white}");
+
+ QPalette pal = _ui.slideShow->palette();
+ pal.setColor(QPalette::WindowText, theme->wizardHeaderBackgroundColor());
+ _ui.slideShow->setPalette(pal);
+#endif
+}
+
} // namespace OCC
void startSpinner();
void stopSpinner();
void slotCertificateAccepted();
+ void slotStyleChanged();
protected slots:
void slotUrlChanged(const QString &);
private:
bool urlHasChanged();
+ void customizeStyle();
Ui_OwncloudSetupPage _ui;
setTitleFormat(Qt::RichText);
setSubTitleFormat(Qt::RichText);
setButtonText(QWizard::CustomButton1, tr("Skip folders configuration"));
+
+
+ // Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching)
+ connect(this, &OwncloudWizard::styleChanged, _setupPage, &OwncloudSetupPage::slotStyleChanged);
+ connect(this, &OwncloudWizard::styleChanged, _advancedSetupPage, &OwncloudAdvancedSetupPage::slotStyleChanged);
+
+ customizeStyle();
}
void OwncloudWizard::setAccount(AccountPtr account)
return nullptr;
}
+void OwncloudWizard::changeEvent(QEvent *e)
+{
+ switch (e->type()) {
+ case QEvent::StyleChange:
+ case QEvent::PaletteChange:
+ case QEvent::ThemeChange:
+ customizeStyle();
+
+ // Notify the other widgets (Dark-/Light-Mode switching)
+ emit styleChanged();
+ break;
+ default:
+ break;
+ }
+
+ QWizard::changeEvent(e);
+}
+
+void OwncloudWizard::customizeStyle()
+{
+ // HINT: Customize wizard's own style here, if necessary in the future (Dark-/Light-Mode switching)
+}
+
} // end namespace
void basicSetupFinished(int);
void skipFolderConfiguration();
void needCertificate();
+ void styleChanged();
+
+protected:
+ void changeEvent(QEvent *) override;
private:
+ void customizeStyle();
+
AccountPtr _account;
OwncloudSetupPage *_setupPage;
OwncloudHttpCredsPage *_httpCredsPage;