TQt4 convert kcpuload

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kcpuload@1234190 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 57ae0fd104
commit c2ac333e3e

@ -14,39 +14,39 @@
#include "icontoggleaction.h"
IconToggleAction::IconToggleAction(
const QString& useTextUnchecked, const QString& useIconUnchecked,
const QString& useTextChecked, const QString& useIconChecked,
const KShortcut& cut, const QObject* receiver, const char* slot,
QObject* parent, const char* name) :
const TQString& useTextUnchecked, const TQString& useIconUnchecked,
const TQString& useTextChecked, const TQString& useIconChecked,
const KShortcut& cut, const TQObject* receiver, const char* slot,
TQObject* tqparent, const char* name) :
KToggleAction(useTextUnchecked, useIconUnchecked, cut, receiver,
slot, parent, name),
slot, tqparent, name),
textChecked(useTextChecked), textUnchecked(useTextUnchecked),
iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) {
}
IconToggleAction::IconToggleAction(const QString& useText,
const QString& useIconUnchecked, const QString& useIconChecked,
const KShortcut& cut, const QObject* receiver, const char* slot,
QObject* parent, const char* name) :
IconToggleAction::IconToggleAction(const TQString& useText,
const TQString& useIconUnchecked, const TQString& useIconChecked,
const KShortcut& cut, const TQObject* receiver, const char* slot,
TQObject* tqparent, const char* name) :
KToggleAction(useText, useIconUnchecked, cut, receiver,
slot, parent, name),
slot, tqparent, name),
textChecked(useText), textUnchecked(useText),
iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) {
}
IconToggleAction::IconToggleAction(
const QString& useTextUnchecked, const QString& useIconUnchecked,
const QString& useTextChecked, const QString& useIconChecked,
const KShortcut& cut, QObject* parent, const char* name) :
KToggleAction(useTextUnchecked, useIconUnchecked, cut, parent, name),
const TQString& useTextUnchecked, const TQString& useIconUnchecked,
const TQString& useTextChecked, const TQString& useIconChecked,
const KShortcut& cut, TQObject* tqparent, const char* name) :
KToggleAction(useTextUnchecked, useIconUnchecked, cut, tqparent, name),
textChecked(useTextChecked), textUnchecked(useTextUnchecked),
iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) {
}
IconToggleAction::IconToggleAction(const QString& useText,
const QString& useIconUnchecked, const QString& useIconChecked,
const KShortcut& cut, QObject* parent, const char* name) :
KToggleAction(useText, useIconUnchecked, cut, parent, name),
IconToggleAction::IconToggleAction(const TQString& useText,
const TQString& useIconUnchecked, const TQString& useIconChecked,
const KShortcut& cut, TQObject* tqparent, const char* name) :
KToggleAction(useText, useIconUnchecked, cut, tqparent, name),
textChecked(useText), textUnchecked(useText),
iconChecked(useIconChecked), iconUnchecked(useIconUnchecked) {
}

@ -22,28 +22,29 @@
*/
class IconToggleAction : public KToggleAction {
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructors.
*/
IconToggleAction(
const QString& useTextUnchecked, const QString& useIconUnchecked,
const QString& useTextChecked, const QString& useIconChecked,
const KShortcut& cut, const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0);
IconToggleAction(const QString& useText,
const QString& useIconUnchecked, const QString& useIconChecked,
const KShortcut& cut, const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0);
const TQString& useTextUnchecked, const TQString& useIconUnchecked,
const TQString& useTextChecked, const TQString& useIconChecked,
const KShortcut& cut, const TQObject* receiver, const char* slot,
TQObject* tqparent, const char* name = 0);
IconToggleAction(const TQString& useText,
const TQString& useIconUnchecked, const TQString& useIconChecked,
const KShortcut& cut, const TQObject* receiver, const char* slot,
TQObject* tqparent, const char* name = 0);
IconToggleAction(
const QString& useTextUnchecked, const QString& useIconUnchecked,
const QString& useTextChecked, const QString& useIconChecked,
const KShortcut& cut = KShortcut(), QObject* parent = 0,
const TQString& useTextUnchecked, const TQString& useIconUnchecked,
const TQString& useTextChecked, const TQString& useIconChecked,
const KShortcut& cut = KShortcut(), TQObject* tqparent = 0,
const char* name = 0);
IconToggleAction(const QString& useText,
const QString& useIconUnchecked, const QString& useIconChecked,
const KShortcut& cut = KShortcut(), QObject* parent = 0,
IconToggleAction(const TQString& useText,
const TQString& useIconUnchecked, const TQString& useIconChecked,
const KShortcut& cut = KShortcut(), TQObject* tqparent = 0,
const char* name = 0);
/**
@ -52,9 +53,9 @@ class IconToggleAction : public KToggleAction {
virtual void setChecked(bool);
private:
QString textChecked, textUnchecked;
TQString textChecked, textUnchecked;
/**< The labels to use in the checked and unchecked states. */
QString iconChecked, iconUnchecked;
TQString iconChecked, iconUnchecked;
/**< The icons to use in the checked and unchecked states. */
};

