2017-07-02 15:02:07 +03:00
/*
2017-07-02 16:12:58 +03:00
* Copyright 2017 Smith AR < audoban @ openmailbox . org >
2017-07-02 15:02:07 +03:00
* 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 LAYOUTMANAGER_H
# define LAYOUTMANAGER_H
2017-07-02 16:12:58 +03:00
# include "dockcorona.h"
2017-07-02 15:02:07 +03:00
# include "importer.h"
2017-07-03 19:04:37 +03:00
# include <QAction>
2017-07-02 16:12:58 +03:00
# include <QObject>
2017-07-03 19:04:37 +03:00
# include <KLocalizedString>
2017-07-02 21:02:27 +03:00
class Importer ;
2017-07-02 15:02:07 +03:00
namespace Latte {
2017-07-02 15:06:35 +03:00
//! This class is responsible to manipulate all layouts.
//! add,remove,rename, update configurations etc.
2017-07-02 15:02:07 +03:00
class LayoutManager : public QObject {
Q_OBJECT
2017-07-03 19:04:37 +03:00
Q_PROPERTY ( QAction * toggleLayoutAction READ toggleLayoutAction NOTIFY toggleLayoutActionChanged )
Q_PROPERTY ( QAction * addWidgetsAction READ addWidgetsAction NOTIFY addWidgetsActionChanged )
2017-07-02 15:02:07 +03:00
public :
LayoutManager ( QObject * parent = nullptr ) ;
~ LayoutManager ( ) override ;
2017-07-03 10:41:59 +03:00
DockCorona * corona ( ) ;
2017-07-02 20:19:18 +03:00
void load ( ) ;
2017-07-03 19:04:37 +03:00
QAction * addWidgetsAction ( ) ;
QAction * toggleLayoutAction ( ) ;
public slots :
//! switch to specified layout
Q_INVOKABLE bool switchToLayout ( QString layoutName ) ;
2017-07-02 21:02:27 +03:00
2017-07-03 12:58:02 +03:00
//! creates a new layout with layoutName based on the preset
2017-07-03 19:04:37 +03:00
Q_INVOKABLE QString newLayout ( QString layoutName , QString preset = QString ( i18n ( " Default " ) ) ) ;
signals :
void addWidgetsActionChanged ( ) ;
void toggleLayoutActionChanged ( ) ;
private slots :
void showWidgetsExplorer ( ) ;
private :
QString layoutPath ( QString layoutName ) ;
//! it is used to activate / deactivate the Alternative Layout
void toggleLayout ( ) ;
2017-07-03 12:58:02 +03:00
2017-07-02 15:02:07 +03:00
private :
2017-07-02 16:12:58 +03:00
DockCorona * m_corona { nullptr } ;
2017-07-02 15:02:07 +03:00
Importer * m_importer { nullptr } ;
2017-07-03 19:04:37 +03:00
QString m_lastNonAlternativeLayout { QString ( i18n ( " My Layout " ) ) } ;
QAction * m_addWidgetsAction { nullptr } ;
QAction * m_toggleLayoutAction { nullptr } ;
2017-07-02 15:02:07 +03:00
} ;
}
# endif // LAYOUTMANAGER_H