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 LAYOUTCONFIGDIALOG_H
# define LAYOUTCONFIGDIALOG_H
2017-07-20 11:27:22 +03:00
# include "layoutmanager.h"
# include "layoutsettings.h"
2017-07-05 22:03:39 +03:00
# include <QObject>
# include <QDialog>
# include <QDebug>
2017-07-17 22:07:04 +03:00
# include <QStandardItemModel>
2017-07-05 22:03:39 +03:00
2017-07-17 22:07:04 +03:00
namespace Ui {
2017-07-05 22:03:39 +03:00
class LayoutConfigDialog ;
}
2017-07-17 22:07:04 +03:00
namespace Latte {
class LayoutManager ;
2017-07-20 11:27:22 +03:00
class LayoutSettings ;
2017-07-17 22:07:04 +03:00
}
2017-07-05 22:03:39 +03:00
namespace Latte {
2017-07-17 22:07:04 +03:00
class LayoutConfigDialog : public QDialog {
2017-07-05 22:03:39 +03:00
Q_OBJECT
public :
2017-07-17 22:07:04 +03:00
LayoutConfigDialog ( QWidget * parent , LayoutManager * corona ) ;
2017-07-05 22:03:39 +03:00
~ LayoutConfigDialog ( ) ;
2017-07-19 19:34:59 +03:00
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-07-05 22:03:39 +03:00
void on_copyButton_clicked ( ) ;
void on_removeButton_clicked ( ) ;
2017-07-17 23:49:32 +03:00
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
2017-07-17 23:49:32 +03:00
void currentLayoutNameChanged ( ) ;
2017-07-21 00:48:57 +03:00
void currentRowChanged ( const QModelIndex & current , const QModelIndex & previous ) ;
2017-07-19 19:34:59 +03:00
void itemChanged ( QStandardItem * item ) ;
2017-07-17 23:49:32 +03:00
2017-07-05 22:03:39 +03:00
private :
2017-07-17 22:07:04 +03:00
void loadLayouts ( ) ;
2017-07-19 19:34:59 +03:00
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-19 19:34:59 +03:00
2017-07-20 17:29:46 +03:00
bool dataAreAccepted ( ) ;
2017-07-21 00:48:57 +03:00
bool idExistsInModel ( QString id ) ;
2017-07-22 10:39:35 +03:00
bool nameExistsInModel ( QString name ) ;
2017-07-20 17:55:44 +03:00
bool saveAllChanges ( ) ;
2017-07-20 17:29:46 +03:00
2017-07-22 10:39:35 +03:00
int ascendingRowFor ( QString name ) ;
2017-07-21 19:24:17 +03:00
QString uniqueTempDirectory ( ) ;
2017-07-19 19:34:59 +03:00
QStringList m_availableActivities ;
2017-07-21 19:24:17 +03:00
QStringList m_tempDirectories ;
2017-07-21 00:48:57 +03:00
QStringList m_initLayoutPaths ;
2017-07-17 22:07:04 +03:00
LayoutManager * m_manager { nullptr } ;
QStandardItemModel * m_model { nullptr } ;
Ui : : LayoutConfigDialog * ui ;
2017-07-20 11:27:22 +03:00
QHash < const QString , LayoutSettings * > m_layouts ;
2017-07-05 22:03:39 +03:00
} ;
}
# endif // LAYOUTCONFIGDIALOG_H