summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-01-11 17:32:06 (UTC)
committer mickeyl <mickeyl>2005-01-11 17:32:06 (UTC)
commitf8fd8556da5649f54af740a5dbb9a8c1ead2bcfc (patch) (side-by-side diff)
treedb41b30ad733fc476746e1a9c7576a5a083240fa
parentf82173157bdba4fa99afde9cc999bfe9b511ce07 (diff)
downloadopie-f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc.zip
opie-f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc.tar.gz
opie-f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc.tar.bz2
finish per-tab column setting. it now works on the fly and is persistent
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp7
-rw-r--r--core/launcher/launcherview.cpp2
-rw-r--r--core/settings/launcher/tabconfig.h1
-rw-r--r--core/settings/launcher/tabdialog.cpp1
-rw-r--r--core/settings/launcher/tabssettings.cpp6
5 files changed, 15 insertions, 2 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 4f81076..4255b44 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -394,48 +394,55 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &
int mode;
stream >> mode;
if ( view(id) )
view(id)->setViewMode( (LauncherView::ViewMode)mode );
} else if ( msg == "setTabBackground(QString,int,QString)" ) {
QString id;
stream >> id;
int mode;
stream >> mode;
QString pixmapOrColor;
stream >> pixmapOrColor;
if ( view(id) )
view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
if ( id == "Documents" )
docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
} else if ( msg == "setTextColor(QString,QString)" ) {
QString id;
stream >> id;
QString color;
stream >> color;
if ( view(id) )
view(id)->setTextColor( QColor(color) );
if ( id == "Documents" )
docLoadingWidget->setTextColor( QColor(color) );
+ } else if ( msg == "setIconColumns(QString,int)" ) {
+ QString id;
+ stream >> id;
+ int number;
+ stream >> number;
+ if ( view(id ) )
+ view(id)->setColNumber( number );
} else if ( msg == "setFont(QString,QString,int,int,int)" ) {
QString id;
stream >> id;
QString fam;
stream >> fam;
int size;
stream >> size;
int weight;
stream >> weight;
int italic;
stream >> italic;
if ( view(id) ) {
if ( !fam.isEmpty() ) {
view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
} else {
view(id)->clearViewFont();
}
}
}else if ( msg == "setBusyIndicatorType(QString)" ) {
QString type;
stream >> type;
setBusyIndicatorType( type );
}else if ( msg == "home()" ) {
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 9d78c0d..2b34cc5 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -618,49 +618,49 @@ 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 ) {
if( !numColumns ) {
if ( viewerWidth <= 200 ) numColumns = 2;
else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96;
else numColumns = 3;
}
setSpacing( 4 );
setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns );
setGridY( fontMetrics().height()*2+24 );
} else {
if( !numColumns ) {
if ( viewerWidth < 150 ) numColumns = 1;
else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150;
else numColumns = 2;
- }
+ }
setSpacing( 2 );
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)
{
ike = TRUE;
if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
if ( (e->state() & ShiftButton) )
emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() );
else
returnPressed(currentItem());
}
QIconView::keyPressEvent(e);
ike = FALSE;
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index 7844673..9ea2418 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -37,37 +37,38 @@ struct TabConfig {
SolidColor,
Image
};
ViewMode m_view;
BackgroundType m_bg_type;
QString m_last_directory;
QString m_bg_image;
QString m_bg_color;
int m_iconcolumns;
QString m_text_color;
bool m_font_use;
QString m_font_family;
int m_font_size;
int m_font_weight;
bool m_font_italic;
bool m_changed;
bool operator == ( const TabConfig &tc )
{
return ( m_view == tc. m_view ) &&
( m_bg_type == tc. m_bg_type ) &&
( m_bg_image == tc. m_bg_image ) &&
( m_bg_color == tc. m_bg_color ) &&
+ ( m_iconcolumns == tc. m_iconcolumns ) &&
( m_text_color == tc. m_text_color ) &&
( m_font_use == tc. m_font_use ) &&
( m_font_use ? (
( m_font_family == tc. m_font_family ) &&
( m_font_size == tc. m_font_size ) &&
( m_font_weight == tc. m_font_weight ) &&
( m_font_italic == tc. m_font_italic )
) : true );
}
};
#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index abe310f..bd51628 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -284,48 +284,49 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig
tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" ));
tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" ));
tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) );
tw-> setCurrentTab ( bgtab );
QWidget *sample = new QVBox ( this );
QTabBar *tb = new QTabBar ( sample );
QString name ( tr( "Previewing %1" ). arg ( tabname ));
tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
m_sample = new SampleView ( sample );
lay-> addWidget ( tw, 10 );
lay-> addWidget ( sample, 1 );
m_iconsize-> setButton ( tc. m_view );
iconSizeClicked ( tc. m_view );
//m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
iconColorClicked ( m_iconcolor-> color ( ));
m_bgtype-> setButton ( tc. m_bg_type );
//m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
+ m_iconcolumns->setValue( tc. m_iconcolumns );
m_bgimage = tc. m_bg_image;
bgTypeClicked ( tc. m_bg_type );
m_fontuse-> setChecked ( tc. m_font_use );
m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic ));
m_fontselect-> setEnabled ( m_fontuse-> isChecked ( ));
fontClicked ( m_fontselect-> selectedFont ( ));
QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
}
TabDialog::~TabDialog ( )
{
}
QWidget *TabDialog::createFontTab ( QWidget *parent )
{
QWidget *tab = new QWidget ( parent, "FontTab" );
QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab );
vertLayout-> addWidget ( m_fontuse );
m_fontselect = new OFontSelector ( false, tab, "fontsel" );
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index ab64331..42f0568 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -149,48 +149,49 @@ void TabsSettings::readTabSettings ( Config &cfg )
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def;
cfg. setGroup ( grp. arg ( *it ));
cfg2. setGroup( grp. arg ( *it ));
QString view = cfg. readEntry ( "View" );
if ( view == "Icon" ) // No tr
tc. m_view = TabConfig::Icon;
if ( view == "List" ) // No tr
tc. m_view = TabConfig::List;
QString bgType = cfg. readEntry ( "BackgroundType" );
if ( bgType == "Image" )
tc. m_bg_type = TabConfig::Image;
else if ( bgType == "SolidColor" )
tc. m_bg_type = TabConfig::SolidColor;
else if ( bgType == "Image" ) // No tr
tc. m_bg_type = TabConfig::Image;
tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image );
tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" );
tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color );
tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns );
+ qDebug( "m_iconcolumns for %s = %d", (const char*) *it, tc.m_iconcolumns );
tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color );
QStringList f = cfg. readListEntry ( "Font", ',' );
if ( f. count ( ) == 4 ) {
tc. m_font_use = true;
tc. m_font_family = f [0];
tc. m_font_size = f [1]. toInt ( );
tc. m_font_weight = f [2]. toInt ( );
tc. m_font_italic = ( f [3]. toInt ( ));
}
m_tabs [*it] = tc;
}
// if all tabs have the same config, then initialize the GLOBALID tab to these values
TabConfig *first = 0;
bool same = true;
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
if ( *it == GLOBALID )
continue;
else if ( !first )
first = &m_tabs [*it];
else
same &= ( *first == m_tabs [*it] );
@@ -242,49 +243,52 @@ void TabsSettings::accept ( )
}
else
cfg. removeEntry ( "Font" );
QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
switch ( tc. m_bg_type ) {
case TabConfig::Ruled:
cfg.writeEntry( "BackgroundType", "Ruled" );
be << *it << tc. m_bg_type << QString("");
break;
case TabConfig::SolidColor:
cfg.writeEntry( "BackgroundType", "SolidColor" );
be << *it << tc. m_bg_type << tc. m_bg_color;
break;
case TabConfig::Image:
cfg.writeEntry( "BackgroundType", "Image" );
be << *it << tc. m_bg_type << tc. m_bg_image;
break;
}
QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
te << *it << tc. m_text_color;
- QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
+ QCopEnvelope ic( "QPE/Launcher", "setIconColumns(QString,int)" );
+ ic << *it << tc. m_iconcolumns;
+
+ QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
fe << *it;
fe << ( tc. m_font_use ? tc. m_font_family : QString::null );
fe << tc. m_font_size;
fe << tc. m_font_weight;
fe << ( tc. m_font_italic ? 1 : 0 );
tc. m_changed = false;
}
cfg. setGroup ( "GUI" );
QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" );
cfg. writeEntry ( "BusyType", busytype );
cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) );
{
QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
e << busytype;
}
}
void TabsSettings::newClicked ( )
{
QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
}