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 Desktop source code
// Copyright (c) 2017, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
// This class creates and manages a virtual "root" window
// for all monitors at all times.
//===========================================
#ifndef _LUMINA_ROOT_WINDOW_H
#define _LUMINA_ROOT_WINDOW_H
#include <QWidget>
#include <QRect>
#include <QString>
#include <QPixmap>
#include <QPainter>
#include <QTimer>
#include <QApplication>
#include <QPaintEvent>
#include <QMdiArea>
#include "RootSubWindow.h"
class RootWindow : public QMdiArea{
Q_OBJECT
public:
enum ScaleType{ SolidColor, Stretch, Full, Fit, Center, Tile, BottomLeft, BottomRight, BottomCenter, \
TopLeft, TopRight, TopCenter, CenterLeft, CenterRight};
RootWindow();
~RootWindow();
void start();
private:
struct screeninfo{
QString id;
QRect area;
QString file;
ScaleType scale;
QPixmap wallpaper; //Note: This pixmap will always be the same size as "area"
};
QTimer *autoResizeTimer;
QList<screeninfo> WALLPAPERS;
void updateScreenPixmap(screeninfo *info); //used for recalculating the wallpaper pixmap based on file/area/scale as needed
//Window Management
QList<RootSubWindow*> WINDOWS;
public slots:
void ResizeRoot();
void ChangeWallpaper(QString id, RootWindow::ScaleType scale, QString file);
//Note: for "SingleColor" scaling the "file" variable should be "rgb(R,G,B)" or "#hexcode"
void NewWindow(WId win, Qt::WindowFlags flags = Qt::WindowFlags());
void ShowWindow(WId win);
void HideWindow(WId win);
void CloseWindow(WId win);
private slots:
protected:
void paintEvent(QPaintEvent *ev);
signals:
void RegisterVirtualRoot(WId);
void RootResized();
void NewScreens(QStringList); // [screen_id_1, screen_id_2, etc..]
void RemovedScreens(QStringList); // [screen_id_1, screen_id_2, etc..]
};
#endif
|