author | mickeyl <mickeyl> | 2005-01-10 23:47:36 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-10 23:47:36 (UTC) |
commit | 32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e (patch) (unidiff) | |
tree | 7b8bcf86b76b4c44ca96f60e2c2594995c74fbb6 | |
parent | dd649f98d0010711ed3d0fac433bd9fafa4002db (diff) | |
download | opie-32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e.zip opie-32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e.tar.gz opie-32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e.tar.bz2 |
make number of icon columns in the launcher customizable per-tab
TODO: add GUI for that
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 1 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 38 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 5 |
4 files changed, 32 insertions, 13 deletions
@@ -1,36 +1,37 @@ | |||
1 | 2005-??-??Opie 1.2.0 | 1 | 2005-??-??Opie 1.2.0 |
2 | 2 | ||
3 | New Features | 3 | New Features |
4 | ------------ | 4 | ------------ |
5 | * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) | ||
5 | 6 | ||
6 | Fixed Bugs | 7 | Fixed Bugs |
7 | ---------- | 8 | ---------- |
8 | * #1501 - Fixed bug in todo sql backend (eilers) | 9 | * #1501 - Fixed bug in todo sql backend (eilers) |
9 | * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) | 10 | * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) |
10 | 11 | ||
11 | Internal | 12 | Internal |
12 | -------- | 13 | -------- |
13 | * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) | 14 | * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) |
14 | 15 | ||
15 | 2004-11-26Opie 1.1.8 | 16 | 2004-11-26Opie 1.1.8 |
16 | 17 | ||
17 | New Features | 18 | New Features |
18 | ------------ | 19 | ------------ |
19 | * PackageManager supports installation of local ipkg files (drw) | 20 | * PackageManager supports installation of local ipkg files (drw) |
20 | * PackageManager supports linking of applications to root (drw) | 21 | * PackageManager supports linking of applications to root (drw) |
21 | * PackageManager supports src/gz feeds (drw,wimpie) | 22 | * PackageManager supports src/gz feeds (drw,wimpie) |
22 | * Added a syslog information tab to sysinfo (mickeyl) | 23 | * Added a syslog information tab to sysinfo (mickeyl) |
23 | * Added new, more consistent, PIM icons + a GIMP teplate (ar) | 24 | * Added new, more consistent, PIM icons + a GIMP teplate (ar) |
24 | 25 | ||
25 | Fixed Bugs | 26 | Fixed Bugs |
26 | ---------- | 27 | ---------- |
27 | * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) | 28 | * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) |
28 | * #1269 - VCards were imported into personal area if it was activated (eilers) | 29 | * #1269 - VCards were imported into personal area if it was activated (eilers) |
29 | * #1464 - Packagemanager dont set active filter after install a package (drw) | 30 | * #1464 - Packagemanager dont set active filter after install a package (drw) |
30 | * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) | 31 | * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) |
31 | * #1493 - Fixed one column layout bug of the launcher (hrw) | 32 | * #1493 - Fixed one column layout bug of the launcher (hrw) |
32 | * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) | 33 | * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) |
33 | * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) | 34 | * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) |
34 | * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) | 35 | * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) |
35 | 36 | ||
36 | Internal | 37 | Internal |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 970b8cb..4f81076 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -260,64 +260,65 @@ void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | void LauncherTabWidget::setLoadingProgress( int percent ) | 263 | void LauncherTabWidget::setLoadingProgress( int percent ) |
264 | { | 264 | { |
265 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); | 265 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); |
266 | } | 266 | } |
267 | 267 | ||
268 | // ### this function could more to LauncherView | 268 | // ### this function could more to LauncherView |
269 | void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) | 269 | void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) |
270 | { | 270 | { |
271 | // View | 271 | // View |
272 | QString view = cfg.readEntry( "View", "Icon" ); | 272 | QString view = cfg.readEntry( "View", "Icon" ); |
273 | if ( view == "List" ) // No tr | 273 | if ( view == "List" ) // No tr |
274 | v->setViewMode( LauncherView::List ); | 274 | v->setViewMode( LauncherView::List ); |
275 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); | 275 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); |
276 | if ( bgType == "Image" ) { // No tr | 276 | if ( bgType == "Image" ) { // No tr |
277 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); | 277 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); |
278 | v->setBackgroundType( LauncherView::Image, pm ); | 278 | v->setBackgroundType( LauncherView::Image, pm ); |
279 | } else if ( bgType == "SolidColor" ) { | 279 | } else if ( bgType == "SolidColor" ) { |
280 | QString c = cfg.readEntry( "BackgroundColor" ); | 280 | QString c = cfg.readEntry( "BackgroundColor" ); |
281 | v->setBackgroundType( LauncherView::SolidColor, c ); | 281 | v->setBackgroundType( LauncherView::SolidColor, c ); |
282 | } else { | 282 | } else { |
283 | v->setBackgroundType( LauncherView::Ruled, QString::null ); | 283 | v->setBackgroundType( LauncherView::Ruled, QString::null ); |
284 | } | 284 | } |
285 | QString textCol = cfg.readEntry( "TextColor" ); | 285 | QString textCol = cfg.readEntry( "TextColor" ); |
286 | if ( textCol.isEmpty() ) | 286 | if ( textCol.isEmpty() ) |
287 | v->setTextColor( QColor() ); | 287 | v->setTextColor( QColor() ); |
288 | else | 288 | else |
289 | v->setTextColor( QColor(textCol) ); | 289 | v->setTextColor( QColor(textCol) ); |
290 | // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); | 290 | // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); |
291 | 291 | ||
292 | v->setColNumber( cfg.readNumEntry( "Columns", 0 ) ); | ||
292 | 293 | ||
293 | QStringList font = cfg.readListEntry( "Font", ',' ); | 294 | QStringList font = cfg.readListEntry( "Font", ',' ); |
294 | if ( font.count() == 4 ) | 295 | if ( font.count() == 4 ) |
295 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); | 296 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); |
296 | 297 | ||
297 | // ### FIXME TabColor TabTextColor | 298 | // ### FIXME TabColor TabTextColor |
298 | 299 | ||
299 | } | 300 | } |
300 | 301 | ||
301 | // ### Could move to LauncherTab | 302 | // ### Could move to LauncherTab |
302 | void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) | 303 | void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) |
303 | { | 304 | { |
304 | cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr | 305 | cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr |
305 | 306 | ||
306 | setTabViewAppearance( tab->view, cfg ); | 307 | setTabViewAppearance( tab->view, cfg ); |
307 | 308 | ||
308 | // Tabs | 309 | // Tabs |
309 | QString tabCol = cfg.readEntry( "TabColor" ); | 310 | QString tabCol = cfg.readEntry( "TabColor" ); |
310 | if ( tabCol.isEmpty() ) | 311 | if ( tabCol.isEmpty() ) |
311 | tab->bgColor = QColor(); | 312 | tab->bgColor = QColor(); |
312 | else | 313 | else |
313 | tab->bgColor = QColor(tabCol); | 314 | tab->bgColor = QColor(tabCol); |
314 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); | 315 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); |
315 | if ( tabTextCol.isEmpty() ) | 316 | if ( tabTextCol.isEmpty() ) |
316 | tab->fgColor = QColor(); | 317 | tab->fgColor = QColor(); |
317 | else | 318 | else |
318 | tab->fgColor = QColor(tabTextCol); | 319 | tab->fgColor = QColor(tabTextCol); |
319 | } | 320 | } |
320 | 321 | ||
321 | void LauncherTabWidget::paletteChange( const QPalette &p ) | 322 | void LauncherTabWidget::paletteChange( const QPalette &p ) |
322 | { | 323 | { |
323 | QVBox::paletteChange( p ); | 324 | QVBox::paletteChange( p ); |
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index dc4c57f..9d78c0d 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -1,56 +1,57 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "launcherview.h" | 21 | #include "launcherview.h" |
22 | 22 | ||
23 | /* OPIE */ | 23 | /* OPIE */ |
24 | #include <opie2/odebug.h> | 24 | #include <opie2/odebug.h> |
25 | #include <qpe/config.h> | ||
25 | #include <qtopia/qpeapplication.h> | 26 | #include <qtopia/qpeapplication.h> |
26 | #include <qtopia/private/categories.h> | 27 | #include <qtopia/private/categories.h> |
27 | #include <qtopia/categoryselect.h> | 28 | #include <qtopia/categoryselect.h> |
28 | #include <qtopia/mimetype.h> | 29 | #include <qtopia/mimetype.h> |
29 | #include <qtopia/resource.h> | 30 | #include <qtopia/resource.h> |
30 | using namespace Opie::Core; | 31 | using namespace Opie::Core; |
31 | 32 | ||
32 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
33 | 34 | ||
34 | /* QT */ | 35 | /* QT */ |
35 | #include <qtimer.h> | 36 | #include <qtimer.h> |
36 | #include <qfileinfo.h> | 37 | #include <qfileinfo.h> |
37 | #include <qiconview.h> | 38 | #include <qiconview.h> |
38 | #include <qobjectlist.h> | 39 | #include <qobjectlist.h> |
39 | 40 | ||
40 | 41 | ||
41 | // These define how the busy icon is animated and highlighted | 42 | // These define how the busy icon is animated and highlighted |
42 | #define BRIGHTEN_BUSY_ICON | 43 | #define BRIGHTEN_BUSY_ICON |
43 | //#define ALPHA_FADE_BUSY_ICON | 44 | //#define ALPHA_FADE_BUSY_ICON |
44 | //#define USE_ANIMATED_BUSY_ICON_OVERLAY | 45 | //#define USE_ANIMATED_BUSY_ICON_OVERLAY |
45 | #define BOUNCE_BUSY_ICON | 46 | #define BOUNCE_BUSY_ICON |
46 | 47 | ||
47 | typedef QMap<QString,QPixmap>::Iterator pixiter; | 48 | typedef QMap<QString,QPixmap>::Iterator pixiter; |
48 | 49 | ||
49 | class BgPixmap | 50 | class BgPixmap |
50 | { | 51 | { |
51 | public: | 52 | public: |
52 | BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} | 53 | BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} |
53 | QPixmap pm; | 54 | QPixmap pm; |
54 | int ref; | 55 | int ref; |
55 | }; | 56 | }; |
56 | 57 | ||
@@ -253,65 +254,65 @@ void LauncherItem::animateIcon() | |||
253 | // Paint animation overlay | 254 | // Paint animation overlay |
254 | QPainter p( liv->viewport() ); | 255 | QPainter p( liv->viewport() ); |
255 | paintAnimatedIcon( &p ); | 256 | paintAnimatedIcon( &p ); |
256 | } | 257 | } |
257 | 258 | ||
258 | void LauncherItem::resetIcon() | 259 | void LauncherItem::resetIcon() |
259 | { | 260 | { |
260 | iteration = 0; | 261 | iteration = 0; |
261 | if (isEyeImage()) { | 262 | if (isEyeImage()) { |
262 | QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(appLnk()->file()); | 263 | QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(appLnk()->file()); |
263 | if (it != LauncherIconView::sm_EyeCache->end()) { | 264 | if (it != LauncherIconView::sm_EyeCache->end()) { |
264 | setPixmap(*it); | 265 | setPixmap(*it); |
265 | return; | 266 | return; |
266 | } | 267 | } |
267 | } | 268 | } |
268 | setPixmap(isBigIcon ? app->bigPixmap() : app->pixmap()); | 269 | setPixmap(isBigIcon ? app->bigPixmap() : app->pixmap()); |
269 | } | 270 | } |
270 | 271 | ||
271 | void LauncherItem::setEyePixmap(const QPixmap&aIcon) | 272 | void LauncherItem::setEyePixmap(const QPixmap&aIcon) |
272 | { | 273 | { |
273 | if (!isEyeImage()) return; | 274 | if (!isEyeImage()) return; |
274 | setPixmap(aIcon); | 275 | setPixmap(aIcon); |
275 | m_EyeImageSet = EYE_ICON; | 276 | m_EyeImageSet = EYE_ICON; |
276 | } | 277 | } |
277 | 278 | ||
278 | //=========================================================================== | 279 | //=========================================================================== |
279 | // Implemantation of LauncherIconview start | 280 | // Implemantation of LauncherIconview start |
280 | //=========================================================================== | 281 | //=========================================================================== |
281 | 282 | ||
282 | QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; | 283 | QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; |
283 | 284 | ||
284 | LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) | 285 | LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) |
285 | : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white) | 286 | : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white),numColumns(0) |
286 | { | 287 | { |
287 | m_EyeCallBack = 0; | 288 | m_EyeCallBack = 0; |
288 | if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); | 289 | if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); |
289 | sortmeth = Name; | 290 | sortmeth = Name; |
290 | hidden.setAutoDelete(TRUE); | 291 | hidden.setAutoDelete(TRUE); |
291 | ike = FALSE; | 292 | ike = FALSE; |
292 | calculateGrid( Bottom ); | 293 | calculateGrid( Bottom ); |
293 | connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); | 294 | connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); |
294 | } | 295 | } |
295 | 296 | ||
296 | LauncherIconView::~LauncherIconView() | 297 | LauncherIconView::~LauncherIconView() |
297 | { | 298 | { |
298 | odebug << "LauncherIconView::~LauncherIconView()" << oendl; | 299 | odebug << "LauncherIconView::~LauncherIconView()" << oendl; |
299 | #if 0 // debuggery | 300 | #if 0 // debuggery |
300 | QListIterator<AppLnk> it(hidden); | 301 | QListIterator<AppLnk> it(hidden); |
301 | AppLnk* l; | 302 | AppLnk* l; |
302 | while ((l=it.current())) { | 303 | while ((l=it.current())) { |
303 | ++it; | 304 | ++it; |
304 | //odebug << "" << l << ": hidden (should remove)" << oendl; | 305 | //odebug << "" << l << ": hidden (should remove)" << oendl; |
305 | } | 306 | } |
306 | #endif | 307 | #endif |
307 | } | 308 | } |
308 | 309 | ||
309 | int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) | 310 | int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) |
310 | { | 311 | { |
311 | switch (sortmeth) { | 312 | switch (sortmeth) { |
312 | case Name: | 313 | case Name: |
313 | return a->name().lower().compare(b->name().lower()); | 314 | return a->name().lower().compare(b->name().lower()); |
314 | case Date: { | 315 | case Date: { |
315 | QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); | 316 | QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); |
316 | QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); | 317 | QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); |
317 | return fa.lastModified().secsTo(fb.lastModified()); | 318 | return fa.lastModified().secsTo(fb.lastModified()); |
@@ -596,80 +597,80 @@ void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink) | |||
596 | 597 | ||
597 | void LauncherIconView::timerEvent( QTimerEvent *te ) | 598 | void LauncherIconView::timerEvent( QTimerEvent *te ) |
598 | { | 599 | { |
599 | if ( te->timerId() == busyTimer ) { | 600 | if ( te->timerId() == busyTimer ) { |
600 | if ( bsy ) | 601 | if ( bsy ) |
601 | bsy->animateIcon(); | 602 | bsy->animateIcon(); |
602 | } else { | 603 | } else { |
603 | QIconView::timerEvent( te ); | 604 | QIconView::timerEvent( te ); |
604 | } | 605 | } |
605 | } | 606 | } |
606 | 607 | ||
607 | void LauncherIconView::setBigIcons( bool bi ) | 608 | void LauncherIconView::setBigIcons( bool bi ) |
608 | { | 609 | { |
609 | sm_EyeCache->clear(); | 610 | sm_EyeCache->clear(); |
610 | bigIcns = bi; | 611 | bigIcns = bi; |
611 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 612 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
612 | busyPix.resize(0,0); | 613 | busyPix.resize(0,0); |
613 | #endif | 614 | #endif |
614 | } | 615 | } |
615 | 616 | ||
616 | QIconViewItem* LauncherIconView::busyItem() const | 617 | QIconViewItem* LauncherIconView::busyItem() const |
617 | { | 618 | { |
618 | return bsy; | 619 | return bsy; |
619 | } | 620 | } |
620 | 621 | ||
621 | void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } | 622 | void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } |
622 | 623 | ||
623 | void LauncherIconView::calculateGrid( ItemTextPos pos ) | 624 | void LauncherIconView::calculateGrid( ItemTextPos pos ) |
624 | { | 625 | { |
625 | int dw = QApplication::desktop()->width(); | 626 | int dw = QApplication::desktop()->width(); |
626 | int viewerWidth = dw-style().scrollBarExtent().width(); | 627 | int viewerWidth = dw-style().scrollBarExtent().width(); |
627 | if ( pos == Bottom ) { | 628 | if ( pos == Bottom ) { |
628 | int cols = 3; | 629 | if( !numColumns ) { |
629 | if ( viewerWidth <= 200 ) | 630 | if ( viewerWidth <= 200 ) numColumns = 2; |
630 | cols = 2; | 631 | else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96; |
631 | else if ( viewerWidth >= 400 ) | 632 | else numColumns = 3; |
632 | cols = viewerWidth/96; | 633 | } |
633 | setSpacing( 4 ); | 634 | setSpacing( 4 ); |
634 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); | 635 | setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); |
635 | setGridY( fontMetrics().height()*2+24 ); | 636 | setGridY( fontMetrics().height()*2+24 ); |
636 | } else { | 637 | } else { |
637 | int cols = 2; | 638 | if( !numColumns ) { |
638 | if ( viewerWidth < 150 ) | 639 | if ( viewerWidth < 150 ) numColumns = 1; |
639 | cols = 1; | 640 | else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150; |
640 | else if ( viewerWidth >= 400 ) | 641 | else numColumns = 2; |
641 | cols = viewerWidth/150; | 642 | } |
642 | setSpacing( 2 ); | 643 | setSpacing( 2 ); |
643 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); | 644 | setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); |
644 | setGridY( fontMetrics().height()+2 ); | 645 | setGridY( fontMetrics().height()+2 ); |
645 | } | 646 | } |
646 | } | 647 | } |
647 | 648 | ||
648 | void LauncherIconView::styleChange( QStyle &old ) | 649 | void LauncherIconView::styleChange( QStyle &old ) |
649 | { | 650 | { |
650 | QIconView::styleChange( old ); | 651 | QIconView::styleChange( old ); |
651 | calculateGrid( itemTextPos() ); | 652 | calculateGrid( itemTextPos() ); |
652 | } | 653 | } |
653 | 654 | ||
654 | void LauncherIconView::keyPressEvent(QKeyEvent* e) | 655 | void LauncherIconView::keyPressEvent(QKeyEvent* e) |
655 | { | 656 | { |
656 | ike = TRUE; | 657 | ike = TRUE; |
657 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { | 658 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { |
658 | if ( (e->state() & ShiftButton) ) | 659 | if ( (e->state() & ShiftButton) ) |
659 | emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); | 660 | emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); |
660 | else | 661 | else |
661 | returnPressed(currentItem()); | 662 | returnPressed(currentItem()); |
662 | } | 663 | } |
663 | 664 | ||
664 | QIconView::keyPressEvent(e); | 665 | QIconView::keyPressEvent(e); |
665 | ike = FALSE; | 666 | ike = FALSE; |
666 | } | 667 | } |
667 | 668 | ||
668 | //=========================================================================== | 669 | //=========================================================================== |
669 | // Implemantation of LauncherIconview end | 670 | // Implemantation of LauncherIconview end |
670 | //=========================================================================== | 671 | //=========================================================================== |
671 | 672 | ||
672 | 673 | ||
673 | //=========================================================================== | 674 | //=========================================================================== |
674 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) | 675 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) |
675 | : QVBox( parent, name, fl ) | 676 | : QVBox( parent, name, fl ) |
@@ -974,64 +975,75 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) | |||
974 | 975 | ||
975 | case SolidColor: | 976 | case SolidColor: |
976 | default: | 977 | default: |
977 | break; | 978 | break; |
978 | } | 979 | } |
979 | 980 | ||
980 | const QObjectList *list = queryList( "QWidget", 0, FALSE ); | 981 | const QObjectList *list = queryList( "QWidget", 0, FALSE ); |
981 | QObject *obj; | 982 | QObject *obj; |
982 | for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) { | 983 | for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) { |
983 | if ( obj->isWidgetType() ) { | 984 | if ( obj->isWidgetType() ) { |
984 | QWidget *w = (QWidget*)obj; | 985 | QWidget *w = (QWidget*)obj; |
985 | w->setBackgroundPixmap( bg ); | 986 | w->setBackgroundPixmap( bg ); |
986 | if ( bgName.isEmpty() ) { | 987 | if ( bgName.isEmpty() ) { |
987 | // Solid Color | 988 | // Solid Color |
988 | if ( val.isEmpty() ) | 989 | if ( val.isEmpty() ) |
989 | w->setBackgroundColor( colorGroup().base() ); | 990 | w->setBackgroundColor( colorGroup().base() ); |
990 | else | 991 | else |
991 | w->setBackgroundColor( val ); | 992 | w->setBackgroundColor( val ); |
992 | } else { | 993 | } else { |
993 | // Ruled or Image pixmap | 994 | // Ruled or Image pixmap |
994 | w->setBackgroundOrigin( ParentOrigin ); | 995 | w->setBackgroundOrigin( ParentOrigin ); |
995 | } | 996 | } |
996 | } | 997 | } |
997 | } | 998 | } |
998 | delete list; | 999 | delete list; |
999 | 1000 | ||
1000 | bgType = t; | 1001 | bgType = t; |
1001 | icons->viewport()->update(); | 1002 | icons->viewport()->update(); |
1002 | 1003 | ||
1003 | QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); | 1004 | QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); |
1004 | } | 1005 | } |
1005 | 1006 | ||
1007 | void LauncherView::setColNumber( int num ) | ||
1008 | { | ||
1009 | icons->setColNumber( num ); | ||
1010 | } | ||
1011 | |||
1012 | void LauncherIconView::setColNumber( int num ) | ||
1013 | { | ||
1014 | numColumns = num; | ||
1015 | calculateGrid( Bottom ); | ||
1016 | } | ||
1017 | |||
1006 | void LauncherView::setTextColor( const QColor &tc ) | 1018 | void LauncherView::setTextColor( const QColor &tc ) |
1007 | { | 1019 | { |
1008 | textCol = tc; | 1020 | textCol = tc; |
1009 | QColorGroup cg = icons->colorGroup(); | 1021 | QColorGroup cg = icons->colorGroup(); |
1010 | cg.setColor( QColorGroup::Text, tc ); | 1022 | cg.setColor( QColorGroup::Text, tc ); |
1011 | icons->setPalette( QPalette(cg,cg,cg) ); | 1023 | icons->setPalette( QPalette(cg,cg,cg) ); |
1012 | icons->viewport()->update(); | 1024 | icons->viewport()->update(); |
1013 | } | 1025 | } |
1014 | 1026 | ||
1015 | void LauncherView::setViewFont( const QFont &f ) | 1027 | void LauncherView::setViewFont( const QFont &f ) |
1016 | { | 1028 | { |
1017 | icons->setFont( f ); | 1029 | icons->setFont( f ); |
1018 | icons->hideOrShowItems( FALSE ); | 1030 | icons->hideOrShowItems( FALSE ); |
1019 | } | 1031 | } |
1020 | 1032 | ||
1021 | void LauncherView::clearViewFont() | 1033 | void LauncherView::clearViewFont() |
1022 | { | 1034 | { |
1023 | icons->unsetFont(); | 1035 | icons->unsetFont(); |
1024 | icons->hideOrShowItems( FALSE ); | 1036 | icons->hideOrShowItems( FALSE ); |
1025 | } | 1037 | } |
1026 | 1038 | ||
1027 | void LauncherView::resizeEvent(QResizeEvent *e) | 1039 | void LauncherView::resizeEvent(QResizeEvent *e) |
1028 | { | 1040 | { |
1029 | // qDebug("LauncherView resize event"); | 1041 | // qDebug("LauncherView resize event"); |
1030 | QVBox::resizeEvent( e ); | 1042 | QVBox::resizeEvent( e ); |
1031 | // commented out for launcherview and qt/e 2.3.8 problems, probably needs real fixing somewhere... | 1043 | // commented out for launcherview and qt/e 2.3.8 problems, probably needs real fixing somewhere... |
1032 | // if ( e->size().width() != e->oldSize().width() ) | 1044 | // if ( e->size().width() != e->oldSize().width() ) |
1033 | sort(); | 1045 | sort(); |
1034 | } | 1046 | } |
1035 | 1047 | ||
1036 | void LauncherView::selectionChanged() | 1048 | void LauncherView::selectionChanged() |
1037 | { | 1049 | { |
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index 05073ab..e2869eb 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h | |||
@@ -53,64 +53,66 @@ public: | |||
53 | ~LauncherView(); | 53 | ~LauncherView(); |
54 | 54 | ||
55 | void hideIcons(); | 55 | void hideIcons(); |
56 | 56 | ||
57 | bool removeLink(const QString& linkfile); | 57 | bool removeLink(const QString& linkfile); |
58 | void addItem(AppLnk* app, bool resort=TRUE); | 58 | void addItem(AppLnk* app, bool resort=TRUE); |
59 | void changeItem(const AppLnk&old,AppLnk*nlink); | 59 | void changeItem(const AppLnk&old,AppLnk*nlink); |
60 | 60 | ||
61 | void removeAllItems(); | 61 | void removeAllItems(); |
62 | void setSortEnabled(bool); | 62 | void setSortEnabled(bool); |
63 | void setUpdatesEnabled(bool); | 63 | void setUpdatesEnabled(bool); |
64 | void sort(); | 64 | void sort(); |
65 | 65 | ||
66 | void setToolsEnabled(bool); | 66 | void setToolsEnabled(bool); |
67 | void updateTools(); | 67 | void updateTools(); |
68 | 68 | ||
69 | void setBusy(bool); | 69 | void setBusy(bool); |
70 | void setBusyIndicatorType( const QString& ); | 70 | void setBusyIndicatorType( const QString& ); |
71 | 71 | ||
72 | enum ViewMode { Icon, List }; | 72 | enum ViewMode { Icon, List }; |
73 | void setViewMode( ViewMode m ); | 73 | void setViewMode( ViewMode m ); |
74 | ViewMode viewMode() const { return vmode; } | 74 | ViewMode viewMode() const { return vmode; } |
75 | 75 | ||
76 | enum BackgroundType { Ruled, SolidColor, Image }; | 76 | enum BackgroundType { Ruled, SolidColor, Image }; |
77 | void setBackgroundType( BackgroundType t, const QString & ); | 77 | void setBackgroundType( BackgroundType t, const QString & ); |
78 | BackgroundType backgroundType() const { return bgType; } | 78 | BackgroundType backgroundType() const { return bgType; } |
79 | 79 | ||
80 | void setTextColor( const QColor & ); | 80 | void setTextColor( const QColor & ); |
81 | QColor textColor() const { return textCol; } | 81 | QColor textColor() const { return textCol; } |
82 | 82 | ||
83 | void setViewFont( const QFont & ); | 83 | void setViewFont( const QFont & ); |
84 | void clearViewFont(); | 84 | void clearViewFont(); |
85 | |||
86 | void setColNumber( int ); | ||
85 | 87 | ||
86 | void relayout(void); | 88 | void relayout(void); |
87 | 89 | ||
88 | signals: | 90 | signals: |
89 | void clicked( const AppLnk * ); | 91 | void clicked( const AppLnk * ); |
90 | void rightPressed( AppLnk * ); | 92 | void rightPressed( AppLnk * ); |
91 | 93 | ||
92 | protected slots: | 94 | protected slots: |
93 | void selectionChanged(); | 95 | void selectionChanged(); |
94 | void returnPressed( QIconViewItem *item ); | 96 | void returnPressed( QIconViewItem *item ); |
95 | void itemClicked( int, QIconViewItem * ); | 97 | void itemClicked( int, QIconViewItem * ); |
96 | void itemPressed( int, QIconViewItem * ); | 98 | void itemPressed( int, QIconViewItem * ); |
97 | void sortBy(int); | 99 | void sortBy(int); |
98 | void showType(int); | 100 | void showType(int); |
99 | void showCategory( int ); | 101 | void showCategory( int ); |
100 | void resizeEvent(QResizeEvent *); | 102 | void resizeEvent(QResizeEvent *); |
101 | void flushBgCache(); | 103 | void flushBgCache(); |
102 | 104 | ||
103 | protected: | 105 | protected: |
104 | void paletteChange( const QPalette & ); | 106 | void paletteChange( const QPalette & ); |
105 | 107 | ||
106 | void fontChanged(const QFont &); | 108 | void fontChanged(const QFont &); |
107 | 109 | ||
108 | private: | 110 | private: |
109 | static bool bsy; | 111 | static bool bsy; |
110 | QWidget* tools; | 112 | QWidget* tools; |
111 | LauncherIconView* icons; | 113 | LauncherIconView* icons; |
112 | QComboBox *typemb; | 114 | QComboBox *typemb; |
113 | QStringList typelist; | 115 | QStringList typelist; |
114 | CategorySelect *catmb; | 116 | CategorySelect *catmb; |
115 | ViewMode vmode; | 117 | ViewMode vmode; |
116 | BackgroundType bgType; | 118 | BackgroundType bgType; |
@@ -167,84 +169,87 @@ public: | |||
167 | QPixmap busyPixmap() const { return busyPix; } | 169 | QPixmap busyPixmap() const { return busyPix; } |
168 | #endif | 170 | #endif |
169 | void setBigIcons( bool bi ); | 171 | void setBigIcons( bool bi ); |
170 | void updateCategoriesAndMimeTypes(); | 172 | void updateCategoriesAndMimeTypes(); |
171 | void setBusyIndicatorType ( BusyIndicatorType t ); | 173 | void setBusyIndicatorType ( BusyIndicatorType t ); |
172 | void doAutoScroll() | 174 | void doAutoScroll() |
173 | { | 175 | { |
174 | // We don't want rubberbanding (yet) | 176 | // We don't want rubberbanding (yet) |
175 | } | 177 | } |
176 | 178 | ||
177 | void setBusy(bool on); | 179 | void setBusy(bool on); |
178 | bool inKeyEvent() const { return ike; } | 180 | bool inKeyEvent() const { return ike; } |
179 | 181 | ||
180 | void addItem(AppLnk* app, bool resort=TRUE); | 182 | void addItem(AppLnk* app, bool resort=TRUE); |
181 | bool removeLink(const QString& linkfile,bool removeCache = true); | 183 | bool removeLink(const QString& linkfile,bool removeCache = true); |
182 | void changeItem(const AppLnk&old,AppLnk*nlink); | 184 | void changeItem(const AppLnk&old,AppLnk*nlink); |
183 | 185 | ||
184 | QStringList mimeTypes() const; | 186 | QStringList mimeTypes() const; |
185 | QStringList categories() const; | 187 | QStringList categories() const; |
186 | void clear(); | 188 | void clear(); |
187 | void addCatsAndMimes(AppLnk* app); | 189 | void addCatsAndMimes(AppLnk* app); |
188 | 190 | ||
189 | void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} | 191 | void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} |
190 | 192 | ||
191 | void setBackgroundPixmap( const QPixmap &pm ) { | 193 | void setBackgroundPixmap( const QPixmap &pm ) { |
192 | bgPixmap = pm; | 194 | bgPixmap = pm; |
193 | } | 195 | } |
194 | 196 | ||
195 | void setBackgroundColor( const QColor &c ) { | 197 | void setBackgroundColor( const QColor &c ) { |
196 | bgColor = c; | 198 | bgColor = c; |
197 | } | 199 | } |
198 | 200 | ||
201 | void setColNumber( int ); | ||
202 | |||
199 | void drawBackground( QPainter *p, const QRect &r ); | 203 | void drawBackground( QPainter *p, const QRect &r ); |
200 | void setItemTextPos( ItemTextPos pos ); | 204 | void setItemTextPos( ItemTextPos pos ); |
201 | void hideOrShowItems(bool resort); | 205 | void hideOrShowItems(bool resort); |
202 | 206 | ||
203 | void setTypeFilter(const QString& typefilter, bool resort); | 207 | void setTypeFilter(const QString& typefilter, bool resort); |
204 | void setCategoryFilter( int catfilter, bool resort ); | 208 | void setCategoryFilter( int catfilter, bool resort ); |
205 | 209 | ||
206 | enum SortMethod { Name, Date, Type }; | 210 | enum SortMethod { Name, Date, Type }; |
207 | 211 | ||
208 | void setSortMethod( SortMethod m ); | 212 | void setSortMethod( SortMethod m ); |
209 | int compare(const AppLnk* a, const AppLnk* b); | 213 | int compare(const AppLnk* a, const AppLnk* b); |
210 | void requestEyePix(const LauncherItem*which); | 214 | void requestEyePix(const LauncherItem*which); |
211 | 215 | ||
212 | static QMap<QString,QPixmap>* sm_EyeCache; | 216 | static QMap<QString,QPixmap>* sm_EyeCache; |
213 | 217 | ||
214 | protected: | 218 | protected: |
215 | virtual void timerEvent( QTimerEvent *te ); | 219 | virtual void timerEvent( QTimerEvent *te ); |
216 | void styleChange( QStyle &old ); | 220 | void styleChange( QStyle &old ); |
217 | void calculateGrid( ItemTextPos pos ); | 221 | void calculateGrid( ItemTextPos pos ); |
218 | void focusInEvent( QFocusEvent * ) {} | 222 | void focusInEvent( QFocusEvent * ) {} |
219 | void focusOutEvent( QFocusEvent * ) {} | 223 | void focusOutEvent( QFocusEvent * ) {} |
220 | LauncherItem*findDocItem(const QString&); | 224 | LauncherItem*findDocItem(const QString&); |
221 | void addCheckItem(AppLnk* app); | 225 | void addCheckItem(AppLnk* app); |
222 | void checkCallback(); | 226 | void checkCallback(); |
223 | virtual void keyPressEvent(QKeyEvent* e); | 227 | virtual void keyPressEvent(QKeyEvent* e); |
224 | 228 | ||
225 | protected slots: | 229 | protected slots: |
226 | void setEyePixmap(const QPixmap&,const QString&,int width); | 230 | void setEyePixmap(const QPixmap&,const QString&,int width); |
227 | void stopEyeTimer(); | 231 | void stopEyeTimer(); |
228 | 232 | ||
229 | private: | 233 | private: |
230 | QList<AppLnk> hidden; | 234 | QList<AppLnk> hidden; |
231 | QDict<void> mimes; | 235 | QDict<void> mimes; |
232 | QDict<void> cats; | 236 | QDict<void> cats; |
233 | SortMethod sortmeth; | 237 | SortMethod sortmeth; |
234 | QRegExp tf; | 238 | QRegExp tf; |
235 | int cf; | 239 | int cf; |
236 | LauncherItem* bsy; | 240 | LauncherItem* bsy; |
237 | int busyTimer; | 241 | int busyTimer; |
238 | bool ike; | 242 | bool ike; |
239 | bool bigIcns; | 243 | bool bigIcns; |
240 | QPixmap bgPixmap; | 244 | QPixmap bgPixmap; |
241 | QColor bgColor; | 245 | QColor bgColor; |
242 | LauncherThumbReceiver*m_EyeCallBack; | 246 | LauncherThumbReceiver*m_EyeCallBack; |
243 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 247 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
244 | QPixmap busyPix; | 248 | QPixmap busyPix; |
245 | #endif | 249 | #endif |
246 | BusyIndicatorType busyType; | 250 | BusyIndicatorType busyType; |
247 | QTimer m_eyeTimer; | 251 | QTimer m_eyeTimer; |
252 | int numColumns; | ||
248 | }; | 253 | }; |
249 | 254 | ||
250 | #endif // LAUNCHERVIEW_H | 255 | #endif // LAUNCHERVIEW_H |