2017-07-02 16:12:58 +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 LAYOUTSETTINGS_H
# define LAYOUTSETTINGS_H
# include <QObject>
# include <KConfigGroup>
# include <KSharedConfig>
# include "dockcorona.h"
class DockCorona ;
namespace Latte {
//! This class is responsible to hold the settings for a specific layout.
//! It also updates always the relevant layout configuration concerning
//! its general settings (no the containments)
class LayoutSettings : public QObject {
Q_OBJECT
2017-07-17 18:31:43 +03:00
Q_PROPERTY ( bool showInMenu READ showInMenu WRITE setShowInMenu NOTIFY showInMenuChanged )
2017-07-02 21:02:27 +03:00
Q_PROPERTY ( bool syncLaunchers READ syncLaunchers WRITE setSyncLaunchers NOTIFY syncLaunchersChanged )
2017-07-04 16:53:55 +03:00
Q_PROPERTY ( QString color READ color WRITE setColor NOTIFY colorChanged )
2017-07-03 19:25:16 +03:00
Q_PROPERTY ( QString name READ name NOTIFY nameChanged )
2017-07-02 21:02:27 +03:00
Q_PROPERTY ( QStringList globalLaunchers READ globalLaunchers WRITE setGlobalLaunchers NOTIFY globalLaunchersChanged )
2017-07-17 18:31:43 +03:00
Q_PROPERTY ( QStringList activities READ activities WRITE setActivities NOTIFY activitiesChanged )
2017-07-02 16:12:58 +03:00
public :
2017-07-03 19:25:16 +03:00
LayoutSettings ( QObject * parent , QString layoutFile , QString layoutName = QString ( ) ) ;
2017-07-02 16:12:58 +03:00
~ LayoutSettings ( ) override ;
2017-07-17 18:31:43 +03:00
bool showInMenu ( ) const ;
void setShowInMenu ( bool show ) ;
bool syncLaunchers ( ) const ;
void setSyncLaunchers ( bool sync ) ;
int version ( ) const ;
void setVersion ( int ver ) ;
2017-07-03 19:25:16 +03:00
QString name ( ) const ;
QString file ( ) const ;
2017-07-04 16:53:55 +03:00
QString color ( ) const ;
void setColor ( QString color ) ;
2017-07-17 18:31:43 +03:00
QStringList activities ( ) const ;
void setActivities ( QStringList activities ) ;
2017-07-02 21:02:27 +03:00
QStringList globalLaunchers ( ) const ;
void setGlobalLaunchers ( QStringList launchers ) ;
2017-07-02 20:19:18 +03:00
signals :
2017-07-17 18:31:43 +03:00
void activitiesChanged ( ) ;
2017-07-04 16:53:55 +03:00
void colorChanged ( ) ;
2017-07-03 19:25:16 +03:00
void fileChanged ( ) ;
2017-07-02 21:02:27 +03:00
void globalLaunchersChanged ( ) ;
2017-07-03 19:25:16 +03:00
void nameChanged ( ) ;
2017-07-02 20:19:18 +03:00
void versionChanged ( ) ;
2017-07-17 18:31:43 +03:00
void showInMenuChanged ( ) ;
2017-07-02 21:02:27 +03:00
void syncLaunchersChanged ( ) ;
2017-07-02 20:19:18 +03:00
private slots :
void loadConfig ( ) ;
void saveConfig ( ) ;
private :
void init ( ) ;
2017-07-03 19:25:16 +03:00
void setName ( QString name ) ;
void setFile ( QString file ) ;
2017-07-02 20:19:18 +03:00
2017-07-02 16:12:58 +03:00
private :
2017-07-17 18:31:43 +03:00
bool m_showInMenu { false } ;
2017-07-02 21:02:27 +03:00
bool m_syncLaunchers { false } ;
2017-07-02 20:19:18 +03:00
//if version doesnt exist it is and old layout file
2017-07-03 19:50:42 +03:00
int m_version { 2 } ;
2017-07-02 21:02:27 +03:00
2017-07-04 16:53:55 +03:00
QString m_color ;
2017-07-02 16:12:58 +03:00
QString m_layoutFile ;
2017-07-03 19:25:16 +03:00
QString m_layoutName ;
2017-07-17 18:31:43 +03:00
QStringList m_activities ;
2017-07-02 21:02:27 +03:00
QStringList m_globalLaunchers ;
2017-07-02 16:12:58 +03:00
DockCorona * m_corona { nullptr } ;
KConfigGroup m_layoutGroup ;
} ;
}
# endif // LAYOUTSETTINGS_H