author | mark <mark> | 2002-02-23 18:25:50 (UTC) |
---|---|---|
committer | mark <mark> | 2002-02-23 18:25:50 (UTC) |
commit | c200950a2b120b015783f1552fd68c355bcc3185 (patch) (unidiff) | |
tree | de9337b1d339fb18c14b7711ce53f6547bc6e2e7 | |
parent | cb8381a2969b3a51697ec2034a919fffa9a9c022 (diff) | |
download | opie-c200950a2b120b015783f1552fd68c355bcc3185.zip opie-c200950a2b120b015783f1552fd68c355bcc3185.tar.gz opie-c200950a2b120b015783f1552fd68c355bcc3185.tar.bz2 |
Makes it possible to choose your background image with a config item in
qpe.conf
Accepts both absolute paths '/opt/QtPalmtop/pics/mypic.png' and
loadPixmap type paths 'mypic'
-rw-r--r-- | core/launcher/launcherview.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 7b20fdc..0df949e 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
25 | #include <qpe/qpedebug.h> | 25 | #include <qpe/qpedebug.h> |
26 | #include <qpe/config.h> | ||
26 | #include <qpe/categories.h> | 27 | #include <qpe/categories.h> |
27 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
28 | #include <qpe/menubutton.h> | 29 | #include <qpe/menubutton.h> |
@@ -126,6 +127,11 @@ public: | |||
126 | 127 | ||
127 | void drawBackground( QPainter *p, const QRect &r ) | 128 | void drawBackground( QPainter *p, const QRect &r ) |
128 | { | 129 | { |
130 | Config config("qpe"); | ||
131 | config.setGroup("Appearance"); | ||
132 | QString backgroundImage = config.readEntry("BackgroundImage"); | ||
133 | |||
134 | if (backgroundImage.isNull()) backgroundImage="qpe-background"; | ||
129 | int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; | 135 | int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; |
130 | //int backgroundMode = 2; | 136 | //int backgroundMode = 2; |
131 | 137 | ||
@@ -143,9 +149,13 @@ public: | |||
143 | QPainter painter( bg ); | 149 | QPainter painter( bg ); |
144 | 150 | ||
145 | painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110)); | 151 | painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110)); |
146 | 152 | // Overlay the Qtopia logo in the center | |
147 | // Overlay the Qtopia logo in the center | 153 | QImage logo; |
148 | QImage logo = Resource::loadImage( "qpe-background" ); | 154 | if (QFile::exists(backgroundImage)) { |
155 | logo = QImage(backgroundImage); | ||
156 | } else { | ||
157 | logo = Resource::loadImage(backgroundImage ); | ||
158 | } | ||
149 | if ( !logo.isNull() ) | 159 | if ( !logo.isNull() ) |
150 | painter.drawImage( (width() - logo.width()) / 2, | 160 | painter.drawImage( (width() - logo.width()) / 2, |
151 | (height() - logo.height()) / 2, logo ); | 161 | (height() - logo.height()) / 2, logo ); |