author | drw <drw> | 2002-12-16 00:26:32 (UTC) |
---|---|---|
committer | drw <drw> | 2002-12-16 00:26:32 (UTC) |
commit | e4057ee7fe74c83e2dc44f8b9870f65da60fc4fa (patch) (side-by-side diff) | |
tree | 027cebbca343052e970c90e7eed3447e14b58e39 | |
parent | a6a23d1c30e395add577eec261ae728f8d783299 (diff) | |
download | opie-e4057ee7fe74c83e2dc44f8b9870f65da60fc4fa.zip opie-e4057ee7fe74c83e2dc44f8b9870f65da60fc4fa.tar.gz opie-e4057ee7fe74c83e2dc44f8b9870f65da60fc4fa.tar.bz2 |
QWhatsThis added
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 159 | ||||
-rw-r--r-- | noncore/settings/appearance2/editScheme.cpp | 9 |
2 files changed, 108 insertions, 60 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index f611799..2f3ba74 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp @@ -3,3 +3,3 @@ Copyright (c) 2002 Trolltech AS <info@trolltech.com> - =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> + =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> @@ -19,3 +19,3 @@ ..}^=.= = ; Public License for more details. -++= -. .` .: +++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU @@ -49,2 +49,3 @@ #include <qvbox.h> +#include <qwhatsthis.h> @@ -54,2 +55,3 @@ #include <qpe/qpeapplication.h> +#include <qpe/qpemessagebox.h> #include <qpe/qcopenvelope_qws.h> @@ -117,2 +119,3 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) 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." ) ); @@ -121,5 +124,6 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) 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" ); - + @@ -133,3 +137,4 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) { - QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; + QString path = QPEApplication::qpeDir ( ); + path.append( "/plugins/styles/" ); QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); @@ -137,3 +142,6 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { - QLibrary *lib = new QLibrary ( path + "/" + *it ); + QString libstr = path; + libstr.append( "/" ); + libstr.append( *it ); + QLibrary *lib = new QLibrary ( libstr ); StyleInterface *iface; @@ -143,3 +151,3 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) m_style_list-> insertItem ( slit ); - + if ( slit-> key ( ) == s ) @@ -167,2 +175,3 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) 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." ) ); @@ -173,3 +182,4 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) { - QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; + QString path = QPEApplication::qpeDir(); + path.append( "/plugins/decorations/" ); QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); @@ -177,3 +187,6 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { - QLibrary *lib = new QLibrary ( path + "/" + *it ); + QString libstr = path; + libstr.append( "/" ); + libstr.append( *it ); + QLibrary *lib = new QLibrary ( libstr ); WindowDecorationInterface *iface; @@ -181,5 +194,5 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) { - DecoListItem *dlit = new DecoListItem ( lib, iface ); + DecoListItem *dlit = new DecoListItem ( lib, iface ); m_deco_list-> insertItem ( dlit ); - + if ( dlit-> key ( ) == s ) @@ -208,5 +221,6 @@ QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) - m_fontselect = new OFontSelector ( false, parent, "FontTab" ); + 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 & )), @@ -214,3 +228,3 @@ QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) - return m_fontselect; + return m_fontselect; } @@ -226,2 +240,3 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); + QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); @@ -229,13 +244,16 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) - QString path = QPEApplication::qpeDir ( ) + "/etc/colors/"; + QString path = QPEApplication::qpeDir ( ); + path.append( "/etc/colors/" ); QStringList sl = QDir ( path ). entryList ( "*.scheme" ); - + for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { QString name = (*it). left ((*it). find ( ".scheme" )); - Config config ( path + *it, Config::File ); + QString pathstr = path; + pathstr.append( *it ); + Config config ( pathstr, Config::File ); config. setGroup ( "Colors" ); - + m_color_list-> insertItem ( new ColorListItem ( name, config )); } - + m_color_list-> setCurrentItem ( 0 ); @@ -246,2 +264,3 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) gridLayout->addWidget( tempButton, 0, 1 ); + QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); @@ -251,2 +270,3 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) gridLayout->addWidget( tempButton, 1, 1 ); + QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); @@ -256,2 +276,3 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) gridLayout->addWidget( tempButton, 2, 1 ); + QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); @@ -269,3 +290,4 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); - lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); + lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); + QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); @@ -274,3 +296,4 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); - + QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); + m_except = new QListView ( tab ); @@ -287,8 +310,9 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) m_except-> header ( )-> setResizeEnabled ( false ); - m_except-> header ( )-> setMovingEnabled ( false ); + m_except-> header ( )-> setMovingEnabled ( false ); m_except-> setSorting ( -1 ); lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); - + QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); + connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); - + QToolButton *tb = new QToolButton ( tab ); @@ -296,4 +320,5 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) tb-> setFocusPolicy ( QWidget::StrongFocus ); - lay-> addWidget ( tb, 2, 1 ); + lay-> addWidget ( tb, 2, 1 ); connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); + QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); @@ -302,5 +327,6 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) tb-> setFocusPolicy ( QWidget::StrongFocus ); - lay-> addWidget ( tb, 3, 1 ); + lay-> addWidget ( tb, 3, 1 ); connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); - + QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); + tb = new QToolButton ( tab ); @@ -308,5 +334,6 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) tb-> setFocusPolicy ( QWidget::StrongFocus ); - lay-> addWidget ( tb, 4, 1 ); + lay-> addWidget ( tb, 4, 1 ); connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); - + QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); + tb = new QToolButton ( tab ); @@ -314,5 +341,6 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) tb-> setFocusPolicy ( QWidget::StrongFocus ); - lay-> addWidget ( tb, 5, 1 ); + lay-> addWidget ( tb, 5, 1 ); connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); - + QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); + lay-> setRowStretch ( 6, 10 ); @@ -324,3 +352,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); - + lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); @@ -329,9 +357,9 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) - vertLayout-> addSpacing ( 3 ); + vertLayout-> addSpacing ( 3 ); QFrame *f = new QFrame ( tab ); f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); - vertLayout-> addWidget ( f ); - vertLayout-> addSpacing ( 3 ); - - + vertLayout-> addWidget ( f ); + vertLayout-> addSpacing ( 3 ); + + QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); @@ -343,2 +371,4 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 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" ); @@ -354,2 +384,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 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" ) ); @@ -358,3 +389,4 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 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" ); @@ -362,2 +394,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 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." ) ); @@ -374,3 +407,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) Appearance::Appearance( QWidget* parent, const char* name, WFlags ) - : QDialog ( parent, name, true ) + : QDialog ( parent, name, true, WStyle_ContextHelp ) { @@ -385,6 +418,7 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 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; - + tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style.png", tr( "Style" )); @@ -395,3 +429,3 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) - top-> addWidget ( tw, 10 ); + top-> addWidget ( tw, 10 ); top-> addWidget ( m_sample, 1 ); @@ -400,3 +434,3 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); - + m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; @@ -426,3 +460,3 @@ void Appearance::accept ( ) - if ( m_style_changed ) { + if ( m_style_changed ) { StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); @@ -431,4 +465,4 @@ void Appearance::accept ( ) } - - if ( m_deco_changed ) { + + if ( m_deco_changed ) { DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); @@ -436,3 +470,3 @@ void Appearance::accept ( ) config.writeEntry( "Decoration", item-> key ( )); - } + } @@ -453,4 +487,4 @@ void Appearance::accept ( ) ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); - - if ( item ) + + if ( item ) item-> save ( config ); @@ -462,2 +496,3 @@ void Appearance::accept ( ) QStringList sl; + QString exceptstr; for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { @@ -467,3 +502,5 @@ void Appearance::accept ( ) fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); - sl << ( QString::number ( fl, 32 ) + it-> pattern ( )); + exceptstr = QString::number ( fl, 32 ); + exceptstr.append( it-> pattern ( )); + sl << exceptstr; } @@ -471,3 +508,3 @@ void Appearance::accept ( ) config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); - + config. write ( ); // need to flush the config info first @@ -478,3 +515,3 @@ void Appearance::accept ( ) } - + QDialog::accept ( ); @@ -493,6 +530,6 @@ void Appearance::styleClicked ( int index ) m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); - + if ( m_sample && sli && sli-> style ( )) m_sample-> setStyle2 ( sli-> style ( )); - + m_style_changed |= ( index != m_original_style ); @@ -612,3 +649,7 @@ void Appearance::saveSchemeClicked() QString schemename = ed-> text ( ); - QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" ); + QString filestr = QPEApplication::qpeDir(); + filestr.append( "/etc/colors/" ); + filestr.append( schemename ); + filestr.append( ".scheme" ); + QFile file ( filestr ); if ( !file. exists ( )) @@ -643,5 +684,9 @@ void Appearance::deleteSchemeClicked() { - if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?", - tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { - QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" ); + if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) + { + QString filestr = QPEApplication::qpeDir ( ); + filestr.append( "/etc/colors/" ); + filestr.append( item-> text ( ) ); + filestr.append( ".scheme" ); + QFile::remove ( filestr ); delete item; diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp index eefeccc..7e5225f 100644 --- a/noncore/settings/appearance2/editScheme.cpp +++ b/noncore/settings/appearance2/editScheme.cpp @@ -18,3 +18,3 @@ ..}^=.= = ; Public License for more details. -++= -. .` .: +++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU @@ -38,5 +38,6 @@ #include <qtoolbutton.h> +#include <qwhatsthis.h> -EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog ( parent, name, modal, fl ) +EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags ) + : QDialog ( parent, name, modal, WStyle_ContextHelp ) { @@ -53,2 +54,3 @@ EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget layout-> addWidget ( l, i, 0 ); + QWhatsThis::add( l, tr( "Click here to select a color for: " ).arg( labels [i] ) ); @@ -56,2 +58,3 @@ EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget layout-> addWidget ( m_buttons [i], i, 1 ); + QWhatsThis::add( m_buttons [i], tr( "Click here to select a color for: " ).arg( labels [i] ) ); } |