diff --git a/CMakeLists.txt b/CMakeLists.txt index 27102a6f0e7c..2434776e7b04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,9 @@ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES) set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(NMC_RCC_FILE "nmctheme_v1.rcc") +configure_file(${CMAKE_SOURCE_DIR}/${NMC_RCC_FILE} "${BIN_OUTPUT_DIRECTORY}/${NMC_RCC_FILE}" COPYONLY) + include(${CMAKE_SOURCE_DIR}/NEXTCLOUD.cmake) set(QT_VERSION_MAJOR "6") @@ -341,6 +344,7 @@ configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) if(BUILD_OWNCLOUD_OSX_BUNDLE) install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/) configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY) + install(FILES nmctheme_v1.rcc DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/) elseif(BUILD_CLIENT) install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} ) configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY) diff --git a/nmctheme_v1.rcc b/nmctheme_v1.rcc new file mode 100644 index 000000000000..1e673f886e4f Binary files /dev/null and b/nmctheme_v1.rcc differ diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 9660bfb7ee7f..0402a9c1a26c 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -3,6 +3,9 @@ find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Svg Qml Quick Qui find_package(KF6Archive REQUIRED) find_package(KF6GuiAddons) +#NMC change, its needed to find the ui file in a different location than the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + if (NOT TARGET Qt::GuiPrivate) message(FATAL_ERROR "Could not find GuiPrivate component of Qt. It might be shipped as a separate package, please check that.") endif() @@ -251,6 +254,10 @@ set(client_SRCS wizard/linklabel.cpp ) +file(GLOB NMC_FILES "nmcgui/*") +set(NMC_SRCS ${NMC_FILES}) +list(APPEND client_SRCS ${NMC_SRCS}) + if (WITH_WEBENGINE) list(APPEND client_SRCS wizard/webviewpage.h @@ -618,6 +625,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) install(FILES ${VISUAL_ELEMENTS} DESTINATION bin/visualelements) install(FILES "${theme_dir}/${APPLICATION_EXECUTABLE}.VisualElementsManifest.xml" DESTINATION bin) install(FILES ${client_I18N} DESTINATION i18n) + install(FILES ${CMAKE_SOURCE_DIR}/nmctheme_v1.rcc DESTINATION bin) endif() # we may not add MACOSX_BUNDLE here, if not building one diff --git a/src/gui/main.cpp b/src/gui/main.cpp index e91fb3be9a1f..f9a92fda2d1b 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -57,6 +57,14 @@ int main(int argc, char **argv) qputenv("QML_IMPORT_PATH", (QDir::currentPath() + QStringLiteral("/qml")).toLatin1()); #endif + bool resourceLoaded = false; + const QString currentPath = QDir::currentPath(); + if(Utility::isMac()) { + resourceLoaded = QResource::registerResource(QDir::toNativeSeparators("/Applications/MagentaCLOUD.app/Contents/Resources/nmctheme_v1.rcc")); + } else if(Utility::isWindows() || !resourceLoaded) { + resourceLoaded = QResource::registerResource(QDir::toNativeSeparators(currentPath + "/nmctheme_v1.rcc")); + } + Q_INIT_RESOURCE(resources); Q_INIT_RESOURCE(theme); diff --git a/src/gui/nmcgui/nmcflow2authwidget.cpp b/src/gui/nmcgui/nmcflow2authwidget.cpp new file mode 100644 index 000000000000..26c1a91a71bd --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.cpp @@ -0,0 +1,175 @@ +/* + * 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 "QProgressIndicator.h" +#include "QPushButton" +#include "QDesktopServices" +#include "QtGui/qpainter.h" +#include "theme.h" + +namespace OCC { + + +NMCFlow2AuthWidget::NMCFlow2AuthWidget(QWidget *parent) + : Flow2AuthWidget(parent) +{ + + //setFixedSize(700,502); + + getUi().copyLinkLabel->setVisible(false); + getUi().openLinkLabel->setVisible(false); + auto progressInd = getProgressIndicator(); + getUi().progressLayout->removeWidget(progressInd); + progressInd->setVisible(false); + progressInd->setFixedSize(0,0); + + //Create and connect the push buttons to base slots + auto loginBrowserButton = new QPushButton(QCoreApplication::translate("", "LOGIN")); + loginBrowserButton->setFocusPolicy(Qt::NoFocus); + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ + slotOpenBrowser(); + }); + + //Set login button size and style + QSize buttonSize(130,32); + const QString styleSheetHoverPart = "QPushButton:hover { background-color: #c00063; }"; + const QString styleSheet("QPushButton{font-size: 15px; border: %1px solid; border-color: black; border-radius: 4px; background-color: %2; color: %3;}" + styleSheetHoverPart ); + loginBrowserButton->setStyleSheet(styleSheet.arg("0","#E20074","white")); + loginBrowserButton->setFixedSize(buttonSize); + + //Create needed layouts + auto mainVerticalLayout = new QVBoxLayout(this); + auto subMainHorizontalLayout = new QHBoxLayout(this); + auto leftSideVerticalLayout = new QVBoxLayout(this); + auto rightSideVerticalLayout = new QVBoxLayout(this); + mainVerticalLayout->setSpacing(0); + mainVerticalLayout->setContentsMargins(16,8,28,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); + + QSpacerItem *spacer4 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + subMainHorizontalLayout->addSpacerItem(spacer4); + subMainHorizontalLayout->addLayout(leftSideVerticalLayout); + subMainHorizontalLayout->addLayout(rightSideVerticalLayout); + + //Create a horizontal Logo and label layout + auto hLogoAndLabelLayout = new QHBoxLayout(this); + hLogoAndLabelLayout->setContentsMargins(0,0,0,0); + getUi().verticalLayout_3->removeWidget(getUi().logoLabel); + getUi().logoLabel->setFixedSize(36,36); + getUi().logoLabel->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/tlogocarrier.svg")).pixmap(36,36)); + + hLogoAndLabelLayout->addWidget(getUi().logoLabel); + + QSpacerItem *spacer3 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->addSpacerItem(spacer3); + + QSpacerItem *spacer9 = new QSpacerItem(8,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + hLogoAndLabelLayout->addSpacerItem(spacer9); + + QLabel *magentaLabel = new QLabel("MagentaCLOUD"); + magentaLabel->setStyleSheet("QLabel{font-size: 15px; font-weight: bold;}"); + magentaLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hLogoAndLabelLayout->addWidget(magentaLabel); + leftSideVerticalLayout->insertItem(1, hLogoAndLabelLayout); + + QSpacerItem *spacer7 = new QSpacerItem(1,24, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(2, spacer7); + + QLabel *descriptionLabel = new QLabel(QCoreApplication::translate("", "SETUP_HEADER_TEXT_1")); + descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + descriptionLabel->setStyleSheet("QLabel{font-size: 28px; font-weight: normal;}"); + descriptionLabel->setWordWrap(true); + descriptionLabel->setMinimumSize(descriptionLabel->sizeHint()); + leftSideVerticalLayout->insertWidget(3, descriptionLabel); + + QSpacerItem *spacer5 = new QSpacerItem(1,16, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(4, spacer5); + + getUi().label->setStyleSheet("QLabel{font-size: 15px; font-weight: normal;}"); + getUi().verticalLayout_3->removeWidget(getUi().label); + leftSideVerticalLayout->insertWidget(5, getUi().label); + getUi().label->setText("Wechseln Sie bitte zu ihrem Browser und melden Sie sich dort an um ihr Konto zu verbinden."); + getUi().label->setFixedWidth(282); + getUi().label->setAlignment(Qt::AlignLeft); + + QSpacerItem *spacer6 = new QSpacerItem(1,32, QSizePolicy::Fixed, QSizePolicy::Fixed); + leftSideVerticalLayout->insertSpacerItem(6, spacer6); + + //Add buttons + leftSideVerticalLayout->insertWidget(7, loginBrowserButton); + + QSpacerItem *spacer11 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); + leftSideVerticalLayout->addSpacerItem(spacer11); + + //Add items to the right side + QLabel *bigMagetnaIcon = new QLabel("Test"); + bigMagetnaIcon->setFixedSize(175,175); + bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/applicationLogo.svg")).pixmap(175,175)); + + QSpacerItem *spacer1 = new QSpacerItem(1,98, QSizePolicy::Fixed, QSizePolicy::Fixed); + rightSideVerticalLayout->addSpacerItem(spacer1); + rightSideVerticalLayout->addWidget(bigMagetnaIcon); + + QSpacerItem *spacer10 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); + rightSideVerticalLayout->addSpacerItem(spacer10); + + QSpacerItem *spacer2 = new QSpacerItem(0,1, QSizePolicy::Fixed, QSizePolicy::Fixed); + subMainHorizontalLayout->addSpacerItem(spacer2); + + + getUi().verticalLayout_3->removeWidget(getUi().errorLabel); + mainVerticalLayout->addWidget(getUi().errorLabel); + + getUi().verticalLayout_3->removeWidget(getUi().statusLabel); + getUi().statusLabel->setFixedSize(0,0); + + + //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); +} + +void NMCFlow2AuthWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter; + painter.begin(this); + painter.fillRect(rect(), Qt::white); + painter.end(); + Flow2AuthWidget::paintEvent(event); +} + +void NMCFlow2AuthWidget::customizeStyle() +{ + //Empty +} + + +} // namespace OCC \ No newline at end of file diff --git a/src/gui/nmcgui/nmcflow2authwidget.h b/src/gui/nmcgui/nmcflow2authwidget.h new file mode 100644 index 000000000000..0a74802bea5b --- /dev/null +++ b/src/gui/nmcgui/nmcflow2authwidget.h @@ -0,0 +1,55 @@ +/* + * 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). + */ + NMCFlow2AuthWidget(QWidget *parent = nullptr); + + /** + * @brief Destructor for NMCFlow2AuthWidget. + */ + ~NMCFlow2AuthWidget() = default; + +protected: + /** + * @brief Reimplemented from Flow2AuthWidget. + * Paints the widget during the paint event. + * @param event The paint event. + */ + void paintEvent(QPaintEvent *event) override; + + /** + * @brief Reimplemented from Flow2AuthWidget. + * Customizes the style of the widget. + */ + void customizeStyle() 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 000000000000..06a4acc3a47c --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.cpp @@ -0,0 +1,258 @@ +/* + * 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 "QtGui/qpainter.h" +#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("", "LOGIN")); + connect(loginBrowserButton, &QPushButton::clicked, this, [this](){ + validatePage(); + }); + + auto buttonLayout = new QHBoxLayout(this); + 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(this); + auto subMainHorizontalLayout = new QHBoxLayout(this); + auto leftSideVerticalLayout = new QVBoxLayout(this); + auto rightSideVerticalLayout = new QVBoxLayout(this); + 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(this); + hLogoAndLabelLayout->setSpacing(0); + hLogoAndLabelLayout->setContentsMargins(0,0,0,0); + + //T-Logo + _tLogoLbl->setFixedSize(36,36); + _tLogoLbl->setPixmap(QIcon(QLatin1String(":/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; color: black}"); + + //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; color: black}"); + + 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 *bigMagetnaIcon = new QLabel(""); + bigMagetnaIcon->setFixedSize(175,175); + bigMagetnaIcon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/folderLogo.svg")).pixmap(175,175)); + + rightSideVerticalLayout->addSpacerItem(new QSpacerItem(1,164, QSizePolicy::Fixed, QSizePolicy::Fixed)); + rightSideVerticalLayout->addWidget(bigMagetnaIcon); + + 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); +} + +void NMCOwncloudAdvancedSetupPage::paintEvent(QPaintEvent *event) +{ + QPainter painter; + painter.begin(this); + painter.fillRect(rect(), Qt::white); + painter.end(); + OwncloudAdvancedSetupPage::paintEvent(event); +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h new file mode 100644 index 000000000000..cfaa79c35e83 --- /dev/null +++ b/src/gui/nmcgui/nmcowncloudadvancedsetuppage.h @@ -0,0 +1,66 @@ +/* + * 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 "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. + */ + NMCOwncloudAdvancedSetupPage(OwncloudWizard *wizard); + + /** + * @brief Destructor for NMCOwncloudAdvancedSetupPage. + */ + ~NMCOwncloudAdvancedSetupPage() = default; + +protected: + /** + * @brief Override of paintEvent to handle custom painting. + * @param event Pointer to the QPaintEvent object. + */ + void paintEvent(QPaintEvent *event) override; + +private: + /** + * @brief Pointer to the QLabel for the custom logo. + */ + QLabel *_tLogoLbl = nullptr; + + /** + * @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 e03b9a50faba..dc9d80738aa7 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -25,6 +25,7 @@ #include "wizard/flow2authwidget.h" #include "creds/credentialsfactory.h" #include "creds/webflowcredentials.h" +#include "nmcgui/nmcflow2authwidget.h" namespace OCC { @@ -33,7 +34,8 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() { _layout = new QVBoxLayout(this); - _flow2AuthWidget = new Flow2AuthWidget(); + // _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 2660ff0b7620..3de1b1c721b7 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -47,6 +47,17 @@ public Q_SLOTS: 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; QScopedPointer _asyncAuth; @@ -56,10 +67,13 @@ protected Q_SLOTS: void slotOpenBrowser(); void slotCopyLinkToClipboard(); +protected: + virtual void customizeStyle(); + private: void startSpinner(); void stopSpinner(bool showStatusLabel); - void customizeStyle(); + // void customizeStyle(); void setLogo(); QProgressIndicator *_progressIndi; diff --git a/src/gui/wizard/owncloudadvancedsetuppage.h b/src/gui/wizard/owncloudadvancedsetuppage.h index 2c0f23bb42b3..06629966cb04 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.h +++ b/src/gui/wizard/owncloudadvancedsetuppage.h @@ -50,6 +50,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 &); @@ -64,6 +74,12 @@ private slots: void slotVirtualFileSyncClicked(); void slotQuotaRetrieved(const QVariantMap &result); +protected: + Ui_OwncloudAdvancedSetupPage &getUi() + { + return _ui; + } + private: void setRadioChecked(QRadioButton *radio); diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index f09c52fcaf15..73805782bcea 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -18,6 +18,7 @@ #include "configfile.h" #include "theme.h" #include "owncloudgui.h" +#include "nmcgui/nmcowncloudadvancedsetuppage.h" #ifdef Q_OS_MAC #include "foregroundbackground_interface.h" @@ -53,7 +54,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 @@ -124,6 +125,8 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) adjustWizardSize(); centerWindow(); + + this->setStyleSheet("QWizard { margin: 0; padding: 0; }" "QWizard::separator { width: 0; }"); } void OwncloudWizard::centerWindow() @@ -141,17 +144,18 @@ void OwncloudWizard::centerWindow() void OwncloudWizard::adjustWizardSize() { - const auto pageSizes = calculateWizardPageSizes(); - const auto currentPageIndex = currentId(); + // 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; - } + // if(currentPageIndex > -1 && currentPageIndex < pageSizes.count()) { + // resize(pageSizes.at(currentPageIndex)); + // return; + // } // As a backup, resize to largest page - resize(calculateLargestSizeOfWizardPages(pageSizes)); + // resize(calculateLargestSizeOfWizardPages(pageSizes)); + resize(700,460); // NMC customization } QList OwncloudWizard::calculateWizardPageSizes() const @@ -330,8 +334,10 @@ void OwncloudWizard::slotCurrentPageChanged(int id) #endif // WITH_WEBENGINE id == WizardCommon::Page_Flow2AuthCreds) { 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({ QWizard::CustomButton2, QWizard::Stretch, QWizard::CustomButton1, QWizard::FinishButton }); + setButtonLayout({ }); setNextButtonAsDefault(); } else { setButtonLayout({ QWizard::BackButton, QWizard::Stretch, QWizard::NextButton }); @@ -408,6 +414,11 @@ void OwncloudWizard::changeEvent(QEvent *e) QWizard::changeEvent(e); } +void OwncloudWizard::paintEvent(QPaintEvent *event) +{ + 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 7f69587a45da..df1d075dab88 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -113,6 +113,7 @@ public slots: protected: void changeEvent(QEvent *) override; + void paintEvent(QPaintEvent *event) override; private: void customizeStyle(); diff --git a/theme/NMCIcons/ApplicationLogo.svg b/theme/NMCIcons/ApplicationLogo.svg new file mode 100644 index 000000000000..efc8c94e1df2 --- /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 000000000000..45f4cb770d6b --- /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 000000000000..8fb2ff11a105 --- /dev/null +++ b/theme/NMCIcons/tlogocarrier.svg @@ -0,0 +1 @@ + \ No newline at end of file