Skip to content

Commit

Permalink
Merge pull request #2895 from nextcloud/wizard_ui_improvements
Browse files Browse the repository at this point in the history
Improve wizard ui
  • Loading branch information
Felix Weilbach authored Mar 10, 2021
2 parents 344b28d + e0b7ef1 commit b5cf820
Show file tree
Hide file tree
Showing 88 changed files with 2,433 additions and 808 deletions.
3 changes: 2 additions & 1 deletion NEXTCLOUD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ option( WITH_PROVIDERS "Build with providers list" ON )


## Theming options
set( APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR "#0082c9" CACHE STRING "Hex color of the wizard header background")
set(NEXTCLOUD_BACKGROUND_COLOR "#0082c9" CACHE STRING "Default Nextcloud background color")
set( APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR ${NEXTCLOUD_BACKGROUND_COLOR} CACHE STRING "Hex color of the wizard header background")
set( APPLICATION_WIZARD_HEADER_TITLE_COLOR "#ffffff" CACHE STRING "Hex color of the text in the wizard header")
option( APPLICATION_WIZARD_USE_CUSTOM_LOGO "Use the logo from ':/client/theme/colored/wizard_logo.(png|svg)' else the default application icon is used" ON )

Expand Down
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#cmakedefine APPLICATION_SERVER_URL_ENFORCE "@APPLICATION_SERVER_URL_ENFORCE@"
#cmakedefine LINUX_APPLICATION_ID "@LINUX_APPLICATION_ID@"
#cmakedefine APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR "@APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR@"
#cmakedefine NEXTCLOUD_BACKGROUND_COLOR "@NEXTCLOUD_BACKGROUND_COLOR@"
#cmakedefine APPLICATION_WIZARD_HEADER_TITLE_COLOR "@APPLICATION_WIZARD_HEADER_TITLE_COLOR@"
#cmakedefine APPLICATION_WIZARD_USE_CUSTOM_LOGO "@APPLICATION_WIZARD_USE_CUSTOM_LOGO@"
#cmakedefine APPLICATION_VIRTUALFILE_SUFFIX "@APPLICATION_VIRTUALFILE_SUFFIX@"
Expand Down
3 changes: 3 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ set(client_UI_SRCS
wizard/owncloudsetupnocredspage.ui
wizard/owncloudwizardresultpage.ui
wizard/webview.ui
wizard/welcomepage.ui
)

set(client_SRCS
Expand Down Expand Up @@ -134,6 +135,8 @@ set(client_SRCS
wizard/webviewpage.cpp
wizard/webview.cpp
wizard/slideshow.cpp
wizard/welcomepage.cpp
wizard/linklabel.cpp
)

IF(BUILD_UPDATER)
Expand Down
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
9 changes: 7 additions & 2 deletions src/gui/owncloudsetupwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void OwncloudSetupWizard::startWizard()
// if its a relative path, prepend with users home dir, otherwise use as absolute path

if (!QDir(localFolder).isAbsolute()) {
localFolder = QDir::homePath() + QDir::separator() + localFolder;
localFolder = QDir::homePath() + QLatin1Char('/') + localFolder;
}

_ocWizard->setProperty("localFolder", localFolder);
Expand All @@ -131,7 +131,12 @@ void OwncloudSetupWizard::startWizard()

_ocWizard->setRemoteFolder(_remoteFolder);

_ocWizard->setStartId(WizardCommon::Page_ServerSetup);
#ifdef WITH_PROVIDERS
const auto startPage = WizardCommon::Page_Welcome;
#else // WITH_PROVIDERS
const auto startPage = WizardCommon::Page_ServerSetup;
#endif // WITH_PROVIDERS
_ocWizard->setStartId(startPage);

_ocWizard->restart();

Expand Down
5 changes: 2 additions & 3 deletions src/gui/wizard/flow2authcredspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ Flow2AuthCredsPage::Flow2AuthCredsPage()
{
_layout = new QVBoxLayout(this);

setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(Theme::instance()->appNameGUI())));
setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Login in your browser (Login Flow v2)")));

_flow2AuthWidget = new Flow2AuthWidget();
_layout->addWidget(_flow2AuthWidget);

Expand All @@ -59,6 +56,8 @@ void Flow2AuthCredsPage::initializePage()

// Don't hide the wizard (avoid user confusion)!
//wizard()->hide();

_flow2AuthWidget->slotStyleChanged();
}

