blob: d1869ae46f353e335e4804290aaaf632c4997af5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
//===========================================
// Lumina-DE source code
// Copyright (c) 2014, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#include "LuminaThemes.h"
#include "LuminaUtils.h"
#include "LuminaOS.h"
QStringList LTHEME::availableSystemThemes(){
//returns: [name::::path] for each item
}
QStringList LTHEME::availableLocalThemes(){ //returns: [name::::path] for each item
}
QStringList LTHEME::availableSystemColors(){ //returns: [name::::path] for each item
}
QStringList LTHEME::availableLocalColors(){ //returns: [name::::path] for each item
}
QStringList LTHEME::availableSystemIcons(){ //returns: [name] for each item
}
//Return the currently selected Theme/Colors/Icons
QStringList LTHEME::currentSettings(){ //returns [theme path, colorspath, iconsname]
}
//Change the current Theme/Colors/Icons
bool LTHEME::setCurrentSettings(QString themepath, QString colorpath, QString iconname){
}
//Return the complete stylesheet for a given theme/colors
QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath){
}
//==================
// THEME ENGINE CLASS
//==================
LuminaThemeEngine::LuminaThemeEngine(QApplication *app){
application=app; //save this pointer for later
QStringList current = LTHEME::currentSettings();
theme = current[0]; colors=current[1]; icons=current[2];
application->setCurrentStyleSheet( LTHEME::assembleStyleSheet(theme, colors) );
watcher = new QFileSystemWatcher(this);
watcher->addPath( QDir::homePath()+"/.lumina/currenttheme.conf" );
connect(watcher, SIGNAL(fileChanged(const &QString)), this, SLOT(watcherChange()) );
}
LuminaThemeEngine::~LuminaThemeEngine(){
}
void LuminaThemeEngine::watcherChange(){
QStringList current = LTHEME::currentSettings();
if(theme!=current[0] || colors!=current[1]){
application->setCurrentStyleSheet( LTHEME::assembleStyleSheet(current[0], current[1]) );
}
if(icons!=current[3]){
emit updateIcons();
}
//Now save this for later checking
theme = current[0]; colors=current[1]; icons=current[2];
}
|