From 9cff39bc34d1f0579b2f9841f55c6cebc87fed57 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Aug 2011 03:21:22 +0000 Subject: Enable the new display configuration module git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1249201 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/displayconfig/displayconfig.cpp | 59 ++++++++++++++++++++++++++++ kcontrol/displayconfig/displayconfig.desktop | 2 +- kcontrol/displayconfig/displayconfig.h | 3 ++ kcontrol/displayconfig/displayconfigbase.ui | 16 ++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) (limited to 'kcontrol') diff --git a/kcontrol/displayconfig/displayconfig.cpp b/kcontrol/displayconfig/displayconfig.cpp index 7c75df2f2..98285276a 100644 --- a/kcontrol/displayconfig/displayconfig.cpp +++ b/kcontrol/displayconfig/displayconfig.cpp @@ -693,7 +693,10 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin connect(base->systemEnableSupport, TQT_SIGNAL(toggled(bool)), base->monitorDisplaySelectDD, TQT_SLOT(setEnabled(bool))); + connect(base->rescanHardware, TQT_SIGNAL(clicked()), TQT_SLOT(rescanHardware())); + connect(base->loadExistingProfile, TQT_SIGNAL(clicked()), TQT_SLOT(reloadProfile())); connect(base->previewConfiguration, TQT_SIGNAL(clicked()), TQT_SLOT(activatePreview())); + connect(base->identifyMonitors, TQT_SIGNAL(clicked()), TQT_SLOT(identifyMonitors())); load(); @@ -720,6 +723,59 @@ void KDisplayConfig::updateExtendedMonitorInformation () { refreshDisplayedInformation(); } +void KDisplayConfig::rescanHardware (void) { + m_randrsimple->destroyScreenInformationObject(m_screenInfoArray); + m_screenInfoArray = m_randrsimple->readCurrentDisplayConfiguration(); + m_randrsimple->ensureMonitorDataConsistency(m_screenInfoArray); + numberOfScreens = m_screenInfoArray.count(); + refreshDisplayedInformation(); +} + +void KDisplayConfig::reloadProfile (void) { + // FIXME + m_randrsimple->destroyScreenInformationObject(m_screenInfoArray); + m_screenInfoArray = m_randrsimple->loadSystemwideDisplayConfiguration("", KDE_CONFDIR); + m_randrsimple->ensureMonitorDataConsistency(m_screenInfoArray); + numberOfScreens = m_screenInfoArray.count(); + refreshDisplayedInformation(); +} + +void KDisplayConfig::identifyMonitors () { + int i; + + TQLabel* idWidget; + TQPtrList widgetList; + + Display *randr_display; + ScreenInfo *randr_screen_info; + XRROutputInfo *output_info; + + randr_display = XOpenDisplay(NULL); + randr_screen_info = m_randrsimple->read_screen_info(randr_display); + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ON outputs... + if (!randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + SingleScreenData *screendata = m_screenInfoArray.at(i); + idWidget = new TQLabel(TQString("Screen\n%1").arg(i+1), (TQWidget*)0, "", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM | Qt::WDestructiveClose); + widgetList.append(idWidget); + idWidget->resize(150, 100); + idWidget->setAlignment(Qt::AlignCenter); + TQFont font = idWidget->font(); + font.setBold( true ); + font.setPointSize(24); + idWidget->setFont( font ); + idWidget->setPaletteForegroundColor(Qt::white); + idWidget->setPaletteBackgroundColor(Qt::black); + idWidget->show(); + KDialog::centerOnScreen(idWidget, i); + TQTimer::singleShot(3000, idWidget, SLOT(close())); + } +} + void KDisplayConfig::deleteProfile () { } @@ -1038,6 +1094,9 @@ void KDisplayConfig::processLockoutControls() { base->resolutionTab->setEnabled(false); } } + + base->loadExistingProfile->setEnabled(false); // Disable this until it works properly! + base->loadExistingProfile->hide(); // Same as above } void KDisplayConfig::addTab( const TQString name, const TQString label ) diff --git a/kcontrol/displayconfig/displayconfig.desktop b/kcontrol/displayconfig/displayconfig.desktop index 9fc6a06c4..653e2f002 100644 --- a/kcontrol/displayconfig/displayconfig.desktop +++ b/kcontrol/displayconfig/displayconfig.desktop @@ -20,4 +20,4 @@ MimeType= Name=Monitor and Display Name[en_US]=Monitor and Display -NoDisplay=true \ No newline at end of file +NoDisplay=false \ No newline at end of file diff --git a/kcontrol/displayconfig/displayconfig.h b/kcontrol/displayconfig/displayconfig.h index 643ff81af..835f1209a 100644 --- a/kcontrol/displayconfig/displayconfig.h +++ b/kcontrol/displayconfig/displayconfig.h @@ -111,6 +111,9 @@ private slots: void rotationInfoChanged (void); void refreshInfoChanged (void); void activatePreview (void); + void identifyMonitors (void); + void rescanHardware (void); + void reloadProfile (void); }; #endif diff --git a/kcontrol/displayconfig/displayconfigbase.ui b/kcontrol/displayconfig/displayconfigbase.ui index 56b5416a6..cbffc91fd 100644 --- a/kcontrol/displayconfig/displayconfigbase.ui +++ b/kcontrol/displayconfig/displayconfigbase.ui @@ -249,6 +249,22 @@ &Extend my Trinity desktop onto this monitor. + + + rescanHardware + + + &Rescan Displays + + + + + loadExistingProfile + + + Load &Existing Profile + + previewConfiguration -- cgit v1.2.1