Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nmc/2003-Contains the settings dialog changes #62

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -191,6 +194,21 @@ set(client_SRCS
syncconflictsmodel.cpp
fileactivitylistmodel.h
fileactivitylistmodel.cpp
nmcgui/nmcaccountsettings.h
nmcgui/nmcaccountsettings.cpp
nmcgui/nmcfolderwizard.h
nmcgui/nmcfolderwizard.cpp
nmcgui/nmcfolderwizardsourcepage.h
nmcgui/nmcfolderwizardsourcepage.cpp
nmcgui/nmcfolderwizardtargetpage.h
nmcgui/nmcfolderwizardtargetpage.cpp
nmcgui/nmcgeneralsettings.h
nmcgui/nmcgeneralsettings.cpp
nmcgui/nmcguiinterface.h
nmcgui/nmcnetworksettings.h
nmcgui/nmcnetworksettings.cpp
nmcgui/nmcsettingsdialog.h
nmcgui/nmcsettingsdialog.cpp
filedetails/datefieldbackend.h
filedetails/datefieldbackend.cpp
filedetails/filedetails.h
Expand Down
11 changes: 6 additions & 5 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "accountsettings.h"
#include "common/syncjournaldb.h"
#include "common/syncjournalfilerecord.h"
#include "nmcgui/nmcfolderwizard.h"
#include "qmessagebox.h"
#include "ui_accountsettings.h"

Expand Down Expand Up @@ -742,7 +743,7 @@ 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 NMCFolderWizard(_accountState->account(), this);
folderWizard->setAttribute(Qt::WA_DeleteOnClose);

connect(folderWizard, &QDialog::accepted, this, &AccountSettings::slotFolderWizardAccepted);
Expand All @@ -753,7 +754,7 @@ void AccountSettings::slotAddFolder()

void AccountSettings::slotFolderWizardAccepted()
{
const auto folderWizard = qobject_cast<FolderWizard *>(sender());
const auto folderWizard = qobject_cast<NMCFolderWizard *>(sender());
const auto folderMan = FolderMan::instance();

qCInfo(lcAccountSettings) << "Folder wizard completed";
Expand Down Expand Up @@ -1111,7 +1112,7 @@ void AccountSettings::showConnectionLabel(const QString &message, QStringList er
_ui->connectLabel->setToolTip({});
_ui->connectLabel->setStyleSheet(errStyle);
}
_ui->accountStatus->setVisible(!message.isEmpty());
//_ui->accountStatus->setVisible(!message.isEmpty());
}

void AccountSettings::slotEnableCurrentFolder(bool terminate)
Expand Down Expand Up @@ -1572,8 +1573,8 @@ void AccountSettings::refreshSelectiveSyncStatus()
infoString += tr("There are folders that have grown in size beyond %1MB: %2").arg(folderSizeLimitString, becameBigFoldersString);
}

_ui->selectiveSyncNotification->setText(infoString);
_ui->bigFolderUi->setVisible(!infoString.isEmpty());
//_ui->selectiveSyncNotification->setText(infoString);
//_ui->bigFolderUi->setVisible(!infoString.isEmpty());
}

bool AccountSettings::event(QEvent *e)
Expand Down
5 changes: 3 additions & 2 deletions src/gui/accountsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ private slots:
void checkClientSideEncryptionState();
void removeActionFromEncryptionMessage(const QString &actionId);

protected:
Ui::AccountSettings *_ui;

private:
bool event(QEvent *) override;
QAction *addActionToEncryptionMessage(const QString &actionTitle, const QString &actionId);
Expand All @@ -137,8 +140,6 @@ private slots:
/// Returns the alias of the selected folder, empty string if none
[[nodiscard]] QString selectedFolderAlias() const;

Ui::AccountSettings *_ui;

FolderStatusModel *_model;
QUrl _OCUrl;
bool _wasDisabledBefore = false;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/folderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ void FolderWizardSelectiveSync::virtualFilesCheckboxClicked()
FolderWizard::FolderWizard(AccountPtr account, QWidget *parent)
: QWizard(parent)
, _folderWizardSourcePage(new FolderWizardLocalPath(account))
, _folderWizardSelectiveSyncPage(new FolderWizardSelectiveSync(account))
//, _folderWizardSelectiveSyncPage(new FolderWizardSelectiveSync(account))
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setPage(Page_Source, _folderWizardSourcePage);
Expand All @@ -679,7 +679,7 @@ FolderWizard::FolderWizard(AccountPtr account, QWidget *parent)
setPage(Page_Target, _folderWizardTargetPage);
_folderWizardTargetPage->installEventFilter(this);
}
setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage);
//setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage);

setWindowTitle(tr("Add Folder Sync Connection"));
setOptions(QWizard::CancelButtonOnLeft);
Expand Down
19 changes: 14 additions & 5 deletions src/gui/folderwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "folder.h"
#include "accountfwd.h"

#include "ui_folderwizardsourcepage.h"
#include "ui_folderwizardtargetpage.h"
#include "nmcgui/nmcfolderwizardsourcepage.h"
#include "nmcgui/nmcfolderwizardtargetpage.h"

class QCheckBox;

Expand Down Expand Up @@ -61,6 +61,11 @@ class FolderWizardLocalPath : public FormatWarningsWizardPage

void setFolderMap(const Folder::Map &fm) { _folderMap = fm; }

