From f38d8ba2e4df6ec11febc4b53b859cf69cb31849 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Tue, 28 May 2013 14:51:08 +0200 Subject: [PATCH] Improve wizard in edit mode --- src/mirall/owncloudsetuppage_ng.ui | 419 +++++++++++++++++------------ src/mirall/owncloudwizard.cpp | 47 ++-- 2 files changed, 277 insertions(+), 189 deletions(-) diff --git a/src/mirall/owncloudsetuppage_ng.ui b/src/mirall/owncloudsetuppage_ng.ui index e829d4af9..080eb9979 100644 --- a/src/mirall/owncloudsetuppage_ng.ui +++ b/src/mirall/owncloudsetuppage_ng.ui @@ -6,14 +6,39 @@ 0 0 - 577 - 374 + 583 + 448 + + + 0 + 0 + + Form + + QLayout::SetMinimumSize + + + + + + 0 + 0 + + + + TextLabel + + + Qt::AlignCenter + + + @@ -30,6 +55,194 @@ + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + + + 0 + + + + + + + true + + + + 0 + + + 0 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + 0 + 0 + + + + &Local Folder + + + pbSelectLocalFolder + + + + + + + + 0 + 0 + + + + pbSelectLocalFolder + + + + + + + + QLayout::SetMinimumSize + + + + + &Keep local data + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + <small>Syncs your existing data to new location.</small> + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + 0 + + + + + + + <html><head/><body><p>If this box is checked, existing content in the local directory will be erased to start a clean sync from the server.</p><p>Do not check this if the local content should be uploaded to the servers directory.</p></body></html> + + + &Start a clean sync + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + <small>Erases the contents of the local folder before syncing using the new settings.</small> + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + 0 + + + + + + + + + + + @@ -128,28 +341,12 @@ - TextLabel + Error Label - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 48 - 58 - - - - @@ -209,176 +406,54 @@ - - - - true - - - - - - true - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - - 0 - 0 - - - - &Local Folder - - - pbSelectLocalFolder - - - - - - - - 0 - 0 - - - - /home/kf/ownCloud - - - - - - - - 0 - 0 - - - - Selective Sync: - - - - - - - - - - 0 - 0 - - - - Sync Entire &Account - - - true - - - true - - - false - - - - - - - - 0 - 0 - - - - Choose &Folders - - - true - - - - - - - - - <html><head/><body><p>If this box is checked, existing content in the local directory will be erased to start a clean sync from the server.</p><p>Do not check this if the local content should be uploaded to the servers directory.</p></body></html> - - - &Start with a clean sync from the server and erase the local directory.. - - - true - - - - - - - - - - - - Qt::Vertical - - - - 20 - 43 - - - - - - - - + - Street Creds Homie! + Status message Qt::AlignCenter - - true - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 48 + 58 + + + + + TextLabel - - - - - 0 - 0 - + + + + Qt::Vertical - - TextLabel + + QSizePolicy::Expanding - - Qt::AlignCenter + + + 20 + 40 + - + diff --git a/src/mirall/owncloudwizard.cpp b/src/mirall/owncloudwizard.cpp index fa0263741..5db8e9e73 100644 --- a/src/mirall/owncloudwizard.cpp +++ b/src/mirall/owncloudwizard.cpp @@ -52,10 +52,10 @@ OwncloudSetupPage::OwncloudSetupPage() _ui.setupUi(this); Theme *theme = Theme::instance(); - setTitle( tr("Connect to your %2 Server") + setTitle( tr("Connect to %2") .arg(theme->wizardHeaderTitleColor().name()).arg( theme->appNameGUI())); - setSubTitle( tr("Enter user credentials to access your %2") - .arg(theme->wizardHeaderTitleColor().name()).arg(theme->appNameGUI())); + setSubTitle( tr("Enter user credentials") + .arg(theme->wizardHeaderTitleColor().name())); connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(slotUrlChanged(QString))); connect( _ui.leUsername, SIGNAL(textChanged(QString)), this, SLOT(slotUserChanged(QString))); @@ -76,6 +76,7 @@ OwncloudSetupPage::OwncloudSetupPage() _progressIndi = new QProgressIndicator; _ui.resultLayout->addWidget( _progressIndi ); _progressIndi->setVisible(false); + _ui.resultLayout->setEnabled(false); // Error label QString style = QLatin1String("border: 1px solid #eed3d7; border-radius: 5px; padding: 3px;" @@ -99,8 +100,13 @@ OwncloudSetupPage::~OwncloudSetupPage() void OwncloudSetupPage::slotToggleAdvanced(int state) { _ui.advancedBox->setVisible( state == Qt::Checked ); - wizard()->resize(wizard()->sizeHint()); + slotHandleUserInput(); + QSize size = wizard()->sizeHint(); + // need to substract header for some reason + size -= QSize(0, 100); + wizard()->setMinimumSize(size); + wizard()->resize(size); } void OwncloudSetupPage::setOCUser( const QString & user ) @@ -248,26 +254,28 @@ void OwncloudSetupPage::slotHandleUserInput() if( !urlHasChanged() && _configExists ) { // This is the password change mode: No change to the url and a config // to an ownCloud exists. - t = tr("Change the Password for your configured ownCloud."); + t = tr("Change the Password for your configured account."); } else { // Complete new setup. _ui.pbSelectLocalFolder->setText(locFolder); if( _remoteFolder.isEmpty() || _remoteFolder == QLatin1String("/") ) { - t = tr("Your entire account will be synced to the local folder '%1'").arg(locFolder); + t = tr("Your entire account will be synced to the local folder '%1'.").arg(locFolder); } else { - t = tr("ownCloud folder '%1' is synced to local folder '%2'").arg(_remoteFolder).arg(locFolder); + t = tr("%1 folder '%2' is synced to local folder '%3'") + .arg(Theme::instance()->appName()).arg(_remoteFolder).arg(locFolder); } - if( entries.count() > 0 ) { + if( entries.count() > 0) { // the directory is not empty - // setErrorString( tr("The local directory is not empty! Open advanced settings for detailed settings.") ); - t += QLatin1String("

