2017-01-02 17:05:30 -05:00
/*
* Copyright 2016 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/>.
*/
2017-02-24 21:41:57 -05:00
# ifndef QUICKWINDOWSYSTEM_H
# define QUICKWINDOWSYSTEM_H
2016-12-25 09:25:27 +02:00
2018-12-02 02:05:52 +02:00
// Qt
2016-12-25 15:19:01 +02:00
# include <QObject>
2017-02-24 21:41:57 -05:00
# include <QQmlEngine>
# include <QJSEngine>
2016-12-25 09:25:27 +02:00
2016-12-25 21:28:00 +02:00
namespace Latte {
2016-12-25 09:25:27 +02:00
2017-02-24 21:41:57 -05:00
/**
* @ brief The QuickWindowSystem class ,
* is a tiny class that provide basic information of WindowSystem
*/
2018-07-03 22:15:45 +03:00
class QuickWindowSystem final : public QObject
{
2016-12-25 09:25:27 +02:00
Q_OBJECT
2017-01-16 14:07:49 -05:00
2017-02-24 21:41:57 -05:00
Q_PROPERTY ( bool compositingActive READ compositingActive NOTIFY compositingChanged FINAL )
2018-03-02 21:17:16 +02:00
Q_PROPERTY ( bool isPlatformWayland READ isPlatformWayland NOTIFY isPlatformWaylandChanged FINAL )
2017-03-03 20:25:53 +02:00
Q_PROPERTY ( uint frameworksVersion READ frameworksVersion NOTIFY frameworksVersionChanged )
2018-04-02 15:45:28 +03:00
Q_PROPERTY ( uint plasmaDesktopVersion READ plasmaDesktopVersion NOTIFY plasmaDesktopVersionChanged )
2017-01-16 14:07:49 -05:00
2016-12-25 09:25:27 +02:00
public :
2017-02-24 21:41:57 -05:00
explicit QuickWindowSystem ( QObject * parent = nullptr ) ;
virtual ~ QuickWindowSystem ( ) ;
2017-01-16 14:07:49 -05:00
2016-12-25 09:25:27 +02:00
bool compositingActive ( ) const ;
2018-03-02 21:17:16 +02:00
bool isPlatformWayland ( ) const ;
2017-03-03 20:25:53 +02:00
uint frameworksVersion ( ) const ;
2018-04-02 17:44:09 +03:00
uint plasmaDesktopVersion ( ) ;
2018-04-02 15:45:28 +03:00
public slots :
Q_INVOKABLE uint makeVersion ( uint major , uint minor , uint release ) const ;
2017-01-16 14:07:49 -05:00
2016-12-30 16:25:27 -05:00
signals :
2016-12-25 09:25:27 +02:00
void compositingChanged ( ) ;
2017-03-03 20:25:53 +02:00
void frameworksVersionChanged ( ) ;
2018-03-02 21:17:16 +02:00
void isPlatformWaylandChanged ( ) ;
2018-04-02 15:45:28 +03:00
void plasmaDesktopVersionChanged ( ) ;
private :
void loadPlasmaDesktopVersion ( ) ;
2017-01-16 14:07:49 -05:00
2018-04-02 17:44:09 +03:00
uint identifyPlasmaDesktopVersion ( ) ;
2016-12-30 16:25:27 -05:00
private :
2018-04-02 15:45:28 +03:00
bool m_compositing { true } ;
2018-04-02 17:44:09 +03:00
int m_plasmaDesktopVersion { - 1 } ;
2016-12-25 09:25:27 +02:00
} ;
2017-02-24 21:41:57 -05:00
static QObject * windowsystem_qobject_singletontype_provider ( QQmlEngine * engine , QJSEngine * scriptEngine )
{
Q_UNUSED ( engine )
Q_UNUSED ( scriptEngine )
// NOTE: QML engine is the owner of this resource
return new QuickWindowSystem ;
}
}
2016-12-25 09:25:27 +02:00
2017-02-24 21:41:57 -05:00
# endif // QUICKWINDOWSYSTEM_H