diff options
Diffstat (limited to 'superkaramba/src')
66 files changed, 512 insertions, 368 deletions
diff --git a/superkaramba/src/CMakeLists.txt b/superkaramba/src/CMakeLists.txt index 211ee0c..c38d41b 100644 --- a/superkaramba/src/CMakeLists.txt +++ b/superkaramba/src/CMakeLists.txt @@ -53,8 +53,8 @@ tde_add_executable( superkaramba AUTOMOC sknewstuff.h sknewstuff.cpp superkarambasettings.kcfgc themelocale.cpp input.cpp sklineedit.cpp input_python.cpp - svcgrp_python.cpp - LINK tdeio-shared ${PYTHON_LIBRARIES} + svcgrp_python.cpp gpusensor.cpp + LINK tdeio-shared ${PYTHON_LIBRARIES} ${TDENEWSTUFF_LIBRARIES} ${LIBKVM_LIBRARIES} DESTINATION ${BIN_INSTALL_DIR} diff --git a/superkaramba/src/bar.h b/superkaramba/src/bar.h index 3c0562a..09dbd96 100644 --- a/superkaramba/src/bar.h +++ b/superkaramba/src/bar.h @@ -17,7 +17,7 @@ class Bar : public Meter { -Q_OBJECT +TQ_OBJECT public: Bar(karamba* k,int ix,int iy,int iw,int ih ); diff --git a/superkaramba/src/clickarea.cpp b/superkaramba/src/clickarea.cpp index a49e4c7..2377aaf 100644 --- a/superkaramba/src/clickarea.cpp +++ b/superkaramba/src/clickarea.cpp @@ -31,7 +31,7 @@ bool ClickArea::click( TQMouseEvent *e ) { //tqDebug(TQString::number(e->type())); //KShellProcess ksp; - if( e->button() != Qt::LeftButton ) + if( e->button() != TQt::LeftButton ) return false; if (!svc_name.isEmpty()) { diff --git a/superkaramba/src/clickarea.h b/superkaramba/src/clickarea.h index d062da1..9aeb221 100644 --- a/superkaramba/src/clickarea.h +++ b/superkaramba/src/clickarea.h @@ -27,8 +27,8 @@ #include <tqevent.h> #include <tqregexp.h> -#include <kprocess.h> -#include <kprocio.h> +#include <tdeprocess.h> +#include <tdeprocio.h> #include <krun.h> #include <meter.h> @@ -39,7 +39,7 @@ **/ class ClickArea : public Meter { - Q_OBJECT + TQ_OBJECT public: ClickArea(karamba* k, int x, int y, int w, int h ); diff --git a/superkaramba/src/clickmap.h b/superkaramba/src/clickmap.h index 33fbf0e..98d68dd 100644 --- a/superkaramba/src/clickmap.h +++ b/superkaramba/src/clickmap.h @@ -22,7 +22,7 @@ **/ class ClickMap : public Meter { -Q_OBJECT +TQ_OBJECT public: ClickMap(karamba* k, int x, int y, int w, int h); diff --git a/superkaramba/src/config_python.cpp b/superkaramba/src/config_python.cpp index 0b9b34b..1a094eb 100644 --- a/superkaramba/src/config_python.cpp +++ b/superkaramba/src/config_python.cpp @@ -172,7 +172,7 @@ PyObject* py_read_config_entry(PyObject *, PyObject *args) return Py_BuildValue((char*)"l", i); } - if (type == TQSTRING_OBJECT_NAME_STRING) + if (type == "TQString") { return Py_BuildValue((char*)"s", entry.toString().ascii()); } diff --git a/superkaramba/src/cpusensor.h b/superkaramba/src/cpusensor.h index e239edb..0d02334 100644 --- a/superkaramba/src/cpusensor.h +++ b/superkaramba/src/cpusensor.h @@ -16,7 +16,7 @@ class CPUSensor : public Sensor { - Q_OBJECT + TQ_OBJECT public: CPUSensor( TQString cpuNbr, int interval ); diff --git a/superkaramba/src/datesensor.cpp b/superkaramba/src/datesensor.cpp index ca5e6e6..24e4675 100644 --- a/superkaramba/src/datesensor.cpp +++ b/superkaramba/src/datesensor.cpp @@ -87,7 +87,7 @@ void DateSensor::toggleCalendar(TQMouseEvent *ev) hidden = false; cal = new DatePicker(0); - connect(cal, TQT_SIGNAL(destroyed()), TQT_SLOT(slotCalendarDeleted())); + connect(cal, TQ_SIGNAL(destroyed()), TQ_SLOT(slotCalendarDeleted())); TQPoint c = (TQPoint(ev->x(), ev->y())); int w = cal->sizeHint().width(); @@ -117,7 +117,7 @@ void DateSensor::mousePressEvent(TQMouseEvent *ev) { switch (ev->button()) { - case Qt::LeftButton: + case TQt::LeftButton: toggleCalendar(ev); break; default: diff --git a/superkaramba/src/datesensor.h b/superkaramba/src/datesensor.h index 67c66db..b0cbdfc 100644 --- a/superkaramba/src/datesensor.h +++ b/superkaramba/src/datesensor.h @@ -26,7 +26,7 @@ private: class DateSensor : public Sensor { -Q_OBJECT +TQ_OBJECT public: DateSensor( int interval ); diff --git a/superkaramba/src/disksensor.cpp b/superkaramba/src/disksensor.cpp index e16d415..55f692a 100644 --- a/superkaramba/src/disksensor.cpp +++ b/superkaramba/src/disksensor.cpp @@ -13,20 +13,20 @@ #include <tqtextstream.h> #include <tqstring.h> #include <tqregexp.h> -#include <kprocess.h> -#include <kprocio.h> +#include <tdeprocess.h> +#include <tdeprocio.h> DiskSensor::DiskSensor( int msec ) : Sensor( msec ) { - connect(&ksp, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int )), - this,TQT_SLOT(receivedStdout(TDEProcess *, char *, int ))); - connect(&ksp, TQT_SIGNAL(processExited(TDEProcess *)), - this,TQT_SLOT(processExited( TDEProcess * ))); + connect(&ksp, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int )), + this,TQ_SLOT(receivedStdout(TDEProcess *, char *, int ))); + connect(&ksp, TQ_SIGNAL(processExited(TDEProcess *)), + this,TQ_SLOT(processExited( TDEProcess * ))); // update values on startup ksp.clearArguments(); ksp << "df"; - ksp.start( KProcIO::Block,KProcIO::Stdout); + ksp.start( TDEProcIO::Block,TDEProcIO::Stdout); init = 1; } DiskSensor::~DiskSensor() @@ -153,7 +153,7 @@ void DiskSensor::update() { ksp.clearArguments(); ksp << "df"; - ksp.start( KProcIO::NotifyOnExit,KProcIO::Stdout); + ksp.start( TDEProcIO::NotifyOnExit,TDEProcIO::Stdout); } void DiskSensor::setMaxValue( SensorParams *sp ) diff --git a/superkaramba/src/disksensor.h b/superkaramba/src/disksensor.h index 7207dd2..eddbb27 100644 --- a/superkaramba/src/disksensor.h +++ b/superkaramba/src/disksensor.h @@ -15,10 +15,10 @@ #include <tqtextcodec.h> #include <tqregexp.h> #include <tqstringlist.h> -#include <kprocess.h> +#include <tdeprocess.h> class DiskSensor : public Sensor { -Q_OBJECT +TQ_OBJECT public: DiskSensor(int msec ); diff --git a/superkaramba/src/gpusensor.cpp b/superkaramba/src/gpusensor.cpp new file mode 100644 index 0000000..120e5f4 --- /dev/null +++ b/superkaramba/src/gpusensor.cpp @@ -0,0 +1,129 @@ +/******************************************************************************* + GPU sensor + Copyright (C) 2024 Mavridis Philippe <mavridisf@gmail.com> + + 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 3 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. If not, see <http://www.gnu.org/licenses/>. + + Improvements and feedback are welcome! +*******************************************************************************/ + +// TQt +#include <tqregexp.h> + +// TDE +#include <tdestandarddirs.h> +#include <kdebug.h> + +// Superkaramba +#include "gpusensor.h" + +GPUSensor::GPUSensor(TQString gpuDriver, TQString gpuId, int interval) + : Sensor(interval), m_gpuDriver(gpuDriver), m_gpuId(gpuId) +{ + if (m_gpuDriver.lower() == "nvidia") + { + TQString nvsmi = TDEStandardDirs::findExe("nvidia-smi"); + if (nvsmi.isNull()) + { + kdError() << "The NVidia System Management Interface software is not avaiable." << endl; + return; + } + + m_command << nvsmi << "--query-gpu" << "utilization.gpu" + << "--format=csv,noheader"; + + if (!m_gpuId.isNull()) + { + m_command << TQString("--id=%1").arg(m_gpuId); + } + } + + else + { + kdError() << "Unsupported driver specified for GPU sensor (" << m_gpuDriver << ");" << endl + << "\tSupported drivers are: nvidia" << endl; + } + + connect(&m_proc, TQ_SIGNAL(receivedStdout(TDEProcess*, char*, int)), + this, TQ_SLOT(receivedStdout(TDEProcess*, char*, int))); + connect(&m_proc, TQ_SIGNAL(processExited(TDEProcess*)), + this, TQ_SLOT(processExited(TDEProcess*))); +} + +GPUSensor::~GPUSensor() +{ +} + +void GPUSensor::update() +{ + if (m_command.isEmpty()) return; + + m_proc.clearArguments(); + m_proc << m_command; + + m_proc.start(TDEProcess::NotifyOnExit, TDEProcess::Stdout); +} + +void GPUSensor::receivedStdout(TDEProcess *proc, char *buffer, int buflen) +{ + buffer[buflen] = 0; + m_buffer += TQCString(buffer); +} + +TQString GPUSensor::getLoad() +{ + if (m_gpuDriver.lower() == "nvidia") + { + return m_buffer.left(m_buffer.length() - 3); + } + + return TQString::null; +} + +#define SUB_FORMAT_STR(fstring, value) \ + format.replace(TQRegExp(#fstring, false), value) +void GPUSensor::processExited(TDEProcess *proc) +{ + SensorParams *sp; + Meter *meter; + TQString format; + TQString load = getLoad(); + m_buffer = TQString::null; + + TQObjectListIt it(*objList); + while (it != 0) + { + sp = (SensorParams*)(*it); + meter = sp->getMeter(); + format = sp->getParam("FORMAT"); + + if( format.length() == 0) + { + format = "%v"; + } + + SUB_FORMAT_STR(%load, load); + SUB_FORMAT_STR(%v, load); + + meter->setValue(format); + ++it; + } +} + +#undef SUB_FORMAT_STR + +void GPUSensor::setMaxValue(SensorParams *sp) +{ + sp->getMeter()->setMax(100); +} + +#include "gpusensor.moc"
\ No newline at end of file diff --git a/superkaramba/src/gpusensor.h b/superkaramba/src/gpusensor.h new file mode 100644 index 0000000..c03eb59 --- /dev/null +++ b/superkaramba/src/gpusensor.h @@ -0,0 +1,52 @@ +/******************************************************************************* + GPU sensor + Copyright (C) 2024 Mavridis Philippe <mavridisf@gmail.com> + + 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 3 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. If not, see <http://www.gnu.org/licenses/>. + + Improvements and feedback are welcome! +*******************************************************************************/ + +#ifndef GPUSENSOR_H +#define GPUSENSOR_H + +// TDE +#include <tdeprocess.h> + +// Superkaramba +#include "sensor.h" + +class GPUSensor : public Sensor +{ + TQ_OBJECT + + public: + GPUSensor(TQString driver, TQString gpuId, int interval = 1000); + ~GPUSensor(); + + void update(); + void setMaxValue(SensorParams *sp); + + protected: + TQString getLoad(); + + private: + TQString m_gpuDriver, m_gpuId, m_buffer; + TQStringList m_command; + TDEProcess m_proc; + + public slots: + void receivedStdout(TDEProcess *proc, char *buffer, int buflen); + void processExited(TDEProcess *proc); +}; + +#endif // GPUSENSOR_H
\ No newline at end of file diff --git a/superkaramba/src/graph.h b/superkaramba/src/graph.h index 8c1b3a8..ca11715 100644 --- a/superkaramba/src/graph.h +++ b/superkaramba/src/graph.h @@ -17,7 +17,7 @@ class Graph : public Meter { -Q_OBJECT +TQ_OBJECT public: diff --git a/superkaramba/src/imagelabel.cpp b/superkaramba/src/imagelabel.cpp index 514e7f8..4b934a9 100644 --- a/superkaramba/src/imagelabel.cpp +++ b/superkaramba/src/imagelabel.cpp @@ -39,7 +39,7 @@ Effect::Effect(ImageLabel* img, int msec) : if (msec > 0) { // remove the effect after the given time - //TQTimer::singleShot (millisec, myImage, TQT_SLOT(slotEffectExpired())); + //TQTimer::singleShot (millisec, myImage, TQ_SLOT(slotEffectExpired())); //timer -> changeInterval(millisec); millisec = msec; } @@ -57,7 +57,7 @@ void Effect::startTimer() { if (millisec > 0) { - TQTimer::singleShot (millisec, myImage, TQT_SLOT(slotEffectExpired())); + TQTimer::singleShot (millisec, myImage, TQ_SLOT(slotEffectExpired())); millisec = 0; } } @@ -287,8 +287,8 @@ void ImageLabel::setValue(TQString fn) KTempFile tmpFile; TDEIO::FileCopyJob* copy = TDEIO::file_copy(fileName, tmpFile.name(), 0600, true, false, false); - connect(copy, TQT_SIGNAL(result(TDEIO::Job*)), - this, TQT_SLOT(slotCopyResult(TDEIO::Job*))); + connect(copy, TQ_SIGNAL(result(TDEIO::Job*)), + this, TQ_SLOT(slotCopyResult(TDEIO::Job*))); return; } else @@ -387,15 +387,15 @@ bool ImageLabel::click(TQMouseEvent* e) if (getBoundingBox().contains(e -> x(), e -> y()) && isEnabled()) { TQString program; - if (e -> button() == Qt::LeftButton) + if (e -> button() == TQt::LeftButton) { program = leftButtonAction; } - else if (e -> button() == Qt::MidButton) + else if (e -> button() == TQt::MidButton) { program = middleButtonAction; } - else if (e -> button() == Qt::RightButton) + else if (e -> button() == TQt::RightButton) { program = rightButtonAction; } diff --git a/superkaramba/src/imagelabel.h b/superkaramba/src/imagelabel.h index 1346c2e..57d90e9 100644 --- a/superkaramba/src/imagelabel.h +++ b/superkaramba/src/imagelabel.h @@ -46,7 +46,7 @@ namespace TDEIO { class Effect : public TQObject { -Q_OBJECT +TQ_OBJECT public: @@ -102,7 +102,7 @@ public: class ImageLabel : public Meter { -Q_OBJECT +TQ_OBJECT public: diff --git a/superkaramba/src/input.h b/superkaramba/src/input.h index 6e1601a..9bf7fdb 100644 --- a/superkaramba/src/input.h +++ b/superkaramba/src/input.h @@ -35,7 +35,7 @@ class Input : public Meter { -Q_OBJECT +TQ_OBJECT public: Input(karamba* k, int ix, int iy, int iw, int ih); diff --git a/superkaramba/src/input_python.cpp b/superkaramba/src/input_python.cpp index fb451bd..727daaa 100644 --- a/superkaramba/src/input_python.cpp +++ b/superkaramba/src/input_python.cpp @@ -348,7 +348,7 @@ PyObject* py_getInputFocus(PyObject *, PyObject *args) // TQWidget *obj = ((karamba*)widget)->focusWidget(); - if(obj->isA(TQLINEEDIT_OBJECT_NAME_STRING)) // SKLineEdit is no TQ_Object, but TQLineEdit can only be here as a SKLineEdit + if(obj->isA("TQLineEdit")) // SKLineEdit is no TQ_Object, but TQLineEdit can only be here as a SKLineEdit return Py_BuildValue((char*)"l", ((SKLineEdit*)obj)->getInput()); return Py_BuildValue((char*)"l", 0); diff --git a/superkaramba/src/karamba.cpp b/superkaramba/src/karamba.cpp index 19b30b5..eab94db 100644 --- a/superkaramba/src/karamba.cpp +++ b/superkaramba/src/karamba.cpp @@ -77,7 +77,7 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, if(!m_theme.set(url)) { setFixedSize(0, 0); - TQTimer::singleShot(100, this, TQT_SLOT(killWidget())); + TQTimer::singleShot(100, this, TQ_SLOT(killWidget())); return; } // Add self to list of open themes @@ -93,8 +93,8 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, setName(qName.ascii()); KDirWatch *dirWatch = KDirWatch::self(); - connect(dirWatch, TQT_SIGNAL( dirty( const TQString & ) ), - TQT_SLOT( slotFileChanged( const TQString & ) ) ); + connect(dirWatch, TQ_SIGNAL( dirty( const TQString & ) ), + TQ_SLOT( slotFileChanged( const TQString & ) ) ); if(!dirWatch->contains(m_theme.file())) dirWatch->addFile(m_theme.file()); @@ -132,7 +132,7 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, if(m_theme.pythonModuleExists()) { kdDebug() << "Loading python module: " << m_theme.pythonModule() << endl; - TQTimer::singleShot(0, this, TQT_SLOT(initPythonInterface())); + TQTimer::singleShot(0, this, TQ_SLOT(initPythonInterface())); } widgetMask = 0; @@ -142,22 +142,22 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, kWinModule = new KWinModule(); desktop = 0; - connect( kWinModule,TQT_SIGNAL(currentDesktopChanged(int)), this, - TQT_SLOT(currentDesktopChanged(int)) ); - connect( kapp, TQT_SIGNAL(backgroundChanged(int)), this, - TQT_SLOT(currentWallpaperChanged(int))); + connect( kWinModule,TQ_SIGNAL(currentDesktopChanged(int)), this, + TQ_SLOT(currentDesktopChanged(int)) ); + connect( tdeApp, TQ_SIGNAL(backgroundChanged(int)), this, + TQ_SLOT(currentWallpaperChanged(int))); // Setup of the Task Manager Callbacks - connect(&taskManager, TQT_SIGNAL(activeTaskChanged(Task*)), this, - TQT_SLOT(activeTaskChanged(Task*)) ); - connect(&taskManager, TQT_SIGNAL(taskAdded(Task*)), this, - TQT_SLOT(taskAdded(Task*)) ); - connect(&taskManager, TQT_SIGNAL(taskRemoved(Task*)), this, - TQT_SLOT(taskRemoved(Task*)) ); - connect(&taskManager, TQT_SIGNAL(startupAdded(Startup*)), this, - TQT_SLOT(startupAdded(Startup*)) ); - connect(&taskManager, TQT_SIGNAL(startupRemoved(Startup*)), this, - TQT_SLOT(startupRemoved(Startup*)) ); + connect(&taskManager, TQ_SIGNAL(activeTaskChanged(Task*)), this, + TQ_SLOT(activeTaskChanged(Task*)) ); + connect(&taskManager, TQ_SIGNAL(taskAdded(Task*)), this, + TQ_SLOT(taskAdded(Task*)) ); + connect(&taskManager, TQ_SIGNAL(taskRemoved(Task*)), this, + TQ_SLOT(taskRemoved(Task*)) ); + connect(&taskManager, TQ_SIGNAL(startupAdded(Startup*)), this, + TQ_SLOT(startupAdded(Startup*)) ); + connect(&taskManager, TQ_SIGNAL(startupRemoved(Startup*)), this, + TQ_SLOT(startupRemoved(Startup*)) ); themeConfMenu = new TDEPopupMenu( this); themeConfMenu -> setCheckable(true); @@ -170,8 +170,8 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, toDesktopMenu = new TDEPopupMenu (this); toDesktopMenu -> setCheckable(true); mid = toDesktopMenu -> insertItem (i18n("&All Desktops"), - dslot = new DesktopChangeSlot(TQT_TQOBJECT(this),0), - TQT_SLOT(receive())); + dslot = new DesktopChangeSlot(this,0), + TQ_SLOT(receive())); dslot->setMenuId(mid); toDesktopMenu -> insertSeparator(); @@ -181,7 +181,7 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, name += ('0' + ndesktop); mid = toDesktopMenu -> insertItem (name, - dslot = new DesktopChangeSlot(TQT_TQOBJECT(this), ndesktop), TQT_SLOT(receive())); + dslot = new DesktopChangeSlot(this, ndesktop), TQ_SLOT(receive())); dslot->setMenuId(mid); } @@ -193,11 +193,11 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, menuAccColl = new TDEActionCollection( this ); kpop->insertItem( SmallIconSet("reload"),i18n("Update"), this, - TQT_SLOT(updateSensors()), Key_F5 ); + TQ_SLOT(updateSensors()), Key_F5 ); toggleLocked = new TDEToggleAction ( i18n("Toggle &Locked Position"), SmallIconSet("locked"), - CTRL+Key_L, TQT_TQOBJECT(this), - TQT_SLOT( slotToggleLocked() ), + CTRL+Key_L, this, + TQ_SLOT( slotToggleLocked() ), accColl, "Locked position" ); accColl->insert(toggleLocked); toggleLocked -> setChecked(true); @@ -205,8 +205,8 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, toggleLocked->plug(kpop); toggleFastTransforms = new TDEToggleAction(i18n("Use &Fast Image Scaling"), - CTRL+Key_F, TQT_TQOBJECT(this), - TQT_SLOT( slotToggleFastTransforms() ), + CTRL+Key_F, this, + TQ_SLOT( slotToggleFastTransforms() ), accColl, "Fast transformations"); accColl->insert(toggleFastTransforms); @@ -221,9 +221,9 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, kpop->insertItem(i18n("To Des&ktop"), toDesktopMenu); kpop->insertItem( SmallIconSet("reload3"),i18n("&Reload Theme"),this, - TQT_SLOT(reloadConfig()), CTRL+Key_R ); + TQ_SLOT(reloadConfig()), CTRL+Key_R ); kpop->insertItem( SmallIconSet("window-close"),i18n("&Close This Theme"), this, - TQT_SLOT(killWidget()), CTRL+Key_C ); + TQ_SLOT(killWidget()), CTRL+Key_C ); if(!SuperKarambaSettings::showSysTray()) showMenuExtension(); @@ -249,7 +249,7 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, menuList = new TQObjectList(); menuList->setAutoDelete( true ); - client = kapp->dcopClient(); + client = tdeApp->dcopClient(); if (!client->isAttached()) client->attach(); appId = client->registerAs(tqApp->name()); @@ -262,7 +262,7 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, if( !parseConfig() ) { setFixedSize(0,0); - TQTimer::singleShot( 100, this, TQT_SLOT(killWidget()) ); + TQTimer::singleShot( 100, this, TQ_SLOT(killWidget()) ); tqWarning("Could not read config file."); } else @@ -310,11 +310,11 @@ karamba::karamba(TQString fn, TQString name, bool reloading, int instance, move(xpos, ypos); } - haveUpdated = 0; + haveUpdated = false; this->setMouseTracking(true); - setFocusPolicy(TQ_StrongFocus); + setFocusPolicy(TQWidget::StrongFocus); } karamba::~karamba() @@ -605,7 +605,7 @@ bool karamba::parseConfig() if (!tiptext.isEmpty()) tmp->setTooltip(tiptext); - connect(tmp, TQT_SIGNAL(pixmapLoaded()), this, TQT_SLOT(externalStep())); + connect(tmp, TQ_SIGNAL(pixmapLoaded()), this, TQ_SLOT(externalStep())); setSensor(lineParser, (Meter*) tmp ); meterList->append (tmp ); imageList->append (tmp ); @@ -790,12 +790,12 @@ void karamba::start() { m_sysTimer = new TQTimer(this); - connect(m_sysTimer, TQT_SIGNAL(timeout()), TQT_SLOT(step())); + connect(m_sysTimer, TQ_SIGNAL(timeout()), TQ_SLOT(step())); m_sysTimer->start(m_interval); //Start the widget running - TQTimer::singleShot( 0, this, TQT_SLOT(step()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(step()) ); if( !(onTop || managed) ) lowerTimer.start(); @@ -988,6 +988,26 @@ void karamba::setSensor(const LineParser& lineParser, Meter* meter) } + if (sens == "GPU") + { + TQString gpuId = lineParser.getString("GPU"); + TQString gpuDriver = lineParser.getString("DRIVER"); + TQString sensorId = TQString("GPU_%1_%2").arg(gpuDriver, gpuId); + sensor = sensorMap[sensorId]; + if (sensor == 0) + { + int interval = lineParser.getInt("INTERVAL"); + interval = (interval == 0) ? 1000 : interval; + sensor = (sensorMap[sensorId] = new GPUSensor(gpuDriver, gpuId, interval)); + sensorList->append(sensor); + } + + SensorParams *sp = new SensorParams(meter); + sp->addParam("FORMAT", m_theme.locale()->translate(lineParser.getString("FORMAT").ascii())); + sensor->addMeter(sp); + sensor->setMaxValue(sp); + } + if( sens == "MEMORY" ) { sensor = sensorMap["MEMORY"]; @@ -1015,7 +1035,7 @@ void karamba::setSensor(const LineParser& lineParser, Meter* meter) int interval = lineParser.getInt("INTERVAL"); interval = (interval == 0)?5000:interval; sensor = ( sensorMap["DISK"] = new DiskSensor( interval ) ); - connect( sensor, TQT_SIGNAL(initComplete()), this, TQT_SLOT(externalStep()) ); + connect( sensor, TQ_SIGNAL(initComplete()), this, TQ_SLOT(externalStep()) ); sensorList->append( sensor ); } // meter->setMax( ((DiskSensor*)sensor)->getTotalSpace(mntPt)/1024 ); @@ -1216,7 +1236,7 @@ void karamba::setSensor(const LineParser& lineParser, Meter* meter) if (sensor != 0) { - TQTimer::singleShot( 0, sensor, TQT_SLOT(update()) ); + TQTimer::singleShot( 0, sensor, TQ_SLOT(update()) ); sensor->start(); } } @@ -1248,9 +1268,9 @@ void karamba::setIncomingData(TQString theme, TQString obj) //dataStream << theme; //dataStream << txt; - //kapp->dcopClient()->send( app->dcopClient()->appId(), "KarambaIface", "themeNotify(TQString,TQString)", data ); + //tdeApp->dcopClient()->send( app->dcopClient()->appId(), "KarambaIface", "themeNotify(TQString,TQString)", data ); - DCOPClient *c = kapp->dcopClient(); + DCOPClient *c = tdeApp->dcopClient(); if (!c->isAttached()) c->attach(); @@ -1268,9 +1288,9 @@ void karamba::callTheme(TQString theme, TQString txt) //dataStream << theme; //dataStream << txt; - //kapp->dcopClient()->send( app->dcopClient()->appId(), "KarambaIface", "themeNotify(TQString,TQString)", data ); + //tdeApp->dcopClient()->send( app->dcopClient()->appId(), "KarambaIface", "themeNotify(TQString,TQString)", data ); - DCOPClient *c = kapp->dcopClient(); + DCOPClient *c = tdeApp->dcopClient(); if (!c->isAttached()) c->attach(); @@ -1294,11 +1314,11 @@ void karamba::meterClicked(TQMouseEvent* e, Meter* meter) { int button = 0; - if( e->button() == Qt::LeftButton ) + if( e->button() == TQt::LeftButton ) button = 1; - else if( e->button() == Qt::MidButton ) + else if( e->button() == TQt::MidButton ) button = 2; - else if( e->button() == Qt::RightButton ) + else if( e->button() == TQt::RightButton ) button = 3; if (RichTextLabel* richText = dynamic_cast<RichTextLabel*>(meter)) @@ -1351,11 +1371,11 @@ void karamba::passClick(TQMouseEvent *e) { int button = 0; - if( e->button() == Qt::LeftButton ) + if( e->button() == TQt::LeftButton ) button = 1; - else if( e->button() == Qt::MidButton ) + else if( e->button() == TQt::MidButton ) button = 2; - else if( e->button() == Qt::RightButton ) + else if( e->button() == TQt::RightButton ) button = 3; pythonIface->widgetClicked(this, e->x(), e->y(), button); @@ -1416,7 +1436,7 @@ void karamba::management_popup( void ) void karamba::mousePressEvent( TQMouseEvent *e ) { //tqDebug("karamba::mousePressEvent"); - if( e->button() == Qt::RightButton && !want_right_button ) + if( e->button() == TQt::RightButton && !want_right_button ) { management_popup(); } @@ -1512,14 +1532,14 @@ void karamba::mouseMoveEvent( TQMouseEvent *e ) //Modified by Ryan Nickell (p0z3r@mail.com) 03/16/2004 // This will work now, but only when you move at least // one pixel in any direction with your mouse. - //if( e->button() == Qt::LeftButton ) - if( e->state() == Qt::LeftButton) + //if( e->button() == TQt::LeftButton ) + if( e->state() == TQt::LeftButton) button = 1; - //else if( e->button() == Qt::MidButton ) - else if( e->state() == Qt::MidButton ) + //else if( e->button() == TQt::MidButton ) + else if( e->state() == TQt::MidButton ) button = 2; - //else if( e->button() == Qt::RightButton ) - else if( e->state() == Qt::RightButton ) + //else if( e->button() == TQt::RightButton ) + else if( e->state() == TQt::RightButton ) button = 3; pythonIface->widgetMouseMoved(this, e->x(), e->y(), button); @@ -1560,7 +1580,7 @@ void karamba::updateSensors() ((Sensor*) *it)->update(); ++it; } - TQTimer::singleShot( 500, this, TQT_SLOT(step()) ); + TQTimer::singleShot( 500, this, TQ_SLOT(step()) ); } void karamba::updateBackground(TDESharedPixmap* kpm) @@ -1691,14 +1711,13 @@ void karamba::step() if (pythonIface && pythonIface->isExtensionLoaded()) { - if (haveUpdated == 0) + if (!haveUpdated) pythonIface->initWidget(this); else pythonIface->widgetUpdated(this); } - if (haveUpdated == 0) - haveUpdated = 1; + haveUpdated = true; } void karamba::widgetClosed() @@ -1779,16 +1798,16 @@ void karamba::addMenuConfigOption(TQString key, TQString name) //tqDebug("karamba::addMenuConfigOption"); kpop -> setItemEnabled(THEMECONF, true); - SignalBridge* action = new SignalBridge(TQT_TQOBJECT(this), key, menuAccColl); + SignalBridge* action = new SignalBridge(this, key, menuAccColl); TDEToggleAction* confItem = new TDEToggleAction (name, TDEShortcut::null(), - action, TQT_SLOT(receive()), + action, TQ_SLOT(receive()), menuAccColl, key.ascii()); confItem -> setName(key.ascii()); menuAccColl -> insert(confItem); - connect(action, TQT_SIGNAL( enabled(TQString, bool) ), - this, TQT_SLOT( slotToggleConfigOption(TQString, bool) )); + connect(action, TQ_SIGNAL( enabled(TQString, bool) ), + this, TQ_SLOT( slotToggleConfigOption(TQString, bool) )); config -> setGroup("config menu"); confItem -> setChecked(config -> readBoolEntry(key)); @@ -2035,16 +2054,16 @@ void karamba::showMenuExtension() trayMenuToggleId = kglobal->insertItem(SmallIconSet("superkaramba"), i18n("Show System Tray Icon"), this, - TQT_SLOT(slotToggleSystemTray()), + TQ_SLOT(slotToggleSystemTray()), CTRL+Key_S); trayMenuThemeId = kglobal->insertItem(SmallIconSet("knewstuff"), i18n("&Manage Themes..."), this, - TQT_SLOT(slotShowTheme()), CTRL+Key_M); + TQ_SLOT(slotShowTheme()), CTRL+Key_M); trayMenuQuitId = kglobal->insertItem(SmallIconSet("system-log-out"), i18n("&Quit SuperKaramba"), this, - TQT_SLOT(slotQuit()), CTRL+Key_Q); + TQ_SLOT(slotQuit()), CTRL+Key_Q); kglobal->polish(); diff --git a/superkaramba/src/karamba.h b/superkaramba/src/karamba.h index 6930c5c..6fc2140 100644 --- a/superkaramba/src/karamba.h +++ b/superkaramba/src/karamba.h @@ -63,7 +63,7 @@ #include <tqdatetime.h> #include <tqbitmap.h> #include <tdeconfig.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <tqdragobject.h> #include "karambarootpixmap.h" @@ -82,6 +82,7 @@ #include "uptimesensor.h" #include "memsensor.h" #include "cpusensor.h" +#include "gpusensor.h" #include "networksensor.h" #include "xmmssensor.h" #include "noatunsensor.h" @@ -111,8 +112,8 @@ class LineParser; class karamba : public TQWidget { - Q_OBJECT - + TQ_OBJECT + public: karamba(TQString fn, TQString name, bool reloading = false, @@ -326,8 +327,8 @@ private slots: */ class DesktopChangeSlot : public TQObject { - Q_OBJECT - + TQ_OBJECT + public: DesktopChangeSlot(TQObject *parent, int desktop_id); @@ -347,8 +348,8 @@ class DesktopChangeSlot : public TQObject /** SignalBridge is an ungulate that lives in the forests of wild Wisconsin. */ class SignalBridge : public TQObject { - Q_OBJECT - + TQ_OBJECT + public: SignalBridge(TQObject* parent, TQString, TDEActionCollection*); diff --git a/superkaramba/src/karamba_python.cpp b/superkaramba/src/karamba_python.cpp index 73212a0..f732570 100644 --- a/superkaramba/src/karamba_python.cpp +++ b/superkaramba/src/karamba_python.cpp @@ -51,12 +51,7 @@ struct module_state { PyObject *error; }; -#if PY_MAJOR_VERSION >= 3 #define GETSTATE(m) ((struct module_state*)PyModule_GetState(m)) -#else -#define GETSTATE(m) (&_state) -static struct module_state _state; -#endif static PyObject * error_out(PyObject *m) { @@ -356,8 +351,6 @@ static PyMethodDef karamba_methods[] = { {NULL, NULL, 0 ,NULL} }; -#if PY_MAJOR_VERSION >= 3 - static int karamba_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(GETSTATE(m)->error); return 0; @@ -382,22 +375,18 @@ static struct PyModuleDef karambadef = { #define INITERROR return NULL -#else - -#define INITERROR return - -#endif +PyMODINIT_FUNC PyInit_karamba(void) +{ + return PyModule_Create(&karambadef); +} PyThreadState* KarambaPython::mainThreadState = 0; KarambaPython::KarambaPython(const ThemeFile& theme, bool reloading): pythonThemeExtensionLoaded(false), pName(0), pModule(0), pDict(0) { - PyThreadState* myThreadState; char pypath[1024]; - getLock(&myThreadState); - // load the .py file for this .theme PyRun_SimpleString((char*)"import sys"); //Add theme path to python path so that we can find the python file @@ -405,13 +394,7 @@ KarambaPython::KarambaPython(const ThemeFile& theme, bool reloading): PyRun_SimpleString(pypath); PyRun_SimpleString((char*)"sys.path.insert(0, '')"); - PyImport_AddModule((char*)"karamba"); -#if PY_MAJOR_VERSION >= 3 - PyModule_Create(&karambadef); -#else - Py_InitModule((char*)"karamba", karamba_methods); -#endif - pName = PyBytes_FromString(theme.pythonModule().ascii()); + pName = PyUnicode_FromString(theme.pythonModule().utf8()); pModule = PyImport_Import(pName); fprintf(stderr, "%s\n", pypath); @@ -443,72 +426,40 @@ KarambaPython::KarambaPython(const ThemeFile& theme, bool reloading): fprintf(stderr, "------------------------------------------------------\n"); } - releaseLock(myThreadState); } KarambaPython::~KarambaPython() { //Clean up Python references if (pythonThemeExtensionLoaded) { - PyThreadState* myThreadState; - getLock(&myThreadState); - //Displose of current python module so we can reload in constructor. Py_DECREF(pModule); Py_DECREF(pName); - - releaseLock(myThreadState); } } void KarambaPython::initPython() { // initialize Python + PyImport_AppendInittab((char*)"karamba", PyInit_karamba); Py_Initialize(); +#if PY_VERSION_HEX < 0x03070000 // initialize thread support PyEval_InitThreads(); +#endif // save a pointer to the main PyThreadState object mainThreadState = PyThreadState_Get(); - - // release the lock - PyEval_ReleaseLock(); } void KarambaPython::shutdownPython() { // shut down the interpreter - PyInterpreterState * mainInterpreterState = mainThreadState->interp; - // create a thread state object for this thread - PyThreadState * myThreadState = PyThreadState_New(mainInterpreterState); - PyThreadState_Swap(myThreadState); - PyEval_AcquireLock(); + PyThreadState_Swap(mainThreadState); Py_Finalize(); } -void KarambaPython::getLock(PyThreadState** myThreadState) -{ - // get the global lock - PyEval_AcquireLock(); - - // create a thread state object for this thread - *myThreadState = PyThreadState_New(mainThreadState->interp); - PyThreadState_Swap(*myThreadState); -} - -void KarambaPython::releaseLock(PyThreadState* myThreadState) -{ - // swap my thread state out of the interpreter - PyThreadState_Swap(NULL); - // clear out any cruft from thread state object - PyThreadState_Clear(myThreadState); - // delete my thread state object - PyThreadState_Delete(myThreadState); - // release the lock - PyEval_ReleaseLock(); -} - PyObject* KarambaPython::getFunc(const char* function) { PyObject* pFunc = PyDict_GetItemString(pDict, (char*)function); @@ -517,17 +468,11 @@ PyObject* KarambaPython::getFunc(const char* function) return NULL; } -bool KarambaPython::callObject(const char* func, PyObject* pArgs, bool lock) +bool KarambaPython::callObject(const char* func, PyObject* pArgs) { bool result = false; - PyThreadState* myThreadState; - //tqDebug("Calling %s", func); - - if (lock) - getLock(&myThreadState); PyObject* pFunc = getFunc(func); - if (pFunc != NULL) { PyObject* pValue = PyObject_CallObject(pFunc, pArgs); @@ -544,8 +489,6 @@ bool KarambaPython::callObject(const char* func, PyObject* pArgs, bool lock) } } Py_DECREF(pArgs); - if (lock) - releaseLock(myThreadState); return result; } @@ -597,8 +540,7 @@ bool KarambaPython::widgetClicked(karamba* k, int x, int y, int button) return callObject("widgetClicked", pArgs); } -bool KarambaPython::keyPressed(karamba* k, const Meter* meter, - const TQString& text) +bool KarambaPython::keyPressed(karamba* k, const Meter* meter, const TQString& text) { PyObject* pArgs = Py_BuildValue((char*)"(lls)", k, meter, text.ucs2()); return callObject("keyPressed", pArgs); @@ -660,13 +602,8 @@ bool KarambaPython::itemDropped(karamba* k, TQString text, int x, int y) bool KarambaPython::themeNotify(karamba* k, const char *from, const char *str) { - // WARNING WARNING WARNING i had to switch off thread locking to get - // this to work. callNotify is called from INSIDE another locked thread, - // so can never complete because themeNotify will expect locking to be - // released... - // PyObject* pArgs = Py_BuildValue((char*)"(lss)", k, from, str); - return callObject("themeNotify", pArgs, false); + return callObject("themeNotify", pArgs); } bool KarambaPython::systrayUpdated(karamba* k) diff --git a/superkaramba/src/karamba_python.h b/superkaramba/src/karamba_python.h index b3f7a0a..5227d6d 100644 --- a/superkaramba/src/karamba_python.h +++ b/superkaramba/src/karamba_python.h @@ -45,10 +45,8 @@ protected: PyObject *pDict; static PyThreadState* mainThreadState; - void getLock(PyThreadState** myThreadState); PyObject* getFunc(const char* function); - void releaseLock(PyThreadState* myThreadState); - bool callObject(const char* func, PyObject* pArgs, bool lock=true); + bool callObject(const char* func, PyObject* pArgs); public: KarambaPython(const ThemeFile& theme, bool reloading); diff --git a/superkaramba/src/karambaapp.cpp b/superkaramba/src/karambaapp.cpp index d567eb7..b4bf15c 100644 --- a/superkaramba/src/karambaapp.cpp +++ b/superkaramba/src/karambaapp.cpp @@ -141,17 +141,17 @@ void KarambaApplication::setUpSysTray(TDEAboutData* about) TDEPopupMenu *menu = sysTrayIcon->contextMenu(); menu->insertItem(SmallIconSet("superkaramba"), i18n("Hide System Tray Icon"), this, - TQT_SLOT(globalHideSysTray())); + TQ_SLOT(globalHideSysTray())); menu->insertSeparator(); m_helpMenu = new KHelpMenu(themeListWindow, about); - action = KStdAction::help(m_helpMenu, TQT_SLOT(appHelpActivated()), + action = KStdAction::help(m_helpMenu, TQ_SLOT(appHelpActivated()), sysTrayIcon->actionCollection()); action->plug(menu); - action = KStdAction::aboutApp(m_helpMenu, TQT_SLOT(aboutApplication()), + action = KStdAction::aboutApp(m_helpMenu, TQ_SLOT(aboutApplication()), sysTrayIcon->actionCollection()); action->plug(menu); - action = KStdAction::aboutKDE(m_helpMenu, TQT_SLOT(aboutKDE()), + action = KStdAction::aboutKDE(m_helpMenu, TQ_SLOT(aboutKDE()), sysTrayIcon->actionCollection()); action->plug(menu); @@ -164,8 +164,8 @@ void KarambaApplication::setUpSysTray(TDEAboutData* about) sysTrayIcon->hide(); //Connect Systray icon's quit event - TQObject::connect(sysTrayIcon, TQT_SIGNAL(quitSelected()), - this, TQT_SLOT(globalQuitSuperKaramba())); + TQObject::connect(sysTrayIcon, TQ_SIGNAL(quitSelected()), + this, TQ_SLOT(globalQuitSuperKaramba())); } void KarambaApplication::showKarambaMenuExtension(bool show) @@ -296,7 +296,7 @@ void KarambaApplication::addKaramba(karamba* k, bool reloading) karambaApp->dcopClient()->appId(), k->theme().file()); k->setInstance(instance); } - karambaList->append(TQT_TQOBJECT(k)); + karambaList->append(k); } void KarambaApplication::deleteKaramba(karamba* k, bool reloading) @@ -304,12 +304,12 @@ void KarambaApplication::deleteKaramba(karamba* k, bool reloading) if(!reloading && karambaApp->dcopStub()) karambaApp->dcopStub()->themeClosed( karambaApp->dcopClient()->appId(), k->theme().file(), k->instance()); - karambaList->removeRef(TQT_TQOBJECT(k)); + karambaList->removeRef(k); } bool KarambaApplication::hasKaramba(karamba* k) { - return karambaList->containsRef(TQT_TQOBJECT(k)) > 0; + return karambaList->containsRef(k) > 0; } // XXX: I guess this should be made with mutex/semaphores diff --git a/superkaramba/src/karambaapp.h b/superkaramba/src/karambaapp.h index 330a6ed..8e53914 100644 --- a/superkaramba/src/karambaapp.h +++ b/superkaramba/src/karambaapp.h @@ -38,7 +38,7 @@ class TDEAboutData; class KarambaApplication : public TDEApplication { - Q_OBJECT + TQ_OBJECT friend class KarambaIface; diff --git a/superkaramba/src/karambasessionmanaged.cpp b/superkaramba/src/karambasessionmanaged.cpp index 6d3c46c..fed4bb9 100644 --- a/superkaramba/src/karambasessionmanaged.cpp +++ b/superkaramba/src/karambasessionmanaged.cpp @@ -28,7 +28,7 @@ bool KarambaSessionManaged::saveState(TQSessionManager&) { - TDEConfig* config = kapp->sessionConfig(); + TDEConfig* config = tdeApp->sessionConfig(); config->setGroup("General Options"); diff --git a/superkaramba/src/kwidgetlistbox.cpp b/superkaramba/src/kwidgetlistbox.cpp index 1811f38..56e0769 100644 --- a/superkaramba/src/kwidgetlistbox.cpp +++ b/superkaramba/src/kwidgetlistbox.cpp @@ -33,8 +33,8 @@ KWidgetListbox::KWidgetListbox(TQWidget *parent, const char *name) verticalHeader()->hide(); setSelectionMode(TQTable::NoSelection); setFocusStyle(TQTable::FollowStyle); - connect(this, TQT_SIGNAL(currentChanged(int, int)), - this, TQT_SLOT(selectionChanged(int, int))); + connect(this, TQ_SIGNAL(currentChanged(int, int)), + this, TQ_SLOT(selectionChanged(int, int))); setHScrollBarMode(TQScrollView::AlwaysOff); setVScrollBarMode(TQScrollView::Auto); } diff --git a/superkaramba/src/kwidgetlistbox.h b/superkaramba/src/kwidgetlistbox.h index 680df49..d791337 100644 --- a/superkaramba/src/kwidgetlistbox.h +++ b/superkaramba/src/kwidgetlistbox.h @@ -30,7 +30,7 @@ typedef bool (*show_callback) (int index, TQWidget* widget, void* data); class KWidgetListbox : public TQTable { - Q_OBJECT + TQ_OBJECT public: diff --git a/superkaramba/src/main.cpp b/superkaramba/src/main.cpp index 9ea8503..feee817 100644 --- a/superkaramba/src/main.cpp +++ b/superkaramba/src/main.cpp @@ -31,7 +31,7 @@ #include <tqfileinfo.h> #include <tqstringlist.h> #include <tdeconfig.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeversion.h> #include "karamba.h" @@ -87,7 +87,7 @@ void karambaMessageOutput(TQtMsgType type, const char *msg) int main(int argc, char **argv) { #ifdef KARAMBA_LOG - tqInstallMsgHandler(karambaMessageOutput); + qInstallMsgHandler(karambaMessageOutput); #endif TDEAboutData about("superkaramba", I18N_NOOP("SuperKaramba"), version, description, @@ -128,7 +128,7 @@ int main(int argc, char **argv) KarambaApplication::unlockKaramba(); - app.connect(tqApp,TQT_SIGNAL(lastWindowClosed()),tqApp,TQT_SLOT(quit())); + app.connect(tqApp,TQ_SIGNAL(lastWindowClosed()),tqApp,TQ_SLOT(quit())); // Try to restore a previous session if applicable. app.checkPreviousSession(app, lst); diff --git a/superkaramba/src/memsensor.cpp b/superkaramba/src/memsensor.cpp index 98eceea..1aac365 100644 --- a/superkaramba/src/memsensor.cpp +++ b/superkaramba/src/memsensor.cpp @@ -33,7 +33,7 @@ #include <uvm/uvm_extern.h> #endif -#include <kprocio.h> +#include <tdeprocio.h> #if defined Q_OS_FREEBSD || defined(Q_OS_NETBSD) /* define pagetok in terms of pageshift */ @@ -57,10 +57,10 @@ MemSensor::MemSensor(int msec) : Sensor(msec) # if defined(Q_OS_FREEBSD) && defined(__FreeBSD_version) && __FreeBSD_version >= 500018 kd = kvm_open("/dev/null", "/dev/null", "/dev/null", O_RDONLY, "kvm_open"); # elif defined Q_OS_FREEBSD - connect(&ksp, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int )), - this,TQT_SLOT(receivedStdout(TDEProcess *, char *, int ))); - connect(&ksp, TQT_SIGNAL(processExited(TDEProcess *)), - this,TQT_SLOT(processExited( TDEProcess * ))); + connect(&ksp, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int )), + this,TQ_SLOT(receivedStdout(TDEProcess *, char *, int ))); + connect(&ksp, TQ_SIGNAL(processExited(TDEProcess *)), + this,TQ_SLOT(processExited( TDEProcess * ))); swapTotal = swapUsed = 0; @@ -210,9 +210,9 @@ int MemSensor::getSwapTotal() mib[1] = VM_UVMEXP; ssize = sizeof(uvmexp); - if (sysctl(mib,2,&uvmexp,&ssize,NULL,0) != -1) { - pagesize = uvmexp.pagesize; - STotal = (pagesize*uvmexp.swpages) >> 10; + if (sysctl(mib, 2, &uvmexp, &ssize, NULL, 0) != -1) { + pagesize = uvmexp.pagesize; + STotal = (pagesize*uvmexp.swpages) >> 10; } return STotal; #else @@ -254,10 +254,10 @@ int MemSensor::getSwapFree() ssize = sizeof(uvmexp); if (sysctl(mib,2,&uvmexp,&ssize,NULL,0) != -1) { - pagesize = uvmexp.pagesize; - STotal = (pagesize*uvmexp.swpages) >> 10; - SUsed = (pagesize*uvmexp.swpginuse) >> 10; - SFree = STotal - SUsed; + pagesize = uvmexp.pagesize; + STotal = (pagesize*uvmexp.swpages) >> 10; + SUsed = (pagesize*uvmexp.swpginuse) >> 10; + SFree = STotal - SUsed; } return SFree; #else @@ -273,7 +273,7 @@ void MemSensor::readValues() # if defined(Q_OS_FREEBSD) && !(defined(__FreeBSD_version) && __FreeBSD_version >= 500018) ksp.clearArguments(); ksp << "swapinfo"; - ksp.start( TDEProcess::NotifyOnExit,KProcIO::Stdout); + ksp.start( TDEProcess::NotifyOnExit,TDEProcIO::Stdout); # endif #else TQFile file("/proc/meminfo"); @@ -287,6 +287,9 @@ void MemSensor::readValues() #endif } +#define SUB_FORMAT_STR(fstring, value) \ + format.replace(TQRegExp(#fstring, false), TQString::number((int)(value))) + void MemSensor::update() { readValues(); @@ -319,27 +322,46 @@ void MemSensor::update() format = "%um"; } - format.replace( TQRegExp("%fmb", false), TQString::number( (int)(( totalMem - usedMemNoBuffers)/1024.0+0.5))); - format.replace( TQRegExp("%fm", false), TQString::number( (int)( ( totalMem - usedMem )/1024.0+0.5) )); - - format.replace( TQRegExp("%umb", false), TQString::number( (int)((usedMemNoBuffers)/1024.0+0.5))); - format.replace( TQRegExp("%um", false), TQString::number( (int)((usedMem)/1024.0+0.5 ))); - - format.replace( TQRegExp("%tm", false), TQString::number( (int)( (totalMem)/1024.0+0.5))); - - format.replace( TQRegExp("%fs", false), TQString::number( (int)((totalSwap - usedSwap)/1024.0+0.5))); - format.replace( TQRegExp("%us", false), TQString::number( (int)(usedSwap/1024.0+0.5))); - format.replace( TQRegExp("%ts", false), TQString::number( (int)(totalSwap/1024.0+0.5))); + SUB_FORMAT_STR(%fmbp, (totalMem - usedMemNoBuffers) * 100.0 / totalMem); + SUB_FORMAT_STR(%fmbg, (totalMem - usedMemNoBuffers) / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%fmb, (totalMem - usedMemNoBuffers) / 1024.0 + 0.5); + SUB_FORMAT_STR(%fmp, (totalMem - usedMem) * 100.0 / totalMem); + SUB_FORMAT_STR(%fmg, (totalMem - usedMem) / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%fm, (totalMem - usedMem) / 1024.0 + 0.5); + + SUB_FORMAT_STR(%umbp, usedMemNoBuffers * 100.0 / totalMem); + SUB_FORMAT_STR(%umbg, usedMemNoBuffers / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%umb, usedMemNoBuffers / 1024.0 + 0.5); + SUB_FORMAT_STR(%ump, usedMem * 100.0 / totalMem); + SUB_FORMAT_STR(%umg, usedMem / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%um, usedMem / 1024.0 + 0.5); + + SUB_FORMAT_STR(%tmg, totalMem / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%tm, totalMem / 1024.0 + 0.5); + + SUB_FORMAT_STR(%fsp, (totalSwap - usedSwap) * 100.0 / totalSwap); + SUB_FORMAT_STR(%fsg, (totalSwap - usedSwap) / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%fs, (totalSwap - usedSwap) / 1024.0 + 0.5); + SUB_FORMAT_STR(%usp, usedSwap * 100.0 / totalSwap); + SUB_FORMAT_STR(%usg, usedSwap / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%us, usedSwap / 1024.0 + 0.5); + + SUB_FORMAT_STR(%tsg, totalSwap / 1024.0 / 1024.0 + 1); + SUB_FORMAT_STR(%ts, totalSwap / 1024.0 + 0.5); meter->setValue(format); ++it; } #if defined(Q_OS_FREEBSD) && !(defined(__FreeBSD_version) && __FreeBSD_version >= 500018) if (set) + { MaxSet = true; + } #endif } +#undef SUB_FORMAT_STR + void MemSensor::setMaxValue( SensorParams *sp ) { Meter *meter; @@ -351,10 +373,22 @@ void MemSensor::setMaxValue( SensorParams *sp ) { f = "%um"; } - if( f=="%fm" || f== "%um" || f=="%fmb" || f=="%umb" ) - meter->setMax( getMemTotal() / 1024 ); - if( f=="%fs" || f== "%us" ) - meter->setMax( getSwapTotal() / 1024 ); + else if (f.endsWith("p")) + { + meter->setMax(100); + } + else if (f == "%fm" || f == "%um" || f == "%fmb" || f == "%umb") + { + meter->setMax(getMemTotal() / 1024); + } + else if (f == "%fmg" || f == "%umg" || f == "%fmbg" || f == "%umbg") + { + meter->setMax(getMemTotal() / 1024 / 1024); + } + else if (f == "%fs" || f == "%us" || f == "%fsg" || f == "%usg") + { + meter->setMax(getSwapTotal() / 1024); + } } #include "memsensor.moc" diff --git a/superkaramba/src/memsensor.h b/superkaramba/src/memsensor.h index 56a91a5..23ee96b 100644 --- a/superkaramba/src/memsensor.h +++ b/superkaramba/src/memsensor.h @@ -13,17 +13,17 @@ #include <tqglobal.h> #include <tqstring.h> #include <tqregexp.h> -#include <kprocess.h> +#include <tdeprocess.h> #ifdef __FreeBSD__ -#include <kprocio.h> +#include <tdeprocio.h> #include <kvm.h> #include <osreldate.h> #endif class MemSensor : public Sensor { -Q_OBJECT +TQ_OBJECT public: diff --git a/superkaramba/src/menu_python.cpp b/superkaramba/src/menu_python.cpp index 5d80a75..bc5d9e3 100644 --- a/superkaramba/src/menu_python.cpp +++ b/superkaramba/src/menu_python.cpp @@ -38,10 +38,10 @@ long createMenu(long widget) karamba* currTheme = (karamba*)widget; TDEPopupMenu* tmp = new TDEPopupMenu(currTheme); - currTheme->menuList->append( TQT_TQOBJECT(tmp) ); + currTheme->menuList->append( tmp ); - currTheme->connect(tmp, TQT_SIGNAL(activated(int)), currTheme, - TQT_SLOT(passMenuItemClicked(int))); + currTheme->connect(tmp, TQ_SIGNAL(activated(int)), currTheme, + TQ_SLOT(passMenuItemClicked(int))); return (long)tmp; } @@ -86,7 +86,7 @@ long deleteMenu(long widget, long menu) karamba* currTheme = (karamba*)widget; TDEPopupMenu* tmp = (TDEPopupMenu*)menu; - currTheme->menuList->removeRef(TQT_TQOBJECT(tmp)); + currTheme->menuList->removeRef(tmp); return 1; } diff --git a/superkaramba/src/meter.h b/superkaramba/src/meter.h index 810a8aa..64609e8 100644 --- a/superkaramba/src/meter.h +++ b/superkaramba/src/meter.h @@ -22,7 +22,7 @@ class karamba; class Meter : public TQObject { -Q_OBJECT +TQ_OBJECT public: diff --git a/superkaramba/src/meter_python.cpp b/superkaramba/src/meter_python.cpp index c5d745b..d3f2293 100644 --- a/superkaramba/src/meter_python.cpp +++ b/superkaramba/src/meter_python.cpp @@ -100,11 +100,13 @@ TQString PyString2TQString(PyObject* text) } else if (PyUnicode_CheckExact(text)) { - Py_UNICODE* t = PyUnicode_AsUnicode(text); - if(sizeof(Py_UNICODE) == 4) - qtext = fromUcs4((TQ_UINT32*)t); - else - qtext = TQString::fromUcs2((TQ_UINT16*)t); + int uniSize = PyUnicode_KIND(text); + if (uniSize == PyUnicode_4BYTE_KIND) + qtext = fromUcs4((TQ_UINT32*)PyUnicode_4BYTE_DATA(text)); + else if (uniSize == PyUnicode_2BYTE_KIND) + qtext = TQString::fromUcs2((TQ_UINT16*)PyUnicode_2BYTE_DATA(text)); + else if (uniSize == PyUnicode_1BYTE_KIND) + qtext.setAscii((char*)PyUnicode_1BYTE_DATA(text)); } else { @@ -119,34 +121,11 @@ PyObject* TQString2PyString(TQString string) PyObject *pyString; const unsigned short* tmp = string.ucs2(); - bool dofree = false; if(tmp) { - #if Py_UNICODE_SIZE == 4 - - Py_UNICODE* buf = new Py_UNICODE[string.length()]; - - for(unsigned int i = 0; i < string.length(); i++) - { - buf[i] = tmp[i]; - } - dofree = true; - - #else - - Py_UNICODE* buf = (Py_UNICODE*) tmp; - - #endif - - pyString = PyUnicode_FromUnicode(buf, string.length()); - - if(dofree) - { - delete [] buf; - } + pyString = PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, tmp, string.length()); } - else pyString = PyBytes_FromString(""); diff --git a/superkaramba/src/misc_python.cpp b/superkaramba/src/misc_python.cpp index 271ec51..5f60ff0 100644 --- a/superkaramba/src/misc_python.cpp +++ b/superkaramba/src/misc_python.cpp @@ -149,13 +149,13 @@ PyObject* py_execute_command_interactive(PyObject *, PyObject* args) } TQApplication::connect(currTheme->currProcess, - TQT_SIGNAL(processExited(TDEProcess *)), + TQ_SIGNAL(processExited(TDEProcess *)), currTheme, - TQT_SLOT(processExited(TDEProcess *))); + TQ_SLOT(processExited(TDEProcess *))); TQApplication::connect(currTheme->currProcess, - TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), currTheme, - TQT_SLOT(receivedStdout(TDEProcess *, char *, int))); + TQ_SLOT(receivedStdout(TDEProcess *, char *, int))); currTheme->currProcess->start(TDEProcess::NotifyOnExit, TDEProcess::Stdout); return Py_BuildValue((char*)"l", (int)(currTheme->currProcess->pid())); diff --git a/superkaramba/src/networksensor.cpp b/superkaramba/src/networksensor.cpp index 2320a6a..34cff5c 100644 --- a/superkaramba/src/networksensor.cpp +++ b/superkaramba/src/networksensor.cpp @@ -108,7 +108,7 @@ void NetworkSensor::getInOutBytes ( unsigned long &in,unsigned long &out) const } if ( line.contains( device ) ) { - TQRegExp rx( "\\W+"+device+":\\D*(\\d+)(?:\\D+\\d+){7}\\D+(\\d+)", false); + TQRegExp rx( "^\\W*"+device+":\\D*(\\d+)(?:\\D+\\d+){7}\\D+(\\d+)", false); rx.search(line); in = rx.cap(1).toULong(); out = rx.cap(2).toULong(); diff --git a/superkaramba/src/networksensor.h b/superkaramba/src/networksensor.h index 5e93517..9ad8eab 100644 --- a/superkaramba/src/networksensor.h +++ b/superkaramba/src/networksensor.h @@ -24,7 +24,7 @@ class NetworkSensor : public Sensor { - Q_OBJECT + TQ_OBJECT public: NetworkSensor( TQString device, int interval ); diff --git a/superkaramba/src/noatunsensor.cpp b/superkaramba/src/noatunsensor.cpp index 129e8e0..0a06473 100644 --- a/superkaramba/src/noatunsensor.cpp +++ b/superkaramba/src/noatunsensor.cpp @@ -144,7 +144,7 @@ TQString NoatunSensor::getTitle() else { TQDataStream reply(replyData, IO_ReadOnly); - if (replyType == TQSTRING_OBJECT_NAME_STRING) + if (replyType == "TQString") { reply >> result; result.replace( TQRegExp("_")," " ); diff --git a/superkaramba/src/programsensor.cpp b/superkaramba/src/programsensor.cpp index 0c2f3e2..aa4edcb 100644 --- a/superkaramba/src/programsensor.cpp +++ b/superkaramba/src/programsensor.cpp @@ -25,10 +25,10 @@ ProgramSensor::ProgramSensor(const TQString &progName, int interval, TQString en programName = progName; //update(); - connect(&ksp, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int )), - this,TQT_SLOT(receivedStdout(TDEProcess *, char *, int ))); - connect(&ksp, TQT_SIGNAL(processExited(TDEProcess *)), - this,TQT_SLOT(processExited( TDEProcess * ))); + connect(&ksp, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int )), + this,TQ_SLOT(receivedStdout(TDEProcess *, char *, int ))); + connect(&ksp, TQ_SIGNAL(processExited(TDEProcess *)), + this,TQ_SLOT(processExited( TDEProcess * ))); } ProgramSensor::~ProgramSensor() @@ -87,7 +87,7 @@ void ProgramSensor::update() ksp << programName; - ksp.start( KProcIO::NotifyOnExit,KProcIO::Stdout); + ksp.start( TDEProcIO::NotifyOnExit,TDEProcIO::Stdout); } #include "programsensor.moc" diff --git a/superkaramba/src/programsensor.h b/superkaramba/src/programsensor.h index 672d0e7..a94019e 100644 --- a/superkaramba/src/programsensor.h +++ b/superkaramba/src/programsensor.h @@ -10,15 +10,15 @@ #ifndef PROGRAMSENSOR_H #define PROGRAMSENSOR_H #include "sensor.h" -#include <kprocess.h> -#include <kprocio.h> +#include <tdeprocess.h> +#include <tdeprocio.h> #include <tqstring.h> #include <tqstringlist.h> #include <tqvaluevector.h> #include <tqtextcodec.h> class ProgramSensor : public Sensor { - Q_OBJECT + TQ_OBJECT public: ProgramSensor(const TQString &programName, int msec=1000, TQString encoding="" ); diff --git a/superkaramba/src/richtextlabel.cpp b/superkaramba/src/richtextlabel.cpp index 999fe0f..d0664da 100644 --- a/superkaramba/src/richtextlabel.cpp +++ b/superkaramba/src/richtextlabel.cpp @@ -165,7 +165,7 @@ bool RichTextLabel::click(TQMouseEvent* e) TQString anchor = text->anchorAt(point); if (anchor[0] != '#') { - if (e->button() == Qt::LeftButton) + if (e->button() == TQt::LeftButton) { KRun :: runCommand(anchor); } diff --git a/superkaramba/src/richtextlabel.h b/superkaramba/src/richtextlabel.h index cae19c6..3d2cb2a 100644 --- a/superkaramba/src/richtextlabel.h +++ b/superkaramba/src/richtextlabel.h @@ -23,7 +23,7 @@ class RichTextLabel : public Meter { - Q_OBJECT + TQ_OBJECT public: RichTextLabel(karamba*); diff --git a/superkaramba/src/rsssensor.h b/superkaramba/src/rsssensor.h index 4361dca..4872504 100644 --- a/superkaramba/src/rsssensor.h +++ b/superkaramba/src/rsssensor.h @@ -21,7 +21,7 @@ **/ class RssSensor : public Sensor { - Q_OBJECT + TQ_OBJECT public: RssSensor( const TQString &source, int interval, const TQString &format, const TQString &encoding=TQString() ); diff --git a/superkaramba/src/sensor.cpp b/superkaramba/src/sensor.cpp index 378cb1d..8655754 100644 --- a/superkaramba/src/sensor.cpp +++ b/superkaramba/src/sensor.cpp @@ -19,7 +19,7 @@ void Sensor::start() { if (!timer.isActive()) { - connect (&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(update())); + connect (&timer,TQ_SIGNAL(timeout()),this,TQ_SLOT(update())); timer.start( (msec == 0)?1000:msec); } } diff --git a/superkaramba/src/sensor.h b/superkaramba/src/sensor.h index 1fa34b1..50faea0 100644 --- a/superkaramba/src/sensor.h +++ b/superkaramba/src/sensor.h @@ -20,7 +20,7 @@ class Sensor : public TQObject { - Q_OBJECT + TQ_OBJECT public: diff --git a/superkaramba/src/sensorsensor.cpp b/superkaramba/src/sensorsensor.cpp index baea31d..2765368 100644 --- a/superkaramba/src/sensorsensor.cpp +++ b/superkaramba/src/sensorsensor.cpp @@ -29,10 +29,10 @@ SensorSensor::SensorSensor(int interval, char tempUnit) : Sensor( interval ) #endif if(tempUnit == 'F') extraParams = " -f"; - connect(&ksp, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int )), - this,TQT_SLOT(receivedStdout(TDEProcess *, char *, int ))); - connect(&ksp, TQT_SIGNAL(processExited(TDEProcess *)), - this,TQT_SLOT(processExited( TDEProcess * ))); + connect(&ksp, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int )), + this,TQ_SLOT(receivedStdout(TDEProcess *, char *, int ))); + connect(&ksp, TQ_SIGNAL(processExited(TDEProcess *)), + this,TQ_SLOT(processExited( TDEProcess * ))); // readValues(); } @@ -108,7 +108,7 @@ void SensorSensor::update() #else ksp << "sensors" << extraParams; #endif - ksp.start( TDEProcess::NotifyOnExit,KProcIO::Stdout); + ksp.start( TDEProcess::NotifyOnExit,TDEProcIO::Stdout); } diff --git a/superkaramba/src/sensorsensor.h b/superkaramba/src/sensorsensor.h index c2692ef..4ece984 100644 --- a/superkaramba/src/sensorsensor.h +++ b/superkaramba/src/sensorsensor.h @@ -7,8 +7,8 @@ #include <tqmap.h> #include <tqstringlist.h> #include <tqregexp.h> -#include <kprocess.h> -#include <kprocio.h> +#include <tdeprocess.h> +#include <tdeprocio.h> #include "sensor.h" @@ -19,7 +19,7 @@ **/ class SensorSensor : public Sensor { - Q_OBJECT + TQ_OBJECT public: SensorSensor(int interval, char tempUnit); diff --git a/superkaramba/src/showdesktop.cpp b/superkaramba/src/showdesktop.cpp index 57d1f46..1259288 100644 --- a/superkaramba/src/showdesktop.cpp +++ b/superkaramba/src/showdesktop.cpp @@ -40,10 +40,10 @@ ShowDesktop::ShowDesktop() kWinModule = new KWinModule( this ); // on desktop changes or when a window is deiconified, we abort the show desktop mode - connect( kWinModule, TQT_SIGNAL(currentDesktopChanged(int)), - TQT_SLOT(slotCurrentDesktopChanged(int))); - connect( kWinModule, TQT_SIGNAL(windowChanged(WId,unsigned int)), - TQT_SLOT(slotWindowChanged(WId,unsigned int))); + connect( kWinModule, TQ_SIGNAL(currentDesktopChanged(int)), + TQ_SLOT(slotCurrentDesktopChanged(int))); + connect( kWinModule, TQ_SIGNAL(windowChanged(WId,unsigned int)), + TQ_SLOT(slotWindowChanged(WId,unsigned int))); } void ShowDesktop::slotCurrentDesktopChanged(int) diff --git a/superkaramba/src/showdesktop.h b/superkaramba/src/showdesktop.h index 22d847f..c26a650 100644 --- a/superkaramba/src/showdesktop.h +++ b/superkaramba/src/showdesktop.h @@ -29,7 +29,7 @@ class KWinModule; */ class ShowDesktop : public TQObject { - Q_OBJECT + TQ_OBJECT public: diff --git a/superkaramba/src/sklineedit.cpp b/superkaramba/src/sklineedit.cpp index 57b9db0..86f281a 100644 --- a/superkaramba/src/sklineedit.cpp +++ b/superkaramba/src/sklineedit.cpp @@ -66,7 +66,7 @@ void SKLineEdit::keyPressEvent(TQKeyEvent* e) if(!e->text().isEmpty()) { - karamba* k = static_cast<karamba*>(TQT_TQWIDGET(parent())); + karamba* k = static_cast<karamba*>(parent()); k->keyPressed(e->text(), m_input); } } diff --git a/superkaramba/src/sknewstuff.cpp b/superkaramba/src/sknewstuff.cpp index c6869b3..19f6aa8 100644 --- a/superkaramba/src/sknewstuff.cpp +++ b/superkaramba/src/sknewstuff.cpp @@ -24,7 +24,7 @@ #include <tdeio/netaccess.h> #include <kmimetype.h> #include <krun.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <ktar.h> #include <kurl.h> #include <tqdir.h> @@ -40,7 +40,7 @@ #include "sknewstuff.h" SKNewStuff::SKNewStuff( ThemesDlg *dlg ) : - TDENewStuff( "superkaramba/themes", dlg ), + TDENewStuff( "Karamba & Superkaramba", dlg ), mDlg( dlg ) { } @@ -53,7 +53,7 @@ bool SKNewStuff::install( const TQString &fileName ) TDEStandardDirs myStdDir; TQFileInfo fi(fileName); TQString base = fi.baseName(); - TQString baseDestDir =myStdDir.saveLocation("data", kapp->instanceName() + "/themes/", true); + TQString baseDestDir =myStdDir.saveLocation("data", tdeApp->instanceName() + "/themes/", true); const TQString destDir = baseDestDir + base + "/"; TDEStandardDirs::makeDir( destDir ); diff --git a/superkaramba/src/systemtray.cpp b/superkaramba/src/systemtray.cpp index ab539cd..ea93889 100644 --- a/superkaramba/src/systemtray.cpp +++ b/superkaramba/src/systemtray.cpp @@ -62,7 +62,7 @@ void Systemtray::updateBackgroundPixmap ( const TQPixmap & pixmap) { //Stupid stupid stupid work around for annoying bug //QXEmbed ignores setBackgroundOrigin(AncestorOrigin).... TQPixmap bug = TQPixmap(emb->size()); - bitBlt(TQT_TQPAINTDEVICE(&bug), 0, 0, TQT_TQPAINTDEVICE(const_cast<TQPixmap*>(&pixmap)), emb->parentWidget()->x()+emb->x(), emb->parentWidget()->y()+emb->y(), emb->width(), emb->height(),TQt::CopyROP, false); + bitBlt(&bug, 0, 0, const_cast<TQPixmap*>(&pixmap), emb->parentWidget()->x()+emb->x(), emb->parentWidget()->y()+emb->y(), emb->width(), emb->height(),TQt::CopyROP, false); emb->setPaletteBackgroundPixmap (bug); } @@ -95,7 +95,7 @@ void Systemtray::initSystray( void ) emb->setAutoDelete(false); - connect(emb, TQT_SIGNAL(embeddedWindowDestroyed()), TQT_SLOT(updateTrayWindows())); + connect(emb, TQ_SIGNAL(embeddedWindowDestroyed()), TQ_SLOT(updateTrayWindows())); m_Wins.append(emb); @@ -107,8 +107,8 @@ void Systemtray::initSystray( void ) updateTrayWindows(); - connect(twin_module, TQT_SIGNAL(systemTrayWindowAdded(WId)), TQT_SLOT(systemTrayWindowAdded(WId))); - connect(twin_module, TQT_SIGNAL(systemTrayWindowRemoved(WId)), TQT_SLOT(systemTrayWindowRemoved(WId))); + connect(twin_module, TQ_SIGNAL(systemTrayWindowAdded(WId)), TQ_SLOT(systemTrayWindowAdded(WId))); + connect(twin_module, TQ_SIGNAL(systemTrayWindowRemoved(WId)), TQ_SLOT(systemTrayWindowRemoved(WId))); TQCString screenstr; screenstr.setNum(tqt_xscreen()); @@ -206,7 +206,7 @@ void Systemtray::systemTrayWindowAdded( WId w ) emb->setAutoDelete(false); //emb->setBackgroundMode(X11ParentRelative); emb->setBackgroundMode(FixedPixmap); - connect(emb, TQT_SIGNAL(embeddedWindowDestroyed()), TQT_SLOT(updateTrayWindows())); + connect(emb, TQ_SIGNAL(embeddedWindowDestroyed()), TQ_SLOT(updateTrayWindows())); m_Wins.append(emb); emb->embed(w); diff --git a/superkaramba/src/systemtray.h b/superkaramba/src/systemtray.h index dbbbed6..ba2d87c 100644 --- a/superkaramba/src/systemtray.h +++ b/superkaramba/src/systemtray.h @@ -33,7 +33,7 @@ typedef long unsigned int Atom; class Systemtray : public TQWidget { - Q_OBJECT + TQ_OBJECT public: Systemtray(TQWidget* parent); diff --git a/superkaramba/src/systray_python.cpp b/superkaramba/src/systray_python.cpp index c953fdb..e0d96a1 100644 --- a/superkaramba/src/systray_python.cpp +++ b/superkaramba/src/systray_python.cpp @@ -111,8 +111,8 @@ long createSystray(long widget, long x, long y, long w, long h) currTheme->systray->move((int)x,(int)y); currTheme->systray->setMinimumSize((int)w,(int)h); currTheme->systray->initSystray(); - TQObject::connect(currTheme->systray,TQT_SIGNAL(updated()), - currTheme,TQT_SLOT(systrayUpdated())); + TQObject::connect(currTheme->systray,TQ_SIGNAL(updated()), + currTheme,TQ_SLOT(systrayUpdated())); currTheme->systray->show(); } diff --git a/superkaramba/src/taskmanager.cpp b/superkaramba/src/taskmanager.cpp index 48cef86..b666d28 100644 --- a/superkaramba/src/taskmanager.cpp +++ b/superkaramba/src/taskmanager.cpp @@ -55,11 +55,11 @@ TaskManager::TaskManager(TQObject *parent, const char *name) twin_module = new KWinModule(); // TDEGlobal::locale()->insertCatalogue("libtaskmanager"); - connect(twin_module, TQT_SIGNAL(windowAdded(WId)), TQT_SLOT(windowAdded(WId))); - connect(twin_module, TQT_SIGNAL(windowRemoved(WId)), TQT_SLOT(windowRemoved(WId))); - connect(twin_module, TQT_SIGNAL(activeWindowChanged(WId)), TQT_SLOT(activeWindowChanged(WId))); - connect(twin_module, TQT_SIGNAL(currentDesktopChanged(int)), TQT_SLOT(currentDesktopChanged(int))); - connect(twin_module, TQT_SIGNAL(windowChanged(WId,unsigned int)), TQT_SLOT(windowChanged(WId,unsigned int))); + connect(twin_module, TQ_SIGNAL(windowAdded(WId)), TQ_SLOT(windowAdded(WId))); + connect(twin_module, TQ_SIGNAL(windowRemoved(WId)), TQ_SLOT(windowRemoved(WId))); + connect(twin_module, TQ_SIGNAL(activeWindowChanged(WId)), TQ_SLOT(activeWindowChanged(WId))); + connect(twin_module, TQ_SIGNAL(currentDesktopChanged(int)), TQ_SLOT(currentDesktopChanged(int))); + connect(twin_module, TQ_SIGNAL(windowChanged(WId,unsigned int)), TQ_SLOT(windowChanged(WId,unsigned int))); // register existing windows const TQValueList<WId> windows = twin_module->windows(); @@ -86,14 +86,14 @@ void TaskManager::configure_startup() return; _startup_info = new TDEStartupInfo( true, this ); connect( _startup_info, - TQT_SIGNAL( gotNewStartup( const TDEStartupInfoId&, const TDEStartupInfoData& )), - TQT_SLOT( gotNewStartup( const TDEStartupInfoId&, const TDEStartupInfoData& ))); + TQ_SIGNAL( gotNewStartup( const TDEStartupInfoId&, const TDEStartupInfoData& )), + TQ_SLOT( gotNewStartup( const TDEStartupInfoId&, const TDEStartupInfoData& ))); connect( _startup_info, - TQT_SIGNAL( gotStartupChange( const TDEStartupInfoId&, const TDEStartupInfoData& )), - TQT_SLOT( gotStartupChange( const TDEStartupInfoId&, const TDEStartupInfoData& ))); + TQ_SIGNAL( gotStartupChange( const TDEStartupInfoId&, const TDEStartupInfoData& )), + TQ_SLOT( gotStartupChange( const TDEStartupInfoId&, const TDEStartupInfoData& ))); connect( _startup_info, - TQT_SIGNAL( gotRemoveStartup( const TDEStartupInfoId&, const TDEStartupInfoData& )), - TQT_SLOT( gotRemoveStartup( const TDEStartupInfoId& ))); + TQ_SIGNAL( gotRemoveStartup( const TDEStartupInfoId&, const TDEStartupInfoData& )), + TQ_SLOT( gotRemoveStartup( const TDEStartupInfoId& ))); c.setGroup( "TaskbarButtonSettings" ); _startup_info->setTimeout( c.readUnsignedNumEntry( "Timeout", 30 )); } @@ -773,14 +773,14 @@ void Task::updateThumbnail() // by the thumbnail generation. This makes things much smoother // on slower machines. // - TQWidget *rootWin = TQT_TQWIDGET(tqApp->desktop()); + TQWidget *rootWin = tqApp->desktop(); TQRect geom = _info.geometry(); _grab = TQPixmap::grabWindow( rootWin->winId(), geom.x(), geom.y(), geom.width(), geom.height() ); if ( !_grab.isNull() ) - TQTimer::singleShot( 200, this, TQT_SLOT( generateThumbnail() ) ); + TQTimer::singleShot( 200, this, TQ_SLOT( generateThumbnail() ) ); } void Task::generateThumbnail() diff --git a/superkaramba/src/taskmanager.h b/superkaramba/src/taskmanager.h index ceb62ff..0626b50 100644 --- a/superkaramba/src/taskmanager.h +++ b/superkaramba/src/taskmanager.h @@ -48,7 +48,7 @@ class TaskManager; */ class Task: public TQObject { - Q_OBJECT + TQ_OBJECT TQ_PROPERTY( TQString name READ name ) TQ_PROPERTY( TQString visibleName READ visibleName ) @@ -375,7 +375,7 @@ private: */ class Startup: public TQObject { - Q_OBJECT + TQ_OBJECT TQ_PROPERTY( TQString text READ text ) TQ_PROPERTY( TQString bin READ bin ) @@ -431,7 +431,7 @@ typedef TQPtrList<Startup> StartupList; */ class TaskManager : public TQObject { - Q_OBJECT + TQ_OBJECT TQ_PROPERTY( int currentDesktop READ currentDesktop ) TQ_PROPERTY( int numberOfDesktops READ numberOfDesktops ) diff --git a/superkaramba/src/textfilesensor.h b/superkaramba/src/textfilesensor.h index 930407a..656f3c6 100644 --- a/superkaramba/src/textfilesensor.h +++ b/superkaramba/src/textfilesensor.h @@ -36,7 +36,7 @@ class TextFileSensor : public Sensor { -Q_OBJECT +TQ_OBJECT public: TextFileSensor( const TQString &fileName, bool rdf, int interval, const TQString &encoding=TQString() ); diff --git a/superkaramba/src/textlabel.cpp b/superkaramba/src/textlabel.cpp index 09b8f98..968973d 100644 --- a/superkaramba/src/textlabel.cpp +++ b/superkaramba/src/textlabel.cpp @@ -342,15 +342,15 @@ bool TextLabel::click(TQMouseEvent* e) if (getBoundingBox().contains(e -> x(), e -> y()) && isEnabled()) { TQString program; - if (e -> button() == Qt::LeftButton) + if (e -> button() == TQt::LeftButton) { program = leftButtonAction; } - else if (e -> button() == Qt::MidButton) + else if (e -> button() == TQt::MidButton) { program = middleButtonAction; } - else if (e -> button() == Qt::RightButton) + else if (e -> button() == TQt::RightButton) { program = rightButtonAction; } diff --git a/superkaramba/src/textlabel.h b/superkaramba/src/textlabel.h index df730d1..8fc167e 100644 --- a/superkaramba/src/textlabel.h +++ b/superkaramba/src/textlabel.h @@ -22,7 +22,7 @@ class TextLabel : public Meter { -Q_OBJECT +TQ_OBJECT public: enum ScrollType { ScrollNone, ScrollNormal, diff --git a/superkaramba/src/themefile.cpp b/superkaramba/src/themefile.cpp index 8cf3b92..912b9a6 100644 --- a/superkaramba/src/themefile.cpp +++ b/superkaramba/src/themefile.cpp @@ -29,7 +29,7 @@ #include <kzip.h> #include <tdeapplication.h> #include <tdemessagebox.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdelocale.h> #include <tdeio/netaccess.h> #include <tqtextstream.h> @@ -209,7 +209,7 @@ bool ThemeFile::set(const KURL &url) { if(!url.isLocalFile() && !url.protocol().isEmpty()) { - if(KMessageBox::warningContinueCancel(TQT_TQWIDGET(kapp->activeWindow()), + if(KMessageBox::warningContinueCancel(tdeApp->activeWindow(), i18n("You are about to install and run %1 SuperKaramba theme. Since " "themes can contain executable code you should only install themes " "from sources that you trust. Continue?"), i18n("Executable Code Warning"), i18n("Install") @@ -224,7 +224,7 @@ bool ThemeFile::set(const KURL &url) if(localFile.exists()) { - if(KMessageBox::warningContinueCancel(TQT_TQWIDGET(kapp->activeWindow()), + if(KMessageBox::warningContinueCancel(tdeApp->activeWindow(), i18n("%1 already exists. Do you want to overwrite it?") .arg(localFile.filePath()),i18n("File Exists"),i18n("Overwrite")) == KMessageBox::Cancel) @@ -233,7 +233,7 @@ bool ThemeFile::set(const KURL &url) } } if(!TDEIO::NetAccess::file_copy(url, localFile.filePath(), -1, true, - false, kapp->mainWidget())) + false, tdeApp->mainWidget())) { return false; } diff --git a/superkaramba/src/themelocale.cpp b/superkaramba/src/themelocale.cpp index f451eaf..9f77c19 100644 --- a/superkaramba/src/themelocale.cpp +++ b/superkaramba/src/themelocale.cpp @@ -162,7 +162,7 @@ void ThemeLocale::setLanguage(const TQStringList &languages) if(m_theme->fileExists(file)) { TQBuffer buffer(m_theme->readThemeFile(file)); - tl_nl_load_domain(TQT_TQIODEVICE(&buffer), buffer.size(), &m_domain); + tl_nl_load_domain(&buffer, buffer.size(), &m_domain); m_language = *it; return; } diff --git a/superkaramba/src/themes_layout.ui b/superkaramba/src/themes_layout.ui index d264187..b6def24 100644 --- a/superkaramba/src/themes_layout.ui +++ b/superkaramba/src/themes_layout.ui @@ -226,17 +226,15 @@ <tabstop>buttonAddToDesktop</tabstop> <tabstop>buttonClose</tabstop> </tabstops> -<Q_SLOTS> +<slots> <slot access="protected">addToDesktop()</slot> <slot access="protected">selectionChanged(int)</slot> <slot access="protected">search(const TQString&)</slot> -</Q_SLOTS> +</slots> <layoutdefaults spacing="6" margin="11"/> <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> <includes> <include location="global" impldecl="in implementation">kpushbutton.h</include> + <include location="global" impldecl="in implementation">kwidgetlistbox.h</include> </includes> -<includehints> - <includehint>kwidgetlistbox.h</includehint> -</includehints> </UI> diff --git a/superkaramba/src/themesdlg.cpp b/superkaramba/src/themesdlg.cpp index 7534054..25903a7 100644 --- a/superkaramba/src/themesdlg.cpp +++ b/superkaramba/src/themesdlg.cpp @@ -38,7 +38,7 @@ #include <kdebug.h> #include <tdefiledialog.h> #include <kpushbutton.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeapplication.h> #include <kiconloader.h> #include <tdelocale.h> @@ -76,7 +76,7 @@ void ThemesDlg::saveUserAddedThemes() { TDEStandardDirs ksd; TQStringList t = themes(); - TQStringList dirs = ksd.findDirs("data", TQString(kapp->name()) + "/themes"); + TQStringList dirs = ksd.findDirs("data", TQString(tdeApp->name()) + "/themes"); TQStringList::Iterator it = t.begin(); bool remove; @@ -134,8 +134,8 @@ void ThemesDlg::populateListbox() item->buttonGo->setText(i18n("New Stuff...")); #ifdef HAVE_TDENEWSTUFF item->buttonGo->setEnabled(true); - connect(item->buttonGo, TQT_SIGNAL(clicked()), - this, TQT_SLOT(getNewStuff())); + connect(item->buttonGo, TQ_SIGNAL(clicked()), + this, TQ_SLOT(getNewStuff())); #else item->buttonGo->setEnabled(false); #endif @@ -148,11 +148,11 @@ void ThemesDlg::populateListbox() item->setDescriptionText(i18n("Add local theme to the list.")); item->buttonGo->setProperty("stdItem", 18); item->buttonGo->setText(i18n("Open...")); - connect(item->buttonGo, TQT_SIGNAL(clicked()), - this, TQT_SLOT(openLocalTheme())); + connect(item->buttonGo, TQ_SIGNAL(clicked()), + this, TQ_SLOT(openLocalTheme())); tableThemes->insertItem(item); - dirs = ksd.findDirs("data", TQString(kapp->name()) + "/themes"); + dirs = ksd.findDirs("data", TQString(tdeApp->name()) + "/themes"); // Get custom dirs from config here? TQStringList::Iterator itend( dirs.end() ); for(TQStringList::Iterator it = dirs.begin(); it != itend; ++it ) @@ -164,8 +164,8 @@ void ThemesDlg::populateListbox() item = new ThemeWidget(new ThemeFile(dir.filePath(*it))); tableThemes->insertItem(item); item->buttonGo->setText(i18n("Uninstall")); - connect(item->buttonGo, TQT_SIGNAL(clicked()), - this, TQT_SLOT(uninstall())); + connect(item->buttonGo, TQ_SIGNAL(clicked()), + this, TQ_SLOT(uninstall())); } } t = SuperKarambaSettings::userAddedThemes(); @@ -178,8 +178,8 @@ void ThemesDlg::populateListbox() item = new ThemeWidget(file); tableThemes->insertItem(item); item->buttonGo->setText(i18n("Uninstall")); - connect(item->buttonGo, TQT_SIGNAL(clicked()), - this, TQT_SLOT(uninstall())); + connect(item->buttonGo, TQ_SIGNAL(clicked()), + this, TQ_SLOT(uninstall())); } else delete file; @@ -363,8 +363,8 @@ int ThemesDlg::addThemeToList(const TQString &file) i = tableThemes->insertItem(item); item->buttonGo->setText(i18n("Uninstall")); - connect(item->buttonGo, TQT_SIGNAL(clicked()), - this, TQT_SLOT(uninstall())); + connect(item->buttonGo, TQ_SIGNAL(clicked()), + this, TQ_SLOT(uninstall())); } tableThemes->setSelected(i); return i; @@ -485,12 +485,12 @@ void ThemesDlg::uninstall() { kdDebug() << "removing " << tempPath << " under TDENewStuffNames from superkarambarc" << endl; - kapp->config()->deleteEntry(tempPath); + tdeApp->config()->deleteEntry(tempPath); config->setGroup("TDENewStuffStatus"); kdDebug() << "removing " << name << " under TDENewStuffStatus from superkarambarc" << endl; - kapp->config()->deleteEntry(name); - kapp->config()->sync(); + tdeApp->config()->deleteEntry(name); + tdeApp->config()->sync(); } #endif @@ -514,11 +514,11 @@ void ThemesDlg::uninstall() if(!name.isEmpty()) { kdDebug() << "removing " << theme.path() << " from superkarambarc" << endl; - kapp->config()->deleteEntry(theme.path()); + tdeApp->config()->deleteEntry(theme.path()); config->setGroup("TDENewStuffStatus"); kdDebug() << "removing " << name << " from superkarambarc" << endl; - kapp->config()->deleteEntry(name); - kapp->config()->sync(); + tdeApp->config()->deleteEntry(name); + tdeApp->config()->sync(); } #endif } diff --git a/superkaramba/src/themesdlg.h b/superkaramba/src/themesdlg.h index 1e73288..095f2c9 100644 --- a/superkaramba/src/themesdlg.h +++ b/superkaramba/src/themesdlg.h @@ -39,7 +39,7 @@ class KArchiveDirectory; class ThemesDlg : public ThemesLayout { - Q_OBJECT + TQ_OBJECT public: diff --git a/superkaramba/src/themewidget.h b/superkaramba/src/themewidget.h index 2481cb8..f57918c 100644 --- a/superkaramba/src/themewidget.h +++ b/superkaramba/src/themewidget.h @@ -29,7 +29,7 @@ class ThemeWidget : public ThemeWidgetLayout { - Q_OBJECT + TQ_OBJECT public: ThemeWidget(TQWidget *parent = 0, const char *name = 0); diff --git a/superkaramba/src/themewidget_layout.ui b/superkaramba/src/themewidget_layout.ui index 8a55785..813df4f 100644 --- a/superkaramba/src/themewidget_layout.ui +++ b/superkaramba/src/themewidget_layout.ui @@ -157,9 +157,6 @@ <property name="text"> <string></string> </property> - <property name="accel"> - <string></string> - </property> </widget> </hbox> </widget> diff --git a/superkaramba/src/xmmssensor.h b/superkaramba/src/xmmssensor.h index 20727b1..2e83967 100644 --- a/superkaramba/src/xmmssensor.h +++ b/superkaramba/src/xmmssensor.h @@ -22,7 +22,7 @@ class XMMSSensor : public Sensor { - Q_OBJECT + TQ_OBJECT public: XMMSSensor( int interval, const TQString &encoding=TQString() ); |