From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/uimode/Makefile.am | 13 ++ parts/uimode/README.dox | 8 ++ parts/uimode/kdevuichooser.desktop | 87 +++++++++++++ parts/uimode/uichooser.ui | 250 +++++++++++++++++++++++++++++++++++++ parts/uimode/uichooser_part.cpp | 52 ++++++++ parts/uimode/uichooser_part.h | 32 +++++ parts/uimode/uichooser_widget.cpp | 153 +++++++++++++++++++++++ parts/uimode/uichooser_widget.h | 42 +++++++ 8 files changed, 637 insertions(+) create mode 100644 parts/uimode/Makefile.am create mode 100644 parts/uimode/README.dox create mode 100644 parts/uimode/kdevuichooser.desktop create mode 100644 parts/uimode/uichooser.ui create mode 100644 parts/uimode/uichooser_part.cpp create mode 100644 parts/uimode/uichooser_part.h create mode 100644 parts/uimode/uichooser_widget.cpp create mode 100644 parts/uimode/uichooser_widget.h (limited to 'parts/uimode') 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 Matthias Hoelzer + +\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 @@ + +UIChooser + + + UIChooser + + + + 0 + 0 + 540 + 529 + + + + UIChooser + + + + unnamed + + + 0 + + + + layout1 + + + + unnamed + + + + TabModeGroup + + + Use Tabs + + + Some prefer not to have a tab bar and switch between documents using other means. Kate is one example of this. + + + + unnamed + + + + AlwaysShowTabs + + + Al&ways + + + true + + + + + NeverShowTabs + + + Ne&ver + + + + + + + HoverCloseGroup + + + false + + + Use Close on Hover + + + The document tab can optionally be used to close the document, by clicking on the tab icon. + + + + unnamed + + + + DoNotCloseOnHover + + + No + + + true + + + + + DoCloseOnHover + + + &Yes + + + + + + + + + layout2 + + + + unnamed + + + + IDEAlButtonGroup + + + Toolview Tab Layout + + + 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". + + + + unnamed + + + + IconsOnly + + + Icons + + + + + TextOnly + + + Te&xt + + + true + + + + + TextAndIcons + + + Text and icons + + + + + + + TabbedBrowsingGroup + + + Tabbed Browsing + + + Some extra options for the document tabbar. + + + + unnamed + + + + OpenNewTabAfterCurrent + + + Open &new tab after current tab + + + + + ShowTabIcons + + + &Show icons on document tabs + + + + + ShowCloseTabsButton + + + Show close &button in tab bar + + + + + + + + + textLabel1 + + + + 5 + 3 + 0 + 0 + + + + Note: Changes will take effect after KDevelop is restarted + + + WordBreak|AlignCenter + + + + + + + AlwaysShowTabs + toggled(bool) + UIChooser + maybeEnableCloseOnHover(bool) + + + NeverShowTabs + toggled(bool) + UIChooser + maybeEnableCloseOnHover(bool) + + + ShowTabIcons + toggled(bool) + UIChooser + maybeEnableCloseOnHover(bool) + + + + kdialog.h + + + maybeEnableCloseOnHover(bool) + + + + 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 + +#include +#include +#include +#include +#include +#include +#include + +#include "uichooser_widget.h" + +#define UICHOOSERSETTINGSPAGE 1 + +typedef KDevGenericFactory 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 + */ + + +#ifndef __KDEVPART_UICHOOSER_H__ +#define __KDEVPART_UICHOOSER_H__ + + +class KDialogBase; +class ConfigWidgetProxy; + +#include + +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 +#include +#include +#include +#include +#include +#include + +#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 + + +#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 -- cgit v1.2.1