From d8d72e81bb6568fad7ee12d0435819923c541e5d Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Jun 2022 18:08:20 +0200 Subject: [PATCH] Redesign local folder information in the account adding wizard Signed-off-by: Claudio Cambra --- src/gui/wizard/owncloudadvancedsetuppage.cpp | 34 +- src/gui/wizard/owncloudadvancedsetuppage.h | 4 +- src/gui/wizard/owncloudadvancedsetuppage.ui | 1240 ++++++++---------- 3 files changed, 565 insertions(+), 713 deletions(-) diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index 451127af3ad6d..e0818dfc9e00f 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -43,9 +43,14 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage(OwncloudWizard *wizard) , _ocWizard(wizard) { _ui.setupUi(this); - setupResoultionWidget(); + _filePathLabel.reset(new ElidedLabel); + _filePathLabel->setElideMode(Qt::ElideMiddle); + _filePathLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + _filePathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); + _ui.locationsGridLayout->addWidget(_filePathLabel.data(), 3, 3); + registerField(QLatin1String("OCSyncFromScratch"), _ui.cbSyncFromScratch); auto sizePolicy = _progressIndi->sizePolicy(); @@ -116,6 +121,7 @@ void OwncloudAdvancedSetupPage::setupCustomization() variant = theme->customMedia(Theme::oCSetupBottom); WizardCommon::setupCustomMedia(variant, _ui.bottomLabel); + WizardCommon::customizeHintLabel(_filePathLabel.data()); WizardCommon::customizeHintLabel(_ui.lFreeSpace); WizardCommon::customizeHintLabel(_ui.lSyncEverythingSizeLabel); WizardCommon::customizeHintLabel(_ui.lSelectiveSyncSizeLabel); @@ -188,10 +194,11 @@ void OwncloudAdvancedSetupPage::fetchUserAvatar() { // Reset user avatar const auto appIcon = Theme::instance()->applicationIcon(); - _ui.lServerIcon->setPixmap(appIcon.pixmap(48)); + // To match the folder icon opposite the avatar -- that is 60x60, minus padding + _ui.lServerIcon->setPixmap(appIcon.pixmap(32)); // Fetch user avatar const auto account = _ocWizard->account(); - auto avatarSize = 64; + auto avatarSize = 32; if (Theme::isHidpi()) { avatarSize *= 2; } @@ -256,8 +263,6 @@ void OwncloudAdvancedSetupPage::updateStatus() QString t; - setLocalFolderPushButtonPath(locFolder); - if (dataChanged()) { if (_remoteFolder.isEmpty() || _remoteFolder == QLatin1String("/")) { t = ""; @@ -277,6 +282,8 @@ void OwncloudAdvancedSetupPage::updateStatus() setResolutionGuiVisible(false); } + _filePathLabel->setText(QDir::toNativeSeparators(locFolder)); + QString lfreeSpaceStr = Utility::octetsToString(availableLocalSpace()); _ui.lFreeSpace->setText(QString(tr("%1 free space", "%1 gets replaced with the size and a matching unit. Example: 3 MB or 5 GB")).arg(lfreeSpaceStr)); @@ -428,7 +435,6 @@ void OwncloudAdvancedSetupPage::slotSelectFolder() // TODO: remove when UX decision is made refreshVirtualFilesAvailibility(dir); - setLocalFolderPushButtonPath(dir); wizard()->setProperty("localFolder", dir); updateStatus(); } @@ -438,22 +444,6 @@ void OwncloudAdvancedSetupPage::slotSelectFolder() setErrorString(errorStr); } - -void OwncloudAdvancedSetupPage::setLocalFolderPushButtonPath(const QString &path) -{ - const auto homeDir = QDir::homePath().endsWith('/') ? QDir::homePath() : QDir::homePath() + QLatin1Char('/'); - - if (!path.startsWith(homeDir)) { - _ui.pbSelectLocalFolder->setText(QDir::toNativeSeparators(path)); - return; - } - - auto prettyPath = path; - prettyPath.remove(0, homeDir.size()); - - _ui.pbSelectLocalFolder->setText(QDir::toNativeSeparators(prettyPath)); -} - void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked() { AccountPtr acc = static_cast(wizard())->account(); diff --git a/src/gui/wizard/owncloudadvancedsetuppage.h b/src/gui/wizard/owncloudadvancedsetuppage.h index f3bf968d8b4f6..0a715d27c3bcf 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.h +++ b/src/gui/wizard/owncloudadvancedsetuppage.h @@ -20,6 +20,7 @@ #include "wizard/owncloudwizardcommon.h" #include "ui_owncloudadvancedsetuppage.h" +#include "elidedlabel.h" class QProgressIndicator; @@ -76,7 +77,6 @@ private slots: QString checkLocalSpace(qint64 remoteSize) const; void customizeStyle(); void setServerAddressLabelUrl(const QUrl &url); - void setLocalFolderPushButtonPath(const QString &path); void styleSyncLogo(); void styleLocalFolderLabel(); void setResolutionGuiVisible(bool value); @@ -93,10 +93,12 @@ private slots: bool _localFolderValid = false; QProgressIndicator *_progressIndi; QString _remoteFolder; + QString _localPath; QStringList _selectiveSyncBlacklist; qint64 _rSize = -1; qint64 _rSelectedSize = -1; OwncloudWizard *_ocWizard; + QScopedPointer _filePathLabel; }; } // namespace OCC diff --git a/src/gui/wizard/owncloudadvancedsetuppage.ui b/src/gui/wizard/owncloudadvancedsetuppage.ui index 075de08409c72..1f149ba6e26ab 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.ui +++ b/src/gui/wizard/owncloudadvancedsetuppage.ui @@ -19,148 +19,143 @@ Form - - - - - - 0 - 0 - - - - TextLabel - - - Qt::RichText - - - Qt::AlignCenter - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 13 - - - - - - - - 0 - + + + + + + - - - Qt::Horizontal + + + + 0 + 0 + + + + TextLabel + + + Qt::RichText - - - 40 - 20 - + + Qt::AlignCenter - + + true + + - - - 0 + + + QLayout::SetFixedSize - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - Avatar - - - Qt::AlignCenter - - - - - - - - 75 - true - - - - User name - - - Qt::AlignCenter - - - - - - - Server address - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - + + + + Avatar + + + Qt::AlignCenter + + - - + + + + + 0 + 0 + + + + &Local Folder + + + Qt::AlignCenter + + + pbSelectLocalFolder + + + + + + + + 75 + true + + + + User name + + + Qt::AlignCenter + + + + + + + + 75 + true + + + + Local Folder + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + Choose different folder + + + true + + + false + + + + + + + + 0 + 0 + + + + Free space + + + Qt::AlignCenter + + + true + + + + + Qt::Horizontal - - QSizePolicy::Minimum - 40 @@ -169,23 +164,42 @@ - - - - Sync Logo + + + + Qt::Vertical - - Qt::AlignCenter + + QSizePolicy::Expanding - + + + 20 + 40 + + + - - + + - Qt::Horizontal + Qt::Vertical - QSizePolicy::Minimum + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + Qt::Horizontal @@ -195,604 +209,450 @@ - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - &Local Folder - - - Qt::AlignCenter - - - pbSelectLocalFolder - - - - - - - - 75 - true - - - - Local Folder - - - Qt::AlignCenter - - - - - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - pbSelectLocalFolder - - - true - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - - - - 0 - 0 - - - - Free space - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - + + + + Server address + + + Qt::AlignHCenter|Qt::AlignTop + + + true + + + + + + + Sync Logo + + + Qt::AlignCenter + + - - - Qt::Horizontal + + + QLayout::SetMinimumSize - - - 40 - 20 - - - - - - - - - - QLayout::SetMinimumSize - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - + 0 0 - - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + 0 0 - + 0 - - - - Synchronize everything from server - - - true - - - - - - - Size - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - + 0 - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 20 - 20 - - - + + + 0 + + + + + Synchronize everything from server + + + true + + + + + + + Size + + + Qt::PlainText + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - Ask before syncing folders larger than - - + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + Ask before syncing folders larger than + + + + + + + + 0 + 0 + + + + Qt::StrongFocus + + + 999999 + + + 99 + + + + + + + MB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - 0 - 0 - - - - Qt::StrongFocus - - - 999999 - - - 99 - - + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + Ask before syncing external storages + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - MB - - + + + 0 + + + + + + 0 + 0 + + + + + + + false + + + + + + + Choose what to sync + + + true + + + false + + + + + + + TextLabel + + + Qt::PlainText + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + + + 0 + 0 + + + + Use virtual files !PLACEHOLDER! + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 20 - 20 - - - - - - - - Ask before syncing external storages - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 + + + + 0 + 0 + - - - - - 0 - 0 - - - - - - - false - - - - - - - Choose what to sync - - - true - - - false - - - - - - - TextLabel - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - Use virtual files !PLACEHOLDER! - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - - 6 - - - QLayout::SetMinimumSize - - - 0 - - - 2 - - - 0 - - - 0 - - - - - - 0 - 0 - + + + 6 - - - 9 - 75 - true - + + QLayout::SetMinimumSize - - 1 + + 0 - - Status message + + 2 - - Qt::AutoText + + 0 - - Qt::AlignCenter + + 0 - - false - - - - - - - - 0 - 0 - - - - Keep local data - - - true - - - - - - - - 0 - 0 - - - - <html><head/><body><p>If this box is checked, existing content in the local folder 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 folder.</p></body></html> - - - Erase local folder and start a clean sync - - - true - - - - - + + + + + 0 + 0 + + + + + 9 + 75 + true + + + + 1 + + + Status message + + + Qt::AutoText + + + Qt::AlignCenter + + + false + + + + + + + + 0 + 0 + + + + Keep local data + + + true + + + + + + + + 0 + 0 + + + + <html><head/><body><p>If this box is checked, existing content in the local folder 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 folder.</p></body></html> + + + Erase local folder and start a clean sync + + + true + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + - - - Qt::Horizontal + + + TextLabel + + + + + + + TextLabel - - - 40 - 20 - + + Qt::RichText - + - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - TextLabel - - - - - - - - - - TextLabel - - - Qt::RichText - - -