diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 1968683e23415..2175d9154ab79 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -2,6 +2,9 @@ project(gui) find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network) find_package(KF5Archive REQUIRED) +#NMC change, its needed to find the ui file in different location as the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + if(QUICK_COMPILER) find_package(Qt5QuickCompiler) set_package_properties(Qt5QuickCompiler PROPERTIES @@ -232,6 +235,8 @@ set(client_SRCS creds/webflowcredentials.cpp creds/webflowcredentialsdialog.h creds/webflowcredentialsdialog.cpp + nmcgui/magentaWizardPage.h + nmcgui/magentaWizardPage.cpp wizard/postfixlineedit.h wizard/postfixlineedit.cpp wizard/abstractcredswizardpage.h diff --git a/src/gui/nmcgui/magentaWizardPage.cpp b/src/gui/nmcgui/magentaWizardPage.cpp new file mode 100644 index 0000000000000..60d1c3ab1a58c --- /dev/null +++ b/src/gui/nmcgui/magentaWizardPage.cpp @@ -0,0 +1,69 @@ +/* + * 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/magentaWizardPage.h" +#include "QtWidgets/qpushbutton.h" +#include "theme.h" +#include "wizard/ui_welcomepage.h" +#include "wizard/welcomepage.h" + +namespace OCC { + +MagentaWizardPage::MagentaWizardPage(OwncloudWizard *ocWizard) + : WelcomePage(ocWizard) +{ + this->layout()->removeItem(_ui->horizontalLayout); + _ui->hostYourOwnServerLabel->setVisible(false); + _ui->loginButton->setVisible(false); + _ui->createAccountButton->setVisible(false); + _ui->slideShow->startShow(2500); + + setFinalPage(true); +} + +int MagentaWizardPage::nextId() const +{ + return -1; +} + +bool MagentaWizardPage::isComplete() const +{ + return true; +} + +void MagentaWizardPage::styleSlideShow() +{ + const auto theme = Theme::instance(); + const auto backgroundColor = palette().window().color(); + + const QString page1FileName = QString(":/client/theme/NMCIcons/page1.png"); + const QString page2FileName = QString(":/client/theme/NMCIcons/page2.png"); + const QString page3FileName = QString(":/client/theme/NMCIcons/page3.png"); + + _ui->slideShow->addSlide(page1FileName, tr("Page 1")); + _ui->slideShow->addSlide(page2FileName, tr("Page 2")); + _ui->slideShow->addSlide(page3FileName, tr("Page 3")); + + const auto isDarkBackground = Theme::isDarkColor(backgroundColor); + _ui->slideShowNextButton->setIcon(theme->uiThemeIcon(QString("control-next.svg"), isDarkBackground)); + _ui->slideShowPreviousButton->setIcon(theme->uiThemeIcon(QString("control-prev.svg"), isDarkBackground)); +} + +void MagentaWizardPage::setLoginButtonDefault() +{ + //No login button available, keep empty +} + + +} // namespace OCC diff --git a/src/gui/nmcgui/magentaWizardPage.h b/src/gui/nmcgui/magentaWizardPage.h new file mode 100644 index 0000000000000..d39de06d151f3 --- /dev/null +++ b/src/gui/nmcgui/magentaWizardPage.h @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#pragma once + +#include "QtWidgets/qboxlayout.h" +#include "wizard/welcomepage.h" + +namespace OCC { + +class MagentaWizardPage : public WelcomePage +{ + Q_OBJECT +public: + MagentaWizardPage(OwncloudWizard *ocWizard); + [[nodiscard]] int nextId() const override; + bool isComplete() const override; + +protected: + void styleSlideShow() override final; + void setLoginButtonDefault() override final; +}; + +} // namespace OCC diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index f242db0d3367e..00a26c83adeba 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -67,7 +67,7 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage(OwncloudWizard *wizard) setupCustomization(); connect(_ui.pbSelectLocalFolder, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectFolder); - setButtonText(QWizard::FinishButton, tr("Connect")); + setButtonText(QWizard::NextButton, tr("Connect")); if (Theme::instance()->enforceVirtualFilesSyncFolder()) { _ui.rSyncEverything->setDisabled(true); @@ -135,7 +135,7 @@ void OwncloudAdvancedSetupPage::setupCustomization() bool OwncloudAdvancedSetupPage::isComplete() const { - return !_checking && _localFolderValid; + return true; //!_checking && _localFolderValid; } void OwncloudAdvancedSetupPage::initializePage() @@ -169,7 +169,7 @@ void OwncloudAdvancedSetupPage::initializePage() updateStatus(); // ensure "next" gets the focus, not obSelectLocalFolder - QTimer::singleShot(0, wizard()->button(QWizard::FinishButton), qOverload<>(&QWidget::setFocus)); + QTimer::singleShot(0, wizard()->button(QWizard::NextButton), qOverload<>(&QWidget::setFocus)); auto acc = dynamic_cast(wizard())->account(); auto quotaJob = new PropfindJob(acc, _remoteFolder, this); @@ -366,7 +366,7 @@ QUrl OwncloudAdvancedSetupPage::serverUrl() const int OwncloudAdvancedSetupPage::nextId() const { // tells the caller that this is the last dialog page - return -1; + return WizardCommon::Page_Magenta; //-1; } QString OwncloudAdvancedSetupPage::localFolder() const diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index faac2f5ad8934..43d2e5dcf82b1 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -55,6 +55,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) #else // WITH_WEBENGINE , _webViewPage(nullptr) #endif // WITH_WEBENGINE + , _magentaPage(new MagentaWizardPage(this)) { setObjectName("owncloudWizard"); @@ -64,6 +65,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) setPage(WizardCommon::Page_HttpCreds, _httpCredsPage); setPage(WizardCommon::Page_Flow2AuthCreds, _flow2CredsPage); setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage); + setPage(WizardCommon::Page_Magenta, _magentaPage); #ifdef WITH_WEBENGINE setPage(WizardCommon::Page_WebView, _webViewPage); #endif // WITH_WEBENGINE @@ -308,8 +310,11 @@ void OwncloudWizard::slotCurrentPageChanged(int id) id == WizardCommon::Page_Flow2AuthCreds) { setButtonLayout({ QWizard::BackButton, QWizard::Stretch }); } else if (id == WizardCommon::Page_AdvancedSetup) { - setButtonLayout({ QWizard::CustomButton2, QWizard::Stretch, QWizard::CustomButton1, QWizard::FinishButton }); + setButtonLayout({ QWizard::CustomButton2, QWizard::Stretch, QWizard::NextButton }); setNextButtonAsDefault(); + } else if (id == WizardCommon::Page_Magenta) { + setButtonLayout({ QWizard::Stretch, QWizard::FinishButton }); + //setNextButtonAsDefault(); } else { setButtonLayout({ QWizard::BackButton, QWizard::Stretch, QWizard::NextButton }); setNextButtonAsDefault(); diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h index 58d3e915d9d1b..b3a0b4677ea46 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -22,6 +22,7 @@ #include #include "networkjobs.h" +#include "nmcgui/magentaWizardPage.h" #include "wizard/owncloudwizardcommon.h" #include "accountfwd.h" @@ -127,6 +128,9 @@ public slots: AbstractCredentialsWizardPage *_credentialsPage = nullptr; WebViewPage *_webViewPage = nullptr; + //NMCCustomization + MagentaWizardPage *_magentaPage = nullptr; + QStringList _setupLog; bool _registration = false; diff --git a/src/gui/wizard/owncloudwizardcommon.h b/src/gui/wizard/owncloudwizardcommon.h index fb118d84f6fd2..3fc1c1f94483a 100644 --- a/src/gui/wizard/owncloudwizardcommon.h +++ b/src/gui/wizard/owncloudwizardcommon.h @@ -49,6 +49,7 @@ namespace WizardCommon { Page_WebView, #endif // WITH_WEBENGINE Page_AdvancedSetup, + Page_Magenta, }; } // ns WizardCommon diff --git a/src/gui/wizard/welcomepage.h b/src/gui/wizard/welcomepage.h index bef31f7756072..209b0a46919e2 100644 --- a/src/gui/wizard/welcomepage.h +++ b/src/gui/wizard/welcomepage.h @@ -35,19 +35,20 @@ class WelcomePage : public QWizardPage ~WelcomePage() override; [[nodiscard]] int nextId() const override; void initializePage() override; - void setLoginButtonDefault(); + virtual void setLoginButtonDefault(); + +protected: + virtual void styleSlideShow(); + QScopedPointer _ui; private: - void setupUi(); void customizeStyle(); - void styleSlideShow(); void setupSlideShow(); + void setupUi(); void setupLoginButton(); void setupCreateAccountButton(); void setupHostYourOwnServerLabel(); - QScopedPointer _ui; - OwncloudWizard *_ocWizard; WizardCommon::Pages _nextPage = WizardCommon::Page_ServerSetup; }; diff --git a/theme.qrc.in b/theme.qrc.in index e8d88fc8a1b0c..e9a08f373e2cc 100644 --- a/theme.qrc.in +++ b/theme.qrc.in @@ -238,5 +238,8 @@ theme/delete.svg theme/send.svg theme/call-notification.wav + theme/NMCIcons/page1.png + theme/NMCIcons/page2.png + theme/NMCIcons/page3.png diff --git a/theme/NMCIcons/page1.png b/theme/NMCIcons/page1.png new file mode 100644 index 0000000000000..5ecf4558b9732 Binary files /dev/null and b/theme/NMCIcons/page1.png differ diff --git a/theme/NMCIcons/page2.png b/theme/NMCIcons/page2.png new file mode 100644 index 0000000000000..cadc2dbe67ae9 Binary files /dev/null and b/theme/NMCIcons/page2.png differ diff --git a/theme/NMCIcons/page3.png b/theme/NMCIcons/page3.png new file mode 100644 index 0000000000000..088ec848a837f Binary files /dev/null and b/theme/NMCIcons/page3.png differ