Skip to content

Commit

Permalink
Restyle wizard pages
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Weilbach <[email protected]>
  • Loading branch information
Felix Weilbach committed Feb 22, 2021
1 parent a13dfe6 commit d6a0efc
Show file tree
Hide file tree
Showing 16 changed files with 1,289 additions and 787 deletions.
2 changes: 1 addition & 1 deletion 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 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
38 changes: 30 additions & 8 deletions src/gui/wizard/flow2authwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "common/utility.h"
#include "account.h"
#include "wizard/owncloudwizardcommon.h"
#include "theme.h"

#include "QProgressIndicator.h"

Expand All @@ -34,13 +35,21 @@ 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.openLinkButton, &QPushButton::clicked, this, &Flow2AuthWidget::slotOpenBrowser);
connect(_ui.copyLinkButton, &QPushButton::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();
_ui.logoLabel->setPixmap(Theme::hidpiFileName("external.png", backgroundColor));
}

void Flow2AuthWidget::startAuth(Account *account)
Expand Down Expand Up @@ -160,7 +169,7 @@ 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();
Expand All @@ -171,7 +180,7 @@ void Flow2AuthWidget::startSpinner()

void Flow2AuthWidget::stopSpinner(bool showStatusLabel)
{
_ui.horizontalLayout->setEnabled(false);
_ui.progressLayout->setEnabled(false);
_ui.statusLabel->setVisible(showStatusLabel);
_progressIndi->setVisible(false);
_progressIndi->stopAnimation();
Expand All @@ -187,8 +196,21 @@ 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);
}
}

WizardCommon::customizeLinkButtonStyle(_ui.openLinkButton);
WizardCommon::customizeLinkButtonStyle(_ui.copyLinkButton);

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
185 changes: 140 additions & 45 deletions src/gui/wizard/flow2authwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,152 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Please switch to your browser to proceed.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="errorLabel">
<property name="text">
<string>An error occurred while connecting. Please try again.</string>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
</widget>
</item>
<item>
<widget class="QCommandLinkButton" name="openLinkButton">
<property name="text">
<string>Re-open Browser</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>80</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QCommandLinkButton" name="copyLinkButton">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<property name="text">
<string>Copy link</string>
<property name="bottomMargin">
<number>0</number>
</property>
</widget>
<item>
<widget class="QLabel" name="logoLabel">
<property name="text">
<string>Logo</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Switch to your browser to connect your account</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string notr="true">Status</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="openLinkButton">
<property name="text">
<string>Reopen browser</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="copyLinkButton">
<property name="text">
<string>Copy link</string>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="errorLabel">
<property name="text">
<string>An error occurred while connecting. Please try again.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="progressLayout"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
Expand All @@ -79,19 +187,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string notr="true">TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
Expand All @@ -100,7 +195,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>107</height>
<height>80</height>
</size>
</property>
</spacer>
Expand Down
Loading

0 comments on commit d6a0efc

Please sign in to comment.