summaryrefslogtreecommitdiffstats
path: root/kcontrol/randr
diff options
context:
space:
mode:
Diffstat (limited to 'kcontrol/randr')
-rw-r--r--kcontrol/randr/CMakeLists.txt3
-rw-r--r--kcontrol/randr/configdialog.cpp1
-rw-r--r--kcontrol/randr/configdialog.h3
-rw-r--r--kcontrol/randr/ktimerdialog.cpp10
-rw-r--r--kcontrol/randr/ktimerdialog.h8
-rw-r--r--kcontrol/randr/tderandrapp.cpp4
-rw-r--r--kcontrol/randr/tderandrapp.h6
-rw-r--r--kcontrol/randr/tderandrbindings.cpp3
-rw-r--r--kcontrol/randr/tderandrmodule.cpp20
-rw-r--r--kcontrol/randr/tderandrmodule.h2
-rw-r--r--kcontrol/randr/tderandrpassivepopup.cpp8
-rw-r--r--kcontrol/randr/tderandrpassivepopup.h2
-rw-r--r--kcontrol/randr/tderandrtray.cpp329
-rw-r--r--kcontrol/randr/tderandrtray.h10
14 files changed, 214 insertions, 195 deletions
diff --git a/kcontrol/randr/CMakeLists.txt b/kcontrol/randr/CMakeLists.txt
index 25a3a897e..1101f1ee1 100644
--- a/kcontrol/randr/CMakeLists.txt
+++ b/kcontrol/randr/CMakeLists.txt
@@ -11,6 +11,7 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
)
@@ -55,6 +56,6 @@ tde_add_executable( tderandrtray AUTOMOC
SOURCES
main.cpp tderandrtray.cpp tderandrapp.cpp
tderandrpassivepopup.cpp configdialog.cpp
- LINK tdeutils-shared tderandr-shared
+ LINK tdeutils-shared tderandr-shared ${TDEHW_LIBRARIES}
DESTINATION ${BIN_INSTALL_DIR}
)
diff --git a/kcontrol/randr/configdialog.cpp b/kcontrol/randr/configdialog.cpp
index 5ed71aa6d..88ec261f2 100644
--- a/kcontrol/randr/configdialog.cpp
+++ b/kcontrol/randr/configdialog.cpp
@@ -1,4 +1,3 @@
-// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
/* This file is part of the KDE project
Copyright (C) 2000 by Carsten Pfeiffer <pfeiffer@kde.org>
diff --git a/kcontrol/randr/configdialog.h b/kcontrol/randr/configdialog.h
index 0728146ee..1b6a5faac 100644
--- a/kcontrol/randr/configdialog.h
+++ b/kcontrol/randr/configdialog.h
@@ -1,4 +1,3 @@
-// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
/* This file is part of the KDE project
Copyright (C) 2000 by Carsten Pfeiffer <pfeiffer@kde.org>
@@ -42,7 +41,7 @@ class ConfigDialog;
class ConfigDialog : public KDialogBase
{
- Q_OBJECT
+ TQ_OBJECT
public:
ConfigDialog(TDEGlobalAccel *accel, bool isApplet );
diff --git a/kcontrol/randr/ktimerdialog.cpp b/kcontrol/randr/ktimerdialog.cpp
index 1aa0f58df..140234a90 100644
--- a/kcontrol/randr/ktimerdialog.cpp
+++ b/kcontrol/randr/ktimerdialog.cpp
@@ -35,9 +35,9 @@
#include "ktimerdialog.h"
#include "ktimerdialog.moc"
-KTimerDialog::KTimerDialog( int msec, TimerStyle style, QWidget *parent,
+KTimerDialog::KTimerDialog( int msec, TimerStyle style, TQWidget *parent,
const char *name, bool modal,
- const QString &caption,
+ const TQString &caption,
int buttonMask, ButtonCode defaultButton,
bool separator,
const KGuiItem &user1,
@@ -56,8 +56,8 @@ KTimerDialog::KTimerDialog( int msec, TimerStyle style, QWidget *parent,
if ( buttonMask & Cancel )
buttonOnTimeout = Cancel;
- connect( totalTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotInternalTimeout() ) );
- connect( updateTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotUpdateTime() ) );
+ connect( totalTimer, TQ_SIGNAL( timeout() ), TQ_SLOT( slotInternalTimeout() ) );
+ connect( updateTimer, TQ_SIGNAL( timeout() ), TQ_SLOT( slotUpdateTime() ) );
// create the widgets
mainWidget = new QVBox( this, "mainWidget" );
@@ -90,7 +90,7 @@ int KTimerDialog::exec()
return KDialogBase::exec();
}
-void KTimerDialog::setMainWidget( QWidget *widget )
+void KTimerDialog::setMainWidget( TQWidget *widget )
{
// yuck, here goes.
QVBox *newWidget = new QVBox( this );
diff --git a/kcontrol/randr/ktimerdialog.h b/kcontrol/randr/ktimerdialog.h
index 23b4a92b0..74891d048 100644
--- a/kcontrol/randr/ktimerdialog.h
+++ b/kcontrol/randr/ktimerdialog.h
@@ -44,7 +44,7 @@ class QLabel;
*/
class KTimerDialog : public KDialogBase
{
- Q_OBJECT
+ TQ_OBJECT
public:
@@ -67,9 +67,9 @@ class KTimerDialog : public KDialogBase
*
* For the rest of the arguments, See @see KDialogBase .
*/
- KTimerDialog( int msec, TimerStyle style=CountDown, QWidget *parent=0,
+ KTimerDialog( int msec, TimerStyle style=CountDown, TQWidget *parent=0,
const char *name=0, bool modal=true,
- const QString &caption=QString::null,
+ const TQString &caption=TQString::null,
int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
bool separator=false,
const KGuiItem &user1=KGuiItem(),
@@ -117,7 +117,7 @@ class KTimerDialog : public KDialogBase
* Overridden function which is used to set the main widget of the dialog.
* @see KDialogBase::setMainWidget.
*/
- void setMainWidget( QWidget *widget );
+ void setMainWidget( TQWidget *widget );
signals:
/**
diff --git a/kcontrol/randr/tderandrapp.cpp b/kcontrol/randr/tderandrapp.cpp
index e2a4b46f2..a6d704e30 100644
--- a/kcontrol/randr/tderandrapp.cpp
+++ b/kcontrol/randr/tderandrapp.cpp
@@ -28,7 +28,7 @@
KRandRApp::KRandRApp()
: m_tray(new KRandRSystemTray(0L, "RANDRTray"))
{
- connect(&m_eventMergingTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(handleX11ConfigChangeEvent()));
+ connect(&m_eventMergingTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(handleX11ConfigChangeEvent()));
m_tray->show();
}
@@ -41,7 +41,7 @@ void KRandRApp::handleX11ConfigChangeEvent()
bool KRandRApp::x11EventFilter(XEvent* e)
{
if (e->type == m_tray->screenChangeNotifyEvent()) {
- m_eventMergingTimer.start(1000, TRUE);
+ m_eventMergingTimer.start(1000, true);
}
return TDEApplication::x11EventFilter( e );
}
diff --git a/kcontrol/randr/tderandrapp.h b/kcontrol/randr/tderandrapp.h
index 004da6294..4a2856ad4 100644
--- a/kcontrol/randr/tderandrapp.h
+++ b/kcontrol/randr/tderandrapp.h
@@ -20,13 +20,13 @@
#define TDERANDRAPP_H
#include <tqtimer.h>
-#include <kuniqueapplication.h>
+#include <tdeuniqueapplication.h>
class KRandRSystemTray;
-class KRandRApp : public KUniqueApplication
+class KRandRApp : public TDEUniqueApplication
{
- Q_OBJECT
+ TQ_OBJECT
public:
KRandRApp();
diff --git a/kcontrol/randr/tderandrbindings.cpp b/kcontrol/randr/tderandrbindings.cpp
index 07702633b..a5ad3fe6d 100644
--- a/kcontrol/randr/tderandrbindings.cpp
+++ b/kcontrol/randr/tderandrbindings.cpp
@@ -1,4 +1,3 @@
-// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
/* This file is part of the KDE project
Copyright (C) by Andrew Stanley-Jones
@@ -19,7 +18,7 @@
*/
#ifndef NOSLOTS
# define DEF( name, key3, key4, fnSlot ) \
- keys->insert( name, i18n(name), TQString(), key3, key4, TQT_TQOBJECT(this), TQT_SLOT(fnSlot) )
+ keys->insert( name, i18n(name), TQString(), key3, key4, this, TQ_SLOT(fnSlot) )
#else
# define DEF( name, key3, key4, fnSlot ) \
keys->insert( name, i18n(name), TQString(), key3, key4 )
diff --git a/kcontrol/randr/tderandrmodule.cpp b/kcontrol/randr/tderandrmodule.cpp
index 11263bbf4..b8a53ce89 100644
--- a/kcontrol/randr/tderandrmodule.cpp
+++ b/kcontrol/randr/tderandrmodule.cpp
@@ -48,12 +48,12 @@ K_EXPORT_COMPONENT_FACTORY (kcm_randr, KSSFactory("tderandr") )
extern "C"
{
- KDE_EXPORT void init_randr()
+ TDE_EXPORT void init_randr()
{
KRandRModule::performApplyOnStartup();
}
- KDE_EXPORT bool test_randr()
+ TDE_EXPORT bool test_randr()
{
int eventBase, errorBase;
if( XRRQueryExtension(tqt_xdisplay(), &eventBase, &errorBase ) )
@@ -100,7 +100,7 @@ KRandRModule::KRandRModule(TQWidget *parent, const char *name, const TQStringLis
screenLabel->setBuddy( m_screenSelector );
TQWhatsThis::add(m_screenSelector, i18n("The screen whose settings you would like to change can be selected using this drop-down list."));
- connect(m_screenSelector, TQT_SIGNAL(activated(int)), TQT_SLOT(slotScreenChanged(int)));
+ connect(m_screenSelector, TQ_SIGNAL(activated(int)), TQ_SLOT(slotScreenChanged(int)));
if (numScreens() <= 1)
m_screenSelector->setEnabled(false);
@@ -110,7 +110,7 @@ KRandRModule::KRandRModule(TQWidget *parent, const char *name, const TQStringLis
TQLabel *sizeLabel = new TQLabel(i18n("Screen size:"), sizeBox);
m_sizeCombo = new KComboBox(sizeBox);
TQWhatsThis::add(m_sizeCombo, i18n("The size, otherwise known as the resolution, of your screen can be selected from this drop-down list."));
- connect(m_sizeCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSizeChanged(int)));
+ connect(m_sizeCombo, TQ_SIGNAL(activated(int)), TQ_SLOT(slotSizeChanged(int)));
sizeLabel->setBuddy( m_sizeCombo );
TQHBox* refreshBox = new TQHBox(this);
@@ -118,10 +118,10 @@ KRandRModule::KRandRModule(TQWidget *parent, const char *name, const TQStringLis
TQLabel *rateLabel = new TQLabel(i18n("Refresh rate:"), refreshBox);
m_refreshRates = new KComboBox(refreshBox);
TQWhatsThis::add(m_refreshRates, i18n("The refresh rate of your screen can be selected from this drop-down list."));
- connect(m_refreshRates, TQT_SIGNAL(activated(int)), TQT_SLOT(slotRefreshChanged(int)));
+ connect(m_refreshRates, TQ_SIGNAL(activated(int)), TQ_SLOT(slotRefreshChanged(int)));
rateLabel->setBuddy( m_refreshRates );
- m_rotationGroup = new TQButtonGroup(2, Qt::Horizontal, i18n("Orientation (degrees counterclockwise)"), this);
+ m_rotationGroup = new TQButtonGroup(2, TQt::Horizontal, i18n("Orientation (degrees counterclockwise)"), this);
topLayout->addWidget(m_rotationGroup);
m_rotationGroup->setRadioButtonExclusive(true);
TQWhatsThis::add(m_rotationGroup, i18n("The options in this section allow you to change the rotation of your screen."));
@@ -129,14 +129,14 @@ KRandRModule::KRandRModule(TQWidget *parent, const char *name, const TQStringLis
m_applyOnStartup = new TQCheckBox(i18n("Apply settings on TDE startup"), this);
topLayout->addWidget(m_applyOnStartup);
TQWhatsThis::add(m_applyOnStartup, i18n("If this option is enabled the size and orientation settings will be used when TDE starts."));
- connect(m_applyOnStartup, TQT_SIGNAL(clicked()), TQT_SLOT(setChanged()));
+ connect(m_applyOnStartup, TQ_SIGNAL(clicked()), TQ_SLOT(setChanged()));
TQHBox* syncBox = new TQHBox(this);
syncBox->layout()->addItem(new TQSpacerItem(20, 1, TQSizePolicy::Maximum));
m_syncTrayApp = new TQCheckBox(i18n("Allow tray application to change startup settings"), syncBox);
topLayout->addWidget(syncBox);
TQWhatsThis::add(m_syncTrayApp, i18n("If this option is enabled, options set by the system tray applet will be saved and loaded when TDE starts instead of being temporary."));
- connect(m_syncTrayApp, TQT_SIGNAL(clicked()), TQT_SLOT(setChanged()));
+ connect(m_syncTrayApp, TQ_SIGNAL(clicked()), TQ_SLOT(setChanged()));
topLayout->addStretch(1);
@@ -155,11 +155,11 @@ void KRandRModule::addRotationButton(int thisRotation, bool checkbox)
if (!checkbox) {
TQRadioButton* thisButton = new TQRadioButton(RandRScreen::rotationName(thisRotation), m_rotationGroup);
thisButton->setEnabled(thisRotation & currentScreen()->rotations());
- connect(thisButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotRotationChanged()));
+ connect(thisButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotRotationChanged()));
} else {
TQCheckBox* thisButton = new TQCheckBox(RandRScreen::rotationName(thisRotation), m_rotationGroup);
thisButton->setEnabled(thisRotation & currentScreen()->rotations());
- connect(thisButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotRotationChanged()));
+ connect(thisButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotRotationChanged()));
}
}
diff --git a/kcontrol/randr/tderandrmodule.h b/kcontrol/randr/tderandrmodule.h
index 65131ee26..73a13b623 100644
--- a/kcontrol/randr/tderandrmodule.h
+++ b/kcontrol/randr/tderandrmodule.h
@@ -27,7 +27,7 @@ class TQCheckBox;
class KRandRModule : public TDECModule, public KRandrSimpleAPI
{
- Q_OBJECT
+ TQ_OBJECT
public:
KRandRModule(TQWidget *parent, const char *name, const TQStringList& _args);
diff --git a/kcontrol/randr/tderandrpassivepopup.cpp b/kcontrol/randr/tderandrpassivepopup.cpp
index 5d2010f94..8dad337b7 100644
--- a/kcontrol/randr/tderandrpassivepopup.cpp
+++ b/kcontrol/randr/tderandrpassivepopup.cpp
@@ -28,7 +28,7 @@
KRandrPassivePopup::KRandrPassivePopup( TQWidget *parent, const char *name, WFlags f )
: KPassivePopup( parent, name, f )
{
- connect( &update_timer, TQT_SIGNAL( timeout()), TQT_SLOT( slotPositionSelf()));
+ connect( &update_timer, TQ_SIGNAL( timeout()), TQ_SLOT( slotPositionSelf()));
}
KRandrPassivePopup* KRandrPassivePopup::message( const TQString &caption, const TQString &text,
@@ -88,14 +88,14 @@ void KRandrPassivePopup::startWatchingWidget( TQWidget* widget_P )
}
}
if( x11_events )
- kapp->installX11EventFilter( this );
+ tdeApp->installX11EventFilter( this );
}
bool KRandrPassivePopup::eventFilter( TQObject* o, TQEvent* e )
{
if( e->type() == TQEvent::Move && o->isWidgetType()
- && watched_widgets.contains( TQT_TQWIDGET( o )))
- TQTimer::singleShot( 0, this, TQT_SLOT( slotPositionSelf()));
+ && watched_widgets.contains( static_cast<TQWidget*>( o )))
+ TQTimer::singleShot( 0, this, TQ_SLOT( slotPositionSelf()));
return false;
}
diff --git a/kcontrol/randr/tderandrpassivepopup.h b/kcontrol/randr/tderandrpassivepopup.h
index 3b1d4b4f6..87dac8c0d 100644
--- a/kcontrol/randr/tderandrpassivepopup.h
+++ b/kcontrol/randr/tderandrpassivepopup.h
@@ -27,7 +27,7 @@
class KRandrPassivePopup
: public KPassivePopup
{
- Q_OBJECT
+ TQ_OBJECT
public:
static KRandrPassivePopup *message( const TQString &caption, const TQString &text,
const TQPixmap &icon, TQWidget *parent, const char *name=0, int timeout = -1 );
diff --git a/kcontrol/randr/tderandrtray.cpp b/kcontrol/randr/tderandrtray.cpp
index a443c3781..0506639e3 100644
--- a/kcontrol/randr/tderandrtray.cpp
+++ b/kcontrol/randr/tderandrtray.cpp
@@ -16,6 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <tqtimer.h>
#include <tqimage.h>
#include <tqtooltip.h>
@@ -32,7 +36,7 @@
#include <kstdguiitem.h>
#include <tdeglobal.h>
#include <tdemessagebox.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
#include <cstdlib>
#include <unistd.h>
@@ -55,15 +59,15 @@ KRandRSystemTray::KRandRSystemTray(TQWidget* parent, const char *name)
, m_help(new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false, actionCollection()))
{
TDEPopupMenu *help = m_help->menu();
- help->connectItem(KHelpMenu::menuHelpContents, this, TQT_SLOT(slotHelpContents()));
+ help->connectItem(KHelpMenu::menuHelpContents, this, TQ_SLOT(slotHelpContents()));
setPixmap(KSystemTray::loadIcon("randr"));
- setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
- connect(this, TQT_SIGNAL(quitSelected()), this, TQT_SLOT(_quit()));
+ setAlignment(TQt::AlignHCenter | TQt::AlignVCenter);
+ connect(this, TQ_SIGNAL(quitSelected()), this, TQ_SLOT(_quit()));
TQToolTip::add(this, i18n("Screen resize & rotate"));
my_parent = parent;
//printf("Reading configuration...\n");
- globalKeys = new TDEGlobalAccel(TQT_TQOBJECT(this));
+ globalKeys = new TDEGlobalAccel(this);
TDEGlobalAccel* keys = globalKeys;
#include "tderandrbindings.cpp"
// the keys need to be read from kdeglobals, not kickerrc
@@ -71,10 +75,10 @@ KRandRSystemTray::KRandRSystemTray(TQWidget* parent, const char *name)
globalKeys->setEnabled(true);
globalKeys->updateConnections();
- connect(kapp, TQT_SIGNAL(settingsChanged(int)), TQT_SLOT(slotSettingsChanged(int)));
+ connect(tdeApp, TQ_SIGNAL(settingsChanged(int)), TQ_SLOT(slotSettingsChanged(int)));
#if (TQT_VERSION-0 >= 0x030200) // XRANDR support
-// connect(this, TQT_SIGNAL(screenSizeChanged(int, int)), kapp->desktop(), TQT_SLOT( desktopResized()));
+// connect(this, TQ_SIGNAL(screenSizeChanged(int, int)), tdeApp->desktop(), TQ_SLOT( desktopResized()));
#endif
randr_display = XOpenDisplay(NULL);
@@ -84,7 +88,7 @@ KRandRSystemTray::KRandRSystemTray(TQWidget* parent, const char *name)
last_known_y = currentScreen()->currentPixelHeight();
}
- t_config = new KSimpleConfig("kiccconfigrc");
+ t_config = new TDESimpleConfig("kiccconfigrc");
TQString cur_profile;
cur_profile = getCurrentProfile();
@@ -92,19 +96,19 @@ KRandRSystemTray::KRandRSystemTray(TQWidget* parent, const char *name)
applyIccConfiguration(cur_profile, NULL);
}
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef WITH_TDEHWLIB
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
- connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*)));
+ connect(hwdevices, TQ_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQ_SLOT(deviceChanged(TDEGenericDevice*)));
#endif
}
/*!
- * \b TQT_SLOT which called if tderandrtray is exited by the user. In this case the user
+ * \b TQ_SLOT which called if tderandrtray is exited by the user. In this case the user
* is asked through a yes/no box if "KRandRTray should start automatically on log in" and the
* result is written to the KDE configfile.
*/
void KRandRSystemTray::_quit (){
- r_config = new KSimpleConfig("tderandrtrayrc");
+ r_config = new TDESimpleConfig("tderandrtrayrc");
TQString tmp1 = i18n ("Start KRandRTray automatically when you log in?");
int tmp2 = KMessageBox::questionYesNo ( 0, tmp1, i18n("Question"), i18n("Start Automatically"), i18n("Do Not Start"));
@@ -143,7 +147,7 @@ void KRandRSystemTray::showEvent ( TQShowEvent * )
void KRandRSystemTray::mousePressEvent(TQMouseEvent* e)
{
// Popup the context menu with left-click
- if (e->button() == Qt::LeftButton) {
+ if (e->button() == TQt::LeftButton) {
contextMenuAboutToShow(contextMenu());
contextMenu()->popup(e->globalPos());
e->accept();
@@ -191,15 +195,15 @@ void KRandRSystemTray::reloadDisplayConfiguration()
if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
continue;
}
-
+
// Activate this output
randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc;
randr_screen_info->cur_output = randr_screen_info->outputs[i];
randr_screen_info->cur_output->auto_set = 1;
randr_screen_info->cur_output->off_set = 0;
output_auto (randr_screen_info, randr_screen_info->cur_output);
- i=main_low_apply(randr_screen_info);
-
+ main_low_apply(randr_screen_info);
+
if (randr_screen_info->outputs[i]->cur_crtc) {
// Output successfully activated!
set_primary_output(randr_screen_info, randr_screen_info->cur_output->id);
@@ -249,25 +253,28 @@ void KRandRSystemTray::contextMenuAboutToShow(TDEPopupMenu* menu)
menu->setCheckable(true);
bool valid = isValid();
-
- if (!valid) {
+ if (!valid)
+ {
lastIndex = menu->insertItem(i18n("Required X Extension Not Available"));
menu->setItemEnabled(lastIndex, false);
-
}
- else {
+ else
+ {
m_screenPopups.clear();
- for (int s = 0; s < numScreens() /*&& numScreens() > 1 */; s++) {
- setCurrentScreen(s);
- if (s == screenIndexOfWidget(this)) {
- /*lastIndex = menu->insertItem(i18n("Screen %1").arg(s+1));
- menu->setItemEnabled(lastIndex, false);*/
- } else {
- TDEPopupMenu* subMenu = new TDEPopupMenu(menu, TQString("screen%1").arg(s+1).latin1());
- m_screenPopups.append(subMenu);
- populateMenu(subMenu);
- lastIndex = menu->insertItem(i18n("Screen %1").arg(s+1), subMenu);
- connect(subMenu, TQT_SIGNAL(activated(int)), TQT_SLOT(slotScreenActivated()));
+ if (numScreens() > 1)
+ {
+ int screenOfWidget = screenIndexOfWidget(this);
+ for (int s = 0; s < numScreens(); s++)
+ {
+ setCurrentScreen(s);
+ if (s != screenOfWidget)
+ {
+ TDEPopupMenu *subMenu = new TDEPopupMenu(menu, TQString("screen%1").arg(s+1).latin1());
+ m_screenPopups.append(subMenu);
+ populateMenu(subMenu);
+ lastIndex = menu->insertItem(i18n("Screen %1").arg(s+1), subMenu);
+ connect(subMenu, TQ_SIGNAL(activated(int)), TQ_SLOT(slotScreenActivated()));
+ }
}
}
@@ -278,52 +285,52 @@ void KRandRSystemTray::contextMenuAboutToShow(TDEPopupMenu* menu)
addOutputMenu(menu);
// Find any user ICC profiles
- TQStringList cfgProfiles;
- cfgProfiles = t_config->groupList();
- if (cfgProfiles.isEmpty() == false) {
- menu->insertTitle(SmallIcon("kcoloredit"), i18n("Color Profile"));
- }
- for (TQStringList::Iterator t(cfgProfiles.begin()); t != cfgProfiles.end(); ++t) {
- lastIndex = menu->insertItem(*t);
- if (t_config->readEntry("CurrentProfile") == (*t)) {
- menu->setItemChecked(lastIndex, true);
+ TQStringList cfgProfiles = t_config->groupList();
+ if (!cfgProfiles.isEmpty())
+ {
+ TDEPopupMenu *profileMenu = new TDEPopupMenu(menu);
+ for (TQStringList::Iterator t(cfgProfiles.begin()); t != cfgProfiles.end(); ++t)
+ {
+ lastIndex = profileMenu->insertItem(*t);
+ if (t_config->readEntry("CurrentProfile") == (*t))
+ {
+ profileMenu->setItemChecked(lastIndex, true);
+ }
+ profileMenu->setItemEnabled(lastIndex, t_config->readBoolEntry("EnableICC", false));
+ profileMenu->connectItem(lastIndex, this, TQ_SLOT(slotColorProfileChanged(int)));
}
- menu->setItemEnabled(lastIndex, t_config->readBoolEntry("EnableICC", false));
- menu->connectItem(lastIndex, this, TQT_SLOT(slotColorProfileChanged(int)));
+ menu->insertItem(SmallIcon("kcoloredit"), i18n("Color Profile"), profileMenu);
}
- if (valid) {
+ if (valid)
+ {
// Find any display profiles
- TQStringList displayProfiles;
- displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true));
- if (!displayProfiles.isEmpty()) {
- menu->insertTitle(SmallIcon("background"), i18n("Display Profiles"));
- lastIndex = menu->insertItem(SmallIcon("bookmark"), "<default>");
- menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int)));
- for (TQStringList::Iterator t(displayProfiles.begin()); t != displayProfiles.end(); ++t) {
- lastIndex = menu->insertItem(SmallIcon("bookmark"), *t);
- menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int)));
+ TQStringList displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true));
+ if (!displayProfiles.isEmpty())
+ {
+ TDEPopupMenu *displayProfileMenu = new TDEPopupMenu(menu);
+ lastIndex = displayProfileMenu->insertItem(SmallIcon("bookmark"), "<default>");
+ displayProfileMenu->connectItem(lastIndex, this, TQ_SLOT(slotDisplayProfileChanged(int)));
+ for (TQStringList::Iterator t(displayProfiles.begin()); t != displayProfiles.end(); ++t)
+ {
+ lastIndex = displayProfileMenu->insertItem(SmallIcon("bookmark"), *t);
+ displayProfileMenu->connectItem(lastIndex, this, TQ_SLOT(slotDisplayProfileChanged(int)));
}
+ menu->insertItem(SmallIcon("background"), i18n("Display Profiles"), displayProfileMenu);
}
}
- menu->insertTitle(SmallIcon("randr"), i18n("Global Configuration"));
-
- TDEAction *actColors = new TDEAction( i18n( "Configure Displays..." ),
- SmallIconSet( "configure" ), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotDisplayConfig() ),
- actionCollection() );
- actColors->plug( menu );
-
-// TDEAction *actPrefs = new TDEAction( i18n( "Configure Display..." ),
-// SmallIconSet( "configure" ), TDEShortcut(), this, TQT_SLOT( slotPrefs() ),
-// actionCollection() );
-// actPrefs->plug( menu );
-
- TDEAction *actSKeys = new TDEAction( i18n( "Configure Shortcut Keys..." ),
- SmallIconSet( "configure" ), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotSKeys() ),
- actionCollection() );
- actSKeys->plug( menu );
+ // Config menu
+ TDEPopupMenu *configMenu = new TDEPopupMenu(menu);
+ TDEAction *actColors = new TDEAction(i18n("Configure Displays..."), SmallIconSet("configure"),
+ TDEShortcut(), this, TQ_SLOT(slotDisplayConfig()), actionCollection());
+ actColors->plug(configMenu);
+ TDEAction *actSKeys = new TDEAction(i18n("Configure Shortcut Keys..."), SmallIconSet("configure"),
+ TDEShortcut(), this, TQ_SLOT(slotSKeys()), actionCollection());
+ actSKeys->plug(configMenu);
+ menu->insertItem(SmallIcon("randr"), i18n("Global Configuration"), configMenu);
+ menu->insertSeparator();
menu->insertItem(SmallIcon("help"),KStdGuiItem::help().text(), m_help->menu());
TDEAction *quitAction = actionCollection()->action(KStdAction::name(KStdAction::Quit));
quitAction->plug(menu);
@@ -407,74 +414,85 @@ int KRandRSystemTray::GetHackResolutionParameter() {
return resparm;
}
-void KRandRSystemTray::populateMenu(TDEPopupMenu* menu)
+void KRandRSystemTray::populateMenu(TDEPopupMenu *menu)
{
- int lastIndex = 0;
-
- menu->insertTitle(SmallIcon("view-fullscreen"), i18n("Screen Size"));
+ int lastIndex;
int numSizes = currentScreen()->numSizes();
- int* sizeSort = new int[numSizes];
-
- for (int i = 0; i < numSizes; i++) {
+ int *sizeSort = new int[numSizes];
+ for (int i = 0; i < numSizes; i++)
+ {
sizeSort[i] = currentScreen()->pixelCount(i);
}
- for (int j = 0; j < numSizes; j++) {
- int highest = -1, highestIndex = -1;
-
- for (int i = 0; i < numSizes; i++) {
- if (sizeSort[i] && sizeSort[i] > highest) {
+ TDEPopupMenu *screenSizeMenu = new TDEPopupMenu(menu);
+ for (int j = 0; j < numSizes; j++)
+ {
+ int highest = 0, highestIndex = -1;
+ for (int i = 0; i < numSizes; i++)
+ {
+ if (sizeSort[i] > highest)
+ {
highest = sizeSort[i];
highestIndex = i;
}
}
- sizeSort[highestIndex] = -1;
Q_ASSERT(highestIndex != -1);
+ sizeSort[highestIndex] = 0;
- lastIndex = menu->insertItem(i18n("%1 x %2").arg(currentScreen()->pixelSize(highestIndex).width()).arg(currentScreen()->pixelSize(highestIndex).height()));
-
+ lastIndex = screenSizeMenu->insertItem(i18n("%1 x %2").arg(currentScreen()->pixelSize(highestIndex).width()).arg(currentScreen()->pixelSize(highestIndex).height()));
if (currentScreen()->proposedSize() == highestIndex)
- menu->setItemChecked(lastIndex, true);
+ {
+ screenSizeMenu->setItemChecked(lastIndex, true);
+ }
- menu->setItemParameter(lastIndex, highestIndex);
- menu->connectItem(lastIndex, this, TQT_SLOT(slotResolutionChanged(int)));
+ screenSizeMenu->setItemParameter(lastIndex, highestIndex);
+ screenSizeMenu->connectItem(lastIndex, this, TQ_SLOT(slotResolutionChanged(int)));
}
delete [] sizeSort;
- sizeSort = 0L;
+ sizeSort = nullptr;
+
+ menu->insertItem(SmallIcon("view-fullscreen"), i18n("Screen Size"), screenSizeMenu);
// Don't display the rotation options if there is no point (ie. none are supported)
// XFree86 4.3 does not include rotation support.
- if (currentScreen()->rotations() != RandRScreen::Rotate0) {
- menu->insertTitle(SmallIcon("reload"), i18n("Orientation"));
-
- for (int i = 0; i < 6; i++) {
- if ((1 << i) & currentScreen()->rotations()) {
- lastIndex = menu->insertItem(currentScreen()->rotationIcon(1 << i), RandRScreen::rotationName(1 << i));
-
+ if (currentScreen()->rotations() != RandRScreen::Rotate0)
+ {
+ TDEPopupMenu *orientationMenu = new TDEPopupMenu(menu);
+ for (int i = 0; i < 6; i++)
+ {
+ if ((1 << i) & currentScreen()->rotations())
+ {
+ lastIndex = orientationMenu->insertItem(currentScreen()->rotationIcon(1 << i), RandRScreen::rotationName(1 << i));
if (currentScreen()->proposedRotation() & (1 << i))
- menu->setItemChecked(lastIndex, true);
+ {
+ orientationMenu->setItemChecked(lastIndex, true);
+ }
- menu->setItemParameter(lastIndex, 1 << i);
- menu->connectItem(lastIndex, this, TQT_SLOT(slotOrientationChanged(int)));
+ orientationMenu->setItemParameter(lastIndex, 1 << i);
+ orientationMenu->connectItem(lastIndex, this, TQ_SLOT(slotOrientationChanged(int)));
}
}
+ menu->insertItem(SmallIcon("reload"), i18n("Orientation"), orientationMenu);
}
TQStringList rr = currentScreen()->refreshRates(currentScreen()->proposedSize());
-
if (rr.count())
- menu->insertTitle(SmallIcon("clock"), i18n("Refresh Rate"));
-
- int i = 0;
- for (TQStringList::Iterator it = rr.begin(); it != rr.end(); ++it, i++) {
- lastIndex = menu->insertItem(*it);
-
- if (currentScreen()->proposedRefreshRate() == i)
- menu->setItemChecked(lastIndex, true);
+ {
+ TDEPopupMenu *refreshRatesMenu = new TDEPopupMenu(menu);
+ int i = 0;
+ for (TQStringList::Iterator it = rr.begin(); it != rr.end(); ++it, i++)
+ {
+ lastIndex = refreshRatesMenu->insertItem(*it);
+ if (currentScreen()->proposedRefreshRate() == i)
+ {
+ refreshRatesMenu->setItemChecked(lastIndex, true);
+ }
- menu->setItemParameter(lastIndex, i);
- menu->connectItem(lastIndex, this, TQT_SLOT(slotRefreshRateChanged(int)));
+ refreshRatesMenu->setItemParameter(lastIndex, i);
+ refreshRatesMenu->connectItem(lastIndex, this, TQ_SLOT(slotRefreshRateChanged(int)));
+ }
+ menu->insertItem(SmallIcon("clock"), i18n("Refresh Rate"), refreshRatesMenu);
}
}
@@ -734,86 +752,89 @@ void KRandRSystemTray::findPrimaryDisplay()
}
}
-void KRandRSystemTray::addOutputMenu(TDEPopupMenu* menu)
+void KRandRSystemTray::addOutputMenu(TDEPopupMenu *menu)
{
XRROutputInfo *output_info;
char *output_name;
- int i;
int lastIndex = 0;
int connected_displays = 0;
- if (isValid() == true) {
- menu->insertTitle(SmallIcon("kcmkwm"), i18n("Output Port"));
+ if (isValid())
+ {
+ TDEPopupMenu *outputMenu = new TDEPopupMenu(menu);
- for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for active (i.e. switched on) outputs
+ for (int 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) {
+ if (!randr_screen_info->outputs[i]->cur_crtc)
+ {
continue;
}
- if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection)
+ {
continue;
}
output_name = output_info->name;
- //printf("ON: Found output %s\n", output_name);
-
- lastIndex = menu->insertItem(i18n("%1 (Active)").arg(output_name));
- menu->setItemChecked(lastIndex, true);
- menu->connectItem(lastIndex, this, TQT_SLOT(slotOutputChanged(int)));
- menu->setItemParameter(lastIndex, i);
+ lastIndex = outputMenu->insertItem(i18n("%1 (Active)").arg(output_name));
+ outputMenu->setItemChecked(lastIndex, true);
+ outputMenu->connectItem(lastIndex, this, TQ_SLOT(slotOutputChanged(int)));
+ outputMenu->setItemParameter(lastIndex, i);
connected_displays++;
}
- for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for inactive (i.e. switched off) but connected outputs
+ for (int i = 0; i < randr_screen_info->n_output; i++)
+ {
output_info = randr_screen_info->outputs[i]->info;
- // Look for CONNECTED outputs....
- if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection)
+ {
continue;
}
- // ...that are not ON
- if (randr_screen_info->outputs[i]->cur_crtc) {
+ if (randr_screen_info->outputs[i]->cur_crtc)
+ {
continue;
}
output_name = output_info->name;
- //printf("CONNECTED, NOT ON: Found output %s\n", output_name);
-
- lastIndex = menu->insertItem(i18n("%1 (Connected, Inactive)").arg(output_name));
- menu->setItemChecked(lastIndex, false);
- menu->connectItem(lastIndex, this, TQT_SLOT(slotOutputChanged(int)));
- menu->setItemParameter(lastIndex, i);
+ lastIndex = outputMenu->insertItem(i18n("%1 (Connected, Inactive)").arg(output_name));
+ outputMenu->setItemChecked(lastIndex, false);
+ outputMenu->connectItem(lastIndex, this, TQ_SLOT(slotOutputChanged(int)));
+ outputMenu->setItemParameter(lastIndex, i);
connected_displays++;
}
- for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for all outputs that are not connected
+ for (int i = 0; i < randr_screen_info->n_output; i++)
+ {
output_info = randr_screen_info->outputs[i]->info;
- // Look for ALL outputs that are not connected....
- if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) {
+ if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection)
+ {
continue;
}
- // ...or ON
- if (randr_screen_info->outputs[i]->cur_crtc) {
+ if (randr_screen_info->outputs[i]->cur_crtc)
+ {
continue;
}
output_name = output_info->name;
- //printf("DISCONNECTED, NOT ON: Found output %s\n", output_name);
-
- lastIndex = menu->insertItem(i18n("%1 (Disconnected, Inactive)").arg(output_name));
- menu->setItemChecked(lastIndex, false);
- menu->setItemEnabled(lastIndex, false);
- menu->connectItem(lastIndex, this, TQT_SLOT(slotOutputChanged(int)));
- menu->setItemParameter(lastIndex, i);
+ lastIndex = outputMenu->insertItem(i18n("%1 (Disconnected, Inactive)").arg(output_name));
+ outputMenu->setItemChecked(lastIndex, false);
+ outputMenu->setItemEnabled(lastIndex, false);
+ outputMenu->connectItem(lastIndex, this, TQ_SLOT(slotOutputChanged(int)));
+ outputMenu->setItemParameter(lastIndex, i);
}
- lastIndex = menu->insertItem(SmallIcon("forward"), i18n("Next available output"));
- if (connected_displays < 2) {
- menu->setItemEnabled(lastIndex, false);
+ if (connected_displays >= 2)
+ {
+ lastIndex = outputMenu->insertItem(SmallIcon("forward"), i18n("Next available output"));
+ outputMenu->connectItem(lastIndex, this, TQ_SLOT(slotCycleDisplays()));
}
- menu->connectItem(lastIndex, this, TQT_SLOT(slotCycleDisplays()));
+
+ menu->insertItem(SmallIcon("kcmkwm"), i18n("Output Port"), outputMenu);
}
}
@@ -830,7 +851,7 @@ void KRandRSystemTray::slotDisplayProfileChanged(int parameter)
profileName = "";
}
TQPtrList<SingleScreenData> profileData = loadDisplayConfiguration(profileName, locateLocal("config", "/", true));
- applyDisplayConfiguration(profileData, TRUE, locateLocal("config", "/", true));
+ applyDisplayConfiguration(profileData, true, locateLocal("config", "/", true));
destroyScreenInformationObject(profileData);
}
@@ -858,7 +879,7 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
randr_screen_info->cur_output->auto_set = 1;
randr_screen_info->cur_output->off_set = 0;
output_auto (randr_screen_info, randr_screen_info->cur_output);
- i=main_low_apply(randr_screen_info);
+ main_low_apply(randr_screen_info);
if (!randr_screen_info->outputs[parameter]->cur_crtc) {
output_name = randr_screen_info->outputs[parameter]->info->name;
@@ -873,7 +894,7 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
randr_screen_info->cur_output->auto_set = 0;
randr_screen_info->cur_output->off_set = 1;
output_off(randr_screen_info, randr_screen_info->cur_output);
- i=main_low_apply(randr_screen_info);
+ main_low_apply(randr_screen_info);
findPrimaryDisplay();
refresh();
@@ -888,7 +909,7 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
}
void KRandRSystemTray::deviceChanged (TDEGenericDevice* device) {
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef WITH_TDEHWLIB
if (device->type() == TDEGenericDeviceType::Monitor) {
KRandrPassivePopup::message(
i18n("New display output options are available!"),
@@ -903,6 +924,6 @@ void KRandRSystemTray::deviceChanged (TDEGenericDevice* device) {
void KRandRSystemTray::slotHelpContents()
{
- kapp->invokeHelp(TQString::null, "tderandrtray");
+ tdeApp->invokeHelp(TQString::null, "tderandrtray");
}
diff --git a/kcontrol/randr/tderandrtray.h b/kcontrol/randr/tderandrtray.h
index 334e1ef31..5d6e16053 100644
--- a/kcontrol/randr/tderandrtray.h
+++ b/kcontrol/randr/tderandrtray.h
@@ -22,9 +22,9 @@
#include <tqptrlist.h>
#include <ksystemtray.h>
-#include <kglobalaccel.h>
+#include <tdeglobalaccel.h>
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef WITH_TDEHWLIB
#include <tdehardwaredevices.h>
#else
#define TDEGenericDevice void
@@ -37,7 +37,7 @@ class TDEPopupMenu;
class KRandRSystemTray : public KSystemTray, public KRandrSimpleAPI
{
- Q_OBJECT
+ TQ_OBJECT
public:
KRandRSystemTray(TQWidget* parent = 0, const char *name = 0);
@@ -91,8 +91,8 @@ private:
int last_known_y;
TDEPopupMenu* m_menu;
- KSimpleConfig *r_config;
- KSimpleConfig *t_config;
+ TDESimpleConfig *r_config;
+ TDESimpleConfig *t_config;
private slots:
void _quit();