summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-20 05:29:08 (UTC)
committer llornkcor <llornkcor>2002-03-20 05:29:08 (UTC)
commitad91f15243333bf968ef5788d12c780746fcffb3 (patch) (unidiff)
tree85fad92287583c506df59e7a334b7b998fbf126b
parentf1228641b5ee823d309a8e5773e5b6fe94e64a42 (diff)
downloadopie-ad91f15243333bf968ef5788d12c780746fcffb3.zip
opie-ad91f15243333bf968ef5788d12c780746fcffb3.tar.gz
opie-ad91f15243333bf968ef5788d12c780746fcffb3.tar.bz2
added better configurable background image support
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 7f86ce1..6354bb7 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -100,67 +100,66 @@ public:
100 void addItem(AppLnk* app, bool resort=TRUE); 100 void addItem(AppLnk* app, bool resort=TRUE);
101 bool removeLink(const QString& linkfile); 101 bool removeLink(const QString& linkfile);
102 102
103 QStringList mimeTypes() const; 103 QStringList mimeTypes() const;
104 QStringList categories() const; 104 QStringList categories() const;
105 105
106 void clear() 106 void clear()
107 { 107 {
108 mimes.clear(); 108 mimes.clear();
109 cats.clear(); 109 cats.clear();
110 QIconView::clear(); 110 QIconView::clear();
111 hidden.clear(); 111 hidden.clear();
112 } 112 }
113 113
114 void addCatsAndMimes(AppLnk* app) 114 void addCatsAndMimes(AppLnk* app)
115 { 115 {
116 // QStringList c = app->categories(); 116 // QStringList c = app->categories();
117 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { 117 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) {
118 // cats.replace(*cit,(void*)1); 118 // cats.replace(*cit,(void*)1);
119 // } 119 // }
120 QString maj=app->type(); 120 QString maj=app->type();
121 int sl=maj.find('/'); 121 int sl=maj.find('/');
122 if (sl>=0) { 122 if (sl>=0) {
123 QString k = maj.left(sl); 123 QString k = maj.left(sl);
124 mimes.replace(k,(void*)1); 124 mimes.replace(k,(void*)1);
125 } 125 }
126 } 126 }
127 127
128 void drawBackground( QPainter *p, const QRect &r ) 128 void drawBackground( QPainter *p, const QRect &r )
129 { 129 {
130 Config config("qpe"); 130 Config config("qpe");
131 config.setGroup("Appearance"); 131 config.setGroup("Appearance");
132 QString backgroundImage = config.readEntry("BackgroundImage"); 132 QString backgroundImage = config.readEntry("BackgroundImage","launcher/opie-background");
133 133 // if (backgroundImage.isNull()) backgroundImage="launcher/opie-background";
134 if (backgroundImage.isNull()) backgroundImage="launcher/opie-background";
135 int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; 134 int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0;
136 //int backgroundMode = 2; 135 //int backgroundMode = 2;
137 136
138 if ( backgroundMode == 1 ) { 137 if ( backgroundMode == 1 ) {
139 138
140 // Double buffer the background 139 // Double buffer the background
141 static QPixmap *bg = NULL; 140 static QPixmap *bg = NULL;
142 static QColor bgColor; 141 static QColor bgColor;
143 142
144 if ( (bg == NULL) || (bgColor != colorGroup().button()) ) { 143 if ( (bg == NULL) || (bgColor != colorGroup().button()) ) {
145 // Create a new background double buffer 144 // Create a new background double buffer
146 if (bg == NULL) 145 if (bg == NULL)
147 bg = new QPixmap( width(), height() ); 146 bg = new QPixmap( width(), height() );
148 bgColor = colorGroup().button(); 147 bgColor = colorGroup().button();
149 QPainter painter( bg ); 148 QPainter painter( bg );
150 149
151 painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110)); 150 painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110));
152 // Overlay the Qtopia logo in the center 151 // Overlay the Qtopia logo in the center
153 QImage logo; 152 QImage logo;
154 if (QFile::exists(backgroundImage)) { 153 if (QFile::exists(backgroundImage)) {
155 logo = QImage(backgroundImage); 154 logo = QImage(backgroundImage);
156 } else { 155 } else {
157 logo = Resource::loadImage(backgroundImage ); 156 logo = Resource::loadImage(backgroundImage );
158 } 157 }
159 if ( !logo.isNull() ) 158 if ( !logo.isNull() )
160 painter.drawImage( (width() - logo.width()) / 2, 159 painter.drawImage( (width() - logo.width()) / 2,
161 (height() - logo.height()) / 2, logo ); 160 (height() - logo.height()) / 2, logo );
162 } 161 }
163 162
164 // Draw the double buffer to the widget (it is tiled for when the icon view is large) 163 // Draw the double buffer to the widget (it is tiled for when the icon view is large)
165 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), 164 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(),
166 (r.y() + contentsY()) % bg->height() ) ); 165 (r.y() + contentsY()) % bg->height() ) );