"); - t += tr("The local directory is not empty. Check the advanced settings!"); - _ui.cbSyncFromScratch->setEnabled(true); + if (!_ui.cbAdvanced->isChecked()) { + t += tr("

Warning: The local directory is not empty. " + "Pick a resolution in the advanced settings!

"); + } + _ui.resolutionWidget->setVisible(true); } else { // the dir is empty, which means that there is no problem. - _ui.cbSyncFromScratch->setEnabled(false); + _ui.resolutionWidget->setVisible(false); } } @@ -294,6 +302,7 @@ QString OwncloudSetupPage::localFolder() const void OwncloudSetupPage::setConnected( bool comp ) { _connected = comp; + _ui.resultLayout->setEnabled(true); _progressIndi->setVisible(false); _progressIndi->stopAnimation(); } @@ -305,6 +314,7 @@ bool OwncloudSetupPage::validatePage() if( ! _connected) { setErrorString(QString::null); _checking = true; + _ui.resultLayout->setEnabled(true); _progressIndi->setVisible(true); _progressIndi->startAnimation(); emit completeChanged(); @@ -335,6 +345,7 @@ void OwncloudSetupPage::setErrorString( const QString& err ) void OwncloudSetupPage::stopSpinner() { + _ui.resultLayout->setEnabled(false); _progressIndi->setVisible(false); _progressIndi->stopAnimation(); } @@ -371,6 +382,8 @@ OwncloudSetupPage::SyncMode OwncloudWizard::syncMode() void OwncloudSetupPage::setConfigExists( bool config ) { _configExists = config; + setSubTitle( tr("Change your user credentials") + .arg(Theme::instance()->wizardHeaderTitleColor().name())); } // ====================================================================== @@ -383,8 +396,8 @@ OwncloudWizardResultPage::OwncloudWizardResultPage() 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())); + // required to show header in QWizard's modern style + setSubTitle( QLatin1String(" ") ); _ui.pbOpenLocal->setText("Open local folder"); _ui.pbOpenServer->setText(tr("Open %1").arg(Theme::instance()->appNameGUI())); @@ -396,8 +409,8 @@ OwncloudWizardResultPage::OwncloudWizardResultPage() _ui.pbOpenLocal->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); -// _ui.pbOpenServer->setIcon(QIcon(":/mirall/resources/owncloud_logo_blue.png")); - _ui.pbOpenServer->setIcon(theme->applicationIcon().pixmap(48)); + QIcon appIcon = theme->applicationIcon(); + _ui.pbOpenServer->setIcon(appIcon.pixmap(48)); _ui.pbOpenServer->setText(tr("Open %1").arg(theme->appNameGUI())); _ui.pbOpenServer->setIconSize(QSize(48, 48)); _ui.pbOpenServer->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);