diff options
Diffstat (limited to 'parts/uimode')
-rw-r--r-- | parts/uimode/Makefile.am | 13 | ||||
-rw-r--r-- | parts/uimode/README.dox | 8 | ||||
-rw-r--r-- | parts/uimode/kdevuichooser.desktop | 87 | ||||
-rw-r--r-- | parts/uimode/uichooser.ui | 250 | ||||
-rw-r--r-- | parts/uimode/uichooser_part.cpp | 52 | ||||
-rw-r--r-- | parts/uimode/uichooser_part.h | 32 | ||||
-rw-r--r-- | parts/uimode/uichooser_widget.cpp | 153 | ||||
-rw-r--r-- | parts/uimode/uichooser_widget.h | 42 |
8 files changed, 637 insertions, 0 deletions
diff --git a/parts/uimode/Makefile.am b/parts/uimode/Makefile.am new file mode 100644 index 00000000..50fe5f5a --- /dev/null +++ b/parts/uimode/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevuichooser.la +libkdevuichooser_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevuichooser_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevuichooser_la_SOURCES = uichooser_part.cpp uichooser.ui uichooser_widget.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevuichooser.desktop + diff --git a/parts/uimode/README.dox b/parts/uimode/README.dox new file mode 100644 index 00000000..5836e21f --- /dev/null +++ b/parts/uimode/README.dox @@ -0,0 +1,8 @@ +/** \class UIChooserPart +Allows you to choose the KDevelop UImode (Graphical User Interface mode) + +\authors <a href="mailto:hoelzer AT physik.uni-wuerzburg.de">Matthias Hoelzer</a> + +\feature Allows you to choose the KDevelop UImode (Graphical User Interface mode) + +*/ diff --git a/parts/uimode/kdevuichooser.desktop b/parts/uimode/kdevuichooser.desktop new file mode 100644 index 00000000..20f8510d --- /dev/null +++ b/parts/uimode/kdevuichooser.desktop @@ -0,0 +1,87 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Provides a dialog for UI-mode selection. +Comment[ca]=Proporciona un diàleg per a la selecció del mode de la interfície d'usuari. +Comment[da]=Sørger for en dialog for valg af brugergrænsefladetilstand. +Comment[de]=Stellt einen Dialog für die Auswahl des Fenstermodus zur Verfügung. +Comment[el]=Προσφέρει ένα διάλογο για την επιλογή της λειτουργίας του περιβάλλοντος χρήστη. +Comment[en_GB]=Provides a dialogue for UI-mode selection. +Comment[es]=Proporciona un diálogo para la selección del modo de la interfaz de usuario. +Comment[et]=Pakub dialoogi kasutajaliidese režiimi valikuks. +Comment[eu]=UI-modu hautapenerako elkarrizketa-koadroa eskeintzen du. +Comment[fa]=محاورهای برای گزینش حالت UI فراهم میکند. +Comment[fr]=Fournit une boîte de dialogue pour la sélection du mode d'interface graphique. +Comment[gl]=Proporciona un diálogo para a selección do modo da interface de usuario +Comment[hi]=यूआई-मोड चयन के लिए एक संवाद प्रदान करता है. +Comment[hu]=Párbeszédablak a grafikus felület kiválasztásához +Comment[it]=Fornisce una maschera per scegliere la modalità UI. +Comment[ja]=UI モード選択のためのダイアログを提供します。 +Comment[ms]=Menyediakan dialok untuk pemilihan mod-UI. +Comment[nds]=Stellt en Dialoog för de Böversiedenutwahl praat. +Comment[ne]=UI-मोड चयनका लागि संवाद प्रदान गर्दछ +Comment[nl]=Biedt een dialoog voor het selecteren van een UI-modus. +Comment[pl]=Udostępnienie okna dialogowego do wyboru trybu interfejsu. +Comment[pt]=Oferece uma janela para a selecção do modo de UI. +Comment[pt_BR]=Fornece um diálogo para seleção modo-UI. +Comment[ru]=Предоставляет диалог выбора режима интерфейса пользователя. +Comment[sk]=Poskytuje dialóg pre voľbu UI módu. +Comment[sl]=Prikazuje okno za izbiro načina uporabniškega vmesnika. +Comment[sr]=Обезбеђује прозор за избор UI режима. +Comment[sr@Latn]=Obezbeđuje prozor za izbor UI režima. +Comment[sv]=Tillhandahåller en dialogruta för att välja läge för det grafiska gränssnittet. +Comment[ta]=UI-பாங்கு தேர்வுக்காக உரையாடல் பெட்டி வரும். +Comment[tg]=Барои интихоб намудани тартиботи истифодабарандаи интерфейс имкон медиҳад. +Comment[tr]=Arayüz-modu seçim için bir pencere sunar. +Comment[zh_CN]=提供用户界面模式选择对话框 +Comment[zh_TW]=提供使用者介面模式選擇對話框 +Name=KDevUIChooser +Name[da]=KDevelop brugergrænsefladevælger +Name[de]=Fenstermodusauswahl (KDevelop) +Name[hi]=के-डेव-यूआई-चूज़र +Name[nds]=KDevelop-Böversietutwahl +Name[pl]=KDevWybórInterfUżytk +Name[sk]=KDev voľba UI +Name[sv]=KDevelop gränssnittsväljare +Name[ta]=KDevUI தேர்வாளர் +Name[tg]=KDevUIИнтихобкунанда +Name[zh_TW]=KDevelop 使用者介面選擇器 +GenericName=User-Interface Selection +GenericName[ca]=Selecció de la interfície d'usuari +GenericName[da]=Valg af brugergrænseflade +GenericName[de]=Fenstermodusauswahl +GenericName[el]=Επιλογή περιβάλλοντος χρήστη +GenericName[es]=Selección de la interfaz de usuario +GenericName[et]=Kasutajaliidese valimine +GenericName[eu]=Erabiltzaile-interfaze hautapena +GenericName[fa]=گزینش واسط کاربر +GenericName[fr]=Sélection de l'interface utilisateur +GenericName[gl]=Selección da interface de usuario +GenericName[hi]=उपयोक्ता-इंटरफ़ेस चयन +GenericName[hu]=A felhasználói felület kiválasztása +GenericName[it]=Selezione dell'interfaccia utente +GenericName[ja]=ユーザインターフェース選択 +GenericName[nds]=Bruker-Koppelsteedutwahl +GenericName[ne]=प्रयोगकर्ता-इन्टरफेस चयन +GenericName[nl]=Gebruikersinterface selectie +GenericName[pl]=Wybór interfejsu użytkownika +GenericName[pt]=Selecção da Interface de Utilizador +GenericName[pt_BR]=Seleção de Interface-Usuário +GenericName[ru]=Выбор интерфейса пользователя +GenericName[sk]=Voľba užívateľského rozhrania +GenericName[sl]=Izbira uporabniškega vmesnika +GenericName[sr]=Избор корисничког интерфејса +GenericName[sr@Latn]=Izbor korisničkog interfejsa +GenericName[sv]=Användargränssnittsval +GenericName[ta]=பயனரின்-இடைமுக தேர்வு +GenericName[tg]=Интихоби интерфейси истифодабаранда +GenericName[tr]=Kullanıcı Arayüzü Seçimi +GenericName[zh_CN]=用户界面选择 +GenericName[zh_TW]=使用者介面選擇器 +Icon=view_choose +ServiceTypes=KDevelop/Plugin +X-KDE-Library=libkdevuichooser +X-KDevelop-Version=5 +X-KDevelop-Scope=Core +X-KDevelop-Mode=AssistantMode +X-KDevelop-Properties=UISwitching diff --git a/parts/uimode/uichooser.ui b/parts/uimode/uichooser.ui new file mode 100644 index 00000000..149a1db1 --- /dev/null +++ b/parts/uimode/uichooser.ui @@ -0,0 +1,250 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>UIChooser</class> +<widget class="QWidget"> + <property name="name"> + <cstring>UIChooser</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>540</width> + <height>529</height> + </rect> + </property> + <property name="caption"> + <string>UIChooser</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>TabModeGroup</cstring> + </property> + <property name="title"> + <string>Use Tabs</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Some prefer not to have a tab bar and switch between documents using other means. Kate is one example of this.</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>AlwaysShowTabs</cstring> + </property> + <property name="text"> + <string>Al&ways</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>NeverShowTabs</cstring> + </property> + <property name="text"> + <string>Ne&ver</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>HoverCloseGroup</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Use Close on Hover</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The document tab can optionally be used to close the document, by clicking on the tab icon.</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>DoNotCloseOnHover</cstring> + </property> + <property name="text"> + <string>No</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>DoCloseOnHover</cstring> + </property> + <property name="text"> + <string>&Yes</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>IDEAlButtonGroup</cstring> + </property> + <property name="title"> + <string>Toolview Tab Layout</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Three different modes for the IDEAl toolview tabs. "Text and icons" is the most informative, but takes a lot of space. Those with a smaller screen will typically want "Icons".</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>IconsOnly</cstring> + </property> + <property name="text"> + <string>Icons</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>TextOnly</cstring> + </property> + <property name="text"> + <string>Te&xt</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>TextAndIcons</cstring> + </property> + <property name="text"> + <string>Text and icons</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>TabbedBrowsingGroup</cstring> + </property> + <property name="title"> + <string>Tabbed Browsing</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Some extra options for the document tabbar.</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>OpenNewTabAfterCurrent</cstring> + </property> + <property name="text"> + <string>Open &new tab after current tab</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>ShowTabIcons</cstring> + </property> + <property name="text"> + <string>&Show icons on document tabs</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>ShowCloseTabsButton</cstring> + </property> + <property name="text"> + <string>Show close &button in tab bar</string> + </property> + </widget> + </grid> + </widget> + </hbox> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Note: Changes will take effect after KDevelop is restarted</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignCenter</set> + </property> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>AlwaysShowTabs</sender> + <signal>toggled(bool)</signal> + <receiver>UIChooser</receiver> + <slot>maybeEnableCloseOnHover(bool)</slot> + </connection> + <connection> + <sender>NeverShowTabs</sender> + <signal>toggled(bool)</signal> + <receiver>UIChooser</receiver> + <slot>maybeEnableCloseOnHover(bool)</slot> + </connection> + <connection> + <sender>ShowTabIcons</sender> + <signal>toggled(bool)</signal> + <receiver>UIChooser</receiver> + <slot>maybeEnableCloseOnHover(bool)</slot> + </connection> +</connections> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<slots> + <slot access="protected">maybeEnableCloseOnHover(bool)</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/parts/uimode/uichooser_part.cpp b/parts/uimode/uichooser_part.cpp new file mode 100644 index 00000000..914c03ba --- /dev/null +++ b/parts/uimode/uichooser_part.cpp @@ -0,0 +1,52 @@ +#include "uichooser_part.h" + +#include <qvbox.h> + +#include <kdialogbase.h> +#include <kdevgenericfactory.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kdevcore.h> +#include <configwidgetproxy.h> +#include <kdevplugininfo.h> + +#include "uichooser_widget.h" + +#define UICHOOSERSETTINGSPAGE 1 + +typedef KDevGenericFactory<UIChooserPart> UIChooserFactory; +static const KDevPluginInfo data("kdevuichooser"); +K_EXPORT_COMPONENT_FACTORY( libkdevuichooser, UIChooserFactory( data ) ) + +UIChooserPart::UIChooserPart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin( &data, parent, name ? name : "UIChooserPart") +{ + setInstance(UIChooserFactory::instance()); + + _configProxy = new ConfigWidgetProxy( core() ); + _configProxy->createGlobalConfigPage( i18n("User Interface"), UICHOOSERSETTINGSPAGE, info()->icon() ); + connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), + this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) ); +} + + +UIChooserPart::~UIChooserPart() +{ + delete _configProxy; +} + +void UIChooserPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber ) +{ + kdDebug() << k_funcinfo << endl; + + if ( pagenumber == UICHOOSERSETTINGSPAGE ) + { + UIChooserWidget * w = new UIChooserWidget( this, page, "UIChooser widget" ); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); + } +} + + + + +#include "uichooser_part.moc" diff --git a/parts/uimode/uichooser_part.h b/parts/uimode/uichooser_part.h new file mode 100644 index 00000000..e4633441 --- /dev/null +++ b/parts/uimode/uichooser_part.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2001 Matthias Hoelzer-Kluepfel <mhk@caldera.de> + */ + + +#ifndef __KDEVPART_UICHOOSER_H__ +#define __KDEVPART_UICHOOSER_H__ + + +class KDialogBase; +class ConfigWidgetProxy; + +#include <kdevplugin.h> + +class UIChooserPart : public KDevPlugin +{ + Q_OBJECT + +public: + UIChooserPart(QObject *parent, const char *name, const QStringList &); + ~UIChooserPart(); + +private slots: + void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int ); + +private: + ConfigWidgetProxy * _configProxy; + +}; + + +#endif diff --git a/parts/uimode/uichooser_widget.cpp b/parts/uimode/uichooser_widget.cpp new file mode 100644 index 00000000..5e6ffbf7 --- /dev/null +++ b/parts/uimode/uichooser_widget.cpp @@ -0,0 +1,153 @@ +/*************************************************************************** + uichooser_widget.cpp - ? + ------------------- + begin : ? + copyright : (C) 2003 by the KDevelop team + email : team@kdevelop.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qradiobutton.h> +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kdeversion.h> + +#include "uichooser_part.h" +#include "kdevmainwindow.h" +#include "uichooser_widget.h" + +UIChooserWidget::UIChooserWidget( UIChooserPart * part, QWidget *parent, const char *name) + : UIChooser(parent, name) + ,m_part(part), _lastMode(0L) +{ + load(); +} + +void UIChooserWidget::load() +{ + KConfig *config = kapp->config(); + config->setGroup("UI"); + + int mdistyle = config->readNumEntry( "MDIStyle", 1 ); + switch( mdistyle ) + { + case 0: + IconsOnly->setChecked( true ); + break; + case 1: + TextOnly->setChecked( true ); + break; + case 3: + TextAndIcons->setChecked( true ); + break; + default: + TextOnly->setChecked( true ); + } + + int tabVisibility = config->readNumEntry( "TabWidgetVisibility", _AlwaysShowTabs ); + switch( tabVisibility ) + { + case _AlwaysShowTabs: + AlwaysShowTabs->setChecked( true ); + break; + case _NeverShowTabs: + NeverShowTabs->setChecked( true ); + break; + } + + bool CloseOnHover = config->readBoolEntry( "CloseOnHover", false ); + + if ( CloseOnHover ) + { + DoCloseOnHover->setChecked( true ); + } + else + { + DoNotCloseOnHover->setChecked( true ); + } + OpenNewTabAfterCurrent->setChecked(config->readBoolEntry( "OpenNewTabAfterCurrent", false )); + ShowTabIcons->setChecked(config->readBoolEntry( "ShowTabIcons", true )); + ShowCloseTabsButton->setChecked(config->readBoolEntry( "ShowCloseTabsButton", true )); + + maybeEnableCloseOnHover(false); +} + + +void UIChooserWidget::save() +{ + KConfig *config = kapp->config(); + config->setGroup("UI"); + + if ( AlwaysShowTabs->isChecked() ) + { + config->writeEntry( "TabWidgetVisibility", _AlwaysShowTabs ); + } + else if ( NeverShowTabs->isChecked() ) + { + config->writeEntry( "TabWidgetVisibility", _NeverShowTabs ); + } + + if ( DoNotCloseOnHover->isChecked() ) + { + config->writeEntry( "CloseOnHover", false ); + } + else if ( DoCloseOnHover->isChecked() ) + { + config->writeEntry( "CloseOnHover", true ); + } + + // using magic numbers for now.. where are these values defined?? + if ( IconsOnly->isChecked() ) + { + config->writeEntry( "MDIStyle", 0 ); + } + else if ( TextAndIcons->isChecked() ) + { + config->writeEntry( "MDIStyle", 3 ); + } + else // TextOnly + { + config->writeEntry( "MDIStyle", 1 ); + } + config->writeEntry("OpenNewTabAfterCurrent", OpenNewTabAfterCurrent->isChecked()); + config->writeEntry("ShowTabIcons", ShowTabIcons->isChecked()); + config->writeEntry("ShowCloseTabsButton", ShowCloseTabsButton->isChecked()); + + config->sync(); +} + + +void UIChooserWidget::accept() +{ + save(); +} + +void UIChooserWidget::maybeEnableCloseOnHover( bool ) +{ + if ( !NeverShowTabs->isChecked() && !ShowTabIcons->isChecked()) + { + HoverCloseGroup->setEnabled(false); + } else if ( NeverShowTabs->isChecked() ) + { + HoverCloseGroup->setEnabled( false ); + TabbedBrowsingGroup->setEnabled( false ); + } else + { + HoverCloseGroup->setEnabled( true ); + TabbedBrowsingGroup->setEnabled( true ); + } +} + + +#include "uichooser_widget.moc" diff --git a/parts/uimode/uichooser_widget.h b/parts/uimode/uichooser_widget.h new file mode 100644 index 00000000..5faba3af --- /dev/null +++ b/parts/uimode/uichooser_widget.h @@ -0,0 +1,42 @@ +#ifndef __UICHOOSER_WIDGET_H__ +#define __UICHOOSER_WIDGET_H__ + + +#include <qwidget.h> + + +#include "uichooser.h" + +class UIChooserPart; + +class UIChooserWidget : public UIChooser +{ + Q_OBJECT + +public: + + enum TabWidgetVisibility { + _AlwaysShowTabs = 0, + _NeverShowTabs = 2 + }; + + UIChooserWidget( UIChooserPart * part, QWidget *parent=0, const char *name=0 ); + +public slots: + void accept(); + +protected slots: + void maybeEnableCloseOnHover( bool ); + +private slots: + + void load(); + void save(); + +private: + UIChooserPart* m_part; + QWidget * _lastMode; +}; + + +#endif |