Skip to content

Commit

Permalink
Restyle wizard
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Weilbach <[email protected]>
  • Loading branch information
Felix Weilbach committed Feb 16, 2021
1 parent 27d56c6 commit c5ec0cd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,6 @@ Application::Application(int &argc, char **argv)
FolderMan::instance()->setupFolders();
_proxy.setupQtProxyFromConfig(); // folders have to be defined first, than we set up the Qt proxy.

// Enable word wrapping of QInputDialog (#4197)
setStyleSheet("QInputDialog QLabel { qproperty-wordWrap:1; }");

connect(AccountManager::instance(), &AccountManager::accountAdded,
this, &Application::slotAccountStateAdded);
connect(AccountManager::instance(), &AccountManager::accountRemoved,
Expand Down
38 changes: 32 additions & 6 deletions src/gui/wizard/owncloudwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)

// note: start Id is set by the calling class depending on if the
// welcome text is to be shown or not.
setWizardStyle(QWizard::ModernStyle);

connect(this, &QWizard::currentIdChanged, this, &OwncloudWizard::slotCurrentPageChanged);
connect(_setupPage, &OwncloudSetupPage::determineAuthType, this, &OwncloudWizard::determineAuthType);
Expand All @@ -90,15 +89,11 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)


Theme *theme = Theme::instance();
setWindowTitle(tr("%1 Connection Wizard").arg(theme->appNameGUI()));
setWindowTitle(tr("Add %1 account").arg(theme->appNameGUI()));
setWizardStyle(QWizard::ModernStyle);
setPixmap(QWizard::BannerPixmap, theme->wizardHeaderBanner());
setPixmap(QWizard::LogoPixmap, theme->wizardHeaderLogo());
setOption(QWizard::NoBackButtonOnStartPage);
setOption(QWizard::NoBackButtonOnLastPage);
setOption(QWizard::NoCancelButton);
setTitleFormat(Qt::RichText);
setSubTitleFormat(Qt::RichText);
setButtonText(QWizard::CustomButton1, tr("Skip folders configuration"));

// Change the next buttons size policy since we hide it on the
Expand Down Expand Up @@ -337,6 +332,37 @@ void OwncloudWizard::changeEvent(QEvent *e)
void OwncloudWizard::customizeStyle()
{
// HINT: Customize wizard's own style here, if necessary in the future (Dark-/Light-Mode switching)
auto theme = Theme::instance();
auto wizardPalette = palette();

wizardPalette.setColor(QPalette::Window, theme->wizardHeaderBackgroundColor());
QColor colorWindowDisabled(wizardPalette.color(QPalette::Window));
colorWindowDisabled.setAlpha(128);
wizardPalette.setColor(QPalette::Disabled, QPalette::Window, colorWindowDisabled);

wizardPalette.setColor(QPalette::Base, theme->wizardHeaderBackgroundColor());
QColor colorBaseDisabled(wizardPalette.color(QPalette::Base));
colorBaseDisabled.setAlpha(128);
wizardPalette.setColor(QPalette::Disabled, QPalette::Base, colorBaseDisabled);

wizardPalette.setColor(QPalette::WindowText, theme->wizardHeaderTitleColor());
QColor colorWindowTextDisabled(wizardPalette.color(QPalette::WindowText));
colorWindowTextDisabled.setAlpha(128);
wizardPalette.setColor(QPalette::Disabled, QPalette::WindowText, colorWindowTextDisabled);

wizardPalette.setColor(QPalette::Text, theme->wizardHeaderTitleColor());
QColor colorTextDisabled(wizardPalette.color(QPalette::Text));
colorTextDisabled.setAlpha(128);
wizardPalette.setColor(QPalette::Disabled, QPalette::Text, colorWindowTextDisabled);

// Set separator color
wizardPalette.setColor(QPalette::Mid, theme->wizardHeaderBackgroundColor());

setPalette(wizardPalette);

WizardCommon::customizePrimaryButtonStyle(button(QWizard::NextButton));
WizardCommon::customizeSecondaryButtonStyle(button(QWizard::CustomButton1));
WizardCommon::customizeSecondaryButtonStyle(button(QWizard::BackButton));
}

void OwncloudWizard::bringToTop()
Expand Down
1 change: 1 addition & 0 deletions src/gui/wizard/owncloudwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public slots:

private:
void customizeStyle();
void adjustWizardSize();

AccountPtr _account;
WelcomePage *_welcomePage;
Expand Down

0 comments on commit c5ec0cd

Please sign in to comment.