2018-12-25 13:03:20 +02:00
/*
* Copyright 2018 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 BACKGROUNDTRACKER_H
# define BACKGROUNDTRACKER_H
// local
# include "plasma/extended/backgroundcache.h"
// Qt
# include <QObject>
namespace Latte {
class BackgroundTracker : public QObject
{
Q_OBJECT
2019-01-05 12:22:06 +02:00
Q_PROPERTY ( bool isBusy READ isBusy NOTIFY isBusyChanged )
2019-01-04 21:10:50 +02:00
2018-12-25 14:17:05 +02:00
Q_PROPERTY ( int location READ location WRITE setLocation NOTIFY locationChanged )
2018-12-25 20:20:06 +02:00
Q_PROPERTY ( float currentBrightness READ currentBrightness NOTIFY currentBrightnessChanged )
2018-12-25 14:17:05 +02:00
2018-12-25 13:03:20 +02:00
Q_PROPERTY ( QString activity READ activity WRITE setActivity NOTIFY activityChanged )
Q_PROPERTY ( QString screenName READ screenName WRITE setScreenName NOTIFY screenNameChanged )
public :
BackgroundTracker ( QObject * parent = nullptr ) ;
virtual ~ BackgroundTracker ( ) ;
2019-01-05 12:22:06 +02:00
bool isBusy ( ) const ;
2019-01-04 21:10:50 +02:00
2018-12-25 14:17:05 +02:00
int location ( ) const ;
void setLocation ( int location ) ;
2018-12-25 20:20:06 +02:00
float currentBrightness ( ) const ;
2018-12-25 14:17:05 +02:00
2018-12-25 13:03:20 +02:00
QString activity ( ) const ;
void setActivity ( QString id ) ;
QString screenName ( ) const ;
void setScreenName ( QString name ) ;
2019-02-18 17:46:53 +02:00
public slots :
Q_INVOKABLE void setBackgroundFromBroadcast ( QString activity , QString screen , QString filename ) ;
Q_INVOKABLE void setBroadcastedBackgroundsEnabled ( QString activity , QString screen , bool enabled ) ;
2018-12-25 13:03:20 +02:00
signals :
void activityChanged ( ) ;
2018-12-25 20:20:06 +02:00
void currentBrightnessChanged ( ) ;
2019-01-05 12:22:06 +02:00
void isBusyChanged ( ) ;
2018-12-25 14:17:05 +02:00
void locationChanged ( ) ;
2018-12-25 13:03:20 +02:00
void screenNameChanged ( ) ;
2018-12-25 14:17:05 +02:00
private slots :
2018-12-25 18:36:44 +02:00
void backgroundChanged ( const QString & activity , const QString & screenName ) ;
2018-12-25 14:17:05 +02:00
void update ( ) ;
2018-12-25 13:03:20 +02:00
private :
2018-12-25 14:17:05 +02:00
// local
2019-01-05 12:22:06 +02:00
bool m_busy { false } ;
2018-12-25 20:20:06 +02:00
float m_brightness { - 1000 } ;
2018-12-25 14:17:05 +02:00
PlasmaExtended : : BackgroundCache * m_cache { nullptr } ;
// Qt
2018-12-25 13:03:20 +02:00
QString m_activity ;
QString m_screenName ;
2018-12-25 14:17:05 +02:00
// Plasma
Plasma : : Types : : Location m_location { Plasma : : Types : : BottomEdge } ;
2018-12-25 13:03:20 +02:00
} ;
}
# endif