diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 1968683e23415..4bde40d1a642d 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -201,6 +201,10 @@ set(client_SRCS filedetails/shareemodel.cpp filedetails/sortedsharemodel.h filedetails/sortedsharemodel.cpp + nmcgui/nmcflow2authwidget.h + nmcgui/nmcflow2authwidget.cpp + nmcgui/nmcowncloudadvancedsetuppage.h + nmcgui/nmcowncloudadvancedsetuppage.cpp tray/svgimageprovider.h tray/svgimageprovider.cpp tray/syncstatussummary.h diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp new file mode 100644 index 0000000000000..faf4c4da43a98 --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "nmcflow2authwidget.h" + +#include "QPushButton" +#include "QDesktopServices" +#include "QtGui/qpainter.h" +#include "theme.h" +#include "QString" +#include + +namespace OCC { + + +NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) + : Flow2AuthWidget(parent) +{ + _ui.copyLinkLabel->setVisible(false); + _ui.openLinkLabel->setVisible(false); + + //Create and connect the push buttons to base slots + auto copyLinkButton = new QPushButton(tr("Copy Link")); + connect(copyLinkButton, &QPushButton::clicked, this, [this](){ + slotCopyLinkToClipboard(); + }); + auto reopenBrowserButton = new QPushButton(tr("Reopen Browser")); + connect(reopenBrowserButton, &QPushButton::clicked, this, [this](){ + slotOpenBrowser(); + }); + + //Create a layout where we put our new buttons. + auto hLayout = new QHBoxLayout(this); + auto spacerLeft = new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed); + auto spacerRight = new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed); + hLayout->addSpacerItem(spacerLeft); + hLayout->addWidget(copyLinkButton); + hLayout->addWidget(reopenBrowserButton); + hLayout->addSpacerItem(spacerRight); + + hLayout->setSpacing(10); //its not defined in jira ticket https://jira.telekom.de/browse/NMC-2380 + + //According to Jira ticket https://jira.telekom.de/browse/NMC-2380 + QSize buttonSize(176,32); + copyLinkButton->setFixedSize(buttonSize); + reopenBrowserButton->setFixedSize(buttonSize); + + //Now add the layout to base layout + _ui.verticalLayout_3->addLayout(hLayout); + + //Make sure the first button wont get focus. It will be assigned to second button (reopenBrowserButton) + copyLinkButton->setFocusPolicy(Qt::NoFocus); + + //Apply custom Pushbutton ui modifications, colors are set globaly in style.qml or theme? + const QString styleSheet("QPushButton{font-size: 14px;font-family: Segoe; border: %1px solid; border-color: black; border-radius: 10px; background-color: %2; color: %3}"); + copyLinkButton->setStyleSheet(styleSheet.arg("1","white","black")); + reopenBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white")); +} + +void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter; + painter.begin(this); + painter.fillRect(rect(), Qt::white); + painter.end(); + Flow2AuthWidget::paintEvent(event); +} + + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h new file mode 100644 index 0000000000000..06c52aea58d9a --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) by Michael Schuster + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef NMCFLOW2AUTHWIDGET_H +#define NMCFLOW2AUTHWIDGET_H + +#include "wizard/flow2authwidget.h" + +namespace OCC { + +class NMCFlow2AuthWidget : public Flow2AuthWidget +{ + Q_OBJECT +public: + NMCFlow2AuthWidget(QWidget *parent = nullptr); + ~NMCFlow2AuthWidget() = default; + +protected: + void paintEvent(QPaintEvent *event) override; +}; + +} // namespace OCC + +#endif // NMCFLOW2AUTHWIDGET_H diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp new file mode 100644 index 0000000000000..9f9ab98047c55 --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "nmcgui/nmcowncloudadvancedsetuppage.h" +#include "QtGui/qpainter.h" + +namespace OCC { + +NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) + : OwncloudAdvancedSetupPage(wizard) + +{ + _ui.confCheckBoxSize->setVisible(false); + _ui.confSpinBox->setVisible(false); + _ui.confTraillingSizeLabel->setVisible(false); + _ui.confCheckBoxSize->setFixedSize(0,0); + _ui.confSpinBox->setFixedSize(0,0); + _ui.confTraillingSizeLabel->setFixedSize(0,0); + _ui.wSyncStrategy->removeItem(_ui.horizontalLayout_6); + + _ui.confCheckBoxExternal->setVisible(false); + _ui.confCheckBoxExternal->setFixedSize(0,0); + _ui.wSyncStrategy->removeItem(_ui.horizontalLayout_8); + + _ui.verticalLayout->removeWidget(_ui.errorLabel); + _ui.wSyncStrategy->insertWidget(0, _ui.errorLabel); + + _ui.lServerIcon->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h new file mode 100644 index 0000000000000..381bebc28b79e --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H +#define MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H + +#include "wizard/owncloudadvancedsetuppage.h" + + +namespace OCC { + +/** + * @brief The NMCOwncloudAdvancedSetupPage class + * @ingroup gui + */ + +class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage +{ + Q_OBJECT + +public: + NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); + ~NMCOwncloudAdvancedSetupPage() = default; +}; + +} // namespace OCC + +#endif diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index e03b9a50faba5..4cd8d6d220505 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -17,6 +17,8 @@ #include #include "flow2authcredspage.h" +#include "QtGui/qpainter.h" +#include "nmcgui/nmcflow2authwidget.h" #include "theme.h" #include "account.h" #include "cookiejar.h" @@ -33,7 +35,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() { _layout = new QVBoxLayout(this); - _flow2AuthWidget = new Flow2AuthWidget(); + _flow2AuthWidget = new NMCFlow2AuthWidget(); _layout->addWidget(_flow2AuthWidget); connect(_flow2AuthWidget, &Flow2AuthWidget::authResult, this, &Flow2AuthCredsPage::slotFlow2AuthResult); diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index a90fcbf495775..18af14952c4ea 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -47,10 +47,12 @@ public Q_SLOTS: void authResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void pollNow(); +protected: + Ui_Flow2AuthWidget _ui{}; + private: Account *_account = nullptr; QScopedPointer _asyncAuth; - Ui_Flow2AuthWidget _ui{}; protected slots: void slotOpenBrowser(); diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index f242db0d3367e..6eb0495848845 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -582,7 +582,7 @@ void OwncloudAdvancedSetupPage::customizeStyle() void OwncloudAdvancedSetupPage::styleLocalFolderLabel() { const auto backgroundColor = palette().window().color(); - const auto folderIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("folder.png", backgroundColor) + const auto folderIconFileName = Theme::instance()->isBranded() ? Theme::hidpiFileName("computer-icon.png", backgroundColor) : Theme::hidpiFileName(":/client/theme/colored/folder.png"); _ui.lLocal->setPixmap(folderIconFileName); } diff --git a/src/gui/wizard/owncloudadvancedsetuppage.h b/src/gui/wizard/owncloudadvancedsetuppage.h index 2c0f23bb42b37..6cbd943c00bf6 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.h +++ b/src/gui/wizard/owncloudadvancedsetuppage.h @@ -50,6 +50,8 @@ class OwncloudAdvancedSetupPage : public QWizardPage void setMultipleFoldersExist(bool exist); void directoriesCreated(); + Ui_OwncloudAdvancedSetupPage ui() const; + signals: void createLocalAndRemoteFolders(const QString &, const QString &); @@ -64,6 +66,9 @@ private slots: void slotVirtualFileSyncClicked(); void slotQuotaRetrieved(const QVariantMap &result); +protected: + Ui_OwncloudAdvancedSetupPage _ui{}; + private: void setRadioChecked(QRadioButton *radio); @@ -87,7 +92,6 @@ private slots: // TODO: remove when UX decision is made void refreshVirtualFilesAvailibility(const QString &path); - Ui_OwncloudAdvancedSetupPage _ui{}; bool _checking = false; bool _created = false; bool _localFolderValid = false; diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index faac2f5ad8934..5c78c4c811637 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -16,6 +16,7 @@ #include "account.h" #include "config.h" #include "configfile.h" +#include "nmcgui/nmcowncloudadvancedsetuppage.h" #include "theme.h" #include "owncloudgui.h" @@ -49,7 +50,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) , _setupPage(new OwncloudSetupPage(this)) , _httpCredsPage(new OwncloudHttpCredsPage(this)) , _flow2CredsPage(new Flow2AuthCredsPage) - , _advancedSetupPage(new OwncloudAdvancedSetupPage(this)) + , _advancedSetupPage(new NMCOwncloudAdvancedSetupPage(this)) #ifdef WITH_WEBENGINE , _webViewPage(new WebViewPage(this)) #else // WITH_WEBENGINE @@ -58,6 +59,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) { setObjectName("owncloudWizard"); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setPage(WizardCommon::Page_Welcome, _welcomePage); setPage(WizardCommon::Page_ServerSetup, _setupPage); @@ -87,7 +89,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) Theme *theme = Theme::instance(); setWindowTitle(tr("Add %1 account").arg(theme->appNameGUI())); - setWizardStyle(QWizard::ModernStyle); + setWizardStyle(QWizard::ClassicStyle); setOption(QWizard::NoBackButtonOnStartPage); setOption(QWizard::NoCancelButton); setButtonText(QWizard::CustomButton1, tr("Skip folders configuration")); @@ -306,9 +308,9 @@ void OwncloudWizard::slotCurrentPageChanged(int id) id == WizardCommon::Page_WebView || #endif // WITH_WEBENGINE id == WizardCommon::Page_Flow2AuthCreds) { - setButtonLayout({ QWizard::BackButton, QWizard::Stretch }); + setButtonLayout({ QWizard::Stretch }); } else if (id == WizardCommon::Page_AdvancedSetup) { - setButtonLayout({ QWizard::CustomButton2, QWizard::Stretch, QWizard::CustomButton1, QWizard::FinishButton }); + setButtonLayout({ QWizard::Stretch, QWizard::FinishButton }); setNextButtonAsDefault(); } else { setButtonLayout({ QWizard::BackButton, QWizard::Stretch, QWizard::NextButton }); @@ -385,6 +387,15 @@ void OwncloudWizard::changeEvent(QEvent *e) QWizard::changeEvent(e); } +void OwncloudWizard::paintEvent(QPaintEvent *event) +{ + QPainter painter; + painter.begin(this); + painter.fillRect(rect(), Qt::white); + painter.end(); + QWizard::paintEvent(event); +} + void OwncloudWizard::customizeStyle() { // HINT: Customize wizard's own style here, if necessary in the future (Dark-/Light-Mode switching) diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h index 58d3e915d9d1b..b6d6e7b5d4997 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -111,6 +111,7 @@ public slots: protected: void changeEvent(QEvent *) override; + void paintEvent(QPaintEvent *event) override; private: void customizeStyle(); diff --git a/theme/black/computer-icon.svg b/theme/black/computer-icon.svg new file mode 100644 index 0000000000000..ca7c451575447 --- /dev/null +++ b/theme/black/computer-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/theme/sync-arrow.svg b/theme/sync-arrow.svg index 56108b6d84f0a..8d28906fad2f2 100644 --- a/theme/sync-arrow.svg +++ b/theme/sync-arrow.svg @@ -1 +1,3 @@ - + + +