@ -15,8 +15,8 @@
#include <klocale.h>
KCPUDock::KCPUDock(int whichCPU, StatPopup *parent, const char *name) :
StatDock(whichCPU, i18n("C"), parent, name) {
KCPUDock::KCPUDock(int whichCPU, StatPopup *tqparent, const char *name) :
StatDock(whichCPU, i18n("C"), tqparent, name) {
}
void KCPUDock::setCPULabel(int set) {
@ -27,6 +27,6 @@ void KCPUDock::setCPULabel(int set) {
else
setLabel(i18n("C"));
repaint();
tqrepaint();
}

@ -25,7 +25,7 @@ public:
/**
* Constructor.
*/
KCPUDock(int whichDock, StatPopup *parent = 0, const char *name = 0);
KCPUDock(int whichDock, StatPopup *tqparent = 0, const char *name = 0);
/**
* Sets the label for this diagram. The label will reflect which

@ -21,8 +21,8 @@
#include <klocale.h>
#include <kpopupmenu.h>
KCPULoad::KCPULoad(QWidget *parent, const char *name) :
StatPopup(true, parent, name) {
KCPULoad::KCPULoad(TQWidget *tqparent, const char *name) :
StatPopup(true, tqparent, name) {
// Create the /proc reading class and check for SMP.
proc = new KCPUProc();
supportSMP = proc->hasSMP();
@ -31,7 +31,7 @@ KCPULoad::KCPULoad(QWidget *parent, const char *name) :
setupActions();
// the vector must not be reallocated during resizing because the class
// that it contains (Reading) cannot be copied safely
// that it tqcontains (Reading) cannot be copied safely
r.reserve(proc->cpu.size());
// Create system tray windows.
@ -65,16 +65,16 @@ void KCPULoad::setSMP(bool set) {
config->sync();
}
QString KCPULoad::dockName(int which) const {
return i18n("CPU %1").arg(which+1);
TQString KCPULoad::dockName(int which) const {
return i18n("CPU %1").tqarg(which+1);
}
QColor KCPULoad::defaultDockColor(int which) const {
static const QColor c[] = {
QColor(0, 255, 0),
QColor(255, 0, 0),
QColor(255, 255, 0),
QColor(0, 255, 255)
TQColor KCPULoad::defaultDockColor(int which) const {
static const TQColor c[] = {
TQColor(0, 255, 0),
TQColor(255, 0, 0),
TQColor(255, 255, 0),
TQColor(0, 255, 255)
};
return c[which % (sizeof(c)/sizeof(c[0]))];
}
@ -85,7 +85,7 @@ void KCPULoad::setupCustomActions() {
actSMP = new IconToggleAction(i18n("Enable S&MP"), "smp",
i18n("S&MP Enabled"), "smpon", 0, coll, "smp");
actSMP->setChecked(bVal);
connect(actSMP, SIGNAL(toggled(bool)), this, SLOT(setSMP(bool)));
connect(actSMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setSMP(bool)));
}
}
@ -122,34 +122,34 @@ void KCPULoad::takeReadingInternal() {
if (isVisible()) {
if (r.size() > 1) {
if (isSplit()) {
QString user =
TQString user =
i18n("Current CPU User: %1%")
.arg(proc->all.userPercent());
QString sys =
.tqarg(proc->all.userPercent());
TQString sys =
i18n("Current CPU System: %1%")
.arg(proc->all.systemPercent());
.tqarg(proc->all.systemPercent());
for (int i = 0; i < r.size(); i++) {
user += i18n(", C%1: %2%").arg(i+1).arg(r[i].upper);
sys += i18n(", C%1: %2%").arg(i+1).arg(r[i].lower);
user += i18n(", C%1: %2%").tqarg(i+1).tqarg(r[i].upper);
sys += i18n(", C%1: %2%").tqarg(i+1).tqarg(r[i].lower);
}
fullReading = i18n("%1.\n%2.").arg(user, sys);
fullReading = i18n("%1.\n%2.").tqarg(user, sys);
} else {
QString total =
TQString total =
i18n("Current CPU usage: %1%")
.arg(proc->all.totalPercent());
.tqarg(proc->all.totalPercent());
for (int i = 0; i < r.size(); i++) {
total += i18n(", C%1: %2%").arg(i+1).arg(r[i].upper);
total += i18n(", C%1: %2%").tqarg(i+1).tqarg(r[i].upper);
}
fullReading = i18n("%1.").arg(total);
fullReading = i18n("%1.").tqarg(total);
}
} else if (r.size() > 0) {
if (isSplit()) {
fullReading = i18n(
"Current CPU User: %1%.\n"
"Current CPU System: %2%.")
.arg(r[0].upper).arg(r[0].lower);
.tqarg(r[0].upper).tqarg(r[0].lower);
} else {
fullReading = i18n("Current CPU usage: %1%.").arg(r[0].upper);
fullReading = i18n("Current CPU usage: %1%.").tqarg(r[0].upper);
}
}
}

@ -24,12 +24,13 @@ class KToggleAction;
*/
class KCPULoad : public StatPopup {
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructor and destructor.
*/
KCPULoad(QWidget *parent = 0, const char *name = 0);
KCPULoad(TQWidget *tqparent = 0, const char *name = 0);
~KCPULoad();
public slots:
@ -42,8 +43,8 @@ protected:
/**
* Overrides from StatPopup.
*/
virtual QString dockName(int which) const;
virtual QColor defaultDockColor(int which) const;
virtual TQString dockName(int which) const;
virtual TQColor defaultDockColor(int which) const;
virtual void setupCustomActions();
virtual void insertCustomItems(KPopupMenu* menu);
virtual void takeReadingInternal();

@ -15,7 +15,7 @@
#define __KCPUPROC_H
#include <cstdio>
#include <qglobal.h>
#include <tqglobal.h>
#include <vector>
/**

@ -16,30 +16,30 @@
#include <cstdlib>
#include <kcombobox.h>
#include <klocale.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qvalidator.h>
#include <tqlabel.h>
#include <tqhbox.h>
#include <tqvalidator.h>
static int stockSpeed[] = {
100, 150, 200, 250, 300, 400, 600, 800, 1000, 1200, 1500, 2000, 2500,
3000, 4000, 5000, 0
};
SpeedDialog::SpeedDialog(int defaultSpeed, QWidget* parent) :
KDialogBase(parent, "speed dialog", true,
SpeedDialog::SpeedDialog(int defaultSpeed, TQWidget* tqparent) :
KDialogBase(tqparent, "speed dialog", true,
i18n("Select Speed"), Ok|Cancel, Ok),
speed(defaultSpeed) {
QHBox* page = makeHBoxMainWidget();
TQHBox* page = makeHBoxMainWidget();
new QLabel(i18n("Update interval in milliseconds:"), page);
new TQLabel(i18n("Update interval in milliseconds:"), page);
KComboBox* speedBox = new KComboBox(true, page);
QIntValidator* val = new QIntValidator(this);
TQIntValidator* val = new TQIntValidator(TQT_TQOBJECT(this));
val->setBottom(1);
speedBox->setValidator(val);
QString speedStr;
TQString speedStr;
for (int i = 0; stockSpeed[i]; i++) {
speedStr.setNum(stockSpeed[i]);
speedBox->insertItem(speedStr);
@ -48,15 +48,15 @@ SpeedDialog::SpeedDialog(int defaultSpeed, QWidget* parent) :
speedStr.setNum(defaultSpeed);
speedBox->setCurrentText(speedStr);
connect(speedBox, SIGNAL(textChanged(const QString&)),
this, SLOT(updateSpeed(const QString&)));
connect(speedBox, TQT_SIGNAL(textChanged(const TQString&)),
this, TQT_SLOT(updateSpeed(const TQString&)));
}
int SpeedDialog::getSpeed() const {
return speed;
}
void SpeedDialog::updateSpeed(const QString& text) {
void SpeedDialog::updateSpeed(const TQString& text) {
speed = atoi(text.ascii());
}

@ -21,12 +21,13 @@
*/
class SpeedDialog : public KDialogBase {
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructor.
*/
SpeedDialog(int defaultSpeed, QWidget* parent);
SpeedDialog(int defaultSpeed, TQWidget* tqparent);
/**
* Returns the speed currently selected in the dialog.
@ -39,7 +40,7 @@ class SpeedDialog : public KDialogBase {
* Updates the speed variable to reflect the latest changes in
* the speed combo box.
*/
virtual void updateSpeed(const QString&);
virtual void updateSpeed(const TQString&);
private:
int speed;

@ -13,28 +13,28 @@
#include "statdock.h"
#include "statpopup.h"
#include <qpainter.h>
#include <tqpainter.h>
const int StatDock::fillLines = 0;
const int StatDock::fillBars = 1;
const int StatDock::fillShaded = 2;
const QColor StatDock::colorGrid(120, 120, 120);
const QColor StatDock::colorGridInactive(60, 60, 60);
const QColor StatDock::colorLabel(255, 255, 255);
const QColor StatDock::colorLabelInactive(125, 125, 125);
const QColor StatDock::colorLower(255, 255, 255);
const QColor StatDock::colorLowerInactive(125, 125, 125);
const QColor StatDock::colorBlack(0, 0, 0);
const TQColor StatDock::colorGrid(120, 120, 120);
const TQColor StatDock::colorGridInactive(60, 60, 60);
const TQColor StatDock::colorLabel(255, 255, 255);
const TQColor StatDock::colorLabelInactive(125, 125, 125);
const TQColor StatDock::colorLower(255, 255, 255);
const TQColor StatDock::colorLowerInactive(125, 125, 125);
const TQColor StatDock::colorBlack(0, 0, 0);
//#define DOCK_SIZE 24
#define DOCK_SIZE width()
#define DOCK_SCALE (((float) 105)/((float) (DOCK_SIZE-1)))
#define SOFT_STEP 3
StatDock::StatDock(int whichDock, const QString& useLabel,
StatPopup *parent, const char *name) :
KSystemTray(parent,name),
StatDock::StatDock(int whichDock, const TQString& useLabel,
StatPopup *tqparent, const char *name) :
KSystemTray(tqparent,name),
label(useLabel),
bufUpper(0),
bufLower(0),
@ -48,7 +48,7 @@ StatDock::StatDock(int whichDock, const QString& useLabel,
bufUpper[i] = bufLower[i] = 0;
// Initialise the display.
parent->initDock(this, contextMenu(), whichDock);
tqparent->initDock(this, contextMenu(), whichDock);
setBackgroundColor(colorBlack);
resize(DOCK_SIZE, DOCK_SIZE);
show();
@ -59,7 +59,7 @@ StatDock::~StatDock() {
delete[] bufLower;
}
void StatDock::resizeEvent ( QResizeEvent * )
void StatDock::resizeEvent ( TQResizeEvent * )
{
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
int* bufUpperOld;
@ -78,54 +78,54 @@ void StatDock::resizeEvent ( QResizeEvent * )
delete[] bufUpperOld;
delete[] bufLowerOld;
repaint();
tqrepaint();
}
void StatDock::setGrid(bool set) {
grid = set;
repaint();
tqrepaint();
}
void StatDock::setActive(bool set) {
active = set;
repaint();
tqrepaint();
}
void StatDock::setSoft(bool set) {
soft = set;
repaint();
tqrepaint();
}
void StatDock::setSplit(bool set) {
split = set;
repaint();
tqrepaint();
}
void StatDock::setLabelled(bool set) {
labelled = set;
repaint();
tqrepaint();
}
void StatDock::setLabel(const QString& set) {
void StatDock::setLabel(const TQString& set) {
label = set;
repaint();
tqrepaint();
}
void StatDock::setFill(int set) {
fill = set;
repaint();
tqrepaint();
}
void StatDock::setColor(const QColor& set) {
void StatDock::setColor(const TQColor& set) {
colorUpper = set;
colorUpperInactive = colorUpper.dark();
repaint();
tqrepaint();
}
void StatDock::clearHistory(void) {
for (i = 0; i < DOCK_SIZE; i++)
bufUpper[i] = bufLower[i] = 0;
repaint();
tqrepaint();
}
void StatDock::addPercentReading(int upper, int lower) {
@ -164,11 +164,11 @@ void StatDock::addPercentReading(int upper, int lower) {
}
// Refresh the diagram.
repaint();
tqrepaint();
}
void StatDock::paintEvent(QPaintEvent*) {
QPainter p(this);
void StatDock::paintEvent(TQPaintEvent*) {
TQPainter p(this);
// Start by drawing the grid.
if(grid) {
@ -261,7 +261,7 @@ void StatDock::paintEvent(QPaintEvent*) {
// Finally label the diagrams.
if(labelled) {
p.setFont(QFont( "Helvetica", ((8*DOCK_SIZE)/24) ));
p.setFont(TQFont( "Helvetica", ((8*DOCK_SIZE)/24) ));
p.setPen((active) ? colorLabel : colorLabelInactive);
p.drawText(rect(), AlignLeft | AlignTop, label);
}

@ -14,7 +14,7 @@
#ifndef __STATDOCK_H
#define __STATDOCK_H
#include <qcolor.h>
#include <tqcolor.h>
#include <ksystemtray.h>
class StatPopup;
@ -29,11 +29,12 @@ class StatPopup;
* with the upper readings shown above the lower readings. When diagram
* splitting is switched off, only the upper readings will be displayed.
*
* The parent window of a StatDock must be a StatPopup, which provides
* The tqparent window of a StatDock must be a StatPopup, which provides
* all of the actions in this window's context menu.
*/
class StatDock : public KSystemTray {
Q_OBJECT
TQ_OBJECT
public:
/**
@ -46,26 +47,26 @@ public:
/**
* Colour constants.
*/
static const QColor colorGrid;
static const QColor colorGridInactive;
static const QColor colorLabel;
static const QColor colorLabelInactive;
static const QColor colorLower;
static const QColor colorLowerInactive;
static const QColor colorBlack;
static const TQColor colorGrid;
static const TQColor colorGridInactive;
static const TQColor colorLabel;
static const TQColor colorLabelInactive;
static const TQColor colorLower;
static const TQColor colorLowerInactive;
static const TQColor colorBlack;
public:
/**
* Constructor and destructor.
*
* Note that the constructor will call parent->initDock().
* Note that the constructor will call tqparent->initDock().
*
* Parameter whichDock must be 0 or 1 to specify whether this dock
* will become dock[0] or dock[1] in the given StatPopup parent.
* will become dock[0] or dock[1] in the given StatPopup tqparent.
* Parameter useLabel should contain the label that will be drawn on
* the diagram if labelling is enabled.
*/
StatDock(int whichDock, const QString& useLabel, StatPopup *parent,
StatDock(int whichDock, const TQString& useLabel, StatPopup *tqparent,
const char *name = 0);
~StatDock();
@ -77,9 +78,9 @@ public:
void setSoft(bool);
void setSplit(bool);
void setLabelled(bool);
void setLabel(const QString&);
void setLabel(const TQString&);
void setFill(int);
void setColor(const QColor&);
void setColor(const TQColor&);
public slots:
/**
@ -108,7 +109,7 @@ private:
/**
* Repaint this system tray window with a fresh diagram.
*/
void paintEvent(QPaintEvent*);
void paintEvent(TQPaintEvent*);
private:
/**
@ -125,13 +126,13 @@ private:
/**< Are we displaying both upper and lower readings? */
bool labelled;
/**< Should this diagram be labelled? */
QString label;
TQString label;
/**< The specific label to draw on this diagram. */
int fill;
/**< Specifies which of the predefined fill styles to use. */
QColor colorUpper;
TQColor colorUpper;
/**< Colour for displaying the upper readings. */
QColor colorUpperInactive;
TQColor colorUpperInactive;
/**< Colour for displaying the upper readings whilst the diagram
is inactive. */
@ -157,7 +158,7 @@ private:
/**< Temporary variables used during computations. */
protected:
void resizeEvent ( QResizeEvent * );
void resizeEvent ( TQResizeEvent * );
};
#endif

@ -16,8 +16,8 @@
#include "statdock.h"
#include "statpopup.h"
#include <qpainter.h>
#include <qtimer.h>
#include <tqpainter.h>
#include <tqtimer.h>
#include <kaction.h>
#include <kcolordialog.h>
#include <kconfig.h>
@ -34,7 +34,7 @@
#define TEXT_EXPANSION_HORIZONTAL 10
#define TEXT_EXPANSION_VERTICAL 3
const QColor StatPopup::colorBorder(0, 0, 0);
const TQColor StatPopup::colorBorder(0, 0, 0);
StatPopup::Reading::Reading() :
dock(0),
@ -54,14 +54,14 @@ void StatPopup::Reading::Init(int which, StatPopup* popup)
color = popup->defaultDockColor(which);
color = popup->config->readColorEntry(colorid, &color);
actColor = new KAction(i18n("Color (%1)...").arg(popup->dockName(which)),
"color", 0, popup, SLOT(selectColor()), popup->coll, colorid);
actColor = new KAction(i18n("Color (%1)...").tqarg(popup->dockName(which)),
"color", 0, TQT_TQOBJECT(popup), TQT_SLOT(selectColor()), popup->coll, colorid);
}
StatPopup::StatPopup(bool useSupportSplit, QWidget *parent, const char *name) :
QWidget(parent, name, Qt::WStyle_Customize | Qt::WStyle_NoBorder |
Qt::WStyle_StaysOnTop | Qt::WDestructiveClose | Qt::WType_TopLevel),
StatPopup::StatPopup(bool useSupportSplit, TQWidget *tqparent, const char *name) :
TQWidget(tqparent, name, TQt::WStyle_Customize | TQt::WStyle_NoBorder |
TQt::WStyle_StaysOnTop | TQt::WDestructiveClose | TQt::WType_TopLevel),
supportSplit(useSupportSplit) {
// Window management.
KWin::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
@ -83,8 +83,8 @@ StatPopup::StatPopup(bool useSupportSplit, QWidget *parent, const char *name) :
coll = new KActionCollection(this);
// Set up a timer for our periodic updates.
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(takeReading()));
timer = new TQTimer(this);
connect(timer, TQT_SIGNAL(timeout()), TQT_TQOBJECT(this), TQT_SLOT(takeReading()));
}
StatPopup::~StatPopup() {
@ -292,20 +292,20 @@ void StatPopup::setGrid(bool set) {
void StatPopup::selectColor() {
// which color?
int whichDock;
if (sscanf(sender()->name(), "Color%d", &whichDock) != 1)
if (sscanf(TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name(), "Color%d", &whichDock) != 1)
return;
if (whichDock < 0 || whichDock >= r.size())
return;
if (r[whichDock].dock) {
QColor ans;
TQColor ans;
if (KColorDialog::getColor(ans, r[whichDock].color, firstDock()) ==
QDialog::Accepted) {
TQDialog::Accepted) {
r[whichDock].color = ans;
r[whichDock].dock->setColor(ans);
config->setGroup("General Options");
QString n;
TQString n;
n.sprintf("Color%d", whichDock);
config->writeEntry(n, ans);
config->sync();
@ -334,57 +334,57 @@ void StatPopup::setupActions() {
bVal = config->readBoolEntry("Active", true);
actActive = new KToggleAction(i18n("&Active"), 0, coll, "active");
actActive->setChecked(bVal);
connect(actActive, SIGNAL(toggled(bool)), this, SLOT(setActive(bool)));
connect(actActive, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setActive(bool)));
actClearHistory = new KAction(i18n("&Clear"), "editdelete", 0,
this, SLOT(clearHistory()), coll, "clear");
TQT_TQOBJECT(this), TQT_SLOT(clearHistory()), coll, "clear");
speed = config->readNumEntry("Speed", DEFAULT_SPEED);
actSpeed = new KAction(i18n("&Speed..."), "speedarrow", 0,
this, SLOT(selectSpeed()), coll, "speed");
TQT_TQOBJECT(this), TQT_SLOT(selectSpeed()), coll, "speed");
if (supportSplit) {
bVal = config->readBoolEntry("Split", true);
actSplit = new IconToggleAction(i18n("Sp&lit Graph"), "split",
i18n("Graph Sp&litting Enabled"), "spliton", 0, coll, "split");
actSplit->setChecked(bVal);
connect(actSplit, SIGNAL(toggled(bool)), this, SLOT(setSplit(bool)));
connect(actSplit, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setSplit(bool)));
}
fillStyle = config->readNumEntry("StyleID", StatDock::fillShaded);
actFillLines = new IconToggleAction(i18n("&Lines"), "lines", "lineson", 0,
this, SLOT(setFillLines()), coll, "filllines");
TQT_TQOBJECT(this), TQT_SLOT(setFillLines()), coll, "filllines");
actFillLines->setChecked(fillStyle == StatDock::fillLines);
actFillBars = new IconToggleAction(i18n("&Bars"), "bars", "barson", 0,
this, SLOT(setFillBars()), coll, "fillbars");
TQT_TQOBJECT(this), TQT_SLOT(setFillBars()), coll, "fillbars");
actFillBars->setChecked(fillStyle == StatDock::fillBars);
actFillShaded = new IconToggleAction(i18n("&Shaded"), "shaded", "shadedon",
0, this, SLOT(setFillShaded()), coll, "fillshaded");
0, TQT_TQOBJECT(this), TQT_SLOT(setFillShaded()), coll, "fillshaded");
actFillShaded->setChecked(fillStyle == StatDock::fillShaded);
bVal = config->readBoolEntry("Soft", false);
actSoft = new IconToggleAction(i18n("So&ft Curves"), "soft",
i18n("So&ft Curves Enabled"), "softon", 0, coll, "soft");
actSoft->setChecked(bVal);
connect(actSoft, SIGNAL(toggled(bool)), this, SLOT(setSoft(bool)));
connect(actSoft, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setSoft(bool)));
bVal = config->readBoolEntry("Labelled", true);
actLabelled= new IconToggleAction(i18n("Show &Labels"), "labels",
i18n("&Labels Enabled"), "labelson", 0, coll, "labelled");
actLabelled->setChecked(bVal);
connect(actLabelled, SIGNAL(toggled(bool)), this, SLOT(setLabelled(bool)));
connect(actLabelled, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setLabelled(bool)));
bVal = config->readBoolEntry("Grid", true);
actGrid = new IconToggleAction(i18n("Show &Grid"), "grid",
i18n("&Grid Enabled"), "gridon", 0, coll, "grid");
actGrid->setChecked(bVal);
connect(actGrid, SIGNAL(toggled(bool)), this, SLOT(setGrid(bool)));
connect(actGrid, TQT_SIGNAL(toggled(bool)), TQT_TQOBJECT(this), TQT_SLOT(setGrid(bool)));
setupCustomActions();
}
void StatPopup::paintEvent(QPaintEvent*) {
QPainter p(this);
void StatPopup::paintEvent(TQPaintEvent*) {
TQPainter p(this);
// Draw the border.
p.setPen(colorBorder);
@ -399,12 +399,12 @@ void StatPopup::paintEvent(QPaintEvent*) {
// Draw the text.
p.setFont(font());
p.setPen(colorGroup().foreground());
p.setPen(tqcolorGroup().foreground());
p.drawText(rect(), AlignHCenter | AlignVCenter, fullReading);
}
void StatPopup::mousePressEvent(QMouseEvent* e) {
if(e->button() == RightButton) {
void StatPopup::mousePressEvent(TQMouseEvent* e) {
if(e->button() == Qt::RightButton) {
// Hide the pop-up.
hide();
} else {
@ -412,38 +412,38 @@ void StatPopup::mousePressEvent(QMouseEvent* e) {
isDragged = true;
relX = e->x();
relY = e->y();
repaint();
tqrepaint();
}
}
void StatPopup::mouseMoveEvent(QMouseEvent* e) {
void StatPopup::mouseMoveEvent(TQMouseEvent* e) {
// In the middle of a drag operation.
move(e->globalX() - relX, e->globalY() - relY);
}
void StatPopup::mouseReleaseEvent(QMouseEvent* e) {
void StatPopup::mouseReleaseEvent(TQMouseEvent* e) {
// The end of a drag operation.
move(e->globalX() - relX, e->globalY() - relY);
isDragged = false;
repaint();
tqrepaint();
}
void StatPopup::closeEvent(QCloseEvent* e) {
void StatPopup::closeEvent(TQCloseEvent* e) {
// We're about to close. Save the current state for the last time.
savePopupState();
closing = true;
QWidget::closeEvent(e);
TQWidget::closeEvent(e);
}
void StatPopup::hideEvent(QHideEvent* e) {
void StatPopup::hideEvent(TQHideEvent* e) {
// We're about to hide. Save the current state if we're not
// closing altogether.
if (! closing)
savePopupState();
QWidget::hideEvent(e);
TQWidget::hideEvent(e);
}
void StatPopup::showEvent(QShowEvent* e) {
void StatPopup::showEvent(TQShowEvent* e) {
// Make sure we're up-to-date and properly resized.
if (isActive())
takeReading();
@ -453,7 +453,7 @@ void StatPopup::showEvent(QShowEvent* e) {
// Window management - fix so a taskbar button doesn't appear
KWin::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
QWidget::showEvent(e);
TQWidget::showEvent(e);
}
void StatPopup::takeReading() {
@ -469,17 +469,17 @@ void StatPopup::takeReading() {
if (resizeRequested)
resizeToText();
repaint();
tqrepaint();
}
}
void StatPopup::resizeToText() {
resizeRequested = false;
QSize size = fontMetrics().size(0, fullReading);
TQSize size = fontMetrics().size(0, fullReading);
resize(size.width() + 2 * TEXT_EXPANSION_HORIZONTAL,
size.height() + 2 * TEXT_EXPANSION_VERTICAL);
repaint();
tqrepaint();
}
#include "statpopup.moc"

@ -14,8 +14,8 @@
#ifndef __STATPOPUP_H
#define __STATPOPUP_H
#include <qwidget.h>
#include <vector> // sorry, QValueVector::erase() does not call destructors
#include <tqwidget.h>
#include <vector> // sorry, TQValueVector::erase() does not call destructors
class KAction;
class KActionCollection;
@ -24,7 +24,7 @@ class KPopupMenu;
class KRadioAction;
class KSelectAction;
class KToggleAction;
class QTimer;
class TQTimer;
class StatDock;
/**
@ -47,14 +47,15 @@ class StatDock;
* require either subclass initialisation or an existing system tray
* window.
*/
class StatPopup : public QWidget {
class StatPopup : public TQWidget {
Q_OBJECT
TQ_OBJECT
public:
/**
* Colour constants.
*/
static const QColor colorBorder;
static const TQColor colorBorder;
public:
/**
@ -64,7 +65,7 @@ public:
* any configuration information. See the general class notes also
* for a list of other routines this constructor will not call.
*/
StatPopup(bool useSupportSplit, QWidget *parent = 0, const char *name = 0);
StatPopup(bool useSupportSplit, TQWidget *tqparent = 0, const char *name = 0);
~StatPopup();
/**
@ -128,8 +129,8 @@ protected:
* The argument given will be either 0 or 1, referring to window
* dock[0] or dock[1] respectively.
*/
virtual QString dockName(int which) const = 0;
virtual QColor defaultDockColor(int which) const = 0;
virtual TQString dockName(int which) const = 0;
virtual TQColor defaultDockColor(int which) const = 0;
/**
* Take a fresh reading. Subclasses must override this routine.
@ -195,21 +196,21 @@ protected:
/**
* Custom painting routine.
*/
void paintEvent(QPaintEvent *);
void paintEvent(TQPaintEvent *);
/**
* Overrides for dragging support.
*/
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void mousePressEvent(TQMouseEvent *);
void mouseReleaseEvent(TQMouseEvent *);
void mouseMoveEvent(TQMouseEvent *);
/**
* Overrides for saving the popup state.
*/
void closeEvent(QCloseEvent *);
void hideEvent(QHideEvent *);
void showEvent(QShowEvent *);
void closeEvent(TQCloseEvent *);
void hideEvent(TQHideEvent *);
void showEvent(TQShowEvent *);
protected slots:
/**
@ -235,7 +236,7 @@ protected:
/**< The upper reading taken during the last reading. */
int lower;
/**< The lower reading taken during the last reading. */
QColor color;
TQColor color;
/**< The colour used in the system tray diagram. */
KAction* actColor;
/**< The menu item to change the colour of this dock. */
@ -248,7 +249,7 @@ protected:
KActionCollection* coll;
/**< The collection of all application-level actions. */
QString fullReading;
TQString fullReading;
/**< A full string describing the last reading taken,
to be displayed in this pop-up. */
@ -264,7 +265,7 @@ private:
/**
* Update support.
*/
QTimer* timer;
TQTimer* timer;
/**< The timer handling periodic updates. */
int speed;
/**< The frequency of updates in milliseconds. */

Loading…
Cancel
Save