diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
commit | c663b6440964f6ac48027143ac9e63298991f9d0 (patch) | |
tree | 6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /kcontrol/clock/dtime.cpp | |
parent | a061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff) | |
download | tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/clock/dtime.cpp')
-rw-r--r-- | kcontrol/clock/dtime.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/kcontrol/clock/dtime.cpp b/kcontrol/clock/dtime.cpp index ba8330c7a..109e436c4 100644 --- a/kcontrol/clock/dtime.cpp +++ b/kcontrol/clock/dtime.cpp @@ -22,15 +22,15 @@ #include <unistd.h> #include <sys/types.h> -#include <qcombobox.h> -#include <qgroupbox.h> -#include <qpushbutton.h> -#include <qpainter.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qwhatsthis.h> -#include <qcheckbox.h> -#include <qregexp.h> +#include <tqcombobox.h> +#include <tqgroupbox.h> +#include <tqpushbutton.h> +#include <tqpainter.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.h> +#include <tqregexp.h> #include <kdebug.h> #include <klocale.h> @@ -42,22 +42,22 @@ #include "dtime.h" #include "dtime.moc" -HMSTimeWidget::HMSTimeWidget(QWidget *parent, const char *name) : +HMSTimeWidget::HMSTimeWidget(TQWidget *parent, const char *name) : KIntSpinBox(parent, name) { } -QString HMSTimeWidget::mapValueToText(int value) +TQString HMSTimeWidget::mapValueToText(int value) { - QString s = QString::number(value); + TQString s = TQString::number(value); if( value < 10 ) { s = "0" + s; } return s; } -Dtime::Dtime(QWidget * parent, const char *name) - : QWidget(parent, name) +Dtime::Dtime(TQWidget * parent, const char *name) + : TQWidget(parent, name) { // ************************************************************* // Start Dialog @@ -65,51 +65,51 @@ Dtime::Dtime(QWidget * parent, const char *name) // Time Server - privateLayoutWidget = new QWidget( this, "layout1" ); - QHBoxLayout *layout1 = new QHBoxLayout( privateLayoutWidget, 0, 0, "ntplayout"); + privateLayoutWidget = new TQWidget( this, "layout1" ); + TQHBoxLayout *layout1 = new TQHBoxLayout( privateLayoutWidget, 0, 0, "ntplayout"); - setDateTimeAuto = new QCheckBox( privateLayoutWidget, "setDateTimeAuto" ); + setDateTimeAuto = new TQCheckBox( privateLayoutWidget, "setDateTimeAuto" ); setDateTimeAuto->setText(i18n("Set date and time &automatically:")); - connect(setDateTimeAuto, SIGNAL(toggled(bool)), this, SLOT(serverTimeCheck())); - connect(setDateTimeAuto, SIGNAL(toggled(bool)), SLOT(configChanged())); + connect(setDateTimeAuto, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(serverTimeCheck())); + connect(setDateTimeAuto, TQT_SIGNAL(toggled(bool)), TQT_SLOT(configChanged())); layout1->addWidget( setDateTimeAuto ); - timeServerList = new QComboBox( false, privateLayoutWidget, "timeServerList" ); - connect(timeServerList, SIGNAL(activated(int)), SLOT(configChanged())); - connect(timeServerList, SIGNAL(textChanged(const QString &)), SLOT(configChanged())); - connect(setDateTimeAuto, SIGNAL(toggled(bool)), timeServerList, SLOT(setEnabled(bool))); + timeServerList = new TQComboBox( false, privateLayoutWidget, "timeServerList" ); + connect(timeServerList, TQT_SIGNAL(activated(int)), TQT_SLOT(configChanged())); + connect(timeServerList, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(configChanged())); + connect(setDateTimeAuto, TQT_SIGNAL(toggled(bool)), timeServerList, TQT_SLOT(setEnabled(bool))); timeServerList->setEnabled(false); timeServerList->setEditable(true); layout1->addWidget( timeServerList ); findNTPutility(); // Date box - QGroupBox* dateBox = new QGroupBox( this, "dateBox" ); + TQGroupBox* dateBox = new TQGroupBox( this, "dateBox" ); - QVBoxLayout *l1 = new QVBoxLayout( dateBox, KDialog::spacingHint() ); + TQVBoxLayout *l1 = new TQVBoxLayout( dateBox, KDialog::spacingHint() ); cal = new KDatePicker( dateBox ); cal->setMinimumSize(cal->sizeHint()); l1->addWidget( cal ); - QWhatsThis::add( cal, i18n("Here you can change the system date's day of the month, month and year.") ); + TQWhatsThis::add( cal, i18n("Here you can change the system date's day of the month, month and year.") ); // Time frame - QGroupBox* timeBox = new QGroupBox( this, "timeBox" ); + TQGroupBox* timeBox = new TQGroupBox( this, "timeBox" ); - QVBoxLayout *v2 = new QVBoxLayout( timeBox, KDialog::spacingHint() ); + TQVBoxLayout *v2 = new TQVBoxLayout( timeBox, KDialog::spacingHint() ); kclock = new Kclock( timeBox, "kclock" ); kclock->setMinimumSize(150,150); v2->addWidget( kclock ); - QGridLayout *v3 = new QGridLayout( v2, 2, 9 ); + TQGridLayout *v3 = new TQGridLayout( v2, 2, 9 ); // Even if the module's widgets are reversed (usually when using RTL // languages), the placing of the time fields must always be H:M:S, from // left to right. - bool isRTL = QApplication::reverseLayout(); + bool isRTL = TQApplication::reverseLayout(); - QSpacerItem *spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + TQSpacerItem *spacer1 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); v3->addMultiCell(spacer1, 0, 1, 1, 1); hour = new HMSTimeWidget( timeBox ); @@ -118,9 +118,9 @@ Dtime::Dtime(QWidget * parent, const char *name) hour->setValidator(new KStrictIntValidator(0, 23, hour)); v3->addMultiCellWidget(hour, 0, 1, isRTL ? 6 : 2, isRTL ? 6 : 2 ); - QLabel *dots1 = new QLabel(":", timeBox); + TQLabel *dots1 = new TQLabel(":", timeBox); dots1->setMinimumWidth( 7 ); - dots1->setAlignment( QLabel::AlignCenter ); + dots1->setAlignment( TQLabel::AlignCenter ); v3->addMultiCellWidget(dots1, 0, 1, 3, 3 ); minute = new HMSTimeWidget( timeBox ); @@ -130,9 +130,9 @@ Dtime::Dtime(QWidget * parent, const char *name) minute->setValidator(new KStrictIntValidator(0, 59, minute)); v3->addMultiCellWidget(minute, 0, 1, 4, 4 ); - QLabel *dots2 = new QLabel(":", timeBox); + TQLabel *dots2 = new TQLabel(":", timeBox); dots2->setMinimumWidth( 7 ); - dots2->setAlignment( QLabel::AlignCenter ); + dots2->setAlignment( TQLabel::AlignCenter ); v3->addMultiCellWidget(dots2, 0, 1, 5, 5 ); second = new HMSTimeWidget( timeBox ); @@ -144,17 +144,17 @@ Dtime::Dtime(QWidget * parent, const char *name) v3->addColSpacing(7, 7); - QString wtstr = i18n("Here you can change the system time. Click into the" + TQString wtstr = i18n("Here you can change the system time. Click into the" " hours, minutes or seconds field to change the relevant value, either" " using the up and down buttons to the right or by entering a new value."); - QWhatsThis::add( hour, wtstr ); - QWhatsThis::add( minute, wtstr ); - QWhatsThis::add( second, wtstr ); + TQWhatsThis::add( hour, wtstr ); + TQWhatsThis::add( minute, wtstr ); + TQWhatsThis::add( second, wtstr ); - QSpacerItem *spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + TQSpacerItem *spacer3 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); v3->addMultiCell(spacer3, 0, 1, 9, 9); - QGridLayout *top = new QGridLayout( this, 2,2, KDialog::spacingHint() ); + TQGridLayout *top = new TQGridLayout( this, 2,2, KDialog::spacingHint() ); top->addWidget(dateBox, 1,0); top->addWidget(timeBox, 1,1); @@ -164,12 +164,12 @@ Dtime::Dtime(QWidget * parent, const char *name) // End Dialog // ************************************************************* - connect( hour, SIGNAL(valueChanged(int)), SLOT(set_time()) ); - connect( minute, SIGNAL(valueChanged(int)), SLOT(set_time()) ); - connect( second, SIGNAL(valueChanged(int)), SLOT(set_time()) ); - connect( cal, SIGNAL(dateChanged(QDate)), SLOT(changeDate(QDate))); + connect( hour, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(set_time()) ); + connect( minute, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(set_time()) ); + connect( second, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(set_time()) ); + connect( cal, TQT_SIGNAL(dateChanged(TQDate)), TQT_SLOT(changeDate(TQDate))); - connect( &internalTimer, SIGNAL(timeout()), SLOT(timeout()) ); + connect( &internalTimer, TQT_SIGNAL(timeout()), TQT_SLOT(timeout()) ); load(); @@ -228,7 +228,7 @@ void Dtime::set_time() emit timeChanged( TRUE ); } -void Dtime::changeDate(QDate d) +void Dtime::changeDate(TQDate d) { date = d; emit timeChanged( TRUE ); @@ -242,7 +242,7 @@ void Dtime::load() { KConfig config("kcmclockrc", true, false); config.setGroup("NTP"); - timeServerList->insertStringList(QStringList::split(',', config.readEntry("servers", + timeServerList->insertStringList(TQStringList::split(',', config.readEntry("servers", i18n("Public Time Server (pool.ntp.org),\ asia.pool.ntp.org,\ europe.pool.ntp.org,\ @@ -251,8 +251,8 @@ oceania.pool.ntp.org")))); setDateTimeAuto->setChecked(config.readBoolEntry("enabled", false)); // Reset to the current date and time - time = QTime::currentTime(); - date = QDate::currentDate(); + time = TQTime::currentTime(); + date = TQDate::currentDate(); cal->setDate(date); // start internal timer @@ -267,11 +267,11 @@ void Dtime::save() config.setGroup("NTP"); // Save the order, but don't duplicate! - QStringList list; + TQStringList list; if( timeServerList->count() != 0) list.append(timeServerList->currentText()); for ( int i=0; i<timeServerList->count();i++ ) { - QString text = timeServerList->text(i); + TQString text = timeServerList->text(i); if( list.find(text) == list.end()) list.append(text); // Limit so errors can go away and not stored forever @@ -283,17 +283,17 @@ void Dtime::save() if(setDateTimeAuto->isChecked() && !ntpUtility.isEmpty()){ // NTP Time setting - QString timeServer = timeServerList->currentText(); - if( timeServer.find( QRegExp(".*\\(.*\\)$") ) != -1 ) { - timeServer.replace( QRegExp(".*\\("), "" ); - timeServer.replace( QRegExp("\\).*"), "" ); + TQString timeServer = timeServerList->currentText(); + if( timeServer.find( TQRegExp(".*\\(.*\\)$") ) != -1 ) { + timeServer.replace( TQRegExp(".*\\("), "" ); + timeServer.replace( TQRegExp("\\).*"), "" ); // Would this be better?: s/^.*\(([^)]*)\).*$/\1/ } KProcess proc; proc << ntpUtility << timeServer; proc.start( KProcess::Block ); if( proc.exitStatus() != 0 ){ - KMessageBox::error( this, i18n(QString("Unable to contact time server: %1.").arg(timeServer).latin1())); + KMessageBox::error( this, i18n(TQString("Unable to contact time server: %1.").arg(timeServer).latin1())); setDateTimeAuto->setChecked( false ); } else { @@ -345,7 +345,7 @@ void Dtime::save() void Dtime::timeout() { // get current time - time = QTime::currentTime(); + time = TQTime::currentTime(); ontimeout = TRUE; second->setValue(time.second()); @@ -356,7 +356,7 @@ void Dtime::timeout() kclock->setTime( time ); } -QString Dtime::quickHelp() const +TQString Dtime::quickHelp() const { return i18n("<h1>Date & Time</h1> This control module can be used to set the system date and" " time. As these settings do not only affect you as a user, but rather the whole system, you" @@ -365,32 +365,32 @@ QString Dtime::quickHelp() const " administrator."); } -void Kclock::setTime(const QTime &time) +void Kclock::setTime(const TQTime &time) { this->time = time; repaint(); } -void Kclock::paintEvent( QPaintEvent * ) +void Kclock::paintEvent( TQPaintEvent * ) { if ( !isVisible() ) return; - QPainter paint; + TQPainter paint; paint.begin( this ); - QPointArray pts; - QPoint cp = rect().center(); + TQPointArray pts; + TQPoint cp = rect().center(); int d = QMIN(width(),height()); - QColor hands = colorGroup().dark(); - QColor shadow = colorGroup().text(); + TQColor hands = colorGroup().dark(); + TQColor shadow = colorGroup().text(); paint.setPen( shadow ); paint.setBrush( shadow ); paint.setViewport(4,4,width(),height()); for ( int c=0 ; c < 2 ; c++ ) { - QWMatrix matrix; + TQWMatrix matrix; matrix.translate( cp.x(), cp.y() ); matrix.scale( d/1000.0F, d/1000.0F ); @@ -435,12 +435,12 @@ void Kclock::paintEvent( QPaintEvent * ) paint.end(); } -QValidator::State KStrictIntValidator::validate( QString & input, int & d ) const +TQValidator::State KStrictIntValidator::validate( TQString & input, int & d ) const { if( input.isEmpty() ) return Valid; - State st = QIntValidator::validate( input, d ); + State st = TQIntValidator::validate( input, d ); if( st == Intermediate ) return Invalid; |