author | mickeyl <mickeyl> | 2005-01-10 23:47:36 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-10 23:47:36 (UTC) |
commit | 32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e (patch) (side-by-side diff) | |
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
@@ -4,2 +4,3 @@ ------------ + * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) 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 @@ -291,2 +291,3 @@ void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) + v->setColNumber( cfg.readNumEntry( "Columns", 0 ) ); 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 @@ -24,2 +24,3 @@ #include <opie2/odebug.h> +#include <qpe/config.h> #include <qtopia/qpeapplication.h> @@ -284,3 +285,3 @@ 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) { @@ -627,18 +628,18 @@ void LauncherIconView::calculateGrid( ItemTextPos pos ) 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 ); @@ -1005,2 +1006,13 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) +void LauncherView::setColNumber( int num ) +{ + icons->setColNumber( num ); +} + +void LauncherIconView::setColNumber( int num ) +{ + numColumns = num; + calculateGrid( Bottom ); +} + void LauncherView::setTextColor( const QColor &tc ) 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 @@ -84,2 +84,4 @@ public: void clearViewFont(); + + void setColNumber( int ); @@ -198,2 +200,4 @@ public: + void setColNumber( int ); + void drawBackground( QPainter *p, const QRect &r ); @@ -247,2 +251,3 @@ private: QTimer m_eyeTimer; + int numColumns; }; |