NMCFolderWizardSourcePage getUi()
{
return _ui;
}

protected:
void changeEvent(QEvent *) override;

Expand All @@ -70,7 +75,7 @@ protected slots:
private:
void changeStyle();

Ui_FolderWizardSourcePage _ui{};
NMCFolderWizardSourcePage _ui{};
Folder::Map _folderMap;
AccountPtr _account;
};
Expand All @@ -93,6 +98,10 @@ class FolderWizardRemotePath : public FormatWarningsWizardPage
void initializePage() override;
void cleanupPage() override;

NMCFolderWizardTargetPage getUi(){
return _ui;
};

protected slots:
void showWarn(const QString & = QString()) const;
void slotAddRemoteFolder();
Expand All @@ -119,7 +128,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;
Expand Down Expand Up @@ -170,7 +179,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;
Expand Down
5 changes: 3 additions & 2 deletions src/gui/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ private slots:
void slotToggleAutoUpdateCheck();
#endif

protected:
Ui::GeneralSettings *_ui;

private:
void customizeStyle();

Ui::GeneralSettings *_ui;
QPointer<IgnoreListEditor> _ignoreEditor;
bool _currentlyLoading = false;
};
Expand Down
3 changes: 1 addition & 2 deletions src/gui/networksettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ private slots:

protected:
void showEvent(QShowEvent *event) override;
Ui::NetworkSettings *_ui;

private:
void loadProxySettings();
void loadBWLimitSettings();

Ui::NetworkSettings *_ui;
};


Expand Down
76 changes: 76 additions & 0 deletions src/gui/nmcgui/nmcaccountsettings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* 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 "nmcaccountsettings.h"
#include "accountsettings.h"
#include "ui_accountsettings.h"
#include "qdesktopservices.h"


namespace OCC {

NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent)
: AccountSettings(accountState, parent)
{
setDefaultSettings();
setLayout();
setLogic();
}

void NMCAccountSettings::setDefaultSettings()
{
//Set default settings
_ui->encryptionMessage->setCloseButtonVisible(true);
_ui->selectiveSyncStatus->setVisible(false);
_ui->selectiveSyncNotification->setVisible(false);
_ui->accountStatus->setVisible(false);
_ui->bigFolderUi->setVisible(false);
}

void NMCAccountSettings::setLayout()
{
//Fix layout
_ui->storageGroupBox->removeWidget(_ui->quotaInfoLabel);
_ui->storageGroupBox->removeWidget(_ui->quotaProgressBar);

auto *quotaVLayout = new QVBoxLayout(this);
auto *quota = new QLabel();
quota->setText(tr("USED_STORAGE_%1").arg(QString::number(_ui->quotaProgressBar->value() > 0 ? _ui->quotaProgressBar->value() : 0)));
quotaVLayout->addWidget(_ui->quotaInfoLabel);
quotaVLayout->addWidget(_ui->quotaProgressBar);
quotaVLayout->addWidget(quota);

auto *magentaHLayout = new QHBoxLayout(this);
magentaHLayout->addLayout(quotaVLayout);
auto *storageLinkButton = new QPushButton(this);
storageLinkButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
storageLinkButton->setFixedHeight(50);
connect(storageLinkButton, &QPushButton::clicked, this, [](){
QDesktopServices::openUrl(QUrl("https://cloud.telekom-dienste.de/tarife"));
});
storageLinkButton->setText(tr("STORAGE_EXTENSION"));
magentaHLayout->addWidget(storageLinkButton);

_ui->gridLayout->addLayout(magentaHLayout, 0, 0);
}

void NMCAccountSettings::setLogic()
{

}




} // namespace OCC
45 changes: 45 additions & 0 deletions src/gui/nmcgui/nmcaccountsettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) by Daniel Molkentin <[email protected]>
*
* 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_ACCOUNTSETTINGSMAGENTA_H
#define MIRALL_ACCOUNTSETTINGSMAGENTA_H

#include "nmcguiinterface.h"
#include <accountsettings.h>

namespace OCC {

/**
* @brief The AccountSettingsMagenta class
* @ingroup gui
*/
class NMCAccountSettings : public AccountSettings, public NMCGuiInterface
{
Q_OBJECT

public:
explicit NMCAccountSettings(AccountState *accountState, QWidget *parent = nullptr);
~NMCAccountSettings() = default;

// NMCGuiInterface interface
protected:
void setDefaultSettings() override final;
void setLayout() override final;
void setLogic() override final;

};


} // namespace OCC
#endif // MIRALL_ACCOUNTSETTINGSMAGENTA_H
45 changes: 45 additions & 0 deletions src/gui/nmcgui/nmcfolderwizard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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);
setOption(QWizard::NoBackButtonOnStartPage);
setOption(QWizard::NoBackButtonOnLastPage);
setButtonText(QWizard::FinishButton, tr("Finish"));

//Source page
auto sourceUi = _folderWizardSourcePage->getUi();
sourceUi.localFolderLineEdit->clear();
sourceUi.localFolderLineEdit->setPlaceholderText(tr("Please select a folder"));
sourceUi.setDefaultSettings();
sourceUi.setLayout();

//Target page
auto targetUi = _folderWizardTargetPage->getUi();
targetUi.setDefaultSettings();
targetUi.setLayout();
}



} // end namespace
Loading