diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 54d32c3580e86..96fb9c4f5ac4a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -23,6 +23,9 @@ endif() configure_file(${CMAKE_SOURCE_DIR}/theme.qrc.in ${CMAKE_SOURCE_DIR}/theme.qrc) set(theme_dir ${CMAKE_SOURCE_DIR}/theme) +#NMC customization: needed to find the ui file in a different location than the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + set(client_UI_SRCS accountsettings.ui conflictdialog.ui @@ -260,6 +263,10 @@ set(client_SRCS wizard/wizardproxysettingsdialog.cpp ) +file(GLOB NMC_FILES "nmcgui/*") +set(NMC_SRCS ${NMC_FILES}) +list(APPEND client_SRCS ${NMC_SRCS}) + if (NOT DISABLE_ACCOUNT_MIGRATION) list(APPEND client_SRCS legacyaccountselectiondialog.h diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp new file mode 100644 index 0000000000000..b826e93e2b335 --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -0,0 +1,162 @@ +/* +* 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 +#include +#include +#include +#include +#include +#include +#include + +#include "QProgressIndicator.h" +#include "theme.h" + +namespace OCC { + +NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) + : Flow2AuthWidget(parent) +{ + // Bestehende UI-Elemente ausblenden + if (getUi().logoLabel) { + getUi().logoLabel->hide(); + getUi().logoLabel->setFixedSize(0, 0); + } + if (getUi().label) { + getUi().label->hide(); + getUi().label->setFixedSize(0, 0); + } + if (getUi().copyLinkButton) { + getUi().copyLinkButton->hide(); + } + if (getUi().openLinkButton) { + getUi().openLinkButton->hide(); + } + if (auto *progressInd = getProgressIndicator()) { + progressInd->setVisible(false); + progressInd->setFixedSize(0, 0); + } + if (getUi().statusLabel) { + getUi().statusLabel->setVisible(false); + getUi().statusLabel->setFixedSize(0, 0); + } + + // Bestehendes Layout und Child-Widgets entfernen + if (auto *oldLayout = layout()) { + QLayoutItem *item; + while ((item = oldLayout->takeAt(0)) != nullptr) { + if (auto *widget = item->widget()) { + widget->setParent(nullptr); + } + delete item; + } + delete oldLayout; + } + + // Login-Button + auto loginButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + loginButton->setFocusPolicy(Qt::NoFocus); + loginButton->setFixedSize(130, 32); + loginButton->setStyleSheet( + "QPushButton { font-size: 15px; border: none; border-radius: 4px; background-color: #E20074; color: white; }" + "QPushButton:hover { background-color: #c00063; }" + ); + connect(loginButton, &QPushButton::clicked, this, &NMCFlow2AuthWidget::slotOpenBrowser); + + // Logo + Titel + auto logoLabel = new QLabel(this); + logoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + logoLabel->setFixedSize(36, 36); + + auto titleLabel = new QLabel(tr("MagentaCLOUD"), this); + titleLabel->setStyleSheet("font-weight: bold; font-size: 15px;"); + + auto logoTitleLayout = new QHBoxLayout; + logoTitleLayout->setSpacing(8); + logoTitleLayout->addWidget(logoLabel); + logoTitleLayout->addWidget(titleLabel); + logoTitleLayout->addStretch(); + + // Überschrift + auto headerLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + headerLabel->setStyleSheet("font-size: 24px; font-weight: normal;"); + headerLabel->setWordWrap(true); + headerLabel->setFixedWidth(282); + + // Anweisungs-Label + auto label = new QLabel(tr("Wechseln Sie bitte zu Ihrem Browser und melden Sie sich dort an, um Ihr Konto zu verbinden."), this); + label->setStyleSheet("font-size: 14px;"); + label->setWordWrap(true); + label->setFixedWidth(282); + + // Linke Seite + auto leftLayout = new QVBoxLayout; + leftLayout->addLayout(logoTitleLayout); + leftLayout->addSpacing(24); + leftLayout->addWidget(headerLabel); + leftLayout->addSpacing(16); + leftLayout->addWidget(label); + leftLayout->addSpacing(24); + leftLayout->addWidget(loginButton); + leftLayout->addStretch(); + + // Rechtes Logo + auto bigLogoLabel = new QLabel(this); + bigLogoLabel->setPixmap(QIcon(":/client/theme/NMCIcons/applicationLogo.svg").pixmap(175, 175)); + bigLogoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + bigLogoLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + + auto rightLayout = new QVBoxLayout; + rightLayout->addStretch(); + rightLayout->addWidget(bigLogoLabel); + rightLayout->addStretch(); + + // Hauptlayout + auto mainLayout = new QHBoxLayout; + mainLayout->setContentsMargins(16, 16, 16, 16); + mainLayout->setSpacing(24); + mainLayout->addLayout(leftLayout); + mainLayout->addStretch(); + mainLayout->addLayout(rightLayout); + + // Fehlerlabel wieder einfügen + if (getUi().errorLabel) { + mainLayout->addWidget(getUi().errorLabel); + } + setLayout(mainLayout); +} + +// Styling bewusst ignorieren +void NMCFlow2AuthWidget::customizeStyle() {} + +// Spinner einblenden / ungenutzt +void NMCFlow2AuthWidget::startSpinner() {} + +// Spinner ausblenden / ungenutzt +void NMCFlow2AuthWidget::stopSpinner(bool showStatusLabel) +{ + Q_UNUSED(showStatusLabel); +} + +// Statusänderung unterdrücken +void NMCFlow2AuthWidget::slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) +{ + Q_UNUSED(status); + Q_UNUSED(secondsLeft); +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h new file mode 100644 index 0000000000000..93fb357d67679 --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -0,0 +1,77 @@ +/* +* 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. +*/ + +/* +* 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 NMCFLOW2AUTHWIDGET_H +#define NMCFLOW2AUTHWIDGET_H + +#include "wizard/flow2authwidget.h" + +namespace OCC { + +class NMCFlow2AuthWidget : public Flow2AuthWidget +{ + Q_OBJECT + +public: + /** + * @brief Constructs an NMCFlow2AuthWidget object. + * @param parent The parent widget (default is nullptr). + */ + explicit NMCFlow2AuthWidget(QWidget *parent = nullptr); + + /** + * @brief Destructor for NMCFlow2AuthWidget. + */ + ~NMCFlow2AuthWidget() override = default; + +protected: + /** + * @brief Reimplemented from Flow2AuthWidget. + * Customizes the style of the widget. + */ + void customizeStyle() override; + + /** + * @brief Optionally reimplemented: controls spinner visibility/start. + */ + void startSpinner() override; + + /** + * @brief Optionally reimplemented: stops spinner and optionally shows label. + */ + void stopSpinner(bool showStatusLabel) override; + + /** + * @brief Optionally reimplemented: handles status updates during auth. + */ + void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft) 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..80127360e25f1 --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -0,0 +1,249 @@ +/* + * 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 +#include "common/utility.h" +#include "wizard/owncloudwizard.h" +#include "wizard/owncloudadvancedsetuppage.h" +#include "nmcgui/nmcowncloudadvancedsetuppage.h" + +namespace OCC { + +void OCC::NMCOwncloudAdvancedSetupPage::cleanUpElements() +{ + getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); + getUi().syncLogoLabel->setFixedSize(0,0); + getUi().syncLogoLabel->setVisible(false); + + getUi().horizontalLayout_6->removeWidget(getUi().confCheckBoxSize); + getUi().confCheckBoxSize->setFixedSize(0,0); + getUi().confCheckBoxSize->setVisible(false); + + getUi().horizontalLayout_6->removeWidget(getUi().confSpinBox); + getUi().confSpinBox->setFixedSize(0,0); + getUi().confSpinBox->setVisible(false); + + getUi().horizontalLayout_6->removeWidget(getUi().confTraillingSizeLabel); + getUi().confTraillingSizeLabel->setFixedSize(0,0); + getUi().confTraillingSizeLabel->setVisible(false); + + getUi().horizontalLayout_8->removeWidget(getUi().confCheckBoxExternal); + getUi().confCheckBoxExternal->setFixedSize(0,0); + getUi().confCheckBoxExternal->setVisible(false); + + getUi().lVirtualFileSync->removeWidget(getUi().rVirtualFileSync); + getUi().rVirtualFileSync->setFixedSize(0,0); + getUi().rVirtualFileSync->setVisible(false); + getUi().rVirtualFileSync->setChecked(true); + + getUi().resolutionWidget->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().errorLabel); + getUi().errorLabel->setFixedSize(0,0); + getUi().errorLabel->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().bottomLabel); + getUi().bottomLabel->setFixedSize(0,0); + getUi().bottomLabel->setVisible(false); + + getUi().verticalLayout->removeWidget(getUi().topLabel); + getUi().topLabel->setFixedSize(0,0); + getUi().topLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().syncLogoLabel); + getUi().syncLogoLabel->setFixedSize(0,0); + getUi().syncLogoLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().lLocal); + getUi().lLocal->setFixedSize(0,0); + getUi().lLocal->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().localFolderDescriptionLabel); + getUi().localFolderDescriptionLabel->setFixedSize(0,0); + getUi().localFolderDescriptionLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().lServerIcon); + getUi().lServerIcon->setFixedSize(0,0); + getUi().lServerIcon->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().userNameLabel); + getUi().userNameLabel->setFixedSize(0,0); + getUi().userNameLabel->setVisible(false); + + getUi().locationsGridLayout->removeWidget(getUi().serverAddressLabel); + getUi().serverAddressLabel->setFixedSize(0,0); + getUi().serverAddressLabel->setVisible(false); +} + +NMCOwncloudAdvancedSetupPage::NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard) + : OwncloudAdvancedSetupPage(wizard), + _tLogoLbl(new QLabel(this)) +{ + + cleanUpElements(); + + // Create and connect the push buttons to base slots + auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "NEXT")); + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ + validatePage(); + }); + + auto buttonLayout = new QHBoxLayout(); + buttonLayout->setSpacing(8); + // Set login button size and style + QSize buttonSize(130,32); + const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;} QPushButton:hover { background-color: %4; }" ); + loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white", "#c00063")); + loginBrowserButton->setFixedSize(buttonSize); + + getUi().locationsGridLayout->removeWidget(getUi().pbSelectLocalFolder); + getUi().pbSelectLocalFolder->setFixedSize(180, 32); + getUi().pbSelectLocalFolder->setStyleSheet(styleSheet.arg("1","white","black", "#ededed")); + getUi().pbSelectLocalFolder->setText("Speicherort ändern"); + + buttonLayout->addWidget(getUi().pbSelectLocalFolder); + buttonLayout->addWidget(loginBrowserButton); + buttonLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed)); + + // Create needed layouts + auto mainVerticalLayout = new QVBoxLayout(); + auto subMainHorizontalLayout = new QHBoxLayout(); + auto leftSideVerticalLayout = new QVBoxLayout(); + auto rightSideVerticalLayout = new QVBoxLayout(); + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16,8,40,0); + subMainHorizontalLayout->setSpacing(0); + subMainHorizontalLayout->setContentsMargins(0,0,0,0); + leftSideVerticalLayout->setSpacing(0); + leftSideVerticalLayout->setContentsMargins(0,0,0,0); + rightSideVerticalLayout->setSpacing(0); + rightSideVerticalLayout->setContentsMargins(0,0,0,0); + + mainVerticalLayout->addLayout(subMainHorizontalLayout); + + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(12,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + subMainHorizontalLayout->addLayout(leftSideVerticalLayout); + subMainHorizontalLayout->addLayout(rightSideVerticalLayout); + + leftSideVerticalLayout->setSpacing(0); + + // Create a horizontal T-Logo and MagentaCLOUC-label layout + auto hLogoAndLabelLayout = new QHBoxLayout(); + hLogoAndLabelLayout->setSpacing(0); + hLogoAndLabelLayout->setContentsMargins(0,0,0,0); + + // Telekom Logo + _tLogoLbl->setFixedSize(36,36); + _tLogoLbl->setPixmap(QIcon(":/client/theme/NMCIcons/tlogocarrier.svg").pixmap(36, 36)); + hLogoAndLabelLayout->addWidget(_tLogoLbl); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + hLogoAndLabelLayout->addSpacerItem(new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // MagentaCLOUD label + QLabel *magentaLabel = new QLabel("MagentaCLOUD"); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hLogoAndLabelLayout->addWidget(magentaLabel); + leftSideVerticalLayout->addItem(hLogoAndLabelLayout); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Headline + QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_2")); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setWordWrap(true); + descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); + leftSideVerticalLayout->addWidget(descriptionLabel); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Path to a local folder + getUi().locationsGridLayout->removeWidget(getFilePathLabel().data()); + leftSideVerticalLayout->addWidget(getFilePathLabel().data()); + getFilePathLabel().data()->setAlignment(Qt::AlignLeft); + getFilePathLabel().data()->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + + // Free space available + getUi().locationsGridLayout->removeWidget(getUi().lFreeSpace); + leftSideVerticalLayout->addWidget(getUi().lFreeSpace); + getUi().lFreeSpace->setAlignment(Qt::AlignLeft); + getUi().lFreeSpace->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,8, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Synch Radio button layout + getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_5); + leftSideVerticalLayout->addLayout(getUi().horizontalLayout_5); + + // Disable Mac related UI fields + if(Utility::isWindows()) + { + getUi().lSyncEverythingSizeLabel->setVisible(false); + getUi().rSyncEverything->setVisible(false); + getUi().rSelectiveSync->setVisible(false); + getUi().bSelectiveSync->setVisible(false); + getUi().lSelectiveSyncSizeLabel->setVisible(false); + } + + // Choose what to sync layout + getUi().wSyncStrategy->removeItem(getUi().horizontalLayout_10); + leftSideVerticalLayout->addLayout(getUi().horizontalLayout_10); + getUi().horizontalLayout_10->removeWidget(getUi().lSelectiveSyncSizeLabel); //Remove text label, its not needed + getUi().lSelectiveSyncSizeLabel->setVisible(false); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Detail description + QLabel *detailLabel = new QLabel(QCoreApplication::translate("","SETUP_DESCRIPTION_TEXT_2")); + detailLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + detailLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + detailLabel->setWordWrap(true); + detailLabel->setMinimumWidth(396); + leftSideVerticalLayout->addWidget(detailLabel); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Add buttons + leftSideVerticalLayout->addItem(buttonLayout); + + leftSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + + // Add items to the right side + QLabel *bigMagentaIcon = new QLabel(""); + bigMagentaIcon->setFixedSize(175,175); + bigMagentaIcon->setPixmap(QIcon(":/client/theme/NMCIcons/folderLogo.svg").pixmap(175, 175)); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,164, QSizePolicy::Fixed, QSizePolicy::Fixed)); + rightSideVerticalLayout->addWidget(bigMagentaIcon); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding)); + subMainHorizontalLayout->addSpacerItem(new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed)); + + // Delete previous installed layout, or you can not apply the new one. + QLayout* layout = this->layout (); + if (layout != 0) + { + QLayoutItem *item; + while ((item = layout->takeAt(0)) != 0) + layout->removeItem (item); + delete layout; + } + + this->setLayout(mainVerticalLayout); +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h new file mode 100644 index 0000000000000..f283f505a644c --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h @@ -0,0 +1,60 @@ +/* + * 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 +#include + +#include "wizard/owncloudadvancedsetuppage.h" + +namespace OCC { + +/** + * @brief The NMCOwncloudAdvancedSetupPage class. + * @ingroup gui + * Subclass of OwncloudAdvancedSetupPage, representing the advanced setup page for NMC OwnCloud. + */ +class NMCOwncloudAdvancedSetupPage : public OwncloudAdvancedSetupPage +{ + Q_OBJECT + +public: + /** + * @brief Constructs an NMCOwncloudAdvancedSetupPage object. + * @param wizard Pointer to the parent OwncloudWizard. + */ + explicit NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); + + /** + * @brief Destructor for NMCOwncloudAdvancedSetupPage. + */ + ~NMCOwncloudAdvancedSetupPage() override = default; + +private: + /** + * @brief Pointer to the QLabel for the custom logo. + */ + QLabel *_tLogoLbl; + + /** + * @brief Helper function to clean up elements. + */ + void cleanUpElements(); +}; + +} // namespace OCC + +#endif // MIRALL_NMCOWNCLOUD_ADVANCED_SETUP_PAGE_H diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index 9e6c48eab996e..51db14a50b0d9 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -13,6 +13,7 @@ #include "wizard/owncloudwizardcommon.h" #include "wizard/owncloudwizard.h" #include "wizard/flow2authwidget.h" +#include "nmcgui/nmcflow2authwidget.h" #include "creds/credentialsfactory.h" #include "creds/webflowcredentials.h" @@ -23,7 +24,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 65c861a04f0dd..00b23e575d9d9 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -31,13 +31,24 @@ class Flow2AuthWidget : public QWidget public Q_SLOTS: void slotAuthResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void slotPollNow(); - void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); + virtual void slotStatusChanged(Flow2Auth::PollStatus status, int secondsLeft); void slotStyleChanged(); Q_SIGNALS: void authResult(Flow2Auth::Result, const QString &errorString, const QString &user, const QString &appPassword); void pollNow(); +protected: + Ui_Flow2AuthWidget &getUi() + { + return _ui; + } + + QProgressIndicator *getProgressIndicator() + { + return _progressIndi; + } + private: Account *_account = nullptr; std::unique_ptr _asyncAuth; @@ -47,10 +58,12 @@ protected Q_SLOTS: void slotOpenBrowser(); void slotCopyLinkToClipboard(); +protected: + virtual void customizeStyle(); + private: - void startSpinner(); - void stopSpinner(bool showStatusLabel); - void customizeStyle(); + virtual void startSpinner(); + virtual void stopSpinner(bool showStatusLabel); void setLogo(); QProgressIndicator *_progressIndi; diff --git a/src/gui/wizard/owncloudadvancedsetuppage.h b/src/gui/wizard/owncloudadvancedsetuppage.h index 595d57140ce26..2f556cf988fd3 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.h +++ b/src/gui/wizard/owncloudadvancedsetuppage.h @@ -42,6 +42,16 @@ class OwncloudAdvancedSetupPage : public QWizardPage void setMultipleFoldersExist(bool exist); void directoriesCreated(); + QScopedPointer &getFilePathLabel() + { + return _filePathLabel; + } + + OwncloudWizard *ocWizard() const + { + return _ocWizard; + } + signals: void createLocalAndRemoteFolders(const QString &, const QString &); @@ -57,6 +67,12 @@ private slots: void slotQuotaRetrieved(const QVariantMap &result); void slotQuotaRetrievedWithError(QNetworkReply *reply); +protected: + Ui_OwncloudAdvancedSetupPage &getUi() + { + return _ui; + } + private: void setRadioChecked(QRadioButton *radio); diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 616d6527b2328..e8933b2cc2bd3 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -86,7 +86,12 @@ OwncloudSetupPage::OwncloudSetupPage(QWidget *parent) void OwncloudSetupPage::setLogo() { - _ui.logoLabel->setPixmap(Theme::instance()->wizardApplicationLogo()); + const auto isDarkBackground = Theme::isDarkColor(palette().window().color()); + if (isDarkBackground) { + _ui.logoLabel->setPixmap(Theme::instance()->wizardApplicationLogo()); + } else { + _ui.logoLabel->setPixmap(Theme::instance()->wizardApplicationLogoColored(QColor("#e20074"))); + } } void OwncloudSetupPage::setupServerAddressDescriptionLabel() diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index 572d1f10f8bd2..c4892c5002d9a 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -20,6 +20,7 @@ #include "wizard/owncloudhttpcredspage.h" #include "wizard/termsofservicewizardpage.h" #include "wizard/owncloudadvancedsetuppage.h" +#include "nmcgui/nmcowncloudadvancedsetuppage.h" #include "wizard/webviewpage.h" #include "wizard/flow2authcredspage.h" @@ -50,7 +51,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) , _httpCredsPage(new OwncloudHttpCredsPage(this)) , _flow2CredsPage(new Flow2AuthCredsPage) , _termsOfServicePage(new TermsOfServiceWizardPage) - , _advancedSetupPage(new OwncloudAdvancedSetupPage(this)) + , _advancedSetupPage(new NMCOwncloudAdvancedSetupPage(this)) #ifdef WITH_WEBENGINE , _webViewPage(new WebViewPage(this)) #else // WITH_WEBENGINE @@ -127,6 +128,8 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) adjustWizardSize(); centerWindow(); + + this->setStyleSheet("QWizard { margin: 0; padding: 0; }" "QWizard::separator { width: 0; }"); } void OwncloudWizard::centerWindow() @@ -144,17 +147,7 @@ void OwncloudWizard::centerWindow() void OwncloudWizard::adjustWizardSize() { - const auto pageSizes = calculateWizardPageSizes(); - const auto currentPageIndex = currentId(); - - // If we can, just use the size of the current page - if(currentPageIndex > -1 && currentPageIndex < pageSizes.count()) { - resize(pageSizes.at(currentPageIndex)); - return; - } - - // As a backup, resize to largest page - resize(calculateLargestSizeOfWizardPages(pageSizes)); + resize(698, 474); // NMC customization } QList OwncloudWizard::calculateWizardPageSizes() const @@ -364,8 +357,9 @@ void OwncloudWizard::slotCurrentPageChanged(int id) id == WizardCommon::Page_Flow2AuthCreds || id == WizardCommon::Page_TermsOfService) { setButtonLayout({QWizard::BackButton, QWizard::Stretch}); + button(QWizard::BackButton)->setVisible(false); } else if (id == WizardCommon::Page_AdvancedSetup) { - setButtonLayout({QWizard::CustomButton2, QWizard::Stretch, QWizard::CustomButton1, QWizard::FinishButton}); + setButtonLayout({ }); setNextButtonAsDefault(); } else if (id == WizardCommon::Page_ServerSetup) { if constexpr (Theme::doNotUseProxy()) { @@ -457,6 +451,11 @@ void OwncloudWizard::changeEvent(QEvent *e) QWizard::changeEvent(e); } +void OwncloudWizard::paintEvent(QPaintEvent *event) +{ + QWizard::paintEvent(event); +} + void OwncloudWizard::hideEvent(QHideEvent *event) { QWizard::hideEvent(event); diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h index 3b1fa07984e3d..a204e686baa14 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -111,6 +111,7 @@ public slots: void changeEvent(QEvent *) override; void hideEvent(QHideEvent *) override; void closeEvent(QCloseEvent *) override; + void paintEvent(QPaintEvent *event) override; private: void customizeStyle(); diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 81342a629edef..cd5b23b1c946e 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -801,6 +801,29 @@ QPixmap Theme::wizardApplicationLogo() const #endif } +QPixmap Theme::wizardApplicationLogoColored(const QColor &color) const +{ + const QString svgPath = QString(Theme::themePrefix) + QStringLiteral("colored/wizard_logo.svg"); + + QSvgRenderer svg(svgPath); + + QSizeF viewBox = svg.viewBoxF().size(); + QSize size = viewBox.toSize(); + + QPixmap pixmap(size); + pixmap.fill(Qt::transparent); + + QPainter painter(&pixmap); + painter.setCompositionMode(QPainter::CompositionMode_SourceOver); + svg.render(&painter); + + painter.setCompositionMode(QPainter::CompositionMode_SourceIn); + painter.fillRect(pixmap.rect(), color); + painter.end(); + + return pixmap; +} + QPixmap Theme::wizardHeaderLogo() const { #ifdef APPLICATION_WIZARD_USE_CUSTOM_LOGO diff --git a/src/libsync/theme.h b/src/libsync/theme.h index f58ed444d7a91..2cbb3bc488c2b 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -348,6 +348,9 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject /** @return logo for the setup wizard. */ [[nodiscard]] QPixmap wizardHeaderLogo() const; + /** @return colored logo for the setup wizard. */ + [[nodiscard]] QPixmap wizardApplicationLogoColored(const QColor &color) const; + /** * The default implementation creates a * background based on diff --git a/theme/NMCIcons/ApplicationLogo.svg b/theme/NMCIcons/ApplicationLogo.svg new file mode 100644 index 0000000000000..efc8c94e1df28 --- /dev/null +++ b/theme/NMCIcons/ApplicationLogo.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/theme/NMCIcons/folderLogo.svg b/theme/NMCIcons/folderLogo.svg new file mode 100644 index 0000000000000..45f4cb770d6bb --- /dev/null +++ b/theme/NMCIcons/folderLogo.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/theme/NMCIcons/tlogocarrier.svg b/theme/NMCIcons/tlogocarrier.svg new file mode 100644 index 0000000000000..8fb2ff11a1050 --- /dev/null +++ b/theme/NMCIcons/tlogocarrier.svg @@ -0,0 +1 @@ + \ No newline at end of file