diff options
Diffstat (limited to 'kcontrol/display')
-rw-r--r-- | kcontrol/display/CMakeLists.txt | 33 | ||||
-rw-r--r-- | kcontrol/display/Makefile.am | 16 | ||||
-rw-r--r-- | kcontrol/display/display.cpp | 110 | ||||
-rw-r--r-- | kcontrol/display/display.desktop | 154 | ||||
-rw-r--r-- | kcontrol/display/display.h | 48 |
5 files changed, 361 insertions, 0 deletions
diff --git a/kcontrol/display/CMakeLists.txt b/kcontrol/display/CMakeLists.txt new file mode 100644 index 000000000..84bcb2dfe --- /dev/null +++ b/kcontrol/display/CMakeLists.txt @@ -0,0 +1,33 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### other data ################################ + +install( FILES display.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_display (module) ###################### + +tde_add_kpart( kcm_display AUTOMOC + SOURCES display.cpp + LINK tdeutils-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kcontrol/display/Makefile.am b/kcontrol/display/Makefile.am new file mode 100644 index 000000000..00a10de02 --- /dev/null +++ b/kcontrol/display/Makefile.am @@ -0,0 +1,16 @@ +kde_module_LTLIBRARIES = kcm_display.la + +kcm_display_la_SOURCES = display.cpp + +kcm_display_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kcm_display_la_LIBADD = $(LIB_TDEUTILS) +AM_CPPFLAGS = $(all_includes) + +METASOURCES = AUTO + +noinst_HEADERS = display.h + +xdg_apps_DATA = display.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/display.pot diff --git a/kcontrol/display/display.cpp b/kcontrol/display/display.cpp new file mode 100644 index 000000000..b3e15d021 --- /dev/null +++ b/kcontrol/display/display.cpp @@ -0,0 +1,110 @@ +/* This file is part of the KDE project + Copyright (C) 2003-2004 Nadeem Hasan <[email protected]> + + 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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 program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <tqapplication.h> +#include <tqlayout.h> +#include <tqtabwidget.h> + +#include <tdecmoduleloader.h> +#include <kdialog.h> +#include <kgenericfactory.h> + +#include "display.h" + +typedef KGenericFactory<KCMDisplay, TQWidget> DisplayFactory; +K_EXPORT_COMPONENT_FACTORY ( kcm_display, DisplayFactory( "display" ) ) + +KCMDisplay::KCMDisplay( TQWidget *parent, const char *name, const TQStringList& ) + : TDECModule( parent, name ) + , m_changed(false) +{ + m_tabs = new TQTabWidget( this ); + + addTab( "randr", i18n( "Size && Orientation" ) ); + addTab( "nvidiadisplay", i18n( "Graphics Adaptor" ) ); + addTab( "nvidia3d", i18n( "3D Options" ) ); + addTab( "kgamma", i18n( "Monitor Gamma" ) ); + if ( TQApplication::desktop()->isVirtualDesktop() ) + addTab( "xinerama", i18n( "Multiple Monitors" ) ); + addTab( "energy", i18n( "Power Control" ) ); + + TQVBoxLayout *top = new TQVBoxLayout( this, 0, KDialog::spacingHint() ); + top->addWidget( m_tabs ); + + setButtons( Apply|Help ); + load(); +} + +void KCMDisplay::addTab( const TQString &name, const TQString &label ) +{ + TQWidget *page = new TQWidget( m_tabs, name.latin1() ); + TQVBoxLayout *top = new TQVBoxLayout( page, KDialog::marginHint() ); + + TDECModule *kcm = TDECModuleLoader::loadModule( name, page ); + + if ( kcm ) + { + top->addWidget( kcm ); + m_tabs->addTab( page, label ); + + connect( kcm, TQT_SIGNAL( changed(bool) ), TQT_SLOT( moduleChanged(bool) ) ); + m_modules.insert(kcm, false); + } + else + delete page; +} + +void KCMDisplay::load() +{ + for (TQMap<TDECModule*, bool>::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it) + it.key()->load(); +} + +void KCMDisplay::save() +{ + for (TQMap<TDECModule*, bool>::Iterator it = m_modules.begin(); it != m_modules.end(); ++it) + if (it.data()) + it.key()->save(); +} + +void KCMDisplay::moduleChanged( bool isChanged ) +{ + TQMap<TDECModule*, bool>::Iterator currentModule = m_modules.find(static_cast<TDECModule*>(TQT_TQWIDGET(const_cast<TQObject*>(TQT_TQOBJECT_CONST(sender()))))); + Q_ASSERT(currentModule != m_modules.end()); + if (currentModule.data() == isChanged) + return; + + currentModule.data() = isChanged; + + bool c = false; + + for (TQMap<TDECModule*, bool>::ConstIterator it = m_modules.begin(); it != m_modules.end(); ++it) { + if (it.data()) { + c = true; + break; + } + } + + if (m_changed != c) { + m_changed = c; + emit changed(c); + } +} + +#include "display.moc" diff --git a/kcontrol/display/display.desktop b/kcontrol/display/display.desktop new file mode 100644 index 000000000..b5c8b8117 --- /dev/null +++ b/kcontrol/display/display.desktop @@ -0,0 +1,154 @@ +[Desktop Entry] +Icon=tdescreensaver +Type=Application +Exec=tdecmshell display +X-DocPath=kcontrol/display/index.html + +X-TDE-Library=display +X-TDE-FactoryName=display +X-TDE-ParentApp=kcontrol +Name=Display +Name[af]=Skerm +Name[ar]=عرض +Name[az]=Displey +Name[be]=Манітор +Name[bg]=Монитор +Name[bn]=ডিসপ্লে +Name[br]=Diskwel +Name[bs]=Ekran +Name[ca]=Pantalla +Name[cs]=Obrazovka +Name[csb]=Ekran +Name[cy]= Arddangos +Name[da]=Skærm +Name[de]=Anzeige +Name[el]=Οθόνη +Name[eo]=Vidigilo +Name[es]=Pantalla +Name[et]=Monitor +Name[eu]=Pantaila +Name[fa]=نمایش +Name[fi]=Näyttö +Name[fr]=Affichage +Name[fy]=Byldskerm +Name[gl]=Pantalla +Name[he]=תצוגה +Name[hi]=रूप-रंग +Name[hr]=Zaslon +Name[hu]=Képernyő +Name[is]=Skjár +Name[ja]=ディスプレイ +Name[ka]=ჩვენება +Name[kk]=Дисплей +Name[km]=បង្ហាញ +Name[ko]=디스플레이 +Name[lt]=Ekranas +Name[lv]=Ekrāns +Name[mk]=Приказ +Name[mn]=Дэлгэц +Name[ms]=Paparan +Name[mt]=Skrin +Name[nb]=Skjerm +Name[nds]=Dorstellen +Name[ne]=प्रदर्शन गर्नुहोस् +Name[nl]=Beeldscherm +Name[nn]=Skjerm +Name[pa]=ਝਲਕ +Name[pl]=Ekran +Name[pt]=Ecrã +Name[pt_BR]=Tela +Name[ro]=Monitor +Name[ru]=Дисплей +Name[rw]=Kwerekana +Name[se]=Šearbma +Name[sk]=Displej +Name[sl]=Zaslon +Name[sr]=Екран +Name[sr@Latn]=Ekran +Name[sv]=Bildskärm +Name[ta]=காட்சி +Name[tg]=Намоиш +Name[th]=การแสดงผล +Name[tr]=Görüntü +Name[tt]=Kürsätü +Name[uk]=Дисплей +Name[uz]=Displey +Name[uz@cyrillic]=Дисплей +Name[vi]=Hiển thị +Name[wa]=Håynaedje +Name[zh_CN]=显示 +Name[zh_TW]=顯示 +Comment=Display Settings +Comment[af]=Skerm Instellings +Comment[ar]=إعدادت العرض +Comment[az]=Displey Qurğuları +Comment[be]=Настаўленні манітора +Comment[bg]=Настройване на екрана +Comment[bn]=ডিসপ্লে সেটিংস +Comment[br]=Kefluniañ an diskwel +Comment[bs]=Postavke ekrana +Comment[ca]=Arranjament de la pantalla +Comment[cs]=Nastavení obrazovky +Comment[csb]=Ùstôw ekranu +Comment[cy]=Gosodiadau Arddangos +Comment[da]=Opsætning af skærm +Comment[de]=Anzeige-Einstellungen +Comment[el]=Ρυθμίσεις οθόνης +Comment[eo]=Vidigila Agordo +Comment[es]=Preferencias de la pantalla +Comment[et]=Monitoride seadistused +Comment[eu]=Pantailaren konfigurazioa +Comment[fa]=نمایش تنظیمات +Comment[fi]=Näytön asetukset +Comment[fr]=Paramètres d'affichage +Comment[fy]=Byldskerm ynstellings +Comment[ga]=Socruithe an Scáileáin +Comment[gl]=Opcións da Pantalla +Comment[he]=הגדרות תצוגה +Comment[hi]=रूप-रंग विन्यास +Comment[hr]=Postavke zaslona +Comment[hu]=Képernyőbeállítások +Comment[is]=Stillingar skjás +Comment[it]=Impostazioni del display +Comment[ja]=ディスプレイの設定 +Comment[ka]=დისპლეის კონფიგურირება +Comment[kk]=Дисплей баптаулары +Comment[km]=កំណត់ការបង្ហាញ +Comment[ko]=디스플레이 설정 +Comment[lt]=Ekrano parametrai +Comment[lv]=Ekrāna parametri +Comment[mk]=Поставувања на приказот +Comment[mn]=Дэлгэц тохируулга +Comment[ms]=Seting Paparan +Comment[mt]=Konfigurazzjoni tal-iskrin +Comment[nb]=Skjerminnstillinger +Comment[nds]=Dorstellen inrichten +Comment[ne]=सेटिङ प्रदर्शन गर्नुहोस् +Comment[nl]=Beeldscherminstellingen +Comment[nn]=Skjerminnstillingar +Comment[pa]=ਝਲਕ ਸੰਰਚਨਾ +Comment[pl]=Ustawienia ekranu +Comment[pt]=Configuração do ecrã +Comment[pt_BR]=Configurações da Tela +Comment[ro]=Configurează monitorul +Comment[ru]=Настройка дисплея +Comment[rw]=Kwerekana Amagenamiterere +Comment[se]=Šearbmaheivehusat +Comment[sk]=Nastavenie displeja +Comment[sl]=Nastavitve zaslona +Comment[sr]=Подешавања екрана +Comment[sr@Latn]=Podešavanja ekrana +Comment[sv]=Anpassa bildskärm +Comment[ta]=அமைப்புகளை காட்டு +Comment[tg]=Танзимоти намоиш +Comment[th]=ตั้งค่าการแสดงผล +Comment[tr]=Görüntü Ayarları +Comment[tt]=Küräk Caylaw +Comment[uk]=Налаштування дисплея +Comment[uz]=Displeyning moslamalari +Comment[uz@cyrillic]=Дисплейнинг мосламалари +Comment[vi]=Thiết lập Hiển thị +Comment[wa]=Apontiaedjes do Håynaedje +Comment[zh_CN]=显示设置 +Comment[zh_TW]=顯示設定 +Categories=Qt;TDE;X-TDE-settings-hardware; diff --git a/kcontrol/display/display.h b/kcontrol/display/display.h new file mode 100644 index 000000000..42373a42f --- /dev/null +++ b/kcontrol/display/display.h @@ -0,0 +1,48 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Nadeem Hasan <[email protected]> + + 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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 program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef DISPLAY_H +#define DISPLAY_H + +#include <tdecmodule.h> + +class TQTabWidget; + +class KCMDisplay : public TDECModule +{ + Q_OBJECT + + public: + KCMDisplay( TQWidget *parent, const char *name, const TQStringList& ); + void load(); + void save(); + + private slots: + void moduleChanged(bool isChanged); + + private: + void addTab( const TQString &name, const TQString &label ); + + TQTabWidget *m_tabs; + TQMap<TDECModule*, bool> m_modules; + bool m_changed; +}; + +#endif // DISPLAY_H + |