diff options
Diffstat (limited to 'utils/themeeditor/graphics/rbscreen.cpp')
-rw-r--r-- | utils/themeeditor/graphics/rbscreen.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp index 8d3ef86ad0..065bea61cd 100644 --- a/utils/themeeditor/graphics/rbscreen.cpp +++ b/utils/themeeditor/graphics/rbscreen.cpp | |||
@@ -20,44 +20,42 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "rbscreen.h" | 22 | #include "rbscreen.h" |
23 | #include "rbviewport.h" | ||
23 | 24 | ||
24 | #include <QPainter> | 25 | #include <QPainter> |
25 | #include <QFile> | 26 | #include <QFile> |
26 | 27 | ||
27 | RBScreen::RBScreen(ProjectModel* project, QGraphicsItem *parent) : | 28 | RBScreen::RBScreen(const RBRenderInfo& info, QGraphicsItem *parent) : |
28 | QGraphicsItem(parent), backdrop(0), project(project) | 29 | QGraphicsItem(parent), backdrop(0), project(project) |
29 | { | 30 | { |
30 | 31 | ||
31 | width = safeSetting(project, "#screenwidth", "300").toInt(); | 32 | width = info.settings()->value("#screenwidth", "300").toInt(); |
32 | height = safeSetting(project, "#screenheight", "200").toInt(); | 33 | height = info.settings()->value("#screenheight", "200").toInt(); |
33 | 34 | ||
34 | QString bg = safeSetting(project, "background color", "FFFFFF"); | 35 | QString bg = info.settings()->value("background color", "000000"); |
35 | bgColor = stringToColor(bg, Qt::white); | 36 | bgColor = stringToColor(bg, Qt::white); |
36 | 37 | ||
37 | QString fg = safeSetting(project, "foreground color", "FFFFFF"); | 38 | QString fg = info.settings()->value("foreground color", "FFFFFF"); |
38 | fgColor = stringToColor(fg, Qt::black); | 39 | fgColor = stringToColor(fg, Qt::black); |
39 | 40 | ||
40 | /* Loading backdrop if available */ | 41 | /* Loading backdrop if available */ |
41 | if(project) | 42 | QString base = info.settings()->value("themebase", ""); |
43 | QString backdropFile = info.settings()->value("backdrop", ""); | ||
44 | |||
45 | if(QFile::exists(base + "/backdrops/" + backdropFile)) | ||
42 | { | 46 | { |
43 | QString base = project->getSetting("themebase", ""); | 47 | backdrop = new QPixmap(base + "/backdrops/" + backdropFile); |
44 | QString backdropFile = project->getSetting("backdrop", ""); | ||
45 | 48 | ||
46 | if(QFile::exists(base + "/backdrops/" + backdropFile)) | 49 | /* If a backdrop has been found, use its width and height */ |
50 | if(!backdrop->isNull()) | ||
47 | { | 51 | { |
48 | backdrop = new QPixmap(base + "/backdrops/" + backdropFile); | 52 | width = backdrop->width(); |
49 | 53 | height = backdrop->height(); | |
50 | /* If a backdrop has been found, use its width and height */ | 54 | } |
51 | if(!backdrop->isNull()) | 55 | else |
52 | { | 56 | { |
53 | width = backdrop->width(); | 57 | delete backdrop; |
54 | height = backdrop->height(); | 58 | backdrop = 0; |
55 | } | ||
56 | else | ||
57 | { | ||
58 | delete backdrop; | ||
59 | backdrop = 0; | ||
60 | } | ||
61 | } | 59 | } |
62 | } | 60 | } |
63 | } | 61 | } |
@@ -93,6 +91,16 @@ void RBScreen::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, | |||
93 | } | 91 | } |
94 | } | 92 | } |
95 | 93 | ||
94 | void RBScreen::showViewport(QString name) | ||
95 | { | ||
96 | if(namedViewports.value(name, 0) == 0) | ||
97 | return; | ||
98 | |||
99 | namedViewports.value(name)->show(); | ||
100 | update(); | ||
101 | } | ||
102 | |||
103 | |||
96 | QColor RBScreen::stringToColor(QString str, QColor fallback) | 104 | QColor RBScreen::stringToColor(QString str, QColor fallback) |
97 | { | 105 | { |
98 | 106 | ||