From 0f03b47a4679002b487d7f87cf9f71bbc3f6a79d Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Fri, 17 May 2013 18:05:22 +0200 Subject: [PATCH] Make new connection wizard themable --- src/mirall/owncloudtheme.cpp | 10 ++++++ src/mirall/owncloudtheme.h | 3 ++ src/mirall/owncloudwizard.cpp | 32 ++++++++++-------- src/mirall/theme.cpp | 22 ++++++++++++ src/mirall/theme.h | 19 +++++++++++ .../colored/wizard_logo.png | Bin 6 files changed, 71 insertions(+), 15 deletions(-) rename resources/owncloud_logo.png => theme/colored/wizard_logo.png (100%) diff --git a/src/mirall/owncloudtheme.cpp b/src/mirall/owncloudtheme.cpp index 756cbe960..c17529923 100644 --- a/src/mirall/owncloudtheme.cpp +++ b/src/mirall/owncloudtheme.cpp @@ -148,5 +148,15 @@ QIcon ownCloudTheme::applicationIcon( ) const return themeIcon( QLatin1String("owncloud") ); } +QColor ownCloudTheme::wizardHeaderBackgroundColor() const +{ + return QColor("#1d2d42"); +} + +QColor ownCloudTheme::wizardHeaderTitleColor() const +{ + return QColor("#ffffff"); +} + } diff --git a/src/mirall/owncloudtheme.h b/src/mirall/owncloudtheme.h index 2e217639f..ee5b366ae 100644 --- a/src/mirall/owncloudtheme.h +++ b/src/mirall/owncloudtheme.h @@ -35,6 +35,9 @@ public: QIcon folderDisabledIcon() const; QIcon applicationIcon() const; + QColor wizardHeaderBackgroundColor() const; + QColor wizardHeaderTitleColor() const; + private: diff --git a/src/mirall/owncloudwizard.cpp b/src/mirall/owncloudwizard.cpp index d4605bf21..517234a36 100644 --- a/src/mirall/owncloudwizard.cpp +++ b/src/mirall/owncloudwizard.cpp @@ -51,8 +51,11 @@ OwncloudSetupPage::OwncloudSetupPage() { _ui.setupUi(this); - // Backgroundcolor for owncloud logo #1d2d42 - setTitle(tr("Create Connection to %1").arg(Theme::instance()->appNameGUI())); + Theme *theme = Theme::instance(); + setTitle( tr("Connect to your %2 Server") + .arg(theme->wizardHeaderTitleColor().name()).arg( theme->appNameGUI())); + setSubTitle( tr("Enter user credentials to access your %2") + .arg(theme->wizardHeaderTitleColor().name()).arg(theme->appNameGUI())); connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(handleNewOcUrl(QString))); @@ -78,8 +81,6 @@ OwncloudSetupPage::OwncloudSetupPage() _ui.errorLabel->setStyleSheet( style ); _ui.errorLabel->setWordWrap(true); _ui.errorLabel->setVisible(false); - setTitle( tr("Connect to your %1 Server").arg( Theme::instance()->appNameGUI())); - setSubTitle( tr("Enter user credentials to access your %1").arg(Theme::instance()->appNameGUI())); // ButtonGroup for _selectiveSyncButtons = new QButtonGroup; @@ -310,21 +311,24 @@ OwncloudWizardResultPage::OwncloudWizardResultPage() _ui.setupUi(this); // no fields to register. + Theme *theme = Theme::instance(); + setTitle( tr("Everything set up!") + .arg(theme->wizardHeaderTitleColor().name())); + setSubTitle( tr("Enter user credentials to access your %2") + .arg(theme->wizardHeaderTitleColor().name()).arg(theme->appNameGUI())); + _ui.pbOpenLocal->setText("Open local folder"); - _ui.pbOpenServer->setText(tr("Open %1").arg(Theme::instance()->appNameGUI())); - setTitle( tr("Everything set up!").arg( Theme::instance()->appNameGUI())); - setSubTitle( tr("Enter user credentials to access your %1").arg(Theme::instance()->appNameGUI())); - _ui.pbOpenLocal->setIcon(QIcon(":/mirall/resources/folder-sync.png")); _ui.pbOpenLocal->setText(tr("Open Local Folder")); _ui.pbOpenLocal->setIconSize(QSize(48, 48)); _ui.pbOpenLocal->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - _ui.pbOpenServer->setIcon(QIcon(":/mirall/resources/owncloud_logo_blue.png")); - _ui.pbOpenServer->setText(tr("Open Server")); +// _ui.pbOpenServer->setIcon(QIcon(":/mirall/resources/owncloud_logo_blue.png")); + _ui.pbOpenServer->setIcon(theme->applicationIcon().pixmap(48)); + _ui.pbOpenServer->setText(tr("Open %1").arg(theme->appNameGUI())); _ui.pbOpenServer->setIconSize(QSize(48, 48)); _ui.pbOpenServer->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); setupCustomization(); @@ -394,13 +398,11 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) connect( _setupPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); - QPixmap pix(QSize(600, 78)); - pix.fill(QColor("#1d2d42")); - setPixmap( QWizard::BannerPixmap, pix ); - QPixmap logo( ":/mirall/resources/owncloud_logo.png"); - setPixmap( QWizard::LogoPixmap, logo ); + Theme *theme = Theme::instance(); setWizardStyle(QWizard::ModernStyle); + setPixmap( QWizard::BannerPixmap, theme->wizardHeaderBanner() ); + setPixmap( QWizard::LogoPixmap, theme->wizardHeaderLogo() ); setOption( QWizard::NoBackButtonOnStartPage ); setOption( QWizard::NoBackButtonOnLastPage ); setOption( QWizard::NoCancelButton ); diff --git a/src/mirall/theme.cpp b/src/mirall/theme.cpp index cc6c265dd..8217cd3c5 100644 --- a/src/mirall/theme.cpp +++ b/src/mirall/theme.cpp @@ -198,5 +198,27 @@ QVariant Theme::customMedia( CustomMediaType type ) return re; } +QColor Theme::wizardHeaderTitleColor() const +{ + return QColor(); +} + +QColor Theme::wizardHeaderBackgroundColor() const +{ + return QColor(); +} + +QPixmap Theme::wizardHeaderLogo() const +{ + return QPixmap(":/mirall/theme/colored/wizard_logo.png"); +} + +QPixmap Theme::wizardHeaderBanner() const +{ + QPixmap pix(QSize(600, 78)); + pix.fill(wizardHeaderBackgroundColor()); + return pix; +} + } // end namespace mirall diff --git a/src/mirall/theme.h b/src/mirall/theme.h index 1edb4b48d..056a6eb3b 100644 --- a/src/mirall/theme.h +++ b/src/mirall/theme.h @@ -22,6 +22,7 @@ class QIcon; class QString; class QObject; class QPixmap; +class QColor; namespace Mirall { @@ -127,6 +128,24 @@ public: */ virtual QVariant customMedia( CustomMediaType type ); + /** @return color for the setup wizard */ + virtual QColor wizardHeaderTitleColor() const; + + /** @return color for the setup wizard. */ + virtual QColor wizardHeaderBackgroundColor() const; + + /** @return logo for the setup wizard. */ + virtual QPixmap wizardHeaderLogo() const; + + /** + * The default implementation creates a + * background based on + * \ref wizardHeaderTitleColor(). + * + * @return banner for the setup wizard. + */ + virtual QPixmap wizardHeaderBanner() const; + /** * About dialog contents */ diff --git a/resources/owncloud_logo.png b/theme/colored/wizard_logo.png similarity index 100% rename from resources/owncloud_logo.png rename to theme/colored/wizard_logo.png