blob: 1b22c4508f29aa2f4653300a46855f785c164f2e (
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
|
//===========================================
// Lumina-desktop source code
// Copyright (c) 2017, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#include "ScreenObject.h"
#include <QQmlEngine>
#include <QDebug>
ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){
bg_screen = scrn;
}
void ScreenObject::RegisterType(){
static bool done = false;
if(done){ return; }
done=true;
qmlRegisterType<ScreenObject>("Lumina.Backend.ScreenObject",2,0, "ScreenObject");
//Also register any types that are needed by this class
PanelObject::RegisterType();
}
QString ScreenObject::name(){ return bg_screen->name(); }
QString ScreenObject::background(){ return bg; }
int ScreenObject::x(){ return bg_screen->geometry().x(); }
int ScreenObject::y(){ return bg_screen->geometry().y(); }
int ScreenObject::width(){ return bg_screen->geometry().width(); }
int ScreenObject::height(){ return bg_screen->geometry().height(); }
void ScreenObject::setBackground(QString fileOrColor){
if(bg!=fileOrColor){
bg = fileOrColor;
emit backgroundChanged();
}
}
void ScreenObject::setPanels(QList<PanelObject*> list){
panel_objects = list;
emit panelsChanged();
}
//QML Read Functions
QStringList ScreenObject::panels(){
//qDebug() << "Request Panels:" << panel_objects.length();
QStringList names;
for(int i=0; i<panel_objects.length(); i++){ names << panel_objects[i]->name(); }
return names;
}
PanelObject* ScreenObject::panel(QString id){
//qDebug() << "Got Panel Request:" << id;
for(int i=0; i<panel_objects.length(); i++){
if(panel_objects[i]->name()==id){ return panel_objects[i]; }
}
return 0;
}
|