diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:49:52 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:49:52 +0000 |
commit | cfc42a28c327b96c6a2afee92af3bac1a479eb8a (patch) | |
tree | e3219edf5f827eaa4db3feb509a17846a1a5a752 /kmoon | |
parent | a73fc4d7e66fe0824313aa4e9a650c4cddef6e9f (diff) | |
download | tdetoys-cfc42a28c327b96c6a2afee92af3bac1a479eb8a.tar.gz tdetoys-cfc42a28c327b96c6a2afee92af3bac1a479eb8a.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdetoys@1157650 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmoon')
-rw-r--r-- | kmoon/kmoonapplet.cpp | 34 | ||||
-rw-r--r-- | kmoon/kmoonapplet.h | 16 | ||||
-rw-r--r-- | kmoon/kmoondlg.cpp | 54 | ||||
-rw-r--r-- | kmoon/kmoondlg.h | 8 | ||||
-rw-r--r-- | kmoon/kmoonwidget.cpp | 64 | ||||
-rw-r--r-- | kmoon/kmoonwidget.h | 16 |
6 files changed, 96 insertions, 96 deletions
diff --git a/kmoon/kmoonapplet.cpp b/kmoon/kmoonapplet.cpp index 9b3dd87..deb91ec 100644 --- a/kmoon/kmoonapplet.cpp +++ b/kmoon/kmoonapplet.cpp @@ -23,11 +23,11 @@ #include <assert.h> #include <unistd.h> -#include <qbitmap.h> -#include <qtooltip.h> -#include <qpainter.h> -#include <qpopupmenu.h> -#include <qlayout.h> +#include <tqbitmap.h> +#include <tqtooltip.h> +#include <tqpainter.h> +#include <tqpopupmenu.h> +#include <tqlayout.h> #include <dcopclient.h> #include <kdebug.h> @@ -53,7 +53,7 @@ const char *description = I18N_NOOP("Moon Phase Indicator for KDE"); extern "C" { - KDE_EXPORT KPanelApplet *init(QWidget *parent, const QString& configFile) + KDE_EXPORT KPanelApplet *init(TQWidget *parent, const TQString& configFile) { KGlobal::locale()->insertCatalogue("kmoon"); return new MoonPAWidget(configFile, KPanelApplet::Normal, @@ -62,14 +62,14 @@ extern "C" } } -MoonPAWidget::MoonPAWidget(const QString& configFile, Type type, int actions, - QWidget *parent, const char *name) +MoonPAWidget::MoonPAWidget(const TQString& configFile, Type type, int actions, + TQWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name) { KConfig *config = KGlobal::config(); config->setGroup("General"); - QVBoxLayout *vbox = new QVBoxLayout(this, 0,0); + TQVBoxLayout *vbox = new TQVBoxLayout(this, 0,0); moon = new MoonWidget(this); moon->setAngle(config->readNumEntry("Rotation", 0)); moon->setNorthHemi(config->readBoolEntry("Northern", true)); @@ -77,12 +77,12 @@ MoonPAWidget::MoonPAWidget(const QString& configFile, Type type, int actions, vbox->addWidget(moon); startTimer(1000 * 60 * 20); - popup = new QPopupMenu(); + popup = new TQPopupMenu(); popup->insertItem(SmallIcon("kmoon"), i18n("&About"), this, - SLOT(showAbout())); + TQT_SLOT(showAbout())); popup->insertItem(SmallIcon("configure"), i18n("&Configure..."), this, - SLOT(settings())); + TQT_SLOT(settings())); // missuse timerEvent for initialising timerEvent(0); @@ -103,8 +103,8 @@ void MoonPAWidget::showAbout() 0, "about", true, true, KStdGuiItem::ok() ); - QPixmap ret = DesktopIcon("kmoon"); - QString text = i18n(description) + QString::fromLatin1("\n\n") + + TQPixmap ret = DesktopIcon("kmoon"); + TQString text = i18n(description) + TQString::fromLatin1("\n\n") + i18n("Written by Stephan Kulow <coolo@kde.org>\n" "\n" "Made an applet by M G Berberich " @@ -118,7 +118,7 @@ void MoonPAWidget::showAbout() dialog->setIcon(ret); - KMessageBox::createKMessageBox(dialog, ret, text, QStringList(), QString::null, 0, KMessageBox::Notify); + KMessageBox::createKMessageBox(dialog, ret, text, TQStringList(), TQString::null, 0, KMessageBox::Notify); } void MoonPAWidget::settings() @@ -139,7 +139,7 @@ void MoonPAWidget::settings() repaint(); } -void MoonPAWidget::timerEvent( QTimerEvent * ) +void MoonPAWidget::timerEvent( TQTimerEvent * ) { time_t clock; time(&clock); @@ -148,7 +148,7 @@ void MoonPAWidget::timerEvent( QTimerEvent * ) moon->repaint(); } -void MoonPAWidget::mousePressEvent( QMouseEvent *e) +void MoonPAWidget::mousePressEvent( TQMouseEvent *e) { if (!popup) return; diff --git a/kmoon/kmoonapplet.h b/kmoon/kmoonapplet.h index ac25d0f..1fdbf50 100644 --- a/kmoon/kmoonapplet.h +++ b/kmoon/kmoonapplet.h @@ -21,8 +21,8 @@ #ifndef KMOONAPPLET #define KMOONAPPLET -#include <qwidget.h> -#include <qimage.h> +#include <tqwidget.h> +#include <tqimage.h> #include <sys/types.h> #include <time.h> #include <ksystemtray.h> @@ -39,29 +39,29 @@ class MoonPAWidget : public KPanelApplet Q_OBJECT public: - MoonPAWidget(const QString& configFile, Type t = Normal, int actions = 0, - QWidget *parent = 0, const char *name = 0); + MoonPAWidget(const TQString& configFile, Type t = Normal, int actions = 0, + TQWidget *parent = 0, const char *name = 0); ~MoonPAWidget(); int widthForHeight(int height) const { return height; } int heightForWidth(int width) const { return width; } protected: - QPopupMenu *popup; + TQPopupMenu *popup; MoonWidget *moon; - QString tooltip; + TQString tooltip; void about() { showAbout(); } void preferences() { settings(); } protected slots: - void timerEvent( QTimerEvent *e); + void timerEvent( TQTimerEvent *e); void showAbout(); void settings(); protected: - void mousePressEvent( QMouseEvent *e); + void mousePressEvent( TQMouseEvent *e); }; #endif diff --git a/kmoon/kmoondlg.cpp b/kmoon/kmoondlg.cpp index 14f6f5a..25390ac 100644 --- a/kmoon/kmoondlg.cpp +++ b/kmoon/kmoondlg.cpp @@ -18,31 +18,31 @@ * */ -#include <qslider.h> -#include <qlayout.h> +#include <tqslider.h> +#include <tqlayout.h> #include <klocale.h> -#include <qwhatsthis.h> -#include <qvbox.h> +#include <tqwhatsthis.h> +#include <tqvbox.h> #include <kapplication.h> -#include <qpushbutton.h> +#include <tqpushbutton.h> #include "kmoondlg.h" #include "kmoonwidget.h" -KMoonDlg::KMoonDlg(int a, bool n, bool m, QWidget *parent, const char *name) +KMoonDlg::KMoonDlg(int a, bool n, bool m, TQWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Change View"), Ok|Cancel|Help), angle(a), north(n), mask(m) { - QWidget *page = new QWidget( this ); + TQWidget *page = new TQWidget( this ); setMainWidget(page); - QHBoxLayout *topLayout = new QHBoxLayout( page, 0, spacingHint() ); + TQHBoxLayout *topLayout = new TQHBoxLayout( page, 0, spacingHint() ); - QVBox *vbox = new QVBox(page); - QHBox *hbox1 = new QHBox(vbox); + TQVBox *vbox = new TQVBox(page); + TQHBox *hbox1 = new TQHBox(vbox); hbox1->setSpacing(15); - QLabel *label = new QLabel( i18n("View angle:"), hbox1, "caption" ); - QString text = i18n("You can use this to rotate the moon to the correct\n" + TQLabel *label = new TQLabel( i18n("View angle:"), hbox1, "caption" ); + TQString text = i18n("You can use this to rotate the moon to the correct\n" "angle for your location.\n" "\n" "This angle is (almost) impossible to\n" @@ -52,39 +52,39 @@ KMoonDlg::KMoonDlg(int a, bool n, bool m, QWidget *parent, const char *name) "The default value is 0, but it is very\n" "unlikely that you would see the moon\n" "at this angle."); - QWhatsThis::add(label, text); + TQWhatsThis::add(label, text); - slider = new QSlider( -90, 90, 2, angle, Qt::Horizontal, hbox1, "slider" ); - slider->setTickmarks(QSlider::Above); + slider = new TQSlider( -90, 90, 2, angle, Qt::Horizontal, hbox1, "slider" ); + slider->setTickmarks(TQSlider::Above); slider->setTickInterval(45); - slider->setEnabled(QPixmap::defaultDepth() > 8); - label->setEnabled(QPixmap::defaultDepth() > 8); - QWhatsThis::add(slider, text); - connect(slider, SIGNAL(valueChanged(int)), SLOT(angleChanged(int))); + slider->setEnabled(TQPixmap::defaultDepth() > 8); + label->setEnabled(TQPixmap::defaultDepth() > 8); + TQWhatsThis::add(slider, text); + connect(slider, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(angleChanged(int))); - QHBox *hbox2 = new QHBox(vbox); + TQHBox *hbox2 = new TQHBox(vbox); hbox2->setSpacing(spacingHint()); - hemitoggle = new QPushButton(hbox2); + hemitoggle = new TQPushButton(hbox2); hemitoggle->setText(north ? i18n("Switch to Southern Hemisphere") : i18n("Switch to Northern Hemisphere")); - connect(hemitoggle, SIGNAL(clicked()), SLOT(toggleHemi())); + connect(hemitoggle, TQT_SIGNAL(clicked()), TQT_SLOT(toggleHemi())); - masktoggle = new QPushButton(hbox2); + masktoggle = new TQPushButton(hbox2); masktoggle->setText(mask ? i18n("Switch Masking Off") : i18n("Switch Masking On")); - connect(masktoggle, SIGNAL(clicked()), SLOT(toggleMask())); + connect(masktoggle, TQT_SIGNAL(clicked()), TQT_SLOT(toggleMask())); topLayout->addWidget(vbox); moon = new MoonWidget(page, "preview"); moon->setMinimumSize(50, 50); moon->setMaximumSize(200,200); - QWhatsThis::add(moon, i18n("The moon as KMoon would display it\n" + TQWhatsThis::add(moon, i18n("The moon as KMoon would display it\n" "following your current setting and time.")); topLayout->addWidget(moon); - connect(this, SIGNAL(helpClicked()), SLOT(help())); + connect(this, TQT_SIGNAL(helpClicked()), TQT_SLOT(help())); // disableResize(); } @@ -94,7 +94,7 @@ void KMoonDlg::angleChanged(int value) { } void KMoonDlg::help() { - kapp->invokeHelp(QString::fromLatin1("config")); + kapp->invokeHelp(TQString::fromLatin1("config")); } void KMoonDlg::toggleHemi() { diff --git a/kmoon/kmoondlg.h b/kmoon/kmoondlg.h index 2533a2a..a927956 100644 --- a/kmoon/kmoondlg.h +++ b/kmoon/kmoondlg.h @@ -31,19 +31,19 @@ class KMoonDlg : public KDialogBase { Q_OBJECT public: - KMoonDlg(int angle, bool north, bool mask, QWidget *parent, const char *name); + KMoonDlg(int angle, bool north, bool mask, TQWidget *parent, const char *name); int getAngle() const { return angle; } bool getNorthHemi() const { return north; } bool getMask() const { return mask; } private: - QSlider *slider; + TQSlider *slider; MoonWidget *moon; int angle; bool north; bool mask; - QPushButton *hemitoggle; - QPushButton *masktoggle; + TQPushButton *hemitoggle; + TQPushButton *masktoggle; private slots: void help(); diff --git a/kmoon/kmoonwidget.cpp b/kmoon/kmoonwidget.cpp index 413b555..7df6375 100644 --- a/kmoon/kmoonwidget.cpp +++ b/kmoon/kmoonwidget.cpp @@ -23,11 +23,11 @@ #include <assert.h> #include <unistd.h> -#include <qbitmap.h> -#include <qtooltip.h> -#include <qpainter.h> -#include <qpopupmenu.h> -#include <qcolor.h> +#include <tqbitmap.h> +#include <tqtooltip.h> +#include <tqpainter.h> +#include <tqpopupmenu.h> +#include <tqcolor.h> #include <dcopclient.h> #include <kdebug.h> @@ -50,8 +50,8 @@ extern double moonphasebylunation(int lun, int phi); extern time_t JDtoDate(double jd, struct tm *event_date); -MoonWidget::MoonWidget(QWidget *parent, const char *name) - : QWidget(parent, name) +MoonWidget::MoonWidget(TQWidget *parent, const char *name) + : TQWidget(parent, name) { struct tm * t; time_t clock; @@ -92,30 +92,30 @@ void MoonWidget::calcStatus( time_t time ) lun -= 2; - QDateTime ln; + TQDateTime ln; ln.setTime_t( last_new ); kdDebug() << KGlobal::locale()->formatDateTime( ln ) << endl; time_t first_quarter = JDtoDate( moonphasebylunation( lun, 1 ), 0 ); - QDateTime fq; + TQDateTime fq; fq.setTime_t( first_quarter ); kdDebug() << KGlobal::locale()->formatDateTime( fq ) << endl; time_t full_moon = JDtoDate( moonphasebylunation( lun, 2 ), 0 ); - QDateTime fm; + TQDateTime fm; fm.setTime_t( full_moon ); kdDebug() << KGlobal::locale()->formatDateTime( fm ) << endl; time_t third_quarter = JDtoDate( moonphasebylunation( lun, 3 ), 0 ); - QDateTime tq; + TQDateTime tq; tq.setTime_t( third_quarter ); kdDebug() << KGlobal::locale()->formatDateTime( tq ) << endl; - QDateTime nn; + TQDateTime nn; nn.setTime_t( next_new ); kdDebug() << KGlobal::locale()->formatDateTime( nn ) << endl; - QDateTime now; + TQDateTime now; now.setTime_t( time ); kdDebug() << KGlobal::locale()->formatDateTime( now ) << endl; @@ -220,15 +220,15 @@ void MoonWidget::calcStatus( time_t time ) repaint(); } -QImage MoonWidget::loadMoon(int index) +TQImage MoonWidget::loadMoon(int index) { if (index == 0) // the new moon has the wrong filename index = 29; - QString filename = QString("kmoon/pics/moon%1.png").arg(index); - QString path = locate("data", filename); + TQString filename = TQString("kmoon/pics/moon%1.png").arg(index); + TQString path = locate("data", filename); if (path.isNull()) kdFatal() << "cound't find " << filename << ". Exiting.\n"; - QImage image(path); + TQImage image(path); KIconEffect iconeffect; image=iconeffect.apply(image, KIcon::Panel, KIcon::DefaultState); return image; @@ -255,12 +255,12 @@ void MoonWidget::setMask(bool value) repaint(); } -void MoonWidget::paintEvent(QPaintEvent *) +void MoonWidget::paintEvent(TQPaintEvent *) { bitBlt(this, 0, 0, &pixmap, 0, 0); } -void MoonWidget::resizeEvent(QResizeEvent *) +void MoonWidget::resizeEvent(TQResizeEvent *) { renderGraphic(); repaint(); @@ -275,15 +275,15 @@ void MoonWidget::renderGraphic() old_w = width(); old_h = height(); old_north = _north; - QImage im = loadMoon(counter); + TQImage im = loadMoon(counter); assert(!im.isNull()); im = im.convertDepth(32, 0); assert(!im.isNull()); int mw = QMIN(width(), height()); - QImage dest; + TQImage dest; - if (QPixmap::defaultDepth() > 8) { + if (TQPixmap::defaultDepth() > 8) { if (fabs(_angle)!=0) { // nothing to rotate //We expand the image 2x before rotating, rotate it, and then average out @@ -292,13 +292,13 @@ void MoonWidget::renderGraphic() if (!pixmap.convertFromImage(im.smoothScale(dmw, dmw), 0)) { return; } - QWMatrix m; + TQWMatrix m; m.rotate(_angle); - QPixmap rotated = pixmap.xForm(m); + TQPixmap rotated = pixmap.xForm(m); //Copy the relevant part back to the pixmap - QRegion r(QRect(0, 0, dmw, dmw), QRegion::Ellipse); - QPainter p; + TQRegion r(TQRect(0, 0, dmw, dmw), TQRegion::Ellipse); + TQPainter p; p.begin(&pixmap); p.fillRect(0, 0, dmw, dmw, Qt::black); p.setClipRegion(r); @@ -331,15 +331,15 @@ void MoonWidget::renderGraphic() if (_mask) { // generate alpha-channel int dmw = mw*2; - QBitmap dMask(dmw, dmw); - QRegion r(QRect(0, 0, dmw, dmw), QRegion::Ellipse); - QPainter p; + TQBitmap dMask(dmw, dmw); + TQRegion r(TQRect(0, 0, dmw, dmw), TQRegion::Ellipse); + TQPainter p; p.begin(&dMask); p.fillRect(0, 0, dmw, dmw, Qt::white); p.setClipRegion(r); p.fillRect(0, 0, dmw, dmw, Qt::black); p.end(); - QImage Mask2 = dMask.convertToImage().convertDepth(32).smoothScale(mw, mw); + TQImage Mask2 = dMask.convertToImage().convertDepth(32).smoothScale(mw, mw); dest.setAlphaBuffer(true); for (int y = 0; y < mw; y++) { QRgb *destline = (QRgb*)dest.scanLine(y); @@ -360,9 +360,9 @@ void MoonWidget::renderGraphic() return; } - QToolTip::remove(this); + TQToolTip::remove(this); - QToolTip::add(this, tooltip); + TQToolTip::add(this, tooltip); } diff --git a/kmoon/kmoonwidget.h b/kmoon/kmoonwidget.h index 474349a..0ded638 100644 --- a/kmoon/kmoonwidget.h +++ b/kmoon/kmoonwidget.h @@ -21,8 +21,8 @@ #ifndef KMOON #define KMOON -#include <qwidget.h> -#include <qimage.h> +#include <tqwidget.h> +#include <tqimage.h> #include <sys/types.h> #include <time.h> #include <ksystemtray.h> @@ -33,7 +33,7 @@ class MoonWidget : public QWidget Q_OBJECT public: - MoonWidget(QWidget *parent = 0, const char *name = 0); + MoonWidget(TQWidget *parent = 0, const char *name = 0); ~MoonWidget(); void calcStatus( time_t time ); @@ -54,14 +54,14 @@ protected: int _mask, old_mask; bool old_north, _north; - QPixmap pixmap; - QString tooltip; + TQPixmap pixmap; + TQString tooltip; - void paintEvent( QPaintEvent *e); - void resizeEvent( QResizeEvent *e); + void paintEvent( TQPaintEvent *e); + void resizeEvent( TQResizeEvent *e); private: - QImage loadMoon(int index); + TQImage loadMoon(int index); void renderGraphic(); }; |