-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,16 +1,17 @@ 2005-??-?? Opie 1.2.0 New Features ------------ + * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) Fixed Bugs ---------- * #1501 - Fixed bug in todo sql backend (eilers) * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) Internal -------- * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 2004-11-26 Opie 1.1.8 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 @@ -280,24 +280,25 @@ void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) QString c = cfg.readEntry( "BackgroundColor" ); v->setBackgroundType( LauncherView::SolidColor, c ); } else { v->setBackgroundType( LauncherView::Ruled, QString::null ); } QString textCol = cfg.readEntry( "TextColor" ); if ( textCol.isEmpty() ) v->setTextColor( QColor() ); else v->setTextColor( QColor(textCol) ); // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); + v->setColNumber( cfg.readNumEntry( "Columns", 0 ) ); QStringList font = cfg.readListEntry( "Font", ',' ); if ( font.count() == 4 ) v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); // ### FIXME TabColor TabTextColor } // ### Could move to LauncherTab void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) { 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 @@ -13,24 +13,25 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "launcherview.h" /* OPIE */ #include <opie2/odebug.h> +#include <qpe/config.h> #include <qtopia/qpeapplication.h> #include <qtopia/private/categories.h> #include <qtopia/categoryselect.h> #include <qtopia/mimetype.h> #include <qtopia/resource.h> using namespace Opie::Core; #include <qpe/qcopenvelope_qws.h> /* QT */ #include <qtimer.h> #include <qfileinfo.h> @@ -273,25 +274,25 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon) if (!isEyeImage()) return; setPixmap(aIcon); m_EyeImageSet = EYE_ICON; } //=========================================================================== // Implemantation of LauncherIconview start //=========================================================================== QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) - : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white) + : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white),numColumns(0) { m_EyeCallBack = 0; if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); sortmeth = Name; hidden.setAutoDelete(TRUE); ike = FALSE; calculateGrid( Bottom ); connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); } LauncherIconView::~LauncherIconView() { @@ -616,40 +617,40 @@ void LauncherIconView::setBigIcons( bool bi ) QIconViewItem* LauncherIconView::busyItem() const { return bsy; } void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } void LauncherIconView::calculateGrid( ItemTextPos pos ) { int dw = QApplication::desktop()->width(); int viewerWidth = dw-style().scrollBarExtent().width(); if ( pos == Bottom ) { - int cols = 3; - if ( viewerWidth <= 200 ) - cols = 2; - else if ( viewerWidth >= 400 ) - cols = viewerWidth/96; + if( !numColumns ) { + if ( viewerWidth <= 200 ) numColumns = 2; + else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96; + else numColumns = 3; + } setSpacing( 4 ); - setGridX( (viewerWidth-(cols+1)*spacing())/cols ); + setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); setGridY( fontMetrics().height()*2+24 ); } else { - int cols = 2; - if ( viewerWidth < 150 ) - cols = 1; - else if ( viewerWidth >= 400 ) - cols = viewerWidth/150; + if( !numColumns ) { + if ( viewerWidth < 150 ) numColumns = 1; + else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150; + else numColumns = 2; + } setSpacing( 2 ); - setGridX( (viewerWidth-(cols+1)*spacing())/cols ); + setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); setGridY( fontMetrics().height()+2 ); } } void LauncherIconView::styleChange( QStyle &old ) { QIconView::styleChange( old ); calculateGrid( itemTextPos() ); } void LauncherIconView::keyPressEvent(QKeyEvent* e) { @@ -994,24 +995,35 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) w->setBackgroundOrigin( ParentOrigin ); } } } delete list; bgType = t; icons->viewport()->update(); QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); } +void LauncherView::setColNumber( int num ) +{ + icons->setColNumber( num ); +} + +void LauncherIconView::setColNumber( int num ) +{ + numColumns = num; + calculateGrid( Bottom ); +} + void LauncherView::setTextColor( const QColor &tc ) { textCol = tc; QColorGroup cg = icons->colorGroup(); cg.setColor( QColorGroup::Text, tc ); icons->setPalette( QPalette(cg,cg,cg) ); icons->viewport()->update(); } void LauncherView::setViewFont( const QFont &f ) { icons->setFont( f ); 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 @@ -73,24 +73,26 @@ public: void setViewMode( ViewMode m ); ViewMode viewMode() const { return vmode; } enum BackgroundType { Ruled, SolidColor, Image }; void setBackgroundType( BackgroundType t, const QString & ); BackgroundType backgroundType() const { return bgType; } void setTextColor( const QColor & ); QColor textColor() const { return textCol; } void setViewFont( const QFont & ); void clearViewFont(); + + void setColNumber( int ); void relayout(void); signals: void clicked( const AppLnk * ); void rightPressed( AppLnk * ); protected slots: void selectionChanged(); void returnPressed( QIconViewItem *item ); void itemClicked( int, QIconViewItem * ); void itemPressed( int, QIconViewItem * ); @@ -187,24 +189,26 @@ public: void addCatsAndMimes(AppLnk* app); void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} void setBackgroundPixmap( const QPixmap &pm ) { bgPixmap = pm; } void setBackgroundColor( const QColor &c ) { bgColor = c; } + void setColNumber( int ); + void drawBackground( QPainter *p, const QRect &r ); void setItemTextPos( ItemTextPos pos ); void hideOrShowItems(bool resort); void setTypeFilter(const QString& typefilter, bool resort); void setCategoryFilter( int catfilter, bool resort ); enum SortMethod { Name, Date, Type }; void setSortMethod( SortMethod m ); int compare(const AppLnk* a, const AppLnk* b); void requestEyePix(const LauncherItem*which); @@ -236,15 +240,16 @@ private: LauncherItem* bsy; int busyTimer; bool ike; bool bigIcns; QPixmap bgPixmap; QColor bgColor; LauncherThumbReceiver*m_EyeCallBack; #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY QPixmap busyPix; #endif BusyIndicatorType busyType; QTimer m_eyeTimer; + int numColumns; }; #endif // LAUNCHERVIEW_H |