-rw-r--r-- | core/settings/launcher/launchersettings.cpp | 2 | ||||
-rw-r--r-- | core/settings/launcher/menusettings.cpp | 4 | ||||
-rw-r--r-- | core/settings/launcher/tabconfig.h | 13 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 5 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 65 |
5 files changed, 73 insertions, 16 deletions
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp index c32d998..7b85602 100644 --- a/core/settings/launcher/launchersettings.cpp +++ b/core/settings/launcher/launchersettings.cpp @@ -15,49 +15,49 @@ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlayout.h> #include <qapplication.h> #include <opie/otabwidget.h> #include "launchersettings.h" #include "tabssettings.h" #include "menusettings.h" #include "taskbarsettings.h" -LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false ) +LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) { setCaption ( tr( "Launcher Settings" )); QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); OTabWidget *tw = new OTabWidget ( this, "otab" ); lay-> addWidget ( tw ); m_tabs = new TabsSettings ( tw ); m_taskbar = new TaskbarSettings ( tw ); m_menu = new MenuSettings ( tw ); tw-> addTab ( m_taskbar, "launchersettings/taskbartab.png", tr( "Taskbar" )); tw-> addTab ( m_menu, "launchersettings/menutab.png", tr( "O-Menu" )); tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); tw-> setCurrentTab ( m_taskbar ); } void LauncherSettings::accept ( ) { m_taskbar-> accept ( ); m_menu-> accept ( ); m_tabs-> accept ( ); diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp index 8d363fa..5a9fada 100644 --- a/core/settings/launcher/menusettings.cpp +++ b/core/settings/launcher/menusettings.cpp @@ -43,50 +43,50 @@ #include <qwhatsthis.h> #include <stdlib.h> MenuSettings::MenuSettings ( QWidget *parent, const char *name ) : QWidget ( parent, name ) { m_applets_changed = false; QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); lay-> addWidget ( l ); m_list = new QListView ( this ); m_list-> addColumn ( "foobar" ); m_list-> header ( )-> hide ( ); lay-> addWidget ( m_list ); m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); lay-> addWidget ( m_menutabs ); - QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the O-Menu." )); - QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher as menus in the O-Menu." )); + QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); + QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); init ( ); } void MenuSettings::init ( ) { Config cfg ( "StartMenu" ); cfg. setGroup ( "Applets" ); QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; QStringList list = QDir ( path, "lib*.so" ). entryList ( ); for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { QString name; QPixmap icon; MenuAppletInterface *iface = 0; QLibrary *lib = new QLibrary ( path + "/" + *it ); lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); if ( iface ) { QString lang = getenv( "LANG" ); diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index 8b6b103..eebfd36 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h @@ -27,27 +27,40 @@ #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; 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_text_color == tc. m_text_color ) && + ( 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 ); + } }; #endif diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 6288f5f..a90ba7d 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp @@ -17,48 +17,49 @@ ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/applnk.h> #include <qlayout.h> #include <qvbox.h> #include <qtabbar.h> #include <qiconview.h> #include <qapplication.h> #include <qlabel.h> #include <qradiobutton.h> #include <qbuttongroup.h> #include <qpushbutton.h> +#include <qwhatsthis.h> #include <opie/ofontselector.h> #include <opie/otabwidget.h> #include <opie/ocolorbutton.h> #include <opie/ofiledialog.h> #include "tabdialog.h" class SampleItem : public QIconViewItem { public: SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) { m_large = pix; m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); } void sizeChange ( ) { calcRect ( ); repaint ( ); } QPixmap *pixmap ( ) const @@ -241,84 +242,86 @@ 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 ), m_tc ( tc ) + : QDialog ( parent, name, modal, fl | WStyle_ContextHelp ), 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_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_bgimage = tc. m_bg_image; bgTypeClicked ( tc. m_bg_type ); m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); 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 ) { m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 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 ); diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index 6cc69c0..a5afaf2 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp @@ -26,162 +26,196 @@ */ #include "tabssettings.h" #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/applnk.h> #include <qpe/mimetype.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/config.h> #include <qlistbox.h> #include <qpushbutton.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> #include <qcheckbox.h> #include "tabdialog.h" #include <stdlib.h> #include <qmessagebox.h> +#define GLOBALID "_launchersettings_global_dummy_" + TabsSettings::TabsSettings ( QWidget *parent, const char *name ) : QWidget ( parent, name ) { QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); m_list = new QListBox ( this ); lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); QWhatsThis::add ( m_list, tr( "foobar" )); - QPushButton *p; - p = new QPushButton ( tr( "New" ), this ); - lay-> addWidget ( p, 1, 1 ); - connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); + QPushButton *p1, *p2, *p3; + p1 = new QPushButton ( tr( "New" ), this ); + lay-> addWidget ( p1, 1, 1 ); + connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); - p = new QPushButton ( tr( "Edit" ), this ); - lay-> addWidget ( p, 2, 1 ); - connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); + p2 = new QPushButton ( tr( "Edit" ), this ); + lay-> addWidget ( p2, 2, 1 ); + connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); - p = new QPushButton ( tr( "Delete" ), this ); - lay-> addWidget ( p, 3, 1 ); - connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); + p3 = new QPushButton ( tr( "Delete" ), this ); + lay-> addWidget ( p3, 3, 1 ); + connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); lay-> setRowStretch ( 4, 10 ); m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this ); lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 ); + p1-> setEnabled ( false ); + p3-> setEnabled ( false ); + init ( ); + + QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); + QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); + QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); + QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); + QWhatsThis::add ( m_busyblink, tr( "Activate this, if you want a blinking busy indicator for starting applications in the Launcher." )); } void TabsSettings::init ( ) { AppLnkSet rootFolder( MimeType::appsFolderName ( )); QStringList types = rootFolder. types ( ); + + m_list-> insertItem ( tr( "All Tabs" )); + m_ids << GLOBALID; for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); m_ids << *it; } QImage img ( Resource::loadImage ( "DocsIcon" )); QPixmap pix; pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); m_list-> insertItem ( pix, tr( "Documents" )); m_ids += "Documents"; // No tr Config cfg ( "Launcher" ); readTabSettings ( cfg ); cfg. setGroup ( "GUI" ); m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" ); } void TabsSettings::readTabSettings ( Config &cfg ) { QString grp ( "Tab %1" ); // No tr m_tabs. clear ( ); for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { TabConfig tc; tc. m_view = TabConfig::Icon; tc. m_bg_type = TabConfig::Ruled; tc. m_changed = false; cfg. setGroup ( grp. arg ( *it )); + if ( *it == GLOBALID ) + cfg. clearGroup ( ); QString view = cfg. readEntry ( "View", "Icon" ); if ( view == "List" ) // No tr tc. m_view = TabConfig::List; QString bgType = cfg. readEntry ( "BackgroundType", "Image" ); 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", "launcher/opie-background" ); tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); 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_weight = f [2]. toInt ( ); tc. m_font_italic = ( f [3]. toInt ( )); } else { tc. m_font_family = font ( ). family ( ); tc. m_font_size = font ( ). pointSize ( ); tc. m_font_weight = 50; tc. m_font_italic = false; } + 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] ); + } + if ( same ) + m_tabs [GLOBALID] = *first; } 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 ) + if ( !tc. m_changed || ( *it == GLOBALID )) continue; + + cfg. setGroup ( grp. arg ( *it )); 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 ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "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(""); @@ -225,28 +259,35 @@ void TabsSettings::deleteClicked ( ) { int ind = m_list-> currentItem ( ); if ( ind < 0 ) return; QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); } void TabsSettings::editClicked ( ) { int ind = m_list-> currentItem ( ); if ( ind < 0 ) return; TabConfig tc = m_tabs [m_ids [ind]]; TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); d-> showMaximized ( ); if ( d-> exec ( ) == QDialog::Accepted ) { tc. m_changed = true; m_tabs [m_ids [ind]] = tc; + + if ( m_ids [ind] == GLOBALID ) { + for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { + if ( *it != GLOBALID ) + m_tabs [*it] = tc; + } + } } delete d; } |