diff --git a/CMakeLists.txt b/CMakeLists.txt index 27102a6f0e7cd..2434776e7b040 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 0000000000000..1e673f886e4f5 Binary files /dev/null and b/nmctheme_v1.rcc differ diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 9660bfb7ee7f2..0402a9c1a26c2 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/accountsettings.cpp b/src/gui/accountsettings.cpp index 6446876cd0f19..9c7c402ed5145 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -22,7 +22,8 @@ #include "theme.h" #include "foldercreationdialog.h" #include "folderman.h" -#include "folderwizard.h" +// #include "folderwizard.h" +#include "nmcgui/nmcfolderwizard.h" #include "folderstatusmodel.h" #include "folderstatusdelegate.h" #include "common/utility.h" @@ -774,7 +775,8 @@ void AccountSettings::slotAddFolder() const auto folderMan = FolderMan::instance(); folderMan->setSyncEnabled(false); // do not start more syncs. - const auto folderWizard = new FolderWizard(_accountState->account(), this); + // const auto folderWizard = new FolderWizard(_accountState->account(), this); + const auto folderWizard = new NMCFolderWizard(_accountState->account(), this); folderWizard->setAttribute(Qt::WA_DeleteOnClose); connect(folderWizard, &QDialog::accepted, this, &AccountSettings::slotFolderWizardAccepted); @@ -785,7 +787,8 @@ void AccountSettings::slotAddFolder() void AccountSettings::slotFolderWizardAccepted() { - const auto folderWizard = qobject_cast(sender()); + // const auto folderWizard = qobject_cast(sender()); + const auto folderWizard = qobject_cast(sender()); const auto folderMan = FolderMan::instance(); qCInfo(lcAccountSettings) << "Folder wizard completed"; diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index 3b8ac7aac9a9d..d1c8428406174 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -505,9 +505,10 @@ bool FolderWizardRemotePath::isComplete() const if (QDir::cleanPath(dir) == QDir::cleanPath(curDir)) { warnStrings.append(tr("This folder is already being synced.")); } else if (dir.startsWith(curDir)) { - warnStrings.append(tr("You are already syncing %1, which is a parent folder of %2.").arg(Utility::escape(curDir), Utility::escape(dir))); + // warnStrings.append(tr("You are already syncing %1, which is a parent folder of %2.").arg(Utility::escape(curDir), Utility::escape(dir))); } else if (curDir.startsWith(dir)) { - warnStrings.append(tr("You are already syncing %1, which is a subfolder of %2.").arg(Utility::escape(curDir), Utility::escape(dir))); + // warnStrings.append(tr("You are already syncing %1, which is a subfolder of %2.").arg(Utility::escape(curDir), Utility::escape(dir))); + warnStrings.append(QCoreApplication::translate("", "FOLDER_WIZARD_FOLDER_WARNING")); //NMC customization } } @@ -564,7 +565,8 @@ void FolderWizardRemotePath::changeStyle() FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account) { auto *layout = new QVBoxLayout(this); - _selectiveSync = new SelectiveSyncWidget(account, this); + // _selectiveSync = new SelectiveSyncWidget(account, this); + _selectiveSync = new NMCSelectiveSyncWidget(account, this); layout->addWidget(_selectiveSync); if (Theme::instance()->showVirtualFilesOption() && bestAvailableVfsMode() != Vfs::Off) { @@ -679,7 +681,11 @@ FolderWizard::FolderWizard(AccountPtr account, QWidget *parent) setPage(Page_Target, _folderWizardTargetPage); _folderWizardTargetPage->installEventFilter(this); } - setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage); + // setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage); + if(Utility::isMac()) + { + setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage); + } setWindowTitle(tr("Add Folder Sync Connection")); setOptions(QWizard::CancelButtonOnLeft); diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h index 867a50ec7b967..838349e71e371 100644 --- a/src/gui/folderwizard.h +++ b/src/gui/folderwizard.h @@ -22,14 +22,15 @@ #include "folder.h" #include "accountfwd.h" -#include "ui_folderwizardsourcepage.h" -#include "ui_folderwizardtargetpage.h" +#include "nmcgui/nmcfolderwizardsourcepage.h" +#include "nmcgui/nmcfolderwizardtargetpage.h" +#include "nmcgui/nmcselectivesyncdialog.h" class QCheckBox; namespace OCC { -class SelectiveSyncWidget; +class NMCSelectiveSyncWidget; class ownCloudInfo; @@ -61,6 +62,11 @@ class FolderWizardLocalPath : public FormatWarningsWizardPage void setFolderMap(const Folder::Map &fm) { _folderMap = fm; } + NMCFolderWizardSourcePage getUi() + { + return _ui; + } + protected: void changeEvent(QEvent *) override; @@ -70,7 +76,7 @@ protected slots: private: void changeStyle(); - Ui_FolderWizardSourcePage _ui{}; + NMCFolderWizardSourcePage _ui{}; Folder::Map _folderMap; AccountPtr _account; }; @@ -93,6 +99,11 @@ class FolderWizardRemotePath : public FormatWarningsWizardPage void initializePage() override; void cleanupPage() override; + NMCFolderWizardTargetPage getUi() + { + return _ui; + }; + protected slots: void showWarn(const QString & = QString()) const; void slotAddRemoteFolder(); @@ -119,7 +130,7 @@ private slots: LsColJob *runLsColJob(const QString &path); void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path); bool selectByPath(QString path); - Ui_FolderWizardTargetPage _ui{}; + NMCFolderWizardTargetPage _ui{}; bool _warnWasVisible = false; AccountPtr _account; QTimer _lscolTimer; @@ -146,7 +157,7 @@ private slots: void virtualFilesCheckboxClicked(); private: - SelectiveSyncWidget *_selectiveSync; + NMCSelectiveSyncWidget *_selectiveSync; QCheckBox *_virtualFilesCheckBox = nullptr; }; @@ -170,7 +181,7 @@ class FolderWizard : public QWizard bool eventFilter(QObject *watched, QEvent *event) override; void resizeEvent(QResizeEvent *event) override; -private: +protected: FolderWizardLocalPath *_folderWizardSourcePage; FolderWizardRemotePath *_folderWizardTargetPage = nullptr; FolderWizardSelectiveSync *_folderWizardSelectiveSyncPage; diff --git a/src/gui/main.cpp b/src/gui/main.cpp index e91fb3be9a1f4..f9a92fda2d1be 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/nmcfolderwizard.cpp b/src/gui/nmcgui/nmcfolderwizard.cpp new file mode 100644 index 0000000000000..fd695fe20af67 --- /dev/null +++ b/src/gui/nmcgui/nmcfolderwizard.cpp @@ -0,0 +1,41 @@ +/* + * 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 "nmcfolderwizard.h" + +/** + * Folder wizard itself + */ + +namespace OCC { + +NMCFolderWizard::NMCFolderWizard(AccountPtr account, QWidget *parent) + :FolderWizard(account, parent) +{ + setWizardStyle(QWizard::ClassicStyle); + setButtonText(QWizard::FinishButton, QCoreApplication::translate("", "ADD_SYNCHRONIZATION")); + + //Source page + auto sourceUi = _folderWizardSourcePage->getUi(); + sourceUi.localFolderLineEdit->clear(); + sourceUi.localFolderLineEdit->setPlaceholderText(QCoreApplication::translate("", "ADD_LIVE_BACKUP_PLACEHOLDER_TEXT")); + sourceUi.setDefaultSettings(); + sourceUi.changeLayout(); + + //Target page + auto targetUi = _folderWizardTargetPage->getUi(); + targetUi.setDefaultSettings(); + targetUi.setLayout(); +} + +} // end namespace diff --git a/src/gui/nmcgui/nmcfolderwizard.h b/src/gui/nmcgui/nmcfolderwizard.h new file mode 100644 index 0000000000000..dc5426aca5560 --- /dev/null +++ b/src/gui/nmcgui/nmcfolderwizard.h @@ -0,0 +1,50 @@ +/* + * 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_NMCFolderWizard_H +#define MIRALL_NMCFolderWizard_H + +#include "folderwizard.h" + +/** + * @brief The NMCFolderWizard class represents a specific folder wizard for the NMC application. + * @ingroup gui + * + * The NMCFolderWizard class is derived from the FolderWizard class and provides additional functionality + * specific to the NMC (replace with the actual application name) application. + */ + +namespace OCC { + +class NMCFolderWizard : public FolderWizard +{ + Q_OBJECT +public: + /** + * @brief Constructs an instance of NMCFolderWizard. + * @param account The account associated with the wizard. + * @param parent The parent widget (default is nullptr). + */ + explicit NMCFolderWizard(OCC::AccountPtr account, QWidget *parent = nullptr); + + /** + * @brief Destroys the NMCFolderWizard instance. + */ + ~NMCFolderWizard() = default; +}; + +} // namespace OCC + +#endif + diff --git a/src/gui/nmcgui/nmcfolderwizardsourcepage.cpp b/src/gui/nmcgui/nmcfolderwizardsourcepage.cpp new file mode 100644 index 0000000000000..f4148f5aad3de --- /dev/null +++ b/src/gui/nmcgui/nmcfolderwizardsourcepage.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 "nmcfolderwizardsourcepage.h" +#include "theme.h" + +namespace OCC { + +NMCFolderWizardSourcePage::NMCFolderWizardSourcePage() + :FolderWizardSourcePage() +{ + +} + +void NMCFolderWizardSourcePage::setDefaultSettings() +{ + groupBox->setVisible(false); +} + +void NMCFolderWizardSourcePage::changeLayout() +{ + gridLayout_2->setContentsMargins(0, 0, 0, 0); + + QLabel *stepLabel = new QLabel(); + stepLabel->setText(QCoreApplication::translate("", "ADD_LIVE_BACKUP_HEADLINE")); + stepLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + stepLabel->setStyleSheet("QLabel{color: black; font-size: 13px; font-weight: bold;}"); + + gridLayout_2->addWidget(stepLabel, 0, 0, Qt::AlignTop | Qt::AlignLeft); + + QWidget *mainLayoutWidget = new QWidget(); + mainLayoutWidget->setStyleSheet(""); + + auto *whiteLayout = new QGridLayout; + mainLayoutWidget->setObjectName("mainLayoutWidget"); + mainLayoutWidget->setStyleSheet("QWidget#mainLayoutWidget { background-color: white; border-radius: 4px;}"); + mainLayoutWidget->setLayout(whiteLayout); + + QLabel *textLabel = new QLabel(); + textLabel->setText(QCoreApplication::translate("", "ADD_LIVE_BACKUP_PAGE1_DESCRIPTION")); + textLabel->setWordWrap(true); + textLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + + whiteLayout->addWidget(textLabel, 0, 0); + + gridLayout_2->removeWidget(localFolderLineEdit); + localFolderLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + whiteLayout->addWidget(localFolderLineEdit, 1, 0); + + localFolderChooseBtn->setAutoDefault(true); + localFolderChooseBtn->setDefault(true); + localFolderChooseBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + //localFolderChooseBtn->setFixedHeight(10); + whiteLayout->addWidget(localFolderChooseBtn, 1, 1); + + gridLayout_2->addWidget(mainLayoutWidget, 1, 0, 1, 3); + + gridLayout_2->removeWidget(warnLabel); + gridLayout_2->addWidget(warnLabel, 2, 0, 1, 3); + + warnLabel->setStyleSheet("border: 0px; border-radius: 4px; background-color: #fee2d0"); + + gridLayout_2->removeItem(verticalSpacer); + gridLayout_2->addItem(verticalSpacer, 3, 0, 1, 3); +} + +} // end namespace + + + diff --git a/src/gui/nmcgui/nmcfolderwizardsourcepage.h b/src/gui/nmcgui/nmcfolderwizardsourcepage.h new file mode 100644 index 0000000000000..860bd2ce3289a --- /dev/null +++ b/src/gui/nmcgui/nmcfolderwizardsourcepage.h @@ -0,0 +1,57 @@ +/* + * 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_NMCFolderWizardSourcePage_H +#define MIRALL_NMCFolderWizardSourcePage_H + +#include "ui_folderwizardsourcepage.h" + +/** + * @brief The NMCFolderWizardSourcePage class represents a source page for the NMCFolderWizard. + * @ingroup gui + * + * The NMCFolderWizardSourcePage class is derived from the Ui::FolderWizardSourcePage class and provides + * additional functionality specific to the NMCFolderWizard in the NMC application (replace with the actual application name). + */ + +namespace OCC { + +class NMCFolderWizardSourcePage : public ::Ui::FolderWizardSourcePage +{ + +public: + /** + * @brief Constructs an instance of NMCFolderWizardSourcePage. + */ + explicit NMCFolderWizardSourcePage(); + + /** + * @brief Destroys the NMCFolderWizardSourcePage instance. + */ + ~NMCFolderWizardSourcePage() = default; + + /** + * @brief Sets default settings for the NMCFolderWizardSourcePage. + */ + void setDefaultSettings(); + + /** + * @brief Changes the layout of the NMCFolderWizardSourcePage. + */ + void changeLayout(); +}; + +} // namespace OCC + +#endif diff --git a/src/gui/nmcgui/nmcfolderwizardtargetpage.cpp b/src/gui/nmcgui/nmcfolderwizardtargetpage.cpp new file mode 100644 index 0000000000000..fe4fc4a598bfe --- /dev/null +++ b/src/gui/nmcgui/nmcfolderwizardtargetpage.cpp @@ -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. + */ + +#include "nmcfolderwizardtargetpage.h" +#include "theme.h" + + +namespace OCC { + +NMCFolderWizardTargetPage::NMCFolderWizardTargetPage() + :FolderWizardTargetPage() +{ +} + +void NMCFolderWizardTargetPage::setDefaultSettings() +{ + warnFrame->setVisible(false); + groupBox->setVisible(false); +} + +void NMCFolderWizardTargetPage::setLayout() +{ + gridLayout_6->setContentsMargins(0, 0, 0, 0); + + QLabel *stepLabel = new QLabel(); + stepLabel->setText(QCoreApplication::translate("", "ADD_LIVE_BACKUP_HEADLINE")); + stepLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + stepLabel->setStyleSheet("QLabel{color: black; font-size: 13px; font-weight: bold;}"); + + gridLayout_6->addWidget(stepLabel, 0, 0, Qt::AlignTop | Qt::AlignLeft); + + QGridLayout *hLayout = new QGridLayout(); + + QWidget *hLayoutWidget = new QWidget(); + hLayoutWidget->setLayout(hLayout); + hLayoutWidget->setObjectName("whiteBackgroundLayout"); + hLayoutWidget->setStyleSheet("QWidget#whiteBackgroundLayout { background-color: white; border-radius: 4px;}"); + + gridLayout_6->removeWidget(folderTreeWidget); + gridLayout_6->removeWidget(refreshButton); + gridLayout_6->removeWidget(addFolderButton); + + QLabel *textLabel2 = new QLabel(); + textLabel2->setText(QCoreApplication::translate("", "ADD_LIVE_BACKUP_PAGE2_DESCRIPTION")); + textLabel2->setWordWrap(true); + textLabel2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + hLayout->addWidget(textLabel2, 0, 0, 1, 3); + + hLayout->addWidget(folderTreeWidget, 1, 0, 3, 1); + + addFolderButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + hLayout->addWidget(addFolderButton, 1, 1, 1, 1); + + refreshButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + refreshButton->setFixedSize(addFolderButton->sizeHint()); + hLayout->addWidget(refreshButton, 2, 1, 1, 1); + + folderEntry->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + hLayout->addWidget(folderEntry, 4, 0, 1, 3); + + gridLayout_6->addWidget(hLayoutWidget, 4, 0, 1, 3); + gridLayout_6->addWidget(warnFrame, 5, 0, 1, 3 ); + warnFrame->setStyleSheet("border: 0px; border-radius: 4px; background-color: #fee2d0"); +} + +} // end namespace diff --git a/src/gui/nmcgui/nmcfolderwizardtargetpage.h b/src/gui/nmcgui/nmcfolderwizardtargetpage.h new file mode 100644 index 0000000000000..1fd51ca9a8bc7 --- /dev/null +++ b/src/gui/nmcgui/nmcfolderwizardtargetpage.h @@ -0,0 +1,57 @@ +/* + * 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_NMCFolderWizardTargetPage_H +#define MIRALL_NMCFolderWizardTargetPage_H + +#include "ui_folderwizardtargetpage.h" + +/** + * @brief The NMCFolderWizardTargetPage class represents a target page for the NMCFolderWizard. + * @ingroup gui + * + * The NMCFolderWizardTargetPage class is derived from the Ui::FolderWizardTargetPage class and provides + * additional functionality specific to the NMCFolderWizard in the NMC application (replace with the actual application name). + */ + +namespace OCC { + +class NMCFolderWizardTargetPage : public ::Ui::FolderWizardTargetPage +{ + +public: + /** + * @brief Constructs an instance of NMCFolderWizardTargetPage. + */ + explicit NMCFolderWizardTargetPage(); + + /** + * @brief Destroys the NMCFolderWizardTargetPage instance. + */ + ~NMCFolderWizardTargetPage() = default; + + /** + * @brief Sets default settings for the NMCFolderWizardTargetPage. + */ + void setDefaultSettings(); + + /** + * @brief Sets the layout for the NMCFolderWizardTargetPage. + */ + void setLayout(); +}; + +} // namespace OCC + +#endif diff --git a/src/gui/nmcgui/nmcselectivesyncdialog.cpp b/src/gui/nmcgui/nmcselectivesyncdialog.cpp new file mode 100644 index 0000000000000..42ab0a0dcaaa0 --- /dev/null +++ b/src/gui/nmcgui/nmcselectivesyncdialog.cpp @@ -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. + */ +#include "nmcgui/nmcselectivesyncdialog.h" +#include "QtWidgets/qapplication.h" +#include "QtWidgets/qboxlayout.h" +#include "QtWidgets/qlabel.h" + + +namespace OCC { + +NMCSelectiveSyncWidget::NMCSelectiveSyncWidget(AccountPtr account, QWidget *parent) + : SelectiveSyncWidget(account, parent) +{ + _layout->removeWidget(_folderTree); + _layout->removeWidget(_header); + + _header->setText(QCoreApplication::translate("", "ADD_LIVE_BACKUP_PAGE3_DESCRIPTION")); + + QHBoxLayout *hLayout = new QHBoxLayout(); + hLayout->setSpacing(8); + + QLabel *icon = new QLabel(this); + icon->setFixedSize(18, 18); + icon->setPixmap(QIcon(QLatin1String(":/client/theme/NMCIcons/applicationLogo.svg")).pixmap(18, 18)); + hLayout->addWidget(icon); + + QLabel *stepLabel = new QLabel(this); + stepLabel->setText(QCoreApplication::translate("", "ADD_LIVE_BACKUP_HEADLINE")); + stepLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + stepLabel->setStyleSheet("QLabel{color: black; font-size: 13px; font-weight: bold;}"); + hLayout->addWidget(stepLabel); + + hLayout->setContentsMargins(0,0,0,0); + + QWidget *hContainer = new QWidget(this); + hContainer->setLayout(hLayout); + + _layout->addWidget(hContainer); + + QVBoxLayout *vLayout = new QVBoxLayout(); + vLayout->setSpacing(8); + + vLayout->addWidget(_header); + vLayout->addWidget(_folderTree); + _folderTree->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + QFrame *vContainer = new QFrame(this); + vContainer->setLayout(vLayout); + vContainer->setObjectName("whiteBackgroundLayout"); + vContainer->setStyleSheet("QFrame#whiteBackgroundLayout { background-color: white; border-radius: 4px;}"); + + _layout->addWidget(vContainer); +} + +} diff --git a/src/gui/nmcgui/nmcselectivesyncdialog.h b/src/gui/nmcgui/nmcselectivesyncdialog.h new file mode 100644 index 0000000000000..ae72aa214e5c5 --- /dev/null +++ b/src/gui/nmcgui/nmcselectivesyncdialog.h @@ -0,0 +1,41 @@ +/* + * 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 "selectivesyncdialog.h" + +namespace OCC { + +/** + * @brief The NMCSelectiveSyncWidget class represents a widget containing a folder tree with labels specific to the NMC application. + * @ingroup gui + * + * The NMCSelectiveSyncWidget class is derived from the SelectiveSyncWidget class and provides additional functionality + * specific to the NMC (replace with the actual application name) application. It contains a folder tree with labels. + */ + +class NMCSelectiveSyncWidget : public SelectiveSyncWidget +{ + Q_OBJECT +public: + /** + * @brief Constructs an instance of NMCSelectiveSyncWidget. + * @param account The account associated with the widget. + * @param parent The parent widget (default is nullptr). + */ + explicit NMCSelectiveSyncWidget(AccountPtr account, QWidget *parent = nullptr); +}; + +} // namespace OCC + diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index af8deeb90c7d7..e3e014aca03d0 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -11,7 +11,8 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -#include "selectivesyncdialog.h" +//#include "selectivesyncdialog.h" +#include "nmcgui/nmcselectivesyncdialog.h" #include "account.h" #include "common/utility.h" #include "configfile.h" @@ -66,20 +67,20 @@ class SelectiveSyncTreeViewItem : public QTreeWidgetItem SelectiveSyncWidget::SelectiveSyncWidget(AccountPtr account, QWidget *parent) : QWidget(parent) - , _account(account) , _folderTree(new QTreeWidget(this)) + , _account(account) { _loading = new QLabel(tr("Loading …"), _folderTree); - auto layout = new QVBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); + _layout = new QVBoxLayout(this); + _layout->setContentsMargins(0, 0, 0, 0); - auto header = new QLabel(this); - header->setText(tr("Deselect remote folders you do not wish to synchronize.")); - header->setWordWrap(true); - layout->addWidget(header); + _header = new QLabel(this); + _header->setText(tr("Deselect remote folders you do not wish to synchronize.")); + _header->setWordWrap(true); + _layout->addWidget(_header); - layout->addWidget(_folderTree); + _layout->addWidget(_folderTree); connect(_folderTree, &QTreeWidget::itemExpanded, this, &SelectiveSyncWidget::slotItemExpanded); @@ -501,7 +502,7 @@ void SelectiveSyncDialog::init(const AccountPtr &account) { setWindowTitle(tr("Choose What to Sync")); auto *layout = new QVBoxLayout(this); - _selectiveSync = new SelectiveSyncWidget(account, this); + _selectiveSync = new NMCSelectiveSyncWidget(account, this); layout->addWidget(_selectiveSync); auto *buttonBox = new QDialogButtonBox(Qt::Horizontal); _okButton = buttonBox->addButton(QDialogButtonBox::Ok); diff --git a/src/gui/selectivesyncdialog.h b/src/gui/selectivesyncdialog.h index 92f45f3d7e5e2..0037fe408fbd6 100644 --- a/src/gui/selectivesyncdialog.h +++ b/src/gui/selectivesyncdialog.h @@ -15,6 +15,7 @@ #pragma once #include #include +#include "QtWidgets/qboxlayout.h" #include "accountfwd.h" #include "csync_exclude.h" @@ -54,6 +55,11 @@ class SelectiveSyncWidget : public QWidget [[nodiscard]] QSize sizeHint() const override; +protected: + QVBoxLayout *_layout; + QLabel *_header; + QTreeWidget *_folderTree; + private slots: void slotUpdateDirectories(QStringList); void slotUpdateRootFolderFilesSize(const QStringList &subfolders); @@ -75,8 +81,6 @@ private slots: bool _inserting = false; // set to true when we are inserting new items on the list QLabel *_loading; - QTreeWidget *_folderTree; - // During account setup we want to filter out excluded folders from the // view without having a Folder.SyncEngine.ExcludedFiles instance. ExcludedFiles _excludedFiles;