nextcloud-desktop/src/gui/settingsdialog.h

99 lines
2.4 KiB
C
Raw Normal View History

/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* 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 SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
#include <QStyledItemDelegate>
#include "progressdispatcher.h"
#include "owncloudgui.h"
class QAction;
class QActionGroup;
class QToolBar;
class QStandardItemModel;
2014-11-10 00:34:07 +03:00
namespace OCC {
2015-04-17 18:56:17 +03:00
class AccountState;
namespace Ui {
2017-05-17 11:55:42 +03:00
class SettingsDialog;
}
class AccountSettings;
class Application;
class FolderMan;
class ownCloudGui;
2015-06-29 19:56:09 +03:00
/**
* @brief The SettingsDialog class
* @ingroup gui
*/
class SettingsDialog : public QDialog
{
Q_OBJECT
2019-06-05 21:57:15 +03:00
Q_PROPERTY(QWidget* currentPage READ currentPage)
public:
explicit SettingsDialog(ownCloudGui *gui, QWidget *parent = nullptr);
~SettingsDialog();
2019-06-05 21:57:15 +03:00
QWidget* currentPage();
public slots:
void showFirstPage();
void showIssuesList(AccountState *account);
void slotSwitchPage(QAction *action);
void slotAccountAvatarChanged();
void slotAccountDisplayNameChanged();
signals:
void styleChanged();
void onActivate();
protected:
void reject() override;
void accept() override;
void changeEvent(QEvent *) override;
private slots:
2015-04-17 18:56:17 +03:00
void accountAdded(AccountState *);
void accountRemoved(AccountState *);
private:
void customizeStyle();
2015-11-16 19:02:05 +03:00
QAction *createColorAwareAction(const QString &iconName, const QString &fileName);
2017-05-17 11:55:42 +03:00
QAction *createActionWithIcon(const QIcon &icon, const QString &text, const QString &iconPath = QString());
2017-05-17 11:55:42 +03:00
Ui::SettingsDialog *const _ui;
2017-05-17 11:55:42 +03:00
QActionGroup *_actionGroup;
// Maps the actions from the action group to the corresponding widgets
2017-05-17 11:55:42 +03:00
QHash<QAction *, QWidget *> _actionGroupWidgets;
// Maps the action in the dialog to their according account. Needed in
// case the account avatar changes
2017-05-17 11:55:42 +03:00
QHash<Account *, QAction *> _actionForAccount;
2017-05-17 11:55:42 +03:00
QToolBar *_toolBar;
2015-04-17 18:56:17 +03:00
ownCloudGui *_gui;
};
}
#endif // SETTINGSDIALOG_H