summaryrefslogtreecommitdiffstats
path: root/kmoon
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 21:31:21 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 21:31:21 +0000
commita1bd60b34891ccc77056c190d7871bc4b14fe654 (patch)
tree713f2f72c8f08a18df12f5bbeef7f9b61b19d4f1 /kmoon
parent8d92c3c2a4131996726cc7b625d3cd3caec296de (diff)
downloadtdetoys-a1bd60b34891ccc77056c190d7871bc4b14fe654.tar.gz
tdetoys-a1bd60b34891ccc77056c190d7871bc4b14fe654.zip
TQt4 port kdetoys
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdetoys@1238103 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmoon')
-rw-r--r--kmoon/kmoonapplet.cpp26
-rw-r--r--kmoon/kmoonapplet.h3
-rw-r--r--kmoon/kmoondlg.cpp20
-rw-r--r--kmoon/kmoondlg.h9
-rw-r--r--kmoon/kmoonwidget.cpp68
-rw-r--r--kmoon/kmoonwidget.h11
-rw-r--r--kmoon/phases.cpp4
7 files changed, 72 insertions, 69 deletions
diff --git a/kmoon/kmoonapplet.cpp b/kmoon/kmoonapplet.cpp
index deb91ec..f9acc02 100644
--- a/kmoon/kmoonapplet.cpp
+++ b/kmoon/kmoonapplet.cpp
@@ -53,18 +53,18 @@ const char *description = I18N_NOOP("Moon Phase Indicator for KDE");
extern "C"
{
- KDE_EXPORT KPanelApplet *init(TQWidget *parent, const TQString& configFile)
+ KDE_EXPORT KPanelApplet *init(TQWidget *tqparent, const TQString& configFile)
{
KGlobal::locale()->insertCatalogue("kmoon");
return new MoonPAWidget(configFile, KPanelApplet::Normal,
KPanelApplet::About|KPanelApplet::Preferences,
- parent, "kmoonapplet");
+ tqparent, "kmoonapplet");
}
}
MoonPAWidget::MoonPAWidget(const TQString& configFile, Type type, int actions,
- TQWidget *parent, const char *name)
- : KPanelApplet(configFile, type, actions, parent, name)
+ TQWidget *tqparent, const char *name)
+ : KPanelApplet(configFile, type, actions, tqparent, name)
{
KConfig *config = KGlobal::config();
config->setGroup("General");
@@ -104,7 +104,7 @@ void MoonPAWidget::showAbout()
KStdGuiItem::ok() );
TQPixmap ret = DesktopIcon("kmoon");
- TQString text = i18n(description) + TQString::fromLatin1("\n\n") +
+ TQString text = i18n(description) + TQString::tqfromLatin1("\n\n") +
i18n("Written by Stephan Kulow <[email protected]>\n"
"\n"
"Made an applet by M G Berberich "
@@ -118,12 +118,12 @@ void MoonPAWidget::showAbout()
dialog->setIcon(ret);
- KMessageBox::createKMessageBox(dialog, ret, text, TQStringList(), TQString::null, 0, KMessageBox::Notify);
+ KMessageBox::createKMessageBox(dialog, ret, text, TQStringList(), TQString(), 0, KMessageBox::Notify);
}
void MoonPAWidget::settings()
{
- KMoonDlg dlg(moon->angle(), moon->northHemi(), moon->mask(),
+ KMoonDlg dlg(moon->angle(), moon->northHemi(), moon->tqmask(),
this, "moondlg");
if (dlg.exec() == KMoonDlg::Accepted) {
moon->setAngle(dlg.getAngle());
@@ -133,10 +133,10 @@ void MoonPAWidget::settings()
config->setGroup("General");
config->writeEntry("Rotation", moon->angle());
config->writeEntry("Northern", moon->northHemi());
- config->writeEntry("Mask", moon->mask());
+ config->writeEntry("Mask", moon->tqmask());
config->sync();
}
- repaint();
+ tqrepaint();
}
void MoonPAWidget::timerEvent( TQTimerEvent * )
@@ -144,8 +144,8 @@ void MoonPAWidget::timerEvent( TQTimerEvent * )
time_t clock;
time(&clock);
struct tm *t = localtime(&clock);
- moon->calcStatus(mktime(t));
- moon->repaint();
+ moon->calctqStatus(mktime(t));
+ moon->tqrepaint();
}
void MoonPAWidget::mousePressEvent( TQMouseEvent *e)
@@ -153,11 +153,11 @@ void MoonPAWidget::mousePressEvent( TQMouseEvent *e)
if (!popup)
return;
- if (e->button() == RightButton) {
+ if (e->button() == Qt::RightButton) {
popup->popup(mapToGlobal(e->pos()));
popup->exec();
}
- if (e->button() == LeftButton) {
+ if (e->button() == Qt::LeftButton) {
showAbout();
}
}
diff --git a/kmoon/kmoonapplet.h b/kmoon/kmoonapplet.h
index 489a5d7..aa88592 100644
--- a/kmoon/kmoonapplet.h
+++ b/kmoon/kmoonapplet.h
@@ -37,10 +37,11 @@ class MoonWidget;
class MoonPAWidget : public KPanelApplet
{
Q_OBJECT
+ TQ_OBJECT
public:
MoonPAWidget(const TQString& configFile, Type t = Normal, int actions = 0,
- TQWidget *parent = 0, const char *name = 0);
+ TQWidget *tqparent = 0, const char *name = 0);
~MoonPAWidget();
int widthForHeight(int height) const { return height; }
diff --git a/kmoon/kmoondlg.cpp b/kmoon/kmoondlg.cpp
index 25390ac..a2204b3 100644
--- a/kmoon/kmoondlg.cpp
+++ b/kmoon/kmoondlg.cpp
@@ -29,9 +29,9 @@
#include "kmoondlg.h"
#include "kmoonwidget.h"
-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)
+KMoonDlg::KMoonDlg(int a, bool n, bool m, TQWidget *tqparent, const char *name)
+ : KDialogBase(tqparent, name, true, i18n("Change View"),
+ Ok|Cancel|Help), angle(a), north(n), tqmask(m)
{
TQWidget *page = new TQWidget( this );
setMainWidget(page);
@@ -71,11 +71,11 @@ KMoonDlg::KMoonDlg(int a, bool n, bool m, TQWidget *parent, const char *name)
connect(hemitoggle, TQT_SIGNAL(clicked()), TQT_SLOT(toggleHemi()));
- masktoggle = new TQPushButton(hbox2);
- masktoggle->setText(mask ? i18n("Switch Masking Off") :
+ tqmasktoggle = new TQPushButton(hbox2);
+ tqmasktoggle->setText(tqmask ? i18n("Switch Masking Off") :
i18n("Switch Masking On"));
- connect(masktoggle, TQT_SIGNAL(clicked()), TQT_SLOT(toggleMask()));
+ connect(tqmasktoggle, TQT_SIGNAL(clicked()), TQT_SLOT(toggleMask()));
topLayout->addWidget(vbox);
moon = new MoonWidget(page, "preview");
@@ -94,7 +94,7 @@ void KMoonDlg::angleChanged(int value) {
}
void KMoonDlg::help() {
- kapp->invokeHelp(TQString::fromLatin1("config"));
+ kapp->invokeHelp(TQString::tqfromLatin1("config"));
}
void KMoonDlg::toggleHemi() {
@@ -105,9 +105,9 @@ void KMoonDlg::toggleHemi() {
}
void KMoonDlg::toggleMask() {
- moon->setMask(!moon->mask());
- mask = moon->mask();
- masktoggle->setText(mask ? i18n("Switch Masking Off") :
+ moon->setMask(!moon->tqmask());
+ tqmask = moon->tqmask();
+ tqmasktoggle->setText(tqmask ? i18n("Switch Masking Off") :
i18n("Switch Masking On"));
}
diff --git a/kmoon/kmoondlg.h b/kmoon/kmoondlg.h
index c5d0c33..b0d4118 100644
--- a/kmoon/kmoondlg.h
+++ b/kmoon/kmoondlg.h
@@ -29,21 +29,22 @@ class TQPushButton;
class KMoonDlg : public KDialogBase {
Q_OBJECT
+ TQ_OBJECT
public:
- KMoonDlg(int angle, bool north, bool mask, TQWidget *parent, const char *name);
+ KMoonDlg(int angle, bool north, bool tqmask, TQWidget *tqparent, const char *name);
int getAngle() const { return angle; }
bool getNorthHemi() const { return north; }
- bool getMask() const { return mask; }
+ bool getMask() const { return tqmask; }
private:
TQSlider *slider;
MoonWidget *moon;
int angle;
bool north;
- bool mask;
+ bool tqmask;
TQPushButton *hemitoggle;
- TQPushButton *masktoggle;
+ TQPushButton *tqmasktoggle;
private slots:
void help();
diff --git a/kmoon/kmoonwidget.cpp b/kmoon/kmoonwidget.cpp
index 7df6375..183451c 100644
--- a/kmoon/kmoonwidget.cpp
+++ b/kmoon/kmoonwidget.cpp
@@ -50,8 +50,8 @@
extern double moonphasebylunation(int lun, int phi);
extern time_t JDtoDate(double jd, struct tm *event_date);
-MoonWidget::MoonWidget(TQWidget *parent, const char *name)
- : TQWidget(parent, name)
+MoonWidget::MoonWidget(TQWidget *tqparent, const char *name)
+ : TQWidget(tqparent, name)
{
struct tm * t;
time_t clock;
@@ -61,23 +61,23 @@ MoonWidget::MoonWidget(TQWidget *parent, const char *name)
config->setGroup("General");
_angle = config->readNumEntry("Rotation", 0);
_north = config->readBoolEntry("Northern", true);
- _mask = config->readBoolEntry("Mask", true);
+ _tqmask = config->readBoolEntry("Mask", true);
old_angle = old_w = old_h = old_counter = -1;
old_north = false;
- old_mask = false;
+ old_tqmask = false;
startTimer(1000 * 60 * 20);
time(&clock);
t = gmtime(&clock);
// kdDebug() << "time " << t->tm_isdst << " " << timezone << " " << daylight << endl ;
- calcStatus(mktime(t));
+ calctqStatus(mktime(t));
}
MoonWidget::~MoonWidget()
{
}
-void MoonWidget::calcStatus( time_t time )
+void MoonWidget::calctqStatus( time_t time )
{
uint lun = 0;
time_t last_new = 0;
@@ -217,17 +217,17 @@ void MoonWidget::calcStatus( time_t time )
}
renderGraphic();
- repaint();
+ tqrepaint();
}
TQImage MoonWidget::loadMoon(int index)
{
if (index == 0) // the new moon has the wrong filename
index = 29;
- TQString filename = TQString("kmoon/pics/moon%1.png").arg(index);
+ TQString filename = TQString("kmoon/pics/moon%1.png").tqarg(index);
TQString path = locate("data", filename);
if (path.isNull())
- kdFatal() << "cound't find " << filename << ". Exiting.\n";
+ kdFatal() << "cound't tqfind " << filename << ". Exiting.\n";
TQImage image(path);
KIconEffect iconeffect;
image=iconeffect.apply(image, KIcon::Panel, KIcon::DefaultState);
@@ -238,21 +238,21 @@ void MoonWidget::setAngle(int value)
{
_angle = value;
renderGraphic();
- repaint();
+ tqrepaint();
}
void MoonWidget::setNorthHemi(bool n)
{
_north = n;
renderGraphic();
- repaint();
+ tqrepaint();
}
void MoonWidget::setMask(bool value)
{
- _mask = value;
+ _tqmask = value;
renderGraphic();
- repaint();
+ tqrepaint();
}
void MoonWidget::paintEvent(TQPaintEvent *)
@@ -263,7 +263,7 @@ void MoonWidget::paintEvent(TQPaintEvent *)
void MoonWidget::resizeEvent(TQResizeEvent *)
{
renderGraphic();
- repaint();
+ tqrepaint();
}
void MoonWidget::renderGraphic()
@@ -280,7 +280,7 @@ void MoonWidget::renderGraphic()
im = im.convertDepth(32, 0);
assert(!im.isNull());
- int mw = QMIN(width(), height());
+ int mw = TQMIN(width(), height());
TQImage dest;
if (TQPixmap::defaultDepth() > 8) {
@@ -300,7 +300,7 @@ void MoonWidget::renderGraphic()
TQRegion r(TQRect(0, 0, dmw, dmw), TQRegion::Ellipse);
TQPainter p;
p.begin(&pixmap);
- p.fillRect(0, 0, dmw, dmw, Qt::black);
+ p.fillRect(0, 0, dmw, dmw, TQt::black);
p.setClipRegion(r);
p.drawPixmap(0, 0, rotated, (rotated.width() - dmw) / 2,
(rotated.height() - dmw) / 2,
@@ -311,41 +311,41 @@ void MoonWidget::renderGraphic()
im = pixmap.convertToImage();
dest = im.copy(0, 0, mw, mw);
for (int y = 0; y < mw; y++) {
- QRgb *destline = (QRgb*)dest.scanLine(y);
- QRgb *sourceline1 = (QRgb*)im.scanLine(2*y);
- QRgb *sourceline2 = (QRgb*)im.scanLine(2*y + 1);
+ TQRgb *destline = (TQRgb*)dest.scanLine(y);
+ TQRgb *sourceline1 = (TQRgb*)im.scanLine(2*y);
+ TQRgb *sourceline2 = (TQRgb*)im.scanLine(2*y + 1);
for (int x = 0; x < mw; x++) {
- int r = qRed(sourceline1[2*x]) + qRed(sourceline1[2*x+1]);
- r = r + qRed(sourceline2[2*x]) + qRed(sourceline2[2*x+1]);
- int g = qGreen(sourceline1[2*x]) + qGreen(sourceline1[2*x+1]);
- g = g + qGreen(sourceline2[2*x]) + qGreen(sourceline2[2*x+1]);
- int b = qBlue(sourceline1[2*x]) + qBlue(sourceline1[2*x+1]);
- b = b + qBlue(sourceline2[2*x]) + qBlue(sourceline2[2*x+1]);
- destline[x] = qRgb(qRound(r / 4), qRound(g / 4),
- qRound(b / 4));
+ int r = tqRed(sourceline1[2*x]) + tqRed(sourceline1[2*x+1]);
+ r = r + tqRed(sourceline2[2*x]) + tqRed(sourceline2[2*x+1]);
+ int g = tqGreen(sourceline1[2*x]) + tqGreen(sourceline1[2*x+1]);
+ g = g + tqGreen(sourceline2[2*x]) + tqGreen(sourceline2[2*x+1]);
+ int b = tqBlue(sourceline1[2*x]) + tqBlue(sourceline1[2*x+1]);
+ b = b + tqBlue(sourceline2[2*x]) + tqBlue(sourceline2[2*x+1]);
+ destline[x] = tqRgb(tqRound(r / 4), tqRound(g / 4),
+ tqRound(b / 4));
}
}
} else {
dest = im.smoothScale(mw, mw).convertDepth(32);
}
- if (_mask) {
+ if (_tqmask) {
// generate alpha-channel
int dmw = mw*2;
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.fillRect(0, 0, dmw, dmw, TQt::white);
p.setClipRegion(r);
- p.fillRect(0, 0, dmw, dmw, Qt::black);
+ p.fillRect(0, 0, dmw, dmw, TQt::black);
p.end();
- TQImage Mask2 = dMask.convertToImage().convertDepth(32).smoothScale(mw, mw);
+ TQImage Mask2 = TQImage(dMask.convertToImage()).convertDepth(32).smoothScale(mw, mw);
dest.setAlphaBuffer(true);
for (int y = 0; y < mw; y++) {
- QRgb *destline = (QRgb*)dest.scanLine(y);
- QRgb *sourceline = (QRgb*)Mask2.scanLine(y);
+ TQRgb *destline = (TQRgb*)dest.scanLine(y);
+ TQRgb *sourceline = (TQRgb*)Mask2.scanLine(y);
for (int x = 0; x < mw; x++) {
- destline[x] = (destline[x] & RGB_MASK)|(qRed(sourceline[x]) << 24);
+ destline[x] = (destline[x] & TQRGB_MASK)|(tqRed(sourceline[x]) << 24);
}
}
}
diff --git a/kmoon/kmoonwidget.h b/kmoon/kmoonwidget.h
index 9439784..d1f7367 100644
--- a/kmoon/kmoonwidget.h
+++ b/kmoon/kmoonwidget.h
@@ -28,15 +28,16 @@
#include <ksystemtray.h>
class TQPopupMenu;
-class MoonWidget : public QWidget
+class MoonWidget : public TQWidget
{
Q_OBJECT
+ TQ_OBJECT
public:
- MoonWidget(TQWidget *parent = 0, const char *name = 0);
+ MoonWidget(TQWidget *tqparent = 0, const char *name = 0);
~MoonWidget();
- void calcStatus( time_t time );
+ void calctqStatus( time_t time );
int angle() const { return _angle; }
void setAngle(int angle);
@@ -44,14 +45,14 @@ public:
bool northHemi() const { return _north; }
void setNorthHemi(bool b);
- bool mask() const { return _mask; }
+ bool tqmask() const { return _tqmask; }
void setMask(bool b);
protected:
int old_w, old_h;
int counter, old_counter;
int _angle, old_angle;
- int _mask, old_mask;
+ int _tqmask, old_tqmask;
bool old_north, _north;
TQPixmap pixmap;
diff --git a/kmoon/phases.cpp b/kmoon/phases.cpp
index 7fc0f4c..972afc2 100644
--- a/kmoon/phases.cpp
+++ b/kmoon/phases.cpp
@@ -166,9 +166,9 @@ double torad(double x)
** since the New Moon of 2000 January 6.
**
** int phi: another phase parameter, selecting the phase of the
-** moon. 0 = New, 1 = First Qtr, 2 = Full, 3 = Last Qtr
+** moon. 0 = New, 1 = First TQtr, 2 = Full, 3 = Last TQtr
**
-** Return: Apparent JD of the needed phase
+** Return: Aptqparent JD of the needed phase
*/
#include <stdio.h>