1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-12 17:17:50 +03:00
latte-dock/app/latteconfigdialog.h

115 lines
3.0 KiB
C
Raw Normal View History

2017-07-05 22:03:39 +03:00
/*
* Copyright 2017 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock 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.
*
* Latte-Dock 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef LATTECONFIGDIALOG_H
#define LATTECONFIGDIALOG_H
2017-07-05 22:03:39 +03:00
2018-01-27 02:27:48 +03:00
#include "dockcorona.h"
2018-01-07 20:33:18 +03:00
#include "layout.h"
2017-07-05 22:03:39 +03:00
#include <QObject>
2018-01-17 19:29:20 +03:00
#include <QButtonGroup>
2017-07-05 22:03:39 +03:00
#include <QDialog>
#include <QDebug>
#include <QStandardItemModel>
2017-07-05 22:03:39 +03:00
namespace Ui {
class LatteConfigDialog;
2017-07-05 22:03:39 +03:00
}
namespace KActivities {
class Controller;
}
namespace Latte {
2018-01-27 02:27:48 +03:00
class DockCorona;
2018-01-07 20:33:18 +03:00
class Layout;
}
2017-07-05 22:03:39 +03:00
namespace Latte {
class LatteConfigDialog : public QDialog {
2017-07-05 22:03:39 +03:00
Q_OBJECT
public:
2018-01-27 02:27:48 +03:00
LatteConfigDialog(QWidget *parent, DockCorona *corona);
~LatteConfigDialog();
2017-07-05 22:03:39 +03:00
void setCurrentPage(Dock::LatteConfigPage page);
QStringList activities();
QStringList availableActivities();
2017-07-05 22:03:39 +03:00
private slots:
2017-07-07 23:00:53 +03:00
// auto connections
2017-08-27 17:00:34 +03:00
void on_newButton_clicked();
2017-07-05 22:03:39 +03:00
void on_copyButton_clicked();
void on_downloadButton_clicked();
2017-07-05 22:03:39 +03:00
void on_removeButton_clicked();
void on_switchButton_clicked();
2017-07-05 22:03:39 +03:00
void on_importButton_clicked();
void on_exportButton_clicked();
2017-07-07 23:00:53 +03:00
void accept() override;
void reject() override;
void apply();
void restoreDefaults();
2017-07-05 22:03:39 +03:00
void layoutsChanged();
void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
void itemChanged(QStandardItem *item);
2017-07-05 22:03:39 +03:00
private:
2017-08-27 17:00:34 +03:00
void addLayoutForFile(QString file, QString layoutName = QString(), bool newTempDirectory = true, bool showNotification = true);
void loadLayouts();
void recalculateAvailableActivities();
2017-07-21 19:24:17 +03:00
void insertLayoutInfoAtRow(int row, QString path, QString color, QString name, bool menu, QStringList activities);
2017-07-28 19:25:28 +03:00
void updateButtonsState();
bool dataAreAccepted();
bool idExistsInModel(QString id);
2017-07-22 22:52:31 +03:00
bool importLayoutsFromV1ConfigFile(QString file);
bool nameExistsInModel(QString name);
bool saveAllChanges();
int ascendingRowFor(QString name);
2017-07-21 19:24:17 +03:00
QString uniqueTempDirectory();
QString uniqueLayoutName(QString name);
2017-07-21 19:24:17 +03:00
QStringList m_availableActivities;
2017-07-21 19:24:17 +03:00
QStringList m_tempDirectories;
QStringList m_initLayoutPaths;
2018-01-17 19:29:20 +03:00
QButtonGroup *m_inMemoryButtons;
QButtonGroup *m_mouseSensitivityButtons;
2018-01-17 19:29:20 +03:00
2018-01-27 02:27:48 +03:00
DockCorona *m_corona{nullptr};
QStandardItemModel *m_model{nullptr};
Ui::LatteConfigDialog *ui;
2018-01-07 20:33:18 +03:00
QHash<const QString, Layout *> m_layouts;
2017-07-05 22:03:39 +03:00
};
}
#endif // LATTECONFIGDIALOG_H