summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-25 23:11:05 (UTC)
committer sandman <sandman>2002-09-25 23:11:05 (UTC)
commit0c6ce9f1600bf1efb7736f87fd14dd8215db851f (patch) (side-by-side diff)
tree13d1367dc79a64d44ef83f57259e04a0be099f8c
parentbdbd20a9a0415e2284e21923ed03d4ca3f6615e8 (diff)
downloadopie-0c6ce9f1600bf1efb7736f87fd14dd8215db851f.zip
opie-0c6ce9f1600bf1efb7736f87fd14dd8215db851f.tar.gz
opie-0c6ce9f1600bf1efb7736f87fd14dd8215db851f.tar.bz2
load and save of tab settings works now -- bg image still missing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/tabconfig.h1
-rw-r--r--core/settings/launcher/tabdialog.cpp34
-rw-r--r--core/settings/launcher/tabdialog.h5
-rw-r--r--core/settings/launcher/tabssettings.cpp4
4 files changed, 32 insertions, 12 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index 52ae81f..8f21eb4 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -1,25 +1,26 @@
#ifndef __TABCONFIG_H__
#define __TABCONFIG_H__
struct TabConfig {
enum ViewMode {
Icon,
List
};
enum BackgroundType {
Ruled,
SolidColor,
Image
};
ViewMode m_view;
BackgroundType m_bg_type;
QString m_bg_image;
QString m_bg_color;
QString m_text_color;
QString m_font_family;
+ QString m_font_style;
int m_font_size;
bool m_changed;
};
#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index 7b01cc7..ca48e66 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -203,136 +203,136 @@ public:
{
m_bgcolor = c;
}
void drawBackground ( QPainter *p, const QRect &r )
{
if ( !m_bgpix. isNull ( )) {
p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ),
( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
}
else
p-> fillRect ( r, m_bgcolor );
}
private:
QColor m_textcolor;
QColor m_bgcolor;
QPixmap m_bgpix;
TabConfig::BackgroundType m_bgtype;
};
TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl )
- : QDialog ( parent, name, modal, fl )
+ : QDialog ( parent, name, modal, fl ), m_tc ( tc )
{
setCaption ( tr( "Edit Tab" ));
QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
QWidget *bgtab;
tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" ));
tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" ));
tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", 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_bgtype-> setButton ( tc. m_bg_type );
+ m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
+ bgTypeClicked ( tc. m_bg_type );
+ m_fontselect-> setSelectedFont ( tc. m_font_family, tc. m_font_style, tc. m_font_size );
+ fontClicked ( m_fontselect-> selectedFont ( ));
}
TabDialog::~TabDialog ( )
{
}
QWidget *TabDialog::createFontTab ( QWidget *parent )
{
- Config config ( "qpe" );
- config. setGroup ( "Appearance" );
-
- QString familyStr = config.readEntry( "FontFamily", "Helvetica" );
- QString styleStr = config.readEntry( "FontStyle", "Regular" );
- int size = config.readNumEntry( "FontSize", 10 );
-
m_fontselect = new OFontSelector ( parent, "FontTab" );
- m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
this, SLOT( fontClicked ( const QFont & )));
return m_fontselect;
}
QWidget *TabDialog::createBgTab ( QWidget *parent )
{
QWidget *tab = new QWidget( parent, "AdvancedTab" );
QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
QGridLayout* gridLayout = new QGridLayout ( vertLayout );
gridLayout-> setColStretch ( 1, 10 );
QLabel* label = new QLabel( tr( "Type:" ), tab );
gridLayout-> addWidget ( label, 0, 0 );
m_bgtype = new QButtonGroup( tab, "buttongroup" );
m_bgtype-> hide ( );
m_bgtype-> setExclusive ( true );
QRadioButton *rb;
rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
m_bgtype-> insert ( rb, TabConfig::Ruled );
gridLayout-> addWidget( rb, 0, 1 );
QHBoxLayout *hb = new QHBoxLayout ( );
hb-> setSpacing ( 4 );
rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
m_bgtype-> insert ( rb, TabConfig::SolidColor );
hb-> addWidget ( rb );
+ hb-> addSpacing ( 10 );
m_solidcolor = new OColorButton ( tab );
connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( colorClicked ( const QColor & )));
hb-> addWidget ( m_solidcolor );
- hb-> addStretch ( 10 );
gridLayout-> addLayout ( hb, 1, 1 );
rb = new QRadioButton( tr( "Image" ), tab, "image" );
m_bgtype-> insert ( rb, TabConfig::Image );
gridLayout-> addWidget( rb, 3, 1 );
- QPushButton *p;
+// QPushButton *p;
connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int )));
vertLayout-> addStretch ( 10 );
return tab;
}
QWidget *TabDialog::createIconTab ( QWidget *parent )
{
QWidget *tab = new QWidget( parent, "AdvancedTab" );
QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
QGridLayout* gridLayout = new QGridLayout ( vertLayout );
gridLayout-> setColStretch ( 1, 10 );
QLabel* label = new QLabel( tr( "Size:" ), tab );
gridLayout-> addWidget ( label, 0, 0 );
m_iconsize = new QButtonGroup( tab, "buttongroup" );
m_iconsize-> hide ( );
m_iconsize-> setExclusive ( true );
QRadioButton *rb;
rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
@@ -358,24 +358,36 @@ void TabDialog::iconSizeClicked ( int s )
void TabDialog::fontClicked ( const QFont &f )
{
m_sample-> setViewFont ( f );
}
void TabDialog::bgTypeClicked ( int t )
{
QString s;
m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
// m_imagebrowse-> setEnabled ( t == TabConfig::Image );
// m_imagedefault-> setEnabled ( t == TabConfig::Image );
if ( t == TabConfig::SolidColor )
s = m_solidcolor-> color ( ). name ( );
m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
}
void TabDialog::colorClicked ( const QColor &col )
{
m_sample-> setBackgroundType ( TabConfig::SolidColor, col. name ( ));
}
+
+void TabDialog::accept ( )
+{
+ m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( ));
+ m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( ));
+ m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
+ m_tc. m_font_family = m_fontselect-> fontFamily ( );
+ m_tc. m_font_size = m_fontselect-> fontSize ( );
+ m_tc. m_font_style = m_fontselect-> fontStyle ( );
+
+ QDialog::accept ( );
+}
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h
index d602573..e1935fd 100644
--- a/core/settings/launcher/tabdialog.h
+++ b/core/settings/launcher/tabdialog.h
@@ -1,40 +1,45 @@
#ifndef __TABDIALOG_H__
#define __TABDIALOG_H__
#include <qdialog.h>
#include "tabconfig.h"
class QButtonGroup;
class OFontSelector;
class SampleView;
class OColorButton;
class TabDialog : public QDialog {
Q_OBJECT
public:
TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 );
virtual ~TabDialog ( );
+public slots:
+ virtual void accept ( );
+
protected slots:
void iconSizeClicked ( int );
void fontClicked ( const QFont & );
void bgTypeClicked ( int );
void colorClicked ( const QColor & );
private:
QWidget *createBgTab ( QWidget *parent );
QWidget *createFontTab ( QWidget *parent );
QWidget *createIconTab ( QWidget *parent );
private:
SampleView *m_sample;
QButtonGroup *m_iconsize;
OFontSelector *m_fontselect;
OColorButton *m_solidcolor;
QButtonGroup *m_bgtype;
+
+ TabConfig &m_tc;
};
#endif \ No newline at end of file
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index fc2d2c9..ae78733 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -99,87 +99,89 @@ void TabsSettings::readTabSettings ( )
TabConfig tc;
tc. m_view = TabConfig::Icon;
tc. m_bg_type = TabConfig::Ruled;
tc. m_changed = false;
cfg. setGroup ( grp. arg ( *it ));
QString view = cfg. readEntry ( "View", "Icon" );
if ( view == "List" ) // No tr
tc. m_view = TabConfig::List;
QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" );
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", "wallpaper/opie" );
tc. m_bg_color = cfg. readEntry ( "BackgroundColor" );
tc. m_text_color = cfg. readEntry ( "TextColor" );
QStringList f = cfg. readListEntry ( "Font", ',' );
if ( f. count ( ) == 4 ) {
tc. m_font_family = f [0];
tc. m_font_size = f [1]. toInt ( );
+ tc. m_font_style = f [2];
} else {
tc. m_font_family = font ( ). family ( );
tc. m_font_size = font ( ). pointSize ( );
+ tc. m_font_style = "Regular";
}
m_tabs [*it] = tc;
}
}
void TabsSettings::accept ( )
{
Config cfg ( "Launcher" );
// Launcher Tab
QString grp ( "Tab %1" ); // No tr
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig &tc = m_tabs [*it];
cfg. setGroup ( grp. arg ( *it ));
if ( !tc. m_changed )
continue;
switch ( tc. m_view ) {
case TabConfig::Icon:
cfg.writeEntry ( "View", "Icon" );
break;
case TabConfig::List:
cfg.writeEntry ( "View", "List" );
break;
}
QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
e << *it << tc. m_view;
cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
cfg. writeEntry ( "TextColor", tc. m_text_color );
- QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + ",50,0";
+ QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + tc. m_font_style + ",0";
cfg. writeEntry ( "Font", f );
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)" );
fe << *it << tc. m_font_family;
fe << tc. m_font_size;