summaryrefslogtreecommitdiff
path: root/noncore/settings/appearance2/appearance.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/appearance2/appearance.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index c376ec7..00128d3 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -39,188 +39,188 @@
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#if QT_VERSION >= 300
#include <qstylefactory.h>
#endif
#include <qtoolbutton.h>
#include <qwindowsstyle.h>
#include <qlistview.h>
#include <qheader.h>
#include <qvbox.h>
#include <qwhatsthis.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemessagebox.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpestyle.h>
#include <qpe/lightstyle.h>
#include <qpe/qlibrary.h>
#include <qpe/styleinterface.h>
#include <opie/ofontselector.h>
#include <opie/odevice.h>
#include <opie/ofiledialog.h>
#include <opie/otabwidget.h>
#include "appearance.h"
#include "editScheme.h"
#include "stylelistitem.h"
#include "decolistitem.h"
#include "colorlistitem.h"
#include "exceptlistitem.h"
#include "sample.h"
using namespace Opie;
class DefaultWindowDecoration : public WindowDecorationInterface
{
public:
DefaultWindowDecoration() : ref(0) {}
QString name() const {
return "Default";
}
- QPixmap icon() const {
+QPixmap icon() const {
return QPixmap();
}
QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = this;
else if ( uuid == IID_WindowDecoration )
*iface = this;
if ( *iface )
(*iface)->addRef();
return QS_OK;
}
Q_REFCOUNT
private:
ulong ref;
};
QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
{
QWidget* tab = new QWidget( parent, "StyleTab" );
QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
m_style_list = new QListBox( tab, "m_style_list" );
vertLayout->addWidget( m_style_list );
QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) );
m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
vertLayout-> addWidget ( m_style_settings );
QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
QString s = cfg. readEntry ( "Style", "Light" );
#if QT_VERSION >= 300
m_style_list->insertStringList(QStyleFactory::styles());
#else
m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
#endif
{
QString path = QPEApplication::qpeDir ( );
path.append( "/plugins/styles/" );
QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
QString libstr = path;
libstr.append( "/" );
libstr.append( *it );
QLibrary *lib = new QLibrary ( libstr );
StyleInterface *iface;
if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) {
StyleListItem *slit = new StyleListItem ( lib, iface );
m_style_list-> insertItem ( slit );
if ( slit-> key ( ) == s )
m_style_list-> setCurrentItem ( slit );
}
else
delete lib;
}
}
m_original_style = m_style_list-> currentItem ( );
styleClicked ( m_original_style );
connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
return tab;
}
QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
{
QWidget* tab = new QWidget( parent, "DecoTab" );
QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
m_deco_list = new QListBox( tab, "m_deco_list" );
vertLayout->addWidget( m_deco_list );
QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) );
- QString s = cfg. readEntry ( "Decoration" );
+ QString s = cfg. readEntry ( "Decoration", "libflat.so" );
m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
{
QString path = QPEApplication::qpeDir();
path.append( "/plugins/decorations/" );
QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
QString libstr = path;
libstr.append( "/" );
libstr.append( *it );
QLibrary *lib = new QLibrary ( libstr );
WindowDecorationInterface *iface;
if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) {
DecoListItem *dlit = new DecoListItem ( lib, iface );
m_deco_list-> insertItem ( dlit );
if ( dlit-> key ( ) == s )
m_deco_list-> setCurrentItem ( dlit );
}
else
delete lib;
}
}
m_original_deco = m_deco_list-> currentItem ( );
if ( m_deco_list-> currentItem ( ) < 0 )
m_deco_list-> setCurrentItem ( 0 );
decoClicked ( m_original_deco );
connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) );
return tab;
}
QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
{
QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
int size = cfg. readNumEntry ( "FontSize", 10 );
m_fontselect = new OFontSelector ( false, parent, "FontTab" );
m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
@@ -357,152 +357,153 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
vertLayout-> addSpacing ( 3 );
QFrame *f = new QFrame ( tab );
f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
vertLayout-> addWidget ( f );
vertLayout-> addSpacing ( 3 );
QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
QLabel* label = new QLabel( tr( "Tab style:" ), tab );
gridLayout-> addWidget ( label, 0, 0 );
QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
btngrp-> hide ( );
btngrp-> setExclusive ( true );
m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
m_tabstyle_list-> insertItem ( tr( "Tabs" ));
m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
m_tabstyle_list-> setCurrentItem ( style );
gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
btngrp-> insert ( m_tabstyle_top );
gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
btngrp-> insert ( m_tabstyle_bottom );
gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
m_tabstyle_top-> setChecked ( tabtop );
m_tabstyle_bottom-> setChecked ( !tabtop );
m_original_tabstyle = style;
m_original_tabpos = tabtop;
vertLayout-> addSpacing ( 3 );
QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
-
+
QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
QPixmap ccw1;
m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
rotbtngrp-> hide ( );
rotbtngrp-> setExclusive ( true );
rotbtngrp-> insert ( m_rotdir_cw );
rotbtngrp-> insert ( m_rotdir_ccw );
rotbtngrp-> insert ( m_rotdir_flip );
ccw1. convertFromImage( ccwImage );
m_rotdir_cw-> setPixmap( cw1 );
- m_rotdir_ccw-> setPixmap( ccw1 );
- m_rotdir_flip-> setPixmap( flip1 );
+ m_rotdir_ccw-> setPixmap( ccw1 );
+ m_rotdir_flip-> setPixmap( flip1 );
rotLay-> addWidget ( rotlabel, 0 );
rotLay-> addWidget ( m_rotdir_cw, 0 );
rotLay-> addWidget ( m_rotdir_ccw, 0 );
rotLay-> addWidget ( m_rotdir_flip, 0 );
int rotDirection = cfg.readNumEntry( "rotatedir" );
ODirection rot = CW;
if (rotDirection == -1) {
rot = ODevice::inst ( )-> direction ( );
} else {
rot = (ODirection)rotDirection;
}
m_rotdir_cw-> setChecked ( rot == CW );
m_rotdir_ccw-> setChecked ( rot == CCW );
m_rotdir_flip-> setChecked ( rot == Flip );
return tab;
}
Appearance::Appearance( QWidget* parent, const char* name, WFlags )
: QDialog ( parent, name, true, WStyle_ContextHelp )
{
setCaption( tr( "Appearance Settings" ) );
Config config( "qpe" );
config.setGroup( "Appearance" );
QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
m_sample = new SampleWindow ( this );
- m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
+
+ m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
QWidget *styletab;
m_color_list = 0;
tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
top-> addWidget ( tw, 10 );
top-> addWidget ( m_sample, 1 );
tw-> setCurrentTab ( styletab );
connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
}
Appearance::~Appearance()
{
}
void Appearance::tabChanged ( QWidget *w )
{
if ( w == m_advtab ) {
m_sample-> hide ( );
updateGeometry ( ); // shouldn't be necessary ...
}
else
m_sample-> show ( );
}
void Appearance::accept ( )
{
bool newtabpos = m_tabstyle_top-> isChecked ( );
int newtabstyle = m_tabstyle_list-> currentItem ( );
Config config ( "qpe" );
config. setGroup ( "Appearance" );
if ( m_style_changed ) {
StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
if ( item )
config.writeEntry( "Style", item-> key ( ));