diff options
Diffstat (limited to 'src/brightnesschooserimpl.cpp')
-rw-r--r-- | src/brightnesschooserimpl.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/brightnesschooserimpl.cpp b/src/brightnesschooserimpl.cpp index 30fed3e..60051b6 100644 --- a/src/brightnesschooserimpl.cpp +++ b/src/brightnesschooserimpl.cpp @@ -19,17 +19,17 @@ ***************************************************************************/ #include "brightnesschooserimpl.h" -#include <qprocess.h> -#include <qslider.h> -#include <qlabel.h> -#include <qmessagebox.h> +#include <ntqprocess.h> +#include <ntqslider.h> +#include <ntqlabel.h> +#include <ntqmessagebox.h> #include <kdebug.h> -#include <qevent.h> -#include <qregexp.h> +#include <ntqevent.h> +#include <ntqregexp.h> #include "preferences.h" -BrightnessChooserImpl::BrightnessChooserImpl(QWidget *parent, const char *name) +BrightnessChooserImpl::BrightnessChooserImpl(TQWidget *parent, const char *name) : BrightnessChooser(parent, name), proc(0) { updateSlider(); @@ -50,7 +50,7 @@ BrightnessChooserImpl::~BrightnessChooserImpl() { // in case save the current brightness setting if (Preferences::saveCurrent()) { - const QString &val = getValue(); + const TQString &val = getValue(); kdDebug() << "save the current brightness value: " << val << endl; Preferences::setCurrentValue(val); Preferences::writeConfig(); @@ -59,10 +59,10 @@ BrightnessChooserImpl::~BrightnessChooserImpl() void BrightnessChooserImpl::updateSlider() { - brightnessSlider->setPageStep(QString(Preferences::step()).toInt()); - brightnessSlider->setLineStep(QString(Preferences::step()).toInt()); - brightnessSlider->setRange(QString(Preferences::minValue()).toInt(), - QString(Preferences::maxValue()).toInt()+1); + brightnessSlider->setPageStep(TQString(Preferences::step()).toInt()); + brightnessSlider->setLineStep(TQString(Preferences::step()).toInt()); + brightnessSlider->setRange(TQString(Preferences::minValue()).toInt(), + TQString(Preferences::maxValue()).toInt()+1); valueLabel->setText(getValue()); kdDebug() << "updateSlider" << endl; kdDebug() << "program: " << Preferences::program() << endl; @@ -77,9 +77,9 @@ void BrightnessChooserImpl::updateBrightness() if (proc) delete proc; // delete the previous instance - proc = new QProcess(this); + proc = new TQProcess(this); - QString args = Preferences::setArgument(); + TQString args = Preferences::setArgument(); args += getValue(); proc->addArgument( Preferences::program() ); proc->addArgument( args ); @@ -93,19 +93,19 @@ void BrightnessChooserImpl::updateBrightness() if ( !proc->start() ) { // error handling - QMessageBox::critical( 0, + TQMessageBox::critical( 0, tr("Fatal error"), tr("Could not start the brightness adjustment command."), tr("Quit") ); } - QString arguments = proc->arguments().join(" "); - qWarning("%s", arguments.ascii()); + TQString arguments = proc->arguments().join(" "); + tqWarning("%s", arguments.ascii()); } void BrightnessChooserImpl::getBrightness() { - QString args = Preferences::getArgument(); + TQString args = Preferences::getArgument(); /* some programs, such as nvclock, do not have a parameter to get the current brightness; in such case we simply return */ @@ -117,7 +117,7 @@ void BrightnessChooserImpl::getBrightness() if (proc) delete proc; // delete the previous instance - proc = new QProcess(this); + proc = new TQProcess(this); proc->addArgument( Preferences::program() ); proc->addArgument( args ); @@ -131,14 +131,14 @@ void BrightnessChooserImpl::getBrightness() if ( !proc->start() ) { // error handling - QMessageBox::critical( 0, + TQMessageBox::critical( 0, tr("Fatal error"), tr("Could not start the brightness adjustment command."), tr("Quit") ); } - QString arguments = proc->arguments().join(" "); - qWarning("%s", arguments.ascii()); + TQString arguments = proc->arguments().join(" "); + tqWarning("%s", arguments.ascii()); } void BrightnessChooserImpl::updateValue(int) @@ -150,47 +150,47 @@ void BrightnessChooserImpl::readFromStderr() { // Read and process the data. // Bear in mind that the data might be output in chunks. - QString out = proc->readStderr(); - qWarning( "%s", out.ascii() ); + TQString out = proc->readStderr(); + tqWarning( "%s", out.ascii() ); } void BrightnessChooserImpl::readFromStdout() { // Read and process the data. // Bear in mind that the data might be output in chunks. - QString out = proc->readStdout(); - qWarning( "%s", out.ascii() ); + TQString out = proc->readStdout(); + tqWarning( "%s", out.ascii() ); } void BrightnessChooserImpl::readValueFromStdout() { // Read and process the data. // Bear in mind that the data might be output in chunks. - QString out = proc->readStdout(); - QRegExp regexp("(\\d+)"); + TQString out = proc->readStdout(); + TQRegExp regexp("(\\d+)"); if (regexp.search(out) > 0) { - QString result = regexp.cap(1); + TQString result = regexp.cap(1); kdDebug() << "initial slider value: " << brightnessSlider->value() << endl; kdDebug() << "captured result: " << result << endl; brightnessSlider->setValue(brightnessSlider->maxValue() - result.toInt()); kdDebug() << "updated slider value: " << brightnessSlider->value() << endl; } - qWarning( "%s", out.ascii() ); + tqWarning( "%s", out.ascii() ); } void BrightnessChooserImpl::procExited() { - qWarning("process terminated"); + tqWarning("process terminated"); emit valueUpdated(); } -const QString BrightnessChooserImpl::getValue() +const TQString BrightnessChooserImpl::getValue() { - return QString::number((brightnessSlider->maxValue() - brightnessSlider->value())); + return TQString::number((brightnessSlider->maxValue() - brightnessSlider->value())); } -void BrightnessChooserImpl::setValue(const QString &val) +void BrightnessChooserImpl::setValue(const TQString &val) { int iVal = brightnessSlider->maxValue() - val.toInt(); kdDebug() << "set slider value: " << iVal << endl; @@ -198,15 +198,15 @@ void BrightnessChooserImpl::setValue(const QString &val) updateBrightness(); } -void BrightnessChooserImpl::keyPressEvent(QKeyEvent *event) +void BrightnessChooserImpl::keyPressEvent(TQKeyEvent *event) { /* intercept ENTER and simulate the OK button; also intercept ESC in order to close the parent widget (otherwise ESC is passed to the applet which seems to close the main panel?)*/ - if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { + if (event->key() == TQt::Key_Return || event->key() == TQt::Key_Enter) { kdDebug() << "pressed ENTER" << endl; updateBrightness(); - } else if (event->key() == Qt::Key_Escape) { + } else if (event->key() == TQt::Key_Escape) { kdDebug() << "pressed ESC" << endl; parentWidget()->close(); } else { |