Improve wizard in edit mode

This commit is contained in:
Daniel Molkentin 2013-05-28 14:51:08 +02:00
parent fdd52a2520
commit f38d8ba2e4
2 changed files with 277 additions and 189 deletions

View file

@ -6,14 +6,39 @@
<rect>
<x>0</x>
<y>0</y>
<width>577</width>
<height>374</height>
<width>583</width>
<height>448</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="topLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
@ -30,6 +55,194 @@
</property>
</spacer>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" colspan="3">
<layout class="QHBoxLayout" name="resultLayout">
<property name="spacing">
<number>0</number>
</property>
</layout>
</item>
<item row="5" column="0" colspan="3">
<widget class="QWidget" name="advancedBox" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Local Folder</string>
</property>
<property name="buddy">
<cstring>pbSelectLocalFolder</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbSelectLocalFolder">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>pbSelectLocalFolder</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="resolutionWidget" native="true">
<layout class="QFormLayout" name="formLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>&amp;Keep local data</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;small&gt;Syncs your existing data to new location.&lt;/small&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="cbSyncFromScratch">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this box is checked, existing content in the local directory will be erased to start a clean sync from the server.&lt;/p&gt;&lt;p&gt;Do not check this if the local content should be uploaded to the servers directory.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Start a clean sync</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;small&gt;Erases the contents of the local folder before syncing using the new settings.&lt;/small&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
@ -128,28 +341,12 @@
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
<string>Error Label</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>58</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
@ -209,176 +406,54 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="3">
<widget class="QGroupBox" name="advancedBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Local Folder</string>
</property>
<property name="buddy">
<cstring>pbSelectLocalFolder</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbSelectLocalFolder">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>/home/kf/ownCloud</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="selectiveSyncLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Selective Sync:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="selectiveSyncLayout">
<item>
<widget class="QPushButton" name="pbBoxMode">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Sync Entire &amp;Account</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSelectiveMode">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose &amp;Folders</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="cbSyncFromScratch">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this box is checked, existing content in the local directory will be erased to start a clean sync from the server.&lt;/p&gt;&lt;p&gt;Do not check this if the local content should be uploaded to the servers directory.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;Start with a clean sync from the server and erase the local directory..</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>43</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" colspan="3">
<layout class="QHBoxLayout" name="resultLayout"/>
</item>
<item row="7" column="0" colspan="3">
<item row="8" column="0" colspan="3">
<widget class="QLabel" name="syncModeLabel">
<property name="text">
<string>Street Creds Homie!</string>
<string>Status message</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>58</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0">
<widget class="QLabel" name="bottomLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="topLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="text">
<string>TextLabel</string>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>

View file

@ -52,10 +52,10 @@ OwncloudSetupPage::OwncloudSetupPage()
_ui.setupUi(this);
Theme *theme = Theme::instance();
setTitle( tr("<font color=\"%1\" size=\"5\">Connect to your %2 Server</font>")
setTitle( tr("<font color=\"%1\" size=\"5\">Connect to %2</font>")
.arg(theme->wizardHeaderTitleColor().name()).arg( theme->appNameGUI()));
setSubTitle( tr("<font color=\"%1\">Enter user credentials to access your %2</font>")
.arg(theme->wizardHeaderTitleColor().name()).arg(theme->appNameGUI()));
setSubTitle( tr("<font color=\"%1\">Enter user credentials</font>")
.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("<p/>");
t += tr("The local directory is not empty. Check the advanced settings!");
_ui.cbSyncFromScratch->setEnabled(true);
if (!_ui.cbAdvanced->isChecked()) {
t += tr("<p><small><strong>Warning:</strong> The local directory is not empty. "
"Pick a resolution in the advanced settings!</small></p>");
}
_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("<font color=\"%1\">Change your user credentials</font>")
.arg(Theme::instance()->wizardHeaderTitleColor().name()));
}
// ======================================================================
@ -383,8 +396,8 @@ OwncloudWizardResultPage::OwncloudWizardResultPage()
Theme *theme = Theme::instance();
setTitle( tr("<font color=\"%1\" size=\"5\">Everything set up!</font>")
.arg(theme->wizardHeaderTitleColor().name()));
setSubTitle( tr("<font color=\"%1\">Enter user credentials to access your %2</font>")
.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);