void OCC::Flow2AuthCredsPage::cleanupPage()
Expand Down
52 changes: 40 additions & 12 deletions src/gui/wizard/flow2authwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "common/utility.h"
#include "account.h"
#include "wizard/owncloudwizardcommon.h"
#include "theme.h"
#include "linklabel.h"

#include "QProgressIndicator.h"

Expand All @@ -34,13 +36,23 @@ Flow2AuthWidget::Flow2AuthWidget(QWidget *parent)
WizardCommon::initErrorLabel(_ui.errorLabel);
_ui.errorLabel->setTextFormat(Qt::RichText);

connect(_ui.openLinkButton, &QCommandLinkButton::clicked, this, &Flow2AuthWidget::slotOpenBrowser);
connect(_ui.copyLinkButton, &QCommandLinkButton::clicked, this, &Flow2AuthWidget::slotCopyLinkToClipboard);
connect(_ui.openLinkLabel, &LinkLabel::clicked, this, &Flow2AuthWidget::slotOpenBrowser);
connect(_ui.copyLinkLabel, &LinkLabel::clicked, this, &Flow2AuthWidget::slotCopyLinkToClipboard);

_ui.horizontalLayout->addWidget(_progressIndi);
auto sizePolicy = _progressIndi->sizePolicy();
sizePolicy.setRetainSizeWhenHidden(true);
_progressIndi->setSizePolicy(sizePolicy);

_ui.progressLayout->addWidget(_progressIndi);
stopSpinner(false);
}

customizeStyle();
void Flow2AuthWidget::setLogo()
{
const auto backgroundColor = palette().window().color();
const auto logoIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("external.png", backgroundColor)
: Theme::hidpiFileName(":/client/theme/colored/external.png");
_ui.logoLabel->setPixmap(logoIconFileName);
}

void Flow2AuthWidget::startAuth(Account *account)
Expand Down Expand Up @@ -160,24 +172,24 @@ void Flow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int second

void Flow2AuthWidget::startSpinner()
{
_ui.horizontalLayout->setEnabled(true);
_ui.progressLayout->setEnabled(true);
_ui.statusLabel->setVisible(true);
_progressIndi->setVisible(true);
_progressIndi->startAnimation();

_ui.openLinkButton->setEnabled(false);
_ui.copyLinkButton->setEnabled(false);
_ui.openLinkLabel->setEnabled(false);
_ui.copyLinkLabel->setEnabled(false);
}

void Flow2AuthWidget::stopSpinner(bool showStatusLabel)
{
_ui.horizontalLayout->setEnabled(false);
_ui.progressLayout->setEnabled(false);
_ui.statusLabel->setVisible(showStatusLabel);
_progressIndi->setVisible(false);
_progressIndi->stopAnimation();

_ui.openLinkButton->setEnabled(_statusUpdateSkipCount == 0);
_ui.copyLinkButton->setEnabled(_statusUpdateSkipCount == 0);
_ui.openLinkLabel->setEnabled(_statusUpdateSkipCount == 0);
_ui.copyLinkLabel->setEnabled(_statusUpdateSkipCount == 0);
}

void Flow2AuthWidget::slotStyleChanged()
Expand All @@ -187,8 +199,24 @@ void Flow2AuthWidget::slotStyleChanged()

void Flow2AuthWidget::customizeStyle()
{
if(_progressIndi)
_progressIndi->setColor(QGuiApplication::palette().color(QPalette::Text));
setLogo();

if (_progressIndi) {
const auto isDarkBackground = Theme::isDarkColor(palette().window().color());
if (isDarkBackground) {
_progressIndi->setColor(Qt::white);
} else {
_progressIndi->setColor(Qt::black);
}
}

_ui.openLinkLabel->setText(tr("Reopen Browser"));
_ui.openLinkLabel->setAlignment(Qt::AlignCenter);

_ui.copyLinkLabel->setText(tr("Copy Link"));
_ui.copyLinkLabel->setAlignment(Qt::AlignCenter);

WizardCommon::customizeHintLabel(_ui.statusLabel);
}

} // namespace OCC
1 change: 1 addition & 0 deletions src/gui/wizard/flow2authwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected slots:
void startSpinner();
void stopSpinner(bool showStatusLabel);
void customizeStyle();
void setLogo();

QProgressIndicator *_progressIndi;
int _statusUpdateSkipCount = 0;
Expand Down
Loading

0 comments on commit b5cf820

Please sign in to comment.