Trinity Qt initial conversion

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdetoys@1157650 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
parent a73fc4d7e6
commit cfc42a28c3

@ -36,9 +36,9 @@ class AmorIface : virtual public DCOPObject
public: public:
k_dcop: k_dcop:
virtual void showTip(QString tip) = 0; virtual void showTip(TQString tip) = 0;
virtual void showMessage(QString message ) = 0; virtual void showMessage(TQString message ) = 0;
virtual void showMessage(QString message, int msec ) = 0; virtual void showMessage(TQString message, int msec ) = 0;
virtual void screenSaverStopped() = 0; virtual void screenSaverStopped() = 0;
virtual void screenSaverStarted() = 0; virtual void screenSaverStarted() = 0;

@ -31,9 +31,9 @@
#include <kdebug.h> #include <kdebug.h>
#include <kpopupmenu.h> #include <kpopupmenu.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qcursor.h> #include <tqcursor.h>
#include <qvaluelist.h> #include <tqvaluelist.h>
#include <klocale.h> #include <klocale.h>
#include <kmessagebox.h> #include <kmessagebox.h>
@ -78,7 +78,7 @@
// Constructor // Constructor
// //
QueueItem::QueueItem(itemType ty, QString te, int ti) QueueItem::QueueItem(itemType ty, TQString te, int ti)
{ {
// if the time field was not given, calculate one based on the type // if the time field was not given, calculate one based on the type
// and length of the item // and length of the item
@ -120,7 +120,7 @@ QueueItem::QueueItem(itemType ty, QString te, int ti)
// AMOR // AMOR
// Constructor // Constructor
// //
Amor::Amor() : DCOPObject( "AmorIface" ), QObject() Amor::Amor() : DCOPObject( "AmorIface" ), TQObject()
{ {
mAmor = 0; mAmor = 0;
mBubble = 0; mBubble = 0;
@ -136,37 +136,37 @@ Amor::Amor() : DCOPObject( "AmorIface" ), QObject()
mState = Normal; mState = Normal;
mWin = new KWinModule; mWin = new KWinModule;
connect(mWin, SIGNAL(activeWindowChanged(WId)), connect(mWin, TQT_SIGNAL(activeWindowChanged(WId)),
this, SLOT(slotWindowActivate(WId))); this, TQT_SLOT(slotWindowActivate(WId)));
connect(mWin, SIGNAL(windowRemoved(WId)), connect(mWin, TQT_SIGNAL(windowRemoved(WId)),
this, SLOT(slotWindowRemove(WId))); this, TQT_SLOT(slotWindowRemove(WId)));
connect(mWin, SIGNAL(stackingOrderChanged()), connect(mWin, TQT_SIGNAL(stackingOrderChanged()),
this, SLOT(slotStackingChanged())); this, TQT_SLOT(slotStackingChanged()));
connect(mWin, SIGNAL(windowChanged(WId, const unsigned long *)), connect(mWin, TQT_SIGNAL(windowChanged(WId, const unsigned long *)),
this, SLOT(slotWindowChange(WId, const unsigned long *))); this, TQT_SLOT(slotWindowChange(WId, const unsigned long *)));
connect(mWin, SIGNAL(currentDesktopChanged(int)), connect(mWin, TQT_SIGNAL(currentDesktopChanged(int)),
this, SLOT(slotDesktopChange(int))); this, TQT_SLOT(slotDesktopChange(int)));
mAmor = new AmorWidget(); mAmor = new AmorWidget();
connect(mAmor, SIGNAL(mouseClicked(const QPoint &)), connect(mAmor, TQT_SIGNAL(mouseClicked(const TQPoint &)),
SLOT(slotMouseClicked(const QPoint &))); TQT_SLOT(slotMouseClicked(const TQPoint &)));
connect(mAmor, SIGNAL(dragged(const QPoint &, bool)), connect(mAmor, TQT_SIGNAL(dragged(const TQPoint &, bool)),
SLOT(slotWidgetDragged(const QPoint &, bool))); TQT_SLOT(slotWidgetDragged(const TQPoint &, bool)));
mAmor->resize(mTheme.maximumSize()); mAmor->resize(mTheme.maximumSize());
mTimer = new QTimer(this); mTimer = new TQTimer(this);
connect(mTimer, SIGNAL(timeout()), SLOT(slotTimeout())); connect(mTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()));
mStackTimer = new QTimer(this); mStackTimer = new TQTimer(this);
connect(mStackTimer, SIGNAL(timeout()), SLOT(restack())); connect(mStackTimer, TQT_SIGNAL(timeout()), TQT_SLOT(restack()));
mBubbleTimer = new QTimer(this); mBubbleTimer = new TQTimer(this);
connect(mBubbleTimer, SIGNAL(timeout()), SLOT(slotBubbleTimeout())); connect(mBubbleTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotBubbleTimeout()));
time(&mActiveTime); time(&mActiveTime);
mCursPos = QCursor::pos(); mCursPos = TQCursor::pos();
mCursorTimer = new QTimer(this); mCursorTimer = new TQTimer(this);
connect(mCursorTimer, SIGNAL(timeout()), SLOT(slotCursorTimeout())); connect(mCursorTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotCursorTimeout()));
mCursorTimer->start( 500 ); mCursorTimer->start( 500 );
if (mWin->activeWindow()) if (mWin->activeWindow())
@ -234,7 +234,7 @@ void Amor::screenSaverStarted()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
void Amor::showTip( QString tip ) void Amor::showTip( TQString tip )
{ {
if (mTipsQueue.count() < 5 && !mForceHideAmorWidget) // start dropping tips if the queue is too long if (mTipsQueue.count() < 5 && !mForceHideAmorWidget) // start dropping tips if the queue is too long
mTipsQueue.enqueue(new QueueItem(QueueItem::Tip, tip)); mTipsQueue.enqueue(new QueueItem(QueueItem::Tip, tip));
@ -247,12 +247,12 @@ void Amor::showTip( QString tip )
} }
void Amor::showMessage( QString message ) void Amor::showMessage( TQString message )
{ {
showMessage(message, -1); showMessage(message, -1);
} }
void Amor::showMessage( QString message , int msec ) void Amor::showMessage( TQString message , int msec )
{ {
// FIXME: What should be done about messages and tips while the screensaver is on? // FIXME: What should be done about messages and tips while the screensaver is on?
if (mForceHideAmorWidget) return; // do not show messages sent while in the screensaver if (mForceHideAmorWidget) return; // do not show messages sent while in the screensaver
@ -311,12 +311,12 @@ bool Amor::readConfig()
// Select a random theme if user requested it // Select a random theme if user requested it
if (mConfig.mRandomTheme) if (mConfig.mRandomTheme)
{ {
QStringList files; TQStringList files;
// Store relative paths into files to avoid storing absolute pathnames. // Store relative paths into files to avoid storing absolute pathnames.
KGlobal::dirs()->findAllResources("appdata", "*rc", false, false, files); KGlobal::dirs()->findAllResources("appdata", "*rc", false, false, files);
int randomTheme = kapp->random() % files.count(); int randomTheme = kapp->random() % files.count();
mConfig.mTheme = (QString)*files.at(randomTheme); mConfig.mTheme = (TQString)*files.at(randomTheme);
} }
// read selected theme // read selected theme
@ -439,14 +439,14 @@ void Amor::selectAnimation(State state)
// if the animation falls outside of the working area, // if the animation falls outside of the working area,
// then relocate it so that is inside the desktop again // then relocate it so that is inside the desktop again
QRect desktopArea = mWin->workArea(); TQRect desktopArea = mWin->workArea();
mInDesktopBottom = false; mInDesktopBottom = false;
if (mTargetRect.y() - mCurrAnim->hotspot().y() + mConfig.mOffset < if (mTargetRect.y() - mCurrAnim->hotspot().y() + mConfig.mOffset <
desktopArea.y()) desktopArea.y())
{ {
// relocate the animation at the bottom of the screen // relocate the animation at the bottom of the screen
mTargetRect = QRect(desktopArea.x(), mTargetRect = TQRect(desktopArea.x(),
desktopArea.y() + desktopArea.height(), desktopArea.y() + desktopArea.height(),
desktopArea.width(), 0); desktopArea.width(), 0);
@ -594,7 +594,7 @@ void Amor::restack()
// //
// The user clicked on our animation. // The user clicked on our animation.
// //
void Amor::slotMouseClicked(const QPoint &pos) void Amor::slotMouseClicked(const TQPoint &pos)
{ {
bool restartTimer = mTimer->isActive(); bool restartTimer = mTimer->isActive();
@ -610,10 +610,10 @@ void Amor::slotMouseClicked(const QPoint &pos)
KPopupMenu* helpMnu = help->menu(); KPopupMenu* helpMnu = help->menu();
mMenu = new KPopupMenu(); mMenu = new KPopupMenu();
mMenu->insertTitle("Amor"); // I really don't want this i18n'ed mMenu->insertTitle("Amor"); // I really don't want this i18n'ed
mMenu->insertItem(SmallIcon("configure"), i18n("&Configure..."), this, SLOT(slotConfigure())); mMenu->insertItem(SmallIcon("configure"), i18n("&Configure..."), this, TQT_SLOT(slotConfigure()));
mMenu->insertSeparator(); mMenu->insertSeparator();
mMenu->insertItem(SmallIcon("help"), i18n("&Help"), helpMnu); mMenu->insertItem(SmallIcon("help"), i18n("&Help"), helpMnu);
mMenu->insertItem(SmallIcon("exit"), i18n("&Quit"), kapp, SLOT(quit())); mMenu->insertItem(SmallIcon("exit"), i18n("&Quit"), kapp, TQT_SLOT(quit()));
} }
mMenu->exec(pos); mMenu->exec(pos);
@ -630,8 +630,8 @@ void Amor::slotMouseClicked(const QPoint &pos)
// //
void Amor::slotCursorTimeout() void Amor::slotCursorTimeout()
{ {
QPoint currPos = QCursor::pos(); TQPoint currPos = TQCursor::pos();
QPoint diff = currPos - mCursPos; TQPoint diff = currPos - mCursPos;
time_t now = time(0); time_t now = time(0);
if (mForceHideAmorWidget) return; // we're hidden, do nothing if (mForceHideAmorWidget) return; // we're hidden, do nothing
@ -710,9 +710,9 @@ void Amor::slotConfigure()
if (!mAmorDialog) if (!mAmorDialog)
{ {
mAmorDialog = new AmorDialog(); mAmorDialog = new AmorDialog();
connect(mAmorDialog, SIGNAL(changed()), SLOT(slotConfigChanged())); connect(mAmorDialog, TQT_SIGNAL(changed()), TQT_SLOT(slotConfigChanged()));
connect(mAmorDialog, SIGNAL(offsetChanged(int)), connect(mAmorDialog, TQT_SIGNAL(offsetChanged(int)),
SLOT(slotOffsetChanged(int))); TQT_SLOT(slotOffsetChanged(int)));
} }
mAmorDialog->show(); mAmorDialog->show();
@ -748,7 +748,7 @@ void Amor::slotOffsetChanged(int off)
// //
void Amor::slotAbout() void Amor::slotAbout()
{ {
QString about = i18n("Amor Version %1\n\n").arg(AMOR_VERSION) + TQString about = i18n("Amor Version %1\n\n").arg(AMOR_VERSION) +
i18n("Amusing Misuse Of Resources\n\n") + i18n("Amusing Misuse Of Resources\n\n") +
i18n("Copyright (c) 1999 Martin R. Jones <mjones@kde.org>\n\n") + i18n("Copyright (c) 1999 Martin R. Jones <mjones@kde.org>\n\n") +
i18n("Original Author: Martin R. Jones <mjones@kde.org>\n") + i18n("Original Author: Martin R. Jones <mjones@kde.org>\n") +
@ -761,7 +761,7 @@ void Amor::slotAbout()
// //
// Widget dragged // Widget dragged
// //
void Amor::slotWidgetDragged( const QPoint &delta, bool release ) void Amor::slotWidgetDragged( const TQPoint &delta, bool release )
{ {
if (mCurrAnim->frame()) if (mCurrAnim->frame())
{ {
@ -903,14 +903,14 @@ void Amor::slotWindowChange(WId win, const unsigned long * properties)
kdDebug(10000) << "Target window moved or resized" << endl; kdDebug(10000) << "Target window moved or resized" << endl;
#endif #endif
QRect newTargetRect = KWin::windowInfo(mTargetWin).frameGeometry(); TQRect newTargetRect = KWin::windowInfo(mTargetWin).frameGeometry();
// if the change in the window caused the animation to fall // if the change in the window caused the animation to fall
// out of the working area of the desktop, or if the animation // out of the working area of the desktop, or if the animation
// didn't fall in the working area before but it does now, then // didn't fall in the working area before but it does now, then
// refocus on the current window so that the animation is // refocus on the current window so that the animation is
// relocated. // relocated.
QRect desktopArea = mWin->workArea(); TQRect desktopArea = mWin->workArea();
bool fitsInWorkArea = !(newTargetRect.y() - mCurrAnim->hotspot().y() + mConfig.mOffset < desktopArea.y()); bool fitsInWorkArea = !(newTargetRect.y() - mCurrAnim->hotspot().y() + mConfig.mOffset < desktopArea.y());
if ((!fitsInWorkArea && !mInDesktopBottom) || (fitsInWorkArea && mInDesktopBottom)) if ((!fitsInWorkArea && !mInDesktopBottom) || (fitsInWorkArea && mInDesktopBottom))
@ -1014,7 +1014,7 @@ AmorSessionWidget::AmorSessionWidget()
{ {
// the only function of this widget is to catch & forward the // the only function of this widget is to catch & forward the
// saveYourself() signal from the session manager // saveYourself() signal from the session manager
connect(kapp, SIGNAL(saveYourself()), SLOT(wm_saveyourself())); connect(kapp, TQT_SIGNAL(saveYourself()), TQT_SLOT(wm_saveyourself()));
} }
void AmorSessionWidget::wm_saveyourself() void AmorSessionWidget::wm_saveyourself()

@ -31,8 +31,8 @@
#include <config.h> #include <config.h>
#endif #endif
#include <qwidget.h> #include <tqwidget.h>
#include <qptrqueue.h> #include <tqptrqueue.h>
#include "amoranim.h" #include "amoranim.h"
#include "amortips.h" #include "amortips.h"
@ -52,7 +52,7 @@ public:
enum itemType { Talk , Tip }; enum itemType { Talk , Tip };
QueueItem(itemType ty, QString te, int ti = -1); QueueItem(itemType ty, TQString te, int ti = -1);
itemType type() { return iType; } itemType type() { return iType; }
QString text() { return iText; }; QString text() { return iText; };
@ -62,7 +62,7 @@ public:
private: private:
itemType iType; itemType iType;
QString iText; TQString iText;
int iTime; int iTime;
}; };
@ -70,16 +70,16 @@ private:
// //
// Amor handles window manager input and animation selection and updates. // Amor handles window manager input and animation selection and updates.
// //
class Amor : public QObject, virtual public AmorIface class Amor : public TQObject, virtual public AmorIface
{ {
Q_OBJECT Q_OBJECT
public: public:
Amor(); Amor();
virtual ~Amor(); virtual ~Amor();
virtual void showTip(QString tip); virtual void showTip(TQString tip);
virtual void showMessage(QString message); virtual void showMessage(TQString message);
virtual void showMessage(QString message, int msec); virtual void showMessage(TQString message, int msec);
virtual void screenSaverStopped(); virtual void screenSaverStopped();
virtual void screenSaverStarted(); virtual void screenSaverStarted();
@ -93,14 +93,14 @@ public slots:
void slotDesktopChange(int); void slotDesktopChange(int);
protected slots: protected slots:
void slotMouseClicked(const QPoint &pos); void slotMouseClicked(const TQPoint &pos);
void slotTimeout(); void slotTimeout();
void slotCursorTimeout(); void slotCursorTimeout();
void slotConfigure(); void slotConfigure();
void slotConfigChanged(); void slotConfigChanged();
void slotOffsetChanged(int); void slotOffsetChanged(int);
void slotAbout(); void slotAbout();
void slotWidgetDragged( const QPoint &delta, bool release ); void slotWidgetDragged( const TQPoint &delta, bool release );
void restack(); void restack();
void hideBubble(bool forceDequeue = false); void hideBubble(bool forceDequeue = false);
@ -110,17 +110,17 @@ protected:
enum State { Focus, Blur, Normal, Sleeping, Waking, Destroy }; enum State { Focus, Blur, Normal, Sleeping, Waking, Destroy };
bool readConfig(); bool readConfig();
void readGroupConfig(KConfigBase &config, QPtrList<AmorAnim> &animList, void readGroupConfig(KConfigBase &config, TQPtrList<AmorAnim> &animList,
const char *seq); const char *seq);
void showBubble(); void showBubble();
AmorAnim *randomAnimation(QPtrList<AmorAnim> &animList); AmorAnim *randomAnimation(TQPtrList<AmorAnim> &animList);
void selectAnimation(State state=Normal); void selectAnimation(State state=Normal);
void active(); void active();
private: private:
KWinModule *mWin; KWinModule *mWin;
WId mTargetWin; // The window that the animations sits on WId mTargetWin; // The window that the animations sits on
QRect mTargetRect; // The goemetry of the target window TQRect mTargetRect; // The goemetry of the target window
WId mNextTarget; // The window that will become the target WId mNextTarget; // The window that will become the target
AmorWidget *mAmor; // The widget displaying the animation AmorWidget *mAmor; // The widget displaying the animation
AmorThemeManager mTheme; // Animations used by current theme AmorThemeManager mTheme; // Animations used by current theme
@ -128,15 +128,15 @@ private:
AmorAnim *mCurrAnim; // The currently running animation AmorAnim *mCurrAnim; // The currently running animation
int mPosition; // The position of the animation int mPosition; // The position of the animation
State mState; // The current state of the animation State mState; // The current state of the animation
QTimer *mTimer; // Frame timer TQTimer *mTimer; // Frame timer
QTimer *mCursorTimer;// Cursor timer TQTimer *mCursorTimer;// Cursor timer
QTimer *mStackTimer; // Restacking timer TQTimer *mStackTimer; // Restacking timer
QTimer *mBubbleTimer;// Bubble tip timer (GP: I didn't create this one, it had no use when I found it) TQTimer *mBubbleTimer;// Bubble tip timer (GP: I didn't create this one, it had no use when I found it)
AmorDialog *mAmorDialog; // Setup dialog AmorDialog *mAmorDialog; // Setup dialog
KPopupMenu *mMenu; // Our menu KPopupMenu *mMenu; // Our menu
time_t mActiveTime; // The time an active event occurred time_t mActiveTime; // The time an active event occurred
QPoint mCursPos; // The last recorded position of the pointer TQPoint mCursPos; // The last recorded position of the pointer
QString mTipText; // Text to display in a bubble when possible TQString mTipText; // Text to display in a bubble when possible
AmorBubble *mBubble; // Text bubble AmorBubble *mBubble; // Text bubble
AmorTips mTips; // Tips to display in the bubble AmorTips mTips; // Tips to display in the bubble
bool mInDesktopBottom; // the animation is not on top of the bool mInDesktopBottom; // the animation is not on top of the
@ -145,7 +145,7 @@ private:
AmorConfig mConfig; // Configuration parameters AmorConfig mConfig; // Configuration parameters
bool mForceHideAmorWidget; bool mForceHideAmorWidget;
QPtrQueue<QueueItem> mTipsQueue; // GP: tips queue TQPtrQueue<QueueItem> mTipsQueue; // GP: tips queue
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

@ -54,9 +54,9 @@ AmorAnim::~AmorAnim()
// //
// Get the Pixmap for the current frame. // Get the Pixmap for the current frame.
// //
const QPixmap *AmorAnim::frame() const TQPixmap *AmorAnim::frame()
{ {
const QPixmap *pixmap = 0; const TQPixmap *pixmap = 0;
if (validFrame()) if (validFrame())
pixmap = AmorPixmapManager::manager()->pixmap(*mSequence.at(mCurrent)); pixmap = AmorPixmapManager::manager()->pixmap(*mSequence.at(mCurrent));
@ -75,18 +75,18 @@ void AmorAnim::readConfig(KConfigBase &config)
// manager. // manager.
mSequence = config.readListEntry("Sequence"); mSequence = config.readListEntry("Sequence");
int frames = mSequence.count(); int frames = mSequence.count();
for ( QStringList::Iterator it = mSequence.begin(); for ( TQStringList::Iterator it = mSequence.begin();
it != mSequence.end(); it != mSequence.end();
++it ) ++it )
{ {
const QPixmap *pixmap = const TQPixmap *pixmap =
AmorPixmapManager::manager()->load(*it); AmorPixmapManager::manager()->load(*it);
if (pixmap) if (pixmap)
mMaximumSize = mMaximumSize.expandedTo(pixmap->size()); mMaximumSize = mMaximumSize.expandedTo(pixmap->size());
} }
// Read the delays between frames. // Read the delays between frames.
QStrList list; TQStrList list;
int entries = config.readListEntry("Delay",list); int entries = config.readListEntry("Delay",list);
mDelay.resize(frames); mDelay.resize(frames);
for (int i = 0; i < entries && i < frames; i++) for (int i = 0; i < entries && i < frames; i++)
@ -113,10 +113,10 @@ void AmorAnim::readConfig(KConfigBase &config)
mHotspot[i].setY(atoi(list.at(i))); mHotspot[i].setY(atoi(list.at(i)));
// Add the overlap of the last frame to the total movement. // Add the overlap of the last frame to the total movement.
const QPoint &lastHotspot = mHotspot[mHotspot.size()-1]; const TQPoint &lastHotspot = mHotspot[mHotspot.size()-1];
if (mTotalMovement > 0) if (mTotalMovement > 0)
{ {
const QPixmap *lastFrame = const TQPixmap *lastFrame =
AmorPixmapManager::manager()->pixmap(mSequence.last()); AmorPixmapManager::manager()->pixmap(mSequence.last());
if (lastFrame) if (lastFrame)
{ {
@ -147,7 +147,7 @@ AmorThemeManager::~AmorThemeManager()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
bool AmorThemeManager::setTheme(const QString & file) bool AmorThemeManager::setTheme(const TQString & file)
{ {
mPath = locate("appdata", file); mPath = locate("appdata", file);
@ -158,7 +158,7 @@ bool AmorThemeManager::setTheme(const QString & file)
// Get the directory where the pixmaps are stored and tell the // Get the directory where the pixmaps are stored and tell the
// pixmap manager. // pixmap manager.
QString pixmapPath = mConfig->readPathEntry("PixmapPath"); TQString pixmapPath = mConfig->readPathEntry("PixmapPath");
if (pixmapPath.isEmpty()) if (pixmapPath.isEmpty())
return false; return false;
@ -188,9 +188,9 @@ bool AmorThemeManager::setTheme(const QString & file)
// //
// Select an animimation randomly from a group // Select an animimation randomly from a group
// //
AmorAnim *AmorThemeManager::random(const QString & group) AmorAnim *AmorThemeManager::random(const TQString & group)
{ {
QString grp( group ); TQString grp( group );
if (mStatic) if (mStatic)
grp = "Base"; grp = "Base";
@ -209,7 +209,7 @@ AmorAnim *AmorThemeManager::random(const QString & group)
// //
// Read an animation group. // Read an animation group.
// //
bool AmorThemeManager::readGroup(const QString & seq) bool AmorThemeManager::readGroup(const TQString & seq)
{ {
AmorPixmapManager::manager()->setPixmapDir(mPath); AmorPixmapManager::manager()->setPixmapDir(mPath);
@ -218,7 +218,7 @@ bool AmorThemeManager::readGroup(const QString & seq)
// Read the list of available animations. // Read the list of available animations.
mConfig->setGroup("Config"); mConfig->setGroup("Config");
QStrList list; TQStrList list;
int entries = mConfig->readListEntry(seq, list); int entries = mConfig->readListEntry(seq, list);
// Read each individual animation // Read each individual animation

@ -33,9 +33,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <qmemarray.h> #include <tqmemarray.h>
#include <qdict.h> #include <tqdict.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <kconfigbase.h> #include <kconfigbase.h>
#include <ksimpleconfig.h> #include <ksimpleconfig.h>
@ -59,32 +59,32 @@ public:
{ return (mCurrent < mSequence.count()); } { return (mCurrent < mSequence.count()); }
int totalMovement() const int totalMovement() const
{ return mTotalMovement; } { return mTotalMovement; }
QSize maximumSize() const TQSize maximumSize() const
{ return mMaximumSize; } { return mMaximumSize; }
int delay() const int delay() const
{ return (validFrame() ? mDelay[mCurrent] : 100); } { return (validFrame() ? mDelay[mCurrent] : 100); }
QPoint hotspot() const TQPoint hotspot() const
{ return (validFrame() ? mHotspot[mCurrent] : QPoint(16,16)); } { return (validFrame() ? mHotspot[mCurrent] : TQPoint(16,16)); }
int movement() const int movement() const
{ return (validFrame() ? mMovement[mCurrent] : 0); } { return (validFrame() ? mMovement[mCurrent] : 0); }
const QPixmap *frame(); const TQPixmap *frame();
protected: protected:
void readConfig(KConfigBase &config); void readConfig(KConfigBase &config);
protected: protected:
unsigned int mCurrent; // current frame in sequence unsigned int mCurrent; // current frame in sequence
QStringList mSequence; // sequence of images to display TQStringList mSequence; // sequence of images to display
QMemArray<int> mDelay; // delay between frames TQMemArray<int> mDelay; // delay between frames
QMemArray<QPoint> mHotspot; // the hotspot in a frame TQMemArray<TQPoint> mHotspot; // the hotspot in a frame
QMemArray<int> mMovement; // the distance to move between frames TQMemArray<int> mMovement; // the distance to move between frames
int mTotalMovement; // the total distance this animation moves int mTotalMovement; // the total distance this animation moves
QSize mMaximumSize; // the maximum size of any frame TQSize mMaximumSize; // the maximum size of any frame
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
typedef QPtrList<AmorAnim> AmorAnimationGroup; typedef TQPtrList<AmorAnim> AmorAnimationGroup;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
@ -96,20 +96,20 @@ public:
AmorThemeManager(); AmorThemeManager();
virtual ~AmorThemeManager(); virtual ~AmorThemeManager();
bool setTheme(const QString & file); bool setTheme(const TQString & file);
bool readGroup(const QString & seq); bool readGroup(const TQString & seq);
bool isStatic() const bool isStatic() const
{ return mStatic; } { return mStatic; }
AmorAnim *random(const QString & group); AmorAnim *random(const TQString & group);
QSize maximumSize() const { return mMaximumSize; } TQSize maximumSize() const { return mMaximumSize; }
protected: protected:
QString mPath; TQString mPath;
KSimpleConfig *mConfig; KSimpleConfig *mConfig;
QSize mMaximumSize; // The largest pixmap used TQSize mMaximumSize; // The largest pixmap used
QDict<AmorAnimationGroup> mAnimations; // list of animation groups TQDict<AmorAnimationGroup> mAnimations; // list of animation groups
bool mStatic; // static image bool mStatic; // static image
}; };

@ -26,13 +26,13 @@
*/ */
#include "amorbubble.h" #include "amorbubble.h"
#include "amorbubble.moc" #include "amorbubble.moc"
#include <qpainter.h> #include <tqpainter.h>
#include <ktextbrowser.h> #include <ktextbrowser.h>
#include <qtooltip.h> #include <tqtooltip.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#include <qtimer.h> #include <tqtimer.h>
#define ARROW_WIDTH 10 #define ARROW_WIDTH 10
#define ARROW_HEIGHT 12 #define ARROW_HEIGHT 12
@ -45,28 +45,28 @@
// Constructor // Constructor
// //
AmorBubble::AmorBubble() AmorBubble::AmorBubble()
: QWidget(0, 0, WStyle_Customize | WStyle_NoBorder | WX11BypassWM ) : TQWidget(0, 0, WStyle_Customize | WStyle_NoBorder | WX11BypassWM )
{ {
mOriginX = 0; mOriginX = 0;
mOriginY = 0; mOriginY = 0;
mBrowser = new KTextBrowser( this ); mBrowser = new KTextBrowser( this );
mBrowser->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); mBrowser->setFrameStyle( TQFrame::NoFrame | TQFrame::Plain );
mBrowser->setMargin( 0 ); mBrowser->setMargin( 0 );
mBrowser->setWrapPolicy(QTextEdit::AtWordOrDocumentBoundary); // too long to fit in one line? mBrowser->setWrapPolicy(TQTextEdit::AtWordOrDocumentBoundary); // too long to fit in one line?
QColorGroup clgrp = mBrowser->colorGroup(); TQColorGroup clgrp = mBrowser->colorGroup();
clgrp.setColor(QColorGroup::Text, Qt::black); clgrp.setColor(TQColorGroup::Text, Qt::black);
//Laurent QTextBrowser didn't have this function FIX me //Laurent TQTextBrowser didn't have this function FIX me
//mBrowser->setPaperColorGroup( clgrp ); //mBrowser->setPaperColorGroup( clgrp );
mBrowser->setPaper( QToolTip::palette().active().brush( QColorGroup::Background ) ); mBrowser->setPaper( TQToolTip::palette().active().brush( TQColorGroup::Background ) );
mBrowser->setVScrollBarMode( QTextBrowser::AlwaysOff ); mBrowser->setVScrollBarMode( TQTextBrowser::AlwaysOff );
mBrowser->setHScrollBarMode( QTextBrowser::AlwaysOff ); mBrowser->setHScrollBarMode( TQTextBrowser::AlwaysOff );
mBrowser->viewport()->installEventFilter( this ); mBrowser->viewport()->installEventFilter( this );
mBrowser->mimeSourceFactory()->addFilePath(KGlobal::dirs()->findResourceDir("data", "kdewizard/pics")+"kdewizard/pics/"); mBrowser->mimeSourceFactory()->addFilePath(KGlobal::dirs()->findResourceDir("data", "kdewizard/pics")+"kdewizard/pics/");
QStringList icons = KGlobal::dirs()->resourceDirs("icon"); TQStringList icons = KGlobal::dirs()->resourceDirs("icon");
QStringList::Iterator it; TQStringList::Iterator it;
for (it = icons.begin(); it != icons.end(); ++it) for (it = icons.begin(); it != icons.end(); ++it)
mBrowser->mimeSourceFactory()->addFilePath(*it); mBrowser->mimeSourceFactory()->addFilePath(*it);
@ -86,9 +86,9 @@ AmorBubble::~AmorBubble()
// Set the message to display in the bubble. Causes the geometry of the // Set the message to display in the bubble. Causes the geometry of the
// widget to be recalculated. // widget to be recalculated.
// //
void AmorBubble::setMessage(const QString& message) void AmorBubble::setMessage(const TQString& message)
{ {
mMessage = QString( "<html>%1</html>" ).arg( message ); mMessage = TQString( "<html>%1</html>" ).arg( message );
// hacks because heightForWidth() doesn't work. // hacks because heightForWidth() doesn't work.
setGeometry( -1000, 0, 300, 1000 ); setGeometry( -1000, 0, 300, 1000 );
show(); show();
@ -103,7 +103,7 @@ void AmorBubble::setMessage(const QString& message)
// //
void AmorBubble::calcGeometry() void AmorBubble::calcGeometry()
{ {
mBound = QRect( 0, 0, 250, 0 ); mBound = TQRect( 0, 0, 250, 0 );
// mBound.setHeight( mBrowser->heightForWidth( mBound.width() ) ); // mBound.setHeight( mBrowser->heightForWidth( mBound.width() ) );
mBound.setHeight( mBrowser->contentsHeight() ); mBound.setHeight( mBrowser->contentsHeight() );
mBound.moveBy(ARROW_WIDTH+BORDER_SIZE, BORDER_SIZE); mBound.moveBy(ARROW_WIDTH+BORDER_SIZE, BORDER_SIZE);
@ -144,7 +144,7 @@ void AmorBubble::calcGeometry()
// create and apply the shape mask // create and apply the shape mask
mMask.resize(w, h); mMask.resize(w, h);
mMask.fill(color0); mMask.fill(color0);
QPainter maskPainter(&mMask); TQPainter maskPainter(&mMask);
maskPainter.setPen(color1); maskPainter.setPen(color1);
maskPainter.setBrush(color1); maskPainter.setBrush(color1);
drawBubble(maskPainter); drawBubble(maskPainter);
@ -157,9 +157,9 @@ void AmorBubble::calcGeometry()
// Draw the bubble that text will be draw into using the current pen // Draw the bubble that text will be draw into using the current pen
// as the outline and the current brush as the fill. // as the outline and the current brush as the fill.
// //
void AmorBubble::drawBubble(QPainter &p) void AmorBubble::drawBubble(TQPainter &p)
{ {
QPointArray pointArray(3); TQPointArray pointArray(3);
int left = ARROW_WIDTH; int left = ARROW_WIDTH;
@ -190,7 +190,7 @@ void AmorBubble::drawBubble(QPainter &p)
// p.drawRoundRect(left, 0, width() - ARROW_WIDTH, height(), 10, 20); // p.drawRoundRect(left, 0, width() - ARROW_WIDTH, height(), 10, 20);
p.drawRect(left, 0, width() - ARROW_WIDTH, height()); p.drawRect(left, 0, width() - ARROW_WIDTH, height());
QPen pen(p.pen()); TQPen pen(p.pen());
p.setPen(NoPen); p.setPen(NoPen);
p.drawPolygon(pointArray); p.drawPolygon(pointArray);
@ -202,11 +202,11 @@ void AmorBubble::drawBubble(QPainter &p)
// //
// Draw the message in a bubble // Draw the message in a bubble
// //
void AmorBubble::paintEvent(QPaintEvent *) void AmorBubble::paintEvent(TQPaintEvent *)
{ {
QPainter painter(this); TQPainter painter(this);
painter.setPen(black); painter.setPen(black);
painter.setBrush( QToolTip::palette().active().brush( QColorGroup::Background ) ); painter.setBrush( TQToolTip::palette().active().brush( TQColorGroup::Background ) );
drawBubble(painter); drawBubble(painter);
} }
@ -214,32 +214,32 @@ void AmorBubble::paintEvent(QPaintEvent *)
// //
// The user clicked on the widget // The user clicked on the widget
// //
void AmorBubble::mouseReleaseEvent(QMouseEvent *) void AmorBubble::mouseReleaseEvent(TQMouseEvent *)
{ {
hide(); hide();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
bool AmorBubble::eventFilter( QObject *, QEvent *e ) bool AmorBubble::eventFilter( TQObject *, TQEvent *e )
{ {
switch ( e->type() ) switch ( e->type() )
{ {
// GP case QEvent::Enter: // GP case TQEvent::Enter:
// GP mBubbleTimer->stop(); // GP mBubbleTimer->stop();
// GP break; // GP break;
// GP case QEvent::Leave: // GP case TQEvent::Leave:
// GP if ( isVisible() ) // GP if ( isVisible() )
// GP mBubbleTimer->start( 1000, true ); // GP mBubbleTimer->start( 1000, true );
// GP break; // GP break;
case QEvent::Enter: case TQEvent::Enter:
mMouseWithin = true; mMouseWithin = true;
break; break;
case QEvent::Leave: case TQEvent::Leave:
mMouseWithin = false; mMouseWithin = false;
break; break;
case QEvent::MouseButtonRelease: case TQEvent::MouseButtonRelease:
hide(); // GP This is the only reason a bubble might posibly be created but hidden hide(); // GP This is the only reason a bubble might posibly be created but hidden
break; break;
default: default:

@ -32,8 +32,8 @@
#endif #endif
#include <kapplication.h> #include <kapplication.h>
#include <qwidget.h> #include <tqwidget.h>
#include <qbitmap.h> #include <tqbitmap.h>
class QTextBrowser; class QTextBrowser;
class QTimer; class QTimer;
@ -50,7 +50,7 @@ public:
virtual ~AmorBubble(); virtual ~AmorBubble();
void setOrigin(int x, int y) { mOriginX = x; mOriginY = y; } void setOrigin(int x, int y) { mOriginX = x; mOriginY = y; }
void setMessage(const QString& message); void setMessage(const TQString& message);
bool mouseWithin() { return mMouseWithin; } bool mouseWithin() { return mMouseWithin; }
@ -59,20 +59,20 @@ protected:
enum HorzPos { Left, Right }; enum HorzPos { Left, Right };
void calcGeometry(); void calcGeometry();
void drawBubble(QPainter &p); void drawBubble(TQPainter &p);
virtual void paintEvent(QPaintEvent *); virtual void paintEvent(TQPaintEvent *);
virtual void mouseReleaseEvent(QMouseEvent *); virtual void mouseReleaseEvent(TQMouseEvent *);
virtual bool eventFilter( QObject *, QEvent * ); virtual bool eventFilter( TQObject *, TQEvent * );
protected: protected:
QString mMessage; // message to display TQString mMessage; // message to display
int mOriginX; // X origin of bubble arrow int mOriginX; // X origin of bubble arrow
int mOriginY; // Y origin of bubble arrow int mOriginY; // Y origin of bubble arrow
QRect mBound; // bounds of the text TQRect mBound; // bounds of the text
QBitmap mMask; // shape mask TQBitmap mMask; // shape mask
VertPos mArrowVert; // vertical position of the arrow VertPos mArrowVert; // vertical position of the arrow
HorzPos mArrowHorz; // horizontal position of the arrow HorzPos mArrowHorz; // horizontal position of the arrow
QTextBrowser *mBrowser; // displays the message TQTextBrowser *mBrowser; // displays the message
bool mMouseWithin; // the mouse pointer is inside the bubble bool mMouseWithin; // the mouse pointer is inside the bubble
}; };

@ -31,7 +31,7 @@
#include <config.h> #include <config.h>
#endif #endif
#include <qstring.h> #include <tqstring.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
@ -45,7 +45,7 @@ public:
void read(); void read();
void write(); void write();
QString mTheme; TQString mTheme;
bool mOnTop; bool mOnTop;
int mOffset; int mOffset;
bool mTips; bool mTips;

@ -25,17 +25,17 @@
** Bug reports and questions can be sent to kde-devel@kde.org ** Bug reports and questions can be sent to kde-devel@kde.org
*/ */
#include <qcheckbox.h> #include <tqcheckbox.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qslider.h> #include <tqslider.h>
#include <qpainter.h> #include <tqpainter.h>
#include <kapplication.h> #include <kapplication.h>
#include <ksimpleconfig.h> #include <ksimpleconfig.h>
#include "amordialog.h" #include "amordialog.h"
#include "amordialog.moc" #include "amordialog.moc"
#include "version.h" #include "version.h"
#include <klocale.h> #include <klocale.h>
#include <qvbox.h> #include <tqvbox.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -46,22 +46,22 @@ AmorDialog::AmorDialog()
: KDialogBase(0, "amordlg", false, i18n("Options"), Ok|Apply|Cancel, Ok ) : KDialogBase(0, "amordlg", false, i18n("Options"), Ok|Apply|Cancel, Ok )
{ {
mConfig.read(); mConfig.read();
QVBox *mainwidget = makeVBoxMainWidget(); TQVBox *mainwidget = makeVBoxMainWidget();
QHBox *hb = new QHBox(mainwidget); TQHBox *hb = new TQHBox(mainwidget);
// Theme list // Theme list
QVBox *themeBox = new QVBox(hb); TQVBox *themeBox = new TQVBox(hb);
themeBox->setSpacing(spacingHint()); themeBox->setSpacing(spacingHint());
QLabel *label = new QLabel(i18n("Theme:"), themeBox); TQLabel *label = new TQLabel(i18n("Theme:"), themeBox);
mThemeListBox = new QListBox(themeBox); mThemeListBox = new TQListBox(themeBox);
connect(mThemeListBox,SIGNAL(highlighted(int)),SLOT(slotHighlighted(int))); connect(mThemeListBox,TQT_SIGNAL(highlighted(int)),TQT_SLOT(slotHighlighted(int)));
mThemeListBox->setMinimumSize( fontMetrics().maxWidth()*20, mThemeListBox->setMinimumSize( fontMetrics().maxWidth()*20,
fontMetrics().lineSpacing()*6 ); fontMetrics().lineSpacing()*6 );
mAboutEdit = new QMultiLineEdit(themeBox); mAboutEdit = new TQMultiLineEdit(themeBox);
mAboutEdit->setReadOnly(true); mAboutEdit->setReadOnly(true);
mAboutEdit->setMinimumHeight( fontMetrics().lineSpacing()*4 ); mAboutEdit->setMinimumHeight( fontMetrics().lineSpacing()*4 );
@ -69,29 +69,29 @@ AmorDialog::AmorDialog()
themeBox->setStretchFactor(mAboutEdit, 1); themeBox->setStretchFactor(mAboutEdit, 1);
// Animation offset // Animation offset
QVBox *offsetBox = new QVBox(hb); TQVBox *offsetBox = new TQVBox(hb);
offsetBox->setSpacing(spacingHint()); offsetBox->setSpacing(spacingHint());
label = new QLabel(i18n("Offset:"), offsetBox); label = new TQLabel(i18n("Offset:"), offsetBox);
QSlider *slider = new QSlider(-40, 40, 5, mConfig.mOffset, TQSlider *slider = new TQSlider(-40, 40, 5, mConfig.mOffset,
QSlider::Vertical, offsetBox); TQSlider::Vertical, offsetBox);
connect(slider, SIGNAL(valueChanged(int)), SLOT(slotOffset(int))); connect(slider, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotOffset(int)));
// Always on top // Always on top
QCheckBox *checkBox = new QCheckBox(i18n("Always on top"), mainwidget); TQCheckBox *checkBox = new TQCheckBox(i18n("Always on top"), mainwidget);
connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotOnTop(bool))); connect(checkBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotOnTop(bool)));
checkBox->setChecked(mConfig.mOnTop); checkBox->setChecked(mConfig.mOnTop);
checkBox = new QCheckBox(i18n("Show random tips"), mainwidget); checkBox = new TQCheckBox(i18n("Show random tips"), mainwidget);
connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTips(bool))); connect(checkBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotRandomTips(bool)));
checkBox->setChecked(mConfig.mTips); // always keep this one after the connect, or the QList would not be grayed when it should checkBox->setChecked(mConfig.mTips); // always keep this one after the connect, or the QList would not be grayed when it should
checkBox = new QCheckBox(i18n("Use a random character"), mainwidget); checkBox = new TQCheckBox(i18n("Use a random character"), mainwidget);
connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTheme(bool))); connect(checkBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotRandomTheme(bool)));
checkBox->setChecked(mConfig.mRandomTheme); checkBox->setChecked(mConfig.mRandomTheme);
checkBox = new QCheckBox(i18n("Allow application tips"), mainwidget); checkBox = new TQCheckBox(i18n("Allow application tips"), mainwidget);
connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotApplicationTips(bool))); connect(checkBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotApplicationTips(bool)));
checkBox->setChecked(mConfig.mAppTips); checkBox->setChecked(mConfig.mAppTips);
readThemes(); readThemes();
@ -111,13 +111,13 @@ AmorDialog::~AmorDialog()
// //
void AmorDialog::readThemes() void AmorDialog::readThemes()
{ {
QStringList files; TQStringList files;
// Non-recursive search for theme files, with the relative paths stored // Non-recursive search for theme files, with the relative paths stored
// in files so that absolute paths are not used. // in files so that absolute paths are not used.
KGlobal::dirs()->findAllResources("appdata", "*rc", false, false, files); KGlobal::dirs()->findAllResources("appdata", "*rc", false, false, files);
for (QStringList::ConstIterator it = files.begin(); for (TQStringList::ConstIterator it = files.begin();
it != files.end(); it != files.end();
it++) it++)
addTheme(*it); addTheme(*it);
@ -127,13 +127,13 @@ void AmorDialog::readThemes()
// //
// Add a single theme to the list // Add a single theme to the list
// //
void AmorDialog::addTheme(const QString& file) void AmorDialog::addTheme(const TQString& file)
{ {
KSimpleConfig config(locate("appdata", file), true); KSimpleConfig config(locate("appdata", file), true);
config.setGroup("Config"); config.setGroup("Config");
QString pixmapPath = config.readPathEntry("PixmapPath"); TQString pixmapPath = config.readPathEntry("PixmapPath");
if (pixmapPath.isEmpty()) if (pixmapPath.isEmpty())
{ {
return; return;
@ -147,13 +147,13 @@ void AmorDialog::addTheme(const QString& file)
pixmapPath = locate("appdata", pixmapPath); pixmapPath = locate("appdata", pixmapPath);
} }
QString description = config.readEntry("Description"); TQString description = config.readEntry("Description");
QString about = config.readEntry("About", " "); TQString about = config.readEntry("About", " ");
QString pixmapName = config.readEntry("Icon"); TQString pixmapName = config.readEntry("Icon");
pixmapPath += pixmapName; pixmapPath += pixmapName;
QPixmap pixmap(pixmapPath); TQPixmap pixmap(pixmapPath);
AmorListBoxItem *item = new AmorListBoxItem(description, pixmap); AmorListBoxItem *item = new AmorListBoxItem(description, pixmap);
mThemeListBox->insertItem(item); mThemeListBox->insertItem(item);
@ -261,10 +261,10 @@ void AmorDialog::slotCancel()
// //
// AmorListBoxItem implements a list box items for selection of themes // AmorListBoxItem implements a list box items for selection of themes
// //
void AmorListBoxItem::paint( QPainter *p ) void AmorListBoxItem::paint( TQPainter *p )
{ {
p->drawPixmap( 3, 0, mPixmap ); p->drawPixmap( 3, 0, mPixmap );
QFontMetrics fm = p->fontMetrics(); TQFontMetrics fm = p->fontMetrics();
int yPos; // vertical text position int yPos; // vertical text position
if ( mPixmap.height() < fm.height() ) if ( mPixmap.height() < fm.height() )
yPos = fm.ascent() + fm.leading()/2; yPos = fm.ascent() + fm.leading()/2;
@ -273,12 +273,12 @@ void AmorListBoxItem::paint( QPainter *p )
p->drawText( mPixmap.width() + 5, yPos, text() ); p->drawText( mPixmap.width() + 5, yPos, text() );
} }
int AmorListBoxItem::height(const QListBox *lb ) const int AmorListBoxItem::height(const TQListBox *lb ) const
{ {
return QMAX( mPixmap.height(), lb->fontMetrics().lineSpacing() + 1 ); return QMAX( mPixmap.height(), lb->fontMetrics().lineSpacing() + 1 );
} }
int AmorListBoxItem::width(const QListBox *lb ) const int AmorListBoxItem::width(const TQListBox *lb ) const
{ {
return mPixmap.width() + lb->fontMetrics().width( text() ) + 6; return mPixmap.width() + lb->fontMetrics().width( text() ) + 6;
} }

@ -27,10 +27,10 @@
#ifndef AMORDIALOG_H #ifndef AMORDIALOG_H
#define AMORDIALOG_H #define AMORDIALOG_H
#include <qdialog.h> #include <tqdialog.h>
#include <qlistbox.h> #include <tqlistbox.h>
#include <qptrlist.h> #include <tqptrlist.h>
#include <qmultilineedit.h> #include <tqmultilineedit.h>
#include "amorconfig.h" #include "amorconfig.h"
#include <kdialogbase.h> #include <kdialogbase.h>
@ -72,13 +72,13 @@ protected slots:
protected: protected:
void readThemes(); void readThemes();
void addTheme(const QString& file); void addTheme(const TQString& file);
protected: protected:
QListBox *mThemeListBox; TQListBox *mThemeListBox;
QMultiLineEdit *mAboutEdit; TQMultiLineEdit *mAboutEdit;
QStringList mThemes; TQStringList mThemes;
QStringList mThemeAbout; TQStringList mThemeAbout;
AmorConfig mConfig; AmorConfig mConfig;
}; };
@ -89,18 +89,18 @@ protected:
class AmorListBoxItem : public QListBoxItem class AmorListBoxItem : public QListBoxItem
{ {
public: public:
AmorListBoxItem(const QString & s, const QPixmap& p) AmorListBoxItem(const TQString & s, const TQPixmap& p)
: QListBoxItem(), mPixmap(p) : TQListBoxItem(), mPixmap(p)
{ setText(s); } { setText(s); }
protected: protected:
virtual void paint(QPainter *); virtual void paint(TQPainter *);
virtual int height(const QListBox *) const; virtual int height(const TQListBox *) const;
virtual int width(const QListBox *) const; virtual int width(const TQListBox *) const;
virtual const QPixmap *pixmap() const { return &mPixmap; } virtual const TQPixmap *pixmap() const { return &mPixmap; }
private: private:
QPixmap mPixmap; TQPixmap mPixmap;
}; };
#endif // AMORDIALOG_H #endif // AMORDIALOG_H

@ -54,15 +54,15 @@ AmorPixmapManager::~AmorPixmapManager()
// Returns: // Returns:
// pointer to pixmap if loaded successfully, 0 otherwise. // pointer to pixmap if loaded successfully, 0 otherwise.
// //
const QPixmap *AmorPixmapManager::load(const QString & img) const TQPixmap *AmorPixmapManager::load(const TQString & img)
{ {
QPixmap *pixmap = mPixmaps.find(img); TQPixmap *pixmap = mPixmaps.find(img);
if (!pixmap) if (!pixmap)
{ {
// pixmap has not yet been loaded. // pixmap has not yet been loaded.
QString path = mPixmapDir + QString("/") + img; TQString path = mPixmapDir + TQString("/") + img;
pixmap = new QPixmap(path); pixmap = new TQPixmap(path);
if (!pixmap->isNull()) if (!pixmap->isNull())
{ {

@ -31,8 +31,8 @@
#include <config.h> #include <config.h>
#endif #endif
#include <qdict.h> #include <tqdict.h>
#include <qpixmap.h> #include <tqpixmap.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
@ -44,19 +44,19 @@ public:
AmorPixmapManager(); AmorPixmapManager();
virtual ~AmorPixmapManager(); virtual ~AmorPixmapManager();
void setPixmapDir(const QString &dir) void setPixmapDir(const TQString &dir)
{ mPixmapDir = dir; } { mPixmapDir = dir; }
void reset() void reset()
{ mPixmapDir = "."; mPixmaps.clear(); } { mPixmapDir = "."; mPixmaps.clear(); }
const QPixmap *load(const QString & img); const TQPixmap *load(const TQString & img);
const QPixmap *pixmap(const QString & img) const const TQPixmap *pixmap(const TQString & img) const
{ return mPixmaps.find(img); } { return mPixmaps.find(img); }
static AmorPixmapManager *manager(); static AmorPixmapManager *manager();
public: public:
QString mPixmapDir; // get pixmaps from here TQString mPixmapDir; // get pixmaps from here
QDict<QPixmap> mPixmaps; // list of pixmaps TQDict<TQPixmap> mPixmaps; // list of pixmaps
static AmorPixmapManager *mManager; // static pointer to instance static AmorPixmapManager *mManager; // static pointer to instance
}; };

@ -29,8 +29,8 @@
#include "amortips.h" #include "amortips.h"
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <klocale.h> #include <klocale.h>
#include <qfile.h> #include <tqfile.h>
#include <qregexp.h> #include <tqregexp.h>
#include <kdebug.h> #include <kdebug.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -45,11 +45,11 @@ AmorTips::AmorTips()
// Set the file containing tips. This reads all tips into memory at the // Set the file containing tips. This reads all tips into memory at the
// moment - need to make more efficient. // moment - need to make more efficient.
// //
bool AmorTips::setFile(const QString& file) bool AmorTips::setFile(const TQString& file)
{ {
bool rv = false; bool rv = false;
QString path( locate("appdata", file) ); TQString path( locate("appdata", file) );
if(path.length() && read(path)) if(path.length() && read(path))
rv = true; rv = true;
@ -71,11 +71,11 @@ void AmorTips::reset()
// //
// Get a tip randomly from the list // Get a tip randomly from the list
// //
QString AmorTips::tip() TQString AmorTips::tip()
{ {
if (mTips.count()) if (mTips.count())
{ {
QString tip = *mTips.at(kapp->random() % mTips.count()); TQString tip = *mTips.at(kapp->random() % mTips.count());
return i18n(tip.utf8()); return i18n(tip.utf8());
} }
@ -88,24 +88,24 @@ QString AmorTips::tip()
// //
bool AmorTips::readKTips() bool AmorTips::readKTips()
{ {
QString fname; TQString fname;
fname = locate("data", QString("kdewizard/tips")); fname = locate("data", TQString("kdewizard/tips"));
if (fname.isEmpty()) if (fname.isEmpty())
return false; return false;
QFile f(fname); TQFile f(fname);
if (f.open(IO_ReadOnly)) if (f.open(IO_ReadOnly))
{ {
// Reading of tips must be exactly as in KTipDatabase::loadTips for translation // Reading of tips must be exactly as in KTipDatabase::loadTips for translation
QString content = f.readAll(); TQString content = f.readAll();
const QRegExp rx("\\n+"); const TQRegExp rx("\\n+");
int pos = -1; int pos = -1;
while ((pos = content.find("<html>", pos + 1, false)) != -1) while ((pos = content.find("<html>", pos + 1, false)) != -1)
{ {
QString tip = content TQString tip = content
.mid(pos + 6, content.find("</html>", pos, false) - pos - 6) .mid(pos + 6, content.find("</html>", pos, false) - pos - 6)
.replace(rx, "\n"); .replace(rx, "\n");
if (!tip.endsWith("\n")) if (!tip.endsWith("\n"))
@ -130,9 +130,9 @@ bool AmorTips::readKTips()
// //
// Read all tips from the specified file. // Read all tips from the specified file.
// //
bool AmorTips::read(const QString& path) bool AmorTips::read(const TQString& path)
{ {
QFile file(path); TQFile file(path);
if (file.open(IO_ReadOnly)) if (file.open(IO_ReadOnly))
{ {
@ -151,17 +151,17 @@ bool AmorTips::read(const QString& path)
// //
// Read a single tip. // Read a single tip.
// //
bool AmorTips::readTip(QFile &file) bool AmorTips::readTip(TQFile &file)
{ {
char buffer[1024] = ""; char buffer[1024] = "";
QString tip; TQString tip;
while (!file.atEnd() && buffer[0] != '%') while (!file.atEnd() && buffer[0] != '%')
{ {
file.readLine(buffer, 1024); file.readLine(buffer, 1024);
if (buffer[0] != '%') if (buffer[0] != '%')
{ {
tip += QString::fromUtf8(buffer); tip += TQString::fromUtf8(buffer);
} }
} }

@ -31,7 +31,7 @@
#include <config.h> #include <config.h>
#endif #endif
#include <qstrlist.h> #include <tqstrlist.h>
class QFile; class QFile;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -43,17 +43,17 @@ class AmorTips
public: public:
AmorTips(); AmorTips();
bool setFile(const QString& file); bool setFile(const TQString& file);
void reset(); void reset();
QString tip(); TQString tip();
protected: protected:
bool readKTips(); bool readKTips();
bool read(const QString& file); bool read(const TQString& file);
bool readTip(QFile &file); bool readTip(TQFile &file);
protected: protected:
QStringList mTips; TQStringList mTips;
}; };
#endif // AMORTIPS_H #endif // AMORTIPS_H

@ -26,7 +26,7 @@
*/ */
#include "amorwidget.h" #include "amorwidget.h"
#include "amorwidget.moc" #include "amorwidget.moc"
#include <qbitmap.h> #include <tqbitmap.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
@ -35,7 +35,7 @@
// Constructor // Constructor
// //
AmorWidget::AmorWidget() AmorWidget::AmorWidget()
: QWidget(0, 0, WStyle_Customize | WStyle_NoBorder | WX11BypassWM ), : TQWidget(0, 0, WStyle_Customize | WStyle_NoBorder | WX11BypassWM ),
mPixmap(0) mPixmap(0)
{ {
setBackgroundMode( NoBackground ); setBackgroundMode( NoBackground );
@ -54,7 +54,7 @@ AmorWidget::~AmorWidget()
// //
// Set the pixmap to display // Set the pixmap to display
// //
void AmorWidget::setPixmap(const QPixmap *pixmap) void AmorWidget::setPixmap(const TQPixmap *pixmap)
{ {
mPixmap = pixmap; mPixmap = pixmap;
@ -75,7 +75,7 @@ void AmorWidget::setPixmap(const QPixmap *pixmap)
// //
// Draw the pixmap // Draw the pixmap
// //
void AmorWidget::paintEvent(QPaintEvent *) void AmorWidget::paintEvent(TQPaintEvent *)
{ {
if (mPixmap) if (mPixmap)
bitBlt( this, 0, 0, mPixmap ); bitBlt( this, 0, 0, mPixmap );
@ -87,7 +87,7 @@ void AmorWidget::paintEvent(QPaintEvent *)
// //
// The user clicked on the widget // The user clicked on the widget
// //
void AmorWidget::mousePressEvent(QMouseEvent *me) void AmorWidget::mousePressEvent(TQMouseEvent *me)
{ {
clickPos = me->globalPos(); clickPos = me->globalPos();
} }
@ -96,7 +96,7 @@ void AmorWidget::mousePressEvent(QMouseEvent *me)
// //
// The user moved the mouse // The user moved the mouse
// //
void AmorWidget::mouseMoveEvent(QMouseEvent *me) void AmorWidget::mouseMoveEvent(TQMouseEvent *me)
{ {
if ( me->state() == LeftButton ) { if ( me->state() == LeftButton ) {
if ( !dragging && (clickPos-me->globalPos()).manhattanLength() > 3 ) if ( !dragging && (clickPos-me->globalPos()).manhattanLength() > 3 )
@ -112,14 +112,14 @@ void AmorWidget::mouseMoveEvent(QMouseEvent *me)
// //
// The user clicked on the widget // The user clicked on the widget
// //
void AmorWidget::mouseReleaseEvent(QMouseEvent *me) void AmorWidget::mouseReleaseEvent(TQMouseEvent *me)
{ {
if ( dragging ) if ( dragging )
emit dragged( me->globalPos() - clickPos, true ); emit dragged( me->globalPos() - clickPos, true );
else if ( me->state() == RightButton ) else if ( me->state() == RightButton )
emit mouseClicked(clickPos); emit mouseClicked(clickPos);
clickPos = QPoint(); clickPos = TQPoint();
dragging = false; dragging = false;
} }

@ -32,7 +32,7 @@
#endif #endif
#include <kapplication.h> #include <kapplication.h>
#include <qwidget.h> #include <tqwidget.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
@ -45,21 +45,21 @@ public:
AmorWidget(); AmorWidget();
virtual ~AmorWidget(); virtual ~AmorWidget();
void setPixmap(const QPixmap *pixmap); void setPixmap(const TQPixmap *pixmap);
signals: signals:
void mouseClicked(const QPoint &pos); void mouseClicked(const TQPoint &pos);
void dragged( const QPoint &delta, bool release ); void dragged( const TQPoint &delta, bool release );
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(TQPaintEvent *);
void mousePressEvent(QMouseEvent *); void mousePressEvent(TQMouseEvent *);
void mouseMoveEvent(QMouseEvent *); void mouseMoveEvent(TQMouseEvent *);
void mouseReleaseEvent(QMouseEvent *); void mouseReleaseEvent(TQMouseEvent *);
protected: protected:
const QPixmap *mPixmap; const TQPixmap *mPixmap;
QPoint clickPos; TQPoint clickPos;
bool dragging; bool dragging;
}; };

@ -18,9 +18,9 @@
#include <math.h> #include <math.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qcursor.h> #include <tqcursor.h>
#include <qimage.h> #include <tqimage.h>
#include <klocale.h> #include <klocale.h>
#include <kglobal.h> #include <kglobal.h>
@ -33,7 +33,7 @@
extern "C" extern "C"
{ {
KDE_EXPORT KPanelApplet* init(QWidget *parent, const QString& configFile) KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile)
{ {
KGlobal::locale()->insertCatalogue("keyesapplet"); KGlobal::locale()->insertCatalogue("keyesapplet");
EyesApplet *applet = new EyesApplet(configFile, KPanelApplet::Normal, 0, parent, "keyesapplet"); EyesApplet *applet = new EyesApplet(configFile, KPanelApplet::Normal, 0, parent, "keyesapplet");
@ -41,16 +41,16 @@ extern "C"
} }
} }
EyesApplet::EyesApplet(const QString& configFile, Type t, int actions, EyesApplet::EyesApplet(const TQString& configFile, Type t, int actions,
QWidget *parent, const char *name) TQWidget *parent, const char *name)
: KPanelApplet( configFile, t, actions, parent, name ) : KPanelApplet( configFile, t, actions, parent, name )
{ {
setWFlags(WNoAutoErase); setWFlags(WNoAutoErase);
setBackgroundOrigin(AncestorOrigin); setBackgroundOrigin(AncestorOrigin);
startTimer(50); startTimer(50);
oldleft = QPoint(-1, -1); oldleft = TQPoint(-1, -1);
oldright = QPoint(-1, -1); oldright = TQPoint(-1, -1);
oldMouse = QPoint(-1, -1); oldMouse = TQPoint(-1, -1);
} }
int EyesApplet::widthForHeight(int h) const int EyesApplet::widthForHeight(int h) const
@ -62,19 +62,19 @@ int EyesApplet::heightForWidth(int w) const
return static_cast<int>(w / 1.4); // rectangular shape. return static_cast<int>(w / 1.4); // rectangular shape.
} }
void EyesApplet::resizeEvent( QResizeEvent*e ) void EyesApplet::resizeEvent( TQResizeEvent*e )
{ {
QWidget::resizeEvent(e); TQWidget::resizeEvent(e);
} }
void EyesApplet::timerEvent(QTimerEvent*) void EyesApplet::timerEvent(TQTimerEvent*)
{ {
QPoint mouse = mapFromGlobal(QCursor::pos()); TQPoint mouse = mapFromGlobal(TQCursor::pos());
if (mouse != oldMouse) if (mouse != oldMouse)
update(); update();
} }
void EyesApplet::paintEvent(QPaintEvent*) void EyesApplet::paintEvent(TQPaintEvent*)
{ {
int spWidth = width() * AAFACTOR; int spWidth = width() * AAFACTOR;
int spHeight = height() * AAFACTOR; int spHeight = height() * AAFACTOR;
@ -82,16 +82,16 @@ void EyesApplet::paintEvent(QPaintEvent*)
if (spWidth != _cache.width() || spHeight != _cache.height()) if (spWidth != _cache.width() || spHeight != _cache.height())
_cache.resize(spWidth, spHeight); _cache.resize(spWidth, spHeight);
QPainter paint(&_cache); TQPainter paint(&_cache);
if (paletteBackgroundPixmap()) if (paletteBackgroundPixmap())
{ {
QPixmap bg(width(), height()); TQPixmap bg(width(), height());
QPainter p(&bg); TQPainter p(&bg);
QPoint offset = backgroundOffset(); TQPoint offset = backgroundOffset();
p.drawTiledPixmap(0, 0, width(), height(), *paletteBackgroundPixmap(), offset.x(), offset.y()); p.drawTiledPixmap(0, 0, width(), height(), *paletteBackgroundPixmap(), offset.x(), offset.y());
p.end(); p.end();
QImage bgImage = bg.convertToImage().scale(spWidth, spHeight); TQImage bgImage = bg.convertToImage().scale(spWidth, spHeight);
paint.drawImage(0, 0, bgImage); paint.drawImage(0, 0, bgImage);
} }
else else
@ -100,8 +100,8 @@ void EyesApplet::paintEvent(QPaintEvent*)
} }
// draw eyes, no pupils // draw eyes, no pupils
paint.setPen(QPen(black, 2 * AAFACTOR)); paint.setPen(TQPen(black, 2 * AAFACTOR));
paint.setBrush(QBrush(white)); paint.setBrush(TQBrush(white));
int w = spWidth; // - AAFACTOR * 2; int w = spWidth; // - AAFACTOR * 2;
int h = spHeight; // - AAFACTOR * 2; int h = spHeight; // - AAFACTOR * 2;
@ -116,22 +116,22 @@ void EyesApplet::paintEvent(QPaintEvent*)
drawPupils(&paint); drawPupils(&paint);
paint.end(); paint.end();
QPainter paintFinal(this); TQPainter paintFinal(this);
QImage spImage = _cache.convertToImage(); TQImage spImage = _cache.convertToImage();
QImage displayImage = spImage.smoothScale(size()); TQImage displayImage = spImage.smoothScale(size());
paintFinal.drawImage(0, 0, displayImage); paintFinal.drawImage(0, 0, displayImage);
paintFinal.end(); paintFinal.end();
} }
void EyesApplet::drawPupils(QPainter* p) void EyesApplet::drawPupils(TQPainter* p)
{ {
QPoint pos, mouse, vect; TQPoint pos, mouse, vect;
double cos_alpha,sin_alpha; double cos_alpha,sin_alpha;
int w = width() * AAFACTOR; int w = width() * AAFACTOR;
int h = height() * AAFACTOR; int h = height() * AAFACTOR;
oldMouse = mapFromGlobal(QCursor::pos()); oldMouse = mapFromGlobal(TQCursor::pos());
mouse = oldMouse * AAFACTOR; mouse = oldMouse * AAFACTOR;
int tmp = QMIN(h, w)/6; int tmp = QMIN(h, w)/6;
@ -155,13 +155,13 @@ void EyesApplet::drawPupils(QPainter* p)
int sizeEye=QMIN(h,w)/6; int sizeEye=QMIN(h,w)/6;
// // draw over old pos // // draw over old pos
// p->setPen(QPen(NoPen)); // p->setPen(TQPen(NoPen));
// p->setBrush(QBrush(white)); // p->setBrush(TQBrush(white));
// p->drawEllipse(oldleft.x() - sizeEye/2, oldleft.y() - sizeEye/2, sizeEye, sizeEye); // p->drawEllipse(oldleft.x() - sizeEye/2, oldleft.y() - sizeEye/2, sizeEye, sizeEye);
// draw left pupil // draw left pupil
p->setPen(QPen(NoPen)); p->setPen(TQPen(NoPen));
p->setBrush(QBrush(black)); p->setBrush(TQBrush(black));
p->drawEllipse(pos.x() - sizeEye/2, pos.y() - sizeEye/2, sizeEye, sizeEye); p->drawEllipse(pos.x() - sizeEye/2, pos.y() - sizeEye/2, sizeEye, sizeEye);
//oldleft = pos; //oldleft = pos;
@ -188,13 +188,13 @@ void EyesApplet::drawPupils(QPainter* p)
int sizeEye=QMIN(h,w)/6; int sizeEye=QMIN(h,w)/6;
// // draw over old pos // // draw over old pos
// p->setPen(QPen(NoPen)); // p->setPen(TQPen(NoPen));
// p->setBrush(QBrush(white)); // p->setBrush(TQBrush(white));
// p->drawEllipse(oldright.x() - sizeEye/2, oldright.y() - sizeEye/2, sizeEye, sizeEye); // p->drawEllipse(oldright.x() - sizeEye/2, oldright.y() - sizeEye/2, sizeEye, sizeEye);
// draw left pupil // draw left pupil
p->setPen(QPen(NoPen)); p->setPen(TQPen(NoPen));
p->setBrush(QBrush(black)); p->setBrush(TQBrush(black));
p->drawEllipse(pos.x() - sizeEye/2, pos.y() - sizeEye/2, sizeEye, sizeEye); p->drawEllipse(pos.x() - sizeEye/2, pos.y() - sizeEye/2, sizeEye, sizeEye);
//oldright = pos; //oldright = pos;

@ -19,7 +19,7 @@
#ifndef __eyes_h__ #ifndef __eyes_h__
#define __eyes_h__ #define __eyes_h__
#include <qpixmap.h> #include <tqpixmap.h>
#include <kpanelapplet.h> #include <kpanelapplet.h>
class EyesApplet : public KPanelApplet class EyesApplet : public KPanelApplet
@ -27,22 +27,22 @@ class EyesApplet : public KPanelApplet
Q_OBJECT Q_OBJECT
public: public:
EyesApplet(const QString& configFile, Type t = Normal, int actions = 0, EyesApplet(const TQString& configFile, Type t = Normal, int actions = 0,
QWidget *parent = 0, const char *name = 0); TQWidget *parent = 0, const char *name = 0);
int widthForHeight(int height) const; int widthForHeight(int height) const;
int heightForWidth(int width) const; int heightForWidth(int width) const;
protected: protected:
void timerEvent(QTimerEvent*); void timerEvent(TQTimerEvent*);
void resizeEvent(QResizeEvent*); void resizeEvent(TQResizeEvent*);
void paintEvent(QPaintEvent*); void paintEvent(TQPaintEvent*);
private: private:
void drawPupils(QPainter* p); void drawPupils(TQPainter* p);
QPoint oldleft, oldright, oldMouse; TQPoint oldleft, oldright, oldMouse;
QPixmap _cache; TQPixmap _cache;
}; };
#endif // __eyes_h__ #endif // __eyes_h__

@ -24,9 +24,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <klocale.h> #include <klocale.h>
#include <kglobal.h> #include <kglobal.h>
@ -38,7 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
extern "C" extern "C"
{ {
KDE_EXPORT KPanelApplet* init(QWidget *parent, const QString& configFile) KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile)
{ {
KGlobal::locale()->insertCatalogue("kfifteenapplet"); KGlobal::locale()->insertCatalogue("kfifteenapplet");
return new FifteenApplet(configFile, KPanelApplet::Normal, return new FifteenApplet(configFile, KPanelApplet::Normal,
@ -46,8 +46,8 @@ extern "C"
} }
} }
FifteenApplet::FifteenApplet(const QString& configFile, Type type, int actions, FifteenApplet::FifteenApplet(const TQString& configFile, Type type, int actions,
QWidget *parent, const char *name) TQWidget *parent, const char *name)
: KPanelApplet(configFile, type, actions, parent, name), _aboutData(0) : KPanelApplet(configFile, type, actions, parent, name), _aboutData(0)
{ {
// setup table // setup table
@ -55,7 +55,7 @@ FifteenApplet::FifteenApplet(const QString& configFile, Type type, int actions,
setCustomMenu(_table->popup()); setCustomMenu(_table->popup());
// setup layout // setup layout
QHBoxLayout *_layout = new QHBoxLayout(this); TQHBoxLayout *_layout = new TQHBoxLayout(this);
_layout->add(_table); _layout->add(_table);
srand(time(0)); srand(time(0));
@ -87,12 +87,12 @@ void FifteenApplet::about()
dialog.exec(); dialog.exec();
} }
PiecesTable::PiecesTable(QWidget* parent, const char* name ) PiecesTable::PiecesTable(TQWidget* parent, const char* name )
: QtTableView(parent, name), _activeRow(-1), _activeCol(-1), _randomized(false) : QtTableView(parent, name), _activeRow(-1), _activeCol(-1), _randomized(false)
{ {
_menu = new QPopupMenu(this); _menu = new TQPopupMenu(this);
_menu->insertItem(i18n("R&andomize Pieces"), this, SLOT(randomizeMap())); _menu->insertItem(i18n("R&andomize Pieces"), this, TQT_SLOT(randomizeMap()));
_menu->insertItem(i18n("&Reset Pieces"), this, SLOT(resetMap())); _menu->insertItem(i18n("&Reset Pieces"), this, TQT_SLOT(resetMap()));
_menu->adjustSize(); // setup table view _menu->adjustSize(); // setup table view
setFrameStyle(StyledPanel | Sunken); setFrameStyle(StyledPanel | Sunken);
@ -107,7 +107,7 @@ PiecesTable::PiecesTable(QWidget* parent, const char* name )
initColors(); initColors();
} }
void PiecesTable::paintCell(QPainter *p, int row, int col) void PiecesTable::paintCell(TQPainter *p, int row, int col)
{ {
int w = cellWidth(); int w = cellWidth();
int h = cellHeight(); int h = cellHeight();
@ -142,15 +142,15 @@ void PiecesTable::paintCell(QPainter *p, int row, int col)
p->setPen(white); p->setPen(white);
else else
p->setPen(black); p->setPen(black);
p->drawText(0, 0, x2, y2, AlignHCenter | AlignVCenter, QString::number(number)); p->drawText(0, 0, x2, y2, AlignHCenter | AlignVCenter, TQString::number(number));
} }
void PiecesTable::resizeEvent(QResizeEvent *e) void PiecesTable::resizeEvent(TQResizeEvent *e)
{ {
QtTableView::resizeEvent(e); QtTableView::resizeEvent(e);
// set font // set font
QFont f = font(); TQFont f = font();
if (height() > 50) if (height() > 50)
f.setPixelSize(8); f.setPixelSize(8);
else if (height() > 40) else if (height() > 40)
@ -171,7 +171,7 @@ void PiecesTable::initColors()
_colors.resize(numRows() * numCols()); _colors.resize(numRows() * numCols());
for (int r = 0; r < numRows(); r++) for (int r = 0; r < numRows(); r++)
for (int c = 0; c < numCols(); c++) for (int c = 0; c < numCols(); c++)
_colors[c + r *numCols()] = QColor(255 - 70 * c,255 - 70 * r, 150); _colors[c + r *numCols()] = TQColor(255 - 70 * c,255 - 70 * r, 150);
} }
void PiecesTable::initMap() void PiecesTable::initMap()
@ -185,7 +185,7 @@ void PiecesTable::initMap()
void PiecesTable::randomizeMap() void PiecesTable::randomizeMap()
{ {
QMemArray<int> positions; TQMemArray<int> positions;
positions.fill(0, 16); positions.fill(0, 16);
for (unsigned int i = 0; i < 16; i++) { for (unsigned int i = 0; i < 16; i++) {
@ -221,7 +221,7 @@ void PiecesTable::checkwin()
KMessageBox::information(this, i18n("Congratulations!\nYou win the game!"), i18n("Fifteen Pieces")); KMessageBox::information(this, i18n("Congratulations!\nYou win the game!"), i18n("Fifteen Pieces"));
} }
void PiecesTable::mousePressEvent(QMouseEvent* e) void PiecesTable::mousePressEvent(TQMouseEvent* e)
{ {
QtTableView::mousePressEvent(e); QtTableView::mousePressEvent(e);
@ -293,7 +293,7 @@ void PiecesTable::mousePressEvent(QMouseEvent* e)
} }
} }
void PiecesTable::mouseMoveEvent(QMouseEvent* e) void PiecesTable::mouseMoveEvent(TQMouseEvent* e)
{ {
QtTableView::mouseMoveEvent(e); QtTableView::mouseMoveEvent(e);

@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define __fifteenapplet_h__ #define __fifteenapplet_h__
#include "qttableview.h" #include "qttableview.h"
#include <qmemarray.h> #include <tqmemarray.h>
#include <kpanelapplet.h> #include <kpanelapplet.h>
@ -37,15 +37,15 @@ class PiecesTable : public QtTableView
Q_OBJECT Q_OBJECT
public: public:
PiecesTable(QWidget* parent = 0, const char* name = 0); PiecesTable(TQWidget* parent = 0, const char* name = 0);
QPopupMenu* popup() { return _menu; } TQPopupMenu* popup() { return _menu; }
protected: protected:
void resizeEvent(QResizeEvent*); void resizeEvent(TQResizeEvent*);
void mousePressEvent(QMouseEvent*); void mousePressEvent(TQMouseEvent*);
void mouseMoveEvent(QMouseEvent*); void mouseMoveEvent(TQMouseEvent*);
void paintCell(QPainter *, int row, int col); void paintCell(TQPainter *, int row, int col);
void initMap(); void initMap();
void initColors(); void initColors();
@ -56,9 +56,9 @@ protected slots:
void resetMap(); void resetMap();
private: private:
QMemArray<int> _map; TQMemArray<int> _map;
QMemArray<QColor> _colors; TQMemArray<TQColor> _colors;
QPopupMenu *_menu; TQPopupMenu *_menu;
int _activeRow, _activeCol; int _activeRow, _activeCol;
bool _randomized; bool _randomized;
}; };
@ -68,8 +68,8 @@ class FifteenApplet : public KPanelApplet
Q_OBJECT Q_OBJECT
public: public:
FifteenApplet(const QString& configFile, Type t = Stretch, int actions = 0, FifteenApplet(const TQString& configFile, Type t = Stretch, int actions = 0,
QWidget *parent = 0, const char *name = 0); TQWidget *parent = 0, const char *name = 0);
int widthForHeight(int height) const; int widthForHeight(int height) const;
int heightForWidth(int width) const; int heightForWidth(int width) const;

@ -15,9 +15,9 @@
#include "qttableview.h" #include "qttableview.h"
#include "qttableview.moc" #include "qttableview.moc"
#ifndef QT_NO_QTTABLEVIEW #ifndef QT_NO_QTTABLEVIEW
#include "qscrollbar.h" #include "tqscrollbar.h"
#include "qpainter.h" #include "tqpainter.h"
#include "qdrawutil.h" #include "tqdrawutil.h"
#include <limits.h> #include <limits.h>
enum ScrollBarDirtyFlags { enum ScrollBarDirtyFlags {
@ -41,16 +41,16 @@ enum ScrollBarDirtyFlags {
class QCornerSquare : public QWidget // internal class class QCornerSquare : public QWidget // internal class
{ {
public: public:
QCornerSquare( QWidget *, const char* = 0 ); QCornerSquare( TQWidget *, const char* = 0 );
void paintEvent( QPaintEvent * ); void paintEvent( TQPaintEvent * );
}; };
QCornerSquare::QCornerSquare( QWidget *parent, const char *name ) QCornerSquare::QCornerSquare( TQWidget *parent, const char *name )
: QWidget( parent, name ) : TQWidget( parent, name )
{ {
} }
void QCornerSquare::paintEvent( QPaintEvent * ) void QCornerSquare::paintEvent( TQPaintEvent * )
{ {
} }
@ -113,9 +113,9 @@ void QCornerSquare::paintEvent( QPaintEvent * )
\warning Experience has shown that use of this widget tends to cause \warning Experience has shown that use of this widget tends to cause
more bugs than expected and our analysis indicates that the widget's more bugs than expected and our analysis indicates that the widget's
very flexibility is the problem. If QScrollView or QListBox can very flexibility is the problem. If TQScrollView or TQListBox can
easily be made to do the job you need, we recommend subclassing easily be made to do the job you need, we recommend subclassing
those widgets rather than QtTableView. In addition, QScrollView makes those widgets rather than QtTableView. In addition, TQScrollView makes
it easy to have child widgets inside tables, which QtTableView it easy to have child widgets inside tables, which QtTableView
doesn't support at all. doesn't support at all.
@ -126,7 +126,7 @@ void QCornerSquare::paintEvent( QPaintEvent * )
/*! /*!
Constructs a table view. The \a parent, \a name and \f arguments Constructs a table view. The \a parent, \a name and \f arguments
are passed to the QFrame constructor. are passed to the TQFrame constructor.
The \link setTableFlags() table flags\endlink are all cleared (set to 0). The \link setTableFlags() table flags\endlink are all cleared (set to 0).
Set \c Tbl_autoVScrollBar or \c Tbl_autoHScrollBar to get automatic scroll Set \c Tbl_autoVScrollBar or \c Tbl_autoHScrollBar to get automatic scroll
@ -135,17 +135,17 @@ void QCornerSquare::paintEvent( QPaintEvent * )
The \link setCellHeight() cell height\endlink and \link setCellWidth() The \link setCellHeight() cell height\endlink and \link setCellWidth()
cell width\endlink are set to 0. cell width\endlink are set to 0.
Frame line shapes (QFrame::HLink and QFrame::VLine) are disallowed; Frame line shapes (TQFrame::HLink and TQFrame::VLine) are disallowed;
see QFrame::setFrameStyle(). see TQFrame::setFrameStyle().
Note that the \a f argument is \e not \link setTableFlags() table Note that the \a f argument is \e not \link setTableFlags() table
flags \endlink but rather \link QWidget::QWidget() widget flags \endlink but rather \link TQWidget::TQWidget() widget
flags. \endlink flags. \endlink
*/ */
QtTableView::QtTableView( QWidget *parent, const char *name, WFlags f ) QtTableView::QtTableView( TQWidget *parent, const char *name, WFlags f )
: QFrame( parent, name, f ) : TQFrame( parent, name, f )
{ {
nRows = nCols = 0; // zero rows/cols nRows = nCols = 0; // zero rows/cols
xCellOffs = yCellOffs = 0; // zero offset xCellOffs = yCellOffs = 0; // zero offset
@ -179,21 +179,21 @@ QtTableView::~QtTableView()
/*! /*!
\internal \internal
Reimplements QWidget::setBackgroundColor() for binary compatibility. Reimplements TQWidget::setBackgroundColor() for binary compatibility.
\sa setPalette() \sa setPalette()
*/ */
void QtTableView::setBackgroundColor( const QColor &c ) void QtTableView::setBackgroundColor( const TQColor &c )
{ {
QWidget::setBackgroundColor( c ); TQWidget::setBackgroundColor( c );
} }
/*!\reimp /*!\reimp
*/ */
void QtTableView::setPalette( const QPalette &p ) void QtTableView::setPalette( const TQPalette &p )
{ {
QWidget::setPalette( p ); TQWidget::setPalette( p );
} }
/*!\reimp /*!\reimp
@ -202,7 +202,7 @@ void QtTableView::setPalette( const QPalette &p )
void QtTableView::show() void QtTableView::show()
{ {
showOrHideScrollBars(); showOrHideScrollBars();
QWidget::show(); TQWidget::show();
} }
@ -226,7 +226,7 @@ void QtTableView::show()
event. event.
At present, QtTableView is the only widget that reimplements \link At present, QtTableView is the only widget that reimplements \link
QWidget::repaint() repaint()\endlink. It does this because by TQWidget::repaint() repaint()\endlink. It does this because by
clearing and then repainting one cell at at time, it can make the clearing and then repainting one cell at at time, it can make the
screen flicker less than it would otherwise. */ screen flicker less than it would otherwise. */
@ -238,10 +238,10 @@ void QtTableView::repaint( int x, int y, int w, int h, bool erase )
w = width() - x; w = width() - x;
if ( h < 0 ) if ( h < 0 )
h = height() - y; h = height() - y;
QRect r( x, y, w, h ); TQRect r( x, y, w, h );
if ( r.isEmpty() ) if ( r.isEmpty() )
return; // nothing to do return; // nothing to do
QPaintEvent e( r ); TQPaintEvent e( r );
if ( erase && backgroundMode() != NoBackground ) if ( erase && backgroundMode() != NoBackground )
eraseInPaint = TRUE; // erase when painting eraseInPaint = TRUE; // erase when painting
paintEvent( &e ); paintEvent( &e );
@ -249,7 +249,7 @@ void QtTableView::repaint( int x, int y, int w, int h, bool erase )
} }
/*! /*!
\overload void QtTableView::repaint( const QRect &r, bool erase ) \overload void QtTableView::repaint( const TQRect &r, bool erase )
Replaints rectangle \a r. If \a erase is TRUE draws the background Replaints rectangle \a r. If \a erase is TRUE draws the background
using the palette's background. using the palette's background.
*/ */
@ -730,7 +730,7 @@ int QtTableView::totalHeight()
<dt> Tbl_autoHScrollBar <dd> The table has a horizontal scroll bar if <dt> Tbl_autoHScrollBar <dd> The table has a horizontal scroll bar if
- and only if - the table is wider than the view. - and only if - the table is wider than the view.
<dt> Tbl_autoScrollBars <dd> - The union of the previous two flags. <dt> Tbl_autoScrollBars <dd> - The union of the previous two flags.
<dt> Tbl_clipCellPainting <dd> - The table uses QPainter::setClipRect() to <dt> Tbl_clipCellPainting <dd> - The table uses TQPainter::setClipRect() to
make sure that paintCell() will not draw outside the cell make sure that paintCell() will not draw outside the cell
boundaries. boundaries.
<dt> Tbl_cutCellsV <dd> - The table will never show part of a <dt> Tbl_cutCellsV <dd> - The table will never show part of a
@ -960,7 +960,7 @@ void QtTableView::updateCell( int row, int col, bool erase )
return; return;
if ( !rowYPos( row, &yPos ) ) if ( !rowYPos( row, &yPos ) )
return; return;
QRect uR = QRect( xPos, yPos, TQRect uR = TQRect( xPos, yPos,
cellW ? cellW : cellWidth(col), cellW ? cellW : cellWidth(col),
cellH ? cellH : cellHeight(row) ); cellH ? cellH : cellHeight(row) );
repaint( uR.intersect(viewRect()), erase ); repaint( uR.intersect(viewRect()), erase );
@ -968,7 +968,7 @@ void QtTableView::updateCell( int row, int col, bool erase )
/*! /*!
\fn QRect QtTableView::cellUpdateRect() const \fn TQRect QtTableView::cellUpdateRect() const
This function should be called only from the paintCell() function in This function should be called only from the paintCell() function in
subclasses. It returns the portion of a cell that actually needs to be subclasses. It returns the portion of a cell that actually needs to be
@ -982,9 +982,9 @@ void QtTableView::updateCell( int row, int col, bool erase )
frame, in \e widget coordinates. frame, in \e widget coordinates.
*/ */
QRect QtTableView::viewRect() const TQRect QtTableView::viewRect() const
{ {
return QRect( frameWidth(), frameWidth(), viewWidth(), viewHeight() ); return TQRect( frameWidth(), frameWidth(), viewWidth(), viewHeight() );
} }
@ -1127,7 +1127,7 @@ void QtTableView::snapToGrid( bool horizontal, bool vertical )
/*! /*!
\internal \internal
This internal slot is connected to the horizontal scroll bar's This internal slot is connected to the horizontal scroll bar's
QScrollBar::valueChanged() signal. TQScrollBar::valueChanged() signal.
Moves the table horizontally to offset \a val without updating the Moves the table horizontally to offset \a val without updating the
scroll bar. scroll bar.
@ -1148,7 +1148,7 @@ void QtTableView::horSbValue( int val )
/*! /*!
\internal \internal
This internal slot is connected to the horizontal scroll bar's This internal slot is connected to the horizontal scroll bar's
QScrollBar::sliderMoved() signal. TQScrollBar::sliderMoved() signal.
Scrolls the table smoothly horizontally even if \c Tbl_snapToHGrid is set. Scrolls the table smoothly horizontally even if \c Tbl_snapToHGrid is set.
*/ */
@ -1168,7 +1168,7 @@ void QtTableView::horSbSliding( int val )
/*! /*!
\internal \internal
This internal slot is connected to the horizontal scroll bar's This internal slot is connected to the horizontal scroll bar's
QScrollBar::sliderReleased() signal. TQScrollBar::sliderReleased() signal.
*/ */
void QtTableView::horSbSlidingDone( ) void QtTableView::horSbSlidingDone( )
@ -1181,7 +1181,7 @@ void QtTableView::horSbSlidingDone( )
/*! /*!
\internal \internal
This internal slot is connected to the vertical scroll bar's This internal slot is connected to the vertical scroll bar's
QScrollBar::valueChanged() signal. TQScrollBar::valueChanged() signal.
Moves the table vertically to offset \a val without updating the Moves the table vertically to offset \a val without updating the
scroll bar. scroll bar.
@ -1202,7 +1202,7 @@ void QtTableView::verSbValue( int val )
/*! /*!
\internal \internal
This internal slot is connected to the vertical scroll bar's This internal slot is connected to the vertical scroll bar's
QScrollBar::sliderMoved() signal. TQScrollBar::sliderMoved() signal.
Scrolls the table smoothly vertically even if \c Tbl_snapToVGrid is set. Scrolls the table smoothly vertically even if \c Tbl_snapToVGrid is set.
*/ */
@ -1222,7 +1222,7 @@ void QtTableView::verSbSliding( int val )
/*! /*!
\internal \internal
This internal slot is connected to the vertical scroll bar's This internal slot is connected to the vertical scroll bar's
QScrollBar::sliderReleased() signal. TQScrollBar::sliderReleased() signal.
*/ */
void QtTableView::verSbSlidingDone( ) void QtTableView::verSbSlidingDone( )
@ -1240,18 +1240,18 @@ void QtTableView::verSbSlidingDone( )
do so for each cell. do so for each cell.
*/ */
void QtTableView::setupPainter( QPainter * ) void QtTableView::setupPainter( TQPainter * )
{ {
} }
/*! /*!
\fn void QtTableView::paintCell( QPainter *p, int row, int col ) \fn void QtTableView::paintCell( TQPainter *p, int row, int col )
This pure virtual function is called to paint the single cell at \a This pure virtual function is called to paint the single cell at \a
(row,col) using \a p, which is open when paintCell() is called and (row,col) using \a p, which is open when paintCell() is called and
must remain open. must remain open.
The coordinate system is \link QPainter::translate() translated \endlink The coordinate system is \link TQPainter::translate() translated \endlink
so that the origin is at the top-left corner of the cell to be so that the origin is at the top-left corner of the cell to be
painted, i.e. \e cell coordinates. Do not scale or shear the coordinate painted, i.e. \e cell coordinates. Do not scale or shear the coordinate
system (or if you do, restore the transformation matrix before you system (or if you do, restore the transformation matrix before you
@ -1269,16 +1269,16 @@ void QtTableView::setupPainter( QPainter * )
Calls paintCell() for the cells that needs to be repainted. Calls paintCell() for the cells that needs to be repainted.
*/ */
void QtTableView::paintEvent( QPaintEvent *e ) void QtTableView::paintEvent( TQPaintEvent *e )
{ {
QRect updateR = e->rect(); // update rectangle TQRect updateR = e->rect(); // update rectangle
if ( sbDirty ) { if ( sbDirty ) {
bool e = eraseInPaint; bool e = eraseInPaint;
updateScrollBars(); updateScrollBars();
eraseInPaint = e; eraseInPaint = e;
} }
QPainter paint( this ); TQPainter paint( this );
if ( !contentsRect().contains( updateR, TRUE ) ) {// update frame ? if ( !contentsRect().contains( updateR, TRUE ) ) {// update frame ?
drawFrame( &paint ); drawFrame( &paint );
@ -1312,11 +1312,11 @@ void QtTableView::paintEvent( QPaintEvent *e )
int xPos = maxX+1; // in case the while() is empty int xPos = maxX+1; // in case the while() is empty
int nextX; int nextX;
int nextY; int nextY;
QRect winR = viewRect(); TQRect winR = viewRect();
QRect cellR; TQRect cellR;
QRect cellUR; TQRect cellUR;
#ifndef QT_NO_TRANSFORMATIONS #ifndef QT_NO_TRANSFORMATIONS
QWMatrix matrix; TQWMatrix matrix;
#endif #endif
while ( yPos <= maxY && row < nRows ) { while ( yPos <= maxY && row < nRows ) {
@ -1384,22 +1384,22 @@ void QtTableView::paintEvent( QPaintEvent *e )
// inside the cells. So QtTableView is reponsible for all pixels // inside the cells. So QtTableView is reponsible for all pixels
// outside the cells. // outside the cells.
QRect viewR = viewRect(); TQRect viewR = viewRect();
const QColorGroup g = colorGroup(); const TQColorGroup g = colorGroup();
if ( xPos <= maxX ) { if ( xPos <= maxX ) {
QRect r = viewR; TQRect r = viewR;
r.setLeft( xPos ); r.setLeft( xPos );
r.setBottom( yPos<maxY?yPos:maxY ); r.setBottom( yPos<maxY?yPos:maxY );
if ( inherits( "QMultiLineEdit" ) ) if ( inherits( "TQMultiLineEdit" ) )
paint.fillRect( r.intersect( updateR ), g.base() ); paint.fillRect( r.intersect( updateR ), g.base() );
else else
paint.eraseRect( r.intersect( updateR ) ); paint.eraseRect( r.intersect( updateR ) );
} }
if ( yPos <= maxY ) { if ( yPos <= maxY ) {
QRect r = viewR; TQRect r = viewR;
r.setTop( yPos ); r.setTop( yPos );
if ( inherits( "QMultiLineEdit" ) ) if ( inherits( "TQMultiLineEdit" ) )
paint.fillRect( r.intersect( updateR ), g.base() ); paint.fillRect( r.intersect( updateR ), g.base() );
else else
paint.eraseRect( r.intersect( updateR ) ); paint.eraseRect( r.intersect( updateR ) );
@ -1408,7 +1408,7 @@ void QtTableView::paintEvent( QPaintEvent *e )
/*!\reimp /*!\reimp
*/ */
void QtTableView::resizeEvent( QResizeEvent * ) void QtTableView::resizeEvent( TQResizeEvent * )
{ {
updateScrollBars( horValue | verValue | horSteps | horGeometry | horRange | updateScrollBars( horValue | verValue | horSteps | horGeometry | horRange |
verSteps | verGeometry | verRange ); verSteps | verGeometry | verRange );
@ -1435,11 +1435,11 @@ void QtTableView::updateView()
values; use findRow() to translate to cell numbers. values; use findRow() to translate to cell numbers.
*/ */
QScrollBar *QtTableView::verticalScrollBar() const TQScrollBar *QtTableView::verticalScrollBar() const
{ {
QtTableView *that = (QtTableView*)this; // semantic const QtTableView *that = (QtTableView*)this; // semantic const
if ( !vScrollBar ) { if ( !vScrollBar ) {
QScrollBar *sb = new QScrollBar( QScrollBar::Vertical, that ); TQScrollBar *sb = new TQScrollBar( TQScrollBar::Vertical, that );
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
sb->setCursor( arrowCursor ); sb->setCursor( arrowCursor );
#endif #endif
@ -1447,12 +1447,12 @@ QScrollBar *QtTableView::verticalScrollBar() const
Q_CHECK_PTR(sb); Q_CHECK_PTR(sb);
sb->setTracking( FALSE ); sb->setTracking( FALSE );
sb->setFocusPolicy( NoFocus ); sb->setFocusPolicy( NoFocus );
connect( sb, SIGNAL(valueChanged(int)), connect( sb, TQT_SIGNAL(valueChanged(int)),
SLOT(verSbValue(int))); TQT_SLOT(verSbValue(int)));
connect( sb, SIGNAL(sliderMoved(int)), connect( sb, TQT_SIGNAL(sliderMoved(int)),
SLOT(verSbSliding(int))); TQT_SLOT(verSbSliding(int)));
connect( sb, SIGNAL(sliderReleased()), connect( sb, TQT_SIGNAL(sliderReleased()),
SLOT(verSbSlidingDone())); TQT_SLOT(verSbSlidingDone()));
sb->hide(); sb->hide();
that->vScrollBar = sb; that->vScrollBar = sb;
return sb; return sb;
@ -1466,11 +1466,11 @@ QScrollBar *QtTableView::verticalScrollBar() const
values; use findCol() to translate to cell numbers. values; use findCol() to translate to cell numbers.
*/ */
QScrollBar *QtTableView::horizontalScrollBar() const TQScrollBar *QtTableView::horizontalScrollBar() const
{ {
QtTableView *that = (QtTableView*)this; // semantic const QtTableView *that = (QtTableView*)this; // semantic const
if ( !hScrollBar ) { if ( !hScrollBar ) {
QScrollBar *sb = new QScrollBar( QScrollBar::Horizontal, that ); TQScrollBar *sb = new TQScrollBar( TQScrollBar::Horizontal, that );
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
sb->setCursor( arrowCursor ); sb->setCursor( arrowCursor );
#endif #endif
@ -1478,12 +1478,12 @@ QScrollBar *QtTableView::horizontalScrollBar() const
sb->setFocusPolicy( NoFocus ); sb->setFocusPolicy( NoFocus );
Q_CHECK_PTR(sb); Q_CHECK_PTR(sb);
sb->setTracking( FALSE ); sb->setTracking( FALSE );
connect( sb, SIGNAL(valueChanged(int)), connect( sb, TQT_SIGNAL(valueChanged(int)),
SLOT(horSbValue(int))); TQT_SLOT(horSbValue(int)));
connect( sb, SIGNAL(sliderMoved(int)), connect( sb, TQT_SIGNAL(sliderMoved(int)),
SLOT(horSbSliding(int))); TQT_SLOT(horSbSliding(int)));
connect( sb, SIGNAL(sliderReleased()), connect( sb, TQT_SIGNAL(sliderReleased()),
SLOT(horSbSlidingDone())); TQT_SLOT(horSbSlidingDone()));
sb->hide(); sb->hide();
that->hScrollBar = sb; that->hScrollBar = sb;
return sb; return sb;
@ -1787,10 +1787,10 @@ bool QtTableView::colXPos( int col, int *xPos ) const
Moves the visible area of the table right by \a xPixels and Moves the visible area of the table right by \a xPixels and
down by \a yPixels pixels. Both may be negative. down by \a yPixels pixels. Both may be negative.
\warning You might find that QScrollView offers a higher-level of \warning You might find that TQScrollView offers a higher-level of
functionality than using QtTableView and this function. functionality than using QtTableView and this function.
This function is \e not the same as QWidget::scroll(); in particular, This function is \e not the same as TQWidget::scroll(); in particular,
the signs of \a xPixels and \a yPixels have the reverse semantics. the signs of \a xPixels and \a yPixels have the reverse semantics.
\sa setXOffset(), setYOffset(), setOffset(), setTopCell(), \sa setXOffset(), setYOffset(), setOffset(), setTopCell(),
@ -1799,7 +1799,7 @@ bool QtTableView::colXPos( int col, int *xPos ) const
void QtTableView::scroll( int xPixels, int yPixels ) void QtTableView::scroll( int xPixels, int yPixels )
{ {
QWidget::scroll( -xPixels, -yPixels, contentsRect() ); TQWidget::scroll( -xPixels, -yPixels, contentsRect() );
} }
@ -2058,7 +2058,7 @@ void QtTableView::updateFrameSize()
if ( autoUpdate() ) { if ( autoUpdate() ) {
int fh = frameRect().height(); int fh = frameRect().height();
int fw = frameRect().width(); int fw = frameRect().width();
setFrameRect( QRect(0,0,rw,rh) ); setFrameRect( TQRect(0,0,rw,rh) );
if ( rw != fw ) if ( rw != fw )
update( QMIN(fw,rw) - frameWidth() - 2, 0, frameWidth()+4, rh ); update( QMIN(fw,rw) - frameWidth() - 2, 0, frameWidth()+4, rh );

@ -16,7 +16,7 @@
#define QTTABLEVIEW_H #define QTTABLEVIEW_H
#ifndef QT_H #ifndef QT_H
#include "qframe.h" #include "tqframe.h"
#endif // QT_H #endif // QT_H
#ifndef QT_NO_QTTABLEVIEW #ifndef QT_NO_QTTABLEVIEW
@ -29,16 +29,16 @@ class QtTableView : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
virtual void setBackgroundColor( const QColor & ); virtual void setBackgroundColor( const TQColor & );
virtual void setPalette( const QPalette & ); virtual void setPalette( const TQPalette & );
void show(); void show();
void repaint( bool erase=TRUE ); void repaint( bool erase=TRUE );
void repaint( int x, int y, int w, int h, bool erase=TRUE ); void repaint( int x, int y, int w, int h, bool erase=TRUE );
void repaint( const QRect &, bool erase=TRUE ); void repaint( const TQRect &, bool erase=TRUE );
protected: protected:
QtTableView( QWidget *parent=0, const char *name=0, WFlags f=0 ); QtTableView( TQWidget *parent=0, const char *name=0, WFlags f=0 );
~QtTableView(); ~QtTableView();
int numRows() const; int numRows() const;
@ -87,8 +87,8 @@ protected:
bool rowIsVisible( int row ) const; bool rowIsVisible( int row ) const;
bool colIsVisible( int col ) const; bool colIsVisible( int col ) const;
QScrollBar *verticalScrollBar() const; TQScrollBar *verticalScrollBar() const;
QScrollBar *horizontalScrollBar() const; TQScrollBar *horizontalScrollBar() const;
private slots: private slots:
void horSbValue( int ); void horSbValue( int );
@ -99,11 +99,11 @@ private slots:
void verSbSlidingDone(); void verSbSlidingDone();
protected: protected:
virtual void paintCell( QPainter *, int row, int col ) = 0; virtual void paintCell( TQPainter *, int row, int col ) = 0;
virtual void setupPainter( QPainter * ); virtual void setupPainter( TQPainter * );
void paintEvent( QPaintEvent * ); void paintEvent( TQPaintEvent * );
void resizeEvent( QResizeEvent * ); void resizeEvent( TQResizeEvent * );
int findRow( int yPos ) const; int findRow( int yPos ) const;
int findCol( int xPos ) const; int findCol( int xPos ) const;
@ -164,8 +164,8 @@ private:
uint tFlags; uint tFlags;
QRect cellUpdateR; QRect cellUpdateR;
QScrollBar *vScrollBar; TQScrollBar *vScrollBar;
QScrollBar *hScrollBar; TQScrollBar *hScrollBar;
QCornerSquare *cornerSquare; QCornerSquare *cornerSquare;
private: // Disabled copy constructor and operator= private: // Disabled copy constructor and operator=
@ -230,7 +230,7 @@ inline uint QtTableView::tableFlags() const
inline bool QtTableView::testTableFlags( uint f ) const inline bool QtTableView::testTableFlags( uint f ) const
{ return (tFlags & f) != 0; } { return (tFlags & f) != 0; }
inline QRect QtTableView::cellUpdateRect() const inline TQRect QtTableView::cellUpdateRect() const
{ return cellUpdateR; } { return cellUpdateR; }
inline bool QtTableView::autoUpdate() const inline bool QtTableView::autoUpdate() const
@ -239,7 +239,7 @@ inline bool QtTableView::autoUpdate() const
inline void QtTableView::repaint( bool erase ) inline void QtTableView::repaint( bool erase )
{ repaint( 0, 0, width(), height(), erase ); } { repaint( 0, 0, width(), height(), erase ); }
inline void QtTableView::repaint( const QRect &r, bool erase ) inline void QtTableView::repaint( const TQRect &r, bool erase )
{ repaint( r.x(), r.y(), r.width(), r.height(), erase ); } { repaint( r.x(), r.y(), r.width(), r.height(), erase ); }
inline void QtTableView::updateScrollBars() inline void QtTableView::updateScrollBars()

@ -23,11 +23,11 @@
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <qbitmap.h> #include <tqbitmap.h>
#include <qtooltip.h> #include <tqtooltip.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <qlayout.h> #include <tqlayout.h>
#include <dcopclient.h> #include <dcopclient.h>
#include <kdebug.h> #include <kdebug.h>
@ -53,7 +53,7 @@ const char *description = I18N_NOOP("Moon Phase Indicator for KDE");
extern "C" extern "C"
{ {
KDE_EXPORT KPanelApplet *init(QWidget *parent, const QString& configFile) KDE_EXPORT KPanelApplet *init(TQWidget *parent, const TQString& configFile)
{ {
KGlobal::locale()->insertCatalogue("kmoon"); KGlobal::locale()->insertCatalogue("kmoon");
return new MoonPAWidget(configFile, KPanelApplet::Normal, return new MoonPAWidget(configFile, KPanelApplet::Normal,
@ -62,14 +62,14 @@ extern "C"
} }
} }
MoonPAWidget::MoonPAWidget(const QString& configFile, Type type, int actions, MoonPAWidget::MoonPAWidget(const TQString& configFile, Type type, int actions,
QWidget *parent, const char *name) TQWidget *parent, const char *name)
: KPanelApplet(configFile, type, actions, parent, name) : KPanelApplet(configFile, type, actions, parent, name)
{ {
KConfig *config = KGlobal::config(); KConfig *config = KGlobal::config();
config->setGroup("General"); config->setGroup("General");
QVBoxLayout *vbox = new QVBoxLayout(this, 0,0); TQVBoxLayout *vbox = new TQVBoxLayout(this, 0,0);
moon = new MoonWidget(this); moon = new MoonWidget(this);
moon->setAngle(config->readNumEntry("Rotation", 0)); moon->setAngle(config->readNumEntry("Rotation", 0));
moon->setNorthHemi(config->readBoolEntry("Northern", true)); moon->setNorthHemi(config->readBoolEntry("Northern", true));
@ -77,12 +77,12 @@ MoonPAWidget::MoonPAWidget(const QString& configFile, Type type, int actions,
vbox->addWidget(moon); vbox->addWidget(moon);
startTimer(1000 * 60 * 20); startTimer(1000 * 60 * 20);
popup = new QPopupMenu(); popup = new TQPopupMenu();
popup->insertItem(SmallIcon("kmoon"), popup->insertItem(SmallIcon("kmoon"),
i18n("&About"), this, i18n("&About"), this,
SLOT(showAbout())); TQT_SLOT(showAbout()));
popup->insertItem(SmallIcon("configure"), i18n("&Configure..."), this, popup->insertItem(SmallIcon("configure"), i18n("&Configure..."), this,
SLOT(settings())); TQT_SLOT(settings()));
// missuse timerEvent for initialising // missuse timerEvent for initialising
timerEvent(0); timerEvent(0);
@ -103,8 +103,8 @@ void MoonPAWidget::showAbout()
0, "about", true, true, 0, "about", true, true,
KStdGuiItem::ok() ); KStdGuiItem::ok() );
QPixmap ret = DesktopIcon("kmoon"); TQPixmap ret = DesktopIcon("kmoon");
QString text = i18n(description) + QString::fromLatin1("\n\n") + TQString text = i18n(description) + TQString::fromLatin1("\n\n") +
i18n("Written by Stephan Kulow <coolo@kde.org>\n" i18n("Written by Stephan Kulow <coolo@kde.org>\n"
"\n" "\n"
"Made an applet by M G Berberich " "Made an applet by M G Berberich "
@ -118,7 +118,7 @@ void MoonPAWidget::showAbout()
dialog->setIcon(ret); 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() void MoonPAWidget::settings()
@ -139,7 +139,7 @@ void MoonPAWidget::settings()
repaint(); repaint();
} }
void MoonPAWidget::timerEvent( QTimerEvent * ) void MoonPAWidget::timerEvent( TQTimerEvent * )
{ {
time_t clock; time_t clock;
time(&clock); time(&clock);
@ -148,7 +148,7 @@ void MoonPAWidget::timerEvent( QTimerEvent * )
moon->repaint(); moon->repaint();
} }
void MoonPAWidget::mousePressEvent( QMouseEvent *e) void MoonPAWidget::mousePressEvent( TQMouseEvent *e)
{ {
if (!popup) if (!popup)
return; return;

@ -21,8 +21,8 @@
#ifndef KMOONAPPLET #ifndef KMOONAPPLET
#define KMOONAPPLET #define KMOONAPPLET
#include <qwidget.h> #include <tqwidget.h>
#include <qimage.h> #include <tqimage.h>
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <ksystemtray.h> #include <ksystemtray.h>
@ -39,29 +39,29 @@ class MoonPAWidget : public KPanelApplet
Q_OBJECT Q_OBJECT
public: public:
MoonPAWidget(const QString& configFile, Type t = Normal, int actions = 0, MoonPAWidget(const TQString& configFile, Type t = Normal, int actions = 0,
QWidget *parent = 0, const char *name = 0); TQWidget *parent = 0, const char *name = 0);
~MoonPAWidget(); ~MoonPAWidget();
int widthForHeight(int height) const { return height; } int widthForHeight(int height) const { return height; }
int heightForWidth(int width) const { return width; } int heightForWidth(int width) const { return width; }
protected: protected:
QPopupMenu *popup; TQPopupMenu *popup;
MoonWidget *moon; MoonWidget *moon;
QString tooltip; TQString tooltip;
void about() { showAbout(); } void about() { showAbout(); }
void preferences() { settings(); } void preferences() { settings(); }
protected slots: protected slots:
void timerEvent( QTimerEvent *e); void timerEvent( TQTimerEvent *e);
void showAbout(); void showAbout();
void settings(); void settings();
protected: protected:
void mousePressEvent( QMouseEvent *e); void mousePressEvent( TQMouseEvent *e);
}; };
#endif #endif

@ -18,31 +18,31 @@
* *
*/ */
#include <qslider.h> #include <tqslider.h>
#include <qlayout.h> #include <tqlayout.h>
#include <klocale.h> #include <klocale.h>
#include <qwhatsthis.h> #include <tqwhatsthis.h>
#include <qvbox.h> #include <tqvbox.h>
#include <kapplication.h> #include <kapplication.h>
#include <qpushbutton.h> #include <tqpushbutton.h>
#include "kmoondlg.h" #include "kmoondlg.h"
#include "kmoonwidget.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"), : KDialogBase(parent, name, true, i18n("Change View"),
Ok|Cancel|Help), angle(a), north(n), mask(m) Ok|Cancel|Help), angle(a), north(n), mask(m)
{ {
QWidget *page = new QWidget( this ); TQWidget *page = new TQWidget( this );
setMainWidget(page); setMainWidget(page);
QHBoxLayout *topLayout = new QHBoxLayout( page, 0, spacingHint() ); TQHBoxLayout *topLayout = new TQHBoxLayout( page, 0, spacingHint() );
QVBox *vbox = new QVBox(page); TQVBox *vbox = new TQVBox(page);
QHBox *hbox1 = new QHBox(vbox); TQHBox *hbox1 = new TQHBox(vbox);
hbox1->setSpacing(15); hbox1->setSpacing(15);
QLabel *label = new QLabel( i18n("View angle:"), hbox1, "caption" ); TQLabel *label = new TQLabel( i18n("View angle:"), hbox1, "caption" );
QString text = i18n("You can use this to rotate the moon to the correct\n" TQString text = i18n("You can use this to rotate the moon to the correct\n"
"angle for your location.\n" "angle for your location.\n"
"\n" "\n"
"This angle is (almost) impossible to\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" "The default value is 0, but it is very\n"
"unlikely that you would see the moon\n" "unlikely that you would see the moon\n"
"at this angle."); "at this angle.");
QWhatsThis::add(label, text); TQWhatsThis::add(label, text);
slider = new QSlider( -90, 90, 2, angle, Qt::Horizontal, hbox1, "slider" ); slider = new TQSlider( -90, 90, 2, angle, Qt::Horizontal, hbox1, "slider" );
slider->setTickmarks(QSlider::Above); slider->setTickmarks(TQSlider::Above);
slider->setTickInterval(45); slider->setTickInterval(45);
slider->setEnabled(QPixmap::defaultDepth() > 8); slider->setEnabled(TQPixmap::defaultDepth() > 8);
label->setEnabled(QPixmap::defaultDepth() > 8); label->setEnabled(TQPixmap::defaultDepth() > 8);
QWhatsThis::add(slider, text); TQWhatsThis::add(slider, text);
connect(slider, SIGNAL(valueChanged(int)), SLOT(angleChanged(int))); connect(slider, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(angleChanged(int)));
QHBox *hbox2 = new QHBox(vbox); TQHBox *hbox2 = new TQHBox(vbox);
hbox2->setSpacing(spacingHint()); hbox2->setSpacing(spacingHint());
hemitoggle = new QPushButton(hbox2); hemitoggle = new TQPushButton(hbox2);
hemitoggle->setText(north ? i18n("Switch to Southern Hemisphere") : hemitoggle->setText(north ? i18n("Switch to Southern Hemisphere") :
i18n("Switch to Northern 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") : masktoggle->setText(mask ? i18n("Switch Masking Off") :
i18n("Switch Masking On")); i18n("Switch Masking On"));
connect(masktoggle, SIGNAL(clicked()), SLOT(toggleMask())); connect(masktoggle, TQT_SIGNAL(clicked()), TQT_SLOT(toggleMask()));
topLayout->addWidget(vbox); topLayout->addWidget(vbox);
moon = new MoonWidget(page, "preview"); moon = new MoonWidget(page, "preview");
moon->setMinimumSize(50, 50); moon->setMinimumSize(50, 50);
moon->setMaximumSize(200,200); 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.")); "following your current setting and time."));
topLayout->addWidget(moon); topLayout->addWidget(moon);
connect(this, SIGNAL(helpClicked()), SLOT(help())); connect(this, TQT_SIGNAL(helpClicked()), TQT_SLOT(help()));
// disableResize(); // disableResize();
} }
@ -94,7 +94,7 @@ void KMoonDlg::angleChanged(int value) {
} }
void KMoonDlg::help() { void KMoonDlg::help() {
kapp->invokeHelp(QString::fromLatin1("config")); kapp->invokeHelp(TQString::fromLatin1("config"));
} }
void KMoonDlg::toggleHemi() { void KMoonDlg::toggleHemi() {

@ -31,19 +31,19 @@ class KMoonDlg : public KDialogBase {
Q_OBJECT Q_OBJECT
public: 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; } int getAngle() const { return angle; }
bool getNorthHemi() const { return north; } bool getNorthHemi() const { return north; }
bool getMask() const { return mask; } bool getMask() const { return mask; }
private: private:
QSlider *slider; TQSlider *slider;
MoonWidget *moon; MoonWidget *moon;
int angle; int angle;
bool north; bool north;
bool mask; bool mask;
QPushButton *hemitoggle; TQPushButton *hemitoggle;
QPushButton *masktoggle; TQPushButton *masktoggle;
private slots: private slots:
void help(); void help();

@ -23,11 +23,11 @@
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <qbitmap.h> #include <tqbitmap.h>
#include <qtooltip.h> #include <tqtooltip.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <qcolor.h> #include <tqcolor.h>
#include <dcopclient.h> #include <dcopclient.h>
#include <kdebug.h> #include <kdebug.h>
@ -50,8 +50,8 @@
extern double moonphasebylunation(int lun, int phi); extern double moonphasebylunation(int lun, int phi);
extern time_t JDtoDate(double jd, struct tm *event_date); extern time_t JDtoDate(double jd, struct tm *event_date);
MoonWidget::MoonWidget(QWidget *parent, const char *name) MoonWidget::MoonWidget(TQWidget *parent, const char *name)
: QWidget(parent, name) : TQWidget(parent, name)
{ {
struct tm * t; struct tm * t;
time_t clock; time_t clock;
@ -92,30 +92,30 @@ void MoonWidget::calcStatus( time_t time )
lun -= 2; lun -= 2;
QDateTime ln; TQDateTime ln;
ln.setTime_t( last_new ); ln.setTime_t( last_new );
kdDebug() << KGlobal::locale()->formatDateTime( ln ) << endl; kdDebug() << KGlobal::locale()->formatDateTime( ln ) << endl;
time_t first_quarter = JDtoDate( moonphasebylunation( lun, 1 ), 0 ); time_t first_quarter = JDtoDate( moonphasebylunation( lun, 1 ), 0 );
QDateTime fq; TQDateTime fq;
fq.setTime_t( first_quarter ); fq.setTime_t( first_quarter );
kdDebug() << KGlobal::locale()->formatDateTime( fq ) << endl; kdDebug() << KGlobal::locale()->formatDateTime( fq ) << endl;
time_t full_moon = JDtoDate( moonphasebylunation( lun, 2 ), 0 ); time_t full_moon = JDtoDate( moonphasebylunation( lun, 2 ), 0 );
QDateTime fm; TQDateTime fm;
fm.setTime_t( full_moon ); fm.setTime_t( full_moon );
kdDebug() << KGlobal::locale()->formatDateTime( fm ) << endl; kdDebug() << KGlobal::locale()->formatDateTime( fm ) << endl;
time_t third_quarter = JDtoDate( moonphasebylunation( lun, 3 ), 0 ); time_t third_quarter = JDtoDate( moonphasebylunation( lun, 3 ), 0 );
QDateTime tq; TQDateTime tq;
tq.setTime_t( third_quarter ); tq.setTime_t( third_quarter );
kdDebug() << KGlobal::locale()->formatDateTime( tq ) << endl; kdDebug() << KGlobal::locale()->formatDateTime( tq ) << endl;
QDateTime nn; TQDateTime nn;
nn.setTime_t( next_new ); nn.setTime_t( next_new );
kdDebug() << KGlobal::locale()->formatDateTime( nn ) << endl; kdDebug() << KGlobal::locale()->formatDateTime( nn ) << endl;
QDateTime now; TQDateTime now;
now.setTime_t( time ); now.setTime_t( time );
kdDebug() << KGlobal::locale()->formatDateTime( now ) << endl; kdDebug() << KGlobal::locale()->formatDateTime( now ) << endl;
@ -220,15 +220,15 @@ void MoonWidget::calcStatus( time_t time )
repaint(); repaint();
} }
QImage MoonWidget::loadMoon(int index) TQImage MoonWidget::loadMoon(int index)
{ {
if (index == 0) // the new moon has the wrong filename if (index == 0) // the new moon has the wrong filename
index = 29; index = 29;
QString filename = QString("kmoon/pics/moon%1.png").arg(index); TQString filename = TQString("kmoon/pics/moon%1.png").arg(index);
QString path = locate("data", filename); TQString path = locate("data", filename);
if (path.isNull()) if (path.isNull())
kdFatal() << "cound't find " << filename << ". Exiting.\n"; kdFatal() << "cound't find " << filename << ". Exiting.\n";
QImage image(path); TQImage image(path);
KIconEffect iconeffect; KIconEffect iconeffect;
image=iconeffect.apply(image, KIcon::Panel, KIcon::DefaultState); image=iconeffect.apply(image, KIcon::Panel, KIcon::DefaultState);
return image; return image;
@ -255,12 +255,12 @@ void MoonWidget::setMask(bool value)
repaint(); repaint();
} }
void MoonWidget::paintEvent(QPaintEvent *) void MoonWidget::paintEvent(TQPaintEvent *)
{ {
bitBlt(this, 0, 0, &pixmap, 0, 0); bitBlt(this, 0, 0, &pixmap, 0, 0);
} }
void MoonWidget::resizeEvent(QResizeEvent *) void MoonWidget::resizeEvent(TQResizeEvent *)
{ {
renderGraphic(); renderGraphic();
repaint(); repaint();
@ -275,15 +275,15 @@ void MoonWidget::renderGraphic()
old_w = width(); old_w = width();
old_h = height(); old_h = height();
old_north = _north; old_north = _north;
QImage im = loadMoon(counter); TQImage im = loadMoon(counter);
assert(!im.isNull()); assert(!im.isNull());
im = im.convertDepth(32, 0); im = im.convertDepth(32, 0);
assert(!im.isNull()); assert(!im.isNull());
int mw = QMIN(width(), height()); int mw = QMIN(width(), height());
QImage dest; TQImage dest;
if (QPixmap::defaultDepth() > 8) { if (TQPixmap::defaultDepth() > 8) {
if (fabs(_angle)!=0) { // nothing to rotate if (fabs(_angle)!=0) { // nothing to rotate
//We expand the image 2x before rotating, rotate it, and then average out //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)) { if (!pixmap.convertFromImage(im.smoothScale(dmw, dmw), 0)) {
return; return;
} }
QWMatrix m; TQWMatrix m;
m.rotate(_angle); m.rotate(_angle);
QPixmap rotated = pixmap.xForm(m); TQPixmap rotated = pixmap.xForm(m);
//Copy the relevant part back to the pixmap //Copy the relevant part back to the pixmap
QRegion r(QRect(0, 0, dmw, dmw), QRegion::Ellipse); TQRegion r(TQRect(0, 0, dmw, dmw), TQRegion::Ellipse);
QPainter p; TQPainter p;
p.begin(&pixmap); p.begin(&pixmap);
p.fillRect(0, 0, dmw, dmw, Qt::black); p.fillRect(0, 0, dmw, dmw, Qt::black);
p.setClipRegion(r); p.setClipRegion(r);
@ -331,15 +331,15 @@ void MoonWidget::renderGraphic()
if (_mask) { if (_mask) {
// generate alpha-channel // generate alpha-channel
int dmw = mw*2; int dmw = mw*2;
QBitmap dMask(dmw, dmw); TQBitmap dMask(dmw, dmw);
QRegion r(QRect(0, 0, dmw, dmw), QRegion::Ellipse); TQRegion r(TQRect(0, 0, dmw, dmw), TQRegion::Ellipse);
QPainter p; TQPainter p;
p.begin(&dMask); p.begin(&dMask);
p.fillRect(0, 0, dmw, dmw, Qt::white); p.fillRect(0, 0, dmw, dmw, Qt::white);
p.setClipRegion(r); p.setClipRegion(r);
p.fillRect(0, 0, dmw, dmw, Qt::black); p.fillRect(0, 0, dmw, dmw, Qt::black);
p.end(); p.end();
QImage Mask2 = dMask.convertToImage().convertDepth(32).smoothScale(mw, mw); TQImage Mask2 = dMask.convertToImage().convertDepth(32).smoothScale(mw, mw);
dest.setAlphaBuffer(true); dest.setAlphaBuffer(true);
for (int y = 0; y < mw; y++) { for (int y = 0; y < mw; y++) {
QRgb *destline = (QRgb*)dest.scanLine(y); QRgb *destline = (QRgb*)dest.scanLine(y);
@ -360,9 +360,9 @@ void MoonWidget::renderGraphic()
return; return;
} }
QToolTip::remove(this); TQToolTip::remove(this);
QToolTip::add(this, tooltip); TQToolTip::add(this, tooltip);
} }

@ -21,8 +21,8 @@
#ifndef KMOON #ifndef KMOON
#define KMOON #define KMOON
#include <qwidget.h> #include <tqwidget.h>
#include <qimage.h> #include <tqimage.h>
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <ksystemtray.h> #include <ksystemtray.h>
@ -33,7 +33,7 @@ class MoonWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
MoonWidget(QWidget *parent = 0, const char *name = 0); MoonWidget(TQWidget *parent = 0, const char *name = 0);
~MoonWidget(); ~MoonWidget();
void calcStatus( time_t time ); void calcStatus( time_t time );
@ -54,14 +54,14 @@ protected:
int _mask, old_mask; int _mask, old_mask;
bool old_north, _north; bool old_north, _north;
QPixmap pixmap; TQPixmap pixmap;
QString tooltip; TQString tooltip;
void paintEvent( QPaintEvent *e); void paintEvent( TQPaintEvent *e);
void resizeEvent( QResizeEvent *e); void resizeEvent( TQResizeEvent *e);
private: private:
QImage loadMoon(int index); TQImage loadMoon(int index);
void renderGraphic(); void renderGraphic();
}; };

@ -25,11 +25,11 @@
#include "kimagenumber.h" #include "kimagenumber.h"
KImageNumber::KImageNumber(const QString& font, QWidget* parent,const char* name) : KImageNumber::KImageNumber(const TQString& font, TQWidget* parent,const char* name) :
QFrame(parent,name), TQFrame(parent,name),
m_value(0) m_value(0)
{ {
fontPix = new QPixmap(font); fontPix = new TQPixmap(font);
resize(sizeHint()); resize(sizeHint());
} }
@ -38,12 +38,12 @@ KImageNumber::~KImageNumber()
delete fontPix; delete fontPix;
} }
void KImageNumber::paintEvent(QPaintEvent*) void KImageNumber::paintEvent(TQPaintEvent*)
{ {
int w = fontPix->width(); int w = fontPix->width();
int each = w/11; int each = w/11;
QString data; TQString data;
data.sprintf("%06.1f", m_value); data.sprintf("%06.1f", m_value);
for(unsigned int i=0; i < data.length(); i++) { for(unsigned int i=0; i < data.length(); i++) {
@ -65,15 +65,15 @@ double KImageNumber::value() const
return m_value; return m_value;
} }
QSize KImageNumber::sizeHint() const TQSize KImageNumber::sizeHint() const
{ {
int w = fontPix->width(); int w = fontPix->width();
int each = w/11; int each = w/11;
QString data; TQString data;
data.sprintf("%06.1f", m_value); data.sprintf("%06.1f", m_value);
return QSize(data.length()*each, fontPix->height()); return TQSize(data.length()*each, fontPix->height());
} }
#include "kimagenumber.moc" #include "kimagenumber.moc"

@ -26,20 +26,20 @@
#ifndef KIMGNUM_H #ifndef KIMGNUM_H
#define KIMGNUM_H #define KIMGNUM_H
#include <qframe.h> #include <tqframe.h>
#include <qpixmap.h> #include <tqpixmap.h>
class KImageNumber : public QFrame class KImageNumber : public QFrame
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( double m_value READ value WRITE setValue ) Q_PROPERTY( double m_value READ value WRITE setValue )
public: public:
KImageNumber(const QString& font, QWidget* parent=0, const char* name=0); KImageNumber(const TQString& font, TQWidget* parent=0, const char* name=0);
virtual ~KImageNumber(); virtual ~KImageNumber();
void paintEvent(QPaintEvent*); void paintEvent(TQPaintEvent*);
virtual QSize sizeHint() const; virtual TQSize sizeHint() const;
double value() const; double value() const;
public slots: public slots:
@ -47,7 +47,7 @@ public slots:
protected: protected:
double m_value; double m_value;
QPixmap* fontPix; TQPixmap* fontPix;
}; };
#endif #endif

@ -42,8 +42,8 @@ static struct conversionEntry ConversionTable[MAX_UNIT] = {
* Note that we use installEventFilter on the two KImageNumber's * Note that we use installEventFilter on the two KImageNumber's
* to make clicks on them bring up the context-menu. * to make clicks on them bring up the context-menu.
*/ */
Kodometer::Kodometer(QWidget* parent, const char* name) Kodometer::Kodometer(TQWidget* parent, const char* name)
: QFrame(parent, name), : TQFrame(parent, name),
dontRefresh(false), dontRefresh(false),
speed(0.0), speed(0.0),
lastDistance(0.0), lastDistance(0.0),
@ -88,18 +88,18 @@ Kodometer::Kodometer(QWidget* parent, const char* name)
menu->insertTitle(kapp->miniIcon(), KGlobal::instance()->aboutData()->programName()); menu->insertTitle(kapp->miniIcon(), KGlobal::instance()->aboutData()->programName());
enabledID = menu->insertItem(i18n("&Enable"), this, SLOT(toggleEnabled())); enabledID = menu->insertItem(i18n("&Enable"), this, TQT_SLOT(toggleEnabled()));
metricID = menu->insertItem(i18n("&Metric Display"), this, metricID = menu->insertItem(i18n("&Metric Display"), this,
SLOT(toggleUnits())); TQT_SLOT(toggleUnits()));
autoResetID = menu->insertItem(i18n("Auto &Reset Trip"), this, autoResetID = menu->insertItem(i18n("Auto &Reset Trip"), this,
SLOT(toggleAutoReset())); TQT_SLOT(toggleAutoReset()));
menu->insertItem(i18n("Reset &Trip"), this, SLOT(resetTrip())); menu->insertItem(i18n("Reset &Trip"), this, TQT_SLOT(resetTrip()));
menu->insertItem(i18n("Reset &Odometer"), this, SLOT(resetTotal())); menu->insertItem(i18n("Reset &Odometer"), this, TQT_SLOT(resetTotal()));
menu->insertSeparator(); menu->insertSeparator();
menu->insertItem(SmallIconSet("help"), i18n("&Help"), helpMnu); menu->insertItem(SmallIconSet("help"), i18n("&Help"), helpMnu);
menu->insertItem(SmallIconSet("exit"), i18n("&Quit"), this, SLOT(quit())); menu->insertItem(SmallIconSet("exit"), i18n("&Quit"), this, TQT_SLOT(quit()));
menu->setCheckable(true); menu->setCheckable(true);
menu->setItemChecked(enabledID, Enabled); menu->setItemChecked(enabledID, Enabled);
@ -169,10 +169,10 @@ void Kodometer::FindAllScreens(void)
* Here's where we override events to the KImgNum's to display * Here's where we override events to the KImgNum's to display
* the context menu * the context menu
*/ */
bool Kodometer::eventFilter( QObject *, QEvent *e ) bool Kodometer::eventFilter( TQObject *, TQEvent *e )
{ {
if ( e->type() == QEvent::MouseButtonPress ) { if ( e->type() == TQEvent::MouseButtonPress ) {
mousePressEvent((QMouseEvent*)e); mousePressEvent((TQMouseEvent*)e);
return true; return true;
} }
return false; return false;
@ -181,7 +181,7 @@ bool Kodometer::eventFilter( QObject *, QEvent *e )
/* /*
* Show the context menu * Show the context menu
*/ */
void Kodometer::mousePressEvent(QMouseEvent* e) void Kodometer::mousePressEvent(TQMouseEvent* e)
{ {
//FIXME fix this! //FIXME fix this!
//dontRefresh = true; //dontRefresh = true;
@ -193,7 +193,7 @@ void Kodometer::mousePressEvent(QMouseEvent* e)
* compare it to the last known position, and then to calculate * compare it to the last known position, and then to calculate
* the distance moved. * the distance moved.
*/ */
void Kodometer::timerEvent(QTimerEvent* e) void Kodometer::timerEvent(TQTimerEvent* e)
{ {
if (Enabled) { if (Enabled) {
if(e->timerId() == distanceID) { if(e->timerId() == distanceID) {
@ -237,17 +237,17 @@ void Kodometer::toggleUnits()
menu->setItemChecked(metricID, UseMetric); menu->setItemChecked(metricID, UseMetric);
QToolTip::remove(totalLabel); TQToolTip::remove(totalLabel);
QToolTip::remove(tripLabel); TQToolTip::remove(tripLabel);
if(!UseMetric) { if(!UseMetric) {
QToolTip::add(totalLabel, TQToolTip::add(totalLabel,
i18n(ConversionTable[distanceUnit].fromUnitTagPlural)); i18n(ConversionTable[distanceUnit].fromUnitTagPlural));
QToolTip::add(tripLabel, TQToolTip::add(tripLabel,
i18n(ConversionTable[tripDistanceUnit].fromUnitTagPlural)); i18n(ConversionTable[tripDistanceUnit].fromUnitTagPlural));
} else { } else {
QToolTip::add(totalLabel, TQToolTip::add(totalLabel,
i18n(ConversionTable[distanceUnit].toUnitTagPlural)); i18n(ConversionTable[distanceUnit].toUnitTagPlural));
QToolTip::add(tripLabel, TQToolTip::add(tripLabel,
i18n(ConversionTable[tripDistanceUnit].toUnitTagPlural)); i18n(ConversionTable[tripDistanceUnit].toUnitTagPlural));
} }
refresh(); refresh();
@ -284,29 +284,29 @@ void Kodometer::refresh(void)
{ {
if(distanceUnit != lastDUnit) { if(distanceUnit != lastDUnit) {
lastDUnit = distanceUnit; lastDUnit = distanceUnit;
QToolTip::remove(totalLabel); TQToolTip::remove(totalLabel);
if(!UseMetric) if(!UseMetric)
QToolTip::add(totalLabel, TQToolTip::add(totalLabel,
i18n(ConversionTable[distanceUnit].fromUnitTagPlural)); i18n(ConversionTable[distanceUnit].fromUnitTagPlural));
else else
QToolTip::add(totalLabel, TQToolTip::add(totalLabel,
i18n(ConversionTable[distanceUnit].toUnitTagPlural)); i18n(ConversionTable[distanceUnit].toUnitTagPlural));
} }
if(tripDistanceUnit != lastTUnit) { if(tripDistanceUnit != lastTUnit) {
lastTUnit = tripDistanceUnit; lastTUnit = tripDistanceUnit;
QToolTip::remove(tripLabel); TQToolTip::remove(tripLabel);
if(!UseMetric) if(!UseMetric)
QToolTip::add(tripLabel, TQToolTip::add(tripLabel,
i18n(ConversionTable[tripDistanceUnit].fromUnitTagPlural)); i18n(ConversionTable[tripDistanceUnit].fromUnitTagPlural));
else else
QToolTip::add(tripLabel, TQToolTip::add(tripLabel,
i18n(ConversionTable[tripDistanceUnit].toUnitTagPlural)); i18n(ConversionTable[tripDistanceUnit].toUnitTagPlural));
} }
//now draw everything //now draw everything
QString distance_s; TQString distance_s;
QString trip_s; TQString trip_s;
double distance_d = 0; double distance_d = 0;
double trip_d = 0; double trip_d = 0;
@ -519,9 +519,9 @@ int Kodometer::CalcDistance(void)
* pretty OO world. * pretty OO world.
*/ */
#define THERE_IS_A_NEXT (ConversionTable[unit].maxToBeforeNext != -1.0) #define THERE_IS_A_NEXT (ConversionTable[unit].maxToBeforeNext != -1.0)
QString Kodometer::FormatDistance(double &dist, Units unit) TQString Kodometer::FormatDistance(double &dist, Units unit)
{ {
QString string; TQString string;
const char *tag; const char *tag;
int precision; int precision;

@ -30,10 +30,10 @@
#include <math.h> #include <math.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qptrlist.h> #include <tqptrlist.h>
#include <qkeycode.h> #include <tqkeycode.h>
#include <qtooltip.h> #include <tqtooltip.h>
#include <kaboutdata.h> #include <kaboutdata.h>
#include <kuniqueapplication.h> #include <kuniqueapplication.h>
@ -94,15 +94,15 @@ class Kodometer : public QFrame
Q_OBJECT Q_OBJECT
public: public:
Kodometer(QWidget* = 0, const char* = 0); Kodometer(TQWidget* = 0, const char* = 0);
~Kodometer() {} ~Kodometer() {}
void refresh(void); void refresh(void);
void readSettings(void); void readSettings(void);
void saveSettings(void); void saveSettings(void);
void timerEvent(QTimerEvent*); void timerEvent(TQTimerEvent*);
void mousePressEvent(QMouseEvent*); void mousePressEvent(TQMouseEvent*);
bool eventFilter( QObject *, QEvent *e ); bool eventFilter( TQObject *, TQEvent *e );
public slots: public slots:
void toggleEnabled(); void toggleEnabled();
@ -117,7 +117,7 @@ protected:
double multiplier(Units); double multiplier(Units);
int CalcDistance(void); int CalcDistance(void);
QString FormatDistance(double &dist, Units); TQString FormatDistance(double &dist, Units);
void FindAllScreens(); void FindAllScreens();
KImageNumber* tripLabel; KImageNumber* tripLabel;
@ -131,7 +131,7 @@ protected:
int enabledID; int enabledID;
double speed; double speed;
QPtrList<double> speeds; TQPtrList<double> speeds;
double lastDistance; double lastDistance;
int distanceID; int distanceID;
int speedID; int speedID;

@ -7,13 +7,13 @@
------------------------------------------------------------- */ ------------------------------------------------------------- */
#include <klocale.h> #include <klocale.h>
#include <qlistview.h> #include <tqlistview.h>
#include "tealist.h" #include "tealist.h"
QString int2time(int time) TQString int2time(int time)
{ {
QString str; TQString str;
if (time / 60) if (time / 60)
str.append(i18n("%1 min").arg(time / 60)); str.append(i18n("%1 min").arg(time / 60));
if (time % 60) if (time % 60)
@ -25,14 +25,14 @@ QString int2time(int time)
} }
TeaListItem::TeaListItem(QListView * parent) TeaListItem::TeaListItem(TQListView * parent)
:QListViewItem(parent) :TQListViewItem(parent)
{ {
} }
TeaListItem::TeaListItem(QListView * parent, QListViewItem *after) TeaListItem::TeaListItem(TQListView * parent, TQListViewItem *after)
:QListViewItem(parent, after) :TQListViewItem(parent, after)
{ {
} }
@ -43,17 +43,17 @@ TeaListItem::~TeaListItem()
void TeaListItem::setTime(int t) void TeaListItem::setTime(int t)
{ {
QListViewItem::setText(1, int2time(t)); TQListViewItem::setText(1, int2time(t));
tim = t; tim = t;
} }
void TeaListItem::setName(const QString &n) void TeaListItem::setName(const TQString &n)
{ {
nam = n; nam = n;
QListViewItem::setText(0, n); TQListViewItem::setText(0, n);
} }
QString TeaListItem::name() TQString TeaListItem::name()
{ {
return nam; return nam;
} }

@ -8,7 +8,7 @@
#ifndef TEALIST_H #ifndef TEALIST_H
#define TEALIST_H #define TEALIST_H
#include <qstring.h> #include <tqstring.h>
class QListView; class QListView;
class QListViewItem; class QListViewItem;
@ -18,20 +18,20 @@ class TeaListItem : public QListViewItem
{ {
public: public:
TeaListItem(QListView *parent); TeaListItem(TQListView *parent);
TeaListItem(QListView *parent, QListViewItem *after); TeaListItem(TQListView *parent, TQListViewItem *after);
~TeaListItem(); ~TeaListItem();
int time(); int time();
QString name(); TQString name();
void setTime(int v); void setTime(int v);
void setName(const QString &n); void setName(const TQString &n);
private: private:
int tim; int tim;
QString nam; TQString nam;
}; };
QString int2time(int t); TQString int2time(int t);
#endif #endif

@ -7,14 +7,14 @@
------------------------------------------------------------- */ ------------------------------------------------------------- */
#include <klocale.h> #include <klocale.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qlayout.h> #include <tqlayout.h>
#include "timeedit.h" #include "timeedit.h"
#include "timeedit.moc" #include "timeedit.moc"
WrappingSpinBox::WrappingSpinBox(int minValue, int maxValue, int step, QWidget *parent, const char *name) WrappingSpinBox::WrappingSpinBox(int minValue, int maxValue, int step, TQWidget *parent, const char *name)
: QSpinBox(minValue, maxValue, step, parent, name) : TQSpinBox(minValue, maxValue, step, parent, name)
{ {
} }
@ -23,7 +23,7 @@ WrappingSpinBox::~WrappingSpinBox()
} }
/** Overloaded QSpinBox method */ /** Overloaded TQSpinBox method */
void WrappingSpinBox::stepUp() void WrappingSpinBox::stepUp()
{ {
bool wrap = false; bool wrap = false;
@ -31,16 +31,16 @@ void WrappingSpinBox::stepUp()
wrap = true; wrap = true;
if (wrap) if (wrap)
emit wrapUp(); // must wrap first (to avoid double-step-up) emit wrapUp(); // must wrap first (to avoid double-step-up)
QSpinBox::stepUp(); TQSpinBox::stepUp();
} }
/** Overloaded QSpinBox method */ /** Overloaded TQSpinBox method */
void WrappingSpinBox::stepDown() void WrappingSpinBox::stepDown()
{ {
bool wrap = false; bool wrap = false;
if (value() == 0) if (value() == 0)
wrap = true; wrap = true;
QSpinBox::stepDown(); TQSpinBox::stepDown();
if (wrap) if (wrap)
emit wrapDown(); emit wrapDown();
} }
@ -49,20 +49,20 @@ void WrappingSpinBox::stepDown()
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
TimeEdit::TimeEdit(QWidget* parent, const char* name) TimeEdit::TimeEdit(TQWidget* parent, const char* name)
: QWidget(parent, name) : TQWidget(parent, name)
{ {
layout = new QHBoxLayout(this); layout = new TQHBoxLayout(this);
minuteBox = new QSpinBox(0, 300, 1, this); minuteBox = new TQSpinBox(0, 300, 1, this);
// minuteBox->setFixedSize(minuteBox->sizeHint()); // minuteBox->setFixedSize(minuteBox->sizeHint());
QLabel* min = new QLabel(i18n(" min"), this); TQLabel* min = new TQLabel(i18n(" min"), this);
min->setFixedSize(min->sizeHint()); min->setFixedSize(min->sizeHint());
secondBox = new WrappingSpinBox(0, 59, 1, this); secondBox = new WrappingSpinBox(0, 59, 1, this);
secondBox->setWrapping(true); secondBox->setWrapping(true);
// secondBox->setFixedSize(secondBox->sizeHint()); // secondBox->setFixedSize(secondBox->sizeHint());
QLabel* sec = new QLabel(i18n(" sec"),this); TQLabel* sec = new TQLabel(i18n(" sec"),this);
sec->setFixedSize(sec->sizeHint()); sec->setFixedSize(sec->sizeHint());
layout->addWidget(minuteBox); layout->addWidget(minuteBox);
@ -71,10 +71,10 @@ TimeEdit::TimeEdit(QWidget* parent, const char* name)
layout->addWidget(secondBox); layout->addWidget(secondBox);
layout->addWidget(sec); layout->addWidget(sec);
connect(minuteBox, SIGNAL(valueChanged(int)), SLOT(spinBoxValueChanged(int)) ); connect(minuteBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(spinBoxValueChanged(int)) );
connect(secondBox, SIGNAL(valueChanged(int)), SLOT(spinBoxValueChanged(int)) ); connect(secondBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(spinBoxValueChanged(int)) );
connect(secondBox, SIGNAL(wrapUp()), SLOT(wrappedUp())); connect(secondBox, TQT_SIGNAL(wrapUp()), TQT_SLOT(wrappedUp()));
connect(secondBox, SIGNAL(wrapDown()), SLOT(wrappedDown())); connect(secondBox, TQT_SIGNAL(wrapDown()), TQT_SLOT(wrappedDown()));
} }
TimeEdit::~TimeEdit() TimeEdit::~TimeEdit()
@ -139,7 +139,7 @@ void TimeEdit::spinBoxValueChanged(int)
emit valueChanged(value()); emit valueChanged(value());
} }
/** SLOT (overloading QSpinBox): set focus */ /** TQT_SLOT (overloading TQSpinBox): set focus */
void TimeEdit::setFocus() void TimeEdit::setFocus()
{ {
minuteBox->setFocus(); minuteBox->setFocus();

@ -8,8 +8,8 @@
#ifndef TIMEEDIT_H #ifndef TIMEEDIT_H
#define TIMEEDIT_H #define TIMEEDIT_H
#include <qspinbox.h> #include <tqspinbox.h>
#include <qwidget.h> #include <tqwidget.h>
class QBoxLayout; class QBoxLayout;
@ -23,7 +23,7 @@ class WrappingSpinBox : public QSpinBox
Q_OBJECT Q_OBJECT
public: public:
WrappingSpinBox(int minValue, int maxValue, int step = 1, QWidget *parent=0, const char *name=0); WrappingSpinBox(int minValue, int maxValue, int step = 1, TQWidget *parent=0, const char *name=0);
~WrappingSpinBox(); ~WrappingSpinBox();
void stepUp(); void stepUp();
@ -44,7 +44,7 @@ class TimeEdit : public QWidget
Q_OBJECT Q_OBJECT
public: public:
TimeEdit(QWidget* parent = 0, const char* name = 0); TimeEdit(TQWidget* parent = 0, const char* name = 0);
~TimeEdit(); ~TimeEdit();
void setValue(int value); void setValue(int value);
@ -63,9 +63,9 @@ signals:
protected: protected:
QSpinBox *minuteBox; TQSpinBox *minuteBox;
WrappingSpinBox *secondBox; WrappingSpinBox *secondBox;
QBoxLayout* layout; TQBoxLayout* layout;
}; };
#endif #endif

@ -23,20 +23,20 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <qcheckbox.h> #include <tqcheckbox.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qhbox.h> #include <tqhbox.h>
#include <qvbox.h> #include <tqvbox.h>
#include <qlineedit.h> #include <tqlineedit.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qtooltip.h> #include <tqtooltip.h>
#include <qfile.h> #include <tqfile.h>
#include <qcursor.h> #include <tqcursor.h>
#include <qpushbutton.h> #include <tqpushbutton.h>
#include <qgroupbox.h> #include <tqgroupbox.h>
#include <qheader.h> #include <tqheader.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qbitmap.h> #include <tqbitmap.h>
#include <kconfig.h> #include <kconfig.h>
#include <khelpmenu.h> #include <khelpmenu.h>
@ -64,7 +64,7 @@ const int TopLevel::DEFAULT_TEA_TIME = 3*60;
TopLevel::TopLevel() : KSystemTray() TopLevel::TopLevel() : KSystemTray()
{ {
setBackgroundMode(X11ParentRelative); // what for? setBackgroundMode(X11ParentRelative); // what for?
QString n, key; TQString n, key;
unsigned int num; unsigned int num;
teas.clear(); teas.clear();
@ -76,7 +76,7 @@ TopLevel::TopLevel() : KSystemTray()
// assuming this is a new-style config // assuming this is a new-style config
num = config->readNumEntry("Number", 0); num = config->readNumEntry("Number", 0);
teas.resize(num); teas.resize(num);
QString tempstr; TQString tempstr;
for (unsigned int index=1; index<=num; ++index) { for (unsigned int index=1; index<=num; ++index) {
key.sprintf("Tea%d Time", index); key.sprintf("Tea%d Time", index);
tempstr = config->readEntry(key, NULL); tempstr = config->readEntry(key, NULL);
@ -118,24 +118,24 @@ TopLevel::TopLevel() : KSystemTray()
startAct = new KAction(i18n("&Start"), "1rightarrow", 0, startAct = new KAction(i18n("&Start"), "1rightarrow", 0,
this, SLOT(start()), actionCollection(), "start"); this, TQT_SLOT(start()), actionCollection(), "start");
stopAct = new KAction(i18n("Sto&p"), "cancel", 0, stopAct = new KAction(i18n("Sto&p"), "cancel", 0,
this, SLOT(stop()), actionCollection(), "stop"); this, TQT_SLOT(stop()), actionCollection(), "stop");
confAct = new KAction(i18n("&Configure..."), "configure", 0, confAct = new KAction(i18n("&Configure..."), "configure", 0,
this, SLOT(config()), actionCollection(), "configure"); this, TQT_SLOT(config()), actionCollection(), "configure");
anonAct = new KAction(i18n("&Anonymous..."), 0, 0, anonAct = new KAction(i18n("&Anonymous..."), 0, 0,
this, SLOT(anonymous()), actionCollection(), "anonymous"); this, TQT_SLOT(anonymous()), actionCollection(), "anonymous");
// KAction *quitAct = actionCollection()->action("file_quit"); // KAction *quitAct = actionCollection()->action("file_quit");
// create app menu (displayed on right-click) // create app menu (displayed on right-click)
menu = new QPopupMenu(); menu = new TQPopupMenu();
menu->setCheckable(true); menu->setCheckable(true);
connect(menu, SIGNAL(activated(int)), this, SLOT(teaSelected(int))); connect(menu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(teaSelected(int)));
// this menu will be displayed when no tea is steeping, and left mouse button is clicked // this menu will be displayed when no tea is steeping, and left mouse button is clicked
start_menu = new QPopupMenu(); start_menu = new TQPopupMenu();
start_menu->setCheckable(true); // menu isn't tickable, but this gives some add. spacing start_menu->setCheckable(true); // menu isn't tickable, but this gives some add. spacing
connect(start_menu, SIGNAL(activated(int)), this, SLOT(teaStartSelected(int))); connect(start_menu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(teaStartSelected(int)));
rebuildTeaMenus(); // populate tops of menus with tea-entries from config rebuildTeaMenus(); // populate tops of menus with tea-entries from config
@ -152,13 +152,13 @@ TopLevel::TopLevel() : KSystemTray()
menu->insertSeparator(); menu->insertSeparator();
confAct->plug(menu); confAct->plug(menu);
menu->insertItem(SmallIcon("help"), i18n("&Help"), helpMnu); menu->insertItem(SmallIcon("help"), i18n("&Help"), helpMnu);
menu->insertItem(SmallIcon("exit"), i18n("Quit"), kapp, SLOT(quit())); menu->insertItem(SmallIcon("exit"), i18n("Quit"), kapp, TQT_SLOT(quit()));
// quitAct->plug(menu); // FIXME: this doesn't seem to work with above definition of quitAct? // quitAct->plug(menu); // FIXME: this doesn't seem to work with above definition of quitAct?
// (need special 'quit'-method?) // (need special 'quit'-method?)
// this menu will be displayed when a tea is steeping, and left mouse button is clicked // this menu will be displayed when a tea is steeping, and left mouse button is clicked
steeping_menu = new QPopupMenu(); steeping_menu = new TQPopupMenu();
// steeping_menu->insertItem(SmallIcon("cancel"), i18n("Just &Cancel Current"), this, SLOT(stop())); // steeping_menu->insertItem(SmallIcon("cancel"), i18n("Just &Cancel Current"), this, TQT_SLOT(stop()));
stopAct->plug(steeping_menu); // FIXME: can provide different text for this incarnation? stopAct->plug(steeping_menu); // FIXME: can provide different text for this incarnation?
// start_menu->insertSeparator(); // start_menu->insertSeparator();
@ -201,7 +201,7 @@ TopLevel::~TopLevel()
// FIXME: must delete more (like all the QWidgets in config-window)? // FIXME: must delete more (like all the QWidgets in config-window)?
} }
void TopLevel::resizeEvent ( QResizeEvent * ) void TopLevel::resizeEvent ( TQResizeEvent * )
{ {
mugPixmap = loadSizedIcon("mug", width()); mugPixmap = loadSizedIcon("mug", width());
teaNotReadyPixmap = loadSizedIcon("tea_not_ready", width()); teaNotReadyPixmap = loadSizedIcon("tea_not_ready", width());
@ -211,26 +211,26 @@ void TopLevel::resizeEvent ( QResizeEvent * )
} }
/** Handle mousePressEvent */ /** Handle mousePressEvent */
void TopLevel::mousePressEvent(QMouseEvent *event) void TopLevel::mousePressEvent(TQMouseEvent *event)
{ {
if (event->button() == LeftButton) { if (event->button() == LeftButton) {
if (ready) { if (ready) {
stop(); // reset tooltip and stop animation stop(); // reset tooltip and stop animation
} else { } else {
if (running) if (running)
steeping_menu->popup(QCursor::pos()); steeping_menu->popup(TQCursor::pos());
else else
start_menu->popup(QCursor::pos()); start_menu->popup(TQCursor::pos());
} }
} else if (event->button() == RightButton) } else if (event->button() == RightButton)
menu->popup(QCursor::pos()); menu->popup(TQCursor::pos());
// else if (event->button() == MidButton) // currently unused // else if (event->button() == MidButton) // currently unused
} }
/** Handle paintEvent (ie. animate icon) */ /** Handle paintEvent (ie. animate icon) */
void TopLevel::paintEvent(QPaintEvent *) void TopLevel::paintEvent(TQPaintEvent *)
{ {
QPixmap *pm = &mugPixmap; TQPixmap *pm = &mugPixmap;
if (running) { if (running) {
if (useTrayVis) if (useTrayVis)
@ -239,7 +239,7 @@ void TopLevel::paintEvent(QPaintEvent *)
pm = &teaNotReadyPixmap; // generic "steeping" icon pm = &teaNotReadyPixmap; // generic "steeping" icon
} else { } else {
// use simple two-frame "animation" // use simple two-frame "animation"
// FIXME: how about using a QMovie instead? (eg. MNG) // FIXME: how about using a TQMovie instead? (eg. MNG)
if (ready) { if (ready) {
if (firstFrame) if (firstFrame)
pm = &teaAnim1Pixmap; pm = &teaAnim1Pixmap;
@ -249,11 +249,11 @@ void TopLevel::paintEvent(QPaintEvent *)
} }
// overlay pie chart onto tray icon // overlay pie chart onto tray icon
QPixmap base(*pm); // make copy of base pixmap TQPixmap base(*pm); // make copy of base pixmap
if (useTrayVis && running) { if (useTrayVis && running) {
// extend mask // extend mask
QBitmap mask = *(base.mask()); TQBitmap mask = *(base.mask());
QPainter pm(&mask); TQPainter pm(&mask);
pm.setBrush(Qt::color1); // fill with "foreground-colour" pm.setBrush(Qt::color1); // fill with "foreground-colour"
pm.setPen(Qt::NoPen); // no border needed/wanted pm.setPen(Qt::NoPen); // no border needed/wanted
pm.drawPie(0+1, ((float) width()/(float) 2.44444444444)+1, (width()/2), (width()/2), 90*16, -360*16); // full circle of small size pm.drawPie(0+1, ((float) width()/(float) 2.44444444444)+1, (width()/2), (width()/2), 90*16, -360*16); // full circle of small size
@ -262,21 +262,21 @@ void TopLevel::paintEvent(QPaintEvent *)
base.setMask(mask); base.setMask(mask);
// draw pie chart // draw pie chart
QPainter px(&base); TQPainter px(&base);
px.setPen(QPen(Qt::black, 0)); // black border px.setPen(TQPen(Qt::black, 0)); // black border
px.setBrush(QColor(192, 0, 0)); // red fill colour for small circle px.setBrush(TQColor(192, 0, 0)); // red fill colour for small circle
px.drawPie(0+1, ((float) width()/(float) 2.44444444444)+1, (width()/2), (width()/2), 90*16, -360*16); px.drawPie(0+1, ((float) width()/(float) 2.44444444444)+1, (width()/2), (width()/2), 90*16, -360*16);
px.setBrush(QColor(0, 192, 0)); // green fill colour for pie part px.setBrush(TQColor(0, 192, 0)); // green fill colour for pie part
px.drawPie(0, ((float) width()/(float) 2.44444444444), ((float) width()/(float) 1.69230769231), ((float) width()/(float) 1.69230769231), 90*16, percentDone*16); px.drawPie(0, ((float) width()/(float) 2.44444444444), ((float) width()/(float) 1.69230769231), ((float) width()/(float) 1.69230769231), 90*16, percentDone*16);
px.end(); px.end();
} }
// FIXME: over-emphasize first and last few percent? (for better visibility) // FIXME: over-emphasize first and last few percent? (for better visibility)
// FIXME: some optimizations (eg. store pre-drawn QPixmap with small circle) // FIXME: some optimizations (eg. store pre-drawn TQPixmap with small circle)
// (and use drawEllipse() instead of drawPie() for small circle!) // (and use drawEllipse() instead of drawPie() for small circle!)
// set new tray icon // set new tray icon
QPainter p(this); TQPainter p(this);
int x = 1 + (((float) width()/(float) 1.83333333333) - pm->width()/2); int x = 1 + (((float) width()/(float) 1.83333333333) - pm->width()/2);
int y = 1 + (((float) width()/(float) 1.83333333333) - pm->height()/2); int y = 1 + (((float) width()/(float) 1.83333333333) - pm->height()/2);
p.drawPixmap(x, y, base); p.drawPixmap(x, y, base);
@ -284,7 +284,7 @@ void TopLevel::paintEvent(QPaintEvent *)
} }
/** Check timer and initiate appropriate action if finished */ /** Check timer and initiate appropriate action if finished */
void TopLevel::timerEvent(QTimerEvent *) void TopLevel::timerEvent(TQTimerEvent *)
{ {
if (running) { if (running) {
// a tea is steeping; must count down // a tea is steeping; must count down
@ -302,15 +302,15 @@ void TopLevel::timerEvent(QTimerEvent *)
menu->setItemChecked(current_selected, true); menu->setItemChecked(current_selected, true);
} }
QString teaMessage = i18n("The %1 is now ready!").arg(current_name); TQString teaMessage = i18n("The %1 is now ready!").arg(current_name);
// invoke action // invoke action
if (useNotify) { if (useNotify) {
KNotifyClient::event(winId(), "tea", teaMessage); KNotifyClient::event(winId(), "tea", teaMessage);
} }
if (useAction && (!action.isEmpty())) { if (useAction && (!action.isEmpty())) {
QString cmd = action; TQString cmd = action;
cmd.replace("%t", current_name); cmd.replace("%t", current_name);
system(QFile::encodeName(cmd)); system(TQFile::encodeName(cmd));
} }
if (usePopup) if (usePopup)
KPassivePopup::message(i18n("The Tea Cooker"), KPassivePopup::message(i18n("The Tea Cooker"),
@ -329,7 +329,7 @@ void TopLevel::timerEvent(QTimerEvent *)
} }
} }
// ...and Tooltip // ...and Tooltip
QString min = int2time(seconds); TQString min = int2time(seconds);
setToolTip(i18n("%1 left for %2").arg(min).arg(current_name)); setToolTip(i18n("%1 left for %2").arg(min).arg(current_name));
} }
} else { } else {
@ -342,7 +342,7 @@ void TopLevel::timerEvent(QTimerEvent *)
} }
/** update ToolTip */ /** update ToolTip */
void TopLevel::setToolTip(const QString &text, bool force) void TopLevel::setToolTip(const TQString &text, bool force)
{ {
// don't update if text hasn't changed // don't update if text hasn't changed
if (lastTip == text) if (lastTip == text)
@ -352,8 +352,8 @@ void TopLevel::setToolTip(const QString &text, bool force)
// FIXME: this isn't too nice: currently mouse must stay outside for >1s for update to occur // FIXME: this isn't too nice: currently mouse must stay outside for >1s for update to occur
if (force || !this->hasMouse() || (lastTip == i18n("The Tea Cooker"))) { if (force || !this->hasMouse() || (lastTip == i18n("The Tea Cooker"))) {
lastTip = text; lastTip = text;
QToolTip::remove(this); TQToolTip::remove(this);
QToolTip::add(this, text); TQToolTip::add(this, text);
} }
} }
@ -369,9 +369,9 @@ void TopLevel::rebuildTeaMenus() {
// now add new tea-entries to top of menus // now add new tea-entries to top of menus
int id = 0; int id = 0;
int index = 0; int index = 0;
for (QValueVector<tea_struct>::ConstIterator it=teas.begin(); it != teas.end(); ++it) { for (TQValueVector<tea_struct>::ConstIterator it=teas.begin(); it != teas.end(); ++it) {
// construct string with name and steeping time // construct string with name and steeping time
QString str = it->name; TQString str = it->name;
str.append(" ("); str.append(" (");
str.append(int2time(it->time)); str.append(int2time(it->time));
str.append(")"); str.append(")");
@ -478,18 +478,18 @@ void TopLevel::anonymous()
anondlg = new KDialogBase(KDialogBase::Plain, i18n("Anonymous Tea"), anondlg = new KDialogBase(KDialogBase::Plain, i18n("Anonymous Tea"),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Ok, this, "anonymous", true); KDialogBase::Ok, this, "anonymous", true);
QWidget *page = anondlg->plainPage(); TQWidget *page = anondlg->plainPage();
QBoxLayout *top_box = new QVBoxLayout(page); TQBoxLayout *top_box = new TQVBoxLayout(page);
QBoxLayout *prop_box = new QHBoxLayout(top_box); TQBoxLayout *prop_box = new TQHBoxLayout(top_box);
QVBox *propleft = new QVBox(page); TQVBox *propleft = new TQVBox(page);
prop_box->addWidget(propleft); prop_box->addWidget(propleft);
QVBox *propright = new QVBox(page); TQVBox *propright = new TQVBox(page);
prop_box->addWidget(propright); prop_box->addWidget(propright);
anon_time = new TimeEdit(propright); anon_time = new TimeEdit(propright);
anon_time->setFixedHeight(anon_time->sizeHint().height()); anon_time->setFixedHeight(anon_time->sizeHint().height());
anon_time->setValue(DEFAULT_TEA_TIME); anon_time->setValue(DEFAULT_TEA_TIME);
QLabel *l = new QLabel(anon_time, i18n("Tea time:"), propleft); TQLabel *l = new TQLabel(anon_time, i18n("Tea time:"), propleft);
l->setFixedSize(l->sizeHint()); l->setFixedSize(l->sizeHint());
top_box->addStretch(); top_box->addStretch();
@ -501,7 +501,7 @@ void TopLevel::anonymous()
// (why? - better use LRU, and save that to config) // (why? - better use LRU, and save that to config)
} }
if (anondlg->exec() == QDialog::Accepted) { if (anondlg->exec() == TQDialog::Accepted) {
shooting = true; shooting = true;
if (!listempty) if (!listempty)
menu->setItemChecked(current_selected, false); // no item is to be checked menu->setItemChecked(current_selected, false); // no item is to be checked
@ -557,7 +557,7 @@ void TopLevel::listBoxItemSelected() {
} }
/* config-slot: name of a tea edited */ /* config-slot: name of a tea edited */
void TopLevel::nameEditTextChanged(const QString& newText) { void TopLevel::nameEditTextChanged(const TQString& newText) {
/* this method also gets called when the last TeaListItem has been deleted /* this method also gets called when the last TeaListItem has been deleted
* (to clear the name edit widget), so check for empty listbox */ * (to clear the name edit widget), so check for empty listbox */
if (listbox->currentItem() != NULL) { if (listbox->currentItem() != NULL) {
@ -618,7 +618,7 @@ void TopLevel::delButtonClicked() {
/* config-slot: "up" button clicked */ /* config-slot: "up" button clicked */
void TopLevel::upButtonClicked() { void TopLevel::upButtonClicked() {
QListViewItem* item = listbox->currentItem(); TQListViewItem* item = listbox->currentItem();
if (item && item->itemAbove()) if (item && item->itemAbove())
item->itemAbove()->moveItem(item); item->itemAbove()->moveItem(item);
@ -628,7 +628,7 @@ void TopLevel::upButtonClicked() {
/* config-slot: "down" button clicked */ /* config-slot: "down" button clicked */
void TopLevel::downButtonClicked() { void TopLevel::downButtonClicked() {
QListViewItem* item = listbox->currentItem(); TQListViewItem* item = listbox->currentItem();
if (item && item->itemBelow()) if (item && item->itemBelow())
item->moveItem(item->itemBelow()); item->moveItem(item->itemBelow());
@ -661,118 +661,118 @@ void TopLevel::config()
confdlg = new KDialogBase(KDialogBase::Plain, i18n("Configure Tea Cooker"), confdlg = new KDialogBase(KDialogBase::Plain, i18n("Configure Tea Cooker"),
KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Help, KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Help,
KDialogBase::Ok, this, "config", true); KDialogBase::Ok, this, "config", true);
QWidget *page = confdlg->plainPage(); TQWidget *page = confdlg->plainPage();
// FIXME: enforce sensible initial/default size of dialog // FIXME: enforce sensible initial/default size of dialog
// FIXME: modal is ok, but can avoid always-on-top? // FIXME: modal is ok, but can avoid always-on-top?
QBoxLayout *top_box = new QVBoxLayout(page, 0, 8); // whole config-stuff TQBoxLayout *top_box = new TQVBoxLayout(page, 0, 8); // whole config-stuff
QBoxLayout *box = new QHBoxLayout(top_box); // list + properties TQBoxLayout *box = new TQHBoxLayout(top_box); // list + properties
/* left side - tea list and list-modifying buttons */ /* left side - tea list and list-modifying buttons */
QBoxLayout *leftside = new QVBoxLayout(box); TQBoxLayout *leftside = new TQVBoxLayout(box);
QGroupBox *listgroup = new QGroupBox(2, Vertical, i18n("Tea List"), page); TQGroupBox *listgroup = new TQGroupBox(2, Vertical, i18n("Tea List"), page);
leftside->addWidget(listgroup, 0, 0); leftside->addWidget(listgroup, 0, 0);
listbox = new QListView(listgroup, "listBox"); listbox = new TQListView(listgroup, "listBox");
listbox->addColumn(i18n("Name")); listbox->addColumn(i18n("Name"));
listbox->header()->setClickEnabled(false, listbox->header()->count()-1); listbox->header()->setClickEnabled(false, listbox->header()->count()-1);
listbox->addColumn(i18n("Time")); listbox->addColumn(i18n("Time"));
listbox->header()->setClickEnabled(false, listbox->header()->count()-1); listbox->header()->setClickEnabled(false, listbox->header()->count()-1);
listbox->setSorting(-1); listbox->setSorting(-1);
connect(listbox, SIGNAL(selectionChanged()), SLOT(listBoxItemSelected())); connect(listbox, TQT_SIGNAL(selectionChanged()), TQT_SLOT(listBoxItemSelected()));
// now buttons for editing the tea-list // now buttons for editing the tea-list
QWidget *listgroup_widget = new QWidget(listgroup); TQWidget *listgroup_widget = new TQWidget(listgroup);
QBoxLayout *hbox = new QHBoxLayout(listgroup_widget); TQBoxLayout *hbox = new TQHBoxLayout(listgroup_widget);
hbox->setSpacing(4); hbox->setSpacing(4);
btn_new = new QPushButton(QString::null, listgroup_widget); btn_new = new TQPushButton(TQString::null, listgroup_widget);
QToolTip::add(btn_new, i18n("New")); TQToolTip::add(btn_new, i18n("New"));
btn_new->setPixmap(SmallIcon("filenew")); btn_new->setPixmap(SmallIcon("filenew"));
btn_new->setMinimumSize(btn_new->sizeHint() * 1.2); btn_new->setMinimumSize(btn_new->sizeHint() * 1.2);
connect(btn_new, SIGNAL(clicked()), SLOT(newButtonClicked())); connect(btn_new, TQT_SIGNAL(clicked()), TQT_SLOT(newButtonClicked()));
hbox->addWidget(btn_new); hbox->addWidget(btn_new);
btn_del = new QPushButton(QString::null, listgroup_widget); btn_del = new TQPushButton(TQString::null, listgroup_widget);
QToolTip::add(btn_del, i18n("Delete")); TQToolTip::add(btn_del, i18n("Delete"));
btn_del->setIconSet(SmallIconSet("editdelete")); btn_del->setIconSet(SmallIconSet("editdelete"));
btn_del->setMinimumSize(btn_new->sizeHint() * 1.2); btn_del->setMinimumSize(btn_new->sizeHint() * 1.2);
connect(btn_del, SIGNAL(clicked()), SLOT(delButtonClicked())); connect(btn_del, TQT_SIGNAL(clicked()), TQT_SLOT(delButtonClicked()));
hbox->addWidget(btn_del); hbox->addWidget(btn_del);
btn_up = new QPushButton(QString::null, listgroup_widget); btn_up = new TQPushButton(TQString::null, listgroup_widget);
QToolTip::add(btn_up, i18n("Up")); TQToolTip::add(btn_up, i18n("Up"));
btn_up->setIconSet(SmallIconSet("up")); btn_up->setIconSet(SmallIconSet("up"));
btn_up->setMinimumSize(btn_up->sizeHint() * 1.2); btn_up->setMinimumSize(btn_up->sizeHint() * 1.2);
connect(btn_up, SIGNAL(clicked()), SLOT(upButtonClicked())); connect(btn_up, TQT_SIGNAL(clicked()), TQT_SLOT(upButtonClicked()));
hbox->addWidget(btn_up); hbox->addWidget(btn_up);
btn_down = new QPushButton(QString::null, listgroup_widget); btn_down = new TQPushButton(TQString::null, listgroup_widget);
QToolTip::add(btn_down, i18n("Down")); TQToolTip::add(btn_down, i18n("Down"));
btn_down->setIconSet(SmallIconSet("down")); btn_down->setIconSet(SmallIconSet("down"));
btn_down->setMinimumSize(btn_down->sizeHint() * 1.2); btn_down->setMinimumSize(btn_down->sizeHint() * 1.2);
connect(btn_down, SIGNAL(clicked()), SLOT(downButtonClicked())); connect(btn_down, TQT_SIGNAL(clicked()), TQT_SLOT(downButtonClicked()));
hbox->addWidget(btn_down); hbox->addWidget(btn_down);
hbox->addStretch(10); hbox->addStretch(10);
/* right side - tea properties */ /* right side - tea properties */
QBoxLayout *rightside = new QVBoxLayout(box); TQBoxLayout *rightside = new TQVBoxLayout(box);
editgroup = new QGroupBox(2, Vertical, i18n("Tea Properties"), page); editgroup = new TQGroupBox(2, Vertical, i18n("Tea Properties"), page);
rightside->addWidget(editgroup, 0, 0); rightside->addWidget(editgroup, 0, 0);
QHBox *propbox = new QHBox(editgroup); TQHBox *propbox = new TQHBox(editgroup);
// FIXME: - must enforce correct vertical alignment of each label-editor pair // FIXME: - must enforce correct vertical alignment of each label-editor pair
// (better use one HBox for each label-editor pair?) // (better use one HBox for each label-editor pair?)
QVBox *propleft = new QVBox(propbox); TQVBox *propleft = new TQVBox(propbox);
QVBox *propright = new QVBox(propbox); TQVBox *propright = new TQVBox(propbox);
nameEdit = new QLineEdit(propright); nameEdit = new TQLineEdit(propright);
nameEdit->setFixedHeight(nameEdit->sizeHint().height()); nameEdit->setFixedHeight(nameEdit->sizeHint().height());
nameEdit->setAlignment(QLineEdit::AlignLeft); nameEdit->setAlignment(TQLineEdit::AlignLeft);
QLabel *l = new QLabel(nameEdit, i18n("Name:"), propleft); TQLabel *l = new TQLabel(nameEdit, i18n("Name:"), propleft);
l->setFixedSize(l->sizeHint()); l->setFixedSize(l->sizeHint());
connect(nameEdit, SIGNAL(textChanged(const QString&)), SLOT(nameEditTextChanged(const QString&)) ); connect(nameEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(nameEditTextChanged(const TQString&)) );
timeEdit = new TimeEdit(propright); timeEdit = new TimeEdit(propright);
timeEdit->setFixedHeight(timeEdit->sizeHint().height()); timeEdit->setFixedHeight(timeEdit->sizeHint().height());
l = new QLabel(timeEdit, i18n("Tea time:"), propleft); l = new TQLabel(timeEdit, i18n("Tea time:"), propleft);
l->setFixedSize(l->sizeHint()); l->setFixedSize(l->sizeHint());
connect(timeEdit, SIGNAL(valueChanged(int)), SLOT(spinBoxValueChanged(int))); connect(timeEdit, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(spinBoxValueChanged(int)));
/* bottom - timeout actions */ /* bottom - timeout actions */
QGroupBox *actiongroup = new QGroupBox(4, Vertical, i18n("Action"), page); TQGroupBox *actiongroup = new TQGroupBox(4, Vertical, i18n("Action"), page);
top_box->addWidget(actiongroup, 0, 0); top_box->addWidget(actiongroup, 0, 0);
QWidget *actionconf_widget = new QWidget(actiongroup); TQWidget *actionconf_widget = new TQWidget(actiongroup);
QBoxLayout *actionconf_hbox = new QHBoxLayout(actionconf_widget); TQBoxLayout *actionconf_hbox = new TQHBoxLayout(actionconf_widget);
btn_conf = new QPushButton(i18n("Configure Events..."), actionconf_widget); btn_conf = new TQPushButton(i18n("Configure Events..."), actionconf_widget);
actionconf_hbox->addWidget(btn_conf); actionconf_hbox->addWidget(btn_conf);
connect(btn_conf, SIGNAL(clicked()), SLOT(confButtonClicked())); connect(btn_conf, TQT_SIGNAL(clicked()), TQT_SLOT(confButtonClicked()));
actionconf_hbox->addStretch(10); actionconf_hbox->addStretch(10);
eventEnable = new QCheckBox(i18n("Event"), actiongroup); eventEnable = new TQCheckBox(i18n("Event"), actiongroup);
popupEnable = new QCheckBox(i18n("Popup"), actiongroup); popupEnable = new TQCheckBox(i18n("Popup"), actiongroup);
eventEnable->setFixedHeight(eventEnable->sizeHint().height()); eventEnable->setFixedHeight(eventEnable->sizeHint().height());
popupEnable->setFixedHeight(popupEnable->sizeHint().height()); popupEnable->setFixedHeight(popupEnable->sizeHint().height());
QHBox *actionbox = new QHBox(actiongroup); TQHBox *actionbox = new TQHBox(actiongroup);
actionEnable = new QCheckBox(actionbox); actionEnable = new TQCheckBox(actionbox);
// FIXME: add text to this line: // FIXME: add text to this line:
// QLabel *actionLabel = new QLabel(i18n("Execute: "), actiongroup); // TQLabel *actionLabel = new TQLabel(i18n("Execute: "), actiongroup);
actionEdit = new QLineEdit(actionbox); actionEdit = new TQLineEdit(actionbox);
actionEdit->setFixedHeight(actionEdit->sizeHint().height()); actionEdit->setFixedHeight(actionEdit->sizeHint().height());
QToolTip::add(actionEdit, i18n("Enter command here; '%t' will be replaced with name of steeping tea")); TQToolTip::add(actionEdit, i18n("Enter command here; '%t' will be replaced with name of steeping tea"));
connect(actionEnable, SIGNAL(toggled(bool)), SLOT(actionEnableToggled(bool))); connect(actionEnable, TQT_SIGNAL(toggled(bool)), TQT_SLOT(actionEnableToggled(bool)));
rightside->addStretch(); rightside->addStretch();
// single checkbox // single checkbox
visEnable = new QCheckBox(i18n("Visualize progress in icon tray"), page); visEnable = new TQCheckBox(i18n("Visualize progress in icon tray"), page);
top_box->addWidget(visEnable, 0, 0); top_box->addWidget(visEnable, 0, 0);
// let listbox claim all remaining vertical space // let listbox claim all remaining vertical space
top_box->setStretchFactor(box, 10); top_box->setStretchFactor(box, 10);
connect(confdlg, SIGNAL(helpClicked()), SLOT(help())); connect(confdlg, TQT_SIGNAL(helpClicked()), TQT_SLOT(help()));
} }
// now add all defined teas (and their times) to the listview // now add all defined teas (and their times) to the listview
@ -805,7 +805,7 @@ void TopLevel::config()
actionEdit->setEnabled(useAction); actionEdit->setEnabled(useAction);
visEnable->setChecked(useTrayVis); visEnable->setChecked(useTrayVis);
if (confdlg->exec() == QDialog::Accepted) if (confdlg->exec() == TQDialog::Accepted)
{ {
// activate new settings // activate new settings
useNotify = eventEnable->isChecked(); useNotify = eventEnable->isChecked();
@ -820,7 +820,7 @@ void TopLevel::config()
int i = 0; int i = 0;
teas.clear(); teas.clear();
teas.resize(listbox->childCount()); teas.resize(listbox->childCount());
for (QListViewItemIterator it(listbox); it.current() != 0; ++it) { for (TQListViewItemIterator it(listbox); it.current() != 0; ++it) {
teas[i].name = static_cast<TeaListItem *>(it.current())->name(); teas[i].name = static_cast<TeaListItem *>(it.current())->name();
teas[i].time = static_cast<TeaListItem *>(it.current())->time(); teas[i].time = static_cast<TeaListItem *>(it.current())->time();
if (it.current() == current_item) if (it.current() == current_item)
@ -849,9 +849,9 @@ void TopLevel::config()
config->deleteGroup("Teas", true); // deep remove of whole group config->deleteGroup("Teas", true); // deep remove of whole group
config->setGroup("Teas"); config->setGroup("Teas");
config->writeEntry("Number", teas.count()); config->writeEntry("Number", teas.count());
QString key; TQString key;
int index = 1; int index = 1;
for (QValueVector<tea_struct>::ConstIterator it = teas.begin(); it != teas.end(); ++it) { for (TQValueVector<tea_struct>::ConstIterator it = teas.begin(); it != teas.end(); ++it) {
key.sprintf("Tea%d Name", index); key.sprintf("Tea%d Name", index);
config->writeEntry(key, it->name); config->writeEntry(key, it->name);
key.sprintf("Tea%d Time", index); key.sprintf("Tea%d Time", index);

@ -24,16 +24,16 @@
#define TOPLEVEL_H #define TOPLEVEL_H
#include <kapplication.h> #include <kapplication.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qlineedit.h> #include <tqlineedit.h>
#include <qvaluevector.h> #include <tqvaluevector.h>
#include <qlistview.h> #include <tqlistview.h>
#include <qpushbutton.h> #include <tqpushbutton.h>
#include <qgroupbox.h> #include <tqgroupbox.h>
#include <knuminput.h> #include <knuminput.h>
#include <ksystemtray.h> #include <ksystemtray.h>
#include <qpixmap.h> #include <tqpixmap.h>
class KAction; class KAction;
class KDialogBase; class KDialogBase;
@ -51,10 +51,10 @@ public:
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(TQPaintEvent *);
void mousePressEvent(QMouseEvent *); void mousePressEvent(TQMouseEvent *);
void timerEvent(QTimerEvent *); void timerEvent(TQTimerEvent *);
void resizeEvent(QResizeEvent *); void resizeEvent(TQResizeEvent *);
private slots: private slots:
@ -65,11 +65,11 @@ private slots:
void config(); void config();
void help(); void help();
void anonymous(); void anonymous();
void setToolTip(const QString &text, bool force=false); void setToolTip(const TQString &text, bool force=false);
void rebuildTeaMenus(); void rebuildTeaMenus();
void listBoxItemSelected(); void listBoxItemSelected();
void nameEditTextChanged(const QString& newText); void nameEditTextChanged(const TQString& newText);
void spinBoxValueChanged(int v); void spinBoxValueChanged(int v);
void newButtonClicked(); void newButtonClicked();
void delButtonClicked(); void delButtonClicked();
@ -87,10 +87,10 @@ private:
static const int DEFAULT_TEA_TIME; static const int DEFAULT_TEA_TIME;
struct tea_struct { struct tea_struct {
QString name; TQString name;
int time; int time;
}; };
QValueVector<tea_struct> teas; // list of tea-names and times TQValueVector<tea_struct> teas; // list of tea-names and times
bool running, ready, firstFrame, listempty; bool running, ready, firstFrame, listempty;
int seconds; // variable for counting down seconds int seconds; // variable for counting down seconds
@ -98,28 +98,28 @@ private:
int percentDone; // ok, this isn't really "per 100", but "per 360" int percentDone; // ok, this isn't really "per 100", but "per 360"
unsigned current_selected; // index of currently +selected+ tea in menu unsigned current_selected; // index of currently +selected+ tea in menu
QListViewItem *current_item; // ptr to currently +selected+ tea in ListView TQListViewItem *current_item; // ptr to currently +selected+ tea in ListView
QString current_name; // name of currently +running+ tea (if any) TQString current_name; // name of currently +running+ tea (if any)
bool shooting; // anonymous tea currently steeping? bool shooting; // anonymous tea currently steeping?
bool useNotify, usePopup, useAction; bool useNotify, usePopup, useAction;
QString action; TQString action;
bool useTrayVis; // visualize progress in tray icon bool useTrayVis; // visualize progress in tray icon
QPixmap mugPixmap, teaNotReadyPixmap, teaAnim1Pixmap, teaAnim2Pixmap; TQPixmap mugPixmap, teaNotReadyPixmap, teaAnim1Pixmap, teaAnim2Pixmap;
KAction *startAct, *stopAct, *confAct, *anonAct; KAction *startAct, *stopAct, *confAct, *anonAct;
QPopupMenu *menu, *steeping_menu, *start_menu; TQPopupMenu *menu, *steeping_menu, *start_menu;
QListView *listbox; TQListView *listbox;
QLineEdit *nameEdit, *actionEdit; TQLineEdit *nameEdit, *actionEdit;
TimeEdit *timeEdit; TimeEdit *timeEdit;
QGroupBox *editgroup; TQGroupBox *editgroup;
QPushButton *btn_new, *btn_del, *btn_up, *btn_down, *btn_conf; TQPushButton *btn_new, *btn_del, *btn_up, *btn_down, *btn_conf;
QString lastTip; TQString lastTip;
KDialogBase *anondlg, *confdlg; KDialogBase *anondlg, *confdlg;
TimeEdit *anon_time; TimeEdit *anon_time;
QCheckBox *eventEnable, *popupEnable, *actionEnable, *visEnable; TQCheckBox *eventEnable, *popupEnable, *actionEnable, *visEnable;
}; };
#endif #endif

@ -1,16 +1,16 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// KTux - QCanvas based screensaver // KTux - TQCanvas based screensaver
// //
// Copyright (c) Martin R. Jones 1999 // Copyright (c) Martin R. Jones 1999
// //
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qmessagebox.h> #include <tqmessagebox.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qslider.h> #include <tqslider.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <klocale.h> #include <klocale.h>
#include <kdebug.h> #include <kdebug.h>
@ -35,7 +35,7 @@ extern "C"
return new KSpriteSaver( id ); return new KSpriteSaver( id );
} }
KDE_EXPORT QDialog *kss_setup() KDE_EXPORT TQDialog *kss_setup()
{ {
return new KSpriteSetup(); return new KSpriteSetup();
} }
@ -43,8 +43,8 @@ extern "C"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
KSpriteSetup::KSpriteSetup( QWidget *parent, const char *name ) KSpriteSetup::KSpriteSetup( TQWidget *parent, const char *name )
: QDialog( parent, name, TRUE ) : TQDialog( parent, name, TRUE )
{ {
KGlobal::locale()->insertCatalogue("ktux"); KGlobal::locale()->insertCatalogue("ktux");
saver = 0; saver = 0;
@ -53,22 +53,22 @@ KSpriteSetup::KSpriteSetup( QWidget *parent, const char *name )
setCaption(i18n("Setup KTux") ); setCaption(i18n("Setup KTux") );
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); TQVBoxLayout *tl = new TQVBoxLayout(this, 10, 10);
QHBoxLayout *tl1 = new QHBoxLayout; TQHBoxLayout *tl1 = new QHBoxLayout;
tl->addLayout(tl1); tl->addLayout(tl1);
QVBoxLayout *tl11 = new QVBoxLayout(5); TQVBoxLayout *tl11 = new TQVBoxLayout(5);
tl1->addLayout(tl11); tl1->addLayout(tl11);
QLabel *label = new QLabel( i18n("Speed:"), this ); TQLabel *label = new TQLabel( i18n("Speed:"), this );
label->setMinimumSize(label->sizeHint()); label->setMinimumSize(label->sizeHint());
tl11->addStretch(1); tl11->addStretch(1);
tl11->addWidget(label); tl11->addWidget(label);
QSlider *sb = new QSlider(0, 100, 10, speed, QSlider::Horizontal, this ); TQSlider *sb = new TQSlider(0, 100, 10, speed, TQSlider::Horizontal, this );
tl11->addWidget(sb); tl11->addWidget(sb);
connect( sb, SIGNAL( valueChanged( int ) ), SLOT( slotSpeed( int ) ) ); connect( sb, TQT_SIGNAL( valueChanged( int ) ), TQT_SLOT( slotSpeed( int ) ) );
preview = new QWidget( this ); preview = new TQWidget( this );
preview->setFixedSize( 220, 170 ); preview->setFixedSize( 220, 170 );
preview->setBackgroundColor( black ); preview->setBackgroundColor( black );
preview->show(); // otherwise saver does not get correct size preview->show(); // otherwise saver does not get correct size
@ -76,15 +76,15 @@ KSpriteSetup::KSpriteSetup( QWidget *parent, const char *name )
tl1->addWidget(preview); tl1->addWidget(preview);
KButtonBox *bbox = new KButtonBox(this); KButtonBox *bbox = new KButtonBox(this);
QButton *button = bbox->addButton( i18n("About")); TQButton *button = bbox->addButton( i18n("About"));
connect( button, SIGNAL( clicked() ), SLOT(slotAbout() ) ); connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT(slotAbout() ) );
bbox->addStretch(1); bbox->addStretch(1);
button = bbox->addButton( KStdGuiItem::ok()); button = bbox->addButton( KStdGuiItem::ok());
connect( button, SIGNAL( clicked() ), SLOT( slotOkPressed() ) ); connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( slotOkPressed() ) );
button = bbox->addButton(KStdGuiItem::cancel()); button = bbox->addButton(KStdGuiItem::cancel());
connect( button, SIGNAL( clicked() ), SLOT( reject() ) ); connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( reject() ) );
bbox->layout(); bbox->layout();
tl->addWidget(bbox); tl->addWidget(bbox);
@ -128,7 +128,7 @@ void KSpriteSetup::slotOkPressed()
void KSpriteSetup::slotAbout() void KSpriteSetup::slotAbout()
{ {
QMessageBox::message(i18n("About KTux"), TQMessageBox::message(i18n("About KTux"),
i18n("KTux Version 1.0\n\nWritten by Martin R. Jones 1999\nmjones@kde.org"), i18n("KTux Version 1.0\n\nWritten by Martin R. Jones 1999\nmjones@kde.org"),
i18n("OK")); i18n("OK"));
} }
@ -144,7 +144,7 @@ KSpriteSaver::KSpriteSaver( WId id ) : KScreenSaver( id )
readSettings(); readSettings();
blank(); blank();
connect(&mTimer, SIGNAL(timeout()), SLOT(slotTimeout())); connect(&mTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()));
mTimer.start(120-mSpeed, true); mTimer.start(120-mSpeed, true);
} }
@ -169,14 +169,14 @@ void KSpriteSaver::setSpeed(int speed)
// //
void KSpriteSaver::readSettings() void KSpriteSaver::readSettings()
{ {
QString str; TQString str;
KConfig *config = KGlobal::config(); KConfig *config = KGlobal::config();
config->setGroup("Settings"); config->setGroup("Settings");
mSpeed = config->readNumEntry("Speed", 50); mSpeed = config->readNumEntry("Speed", 50);
QString path = KGlobal::dirs()->findResourceDir( "sprite", "bg.png" ); TQString path = KGlobal::dirs()->findResourceDir( "sprite", "bg.png" );
SpritePixmapManager::manager()->setPixmapDir(path); SpritePixmapManager::manager()->setPixmapDir(path);
@ -184,7 +184,7 @@ void KSpriteSaver::readSettings()
KSimpleConfig *mConfig = new KSimpleConfig(path, true); KSimpleConfig *mConfig = new KSimpleConfig(path, true);
mConfig->setGroup("Config"); mConfig->setGroup("Config");
QStrList list; TQStrList list;
int groups = mConfig->readListEntry("Groups", list); int groups = mConfig->readListEntry("Groups", list);
mTimerIds.resize(groups); mTimerIds.resize(groups);
for (int i = 0; i < groups; i++) for (int i = 0; i < groups; i++)
@ -201,16 +201,16 @@ void KSpriteSaver::readSettings()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void KSpriteSaver::initialise() void KSpriteSaver::initialise()
{ {
mCanvas = new QCanvas(); mCanvas = new TQCanvas();
QPixmap pm( locate("sprite", "bg.png") ); TQPixmap pm( locate("sprite", "bg.png") );
mCanvas->setBackgroundPixmap( pm ); mCanvas->setBackgroundPixmap( pm );
mCanvas->resize( width(), height() ); mCanvas->resize( width(), height() );
mView = new QCanvasView(mCanvas); mView = new TQCanvasView(mCanvas);
mView->viewport()->setBackgroundColor( black ); mView->viewport()->setBackgroundColor( black );
mView->resize( size()); mView->resize( size());
mView->setFrameStyle( QFrame::NoFrame ); mView->setFrameStyle( TQFrame::NoFrame );
mView->setVScrollBarMode( QScrollView::AlwaysOff ); mView->setVScrollBarMode( TQScrollView::AlwaysOff );
mView->setHScrollBarMode( QScrollView::AlwaysOff ); mView->setHScrollBarMode( TQScrollView::AlwaysOff );
embed( mView ); embed( mView );
mView->show(); mView->show();
SpriteRange::setFieldSize(mView->size()); SpriteRange::setFieldSize(mView->size());
@ -231,7 +231,7 @@ void KSpriteSaver::slotTimeout()
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void KSpriteSaver::timerEvent(QTimerEvent *ev) void KSpriteSaver::timerEvent(TQTimerEvent *ev)
{ {
for (unsigned i = 0; i < mTimerIds.size(); i++) for (unsigned i = 0; i < mTimerIds.size(); i++)
{ {

@ -1,6 +1,6 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// ksprite - QCanvas based screensaver // ksprite - TQCanvas based screensaver
// //
// Copyright (c) Martin R. Jones 1996 // Copyright (c) Martin R. Jones 1996
// //
@ -8,11 +8,11 @@
#ifndef __SPRITE_H__ #ifndef __SPRITE_H__
#define __SPRITE_H__ #define __SPRITE_H__
#include <qtimer.h> #include <tqtimer.h>
#include <qpushbutton.h> #include <tqpushbutton.h>
#include <qptrlist.h> #include <tqptrlist.h>
#include <qstrlist.h> #include <tqstrlist.h>
#include <qcanvas.h> #include <tqcanvas.h>
#include <kscreensaver.h> #include <kscreensaver.h>
#include "spriteanim.h" #include "spriteanim.h"
@ -35,22 +35,22 @@ protected slots:
void slotTimeout(); void slotTimeout();
protected: protected:
virtual void timerEvent(QTimerEvent *); virtual void timerEvent(TQTimerEvent *);
protected: protected:
QCanvas *mCanvas; QCanvas *mCanvas;
QCanvasView *mView; QCanvasView *mView;
QTimer mTimer; QTimer mTimer;
int mSpeed; int mSpeed;
QPtrList<SpriteGroup> mGroups; TQPtrList<SpriteGroup> mGroups;
QMemArray<int> mTimerIds; TQMemArray<int> mTimerIds;
}; };
class KSpriteSetup : public QDialog class KSpriteSetup : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
KSpriteSetup( QWidget *parent = NULL, const char *name = NULL ); KSpriteSetup( TQWidget *parent = NULL, const char *name = NULL );
~KSpriteSetup(); ~KSpriteSetup();
protected: protected:
@ -63,7 +63,7 @@ private slots:
private: private:
int speed; int speed;
QWidget *preview; TQWidget *preview;
KSpriteSaver *saver; KSpriteSaver *saver;
}; };

@ -14,8 +14,8 @@
// //
// SpriteObject stores the animations that create an object // SpriteObject stores the animations that create an object
// //
SpriteObject::SpriteObject(SpritePixmapSequence *seq, QCanvas *c ) SpriteObject::SpriteObject(SpritePixmapSequence *seq, TQCanvas *c )
: QCanvasSprite(seq, c), : TQCanvasSprite(seq, c),
mCycle(0), mCycle(0),
mLifeSpan(-1), mLifeSpan(-1),
mSeq(seq) mSeq(seq)
@ -39,7 +39,7 @@ void SpriteObject::age()
void SpriteObject::setBounds( int x1, int y1, int x2, int y2 ) void SpriteObject::setBounds( int x1, int y1, int x2, int y2 )
{ {
mBound = QRect( x1, y1, x2-x1, y2-y1 ); mBound = TQRect( x1, y1, x2-x1, y2-y1 );
} }
bool SpriteObject::outOfBounds() const bool SpriteObject::outOfBounds() const
@ -58,7 +58,7 @@ SpriteDef::SpriteDef(KConfigBase &config)
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
SpriteObject *SpriteDef::create( QCanvas *c ) SpriteObject *SpriteDef::create( TQCanvas *c )
{ {
SpriteObject *sprite = 0; SpriteObject *sprite = 0;
if (mSeq) if (mSeq)
@ -92,7 +92,7 @@ void SpriteDef::read(KConfigBase &config)
mEndY.set(config.readEntry("EndY", "10000")); mEndY.set(config.readEntry("EndY", "10000"));
mLifeSpan = config.readNumEntry("LifeSpan", -1); mLifeSpan = config.readNumEntry("LifeSpan", -1);
mZ = config.readNumEntry("Z", 1); mZ = config.readNumEntry("Z", 1);
QString animation = config.readEntry("Animation", ""); TQString animation = config.readEntry("Animation", "");
mSeq = SpriteSequenceManager::manager()->load(config, animation); mSeq = SpriteSequenceManager::manager()->load(config, animation);
kdDebug() << "Set Z = " << mZ << endl; kdDebug() << "Set Z = " << mZ << endl;
} }
@ -101,7 +101,7 @@ void SpriteDef::read(KConfigBase &config)
// //
// SpriteGroup // SpriteGroup
// //
SpriteGroup::SpriteGroup(QCanvas *c, KConfigBase &config) SpriteGroup::SpriteGroup(TQCanvas *c, KConfigBase &config)
: mCanvas(c) : mCanvas(c)
{ {
mAvailable.setAutoDelete(true); mAvailable.setAutoDelete(true);
@ -112,7 +112,7 @@ SpriteGroup::SpriteGroup(QCanvas *c, KConfigBase &config)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void SpriteGroup::next() void SpriteGroup::next()
{ {
QPtrListIterator<SpriteObject> it(mActive); TQPtrListIterator<SpriteObject> it(mActive);
for (; it.current(); ++it) for (; it.current(); ++it)
{ {
@ -148,7 +148,7 @@ void SpriteGroup::read(KConfigBase &config)
mRefresh.set(config.readEntry("Refresh", "1000")); mRefresh.set(config.readEntry("Refresh", "1000"));
QStrList anims; TQStrList anims;
config.readListEntry("Animations", anims); config.readListEntry("Animations", anims);
for (anims.first(); anims.current(); anims.next()) for (anims.first(); anims.current(); anims.next())

@ -12,11 +12,11 @@
#include <config.h> #include <config.h>
#endif #endif
#include <qpixmap.h> #include <tqpixmap.h>
#include <qdict.h> #include <tqdict.h>
#include <qptrlist.h> #include <tqptrlist.h>
#include <qstrlist.h> #include <tqstrlist.h>
#include <qcanvas.h> #include <tqcanvas.h>
#include <kconfigbase.h> #include <kconfigbase.h>
#include <ksimpleconfig.h> #include <ksimpleconfig.h>
@ -27,7 +27,7 @@
class SpriteObject : public QCanvasSprite class SpriteObject : public QCanvasSprite
{ {
public: public:
SpriteObject(SpritePixmapSequence *seq, QCanvas *c); SpriteObject(SpritePixmapSequence *seq, TQCanvas *c);
void setLifeSpan(int l) { mLifeSpan = l; } void setLifeSpan(int l) { mLifeSpan = l; }
void age(); void age();
@ -51,7 +51,7 @@ class SpriteDef
public: public:
SpriteDef(KConfigBase &config); SpriteDef(KConfigBase &config);
SpriteObject *create( QCanvas *c ); SpriteObject *create( TQCanvas *c );
protected: protected:
void read(KConfigBase &config); void read(KConfigBase &config);
@ -75,7 +75,7 @@ protected:
class SpriteGroup class SpriteGroup
{ {
public: public:
SpriteGroup(QCanvas *c, KConfigBase &config); SpriteGroup(TQCanvas *c, KConfigBase &config);
void next(); void next();
void refresh(); void refresh();
@ -85,8 +85,8 @@ protected:
void read(KConfigBase &config); void read(KConfigBase &config);
protected: protected:
QPtrList<SpriteDef> mAvailable; TQPtrList<SpriteDef> mAvailable;
QPtrList<SpriteObject> mActive; TQPtrList<SpriteObject> mActive;
int mCount; int mCount;
SpriteRange mRefresh; SpriteRange mRefresh;
QCanvas *mCanvas; QCanvas *mCanvas;

@ -8,9 +8,9 @@
#include <kapplication.h> #include <kapplication.h>
#include "spritemisc.h" #include "spritemisc.h"
QSize SpriteRange::mFieldSize; TQSize SpriteRange::mFieldSize;
SpriteRange::SpriteRange(const QString &str) SpriteRange::SpriteRange(const TQString &str)
{ {
set(str); set(str);
} }
@ -27,7 +27,7 @@ int SpriteRange::random() const
return val; return val;
} }
void SpriteRange::set(const QString &str) void SpriteRange::set(const TQString &str)
{ {
int r = str.find(".."); int r = str.find("..");
@ -42,12 +42,12 @@ void SpriteRange::set(const QString &str)
} }
} }
void SpriteRange::setFieldSize(const QSize &size) void SpriteRange::setFieldSize(const TQSize &size)
{ {
mFieldSize = size; mFieldSize = size;
} }
int SpriteRange::parse(const QString &str) int SpriteRange::parse(const TQString &str)
{ {
int val = 0; int val = 0;

@ -8,13 +8,13 @@
#ifndef __SPRITEMISC_H__ #ifndef __SPRITEMISC_H__
#define __SPRITEMISC_H__ #define __SPRITEMISC_H__
#include <qstring.h> #include <tqstring.h>
#include <qsize.h> #include <tqsize.h>
class SpriteRange class SpriteRange
{ {
public: public:
SpriteRange(const QString &str); SpriteRange(const TQString &str);
SpriteRange(int l=0, int h=0) : mMin(l), mMax(h) {} SpriteRange(int l=0, int h=0) : mMin(l), mMax(h) {}
int min() const { return mMin; } int min() const { return mMin; }
@ -23,18 +23,18 @@ public:
int random() const; int random() const;
void set(int l, int h) { mMin=l; mMax=h; } void set(int l, int h) { mMin=l; mMax=h; }
void set(const QString &str); void set(const TQString &str);
static void setFieldSize(const QSize &size); static void setFieldSize(const TQSize &size);
static QSize fieldSize() { return mFieldSize; } static TQSize fieldSize() { return mFieldSize; }
protected: protected:
int parse(const QString &str); int parse(const TQString &str);
protected: protected:
int mMin; int mMin;
int mMax; int mMax;
static QSize mFieldSize; static TQSize mFieldSize;
}; };
#endif #endif

@ -37,16 +37,16 @@ SpritePixmapManager::~SpritePixmapManager()
// Returns: // Returns:
// pointer to pixmap if loaded successfully, 0 otherwise. // pointer to pixmap if loaded successfully, 0 otherwise.
// //
const QPixmap *SpritePixmapManager::load(const QString & img) const TQPixmap *SpritePixmapManager::load(const TQString & img)
{ {
QPixmap *pixmap = mPixmaps.find(img); TQPixmap *pixmap = mPixmaps.find(img);
if (!pixmap) if (!pixmap)
{ {
// pixmap has not yet been loaded. // pixmap has not yet been loaded.
kdDebug() << "Reading pixmap: " << img << endl; kdDebug() << "Reading pixmap: " << img << endl;
QString path = mPixmapDir + QString("/") + img; TQString path = mPixmapDir + TQString("/") + img;
pixmap = new QPixmap(path); pixmap = new TQPixmap(path);
if (!pixmap->isNull()) if (!pixmap->isNull())
{ {
@ -79,9 +79,9 @@ SpritePixmapManager *SpritePixmapManager::manager()
//=========================================================================== //===========================================================================
// //
SpritePixmapSequence::SpritePixmapSequence(QPtrList<QPixmap> pm, QPtrList<QPoint> hs, SpritePixmapSequence::SpritePixmapSequence(TQPtrList<TQPixmap> pm, TQPtrList<TQPoint> hs,
QMemArray<int> d) TQMemArray<int> d)
: QCanvasPixmapArray(pm, hs), mDelays(d) : TQCanvasPixmapArray(pm, hs), mDelays(d)
{ {
} }
@ -113,7 +113,7 @@ SpriteSequenceManager::~SpriteSequenceManager()
// pointer to sprite if loaded successfully, 0 otherwise. // pointer to sprite if loaded successfully, 0 otherwise.
// //
SpritePixmapSequence *SpriteSequenceManager::load(KConfigBase &config, SpritePixmapSequence *SpriteSequenceManager::load(KConfigBase &config,
const QString & name) const TQString & name)
{ {
SpritePixmapSequence *sprite = mSprites.find(name); SpritePixmapSequence *sprite = mSprites.find(name);
@ -135,24 +135,24 @@ SpritePixmapSequence *SpriteSequenceManager::load(KConfigBase &config,
// //
SpritePixmapSequence *SpriteSequenceManager::read(KConfigBase &config) SpritePixmapSequence *SpriteSequenceManager::read(KConfigBase &config)
{ {
QStrList strImages; TQStrList strImages;
QStrList strDelays; TQStrList strDelays;
QPtrList<QPixmap> pixmaps; TQPtrList<TQPixmap> pixmaps;
QPtrList<QPoint> hotspots; TQPtrList<TQPoint> hotspots;
int frames = config.readListEntry("Images", strImages); int frames = config.readListEntry("Images", strImages);
config.readListEntry("Delays", strDelays); config.readListEntry("Delays", strDelays);
QMemArray<int> delays(frames); TQMemArray<int> delays(frames);
for (int i = 0; i < frames; i++) for (int i = 0; i < frames; i++)
{ {
const QPixmap *pixmap = const TQPixmap *pixmap =
SpritePixmapManager::manager()->load(strImages.at(i)); SpritePixmapManager::manager()->load(strImages.at(i));
if (pixmap) if (pixmap)
{ {
pixmaps.append(pixmap); pixmaps.append(pixmap);
hotspots.append(new QPoint(0,0)); hotspots.append(new TQPoint(0,0));
delays[i] = atoi(strDelays.at(i)); delays[i] = atoi(strDelays.at(i));
} }
} }

@ -12,9 +12,9 @@
#include <config.h> #include <config.h>
#endif #endif
#include <qdict.h> #include <tqdict.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qcanvas.h> #include <tqcanvas.h>
#include <kconfigbase.h> #include <kconfigbase.h>
#include <ksimpleconfig.h> #include <ksimpleconfig.h>
@ -28,19 +28,19 @@ public:
SpritePixmapManager(); SpritePixmapManager();
virtual ~SpritePixmapManager(); virtual ~SpritePixmapManager();
void setPixmapDir(const QString &dir) void setPixmapDir(const TQString &dir)
{ mPixmapDir = dir; } { mPixmapDir = dir; }
void reset() void reset()
{ mPixmapDir = "."; mPixmaps.clear(); } { mPixmapDir = "."; mPixmaps.clear(); }
const QPixmap *load(const QString & img); const TQPixmap *load(const TQString & img);
const QPixmap *pixmap(const char *img) const const TQPixmap *pixmap(const char *img) const
{ return mPixmaps.find(img); } { return mPixmaps.find(img); }
static SpritePixmapManager *manager(); static SpritePixmapManager *manager();
public: public:
QString mPixmapDir; // get pixmaps from here TQString mPixmapDir; // get pixmaps from here
QDict<QPixmap> mPixmaps; // list of pixmaps TQDict<TQPixmap> mPixmaps; // list of pixmaps
static SpritePixmapManager *mManager; // static pointer to instance static SpritePixmapManager *mManager; // static pointer to instance
}; };
@ -49,12 +49,12 @@ public:
class SpritePixmapSequence : public QCanvasPixmapArray class SpritePixmapSequence : public QCanvasPixmapArray
{ {
public: public:
SpritePixmapSequence(QPtrList<QPixmap> pm, QPtrList<QPoint> hs, QMemArray<int> d); SpritePixmapSequence(TQPtrList<TQPixmap> pm, TQPtrList<TQPoint> hs, TQMemArray<int> d);
int delay(int i) const { return mDelays[i]; } int delay(int i) const { return mDelays[i]; }
protected: protected:
QMemArray<int> mDelays; TQMemArray<int> mDelays;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -67,7 +67,7 @@ public:
SpriteSequenceManager(); SpriteSequenceManager();
~SpriteSequenceManager(); ~SpriteSequenceManager();
SpritePixmapSequence *load(KConfigBase &config, const QString & name); SpritePixmapSequence *load(KConfigBase &config, const TQString & name);
SpritePixmapSequence *sprite(const char *name) SpritePixmapSequence *sprite(const char *name)
{ return mSprites.find(name); } { return mSprites.find(name); }
@ -77,7 +77,7 @@ protected:
SpritePixmapSequence *read(KConfigBase &config); SpritePixmapSequence *read(KConfigBase &config);
protected: protected:
QDict<SpritePixmapSequence> mSprites; TQDict<SpritePixmapSequence> mSprites;
static SpriteSequenceManager *mManager; static SpriteSequenceManager *mManager;
}; };

@ -20,23 +20,23 @@
#include "weatherbutton.h" #include "weatherbutton.h"
#include "weatherservice_stub.h" #include "weatherservice_stub.h"
#include <qtooltip.h> #include <tqtooltip.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qobjectlist.h> #include <tqobjectlist.h>
#include <kdebug.h> #include <kdebug.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <klocale.h> #include <klocale.h>
dockwidget::dockwidget(const QString &location, QWidget *parent, dockwidget::dockwidget(const TQString &location, TQWidget *parent,
const char *name) : QWidget(parent,name), m_locationCode( location ), m_orientation( Horizontal ) const char *name) : TQWidget(parent,name), m_locationCode( location ), m_orientation( Horizontal )
{ {
m_font = KGlobalSettings::generalFont(); m_font = KGlobalSettings::generalFont();
setBackgroundOrigin( AncestorOrigin ); setBackgroundOrigin( AncestorOrigin );
initDock(); initDock();
connect(m_button, SIGNAL( clicked() ), SIGNAL( buttonClicked() )); connect(m_button, TQT_SIGNAL( clicked() ), TQT_SIGNAL( buttonClicked() ));
m_weatherService = new WeatherService_stub( "KWeatherService", "WeatherService" ); m_weatherService = new WeatherService_stub( "KWeatherService", "WeatherService" );
} }
@ -46,7 +46,7 @@ dockwidget::~dockwidget()
delete m_weatherService; delete m_weatherService;
} }
void dockwidget::setLocationCode(const QString &locationCode) void dockwidget::setLocationCode(const TQString &locationCode)
{ {
m_locationCode = locationCode; m_locationCode = locationCode;
showWeather(); showWeather();
@ -78,11 +78,11 @@ void dockwidget::setViewMode(int _mode)
void dockwidget::showWeather() void dockwidget::showWeather()
{ {
QString tip = "<qt>"; TQString tip = "<qt>";
QString temp = "?"; TQString temp = "?";
QString wind = "?"; TQString wind = "?";
QString pressure = "?"; TQString pressure = "?";
if ( !m_locationCode.isEmpty() ) if ( !m_locationCode.isEmpty() )
{ {
@ -90,12 +90,12 @@ void dockwidget::showWeather()
wind = m_weatherService->wind( m_locationCode ); wind = m_weatherService->wind( m_locationCode );
pressure = m_weatherService->pressure( m_locationCode ); pressure = m_weatherService->pressure( m_locationCode );
QString dewPoint = m_weatherService->dewPoint( m_locationCode); TQString dewPoint = m_weatherService->dewPoint( m_locationCode);
QString relHumidity = m_weatherService->relativeHumidity( m_locationCode ); TQString relHumidity = m_weatherService->relativeHumidity( m_locationCode );
QString heatIndex = m_weatherService->heatIndex( m_locationCode ); TQString heatIndex = m_weatherService->heatIndex( m_locationCode );
QString windChill = m_weatherService->windChill( m_locationCode ); TQString windChill = m_weatherService->windChill( m_locationCode );
QString sunRiseTime = m_weatherService->sunRiseTime( m_locationCode ); TQString sunRiseTime = m_weatherService->sunRiseTime( m_locationCode );
QString sunSetTime = m_weatherService->sunSetTime( m_locationCode ); TQString sunSetTime = m_weatherService->sunSetTime( m_locationCode );
tip += "<h3><center><nobr>" + tip += "<h3><center><nobr>" +
m_weatherService->stationName( m_locationCode ) + " (" + m_weatherService->stationName( m_locationCode ) + " (" +
@ -104,7 +104,7 @@ void dockwidget::showWeather()
if ( m_weatherService->currentIconString( m_locationCode ) == "dunno" ) // no data if ( m_weatherService->currentIconString( m_locationCode ) == "dunno" ) // no data
tip += "<center><nobr>" + i18n("The network is currently offline...") + "</nobr></center>"; tip += "<center><nobr>" + i18n("The network is currently offline...") + "</nobr></center>";
tip += QString("<br><table>" tip += TQString("<br><table>"
"<tr><th><nobr>" + i18n( "Temperature:" ) + "</nobr></th><td><nobr>%1</nobr></td>" "<tr><th><nobr>" + i18n( "Temperature:" ) + "</nobr></th><td><nobr>%1</nobr></td>"
"<th><nobr>" + i18n( "Dew Point:" ) + "</nobr></th><td><nobr>%2</nobr></td></nobr></tr>" "<th><nobr>" + i18n( "Dew Point:" ) + "</nobr></th><td><nobr>%2</nobr></td></nobr></tr>"
@ -115,14 +115,14 @@ void dockwidget::showWeather()
.arg(temp).arg(dewPoint).arg(pressure).arg(relHumidity).arg(wind); .arg(temp).arg(dewPoint).arg(pressure).arg(relHumidity).arg(wind);
if ( !heatIndex.isEmpty() ) if ( !heatIndex.isEmpty() )
tip += QString("<th><nobr>" + i18n( "Heat Index:" ) + "</nobr></th><td><nobr>%1</nobr></td>").arg(heatIndex); tip += TQString("<th><nobr>" + i18n( "Heat Index:" ) + "</nobr></th><td><nobr>%1</nobr></td>").arg(heatIndex);
else if ( !windChill.isEmpty() ) else if ( !windChill.isEmpty() )
tip += QString("<th><nobr>" + i18n( "Wind Chill:" ) + "</nobr></th><td><nobr>%1</nobr></td>").arg(windChill); tip += TQString("<th><nobr>" + i18n( "Wind Chill:" ) + "</nobr></th><td><nobr>%1</nobr></td>").arg(windChill);
else else
tip += "<td>&nbsp;</td><td>&nbsp;</td>"; tip += "<td>&nbsp;</td><td>&nbsp;</td>";
tip += "</tr>"; tip += "</tr>";
tip += QString("<tr><th><nobr>" + i18n( "Sunrise:" ) + "</nobr></th><td><nobr>%1</nobr></td>" + tip += TQString("<tr><th><nobr>" + i18n( "Sunrise:" ) + "</nobr></th><td><nobr>%1</nobr></td>" +
"<th><nobr>" + i18n( "Sunset:" ) + "</nobr></th><td><nobr>%2</nobr></td>") "<th><nobr>" + i18n( "Sunset:" ) + "</nobr></th><td><nobr>%2</nobr></td>")
.arg(sunRiseTime).arg(sunSetTime); .arg(sunRiseTime).arg(sunSetTime);
@ -144,10 +144,10 @@ void dockwidget::showWeather()
tip += "</qt>"; tip += "</qt>";
// On null or empty location code, or if the station needs maintenance, this will return the dunno icon. // On null or empty location code, or if the station needs maintenance, this will return the dunno icon.
QPixmap icon = m_weatherService->icon( m_locationCode ); TQPixmap icon = m_weatherService->icon( m_locationCode );
QToolTip::remove(this); TQToolTip::remove(this);
QToolTip::add(this, tip); TQToolTip::add(this, tip);
kdDebug(12004) << "show weather: " << endl; kdDebug(12004) << "show weather: " << endl;
kdDebug(12004) << "location: " << m_locationCode << endl; kdDebug(12004) << "location: " << m_locationCode << endl;
@ -167,9 +167,9 @@ void dockwidget::initDock()
m_button= new WeatherButton(this,"m_button"); m_button= new WeatherButton(this,"m_button");
m_lblTemp= new QLabel(this,"lblTemp"); m_lblTemp= new TQLabel(this,"lblTemp");
m_lblWind= new QLabel(this,"lblWind"); m_lblWind= new TQLabel(this,"lblWind");
m_lblPres= new QLabel(this,"lblPres"); m_lblPres= new TQLabel(this,"lblPres");
m_lblTemp->setBackgroundOrigin(AncestorOrigin); m_lblTemp->setBackgroundOrigin(AncestorOrigin);
m_lblWind->setBackgroundOrigin(AncestorOrigin); m_lblWind->setBackgroundOrigin(AncestorOrigin);
@ -179,12 +179,12 @@ void dockwidget::initDock()
m_lblWind->setMargin(0); m_lblWind->setMargin(0);
m_lblPres->setMargin(0); m_lblPres->setMargin(0);
QBoxLayout *mainLayout = new QBoxLayout(this, QBoxLayout::TopToBottom); TQBoxLayout *mainLayout = new TQBoxLayout(this, TQBoxLayout::TopToBottom);
mainLayout->setSpacing(0); mainLayout->setSpacing(0);
mainLayout->setMargin(0); mainLayout->setMargin(0);
mainLayout->addWidget(m_button, 0, Qt::AlignCenter); mainLayout->addWidget(m_button, 0, Qt::AlignCenter);
QBoxLayout *layout = new QBoxLayout(mainLayout, QBoxLayout::TopToBottom); TQBoxLayout *layout = new TQBoxLayout(mainLayout, TQBoxLayout::TopToBottom);
layout->setSpacing(0); layout->setSpacing(0);
layout->setMargin(0); layout->setMargin(0);
layout->addWidget(m_lblTemp); layout->addWidget(m_lblTemp);
@ -195,11 +195,11 @@ void dockwidget::initDock()
updateFont(); updateFont();
QTimer::singleShot( 0, this, SLOT( showWeather() ) ); TQTimer::singleShot( 0, this, TQT_SLOT( showWeather() ) );
} }
/** resize the view **/ /** resize the view **/
void dockwidget::resizeView( const QSize &size ) void dockwidget::resizeView( const TQSize &size )
{ {
kdDebug(12004) << "Changing to size " << size << endl; kdDebug(12004) << "Changing to size " << size << endl;
resize(size); resize(size);
@ -212,15 +212,15 @@ void dockwidget::resizeView( const QSize &size )
{ {
if ( h <= 128 ) // left to right layout if ( h <= 128 ) // left to right layout
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::LeftToRight); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::LeftToRight);
m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
m_lblWind->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblWind->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
m_lblPres->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblPres->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
} }
else // top to bottom else // top to bottom
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::TopToBottom); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::TopToBottom);
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
h = 128 - (3 * fm.height()); // 3 lines of text below the button h = 128 - (3 * fm.height()); // 3 lines of text below the button
m_lblTemp->setAlignment(Qt::AlignCenter); m_lblTemp->setAlignment(Qt::AlignCenter);
m_lblWind->setAlignment(Qt::AlignCenter); m_lblWind->setAlignment(Qt::AlignCenter);
@ -232,13 +232,13 @@ void dockwidget::resizeView( const QSize &size )
{ {
if ( h <= 32 ) // left to right if ( h <= 32 ) // left to right
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::LeftToRight); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::LeftToRight);
m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
} }
else // top to bottom else // top to bottom
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::TopToBottom); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::TopToBottom);
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
h = QMIN(128, h) - fm.height(); h = QMIN(128, h) - fm.height();
m_lblTemp->setAlignment(Qt::AlignCenter); m_lblTemp->setAlignment(Qt::AlignCenter);
} }
@ -259,18 +259,18 @@ void dockwidget::resizeView( const QSize &size )
{ {
if ( w <= 128 ) // top to bottom if ( w <= 128 ) // top to bottom
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::TopToBottom); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::TopToBottom);
m_lblTemp->setAlignment(Qt::AlignCenter); m_lblTemp->setAlignment(Qt::AlignCenter);
m_lblWind->setAlignment(Qt::AlignCenter); m_lblWind->setAlignment(Qt::AlignCenter);
m_lblPres->setAlignment(Qt::AlignCenter); m_lblPres->setAlignment(Qt::AlignCenter);
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
h = h - (3 * fm.height()); // 3 lines of text below the button h = h - (3 * fm.height()); // 3 lines of text below the button
h = QMIN(w, h); h = QMIN(w, h);
} }
else // left to right layout else // left to right layout
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::LeftToRight); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::LeftToRight);
m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
m_lblWind->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblWind->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
m_lblPres->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblPres->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
@ -281,14 +281,14 @@ void dockwidget::resizeView( const QSize &size )
{ {
if ( w <= 128 ) // top to bottom if ( w <= 128 ) // top to bottom
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::TopToBottom); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::TopToBottom);
m_lblTemp->setAlignment(Qt::AlignCenter); m_lblTemp->setAlignment(Qt::AlignCenter);
h = w; h = w;
} }
else // left to right layout else // left to right layout
{ {
static_cast<QBoxLayout*>(layout())->setDirection(QBoxLayout::LeftToRight); static_cast<TQBoxLayout*>(layout())->setDirection(TQBoxLayout::LeftToRight);
m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter); m_lblTemp->setAlignment(Qt::AlignAuto | Qt::AlignVCenter);
h = static_cast<int>(w * 0.33); h = static_cast<int>(w * 0.33);
@ -306,7 +306,7 @@ void dockwidget::resizeView( const QSize &size )
int dockwidget::widthForHeight(int h) int dockwidget::widthForHeight(int h)
{ {
int w; int w;
QFontInfo fi(KGlobalSettings::generalFont()); TQFontInfo fi(KGlobalSettings::generalFont());
if ( m_mode == ShowAll ) if ( m_mode == ShowAll )
{ {
@ -315,7 +315,7 @@ int dockwidget::widthForHeight(int h)
int pixelSize = h/3 - 3; int pixelSize = h/3 - 3;
pixelSize = QMIN(pixelSize, fi.pixelSize()); // don't make it too large pixelSize = QMIN(pixelSize, fi.pixelSize()); // don't make it too large
m_font.setPixelSize(pixelSize); m_font.setPixelSize(pixelSize);
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
w = h + QMAX(fm.width(m_lblWind->text()), fm.width(m_lblPres->text())) + 1; w = h + QMAX(fm.width(m_lblWind->text()), fm.width(m_lblPres->text())) + 1;
} }
else // top to bottom else // top to bottom
@ -328,7 +328,7 @@ int dockwidget::widthForHeight(int h)
{ {
m_font.setPixelSize(h/2/3); m_font.setPixelSize(h/2/3);
} }
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
// size of icon // size of icon
h = 128 - (3 * fm.height()); // 3 lines of text below the button h = 128 - (3 * fm.height()); // 3 lines of text below the button
w = QMAX(fm.width(m_lblWind->text()), fm.width(m_lblPres->text())) + 1; w = QMAX(fm.width(m_lblWind->text()), fm.width(m_lblPres->text())) + 1;
@ -342,7 +342,7 @@ int dockwidget::widthForHeight(int h)
int pixelSize = h - 3; int pixelSize = h - 3;
pixelSize = QMIN(pixelSize, fi.pixelSize()); // don't make it too large pixelSize = QMIN(pixelSize, fi.pixelSize()); // don't make it too large
m_font.setPixelSize(pixelSize); m_font.setPixelSize(pixelSize);
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
w = h + fm.width(m_lblTemp->text()) + 1; w = h + fm.width(m_lblTemp->text()) + 1;
} }
else // top to bottom else // top to bottom
@ -355,7 +355,7 @@ int dockwidget::widthForHeight(int h)
{ {
m_font.setPixelSize(h/2); m_font.setPixelSize(h/2);
} }
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
// size of icon // size of icon
h = QMIN(128, h) - fm.height(); h = QMIN(128, h) - fm.height();
w = fm.width(m_lblTemp->text()) + 1; w = fm.width(m_lblTemp->text()) + 1;
@ -377,7 +377,7 @@ int dockwidget::heightForWidth( int w )
if ( m_mode == ShowAll ) if ( m_mode == ShowAll )
{ {
QFontMetrics fmg(KGlobalSettings::generalFont()); TQFontMetrics fmg(KGlobalSettings::generalFont());
int maxWidth = fmg.width("888 km/h NNWW"); // a good approximation int maxWidth = fmg.width("888 km/h NNWW"); // a good approximation
if ( w <= 128 ) // top to bottom if ( w <= 128 ) // top to bottom
@ -391,7 +391,7 @@ int dockwidget::heightForWidth( int w )
m_font.setPixelSize(static_cast<int>(fmg.height() * double(w) / maxWidth)); m_font.setPixelSize(static_cast<int>(fmg.height() * double(w) / maxWidth));
} }
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
h = w + (3 * fm.height()); // 3 lines of text below the button h = w + (3 * fm.height()); // 3 lines of text below the button
} }
else else
@ -405,14 +405,14 @@ int dockwidget::heightForWidth( int w )
m_font.setPixelSize(static_cast<int>(fmg.height() * (w*0.66) / maxWidth)); m_font.setPixelSize(static_cast<int>(fmg.height() * (w*0.66) / maxWidth));
} }
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
h = 3 * fm.height(); // 3 lines of text h = 3 * fm.height(); // 3 lines of text
} }
} }
else if ( m_mode == ShowTempOnly ) else if ( m_mode == ShowTempOnly )
{ {
QFontMetrics fmg(KGlobalSettings::generalFont()); TQFontMetrics fmg(KGlobalSettings::generalFont());
int maxWidth = fmg.width("888.88 CC"); // a good approximation int maxWidth = fmg.width("888.88 CC"); // a good approximation
if ( w <= 128 ) // top to bottom if ( w <= 128 ) // top to bottom
@ -426,7 +426,7 @@ int dockwidget::heightForWidth( int w )
m_font.setPixelSize(static_cast<int>(fmg.height() * double(w) / maxWidth)); m_font.setPixelSize(static_cast<int>(fmg.height() * double(w) / maxWidth));
} }
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
h = w + fm.height(); // text below the button h = w + fm.height(); // text below the button
} }
else else
@ -440,7 +440,7 @@ int dockwidget::heightForWidth( int w )
m_font.setPixelSize(static_cast<int>(fmg.height() * (w*0.66) / maxWidth)); m_font.setPixelSize(static_cast<int>(fmg.height() * (w*0.66) / maxWidth));
} }
QFontMetrics fm(m_font); TQFontMetrics fm(m_font);
h = QMAX(fm.height(), static_cast<int>(w * 0.33)); h = QMAX(fm.height(), static_cast<int>(w * 0.33));
} }
} }

@ -18,9 +18,9 @@
#ifndef DOCKWIDGET_H #ifndef DOCKWIDGET_H
#define DOCKWIDGET_H #define DOCKWIDGET_H
#include <qfont.h> #include <tqfont.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qwidget.h> #include <tqwidget.h>
#include <dcopref.h> #include <dcopref.h>
@ -33,16 +33,16 @@ class dockwidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
dockwidget(const QString &location, QWidget *parent=0, const char *name=0); dockwidget(const TQString &location, TQWidget *parent=0, const char *name=0);
~dockwidget(); ~dockwidget();
enum {ShowIconOnly=1, ShowTempOnly=2, ShowAll=3 }; enum {ShowIconOnly=1, ShowTempOnly=2, ShowAll=3 };
void setLocationCode(const QString &locationCode); void setLocationCode(const TQString &locationCode);
void setViewMode(int); void setViewMode(int);
void setOrientation(Orientation o) { m_orientation = o; } void setOrientation(Orientation o) { m_orientation = o; }
/** resize the view **/ /** resize the view **/
void resizeView(const QSize &size); void resizeView(const TQSize &size);
int widthForHeight(int h); int widthForHeight(int h);
int heightForWidth(int w); int heightForWidth(int w);
@ -57,13 +57,13 @@ private:
void updateFont(); void updateFont();
int m_mode; int m_mode;
QString m_locationCode; TQString m_locationCode;
QFont m_font; TQFont m_font;
QPixmap m_icon; TQPixmap m_icon;
WeatherButton *m_button; WeatherButton *m_button;
QLabel *m_lblTemp; TQLabel *m_lblTemp;
QLabel *m_lblWind; TQLabel *m_lblWind;
QLabel *m_lblPres; TQLabel *m_lblPres;
Orientation m_orientation; Orientation m_orientation;
WeatherService_stub *m_weatherService; WeatherService_stub *m_weatherService;

@ -21,10 +21,10 @@
without including the source code for Qt in the source distribution. without including the source code for Qt in the source distribution.
*/ */
#include <qbuttongroup.h> #include <tqbuttongroup.h>
#include <qcheckbox.h> #include <tqcheckbox.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qlayout.h> #include <tqlayout.h>
#include <kaboutdata.h> #include <kaboutdata.h>
#include <kapplication.h> #include <kapplication.h>
@ -43,18 +43,18 @@
extern "C" extern "C"
{ {
KDE_EXPORT KCModule *create_weather( QWidget *parent, const char * ) KDE_EXPORT KCModule *create_weather( TQWidget *parent, const char * )
{ {
return new KCMWeather( parent, "kweather" ); return new KCMWeather( parent, "kweather" );
} }
} }
KCMWeather::KCMWeather( QWidget *parent, const char *name ) KCMWeather::KCMWeather( TQWidget *parent, const char *name )
: KCModule( parent, name ) : KCModule( parent, name )
{ {
mWeatherService = new WeatherService_stub( "KWeatherService", mWeatherService = new WeatherService_stub( "KWeatherService",
"WeatherService" ); "WeatherService" );
QVBoxLayout *layout = new QVBoxLayout( this ); TQVBoxLayout *layout = new TQVBoxLayout( this );
mWidget = new prefsDialogData( this ); mWidget = new prefsDialogData( this );
mWidget->m_reportLocation->setFocus(); mWidget->m_reportLocation->setFocus();
@ -63,14 +63,14 @@ KCMWeather::KCMWeather( QWidget *parent, const char *name )
fillStationList(); fillStationList();
load(); load();
connect( mWidget->m_enableLog, SIGNAL( toggled( bool ) ), connect( mWidget->m_enableLog, TQT_SIGNAL( toggled( bool ) ),
SLOT( enableLogWidgets( bool ) ) ); TQT_SLOT( enableLogWidgets( bool ) ) );
connect( mWidget->m_viewMode, SIGNAL( released( int ) ), connect( mWidget->m_viewMode, TQT_SIGNAL( released( int ) ),
SLOT( changeViewMode( int ) ) ); TQT_SLOT( changeViewMode( int ) ) );
connect( mWidget->m_reportLocation, SIGNAL( activated( const QString& ) ), connect( mWidget->m_reportLocation, TQT_SIGNAL( activated( const TQString& ) ),
SLOT( reportLocationChanged() ) ); TQT_SLOT( reportLocationChanged() ) );
connect( mWidget->m_textColor, SIGNAL( changed(const QColor &) ), connect( mWidget->m_textColor, TQT_SIGNAL( changed(const TQColor &) ),
SLOT( textColorChanged(const QColor &) ) ); TQT_SLOT( textColorChanged(const TQColor &) ) );
KAboutData *about = new KAboutData( KAboutData *about = new KAboutData(
I18N_NOOP( "kcmweather" ), I18N_NOOP( "kcmweather" ),
@ -86,7 +86,7 @@ KCMWeather::~KCMWeather()
{ {
delete mWeatherService; delete mWeatherService;
} }
void KCMWeather::showEvent( QShowEvent * ) void KCMWeather::showEvent( TQShowEvent * )
{ {
fillStationList(); fillStationList();
} }
@ -94,12 +94,12 @@ void KCMWeather::showEvent( QShowEvent * )
void KCMWeather::fillStationList() void KCMWeather::fillStationList()
{ {
// store current selection // store current selection
QString current = mWidget->m_reportLocation->currentText(); TQString current = mWidget->m_reportLocation->currentText();
mWidget->m_reportLocation->clear(); mWidget->m_reportLocation->clear();
QStringList stationList = mWeatherService->listStations(); TQStringList stationList = mWeatherService->listStations();
QStringList::Iterator idx = stationList.begin(); TQStringList::Iterator idx = stationList.begin();
// get station name from station id for sorting afterwards // get station name from station id for sorting afterwards
for(; idx != stationList.end(); ++idx) for(; idx != stationList.end(); ++idx)
@ -154,7 +154,7 @@ void KCMWeather::reportLocationChanged()
emit changed( true ); emit changed( true );
} }
void KCMWeather::textColorChanged(const QColor &) void KCMWeather::textColorChanged(const TQColor &)
{ {
emit changed( true ); emit changed( true );
} }
@ -169,11 +169,11 @@ void KCMWeather::load()
mWidget->m_enableLog->setChecked( enabled ); mWidget->m_enableLog->setChecked( enabled );
enableLogWidgets( enabled ); enableLogWidgets( enabled );
static QColor black(Qt::black); static TQColor black(Qt::black);
QColor textColor = config.readColorEntry("textColor", &black); TQColor textColor = config.readColorEntry("textColor", &black);
mWidget->m_textColor->setColor(textColor); mWidget->m_textColor->setColor(textColor);
QString loc = config.readEntry( "report_location" ); TQString loc = config.readEntry( "report_location" );
mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) ); mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );
@ -196,7 +196,7 @@ void KCMWeather::save()
config.writeEntry( "textColor", mWidget->m_textColor->color() ); config.writeEntry( "textColor", mWidget->m_textColor->color() );
// Station idx to local idx; if nothing selected yet, keep it empty // Station idx to local idx; if nothing selected yet, keep it empty
QString loc; TQString loc;
if ( ! mWidget->m_reportLocation->currentText().isEmpty() ) if ( ! mWidget->m_reportLocation->currentText().isEmpty() )
loc = mWeatherService->stationCode( mWidget->m_reportLocation->currentText() ); loc = mWeatherService->stationCode( mWidget->m_reportLocation->currentText() );
config.writeEntry( "report_location", loc); config.writeEntry( "report_location", loc);

@ -32,7 +32,7 @@ class KCMWeather : public KCModule
Q_OBJECT Q_OBJECT
public: public:
KCMWeather( QWidget *parent = 0, const char *name = 0 ); KCMWeather( TQWidget *parent = 0, const char *name = 0 );
~KCMWeather(); ~KCMWeather();
virtual void load(); virtual void load();
@ -41,13 +41,13 @@ class KCMWeather : public KCModule
protected: protected:
void fillStationList(); void fillStationList();
virtual void showEvent( QShowEvent * ); virtual void showEvent( TQShowEvent * );
private slots: private slots:
void enableLogWidgets( bool value ); void enableLogWidgets( bool value );
void changeViewMode( int mode ); void changeViewMode( int mode );
void reportLocationChanged(); void reportLocationChanged();
void textColorChanged(const QColor &); void textColorChanged(const TQColor &);
private: private:
prefsDialogData *mWidget; prefsDialogData *mWidget;

@ -21,7 +21,7 @@
without including the source code for Qt in the source distribution. without including the source code for Qt in the source distribution.
*/ */
#include <qlayout.h> #include <tqlayout.h>
#include <kaboutdata.h> #include <kaboutdata.h>
#include <kdebug.h> #include <kdebug.h>
@ -33,19 +33,19 @@
extern "C" extern "C"
{ {
KDE_EXPORT KCModule *create_weatherservice( QWidget *parent, const char * ) { KDE_EXPORT KCModule *create_weatherservice( TQWidget *parent, const char * ) {
return new KCMWeatherService( parent, "kweather" ); return new KCMWeatherService( parent, "kweather" );
} }
} }
KCMWeatherService::KCMWeatherService( QWidget *parent, const char *name ) KCMWeatherService::KCMWeatherService( TQWidget *parent, const char *name )
: KCModule( parent, name ) : KCModule( parent, name )
{ {
QVBoxLayout *layout = new QVBoxLayout( this ); TQVBoxLayout *layout = new TQVBoxLayout( this );
mWidget = new ServiceConfigWidget( this ); mWidget = new ServiceConfigWidget( this );
// not needed, as a change immediately changes the service // not needed, as a change immediately changes the service
//connect(mWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); //connect(mWidget, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
layout->addWidget( mWidget ); layout->addWidget( mWidget );
KAboutData *about = new KAboutData( "kcmweatherservice", KAboutData *about = new KAboutData( "kcmweatherservice",

@ -33,7 +33,7 @@ class KCMWeatherService : public KCModule
Q_OBJECT Q_OBJECT
public: public:
KCMWeatherService( QWidget *parent = 0, const char *name = 0 ); KCMWeatherService( TQWidget *parent = 0, const char *name = 0 );
virtual void load(); virtual void load();
virtual void save(); virtual void save();

@ -29,9 +29,9 @@
#include <ksettings/dispatcher.h> #include <ksettings/dispatcher.h>
#include <dcopclient.h> #include <dcopclient.h>
#include <qfile.h> #include <tqfile.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qpalette.h> #include <tqpalette.h>
#include "kweather.h" #include "kweather.h"
#include "reportview.h" #include "reportview.h"
@ -40,7 +40,7 @@
extern "C" extern "C"
{ {
KDE_EXPORT KPanelApplet* init(QWidget *parent, const QString& configFile) KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile)
{ {
KGlobal::locale()->insertCatalogue("kweather"); KGlobal::locale()->insertCatalogue("kweather");
kweather *theApplet = new kweather(configFile, KPanelApplet::Normal, kweather *theApplet = new kweather(configFile, KPanelApplet::Normal,
@ -49,8 +49,8 @@ extern "C"
} }
} }
kweather::kweather(const QString& configFile, Type t, int actions, kweather::kweather(const TQString& configFile, Type t, int actions,
QWidget *parent, const char *name): TQWidget *parent, const char *name):
KPanelApplet(configFile, t, actions, parent, name), weatherIface(), KPanelApplet(configFile, t, actions, parent, name), weatherIface(),
mFirstRun( false ), mReport( 0 ), mClient( 0 ), mFirstRun( false ), mReport( 0 ), mClient( 0 ),
mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 ), mTextColor(Qt::black) mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 ), mTextColor(Qt::black)
@ -58,18 +58,18 @@ kweather::kweather(const QString& configFile, Type t, int actions,
kdDebug(12004) << "Constructor " << endl; kdDebug(12004) << "Constructor " << endl;
setObjId("weatherIface"); setObjId("weatherIface");
setBackgroundOrigin( QWidget::AncestorOrigin ); setBackgroundOrigin( TQWidget::AncestorOrigin );
loadPrefs(); loadPrefs();
initContextMenu(); initContextMenu();
initDCOP(); initDCOP();
dockWidget = new dockwidget(reportLocation, this, "dockwidget"); dockWidget = new dockwidget(reportLocation, this, "dockwidget");
connect(dockWidget, SIGNAL(buttonClicked()), SLOT(doReport())); connect(dockWidget, TQT_SIGNAL(buttonClicked()), TQT_SLOT(doReport()));
dockWidget->setViewMode(mViewMode); dockWidget->setViewMode(mViewMode);
setLabelColor(); setLabelColor();
timeOut = new QTimer(this, "timeOut" ); timeOut = new TQTimer(this, "timeOut" );
connect(timeOut, SIGNAL(timeout()), SLOT(timeout())); connect(timeOut, TQT_SIGNAL(timeout()), TQT_SLOT(timeout()));
timeOut->start(10*60*1000); timeOut->start(10*60*1000);
if(mFirstRun) if(mFirstRun)
@ -88,13 +88,13 @@ void kweather::initContextMenu()
mContextMenu = new KPopupMenu(this); mContextMenu = new KPopupMenu(this);
mContextMenu->insertTitle(i18n("KWeather - %1").arg( reportLocation ), -1, 0); mContextMenu->insertTitle(i18n("KWeather - %1").arg( reportLocation ), -1, 0);
mContextMenu->insertItem(SmallIcon("viewmag"), i18n("Show &Report"), mContextMenu->insertItem(SmallIcon("viewmag"), i18n("Show &Report"),
this, SLOT(doReport()), 0, -1, 1); this, TQT_SLOT(doReport()), 0, -1, 1);
mContextMenu->insertItem(SmallIcon("reload"), i18n("&Update Now"), mContextMenu->insertItem(SmallIcon("reload"), i18n("&Update Now"),
this, SLOT(slotUpdateNow()), 0, -1, 2); this, TQT_SLOT(slotUpdateNow()), 0, -1, 2);
mContextMenu->insertSeparator(); mContextMenu->insertSeparator();
mContextMenu->insertItem(SmallIcon("kweather"), i18n("&About KWeather"), this, SLOT(about())); mContextMenu->insertItem(SmallIcon("kweather"), i18n("&About KWeather"), this, TQT_SLOT(about()));
mContextMenu->insertItem(SmallIcon("configure"), mContextMenu->insertItem(SmallIcon("configure"),
i18n("&Configure KWeather..."), this, SLOT(preferences())); i18n("&Configure KWeather..."), this, TQT_SLOT(preferences()));
setCustomMenu(mContextMenu); setCustomMenu(mContextMenu);
} }
@ -116,8 +116,8 @@ void kweather::initDCOP()
mWeatherService = new WeatherService_stub( "KWeatherService", "WeatherService" ); mWeatherService = new WeatherService_stub( "KWeatherService", "WeatherService" );
if (!connectDCOPSignal(0, 0, "fileUpdate(QString)", if (!connectDCOPSignal(0, 0, "fileUpdate(TQString)",
"refresh(QString)",false)) "refresh(TQString)",false))
kdDebug(12004) << "Could not attach dcop signal..." << endl; kdDebug(12004) << "Could not attach dcop signal..." << endl;
else else
kdDebug(12004) << "attached dcop signals..." << endl; kdDebug(12004) << "attached dcop signals..." << endl;
@ -158,7 +158,7 @@ void kweather::preferences()
if ( settingsDialog == 0 ) if ( settingsDialog == 0 )
{ {
settingsDialog = new KCMultiDialog( this ); settingsDialog = new KCMultiDialog( this );
connect( settingsDialog, SIGNAL( configCommitted() ), SLOT( slotPrefsAccepted() ) ); connect( settingsDialog, TQT_SIGNAL( configCommitted() ), TQT_SLOT( slotPrefsAccepted() ) );
settingsDialog->addModule( "kcmweather.desktop" ); settingsDialog->addModule( "kcmweather.desktop" );
settingsDialog->addModule( "kcmweatherservice.desktop" ); settingsDialog->addModule( "kcmweatherservice.desktop" );
@ -171,7 +171,7 @@ void kweather::preferences()
/** The help handler */ /** The help handler */
void kweather::help() void kweather::help()
{ {
kapp->invokeHelp(QString::null, QString::fromLatin1("kweather")); kapp->invokeHelp(TQString::null, TQString::fromLatin1("kweather"));
} }
/** Display the current weather report. */ /** Display the current weather report. */
@ -189,7 +189,7 @@ void kweather::doReport()
{ {
mReport = new reportView(reportLocation); mReport = new reportView(reportLocation);
connect( mReport, SIGNAL( finished() ), SLOT( slotReportFinished() ) ); connect( mReport, TQT_SIGNAL( finished() ), TQT_SLOT( slotReportFinished() ) );
} }
mReport->show(); mReport->show();
@ -216,7 +216,7 @@ void kweather::loadPrefs(){
reportLocation = kcConfig->readEntry("report_location"); reportLocation = kcConfig->readEntry("report_location");
mViewMode = kcConfig->readNumEntry("smallview_mode", dockwidget::ShowAll); mViewMode = kcConfig->readNumEntry("smallview_mode", dockwidget::ShowAll);
static QColor black(Qt::black); static TQColor black(Qt::black);
mTextColor = kcConfig->readColorEntry("textColor", &black); mTextColor = kcConfig->readColorEntry("textColor", &black);
} }
@ -246,17 +246,17 @@ void kweather::writeLogEntry()
if (logOn && !fileName.isEmpty()) if (logOn && !fileName.isEmpty())
{ {
kdDebug(12004)<< "Try log file:" << fileName << endl; kdDebug(12004)<< "Try log file:" << fileName << endl;
QFile logFile(fileName); TQFile logFile(fileName);
QTextStream logFileStream(&logFile); TQTextStream logFileStream(&logFile);
if (logFile.open(IO_Append | IO_ReadWrite)) if (logFile.open(IO_Append | IO_ReadWrite))
{ {
QString temperature = mWeatherService->temperature(reportLocation ); TQString temperature = mWeatherService->temperature(reportLocation );
QString wind = mWeatherService->wind(reportLocation ); TQString wind = mWeatherService->wind(reportLocation );
QString pressure = mWeatherService->pressure(reportLocation ); TQString pressure = mWeatherService->pressure(reportLocation );
QString date = mWeatherService->date(reportLocation ); TQString date = mWeatherService->date(reportLocation );
QStringList weather = mWeatherService->weather(reportLocation ); TQStringList weather = mWeatherService->weather(reportLocation );
QStringList cover = mWeatherService->cover(reportLocation ); TQStringList cover = mWeatherService->cover(reportLocation );
QString visibility = mWeatherService->visibility(reportLocation ); TQString visibility = mWeatherService->visibility(reportLocation );
logFileStream << date << ","; logFileStream << date << ",";
logFileStream << wind << ","; logFileStream << wind << ",";
logFileStream << temperature << ","; logFileStream << temperature << ",";
@ -312,7 +312,7 @@ int kweather::heightForWidth(int w) const
return h; return h;
} }
void kweather::refresh(QString stationID) void kweather::refresh(TQString stationID)
{ {
kdDebug(12004) << "refresh " << stationID << endl; kdDebug(12004) << "refresh " << stationID << endl;
if( stationID == reportLocation) if( stationID == reportLocation)
@ -335,14 +335,14 @@ void kweather::slotPrefsAccepted()
if (logOn && !fileName.isEmpty()) if (logOn && !fileName.isEmpty())
{ {
QFile logFile(fileName); TQFile logFile(fileName);
// Open the file, create it if not already exists // Open the file, create it if not already exists
if (logFile.open(IO_ReadWrite)) if (logFile.open(IO_ReadWrite))
{ {
if (logFile.size() == 0) if (logFile.size() == 0)
{ {
// Empty file, put the header // Empty file, put the header
QTextStream logFileStream(&logFile); TQTextStream logFileStream(&logFile);
logFileStream << "Date,Wind Speed & Direction,Temperature,Pressure,Cover,Visibility,Current Weather" << endl; logFileStream << "Date,Wind Speed & Direction,Temperature,Pressure,Cover,Visibility,Current Weather" << endl;
} }
logFile.close(); logFile.close();
@ -361,7 +361,7 @@ void kweather::slotPrefsAccepted()
timeout(); timeout();
} }
void kweather::mousePressEvent(QMouseEvent *e) void kweather::mousePressEvent(TQMouseEvent *e)
{ {
if ( e->button() != RightButton ) if ( e->button() != RightButton )
{ {
@ -382,14 +382,14 @@ void kweather::slotUpdateNow()
bool kweather::attach() bool kweather::attach()
{ {
QString error; TQString error;
kdDebug(12004) << "Looking for dcop service..." << endl; kdDebug(12004) << "Looking for dcop service..." << endl;
if (!mClient->isApplicationRegistered("KWeatherService")) if (!mClient->isApplicationRegistered("KWeatherService"))
{ {
kdDebug(12004) << "Could not find service so I am starting it..." kdDebug(12004) << "Could not find service so I am starting it..."
<< endl; << endl;
if (!KApplication::startServiceByDesktopName("kweatherservice", if (!KApplication::startServiceByDesktopName("kweatherservice",
QStringList(), &error)) TQStringList(), &error))
{ {
kdDebug(12004) << "Starting KWeatherService failed with message: " kdDebug(12004) << "Starting KWeatherService failed with message: "
<< error << endl; << error << endl;
@ -406,7 +406,7 @@ bool kweather::attach()
return true; return true;
} }
void kweather::resizeEvent(QResizeEvent *e) void kweather::resizeEvent(TQResizeEvent *e)
{ {
kdDebug(12004) << "KWeather Resize event " << e->size() << endl; kdDebug(12004) << "KWeather Resize event " << e->size() << endl;
dockWidget->resizeView(e->size()); dockWidget->resizeView(e->size());
@ -417,7 +417,7 @@ void kweather::setLabelColor()
setPaletteForegroundColor(mTextColor); setPaletteForegroundColor(mTextColor);
} }
void kweather::paletteChange(const QPalette &) void kweather::paletteChange(const TQPalette &)
{ {
setLabelColor(); setLabelColor();
} }

@ -35,13 +35,13 @@ class kweather : public KPanelApplet, public weatherIface
Q_OBJECT Q_OBJECT
public: public:
kweather(const QString& configFile, Type t = Normal, int actions = 0, QWidget *parent = 0, const char *name = 0); kweather(const TQString& configFile, Type t = Normal, int actions = 0, TQWidget *parent = 0, const char *name = 0);
~kweather(); ~kweather();
void help(); void help();
void resizeEvent(QResizeEvent*); void resizeEvent(TQResizeEvent*);
int heightForWidth(int i) const; int heightForWidth(int i) const;
int widthForHeight(int i) const; int widthForHeight(int i) const;
void refresh(QString); void refresh(TQString);
void setBackground(); void setBackground();
void setLabelColor(); void setLabelColor();
@ -50,7 +50,7 @@ public slots: // Public slots
void about(); void about();
protected: protected:
void paletteChange(const QPalette &); void paletteChange(const TQPalette &);
protected slots: protected slots:
void doReport(); void doReport();
@ -66,17 +66,17 @@ private: // Private methods
void savePrefs(); void savePrefs();
void showWeather(); void showWeather();
void writeLogEntry(); void writeLogEntry();
void mousePressEvent(QMouseEvent *e); void mousePressEvent(TQMouseEvent *e);
bool attach(); bool attach();
QString reportLocation; TQString reportLocation;
QString fileName; TQString fileName;
QString metarData; TQString metarData;
bool logOn; bool logOn;
bool mFirstRun; bool mFirstRun;
int mViewMode; int mViewMode;
QTimer *timeOut; TQTimer *timeOut;
dockwidget *dockWidget; dockwidget *dockWidget;
reportView *mReport; reportView *mReport;
DCOPClient *mClient; DCOPClient *mClient;
@ -84,7 +84,7 @@ private: // Private methods
KPopupMenu *mContextMenu; KPopupMenu *mContextMenu;
WeatherService_stub *mWeatherService; WeatherService_stub *mWeatherService;
KCMultiDialog *settingsDialog; KCMultiDialog *settingsDialog;
QColor mTextColor; TQColor mTextColor;
}; };
#endif #endif

@ -20,7 +20,7 @@ email : jratke@comcast.net
#include "config.h" #include "config.h"
#include <qdatetime.h> #include <tqdatetime.h>
#include <kdebug.h> #include <kdebug.h>
#include <math.h> #include <math.h>
@ -34,27 +34,27 @@ email : jratke@comcast.net
MetarParser::MetarParser(StationDatabase *stationDB, MetarParser::MetarParser(StationDatabase *stationDB,
KLocale::MeasureSystem units, KLocale::MeasureSystem units,
QDate date, TQDate date,
QTime time, TQTime time,
unsigned int localUTCOffset) : unsigned int localUTCOffset) :
m_stationDb(stationDB), m_units(units), m_date(date), m_time(time), m_localUTCOffset(localUTCOffset) m_stationDb(stationDB), m_units(units), m_date(date), m_time(time), m_localUTCOffset(localUTCOffset)
{ {
CoverRegExp = QRegExp("^(FEW|SCT|BKN|OVC|SKC|CLR|CAVOK)([0-9]{3})?(?:TCU|CB)?$"); CoverRegExp = TQRegExp("^(FEW|SCT|BKN|OVC|SKC|CLR|CAVOK)([0-9]{3})?(?:TCU|CB)?$");
CurrentRegExp = QRegExp("^(\\+|-|VC)?([A-Z]{2,4})$"); CurrentRegExp = TQRegExp("^(\\+|-|VC)?([A-Z]{2,4})$");
WindRegExp = QRegExp("^([0-9]{3}|VRB)([0-9]{2,3})(?:G([0-9]{2,3}))?(KT|KMH|MPS)$"); WindRegExp = TQRegExp("^([0-9]{3}|VRB)([0-9]{2,3})(?:G([0-9]{2,3}))?(KT|KMH|MPS)$");
VisRegExp = QRegExp("^([0-9]{1,2})SM$"); VisRegExp = TQRegExp("^([0-9]{1,2})SM$");
VisFracRegExp = QRegExp("^1/(2|4)SM$"); VisFracRegExp = TQRegExp("^1/(2|4)SM$");
TempRegExp = QRegExp("^(M)?([0-9]{2})/(?:(M)?([0-9]{2}))?$"); TempRegExp = TQRegExp("^(M)?([0-9]{2})/(?:(M)?([0-9]{2}))?$");
TimeRegExp = QRegExp("^([0-9]{2}:[0-9]{2})$"); TimeRegExp = TQRegExp("^([0-9]{2}:[0-9]{2})$");
DateRegExp = QRegExp("^([0-9]{4}/[0-9]{2}/[0-9]{2})$"); DateRegExp = TQRegExp("^([0-9]{4}/[0-9]{2}/[0-9]{2})$");
PressRegExp = QRegExp("^([AQ])([0-9]{4})$"); PressRegExp = TQRegExp("^([AQ])([0-9]{4})$");
TempTenRegExp = QRegExp("^T([01][0-9]{3})([01][0-9]{3})$"); TempTenRegExp = TQRegExp("^T([01][0-9]{3})([01][0-9]{3})$");
} }
void MetarParser::reset() void MetarParser::reset()
{ {
// Initialize the WeatherInfo structure // Initialize the WeatherInfo structure
weatherInfo.theWeather = QString::null; weatherInfo.theWeather = TQString::null;
weatherInfo.clouds = 0; weatherInfo.clouds = 0;
weatherInfo.windMPH = 0; weatherInfo.windMPH = 0;
weatherInfo.tempC = 0; weatherInfo.tempC = 0;
@ -64,19 +64,19 @@ void MetarParser::reset()
weatherInfo.qsCurrentList.clear(); weatherInfo.qsCurrentList.clear();
weatherInfo.qsDate = m_date; weatherInfo.qsDate = m_date;
weatherInfo.qsTime = m_time; weatherInfo.qsTime = m_time;
weatherInfo.qsPressure = QString::null; weatherInfo.qsPressure = TQString::null;
weatherInfo.qsTemperature = QString::null; weatherInfo.qsTemperature = TQString::null;
weatherInfo.qsDewPoint = QString::null; weatherInfo.qsDewPoint = TQString::null;
weatherInfo.qsRelHumidity = QString::null; weatherInfo.qsRelHumidity = TQString::null;
weatherInfo.qsVisibility = QString::null; weatherInfo.qsVisibility = TQString::null;
weatherInfo.qsWindSpeed = QString::null; weatherInfo.qsWindSpeed = TQString::null;
weatherInfo.qsWindChill = QString::null; weatherInfo.qsWindChill = TQString::null;
weatherInfo.qsHeatIndex = QString::null; weatherInfo.qsHeatIndex = TQString::null;
weatherInfo.qsWindDirection = QString::null; weatherInfo.qsWindDirection = TQString::null;
weatherInfo.stationNeedsMaintenance = false; weatherInfo.stationNeedsMaintenance = false;
} }
struct WeatherInfo MetarParser::processData(const QString &stationID, const QString &metar) struct WeatherInfo MetarParser::processData(const TQString &stationID, const TQString &metar)
{ {
reset(); reset();
@ -85,11 +85,11 @@ struct WeatherInfo MetarParser::processData(const QString &stationID, const QStr
kdDebug(12006) << "Processing data: " << metar << endl; kdDebug(12006) << "Processing data: " << metar << endl;
// Split at whitespace into tokens // Split at whitespace into tokens
QStringList dataList = QStringList::split(QRegExp("\\s+"), metar); TQStringList dataList = TQStringList::split(TQRegExp("\\s+"), metar);
bool found = false; bool found = false;
bool beforeRemark = true; bool beforeRemark = true;
for (QStringList::ConstIterator it = dataList.begin(); for (TQStringList::ConstIterator it = dataList.begin();
it != dataList.end(); ++it) it != dataList.end(); ++it)
{ {
// Don't try to parse the ICAO location code // Don't try to parse the ICAO location code
@ -143,17 +143,17 @@ struct WeatherInfo MetarParser::processData(const QString &stationID, const QStr
} }
/** Parse the current cover type */ /** Parse the current cover type */
bool MetarParser::parseCover(const QString &s) bool MetarParser::parseCover(const TQString &s)
{ {
if (CoverRegExp.search(s) > -1) if (CoverRegExp.search(s) > -1)
{ {
kdDebug(12006) << "Cover: " << CoverRegExp.capturedTexts().join("-") kdDebug(12006) << "Cover: " << CoverRegExp.capturedTexts().join("-")
<< endl; << endl;
QString sCode = CoverRegExp.cap(1); TQString sCode = CoverRegExp.cap(1);
float height = CoverRegExp.cap(2).toFloat(); // initially in 100's of feet float height = CoverRegExp.cap(2).toFloat(); // initially in 100's of feet
QString sClouds; TQString sClouds;
QString skycondition; TQString skycondition;
height *= 100; height *= 100;
if (m_units == KLocale::Metric) if (m_units == KLocale::Metric)
@ -203,13 +203,13 @@ bool MetarParser::parseCover(const QString &s)
} }
/** Parse the current weather conditions */ /** Parse the current weather conditions */
bool MetarParser::parseCurrent(const QString &s) bool MetarParser::parseCurrent(const TQString &s)
{ {
if (CurrentRegExp.search(s) > -1) if (CurrentRegExp.search(s) > -1)
{ {
QString sIntensity = CurrentRegExp.cap(1); TQString sIntensity = CurrentRegExp.cap(1);
QString sCode = CurrentRegExp.cap(2); TQString sCode = CurrentRegExp.cap(2);
QString intensity, descriptor, phenomena, currentWeather; TQString intensity, descriptor, phenomena, currentWeather;
kdDebug(12006) << "Current: " << CurrentRegExp.capturedTexts().join("-") << endl; kdDebug(12006) << "Current: " << CurrentRegExp.capturedTexts().join("-") << endl;
@ -354,7 +354,7 @@ bool MetarParser::parseCurrent(const QString &s)
} }
/** Parse out the current temperature */ /** Parse out the current temperature */
bool MetarParser::parseTemperature(const QString &s) bool MetarParser::parseTemperature(const TQString &s)
{ {
if (TempRegExp.search(s) > -1) if (TempRegExp.search(s) > -1)
{ {
@ -375,7 +375,7 @@ bool MetarParser::parseTemperature(const QString &s)
return false; return false;
} }
bool MetarParser::parseTemperatureTenths(const QString &s) bool MetarParser::parseTemperatureTenths(const TQString &s)
{ {
if (TempTenRegExp.search(s) > -1) if (TempTenRegExp.search(s) > -1)
{ {
@ -432,7 +432,7 @@ void MetarParser::calcTemperatureVariables()
fHeatIndex = 0; fHeatIndex = 0;
} }
QString unit; TQString unit;
if (m_units == KLocale::Metric) if (m_units == KLocale::Metric)
{ {
unit = i18n("°C"); unit = i18n("°C");
@ -460,7 +460,7 @@ void MetarParser::calcTemperatureVariables()
weatherInfo.qsHeatIndex += unit; weatherInfo.qsHeatIndex += unit;
} }
void MetarParser::removeTrailingDotZero(QString &string) void MetarParser::removeTrailingDotZero(TQString &string)
{ {
if ( string.right( 2 ) == ".0" ) if ( string.right( 2 ) == ".0" )
{ {
@ -469,20 +469,20 @@ void MetarParser::removeTrailingDotZero(QString &string)
} }
/** Parse out the current date. */ /** Parse out the current date. */
bool MetarParser::parseDate(const QString &s) bool MetarParser::parseDate(const TQString &s)
{ {
if (DateRegExp.search(s) > -1) if (DateRegExp.search(s) > -1)
{ {
kdDebug(12006) << "Date: " << DateRegExp.capturedTexts().join("-") kdDebug(12006) << "Date: " << DateRegExp.capturedTexts().join("-")
<< endl; << endl;
QString dateString = DateRegExp.cap(1); TQString dateString = DateRegExp.cap(1);
QString day, month, year; TQString day, month, year;
day = dateString.mid(8,2); day = dateString.mid(8,2);
month = dateString.mid(5,2); month = dateString.mid(5,2);
year = dateString.mid(0,4); year = dateString.mid(0,4);
QDate theDate(year.toInt(), month.toInt(), day.toInt()); TQDate theDate(year.toInt(), month.toInt(), day.toInt());
weatherInfo.qsDate = theDate; weatherInfo.qsDate = theDate;
@ -492,19 +492,19 @@ bool MetarParser::parseDate(const QString &s)
} }
/** Parse out the current time. */ /** Parse out the current time. */
bool MetarParser::parseTime(const QString &s) bool MetarParser::parseTime(const TQString &s)
{ {
if (TimeRegExp.search(s) > -1) if (TimeRegExp.search(s) > -1)
{ {
kdDebug(12006) << "Time: " << TimeRegExp.capturedTexts().join("-") kdDebug(12006) << "Time: " << TimeRegExp.capturedTexts().join("-")
<< endl; << endl;
QString hour, minute, dateString; TQString hour, minute, dateString;
dateString = TimeRegExp.cap(1); dateString = TimeRegExp.cap(1);
hour = dateString.mid(0,2); hour = dateString.mid(0,2);
minute = dateString.mid(3,2); minute = dateString.mid(3,2);
QTime theTime(hour.toInt(), minute.toInt()); TQTime theTime(hour.toInt(), minute.toInt());
weatherInfo.qsTime = theTime; weatherInfo.qsTime = theTime;
return true; return true;
@ -513,7 +513,7 @@ bool MetarParser::parseTime(const QString &s)
} }
/** Parse out the current visibility */ /** Parse out the current visibility */
bool MetarParser::parseVisibility(QStringList::ConstIterator it) bool MetarParser::parseVisibility(TQStringList::ConstIterator it)
{ {
float fVisibility = 0; float fVisibility = 0;
@ -557,11 +557,11 @@ bool MetarParser::parseVisibility(QStringList::ConstIterator it)
} }
/** Parse out the current pressure. */ /** Parse out the current pressure. */
bool MetarParser::parsePressure( const QString &s) bool MetarParser::parsePressure( const TQString &s)
{ {
if (PressRegExp.search(s) > -1) if (PressRegExp.search(s) > -1)
{ {
QString type = PressRegExp.cap(1); TQString type = PressRegExp.cap(1);
float fPressure = PressRegExp.cap(2).toFloat(); float fPressure = PressRegExp.cap(2).toFloat();
kdDebug(12006) << "Pressure: " << PressRegExp.capturedTexts().join("-") kdDebug(12006) << "Pressure: " << PressRegExp.capturedTexts().join("-")
@ -591,7 +591,7 @@ bool MetarParser::parsePressure( const QString &s)
struct wind_info struct wind_info
{ {
unsigned int number; unsigned int number;
QString name; TQString name;
}; };
static const struct wind_info wind_direction[] = static const struct wind_info wind_direction[] =
@ -617,7 +617,7 @@ static const struct wind_info wind_direction[] =
}; };
QString MetarParser::parseWindDirection(const unsigned int direction) TQString MetarParser::parseWindDirection(const unsigned int direction)
{ {
unsigned int i = 0; unsigned int i = 0;
@ -634,14 +634,14 @@ QString MetarParser::parseWindDirection(const unsigned int direction)
} }
/** Parse the wind speed */ /** Parse the wind speed */
bool MetarParser::parseWindSpeed(const QString &s) bool MetarParser::parseWindSpeed(const TQString &s)
{ {
if (WindRegExp.search(s) > -1) if (WindRegExp.search(s) > -1)
{ {
unsigned int direction = WindRegExp.cap(1).toInt(); unsigned int direction = WindRegExp.cap(1).toInt();
float windSpeed = WindRegExp.cap(2).toFloat(); float windSpeed = WindRegExp.cap(2).toFloat();
float gustSpeed = WindRegExp.cap(3).toFloat(); float gustSpeed = WindRegExp.cap(3).toFloat();
QString sWindUnit = WindRegExp.cap(4); TQString sWindUnit = WindRegExp.cap(4);
kdDebug(12006) << "Wind: " << WindRegExp.capturedTexts().join("-") kdDebug(12006) << "Wind: " << WindRegExp.capturedTexts().join("-")
<< endl; << endl;
@ -705,7 +705,7 @@ bool MetarParser::parseWindSpeed(const QString &s)
return false; return false;
} }
bool MetarParser::parseStationNeedsMaintenance(const QString &s) bool MetarParser::parseStationNeedsMaintenance(const TQString &s)
{ {
if (s == "$") if (s == "$")
{ {
@ -815,11 +815,11 @@ void MetarParser::calcWindChill()
} }
} }
bool MetarParser::isNight(const QString &stationID) const bool MetarParser::isNight(const TQString &stationID) const
{ {
QString upperStationID = stationID.upper(); TQString upperStationID = stationID.upper();
QString latitude = m_stationDb->stationLatitudeFromID(upperStationID); TQString latitude = m_stationDb->stationLatitudeFromID(upperStationID);
QString longitude = m_stationDb->stationLongitudeFromID(upperStationID); TQString longitude = m_stationDb->stationLongitudeFromID(upperStationID);
if ( latitude.compare( i18n("Unknown Station" ) ) == 0 || if ( latitude.compare( i18n("Unknown Station" ) ) == 0 ||
longitude.compare( i18n("Unknown Station" ) ) == 0 ) longitude.compare( i18n("Unknown Station" ) ) == 0 )
@ -830,10 +830,10 @@ bool MetarParser::isNight(const QString &stationID) const
{ {
Sun theSun( latitude, longitude , m_date, m_localUTCOffset ); Sun theSun( latitude, longitude , m_date, m_localUTCOffset );
QTime currently = m_time; TQTime currently = m_time;
QTime civilStart = theSun.computeCivilTwilightStart(); TQTime civilStart = theSun.computeCivilTwilightStart();
QTime civilEnd = theSun.computeCivilTwilightEnd(); TQTime civilEnd = theSun.computeCivilTwilightEnd();
kdDebug (12006) << "station, current, lat, lon, start, end, offset: " << kdDebug (12006) << "station, current, lat, lon, start, end, offset: " <<
upperStationID << " " << currently << " " << latitude << " " << upperStationID << " " << currently << " " << latitude << " " <<
@ -859,9 +859,9 @@ bool MetarParser::isNight(const QString &stationID) const
} }
} }
QString MetarParser::iconName( const QString &icon ) const TQString MetarParser::iconName( const TQString &icon ) const
{ {
QString _iconName = icon; TQString _iconName = icon;
if ( isNight( weatherInfo.reportLocation ) ) if ( isNight( weatherInfo.reportLocation ) )
_iconName += "_night"; _iconName += "_night";

@ -22,35 +22,35 @@ email : jratke@comcast.net
#include <klocale.h> #include <klocale.h>
#include <krfcdate.h> #include <krfcdate.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <qregexp.h> #include <tqregexp.h>
#include <qstringlist.h> #include <tqstringlist.h>
class StationDatabase; class StationDatabase;
struct WeatherInfo struct WeatherInfo
{ {
/** The current weather state outside */ /** The current weather state outside */
QString theWeather; TQString theWeather;
int clouds; int clouds;
float windMPH; float windMPH;
float tempC; float tempC;
float dewC; float dewC;
bool heavy; bool heavy;
QStringList qsCoverList; TQStringList qsCoverList;
QStringList qsCurrentList; TQStringList qsCurrentList;
QDate qsDate; TQDate qsDate;
QString qsPressure; TQString qsPressure;
QString qsTemperature; TQString qsTemperature;
QString qsDewPoint; TQString qsDewPoint;
QString qsRelHumidity; TQString qsRelHumidity;
QTime qsTime; TQTime qsTime;
QString qsVisibility; TQString qsVisibility;
QString qsWindSpeed; TQString qsWindSpeed;
QString qsWindChill; TQString qsWindChill;
QString qsHeatIndex; TQString qsHeatIndex;
QString qsWindDirection; TQString qsWindDirection;
QString reportLocation; TQString reportLocation;
bool stationNeedsMaintenance; bool stationNeedsMaintenance;
}; };
@ -60,8 +60,8 @@ class MetarParser
public: public:
MetarParser(StationDatabase *stationDB, MetarParser(StationDatabase *stationDB,
KLocale::MeasureSystem units = KLocale::Imperial, KLocale::MeasureSystem units = KLocale::Imperial,
QDate date = QDate::currentDate(), TQDate date = TQDate::currentDate(),
QTime time = QTime::currentTime(), TQTime time = TQTime::currentTime(),
unsigned int localUTCOffset = KRFCDate::localUTCOffset()); unsigned int localUTCOffset = KRFCDate::localUTCOffset());
/* /*
@ -73,26 +73,26 @@ class MetarParser
* latitude and longitude to calculate the sunrise and sunset time to see if * latitude and longitude to calculate the sunrise and sunset time to see if
* the day or night icon should be used. * the day or night icon should be used.
*/ */
struct WeatherInfo processData(const QString &stationID, const QString &metar); struct WeatherInfo processData(const TQString &stationID, const TQString &metar);
private: private:
bool parseCover(const QString &s); bool parseCover(const TQString &s);
bool parseCurrent(const QString &s); bool parseCurrent(const TQString &s);
bool parseTemperature(const QString &s); bool parseTemperature(const TQString &s);
bool parseTemperatureTenths(const QString &s); bool parseTemperatureTenths(const TQString &s);
void calcTemperatureVariables(); void calcTemperatureVariables();
void removeTrailingDotZero(QString &string); void removeTrailingDotZero(TQString &string);
bool parseDate(const QString &s); bool parseDate(const TQString &s);
bool parseTime(const QString &s); bool parseTime(const TQString &s);
bool parseVisibility(QStringList::ConstIterator it); bool parseVisibility(TQStringList::ConstIterator it);
bool parsePressure( const QString &s ); bool parsePressure( const TQString &s );
QString parseWindDirection(const unsigned int direction); TQString parseWindDirection(const unsigned int direction);
bool parseWindSpeed(const QString &s); bool parseWindSpeed(const TQString &s);
bool parseStationNeedsMaintenance(const QString &s); bool parseStationNeedsMaintenance(const TQString &s);
void calcCurrentIcon(); void calcCurrentIcon();
void calcWindChill(); void calcWindChill();
bool isNight(const QString &stationID) const; bool isNight(const TQString &stationID) const;
QString iconName( const QString &icon ) const; TQString iconName( const TQString &icon ) const;
/* /*
* Reset the internal WeatherInfo struct of the class so that * Reset the internal WeatherInfo struct of the class so that
@ -102,22 +102,22 @@ class MetarParser
StationDatabase* const m_stationDb; StationDatabase* const m_stationDb;
const KLocale::MeasureSystem m_units; const KLocale::MeasureSystem m_units;
const QDate m_date; const TQDate m_date;
const QTime m_time; const TQTime m_time;
const unsigned int m_localUTCOffset; const unsigned int m_localUTCOffset;
struct WeatherInfo weatherInfo; struct WeatherInfo weatherInfo;
QRegExp CoverRegExp; TQRegExp CoverRegExp;
QRegExp CurrentRegExp; TQRegExp CurrentRegExp;
QRegExp WindRegExp; TQRegExp WindRegExp;
QRegExp VisRegExp; TQRegExp VisRegExp;
QRegExp VisFracRegExp; TQRegExp VisFracRegExp;
QRegExp TempRegExp; TQRegExp TempRegExp;
QRegExp TimeRegExp; TQRegExp TimeRegExp;
QRegExp DateRegExp; TQRegExp DateRegExp;
QRegExp PressRegExp; TQRegExp PressRegExp;
QRegExp TempTenRegExp; TQRegExp TempTenRegExp;
}; };
#endif #endif

@ -21,9 +21,9 @@
#include <iostream> #include <iostream>
using namespace std; using namespace std;
#include <qdatetime.h> #include <tqdatetime.h>
#include <qfile.h> #include <tqfile.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <krfcdate.h> #include <krfcdate.h>
@ -34,7 +34,7 @@ void test1();
void test2(); void test2();
void displayWeatherInfo(const struct WeatherInfo &wi); void displayWeatherInfo(const struct WeatherInfo &wi);
const char *getString(const QString &str); const char *getString(const TQString &str);
int localUTCOffset = -300; int localUTCOffset = -300;
@ -47,9 +47,9 @@ int main()
bool found = false; bool found = false;
// try the stations.dat file in the current directory first. // try the stations.dat file in the current directory first.
QString path("stations.dat"); TQString path("stations.dat");
if (QFile::exists(path)) if (TQFile::exists(path))
{ {
found = true; found = true;
} }
@ -61,10 +61,10 @@ int main()
// means that make install would have had to be done first before calling // means that make install would have had to be done first before calling
// make check so that the file will be there. // make check so that the file will be there.
QString kdeDirs(getenv("KDEDIR")); TQString kdeDirs(getenv("KDEDIR"));
path = kdeDirs + "/share/apps/kweatherservice/stations.dat"; path = kdeDirs + "/share/apps/kweatherservice/stations.dat";
if (QFile::exists(path)) if (TQFile::exists(path))
{ {
found = true; found = true;
} }
@ -100,8 +100,8 @@ int main()
void test1() void test1()
{ {
QDate Date(2004, 6, 17); // June 17th. TQDate Date(2004, 6, 17); // June 17th.
QTime Time(21, 7); // hours, minutes, seconds and ms defaults to 0 TQTime Time(21, 7); // hours, minutes, seconds and ms defaults to 0
// Construct a MetarParser object for our tests. // Construct a MetarParser object for our tests.
MetarParser parser( stationDb, KLocale::Imperial, Date, Time, localUTCOffset ); MetarParser parser( stationDb, KLocale::Imperial, Date, Time, localUTCOffset );
@ -134,8 +134,8 @@ void test1()
void test2() void test2()
{ {
QDate Date(2004, 6, 18); // June 18th. TQDate Date(2004, 6, 18); // June 18th.
QTime Time(18, 43); // hours, minutes, seconds and ms defaults to 0 TQTime Time(18, 43); // hours, minutes, seconds and ms defaults to 0
// Construct a MetarParser object for our tests. // Construct a MetarParser object for our tests.
MetarParser parser( stationDb, KLocale::Imperial, Date, Time, localUTCOffset ); MetarParser parser( stationDb, KLocale::Imperial, Date, Time, localUTCOffset );
@ -176,13 +176,13 @@ void displayWeatherInfo(const struct WeatherInfo &wi)
cout << "heavy: " << wi.heavy << endl; cout << "heavy: " << wi.heavy << endl;
unsigned int i = 0; unsigned int i = 0;
for ( QStringList::ConstIterator it = wi.qsCoverList.begin(); for ( TQStringList::ConstIterator it = wi.qsCoverList.begin();
it != wi.qsCoverList.end(); it != wi.qsCoverList.end();
++it, i++ ) { ++it, i++ ) {
cout << "qsCoverList[" << i << "]: " << (*it).latin1() << endl; cout << "qsCoverList[" << i << "]: " << (*it).latin1() << endl;
} }
i = 0; i = 0;
for ( QStringList::ConstIterator it = wi.qsCurrentList.begin(); for ( TQStringList::ConstIterator it = wi.qsCurrentList.begin();
it != wi.qsCurrentList.end(); it != wi.qsCurrentList.end();
++it, i++ ) { ++it, i++ ) {
cout << "qsCurrentList[" << i << "]: " << (*it).latin1() << endl; cout << "qsCurrentList[" << i << "]: " << (*it).latin1() << endl;
@ -205,7 +205,7 @@ void displayWeatherInfo(const struct WeatherInfo &wi)
static const char *nullString = "[null]"; static const char *nullString = "[null]";
const char *getString(const QString &str) const char *getString(const TQString &str)
{ {
if (str.isNull()) if (str.isNull())
{ {

@ -41,18 +41,18 @@ extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
DCOPClient *client = app.dcopClient(); DCOPClient *client = app.dcopClient();
client->attach(); client->attach();
QString error; TQString error;
if (!client->isApplicationRegistered("KWeatherService")) if (!client->isApplicationRegistered("KWeatherService"))
{ {
if (KApplication::startServiceByDesktopName("kweatherservice", if (KApplication::startServiceByDesktopName("kweatherservice",
QStringList(), &error)) TQStringList(), &error))
{ {
kdDebug() << "Starting kweatherservice failed: " << error << endl; kdDebug() << "Starting kweatherservice failed: " << error << endl;
return -2; return -2;
} }
} }
QString reportLocation = args->arg( 0 ); TQString reportLocation = args->arg( 0 );
reportView *report = new reportView(reportLocation); reportView *report = new reportView(reportLocation);
args->clear(); args->clear();
report->exec(); report->exec();

@ -23,30 +23,30 @@
#include <khtmlview.h> #include <khtmlview.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <qvbox.h> #include <tqvbox.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qapplication.h> #include <tqapplication.h>
#include "reportview.h" #include "reportview.h"
#include "weatherservice_stub.h" #include "weatherservice_stub.h"
reportView::reportView(const QString &reportLocation) reportView::reportView(const TQString &reportLocation)
: KDialogBase( (QWidget *)0, "report", false, QString::null, Close ), : KDialogBase( (TQWidget *)0, "report", false, TQString::null, Close ),
m_locationCode(reportLocation) m_locationCode(reportLocation)
{ {
QVBox *vbox = makeVBoxMainWidget(); TQVBox *vbox = makeVBoxMainWidget();
m_reportView = new KHTMLPart(vbox, "m_reportView"); m_reportView = new KHTMLPart(vbox, "m_reportView");
KConfig config( "weather_panelappletrc" ); KConfig config( "weather_panelappletrc" );
config.setGroup( "General Options" ); config.setGroup( "General Options" );
QSize defaultSize( 450, 325 ); TQSize defaultSize( 450, 325 );
resize( config.readSizeEntry( "reportview_size", &defaultSize ) ); resize( config.readSizeEntry( "reportview_size", &defaultSize ) );
centerOnScreen( this ); centerOnScreen( this );
m_weatherService = new WeatherService_stub( "KWeatherService", "WeatherService" ); m_weatherService = new WeatherService_stub( "KWeatherService", "WeatherService" );
QPixmap icon = m_weatherService->icon( m_locationCode ); TQPixmap icon = m_weatherService->icon( m_locationCode );
setIcon( icon ); setIcon( icon );
render(); render();
@ -55,7 +55,7 @@ reportView::reportView(const QString &reportLocation)
reportView::~reportView(){ reportView::~reportView(){
delete m_weatherService; delete m_weatherService;
// we do not have to delete m_reportView because this class is // we do not have to delete m_reportView because this class is
// the parent of the QVBox, and that is the parent of the KHTMLPart. // the parent of the TQVBox, and that is the parent of the KHTMLPart.
KConfig config( "weather_panelappletrc" ); KConfig config( "weather_panelappletrc" );
config.setGroup( "General Options" ); config.setGroup( "General Options" );
@ -64,76 +64,76 @@ reportView::~reportView(){
/** Render the document */ /** Render the document */
void reportView::render(){ void reportView::render(){
QFont generalFont = KGlobalSettings::generalFont(); TQFont generalFont = KGlobalSettings::generalFont();
QString fntFamily = generalFont.family(); TQString fntFamily = generalFont.family();
int fntSize = generalFont.pointSize(); int fntSize = generalFont.pointSize();
if (fntSize == -1) if (fntSize == -1)
fntSize = QFontInfo(generalFont).pointSize(); fntSize = TQFontInfo(generalFont).pointSize();
QString textColor = KGlobalSettings::textColor().name(); TQString textColor = KGlobalSettings::textColor().name();
QString baseColor = KGlobalSettings::baseColor().name(); TQString baseColor = KGlobalSettings::baseColor().name();
QColorGroup cg = palette().active(); TQColorGroup cg = palette().active();
QString bgColor = cg.background().name(); TQString bgColor = cg.background().name();
QString hlColor = cg.highlight().name(); TQString hlColor = cg.highlight().name();
QString hlTextColor = cg.highlightedText().name(); TQString hlTextColor = cg.highlightedText().name();
QString locationName = m_weatherService->stationName(m_locationCode); TQString locationName = m_weatherService->stationName(m_locationCode);
QString countryName = m_weatherService->stationCountry(m_locationCode); TQString countryName = m_weatherService->stationCountry(m_locationCode);
QString temp = m_weatherService->temperature(m_locationCode); TQString temp = m_weatherService->temperature(m_locationCode);
QString dewPoint = m_weatherService->dewPoint( m_locationCode); TQString dewPoint = m_weatherService->dewPoint( m_locationCode);
QString relHumidity = m_weatherService->relativeHumidity(m_locationCode ); TQString relHumidity = m_weatherService->relativeHumidity(m_locationCode );
QString heatIndex = m_weatherService->heatIndex(m_locationCode ); TQString heatIndex = m_weatherService->heatIndex(m_locationCode );
QString windChill = m_weatherService->windChill(m_locationCode ); TQString windChill = m_weatherService->windChill(m_locationCode );
QString pressure = m_weatherService->pressure(m_locationCode ); TQString pressure = m_weatherService->pressure(m_locationCode );
QString wind = m_weatherService->wind(m_locationCode ); TQString wind = m_weatherService->wind(m_locationCode );
QString sunRiseTime = m_weatherService->sunRiseTime(m_locationCode ); TQString sunRiseTime = m_weatherService->sunRiseTime(m_locationCode );
QString sunSetTime = m_weatherService->sunSetTime(m_locationCode ); TQString sunSetTime = m_weatherService->sunSetTime(m_locationCode );
QString date = m_weatherService->date(m_locationCode ); TQString date = m_weatherService->date(m_locationCode );
QString icon = m_weatherService->iconFileName(m_locationCode ); TQString icon = m_weatherService->iconFileName(m_locationCode );
QStringList cover = m_weatherService->cover(m_locationCode ); TQStringList cover = m_weatherService->cover(m_locationCode );
QStringList weather = m_weatherService->weather(m_locationCode ); TQStringList weather = m_weatherService->weather(m_locationCode );
setCaption(i18n("Weather Report - %1").arg( locationName ) ); setCaption(i18n("Weather Report - %1").arg( locationName ) );
QString weatherText = "<ul>\n"; TQString weatherText = "<ul>\n";
if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) ) if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) )
{ {
weatherText += "<li>" + i18n( "Station reports that it needs maintenance" ) + " \n"; weatherText += "<li>" + i18n( "Station reports that it needs maintenance" ) + " \n";
} }
for (QStringList::const_iterator it = cover.begin(); for (TQStringList::const_iterator it = cover.begin();
it != cover.end(); ++it) it != cover.end(); ++it)
weatherText += "<li>" + *it + "\n"; weatherText += "<li>" + *it + "\n";
for (QStringList::const_iterator it = weather.begin(); for (TQStringList::const_iterator it = weather.begin();
it != weather.end(); ++it) it != weather.end(); ++it)
weatherText += "<li>" + *it + "\n"; weatherText += "<li>" + *it + "\n";
weatherText += "</ul>\n"; weatherText += "</ul>\n";
QString contents = TQString contents =
"<html><head><style type=\"text/css\">" + "<html><head><style type=\"text/css\">" +
QString("body { font-family: \"%1\"; font-size: %2pt; color: %3; background-color: %4; }\n") TQString("body { font-family: \"%1\"; font-size: %2pt; color: %3; background-color: %4; }\n")
.arg(fntFamily).arg(fntSize).arg(textColor).arg(baseColor) + .arg(fntFamily).arg(fntSize).arg(textColor).arg(baseColor) +
QString("div.headerTitle { background-color: %1; color: %2; padding: 4px; font-size: 120%; border: solid %3 1px; }\n") TQString("div.headerTitle { background-color: %1; color: %2; padding: 4px; font-size: 120%; border: solid %3 1px; }\n")
.arg(hlColor).arg(hlTextColor).arg(textColor) + .arg(hlColor).arg(hlTextColor).arg(textColor) +
QString("div.headerMsg { background-color: %1; color: %2; border-bottom: solid %3 1px; " TQString("div.headerMsg { background-color: %1; color: %2; border-bottom: solid %3 1px; "
"border-left: solid %4 1px; border-right: solid %5 1px; margin-bottom: 1em; padding: 2px; }\n") "border-left: solid %4 1px; border-right: solid %5 1px; margin-bottom: 1em; padding: 2px; }\n")
.arg(bgColor).arg(textColor).arg(textColor).arg(textColor).arg(textColor) + .arg(bgColor).arg(textColor).arg(textColor).arg(textColor).arg(textColor) +
QString("</style><title></title></head><body dir=\"%1\">").arg( QApplication::reverseLayout()?"rtl":"ltr") + TQString("</style><title></title></head><body dir=\"%1\">").arg( TQApplication::reverseLayout()?"rtl":"ltr") +
"<div class=\"headerTitle\"><b>" + i18n( "Weather Report - %1 - %2" ).arg( locationName ).arg( countryName ) + "<div class=\"headerTitle\"><b>" + i18n( "Weather Report - %1 - %2" ).arg( locationName ).arg( countryName ) +
"</b></div>\n"; "</b></div>\n";
if ( ! date.isEmpty() ) if ( ! date.isEmpty() )
contents += "<div class=\"headerMsg\"><b>" + i18n( "Latest data from %1" ).arg(date) + "</b></div>\n"; contents += "<div class=\"headerMsg\"><b>" + i18n( "Latest data from %1" ).arg(date) + "</b></div>\n";
contents += QString( contents += TQString(
"<table><tr><td width=\"60\" style=\"text-align: center; border: dotted %1 1px;\">" "<table><tr><td width=\"60\" style=\"text-align: center; border: dotted %1 1px;\">"
"<img width=\"64\" height=\"64\" src=\"%2\" /></td>" "<img width=\"64\" height=\"64\" src=\"%2\" /></td>"
"<td style=\"vertical-align: top\">%3</td></tr>") "<td style=\"vertical-align: top\">%3</td></tr>")
.arg(bgColor).arg(KURL(icon).url()).arg(weatherText) + .arg(bgColor).arg(KURL(icon).url()).arg(weatherText) +
"</table><table>" + "</table><table>" +
QString("<tr><th style=\"text-align: right\">" + i18n( "Temperature:" ) TQString("<tr><th style=\"text-align: right\">" + i18n( "Temperature:" )
+ "</th><td>%1</td>" + "</th><td>%1</td>"
"<td width=\"50\">&nbsp;</td>" "<td width=\"50\">&nbsp;</td>"
"<th style=\"text-align: right\">" + i18n( "Dew Point:" ) "<th style=\"text-align: right\">" + i18n( "Dew Point:" )
@ -149,16 +149,16 @@ void reportView::render(){
.arg(wind) + "<td width=\"50\">&nbsp;</td>"; .arg(wind) + "<td width=\"50\">&nbsp;</td>";
if (!heatIndex.isEmpty()) if (!heatIndex.isEmpty())
contents += QString("<th style=\"text-align: right\">" contents += TQString("<th style=\"text-align: right\">"
+ i18n( "Heat Index:" ) + "</th><td>%1</td>").arg(heatIndex); + i18n( "Heat Index:" ) + "</th><td>%1</td>").arg(heatIndex);
else if (!windChill.isEmpty()) else if (!windChill.isEmpty())
contents += QString("<th style=\"text-align: right\">" contents += TQString("<th style=\"text-align: right\">"
+ i18n( "Wind Chill:" ) + "</th><td>%1</td>").arg(windChill); + i18n( "Wind Chill:" ) + "</th><td>%1</td>").arg(windChill);
else else
contents += "<td>&nbsp;</td><td>&nbsp;</td>"; contents += "<td>&nbsp;</td><td>&nbsp;</td>";
contents += "</tr>"; contents += "</tr>";
contents += QString("<tr><th style=\"text-align: right\">" contents += TQString("<tr><th style=\"text-align: right\">"
+ i18n( "Sunrise:" ) + "</th><td>%1</td>" + + i18n( "Sunrise:" ) + "</th><td>%1</td>" +
"<td width=\"50\">&nbsp;</td><th style=\"text-align: right\">" "<td width=\"50\">&nbsp;</td><th style=\"text-align: right\">"
+ i18n( "Sunset:" ) + "</th><td>%2</td>") + i18n( "Sunset:" ) + "</th><td>%2</td>")
@ -170,7 +170,7 @@ void reportView::render(){
m_reportView->write( contents ); m_reportView->write( contents );
m_reportView->end(); m_reportView->end();
QScrollView *view = m_reportView->view(); TQScrollView *view = m_reportView->view();
kdDebug() << "Size " << view->size().height() << "," << view->size().width() << endl; kdDebug() << "Size " << view->size().height() << "," << view->size().width() << endl;
kdDebug() << "Size " << view->visibleHeight() << "," << view->visibleWidth() << endl; kdDebug() << "Size " << view->visibleHeight() << "," << view->visibleWidth() << endl;

@ -19,7 +19,7 @@
#define REPORTVIEW_H #define REPORTVIEW_H
#include <kdialogbase.h> #include <kdialogbase.h>
#include <qstringlist.h> #include <tqstringlist.h>
class KHTMLPart; class KHTMLPart;
@ -33,7 +33,7 @@ class reportView : public KDialogBase {
Q_OBJECT Q_OBJECT
public: public:
reportView(const QString &reportLocation); reportView(const TQString &reportLocation);
~reportView(); ~reportView();
void render(); void render();
@ -41,7 +41,7 @@ public:
private: private:
WeatherService_stub *m_weatherService; WeatherService_stub *m_weatherService;
KHTMLPart *m_reportView; KHTMLPart *m_reportView;
QString m_locationCode; TQString m_locationCode;
}; };
#endif #endif

@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include <qimage.h> #include <tqimage.h>
#include <qheader.h> #include <tqheader.h>
#include <dcopclient.h> #include <dcopclient.h>
#include <dcopref.h> #include <dcopref.h>
@ -37,30 +37,30 @@
class StationItem : public QListViewItem class StationItem : public QListViewItem
{ {
public: public:
StationItem( QListView *view, const QString &name, const QString &uid ) StationItem( TQListView *view, const TQString &name, const TQString &uid )
: QListViewItem( view, name ), mUID( uid ) : TQListViewItem( view, name ), mUID( uid )
{ {
} }
StationItem( QListViewItem *item, const QString &name, const QString &uid ) StationItem( TQListViewItem *item, const TQString &name, const TQString &uid )
: QListViewItem( item, name ), mUID( uid ) : TQListViewItem( item, name ), mUID( uid )
{ {
} }
QString uid() const { return mUID; } TQString uid() const { return mUID; }
private: private:
QString mUID; TQString mUID;
}; };
static void parseStationEntry( const QString &line, QString &name, QString &uid ); static void parseStationEntry( const TQString &line, TQString &name, TQString &uid );
ServiceConfigWidget::ServiceConfigWidget( QWidget *parent, const char *name ) ServiceConfigWidget::ServiceConfigWidget( TQWidget *parent, const char *name )
: wsPrefs( parent, name ), mService(0) : wsPrefs( parent, name ), mService(0)
{ {
mService = new WeatherService_stub( "KWeatherService", "WeatherService" ); mService = new WeatherService_stub( "KWeatherService", "WeatherService" );
connect( mAllStations, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ), SLOT( addStation() ) ); connect( mAllStations, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ), TQT_SLOT( addStation() ) );
connect( mSelectedStations, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ), SLOT( removeStation() ) ); connect( mSelectedStations, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ), TQT_SLOT( removeStation() ) );
initGUI(); initGUI();
loadLocations(); loadLocations();
@ -125,16 +125,16 @@ void ServiceConfigWidget::scanStations()
if ( !dcopActive() ) if ( !dcopActive() )
return; return;
QStringList list = mService->listStations( ); TQStringList list = mService->listStations( );
mSelectedStations->clear(); mSelectedStations->clear();
for ( uint i = 0; i < list.count(); ++i ) { for ( uint i = 0; i < list.count(); ++i ) {
QPixmap pm = mService->icon( list[ i ] ); TQPixmap pm = mService->icon( list[ i ] );
QImage img = pm.convertToImage(); TQImage img = pm.convertToImage();
img = img.smoothScale( 22, 22 ); img = img.smoothScale( 22, 22 );
pm.convertFromImage( img ); pm.convertFromImage( img );
QString uid = list[ i ]; TQString uid = list[ i ];
if (mStationMap[ uid ].isEmpty()) if (mStationMap[ uid ].isEmpty())
{ {
mStationMap[ uid ] = uid; mStationMap[ uid ] = uid;
@ -145,7 +145,7 @@ void ServiceConfigWidget::scanStations()
} }
} }
void ServiceConfigWidget::selectionChanged( QListViewItem *item ) void ServiceConfigWidget::selectionChanged( TQListViewItem *item )
{ {
mRemoveButton->setEnabled( item != 0 ); mRemoveButton->setEnabled( item != 0 );
} }
@ -166,34 +166,34 @@ void ServiceConfigWidget::loadLocations()
KConfig config( locate( "data", "kweatherservice/weather_stations.desktop" ) ); KConfig config( locate( "data", "kweatherservice/weather_stations.desktop" ) );
config.setGroup( "Main" ); config.setGroup( "Main" );
QStringList regions = QStringList::split( ' ', config.readEntry( "regions" ) ); TQStringList regions = TQStringList::split( ' ', config.readEntry( "regions" ) );
QStringList::ConstIterator regionIt; TQStringList::ConstIterator regionIt;
for ( regionIt = regions.begin(); regionIt != regions.end(); ++regionIt ) { for ( regionIt = regions.begin(); regionIt != regions.end(); ++regionIt ) {
config.setGroup( *regionIt ); config.setGroup( *regionIt );
QString name = config.readEntry( "name" ); TQString name = config.readEntry( "name" );
QStringList states = config.readListEntry( "states", ' ' ); TQStringList states = config.readListEntry( "states", ' ' );
QListViewItem *regionItem = new QListViewItem( mAllStations, name ); TQListViewItem *regionItem = new TQListViewItem( mAllStations, name );
regionItem->setSelectable( false ); regionItem->setSelectable( false );
QStringList::ConstIterator stateIt; TQStringList::ConstIterator stateIt;
for ( stateIt = states.begin(); stateIt != states.end(); ++stateIt ) { for ( stateIt = states.begin(); stateIt != states.end(); ++stateIt ) {
config.setGroup( *regionIt + "_" + *stateIt ); config.setGroup( *regionIt + "_" + *stateIt );
QString name = config.readEntry( "name" ); TQString name = config.readEntry( "name" );
QListViewItem *stateItem = new QListViewItem( regionItem, name ); TQListViewItem *stateItem = new TQListViewItem( regionItem, name );
stateItem->setSelectable( false ); stateItem->setSelectable( false );
QMap<QString, QString> entries = config.entryMap( *regionIt + "_" + *stateIt ); TQMap<TQString, TQString> entries = config.entryMap( *regionIt + "_" + *stateIt );
QMap<QString, QString>::ConstIterator entryIt; TQMap<TQString, TQString>::ConstIterator entryIt;
for ( entryIt = entries.begin(); entryIt != entries.end(); ++entryIt ) { for ( entryIt = entries.begin(); entryIt != entries.end(); ++entryIt ) {
if ( entryIt.key() != "name" ) { if ( entryIt.key() != "name" ) {
QString station, uid; TQString station, uid;
// get station and uid from the data // get station and uid from the data
parseStationEntry( entryIt.data(), station, uid ); parseStationEntry( entryIt.data(), station, uid );
new StationItem( stateItem, station, uid ); new StationItem( stateItem, station, uid );
mStationMap.insert( uid, QString( "%1, %2" ) mStationMap.insert( uid, TQString( "%1, %2" )
.arg( station ).arg( *stateIt ) ); .arg( station ).arg( *stateIt ) );
} }
} }
@ -203,21 +203,21 @@ void ServiceConfigWidget::loadLocations()
bool ServiceConfigWidget::dcopActive() bool ServiceConfigWidget::dcopActive()
{ {
QString error; TQString error;
QCString appID; TQCString appID;
bool isGood = true; bool isGood = true;
DCOPClient *client = kapp->dcopClient(); DCOPClient *client = kapp->dcopClient();
if ( !client->isApplicationRegistered( "KWeatherService" ) ) { if ( !client->isApplicationRegistered( "KWeatherService" ) ) {
if ( KApplication::startServiceByDesktopName( "kweatherservice", QStringList(), &error, &appID ) ) if ( KApplication::startServiceByDesktopName( "kweatherservice", TQStringList(), &error, &appID ) )
isGood = false; isGood = false;
} }
return isGood; return isGood;
} }
void parseStationEntry( const QString &line, QString &name, QString &uid ) void parseStationEntry( const TQString &line, TQString &name, TQString &uid )
{ {
QStringList list = QStringList::split( ' ', line ); TQStringList list = TQStringList::split( ' ', line );
bool inName = true; bool inName = true;

@ -30,7 +30,7 @@ class ServiceConfigWidget : public wsPrefs
Q_OBJECT Q_OBJECT
public: public:
ServiceConfigWidget( QWidget *parent, const char *name = 0 ); ServiceConfigWidget( TQWidget *parent, const char *name = 0 );
virtual ~ServiceConfigWidget(); virtual ~ServiceConfigWidget();
signals: signals:
@ -42,7 +42,7 @@ class ServiceConfigWidget : public wsPrefs
void updateStations(); void updateStations();
void exitWeatherService(); void exitWeatherService();
void selectionChanged( QListViewItem* ); void selectionChanged( TQListViewItem* );
void modified(); void modified();
private: private:
@ -51,7 +51,7 @@ class ServiceConfigWidget : public wsPrefs
bool dcopActive(); bool dcopActive();
void scanStations(); void scanStations();
QMap<QString, QString> mStationMap; TQMap<TQString, TQString> mStationMap;
WeatherService_stub *mService; WeatherService_stub *mService;
}; };

@ -20,14 +20,14 @@
*/ */
#include "sidebarwidget.h" #include "sidebarwidget.h"
#include <qscrollview.h> #include <tqscrollview.h>
sidebarwidget::sidebarwidget(QWidget* parent, const char* name) : sidebarwidget::sidebarwidget(TQWidget* parent, const char* name) :
sidebarwidgetbase(parent,name) sidebarwidgetbase(parent,name)
{ {
view = new QVBox(reportGrid->viewport()); view = new TQVBox(reportGrid->viewport());
reportGrid->addChild(view); reportGrid->addChild(view);
reportGrid->setResizePolicy(QScrollView::AutoOneFit); reportGrid->setResizePolicy(TQScrollView::AutoOneFit);
} }
sidebarwidget::~sidebarwidget() sidebarwidget::~sidebarwidget()
@ -35,12 +35,12 @@
} }
void sidebarwidget::addWidget(QWidget *w, const QString &s) void sidebarwidget::addWidget(TQWidget *w, const TQString &s)
{ {
w->setFixedWidth(reportGrid->visibleWidth ()); w->setFixedWidth(reportGrid->visibleWidth ());
} }
QWidget *sidebarwidget::viewport() TQWidget *sidebarwidget::viewport()
{ {
return view; return view;
} }

@ -24,17 +24,17 @@
#include <sidebarwidgetbase.h> #include <sidebarwidgetbase.h>
#include <qvbox.h> #include <tqvbox.h>
class sidebarwidget : public sidebarwidgetbase class sidebarwidget : public sidebarwidgetbase
{ {
Q_OBJECT Q_OBJECT
public: public:
sidebarwidget(QWidget* parent, const char* name = 0); sidebarwidget(TQWidget* parent, const char* name = 0);
virtual ~sidebarwidget(); virtual ~sidebarwidget();
void addWidget(QWidget *w, const QString &s); void addWidget(TQWidget *w, const TQString &s);
QWidget *viewport(); TQWidget *viewport();
QVBox *view; TQVBox *view;
}; };

@ -12,21 +12,21 @@
// //
#include "stationdatabase.h" #include "stationdatabase.h"
#include <qstringlist.h> #include <tqstringlist.h>
#include <qfile.h> #include <tqfile.h>
#include <kdebug.h> #include <kdebug.h>
class StationInfo class StationInfo
{ {
public: public:
QString cityName; TQString cityName;
QString country; TQString country;
QString longitude; TQString longitude;
QString latitude; TQString latitude;
StationInfo () {} StationInfo () {}
}; };
StationDatabase::StationDatabase(const QString path) : mPath(path) StationDatabase::StationDatabase(const TQString path) : mPath(path)
{ {
} }
@ -35,21 +35,21 @@ StationDatabase::~StationDatabase()
{ {
} }
bool StationDatabase::loadStation( const QString & stationID ) bool StationDatabase::loadStation( const TQString & stationID )
{ {
QFile file( mPath ); TQFile file( mPath );
bool found = FALSE; bool found = FALSE;
if ( !file.open( IO_ReadOnly ) ) if ( !file.open( IO_ReadOnly ) )
return false; return false;
QTextStream stream( &file ); TQTextStream stream( &file );
stream.setEncoding( QTextStream::UnicodeUTF8 ); stream.setEncoding( TQTextStream::UnicodeUTF8 );
QString line; TQString line;
while ( !stream.eof() ) while ( !stream.eof() )
{ {
line = stream.readLine(); // line of text excluding '\n' line = stream.readLine(); // line of text excluding '\n'
QStringList data = QStringList::split( ";", line, true ); TQStringList data = TQStringList::split( ";", line, true );
if ( data[ 0 ].stripWhiteSpace() == stationID ) if ( data[ 0 ].stripWhiteSpace() == stationID )
{ {
@ -70,11 +70,11 @@ bool StationDatabase::loadStation( const QString & stationID )
} }
/*! /*!
\fn StationDatabase::stationNameFromID(const QString& id) \fn StationDatabase::stationNameFromID(const TQString& id)
*/ */
QString StationDatabase::stationNameFromID( const QString & stationID ) TQString StationDatabase::stationNameFromID( const TQString & stationID )
{ {
QString result; TQString result;
if ( theDB.find( stationID ) == theDB.end() ) if ( theDB.find( stationID ) == theDB.end() )
{ {
@ -92,11 +92,11 @@ QString StationDatabase::stationNameFromID( const QString & stationID )
} }
/*! /*!
\fn StationDatabase::stationLongitudeFromID( const QString &stationID) \fn StationDatabase::stationLongitudeFromID( const TQString &stationID)
*/ */
QString StationDatabase::stationLongitudeFromID( const QString & stationID ) TQString StationDatabase::stationLongitudeFromID( const TQString & stationID )
{ {
QString result; TQString result;
if ( theDB.find( stationID ) == theDB.end() ) if ( theDB.find( stationID ) == theDB.end() )
{ {
@ -114,11 +114,11 @@ QString StationDatabase::stationLongitudeFromID( const QString & stationID )
} }
/*! /*!
\fn StationDatabase::stationLatitudeFromID(const QString &stationID) \fn StationDatabase::stationLatitudeFromID(const TQString &stationID)
*/ */
QString StationDatabase::stationLatitudeFromID( const QString & stationID ) TQString StationDatabase::stationLatitudeFromID( const TQString & stationID )
{ {
QString result; TQString result;
if ( theDB.find( stationID ) == theDB.end() ) if ( theDB.find( stationID ) == theDB.end() )
{ {
@ -136,11 +136,11 @@ QString StationDatabase::stationLatitudeFromID( const QString & stationID )
} }
/*! /*!
\fn StationDatabase::stationCountryFromID( const QString &stationID) \fn StationDatabase::stationCountryFromID( const TQString &stationID)
*/ */
QString StationDatabase::stationCountryFromID( const QString &stationID ) TQString StationDatabase::stationCountryFromID( const TQString &stationID )
{ {
QString result; TQString result;
if ( theDB.find( stationID ) == theDB.end() ) if ( theDB.find( stationID ) == theDB.end() )
{ {
@ -157,9 +157,9 @@ QString StationDatabase::stationCountryFromID( const QString &stationID )
return result; return result;
} }
QString StationDatabase::stationIDfromName( const QString &name ) TQString StationDatabase::stationIDfromName( const TQString &name )
{ {
QMap<QString,StationInfo>::Iterator itr = theDB.begin(); TQMap<TQString,StationInfo>::Iterator itr = theDB.begin();
for( ; itr != theDB.end(); ++itr) for( ; itr != theDB.end(); ++itr)
{ {
kdDebug() << "Checking " << itr.data().cityName << endl; kdDebug() << "Checking " << itr.data().cityName << endl;

@ -13,8 +13,8 @@
#ifndef STATIONDATABASE_H #ifndef STATIONDATABASE_H
#define STATIONDATABASE_H #define STATIONDATABASE_H
#include <qmap.h> #include <tqmap.h>
#include <qstring.h> #include <tqstring.h>
#include <klocale.h> #include <klocale.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
@ -30,25 +30,25 @@ class StationInfo;
class StationDatabase class StationDatabase
{ {
public: public:
StationDatabase(const QString path = locate("data", "kweatherservice/stations.dat")); StationDatabase(const TQString path = locate("data", "kweatherservice/stations.dat"));
~StationDatabase(); ~StationDatabase();
QString stationNameFromID(const QString& id); TQString stationNameFromID(const TQString& id);
QString stationLongitudeFromID( const QString &stationID); TQString stationLongitudeFromID( const TQString &stationID);
QString stationLatitudeFromID(const QString &stationID); TQString stationLatitudeFromID(const TQString &stationID);
QString stationCountryFromID( const QString &stationID); TQString stationCountryFromID( const TQString &stationID);
QString stationIDfromName( const QString &name ); TQString stationIDfromName( const TQString &name );
private: private:
QMap<QString, StationInfo> theDB; TQMap<TQString, StationInfo> theDB;
bool loadStation( const QString & stationID ); bool loadStation( const TQString & stationID );
const QString mPath; const TQString mPath;
}; };
#endif #endif

@ -19,9 +19,9 @@
#include <cstdlib> #include <cstdlib>
using namespace std; using namespace std;
#include <qfile.h> #include <tqfile.h>
#include <qstring.h> #include <tqstring.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <krfcdate.h> #include <krfcdate.h>
#include "stationdatabase.h" #include "stationdatabase.h"
@ -33,9 +33,9 @@ int main()
bool found = false; bool found = false;
// try the stations.dat file in the current directory first. // try the stations.dat file in the current directory first.
QString path("stations.dat"); TQString path("stations.dat");
if (QFile::exists(path)) if (TQFile::exists(path))
{ {
found = true; found = true;
} }
@ -47,10 +47,10 @@ int main()
// means that make install would have had to be done first before calling // means that make install would have had to be done first before calling
// make check so that the file will be there. // make check so that the file will be there.
QString kdeDirs(getenv("KDEDIR")); TQString kdeDirs(getenv("KDEDIR"));
path = kdeDirs + "/share/apps/kweatherservice/stations.dat"; path = kdeDirs + "/share/apps/kweatherservice/stations.dat";
if (QFile::exists(path)) if (TQFile::exists(path))
{ {
found = true; found = true;
} }

@ -54,8 +54,8 @@ static inline double acosd(double x) { return RADEG * acos(x); }
static inline double atan2d(double y, double x) { return RADEG * atan2(y, x); } static inline double atan2d(double y, double x) { return RADEG * atan2(y, x); }
/* Other local functions */ /* Other local functions */
static double latitudeToDouble( const QString &latitude ); static double latitudeToDouble( const TQString &latitude );
static double longitudeToDouble( const QString &longitude ); static double longitudeToDouble( const TQString &longitude );
static int __sunriset__( int year, int month, int day, double lon, double lat, static int __sunriset__( int year, int month, int day, double lon, double lat,
double altit, int upper_limb, double &trise, double &tset ); double altit, int upper_limb, double &trise, double &tset );
static void sunpos( double d, double &lon, double &r ); static void sunpos( double d, double &lon, double &r );
@ -87,7 +87,7 @@ static inline int civil_twilight(int year, int month, int day, double lon, doubl
} }
Sun::Sun(const QString &latitude, const QString &longitude, QDate date, const int localUTCOffset) : Sun::Sun(const TQString &latitude, const TQString &longitude, TQDate date, const int localUTCOffset) :
m_date(date), m_date(date),
m_lat(latitudeToDouble(latitude)), m_lon(longitudeToDouble(longitude)), m_lat(latitudeToDouble(latitude)), m_lon(longitudeToDouble(longitude)),
m_localUTCOffset(localUTCOffset) m_localUTCOffset(localUTCOffset)
@ -95,14 +95,14 @@ Sun::Sun(const QString &latitude, const QString &longitude, QDate date, const in
} }
QTime Sun::computeRiseTime() TQTime Sun::computeRiseTime()
{ {
double riseTime; double riseTime;
double setTime; double setTime;
sun_rise_set( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, riseTime, setTime ); sun_rise_set( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, riseTime, setTime );
QTime result = convertDoubleToLocalTime( riseTime ); TQTime result = convertDoubleToLocalTime( riseTime );
if ( ! result.isValid() ) if ( ! result.isValid() )
result.setHMS( 6, 0, 0 ); result.setHMS( 6, 0, 0 );
@ -111,14 +111,14 @@ QTime Sun::computeRiseTime()
} }
QTime Sun::computeSetTime() TQTime Sun::computeSetTime()
{ {
double riseTime; double riseTime;
double setTime; double setTime;
sun_rise_set( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, riseTime, setTime ); sun_rise_set( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, riseTime, setTime );
QTime result = convertDoubleToLocalTime( setTime ); TQTime result = convertDoubleToLocalTime( setTime );
if ( ! result.isValid() ) if ( ! result.isValid() )
result.setHMS( 19, 0, 0 ); result.setHMS( 19, 0, 0 );
@ -127,14 +127,14 @@ QTime Sun::computeSetTime()
} }
QTime Sun::computeCivilTwilightStart() TQTime Sun::computeCivilTwilightStart()
{ {
double start; double start;
double end; double end;
civil_twilight( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, start, end ); civil_twilight( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, start, end );
QTime result = convertDoubleToLocalTime( start ); TQTime result = convertDoubleToLocalTime( start );
if ( ! result.isValid() ) if ( ! result.isValid() )
result.setHMS( 6, 0, 0 ); result.setHMS( 6, 0, 0 );
@ -143,14 +143,14 @@ QTime Sun::computeCivilTwilightStart()
} }
QTime Sun::computeCivilTwilightEnd() TQTime Sun::computeCivilTwilightEnd()
{ {
double start; double start;
double end; double end;
civil_twilight( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, start, end ); civil_twilight( m_date.year(), m_date.month(), m_date.day(), m_lon, m_lat, start, end );
QTime result = convertDoubleToLocalTime( end ); TQTime result = convertDoubleToLocalTime( end );
if ( ! result.isValid() ) if ( ! result.isValid() )
result.setHMS( 19, 0, 0 ); result.setHMS( 19, 0, 0 );
@ -167,7 +167,7 @@ QTime Sun::computeCivilTwilightEnd()
* *
* Does not currently handle seconds. * Does not currently handle seconds.
*/ */
static double latitudeToDouble( const QString &latitude ) static double latitudeToDouble( const TQString &latitude )
{ {
double result; double result;
@ -183,7 +183,7 @@ static double latitudeToDouble( const QString &latitude )
} }
static double longitudeToDouble( const QString &longitude ) static double longitudeToDouble( const TQString &longitude )
{ {
double result; double result;
@ -199,9 +199,9 @@ static double longitudeToDouble( const QString &longitude )
} }
QTime Sun::convertDoubleToLocalTime( const double time ) TQTime Sun::convertDoubleToLocalTime( const double time )
{ {
QTime result; TQTime result;
// Example: say time is 17.7543 Then hours = 17 and minutes = 0.7543 * 60 = 45.258 // Example: say time is 17.7543 Then hours = 17 and minutes = 0.7543 * 60 = 45.258
// We need to convert the time to CORRECT local hours // We need to convert the time to CORRECT local hours

@ -18,8 +18,8 @@
#ifndef SUN_H #ifndef SUN_H
#define SUN_H #define SUN_H
#include <qstring.h> #include <tqstring.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <krfcdate.h> #include <krfcdate.h>
class Sun class Sun
@ -35,20 +35,20 @@ class Sun
* to the local time zone. * to the local time zone.
* *
*/ */
Sun( const QString &latitude, Sun( const TQString &latitude,
const QString &longitude, const TQString &longitude,
QDate date = QDate::currentDate(), TQDate date = TQDate::currentDate(),
const int localUTCOffset = KRFCDate::localUTCOffset() ); const int localUTCOffset = KRFCDate::localUTCOffset() );
QTime computeRiseTime(); TQTime computeRiseTime();
QTime computeSetTime(); TQTime computeSetTime();
QTime computeCivilTwilightStart(); TQTime computeCivilTwilightStart();
QTime computeCivilTwilightEnd(); TQTime computeCivilTwilightEnd();
private: private:
QTime convertDoubleToLocalTime( const double time ); TQTime convertDoubleToLocalTime( const double time );
const QDate m_date; const TQDate m_date;
const double m_lat; const double m_lat;
const double m_lon; const double m_lon;
const int m_localUTCOffset; const int m_localUTCOffset;

@ -18,8 +18,8 @@
#include <iostream> #include <iostream>
using namespace std; using namespace std;
#include <qstring.h> #include <tqstring.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <krfcdate.h> #include <krfcdate.h>
#include "sun.h" #include "sun.h"
@ -29,16 +29,16 @@ int main()
{ {
bool anyFailed = false; bool anyFailed = false;
QString KUGN_Latitude("42-25N"); TQString KUGN_Latitude("42-25N");
QString KUGN_Longitude("087-52W"); TQString KUGN_Longitude("087-52W");
QDate Date(2004, 6, 1); // June 1st. TQDate Date(2004, 6, 1); // June 1st.
int localUTCOffset = -300; int localUTCOffset = -300;
// Construct a sun object for our tests. // Construct a sun object for our tests.
Sun theSun( KUGN_Latitude, KUGN_Longitude, Date, localUTCOffset ); Sun theSun( KUGN_Latitude, KUGN_Longitude, Date, localUTCOffset );
QTime civilStart = theSun.computeCivilTwilightStart(); TQTime civilStart = theSun.computeCivilTwilightStart();
QTime civilEnd = theSun.computeCivilTwilightEnd(); TQTime civilEnd = theSun.computeCivilTwilightEnd();
cout << "Testing Civil Twilight Calculations..."; cout << "Testing Civil Twilight Calculations...";
// Start should be 04:42:39 End should be 20:56:06 // Start should be 04:42:39 End should be 20:56:06
@ -55,8 +55,8 @@ int main()
cout << "Testing Rise and Set Time Calculations..."; cout << "Testing Rise and Set Time Calculations...";
QTime rise = theSun.computeRiseTime(); TQTime rise = theSun.computeRiseTime();
QTime set = theSun.computeSetTime(); TQTime set = theSun.computeSetTime();
// Rise should be 05:16:35 Set should be 20:22:10 // Rise should be 05:16:35 Set should be 20:22:10
if (rise.hour() == 5 && rise.minute() == 16 && rise.second() == 35 && if (rise.hour() == 5 && rise.minute() == 16 && rise.second() == 35 &&

@ -9,7 +9,7 @@ public:
k_dcop: k_dcop:
/** Cause KWeather to refrsh it's data **/ /** Cause KWeather to refrsh it's data **/
virtual void refresh(QString) = 0; virtual void refresh(TQString) = 0;
}; };
#endif #endif

@ -23,11 +23,11 @@
#include "dockwidget.h" #include "dockwidget.h"
#include "sidebarwidget.h" #include "sidebarwidget.h"
#include <qlabel.h> #include <tqlabel.h>
#include <qfont.h> #include <tqfont.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qscrollview.h> #include <tqscrollview.h>
#include <qgroupbox.h> #include <tqgroupbox.h>
#include <klocale.h> #include <klocale.h>
#include <kdebug.h> #include <kdebug.h>
#include <kconfig.h> #include <kconfig.h>
@ -36,9 +36,9 @@
#include <dcopref.h> #include <dcopref.h>
KonqSidebarWeather::KonqSidebarWeather(KInstance* inst, QObject* parent, KonqSidebarWeather::KonqSidebarWeather(KInstance* inst, TQObject* parent,
QWidget* widgetParent, TQWidget* widgetParent,
QString& desktopName, const char* name) TQString& desktopName, const char* name)
: KonqSidebarPlugin(inst, parent, widgetParent, desktopName, name), : KonqSidebarPlugin(inst, parent, widgetParent, desktopName, name),
DCOPObject(name) DCOPObject(name)
@ -51,8 +51,8 @@ KonqSidebarWeather::KonqSidebarWeather(KInstance* inst, QObject* parent,
kdDebug() << "Get weatherstation list... " << endl; kdDebug() << "Get weatherstation list... " << endl;
if (!connectDCOPSignal(0,0, if (!connectDCOPSignal(0,0,
"fileUpdate(QString)", "fileUpdate(TQString)",
"refresh(QString)",false)) "refresh(TQString)",false))
kdDebug() << "Could not attach signal..." << endl; kdDebug() << "Could not attach signal..." << endl;
else else
kdDebug() << "attached dcop signals..." << endl; kdDebug() << "attached dcop signals..." << endl;
@ -60,7 +60,7 @@ KonqSidebarWeather::KonqSidebarWeather(KInstance* inst, QObject* parent,
DCOPRef dcopCall( "KWeatherService", "WeatherService" ); DCOPRef dcopCall( "KWeatherService", "WeatherService" );
DCOPReply reply = dcopCall.call("listStations()", true ); DCOPReply reply = dcopCall.call("listStations()", true );
if ( reply.isValid() ) { if ( reply.isValid() ) {
QStringList replyList = reply; TQStringList replyList = reply;
for(int i = 0; i < replyList.size(); i++) for(int i = 0; i < replyList.size(); i++)
{ {
dockwidget *d = new dockwidget(m_container->viewport(), replyList[i].latin1()); dockwidget *d = new dockwidget(m_container->viewport(), replyList[i].latin1());
@ -68,13 +68,13 @@ KonqSidebarWeather::KonqSidebarWeather(KInstance* inst, QObject* parent,
d->resizeView(80,48); d->resizeView(80,48);
d->show(); d->show();
m_widgets.insert(replyList[i], d); m_widgets.insert(replyList[i], d);
dcopCall.send("update(QString)", replyList[i]); dcopCall.send("update(TQString)", replyList[i]);
} }
} }
timeOut = new QTimer(this, "timeOut" ); timeOut = new TQTimer(this, "timeOut" );
timeOut->changeInterval(15*60000); timeOut->changeInterval(15*60000);
connect(timeOut, SIGNAL(timeout()), this, SLOT(update())); connect(timeOut, TQT_SIGNAL(timeout()), this, TQT_SLOT(update()));
// m_widgets.append(new dockwidget(widgetParent)); // m_widgets.append(new dockwidget(widgetParent));
} }
@ -83,30 +83,30 @@ KonqSidebarWeather::~KonqSidebarWeather()
{ {
} }
void* KonqSidebarWeather::provides(const QString&) void* KonqSidebarWeather::provides(const TQString&)
{ {
return 0; return 0;
} }
void KonqSidebarWeather::emitStatusBarText(const QString& s) void KonqSidebarWeather::emitStatusBarText(const TQString& s)
{ {
} }
QWidget* KonqSidebarWeather::getWidget() TQWidget* KonqSidebarWeather::getWidget()
{ {
return m_container; return m_container;
} }
void KonqSidebarWeather::refresh(QString stationID) void KonqSidebarWeather::refresh(TQString stationID)
{ {
kdDebug() << "refresh " << stationID << endl; kdDebug() << "refresh " << stationID << endl;
if(m_widgets.find(stationID)) if(m_widgets.find(stationID))
{ {
DCOPRef dcopCall( "KWeatherService", "WeatherService" ); DCOPRef dcopCall( "KWeatherService", "WeatherService" );
m_widgets[stationID]->setWeatherIcon(dcopCall.call("currentIcon(QString)", stationID ,true )); m_widgets[stationID]->setWeatherIcon(dcopCall.call("currentIcon(TQString)", stationID ,true ));
m_widgets[stationID]->setTemperature(dcopCall.call("temperature(QString)", stationID,true )); m_widgets[stationID]->setTemperature(dcopCall.call("temperature(TQString)", stationID,true ));
m_widgets[stationID]->setPressure(dcopCall.call("pressure(QString)", stationID,true )); m_widgets[stationID]->setPressure(dcopCall.call("pressure(TQString)", stationID,true ));
m_widgets[stationID]->setWind(dcopCall.call("wind(QString)", stationID,true )); m_widgets[stationID]->setWind(dcopCall.call("wind(TQString)", stationID,true ));
m_widgets[stationID]->showWeather(); m_widgets[stationID]->showWeather();
} }
else else
@ -131,7 +131,7 @@ void KonqSidebarWeather::update()
DCOPRef dcopCall( "KWeatherService", "WeatherService" ); DCOPRef dcopCall( "KWeatherService", "WeatherService" );
DCOPReply reply = dcopCall.call("listStations()", true ); DCOPReply reply = dcopCall.call("listStations()", true );
if ( reply.isValid() ) { if ( reply.isValid() ) {
QStringList replyList = reply; TQStringList replyList = reply;
for(int i = 0; i < replyList.size(); i++) for(int i = 0; i < replyList.size(); i++)
{ {
if(!m_widgets.find(replyList[i])) if(!m_widgets.find(replyList[i]))
@ -141,7 +141,7 @@ void KonqSidebarWeather::update()
d->show(); d->show();
m_widgets.insert(replyList[i], d); m_widgets.insert(replyList[i], d);
} }
dcopCall.send("update(QString)", replyList[i]); dcopCall.send("update(TQString)", replyList[i]);
} }
} }
timeOut->start(15*60000); timeOut->start(15*60000);
@ -149,14 +149,14 @@ void KonqSidebarWeather::update()
extern "C" extern "C"
{ {
KDE_EXPORT void* create_weather_sidebar(KInstance* inst, QObject* par, QWidget*widp, KDE_EXPORT void* create_weather_sidebar(KInstance* inst, TQObject* par, TQWidget*widp,
QString& desktopname, const char* name) TQString& desktopname, const char* name)
{ {
return new KonqSidebarWeather(inst, par, widp, desktopname, name); return new KonqSidebarWeather(inst, par, widp, desktopname, name);
} }
KDE_EXPORT bool add_weather_sidebar(QString* fn, QString* /*param*/, KDE_EXPORT bool add_weather_sidebar(TQString* fn, TQString* /*param*/,
QMap<QString, QString>* map) TQMap<TQString, TQString>* map)
{ {
map->insert("Type","Link"); map->insert("Type","Link");
map->insert("Icon","weather_sidebar"); map->insert("Icon","weather_sidebar");

@ -26,10 +26,10 @@
#include <kparts/part.h> #include <kparts/part.h>
#include <kparts/factory.h> #include <kparts/factory.h>
#include <kparts/browserextension.h> #include <kparts/browserextension.h>
#include <qdict.h> #include <tqdict.h>
#include <dcopobject.h> #include <dcopobject.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qtimer.h> #include <tqtimer.h>
class dockwidget; class dockwidget;
class sidebarwidget; class sidebarwidget;
@ -39,16 +39,16 @@ class KonqSidebarWeather: public KonqSidebarPlugin, virtual public DCOPObject
Q_OBJECT Q_OBJECT
K_DCOP K_DCOP
public: public:
KonqSidebarWeather(KInstance* inst, QObject* parent, QWidget* widgetParent, KonqSidebarWeather(KInstance* inst, TQObject* parent, TQWidget* widgetParent,
QString& desktopName_, const char* name = 0); TQString& desktopName_, const char* name = 0);
~KonqSidebarWeather(); ~KonqSidebarWeather();
virtual void* provides(const QString&); virtual void* provides(const TQString&);
void emitStatusBarText(const QString&); void emitStatusBarText(const TQString&);
virtual QWidget *getWidget(); virtual TQWidget *getWidget();
k_dcop: k_dcop:
virtual void refresh(QString); virtual void refresh(TQString);
protected: protected:
virtual void handleURL(const KURL &url); virtual void handleURL(const KURL &url);
@ -59,9 +59,9 @@ private slots:
void update(); void update();
private: private:
QDict <dockwidget> m_widgets; TQDict <dockwidget> m_widgets;
sidebarwidget *m_container; sidebarwidget *m_container;
QTimer *timeOut; TQTimer *timeOut;
}; };
#endif #endif

@ -19,7 +19,7 @@
#include "weatherbutton.h" #include "weatherbutton.h"
#include <qpainter.h> #include <tqpainter.h>
#include <kapplication.h> #include <kapplication.h>
#include <kcursor.h> #include <kcursor.h>
@ -29,15 +29,15 @@
#include <kipc.h> #include <kipc.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
WeatherButton::WeatherButton( QWidget *parent, const char *name ) WeatherButton::WeatherButton( TQWidget *parent, const char *name )
: QButton( parent, name ), m_highlight( false ) : TQButton( parent, name ), m_highlight( false )
{ {
setBackgroundOrigin( AncestorOrigin ); setBackgroundOrigin( AncestorOrigin );
connect( kapp, SIGNAL( settingsChanged( int ) ), connect( kapp, TQT_SIGNAL( settingsChanged( int ) ),
SLOT( slotSettingsChanged( int ) ) ); TQT_SLOT( slotSettingsChanged( int ) ) );
connect( kapp, SIGNAL( iconChanged( int ) ), connect( kapp, TQT_SIGNAL( iconChanged( int ) ),
SLOT( slotIconChanged( int ) ) ); TQT_SLOT( slotIconChanged( int ) ) );
kapp->addKipcEventMask( KIPC::SettingsChanged ); kapp->addKipcEventMask( KIPC::SettingsChanged );
kapp->addKipcEventMask( KIPC::IconChanged ); kapp->addKipcEventMask( KIPC::IconChanged );
@ -45,19 +45,19 @@ WeatherButton::WeatherButton( QWidget *parent, const char *name )
slotSettingsChanged( KApplication::SETTINGS_MOUSE ); slotSettingsChanged( KApplication::SETTINGS_MOUSE );
} }
void WeatherButton::drawButton( QPainter *p ) void WeatherButton::drawButton( TQPainter *p )
{ {
drawButtonLabel(p); drawButtonLabel(p);
} }
void WeatherButton::drawButtonLabel( QPainter *p ) void WeatherButton::drawButtonLabel( TQPainter *p )
{ {
if (!pixmap()) if (!pixmap())
{ {
return; return;
} }
QPixmap pix = m_highlight? m_activeIcon : m_normalIcon; TQPixmap pix = m_highlight? m_activeIcon : m_normalIcon;
if (isOn() || isDown()) if (isOn() || isDown())
{ {
@ -70,7 +70,7 @@ void WeatherButton::drawButtonLabel( QPainter *p )
int ph = pix.height(); int ph = pix.height();
int pw = pix.width(); int pw = pix.width();
int margin = 3; int margin = 3;
QPoint origin(margin / 2, margin / 2); TQPoint origin(margin / 2, margin / 2);
if (ph < (h - margin)) if (ph < (h - margin))
{ {
@ -86,9 +86,9 @@ void WeatherButton::drawButtonLabel( QPainter *p )
} }
void WeatherButton::setPixmap( const QPixmap &pix ) void WeatherButton::setPixmap( const TQPixmap &pix )
{ {
QButton::setPixmap( pix ); TQButton::setPixmap( pix );
generateIcons(); generateIcons();
} }
@ -97,8 +97,8 @@ void WeatherButton::generateIcons()
if ( !pixmap() ) if ( !pixmap() )
return; return;
QImage image = pixmap()->convertToImage(); TQImage image = pixmap()->convertToImage();
image = image.smoothScale( pixmapSize(), QImage::ScaleMin ); image = image.smoothScale( pixmapSize(), TQImage::ScaleMin );
KIconEffect effect; KIconEffect effect;
@ -127,31 +127,31 @@ void WeatherButton::slotIconChanged( int group )
repaint( false ); repaint( false );
} }
void WeatherButton::enterEvent( QEvent *e ) void WeatherButton::enterEvent( TQEvent *e )
{ {
m_highlight = true; m_highlight = true;
repaint( false ); repaint( false );
QButton::enterEvent( e ); TQButton::enterEvent( e );
} }
void WeatherButton::leaveEvent( QEvent *e ) void WeatherButton::leaveEvent( TQEvent *e )
{ {
m_highlight = false; m_highlight = false;
repaint( false ); repaint( false );
QButton::enterEvent( e ); TQButton::enterEvent( e );
} }
void WeatherButton::resizeEvent( QResizeEvent * ) void WeatherButton::resizeEvent( TQResizeEvent * )
{ {
generateIcons(); generateIcons();
} }
QPoint WeatherButton::pixmapOrigin() const TQPoint WeatherButton::pixmapOrigin() const
{ {
QSize point = margin()/2; TQSize point = margin()/2;
QPoint origin( point.width(), point.height() ); TQPoint origin( point.width(), point.height() );
return origin; return origin;
} }

@ -20,32 +20,32 @@
#ifndef WEATHERBUTTON_H #ifndef WEATHERBUTTON_H
#define WEATHERBUTTON_H #define WEATHERBUTTON_H
#include <qbutton.h> #include <tqbutton.h>
#include <qpixmap.h> #include <tqpixmap.h>
class WeatherButton : public QButton class WeatherButton : public QButton
{ {
Q_OBJECT Q_OBJECT
public: public:
WeatherButton( QWidget *parent, const char *name ); WeatherButton( TQWidget *parent, const char *name );
void setPixmap( const QPixmap &pix ); void setPixmap( const TQPixmap &pix );
protected: protected:
void drawButton( QPainter *p ); void drawButton( TQPainter *p );
void drawButtonLabel( QPainter *p ); void drawButtonLabel( TQPainter *p );
QSize margin() const { return QSize( 3, 3 ); } TQSize margin() const { return TQSize( 3, 3 ); }
QSize pixmapSize() const { return size() - margin()*2; } TQSize pixmapSize() const { return size() - margin()*2; }
QPoint pixmapOrigin() const; TQPoint pixmapOrigin() const;
void generateIcons(); void generateIcons();
void enterEvent( QEvent *e ); void enterEvent( TQEvent *e );
void leaveEvent( QEvent *e ); void leaveEvent( TQEvent *e );
void resizeEvent( QResizeEvent *e ); void resizeEvent( TQResizeEvent *e );
bool m_highlight; bool m_highlight;
QPixmap m_normalIcon; TQPixmap m_normalIcon;
QPixmap m_activeIcon; TQPixmap m_activeIcon;
protected slots: protected slots:
void slotSettingsChanged( int category ); void slotSettingsChanged( int category );

@ -16,9 +16,9 @@ email : geiseri@msoe.edu
***************************************************************************/ ***************************************************************************/
#include "config.h" #include "config.h"
#include <qfile.h> #include <tqfile.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <qtextstream.h> #include <tqtextstream.h>
#include <kglobal.h> #include <kglobal.h>
#include <klocale.h> #include <klocale.h>
#include <kdebug.h> #include <kdebug.h>
@ -50,7 +50,7 @@ class WeatherLib::Data
/** The current weather state outside */ /** The current weather state outside */
struct WeatherInfo wi; struct WeatherInfo wi;
QDateTime age; TQDateTime age;
KTempFile *target; KTempFile *target;
bool downloading; bool downloading;
bool updated; bool updated;
@ -65,7 +65,7 @@ WeatherLib::Data::Data()
void WeatherLib::Data::clear() void WeatherLib::Data::clear()
{ {
age = QDateTime::currentDateTime(); age = TQDateTime::currentDateTime();
downloading = false; downloading = false;
updated = false; updated = false;
job = 0; job = 0;
@ -77,8 +77,8 @@ void WeatherLib::Data::clear()
} }
} }
WeatherLib::WeatherLib(StationDatabase *stationDB, QObject *parent, const char *name) WeatherLib::WeatherLib(StationDatabase *stationDB, TQObject *parent, const char *name)
: QObject (parent, name) : TQObject (parent, name)
{ {
KGlobal::locale()->insertCatalogue("kweather"); KGlobal::locale()->insertCatalogue("kweather");
@ -106,7 +106,7 @@ void WeatherLib::slotCopyDone(KIO::Job* job)
} }
} }
// Find the job // Find the job
QDictIterator<Data> it( data ); TQDictIterator<Data> it( data );
Data *d = 0L; Data *d = 0L;
for( ; it.current(); ++it ) for( ; it.current(); ++it )
{ {
@ -118,13 +118,13 @@ void WeatherLib::slotCopyDone(KIO::Job* job)
if( !job->error() ) if( !job->error() )
{ {
kdDebug( 12006) << "Reading: " << d->target->name() << endl; kdDebug( 12006) << "Reading: " << d->target->name() << endl;
QFile file( d->target->name() ); TQFile file( d->target->name() );
file.open( IO_ReadOnly ); file.open( IO_ReadOnly );
QTextStream *t = new QTextStream( &file ); TQTextStream *t = new TQTextStream( &file );
//QTextStream *t = d->target->textStream(); //TQTextStream *t = d->target->textStream();
if( t ) if( t )
{ {
QString s = QString::null; TQString s = TQString::null;
while ( !t->eof() ) while ( !t->eof() )
{ {
s += " " + t->readLine(); s += " " + t->readLine();
@ -135,7 +135,7 @@ void WeatherLib::slotCopyDone(KIO::Job* job)
kdDebug( 12006 ) << "Parse: " << s << endl; kdDebug( 12006 ) << "Parse: " << s << endl;
MetarParser parser(m_StationDb, KGlobal::locale()->measureSystem()); MetarParser parser(m_StationDb, KGlobal::locale()->measureSystem());
d->wi = parser.processData(d->wi.reportLocation, s); d->wi = parser.processData(d->wi.reportLocation, s);
d->age = QDateTime::currentDateTime().addSecs(1800); d->age = TQDateTime::currentDateTime().addSecs(1800);
emit fileUpdate(d->wi.reportLocation); emit fileUpdate(d->wi.reportLocation);
d->updated = true; d->updated = true;
} }
@ -193,11 +193,11 @@ void WeatherLib::getData(Data *d, bool force /* try even if host was down last t
{ {
d->downloading = true; d->downloading = true;
d->updated = false; d->updated = false;
QString u = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; TQString u = "http://weather.noaa.gov/pub/data/observations/metar/stations/";
u += d->wi.reportLocation.upper().stripWhiteSpace(); u += d->wi.reportLocation.upper().stripWhiteSpace();
u += ".TXT"; u += ".TXT";
d->target = new KTempFile(QString::null, "-weather"); d->target = new KTempFile(TQString::null, "-weather");
d->target->setAutoDelete(true); d->target->setAutoDelete(true);
d->target->file(); d->target->file();
@ -206,15 +206,15 @@ void WeatherLib::getData(Data *d, bool force /* try even if host was down last t
d->job = KIO::file_copy( url, local, -1, true, false, false); d->job = KIO::file_copy( url, local, -1, true, false, false);
d->job->addMetaData("cache", "reload"); // Make sure to get fresh info d->job->addMetaData("cache", "reload"); // Make sure to get fresh info
connect( d->job, SIGNAL( result( KIO::Job *)), connect( d->job, TQT_SIGNAL( result( KIO::Job *)),
SLOT(slotCopyDone(KIO::Job *))); TQT_SLOT(slotCopyDone(KIO::Job *)));
kdDebug( 12006 ) << "Copying " << url.prettyURL() << " to " kdDebug( 12006 ) << "Copying " << url.prettyURL() << " to "
<< local.prettyURL() << endl; << local.prettyURL() << endl;
emit fileUpdating(d->wi.reportLocation); emit fileUpdating(d->wi.reportLocation);
} }
} }
WeatherLib::Data* WeatherLib::findData(const QString &stationID) WeatherLib::Data* WeatherLib::findData(const TQString &stationID)
{ {
Data *d = data[stationID]; Data *d = data[stationID];
if (!d) if (!d)
@ -230,45 +230,45 @@ WeatherLib::Data* WeatherLib::findData(const QString &stationID)
return d; return d;
} }
QString WeatherLib::temperature(const QString &stationID){ TQString WeatherLib::temperature(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsTemperature; return d->wi.qsTemperature;
} }
QString WeatherLib::pressure(const QString &stationID){ TQString WeatherLib::pressure(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsPressure; return d->wi.qsPressure;
} }
QString WeatherLib::wind(const QString &stationID){ TQString WeatherLib::wind(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return (d->wi.qsWindSpeed + " " + d->wi.qsWindDirection); return (d->wi.qsWindSpeed + " " + d->wi.qsWindDirection);
} }
/** */ /** */
QString WeatherLib::dewPoint(const QString &stationID){ TQString WeatherLib::dewPoint(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsDewPoint; return d->wi.qsDewPoint;
} }
QString WeatherLib::relHumidity(const QString &stationID){ TQString WeatherLib::relHumidity(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsRelHumidity; return d->wi.qsRelHumidity;
} }
QString WeatherLib::heatIndex(const QString &stationID){ TQString WeatherLib::heatIndex(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsHeatIndex; return d->wi.qsHeatIndex;
} }
QString WeatherLib::windChill(const QString &stationID){ TQString WeatherLib::windChill(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsWindChill; return d->wi.qsWindChill;
} }
QString WeatherLib::iconName(const QString &stationID){ TQString WeatherLib::iconName(const TQString &stationID){
QString result("dunno"); TQString result("dunno");
// isEmpty is true for null or 0 length strings // isEmpty is true for null or 0 length strings
if ( !stationID.isEmpty() ) if ( !stationID.isEmpty() )
@ -280,49 +280,49 @@ QString WeatherLib::iconName(const QString &stationID){
return result; return result;
} }
QString WeatherLib::date(const QString &stationID){ TQString WeatherLib::date(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
if ( ! d->wi.qsDate.isValid() ) if ( ! d->wi.qsDate.isValid() )
return ""; return "";
else else
{ {
QDateTime gmtDateTime(d->wi.qsDate, d->wi.qsTime); TQDateTime gmtDateTime(d->wi.qsDate, d->wi.qsTime);
QDateTime localDateTime = gmtDateTime.addSecs(KRFCDate::localUTCOffset() * 60); TQDateTime localDateTime = gmtDateTime.addSecs(KRFCDate::localUTCOffset() * 60);
return KGlobal::locale()->formatDateTime(localDateTime, false, false); return KGlobal::locale()->formatDateTime(localDateTime, false, false);
} }
} }
/** Returns the current cover */ /** Returns the current cover */
QStringList WeatherLib::cover(const QString &stationID){ TQStringList WeatherLib::cover(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsCoverList; return d->wi.qsCoverList;
} }
/** return the visibility */ /** return the visibility */
QString WeatherLib::visibility(const QString &stationID){ TQString WeatherLib::visibility(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsVisibility; return d->wi.qsVisibility;
} }
/** return the weather text */ /** return the weather text */
QStringList WeatherLib::weather(const QString &stationID){ TQStringList WeatherLib::weather(const TQString &stationID){
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.qsCurrentList; return d->wi.qsCurrentList;
} }
bool WeatherLib::stationNeedsMaintenance(const QString &stationID) bool WeatherLib::stationNeedsMaintenance(const TQString &stationID)
{ {
Data *d = findData(stationID); Data *d = findData(stationID);
return d->wi.stationNeedsMaintenance; return d->wi.stationNeedsMaintenance;
} }
void WeatherLib::update(const QString &stationID) void WeatherLib::update(const TQString &stationID)
{ {
// Only grab new data if its more than 50 minutes old // Only grab new data if its more than 50 minutes old
Data *d = findData(stationID); Data *d = findData(stationID);
QDateTime timeout = QDateTime::currentDateTime(); TQDateTime timeout = TQDateTime::currentDateTime();
kdDebug (12006) << "Current Time: " << KGlobal::locale()->formatDateTime(timeout, false, false) << kdDebug (12006) << "Current Time: " << KGlobal::locale()->formatDateTime(timeout, false, false) <<
" Update at: " << KGlobal::locale()->formatDateTime(d->age, false, false) << endl; " Update at: " << KGlobal::locale()->formatDateTime(d->age, false, false) << endl;
@ -332,23 +332,23 @@ void WeatherLib::update(const QString &stationID)
emit fileUpdate(d->wi.reportLocation); emit fileUpdate(d->wi.reportLocation);
} }
QStringList WeatherLib::stations() TQStringList WeatherLib::stations()
{ {
QStringList l; TQStringList l;
QDictIterator<Data> it( data ); TQDictIterator<Data> it( data );
for( ; it.current(); ++it ) for( ; it.current(); ++it )
l += it.currentKey(); l += it.currentKey();
return l; return l;
} }
void WeatherLib::forceUpdate(const QString &stationID) void WeatherLib::forceUpdate(const TQString &stationID)
{ {
hostDown = false; // we want to show error message if host is still down hostDown = false; // we want to show error message if host is still down
Data *d = findData(stationID); Data *d = findData(stationID);
getData( d ); getData( d );
} }
void WeatherLib::remove(const QString &stationID) void WeatherLib::remove(const TQString &stationID)
{ {
data.remove(stationID); data.remove(stationID);
emit stationRemoved(stationID); emit stationRemoved(stationID);

@ -17,10 +17,10 @@
#ifndef WEATHERLIB_H #ifndef WEATHERLIB_H
#define WEATHERLIB_H #define WEATHERLIB_H
#include <qobject.h> #include <tqobject.h>
#include <qstring.h> #include <tqstring.h>
#include <qregexp.h> #include <tqregexp.h>
#include <qdict.h> #include <tqdict.h>
namespace KIO namespace KIO
{ {
@ -36,47 +36,47 @@ class WeatherLib : public QObject
public: public:
class Data; class Data;
WeatherLib(StationDatabase *stationDB, QObject *parent =0L, const char *name =0L); WeatherLib(StationDatabase *stationDB, TQObject *parent =0L, const char *name =0L);
virtual ~WeatherLib(); virtual ~WeatherLib();
QString temperature(const QString &stationID); TQString temperature(const TQString &stationID);
QString dewPoint(const QString &stationID); TQString dewPoint(const TQString &stationID);
QString relHumidity(const QString &stationID); TQString relHumidity(const TQString &stationID);
QString heatIndex(const QString &stationID); TQString heatIndex(const TQString &stationID);
QString windChill(const QString &stationID); TQString windChill(const TQString &stationID);
QString wind(const QString &stationID); TQString wind(const TQString &stationID);
QString pressure(const QString &stationID); TQString pressure(const TQString &stationID);
QString iconName(const QString &stationID); TQString iconName(const TQString &stationID);
QString date(const QString &stationID); TQString date(const TQString &stationID);
QStringList weather(const QString &stationID); TQStringList weather(const TQString &stationID);
QString visibility(const QString &stationID); TQString visibility(const TQString &stationID);
QStringList cover(const QString &stationID); TQStringList cover(const TQString &stationID);
bool stationNeedsMaintenance(const QString &stationID); bool stationNeedsMaintenance(const TQString &stationID);
QStringList stations(); TQStringList stations();
bool isNight(const QString &stationID) const; bool isNight(const TQString &stationID) const;
void update(const QString &stationID); void update(const TQString &stationID);
void forceUpdate(const QString &stationID); void forceUpdate(const TQString &stationID);
void remove(const QString &stationID); void remove(const TQString &stationID);
signals: signals:
void fileUpdating(const QString &stationID); void fileUpdating(const TQString &stationID);
void fileUpdate(const QString &stationID); void fileUpdate(const TQString &stationID);
void stationRemoved(const QString &stationID); void stationRemoved(const TQString &stationID);
private slots: private slots:
void slotCopyDone(KIO::Job*); void slotCopyDone(KIO::Job*);
private: private:
Data* findData(const QString &stationID); Data* findData(const TQString &stationID);
void clearData(Data *d); void clearData(Data *d);
void getData(Data *d, bool force = false); void getData(Data *d, bool force = false);
void processData(const QString &metar, Data *d); void processData(const TQString &metar, Data *d);
StationDatabase *m_StationDb; StationDatabase *m_StationDb;
QDict<Data> data; TQDict<Data> data;
bool fileDownloaded; bool fileDownloaded;
bool hostDown; bool hostDown;
}; };

@ -31,25 +31,25 @@
#include "stationdatabase.h" #include "stationdatabase.h"
#include "sun.h" #include "sun.h"
WeatherService::WeatherService(QObject *parent, const char *name) : QObject (parent, name), DCOPObject("WeatherService") WeatherService::WeatherService(TQObject *parent, const char *name) : TQObject (parent, name), DCOPObject("WeatherService")
{ {
kdDebug(12006) << "Starting new service... " << endl; kdDebug(12006) << "Starting new service... " << endl;
stationDB = new StationDatabase(); stationDB = new StationDatabase();
m_weatherLib = new WeatherLib(stationDB, this, "WeatherLib"); m_weatherLib = new WeatherLib(stationDB, this, "WeatherLib");
connect(m_weatherLib, SIGNAL(fileUpdating( const QString&)), connect(m_weatherLib, TQT_SIGNAL(fileUpdating( const TQString&)),
SLOT(updating( const QString&))); TQT_SLOT(updating( const TQString&)));
connect(m_weatherLib, SIGNAL(fileUpdate( const QString&)), connect(m_weatherLib, TQT_SIGNAL(fileUpdate( const TQString&)),
SLOT(updated( const QString&))); TQT_SLOT(updated( const TQString&)));
connect(m_weatherLib, SIGNAL(stationRemoved(const QString&)), connect(m_weatherLib, TQT_SIGNAL(stationRemoved(const TQString&)),
SLOT(slotStationRemoved(const QString&))); TQT_SLOT(slotStationRemoved(const TQString&)));
KConfig *conf = kapp->config(); KConfig *conf = kapp->config();
conf->setGroup("WEATHERSTATIONS"); conf->setGroup("WEATHERSTATIONS");
QStringList stations =conf->readListEntry("stations"); TQStringList stations =conf->readListEntry("stations");
QStringList::Iterator it = stations.begin(); TQStringList::Iterator it = stations.begin();
for ( ; it != stations.end(); ++it ) for ( ; it != stations.end(); ++it )
m_weatherLib->update(*it); m_weatherLib->update(*it);
} }
@ -63,7 +63,7 @@ WeatherService::~WeatherService()
delete stationDB; delete stationDB;
} }
void WeatherService::updated(const QString &stationID) void WeatherService::updated(const TQString &stationID)
{ {
kdDebug(12006) << "Sending update for " << stationID << endl; kdDebug(12006) << "Sending update for " << stationID << endl;
emit fileUpdate( stationID ); emit fileUpdate( stationID );
@ -72,129 +72,129 @@ void WeatherService::updated(const QString &stationID)
void WeatherService::updateAll() void WeatherService::updateAll()
{ {
kdDebug(12006) << "Sending for all" << endl; kdDebug(12006) << "Sending for all" << endl;
QStringList stations = m_weatherLib->stations(); TQStringList stations = m_weatherLib->stations();
QStringList::ConstIterator end(stations.end()); TQStringList::ConstIterator end(stations.end());
for ( QStringList::ConstIterator it = stations.begin(); it != end; ++it ) { for ( TQStringList::ConstIterator it = stations.begin(); it != end; ++it ) {
update(*it); update(*it);
} }
} }
void WeatherService::updating(const QString &stationID) void WeatherService::updating(const TQString &stationID)
{ {
kdDebug(12006) << "Sending updating for " << stationID << endl; kdDebug(12006) << "Sending updating for " << stationID << endl;
emit fileUpdating( stationID ); emit fileUpdating( stationID );
} }
void WeatherService::slotStationRemoved(const QString &stationID) void WeatherService::slotStationRemoved(const TQString &stationID)
{ {
kdDebug(12006) << "Sending stationRemoved for " << stationID << endl; kdDebug(12006) << "Sending stationRemoved for " << stationID << endl;
emit stationRemoved( stationID ); emit stationRemoved( stationID );
} }
QString WeatherService::temperature(const QString &stationID) TQString WeatherService::temperature(const TQString &stationID)
{ {
kdDebug (12006) << "Returning " << stationID << endl; kdDebug (12006) << "Returning " << stationID << endl;
return m_weatherLib->temperature(stationID); return m_weatherLib->temperature(stationID);
} }
QString WeatherService::dewPoint(const QString &stationID) TQString WeatherService::dewPoint(const TQString &stationID)
{ {
return m_weatherLib->dewPoint(stationID); return m_weatherLib->dewPoint(stationID);
} }
QString WeatherService::relativeHumidity(const QString &stationID) TQString WeatherService::relativeHumidity(const TQString &stationID)
{ {
return m_weatherLib->relHumidity(stationID); return m_weatherLib->relHumidity(stationID);
} }
QString WeatherService::heatIndex(const QString &stationID) TQString WeatherService::heatIndex(const TQString &stationID)
{ {
return m_weatherLib->heatIndex(stationID); return m_weatherLib->heatIndex(stationID);
} }
QString WeatherService::windChill(const QString &stationID) TQString WeatherService::windChill(const TQString &stationID)
{ {
return m_weatherLib->windChill(stationID); return m_weatherLib->windChill(stationID);
} }
QString WeatherService::wind(const QString &stationID) TQString WeatherService::wind(const TQString &stationID)
{ {
return m_weatherLib->wind(stationID); return m_weatherLib->wind(stationID);
} }
QString WeatherService::pressure(const QString &stationID) TQString WeatherService::pressure(const TQString &stationID)
{ {
return m_weatherLib->pressure(stationID); return m_weatherLib->pressure(stationID);
} }
QPixmap WeatherService::currentIcon(const QString &stationID) TQPixmap WeatherService::currentIcon(const TQString &stationID)
{ {
return icon( stationID ); return icon( stationID );
} }
QPixmap WeatherService::icon(const QString &stationID) TQPixmap WeatherService::icon(const TQString &stationID)
{ {
kdDebug(12006) << "Get the current weather icon.." << endl; kdDebug(12006) << "Get the current weather icon.." << endl;
QString icon = iconFileName(stationID); TQString icon = iconFileName(stationID);
QPixmap theIcon = QPixmap(icon); TQPixmap theIcon = TQPixmap(icon);
return theIcon; return theIcon;
} }
QString WeatherService::currentIconString(const QString &stationID) TQString WeatherService::currentIconString(const TQString &stationID)
{ {
return m_weatherLib->iconName(stationID); return m_weatherLib->iconName(stationID);
} }
QString WeatherService::iconFileName(const QString &stationID) TQString WeatherService::iconFileName(const TQString &stationID)
{ {
QString icon = m_weatherLib->iconName(stationID); TQString icon = m_weatherLib->iconName(stationID);
icon = locate( "data", "kweather/" + icon + ".png" ); icon = locate( "data", "kweather/" + icon + ".png" );
return icon; return icon;
} }
QString WeatherService::date(const QString &stationID) TQString WeatherService::date(const TQString &stationID)
{ {
return m_weatherLib->date(stationID); return m_weatherLib->date(stationID);
} }
QString WeatherService::visibility(const QString &stationID) TQString WeatherService::visibility(const TQString &stationID)
{ {
return m_weatherLib->visibility(stationID); return m_weatherLib->visibility(stationID);
} }
QStringList WeatherService::cover(const QString &stationID) TQStringList WeatherService::cover(const TQString &stationID)
{ {
return m_weatherLib->cover(stationID); return m_weatherLib->cover(stationID);
} }
QStringList WeatherService::weather(const QString &stationID) TQStringList WeatherService::weather(const TQString &stationID)
{ {
return m_weatherLib->weather(stationID); return m_weatherLib->weather(stationID);
} }
bool WeatherService::stationNeedsMaintenance(const QString &stationID) bool WeatherService::stationNeedsMaintenance(const TQString &stationID)
{ {
return m_weatherLib->stationNeedsMaintenance(stationID); return m_weatherLib->stationNeedsMaintenance(stationID);
} }
void WeatherService::update(const QString &stationID) void WeatherService::update(const TQString &stationID)
{ {
m_weatherLib->update(stationID); m_weatherLib->update(stationID);
} }
void WeatherService::forceUpdate(const QString &stationID) void WeatherService::forceUpdate(const TQString &stationID)
{ {
m_weatherLib->forceUpdate(stationID); m_weatherLib->forceUpdate(stationID);
} }
void WeatherService::removeStation(const QString &stationID) void WeatherService::removeStation(const TQString &stationID)
{ {
m_weatherLib->remove(stationID); m_weatherLib->remove(stationID);
saveSettings(); saveSettings();
} }
void WeatherService::addStation(const QString &stationID) void WeatherService::addStation(const TQString &stationID)
{ {
m_weatherLib->update(stationID); m_weatherLib->update(stationID);
saveSettings(); saveSettings();
@ -206,7 +206,7 @@ void WeatherService::exit()
kapp->quit(); kapp->quit();
} }
QStringList WeatherService::listStations() TQStringList WeatherService::listStations()
{ {
return m_weatherLib->stations(); return m_weatherLib->stations();
} }
@ -219,17 +219,17 @@ void WeatherService::saveSettings()
conf->sync(); conf->sync();
} }
QString WeatherService::stationName(const QString &stationID) TQString WeatherService::stationName(const TQString &stationID)
{ {
if ( stationDB ) if ( stationDB )
{ {
QString upperStationID = stationID.upper(); TQString upperStationID = stationID.upper();
return stationDB->stationNameFromID(upperStationID); return stationDB->stationNameFromID(upperStationID);
} }
else else
return stationID; return stationID;
} }
QString WeatherService::stationCode( const QString &stationName ) TQString WeatherService::stationCode( const TQString &stationName )
{ {
if ( stationDB ) if ( stationDB )
{ {
@ -239,51 +239,51 @@ QString WeatherService::stationCode( const QString &stationName )
return stationName; return stationName;
} }
QString WeatherService::stationCountry(const QString &stationID) TQString WeatherService::stationCountry(const TQString &stationID)
{ {
if ( stationDB ) if ( stationDB )
{ {
QString upperStationID = stationID.upper(); TQString upperStationID = stationID.upper();
return stationDB->stationCountryFromID(upperStationID); return stationDB->stationCountryFromID(upperStationID);
} }
else else
return stationID; return stationID;
} }
QString WeatherService::longitude(const QString &stationID) TQString WeatherService::longitude(const TQString &stationID)
{ {
if ( stationDB ) if ( stationDB )
{ {
QString upperStationID = stationID.upper(); TQString upperStationID = stationID.upper();
return stationDB->stationLongitudeFromID(upperStationID); return stationDB->stationLongitudeFromID(upperStationID);
} }
else else
return "None"; return "None";
} }
QString WeatherService::latitude(const QString &stationID) TQString WeatherService::latitude(const TQString &stationID)
{ {
if ( stationDB ) if ( stationDB )
{ {
QString upperStationID = stationID.upper(); TQString upperStationID = stationID.upper();
return stationDB->stationLatitudeFromID(upperStationID); return stationDB->stationLatitudeFromID(upperStationID);
} }
else else
return "None"; return "None";
} }
QStringList WeatherService::findStations(float /*lon*/, float /*lat*/) TQStringList WeatherService::findStations(float /*lon*/, float /*lat*/)
{ {
QStringList stationList; TQStringList stationList;
stationList << "KMKE" << "KPNE" << "KTPW"; stationList << "KMKE" << "KPNE" << "KTPW";
return stationList; return stationList;
} }
QString WeatherService::getTime(const QString &stationID, TimeType timeType) TQString WeatherService::getTime(const TQString &stationID, TimeType timeType)
{ {
QString upperStationID = stationID.upper(); TQString upperStationID = stationID.upper();
QString latitude = stationDB->stationLatitudeFromID(upperStationID); TQString latitude = stationDB->stationLatitudeFromID(upperStationID);
QString longitude = stationDB->stationLongitudeFromID(upperStationID); TQString longitude = stationDB->stationLongitudeFromID(upperStationID);
if ( latitude.compare( i18n("Unknown Station" ) ) == 0 || if ( latitude.compare( i18n("Unknown Station" ) ) == 0 ||
longitude.compare( i18n("Unknown Station" ) ) == 0 ) longitude.compare( i18n("Unknown Station" ) ) == 0 )
@ -294,7 +294,7 @@ QString WeatherService::getTime(const QString &stationID, TimeType timeType)
{ {
Sun theSun( latitude, longitude ); Sun theSun( latitude, longitude );
QTime time; TQTime time;
switch ( timeType ) switch ( timeType )
{ {
case RISE: case RISE:
@ -318,22 +318,22 @@ QString WeatherService::getTime(const QString &stationID, TimeType timeType)
} }
} }
QString WeatherService::sunRiseTime(const QString &stationID) TQString WeatherService::sunRiseTime(const TQString &stationID)
{ {
return getTime(stationID, RISE); return getTime(stationID, RISE);
} }
QString WeatherService::sunSetTime(const QString &stationID) TQString WeatherService::sunSetTime(const TQString &stationID)
{ {
return getTime(stationID, SET); return getTime(stationID, SET);
} }
QString WeatherService::civilTwilightStart(const QString &stationID) TQString WeatherService::civilTwilightStart(const TQString &stationID)
{ {
return getTime(stationID, CIVIL_START); return getTime(stationID, CIVIL_START);
} }
QString WeatherService::civilTwilightEnd(const QString &stationID) TQString WeatherService::civilTwilightEnd(const TQString &stationID)
{ {
return getTime(stationID, CIVIL_END); return getTime(stationID, CIVIL_END);
} }

@ -22,14 +22,14 @@
#ifndef _WEATHER_SERVICE #ifndef _WEATHER_SERVICE
#define _WEATHER_SERVICE #define _WEATHER_SERVICE
#include <qstringlist.h> #include <tqstringlist.h>
#include <dcopobject.h> #include <dcopobject.h>
#include <qpixmap.h> #include <tqpixmap.h>
class WeatherLib; class WeatherLib;
class StationDatabase; class StationDatabase;
class WeatherService : public QObject, public DCOPObject class WeatherService : public TQObject, public DCOPObject
{ {
Q_OBJECT Q_OBJECT
K_DCOP K_DCOP
@ -38,56 +38,56 @@ class WeatherService : public QObject, public DCOPObject
WeatherLib *m_weatherLib; WeatherLib *m_weatherLib;
private slots: private slots:
void updated(const QString &stationID); void updated(const TQString &stationID);
void updating(const QString &stationID); void updating(const TQString &stationID);
void slotStationRemoved(const QString &stationID); void slotStationRemoved(const TQString &stationID);
public: public:
WeatherService(QObject *parent, const char *name); WeatherService(TQObject *parent, const char *name);
~WeatherService(); ~WeatherService();
k_dcop_signals: k_dcop_signals:
void fileUpdating(QString); void fileUpdating(TQString);
void fileUpdate(QString); void fileUpdate(TQString);
void stationRemoved(QString); void stationRemoved(TQString);
k_dcop: k_dcop:
QString temperature(const QString &stationID); TQString temperature(const TQString &stationID);
QString dewPoint(const QString &stationID); TQString dewPoint(const TQString &stationID);
QString relativeHumidity(const QString &stationID); TQString relativeHumidity(const TQString &stationID);
QString heatIndex(const QString &stationID); TQString heatIndex(const TQString &stationID);
QString windChill(const QString &stationID); TQString windChill(const TQString &stationID);
QString wind(const QString &stationID); TQString wind(const TQString &stationID);
QString pressure(const QString &stationID); TQString pressure(const TQString &stationID);
QPixmap currentIcon(const QString &stationID); TQPixmap currentIcon(const TQString &stationID);
QPixmap icon(const QString &stationID); TQPixmap icon(const TQString &stationID);
QString currentIconString(const QString &stationID); TQString currentIconString(const TQString &stationID);
QString iconFileName(const QString &stationID); TQString iconFileName(const TQString &stationID);
QString date(const QString &stationID); TQString date(const TQString &stationID);
QString visibility(const QString &stationID); TQString visibility(const TQString &stationID);
QStringList cover(const QString &stationID); TQStringList cover(const TQString &stationID);
QStringList weather(const QString &stationID); TQStringList weather(const TQString &stationID);
bool stationNeedsMaintenance(const QString &stationID); bool stationNeedsMaintenance(const TQString &stationID);
QString stationName(const QString &stationID); TQString stationName(const TQString &stationID);
QString stationCountry(const QString &stationID); TQString stationCountry(const TQString &stationID);
QString longitude(const QString &stationID); TQString longitude(const TQString &stationID);
QString latitude(const QString &stationID); TQString latitude(const TQString &stationID);
QStringList findStations(float lon, float lat); TQStringList findStations(float lon, float lat);
QString sunRiseTime(const QString &stationID); TQString sunRiseTime(const TQString &stationID);
QString sunSetTime(const QString &stationID); TQString sunSetTime(const TQString &stationID);
QString civilTwilightStart(const QString &stationID); TQString civilTwilightStart(const TQString &stationID);
QString civilTwilightEnd(const QString &stationID); TQString civilTwilightEnd(const TQString &stationID);
void update(const QString &stationID); void update(const TQString &stationID);
void updateAll(); void updateAll();
void forceUpdate(const QString &stationID); void forceUpdate(const TQString &stationID);
void removeStation(const QString &stationID); void removeStation(const TQString &stationID);
void addStation(const QString &stationID); void addStation(const TQString &stationID);
QStringList listStations(); TQStringList listStations();
QString stationCode( const QString &stationName ); TQString stationCode( const TQString &stationName );
void exit(); void exit();
@ -101,7 +101,7 @@ class WeatherService : public QObject, public DCOPObject
}; };
void saveSettings(); void saveSettings();
QString getTime(const QString &stationID, TimeType timeType); TQString getTime(const TQString &stationID, TimeType timeType);
StationDatabase *stationDB; StationDatabase *stationDB;
}; };
#endif #endif

@ -25,7 +25,7 @@
/* /*
** Bug reports and questions can be sent to kde-devel@kde.org ** Bug reports and questions can be sent to kde-devel@kde.org
*/ */
#include <qlayout.h> #include <tqlayout.h>
#include <kapplication.h> #include <kapplication.h>
@ -42,7 +42,7 @@
extern "C" extern "C"
{ {
KDE_EXPORT KPanelApplet *init(QWidget *parent, const QString& configFile) KDE_EXPORT KPanelApplet *init(TQWidget *parent, const TQString& configFile)
{ {
KGlobal::locale()->insertCatalogue("kworldclock"); KGlobal::locale()->insertCatalogue("kworldclock");
KGlobal::locale()->insertCatalogue("timezones"); // For time zone translation KGlobal::locale()->insertCatalogue("timezones"); // For time zone translation
@ -53,14 +53,14 @@ extern "C"
} }
KWWApplet::KWWApplet(const QString& configFile, Type type, int actions, KWWApplet::KWWApplet(const TQString& configFile, Type type, int actions,
QWidget *parent, const char *name) TQWidget *parent, const char *name)
: KPanelApplet(configFile, type, actions, parent, name) : KPanelApplet(configFile, type, actions, parent, name)
{ {
// make use of the icons installed for ksaferppp // make use of the icons installed for ksaferppp
KGlobal::iconLoader()->addAppDir("kworldwatch"); KGlobal::iconLoader()->addAppDir("kworldwatch");
QVBoxLayout *vbox = new QVBoxLayout(this, 0,0); TQVBoxLayout *vbox = new TQVBoxLayout(this, 0,0);
map = new MapWidget(true, true, this); map = new MapWidget(true, true, this);
map->load(config()); map->load(config());
@ -90,11 +90,11 @@ int KWWApplet::heightForWidth(int width) const
// catch the mouse clicks of our child widgets // catch the mouse clicks of our child widgets
bool KWWApplet::eventFilter( QObject *o, QEvent *e ) bool KWWApplet::eventFilter( TQObject *o, TQEvent *e )
{ {
if ((e->type() == QEvent::MouseButtonPress) || (e->type() == QEvent::MouseButtonDblClick)) if ((e->type() == TQEvent::MouseButtonPress) || (e->type() == TQEvent::MouseButtonDblClick))
{ {
mousePressEvent(static_cast<QMouseEvent*>(e)); mousePressEvent(static_cast<TQMouseEvent*>(e));
return true; return true;
} }
@ -102,20 +102,20 @@ bool KWWApplet::eventFilter( QObject *o, QEvent *e )
} }
void KWWApplet::mousePressEvent(QMouseEvent *e) void KWWApplet::mousePressEvent(TQMouseEvent *e)
{ {
bool clicked = false; bool clicked = false;
if (KGlobalSettings::singleClick()) if (KGlobalSettings::singleClick())
{ {
clicked = e->type() == QMouseEvent::MouseButtonPress; clicked = e->type() == TQMouseEvent::MouseButtonPress;
} }
else else
{ {
clicked = e->type() == QMouseEvent::MouseButtonDblClick; clicked = e->type() == TQMouseEvent::MouseButtonDblClick;
} }
if (clicked && e->button() == QMouseEvent::LeftButton) if (clicked && e->button() == TQMouseEvent::LeftButton)
{ {
KRun::run("kworldclock", KURL::List()); KRun::run("kworldclock", KURL::List());
} }

@ -29,8 +29,8 @@
#define KWW_applet_h #define KWW_applet_h
#include <qstring.h> #include <tqstring.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <kpanelapplet.h> #include <kpanelapplet.h>
@ -45,8 +45,8 @@ class KWWApplet : public KPanelApplet
public: public:
KWWApplet(const QString& configFile, Type t = Normal, int actions = 0, KWWApplet(const TQString& configFile, Type t = Normal, int actions = 0,
QWidget *parent = 0, const char *name = 0); TQWidget *parent = 0, const char *name = 0);
~KWWApplet(); ~KWWApplet();
int widthForHeight(int height) const; int widthForHeight(int height) const;
@ -55,8 +55,8 @@ public:
protected: protected:
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(TQMouseEvent *ev);
bool eventFilter(QObject *, QEvent *); bool eventFilter(TQObject *, TQEvent *);
private: private:

@ -25,10 +25,10 @@
/* /*
** Bug reports and questions can be sent to kde-devel@kde.org ** Bug reports and questions can be sent to kde-devel@kde.org
*/ */
#include <qfile.h> #include <tqfile.h>
#include <qtextstream.h> #include <tqtextstream.h>
#include <qregexp.h> #include <tqregexp.h>
#include <qpainter.h> #include <tqpainter.h>
#include <kglobal.h> #include <kglobal.h>
@ -51,13 +51,13 @@ CityList::~CityList()
void CityList::readCityLists() void CityList::readCityLists()
{ {
QStringList lists = KGlobal::dirs()->findAllResources("data", "kworldclock/*.tab"); TQStringList lists = KGlobal::dirs()->findAllResources("data", "kworldclock/*.tab");
for (QStringList::Iterator it = lists.begin(); it != lists.end(); ++it) for (TQStringList::Iterator it = lists.begin(); it != lists.end(); ++it)
readCityList(*it); readCityList(*it);
} }
double coordinate(QString c) double coordinate(TQString c)
{ {
int neg; int neg;
int d=0, m=0, s=0; int d=0, m=0, s=0;
@ -96,18 +96,18 @@ double coordinate(QString c)
} }
void CityList::readCityList(const QString &fname) void CityList::readCityList(const TQString &fname)
{ {
QFile f(fname); TQFile f(fname);
if (f.open(IO_ReadOnly)) if (f.open(IO_ReadOnly))
{ {
QTextStream is(&f); TQTextStream is(&f);
QString line; TQString line;
QStringList tags; TQStringList tags;
QRegExp coord("[+-]\\d+[+-]\\d+"); TQRegExp coord("[+-]\\d+[+-]\\d+");
QRegExp name("[^\\s]+/[^\\s]+"); TQRegExp name("[^\\s]+/[^\\s]+");
int pos; int pos;
while (!is.eof()) while (!is.eof())
{ {
@ -115,7 +115,7 @@ void CityList::readCityList(const QString &fname)
if (line.isEmpty() || line.left(1) == "#") if (line.isEmpty() || line.left(1) == "#")
continue; continue;
QString c, n; TQString c, n;
pos = coord.search(line, 0); pos = coord.search(line, 0);
if (pos >= 0) if (pos >= 0)
@ -145,24 +145,24 @@ void CityList::readCityList(const QString &fname)
} }
QPoint CityList::getPosition(double la, double lo, int w, int h, int offset) TQPoint CityList::getPosition(double la, double lo, int w, int h, int offset)
{ {
int x = (int)((double)w * (180.0 + lo) / 360.0); int x = (int)((double)w * (180.0 + lo) / 360.0);
int y = (int)((double)h * (90.0 - la) / 180.0); int y = (int)((double)h * (90.0 - la) / 180.0);
x = (x + offset + w/2) % w; x = (x + offset + w/2) % w;
return QPoint(x,y); return TQPoint(x,y);
} }
void CityList::paint(QPainter *p, int width, int height, int offset) void CityList::paint(TQPainter *p, int width, int height, int offset)
{ {
p->setPen(Qt::black); p->setPen(Qt::black);
QPtrListIterator<City> it(_cities); TQPtrListIterator<City> it(_cities);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
QPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), width, height, offset); TQPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), width, height, offset);
if (width > 100) if (width > 100)
p->drawEllipse(pos.x(), pos.y(), 3,3); p->drawEllipse(pos.x(), pos.y(), 3,3);
@ -172,15 +172,15 @@ void CityList::paint(QPainter *p, int width, int height, int offset)
} }
City *CityList::getNearestCity(int w, int h, int offset, int x, int y, QPoint &where) City *CityList::getNearestCity(int w, int h, int offset, int x, int y, TQPoint &where)
{ {
City *result = 0; City *result = 0;
double dist = 1.0e10; double dist = 1.0e10;
QPtrListIterator<City> it(_cities); TQPtrListIterator<City> it(_cities);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
QPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), w, h, offset); TQPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), w, h, offset);
double d = (pos.x()-x)*(pos.x()-x) + (pos.y()-y)*(pos.y()-y); double d = (pos.x()-x)*(pos.x()-x) + (pos.y()-y)*(pos.y()-y);
if (d < dist) if (d < dist)
@ -195,11 +195,11 @@ City *CityList::getNearestCity(int w, int h, int offset, int x, int y, QPoint &w
} }
QStringList CityList::timezones() TQStringList CityList::timezones()
{ {
QStringList r; TQStringList r;
QPtrListIterator<City> it(_cities); TQPtrListIterator<City> it(_cities);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
r << it.current()->name(); r << it.current()->name();
r.sort(); r.sort();

@ -29,9 +29,9 @@
#define CITIES_H #define CITIES_H
#include <qstring.h> #include <tqstring.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <qptrlist.h> #include <tqptrlist.h>
class QPainter; class QPainter;
@ -41,8 +41,8 @@ class City
{ {
public: public:
City(const QString &n, double la, double lo) : _name(n), _latitude(la), _longitude(lo) {}; City(const TQString &n, double la, double lo) : _name(n), _latitude(la), _longitude(lo) {};
QString name() { return _name; }; TQString name() { return _name; };
double latitude() { return _latitude; }; double latitude() { return _latitude; };
double longitude() { return _longitude; }; double longitude() { return _longitude; };
@ -50,7 +50,7 @@ public:
private: private:
QString _name; TQString _name;
double _latitude, _longitude; double _latitude, _longitude;
}; };
@ -62,24 +62,24 @@ public:
CityList(); CityList();
~CityList(); ~CityList();
void paint(QPainter *p, int width, int height, int offset); void paint(TQPainter *p, int width, int height, int offset);
City *getNearestCity(int w, int h, int offset, int x, int y, QPoint &where); City *getNearestCity(int w, int h, int offset, int x, int y, TQPoint &where);
QStringList timezones(); TQStringList timezones();
private: private:
void readCityLists(); void readCityLists();
void readCityList(const QString &fname); void readCityList(const TQString &fname);
QPoint getPosition(double la, double lo, int w, int h, int offset); TQPoint getPosition(double la, double lo, int w, int h, int offset);
private: private:
QPtrList<City> _cities; TQPtrList<City> _cities;
}; };

@ -38,8 +38,8 @@ FlagList::FlagList()
{ {
_flags.setAutoDelete(true); _flags.setAutoDelete(true);
_flagPixmap = QPixmap(locate("data", "kworldclock/pics/flag.png")); _flagPixmap = TQPixmap(locate("data", "kworldclock/pics/flag.png"));
_flagMask = QPixmap(locate("data", "kworldclock/pics/flag-mask.xpm"), 0, QPixmap::ThresholdDither); _flagMask = TQPixmap(locate("data", "kworldclock/pics/flag-mask.xpm"), 0, TQPixmap::ThresholdDither);
_flagMask.setMask(_flagMask.createHeuristicMask()); _flagMask.setMask(_flagMask.createHeuristicMask());
} }
@ -50,31 +50,31 @@ void FlagList::addFlag(Flag *f)
} }
QPoint FlagList::getPosition(double la, double lo, int w, int h, int offset) TQPoint FlagList::getPosition(double la, double lo, int w, int h, int offset)
{ {
int x = (int)((double)w * (180.0 + lo) / 360.0); int x = (int)((double)w * (180.0 + lo) / 360.0);
int y = (int)((double)h * (90.0 - la) / 180.0); int y = (int)((double)h * (90.0 - la) / 180.0);
x = (x + offset + w/2) % w; x = (x + offset + w/2) % w;
return QPoint(x,y); return TQPoint(x,y);
} }
void FlagList::paint(QPainter *p, int width, int height, int offset) void FlagList::paint(TQPainter *p, int width, int height, int offset)
{ {
p->setPen(Qt::black); p->setPen(Qt::black);
QPtrListIterator<Flag> it(_flags); TQPtrListIterator<Flag> it(_flags);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
QPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), width, height, offset); TQPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), width, height, offset);
p->setPen(it.current()->color()); p->setPen(it.current()->color());
p->setBrush(it.current()->color()); p->setBrush(it.current()->color());
if (width > 100) if (width > 100)
{ {
pos -= QPoint(5,15); pos -= TQPoint(5,15);
p->drawPixmap(pos,_flagMask); p->drawPixmap(pos,_flagMask);
p->drawPixmap(pos,_flagPixmap); p->drawPixmap(pos,_flagPixmap);
@ -85,14 +85,14 @@ void FlagList::paint(QPainter *p, int width, int height, int offset)
} }
void FlagList::removeNearestFlag(const QPoint &target, int w, int h, int offset) void FlagList::removeNearestFlag(const TQPoint &target, int w, int h, int offset)
{ {
Flag *flag = 0; Flag *flag = 0;
QPoint diff; TQPoint diff;
int dist = INT_MAX; int dist = INT_MAX;
QPtrListIterator<Flag> it(_flags); TQPtrListIterator<Flag> it(_flags);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
diff = getPosition(it.current()->latitude(), it.current()->longitude(), w, h, offset); diff = getPosition(it.current()->latitude(), it.current()->longitude(), w, h, offset);
@ -117,13 +117,13 @@ void FlagList::save(KConfig *config)
{ {
config->writeEntry("Flags", _flags.count()); config->writeEntry("Flags", _flags.count());
QPtrListIterator<Flag> it(_flags); TQPtrListIterator<Flag> it(_flags);
int cnt=0; int cnt=0;
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
config->writeEntry(QString("Flag_%1_Color").arg(cnt), it.current()->color()); config->writeEntry(TQString("Flag_%1_Color").arg(cnt), it.current()->color());
config->writeEntry(QString("Flag_%1_Latitude").arg(cnt), it.current()->latitude()); config->writeEntry(TQString("Flag_%1_Latitude").arg(cnt), it.current()->latitude());
config->writeEntry(QString("Flag_%1_Longitude").arg(cnt), it.current()->longitude()); config->writeEntry(TQString("Flag_%1_Longitude").arg(cnt), it.current()->longitude());
cnt++; cnt++;
} }
} }
@ -136,9 +136,9 @@ void FlagList::load(KConfig *config)
for (int i=0; i<num; ++i) for (int i=0; i<num; ++i)
{ {
addFlag(new Flag(config->readDoubleNumEntry(QString("Flag_%1_Longitude").arg(i)), addFlag(new Flag(config->readDoubleNumEntry(TQString("Flag_%1_Longitude").arg(i)),
config->readDoubleNumEntry(QString("Flag_%1_Latitude").arg(i)), config->readDoubleNumEntry(TQString("Flag_%1_Latitude").arg(i)),
config->readColorEntry(QString("Flag_%1_Color").arg(i)))); config->readColorEntry(TQString("Flag_%1_Color").arg(i))));
} }
} }

@ -29,13 +29,13 @@
#define FLAGS_H #define FLAGS_H
#include <qstring.h> #include <tqstring.h>
#include <qcolor.h> #include <tqcolor.h>
#include <qptrlist.h> #include <tqptrlist.h>
#include <qpoint.h> #include <tqpoint.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qbitmap.h> #include <tqbitmap.h>
#include <kconfig.h> #include <kconfig.h>
@ -45,25 +45,25 @@ class Flag
{ {
public: public:
Flag(double lo, double la, const QColor &col) Flag(double lo, double la, const TQColor &col)
: _lo(lo), _la(la), _col(col) {}; : _lo(lo), _la(la), _col(col) {};
double longitude() const { return _lo; }; double longitude() const { return _lo; };
double latitude() const { return _la; }; double latitude() const { return _la; };
QColor color() const { return _col; }; TQColor color() const { return _col; };
QString annotation() const { return _ann; }; TQString annotation() const { return _ann; };
void setAnnotation(const QString &ann) { _ann = ann; }; void setAnnotation(const TQString &ann) { _ann = ann; };
private: private:
double _lo, _la; double _lo, _la;
QColor _col; TQColor _col;
QString _ann; TQString _ann;
}; };
@ -74,11 +74,11 @@ public:
FlagList(); FlagList();
void paint(QPainter *p, int w, int h, int offset); void paint(TQPainter *p, int w, int h, int offset);
void addFlag(Flag *f); void addFlag(Flag *f);
void removeNearestFlag(const QPoint &target, int w, int h, int offset); void removeNearestFlag(const TQPoint &target, int w, int h, int offset);
void removeAllFlags(); void removeAllFlags();
void save(KConfig *config); void save(KConfig *config);
@ -87,12 +87,12 @@ public:
private: private:
QPoint getPosition(double la, double lo, int w, int h, int offset); TQPoint getPosition(double la, double lo, int w, int h, int offset);
QPtrList<Flag> _flags; TQPtrList<Flag> _flags;
QPixmap _flagPixmap; TQPixmap _flagPixmap;
QBitmap _flagMask; TQBitmap _flagMask;
}; };

@ -15,15 +15,15 @@
class SimpleFlowIterator :public QGLayoutIterator class SimpleFlowIterator :public QGLayoutIterator
{ {
public: public:
SimpleFlowIterator( QPtrList<QLayoutItem> *l ) :idx(0), list(l) {} SimpleFlowIterator( TQPtrList<TQLayoutItem> *l ) :idx(0), list(l) {}
uint count() const; uint count() const;
QLayoutItem *current(); TQLayoutItem *current();
QLayoutItem *next(); TQLayoutItem *next();
QLayoutItem *takeCurrent(); TQLayoutItem *takeCurrent();
private: private:
int idx; int idx;
QPtrList<QLayoutItem> *list; TQPtrList<TQLayoutItem> *list;
}; };
@ -32,17 +32,17 @@ uint SimpleFlowIterator::count() const
return list->count(); return list->count();
} }
QLayoutItem *SimpleFlowIterator::current() TQLayoutItem *SimpleFlowIterator::current()
{ {
return idx < int(count()) ? list->at(idx) : 0; return idx < int(count()) ? list->at(idx) : 0;
} }
QLayoutItem *SimpleFlowIterator::next() TQLayoutItem *SimpleFlowIterator::next()
{ {
idx++; return current(); idx++; return current();
} }
QLayoutItem *SimpleFlowIterator::takeCurrent() TQLayoutItem *SimpleFlowIterator::takeCurrent()
{ {
return idx < int(count()) ? list->take( idx ) : 0; return idx < int(count()) ? list->take( idx ) : 0;
} }
@ -58,7 +58,7 @@ int SimpleFlow::heightForWidth( int w ) const
if ( cached_width != w ) { if ( cached_width != w ) {
//Not all C++ compilers support "mutable" yet: //Not all C++ compilers support "mutable" yet:
SimpleFlow * mthis = (SimpleFlow*)this; SimpleFlow * mthis = (SimpleFlow*)this;
int h = mthis->doLayout( QRect(0,0,w,0), TRUE ); int h = mthis->doLayout( TQRect(0,0,w,0), TRUE );
mthis->cached_hfw = h; mthis->cached_hfw = h;
mthis->cached_width = w; mthis->cached_width = w;
return h; return h;
@ -66,7 +66,7 @@ int SimpleFlow::heightForWidth( int w ) const
return cached_hfw; return cached_hfw;
} }
void SimpleFlow::addItem( QLayoutItem *item) void SimpleFlow::addItem( TQLayoutItem *item)
{ {
list.append( item ); list.append( item );
} }
@ -76,34 +76,34 @@ bool SimpleFlow::hasHeightForWidth() const
return TRUE; return TRUE;
} }
QSize SimpleFlow::sizeHint() const TQSize SimpleFlow::sizeHint() const
{ {
return minimumSize(); return minimumSize();
} }
QSizePolicy::ExpandData SimpleFlow::expanding() const TQSizePolicy::ExpandData SimpleFlow::expanding() const
{ {
return QSizePolicy::NoDirection; return TQSizePolicy::NoDirection;
} }
QLayoutIterator SimpleFlow::iterator() TQLayoutIterator SimpleFlow::iterator()
{ {
return QLayoutIterator( new SimpleFlowIterator( &list ) ); return TQLayoutIterator( new SimpleFlowIterator( &list ) );
} }
void SimpleFlow::setGeometry( const QRect &r ) void SimpleFlow::setGeometry( const TQRect &r )
{ {
QLayout::setGeometry( r ); TQLayout::setGeometry( r );
doLayout( r ); doLayout( r );
} }
int SimpleFlow::doLayout( const QRect &r, bool testonly ) int SimpleFlow::doLayout( const TQRect &r, bool testonly )
{ {
int x = r.x(); int x = r.x();
int y = r.y(); int y = r.y();
int h = 0; //height of this line so far. int h = 0; //height of this line so far.
QPtrListIterator<QLayoutItem> it(list); TQPtrListIterator<TQLayoutItem> it(list);
QLayoutItem *o; TQLayoutItem *o;
while ( (o=it.current()) != 0 ) { while ( (o=it.current()) != 0 ) {
++it; ++it;
int nextX = x + o->sizeHint().width() + spacing(); int nextX = x + o->sizeHint().width() + spacing();
@ -114,18 +114,18 @@ int SimpleFlow::doLayout( const QRect &r, bool testonly )
h = 0; h = 0;
} }
if ( !testonly ) if ( !testonly )
o->setGeometry( QRect( QPoint( x, y ), o->sizeHint() ) ); o->setGeometry( TQRect( TQPoint( x, y ), o->sizeHint() ) );
x = nextX; x = nextX;
h = QMAX( h, o->sizeHint().height() ); h = QMAX( h, o->sizeHint().height() );
} }
return y + h - r.y(); return y + h - r.y();
} }
QSize SimpleFlow::minimumSize() const TQSize SimpleFlow::minimumSize() const
{ {
QSize s(0,0); TQSize s(0,0);
QPtrListIterator<QLayoutItem> it(list); TQPtrListIterator<TQLayoutItem> it(list);
QLayoutItem *o; TQLayoutItem *o;
while ( (o=it.current()) != 0 ) { while ( (o=it.current()) != 0 ) {
++it; ++it;
s = s.expandedTo( o->minimumSize() ); s = s.expandedTo( o->minimumSize() );

@ -15,39 +15,39 @@
#ifndef FLOW_H #ifndef FLOW_H
#define FLOW_H #define FLOW_H
#include <qlayout.h> #include <tqlayout.h>
#include <qptrlist.h> #include <tqptrlist.h>
class SimpleFlow : public QLayout class SimpleFlow : public QLayout
{ {
public: public:
SimpleFlow( QWidget *parent, int border=0, int space=-1, SimpleFlow( TQWidget *parent, int border=0, int space=-1,
const char *name=0 ) const char *name=0 )
: QLayout( parent, border, space, name ), : TQLayout( parent, border, space, name ),
cached_width(0), cached_hfw(0) {} cached_width(0), cached_hfw(0) {}
SimpleFlow( QLayout* parent, int space=-1, const char *name=0 ) SimpleFlow( TQLayout* parent, int space=-1, const char *name=0 )
: QLayout( parent, space, name ), : TQLayout( parent, space, name ),
cached_width(0), cached_hfw(0) {} cached_width(0), cached_hfw(0) {}
SimpleFlow( int space=-1, const char *name=0 ) SimpleFlow( int space=-1, const char *name=0 )
: QLayout( space, name ), : TQLayout( space, name ),
cached_width(0), cached_hfw(0) {} cached_width(0), cached_hfw(0) {}
~SimpleFlow(); ~SimpleFlow();
void addItem( QLayoutItem *item); void addItem( TQLayoutItem *item);
bool hasHeightForWidth() const; bool hasHeightForWidth() const;
int heightForWidth( int ) const; int heightForWidth( int ) const;
QSize sizeHint() const; TQSize sizeHint() const;
QSize minimumSize() const; TQSize minimumSize() const;
QLayoutIterator iterator(); TQLayoutIterator iterator();
QSizePolicy::ExpandData expanding() const; TQSizePolicy::ExpandData expanding() const;
protected: protected:
void setGeometry( const QRect& ); void setGeometry( const TQRect& );
private: private:
int doLayout( const QRect&, bool testonly = FALSE ); int doLayout( const TQRect&, bool testonly = FALSE );
QPtrList<QLayoutItem> list; TQPtrList<TQLayoutItem> list;
int cached_width; int cached_width;
int cached_hfw; int cached_hfw;
}; };

@ -28,11 +28,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qwidget.h> #include <tqwidget.h>
#include <kapplication.h> #include <kapplication.h>
@ -48,17 +48,17 @@
#include "zoneclock.h" #include "zoneclock.h"
WorldWideWatch::WorldWideWatch(bool restore, QWidget *parent, const char *name) WorldWideWatch::WorldWideWatch(bool restore, TQWidget *parent, const char *name)
: KMainWindow(parent, name) : KMainWindow(parent, name)
{ {
KGlobal::locale()->insertCatalogue("timezones"); // For time zone translation KGlobal::locale()->insertCatalogue("timezones"); // For time zone translation
QWidget *w = new QWidget(this); TQWidget *w = new TQWidget(this);
setCentralWidget(w); setCentralWidget(w);
setPlainCaption(i18n("KDE World Clock")); setPlainCaption(i18n("KDE World Clock"));
QVBoxLayout *vbox = new QVBoxLayout(w, 0,0); TQVBoxLayout *vbox = new TQVBoxLayout(w, 0,0);
_map = new MapWidget(false, restore, w); _map = new MapWidget(false, restore, w);
vbox->addWidget(_map,1); vbox->addWidget(_map,1);
@ -66,8 +66,8 @@ WorldWideWatch::WorldWideWatch(bool restore, QWidget *parent, const char *name)
_clocks = new ZoneClockPanel(w); _clocks = new ZoneClockPanel(w);
vbox->addWidget(_clocks); vbox->addWidget(_clocks);
connect(_map, SIGNAL(addClockClicked(const QString &)), _clocks, SLOT(addClock(const QString &))); connect(_map, TQT_SIGNAL(addClockClicked(const TQString &)), _clocks, TQT_SLOT(addClock(const TQString &)));
connect(_map, SIGNAL(saveSettings()), this, SLOT(doSave())); connect(_map, TQT_SIGNAL(saveSettings()), this, TQT_SLOT(doSave()));
if (restore) if (restore)
load(kapp->config()); load(kapp->config());
@ -103,19 +103,19 @@ void WorldWideWatch::doSave()
void WatchApplication::dumpMap() void WatchApplication::dumpMap()
{ {
// guess some default parameters // guess some default parameters
QSize mapSize(kapp->desktop()->size()); TQSize mapSize(kapp->desktop()->size());
KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QCString themeName = args->getOption("theme"); TQCString themeName = args->getOption("theme");
QCString outName = args->getOption("o"); TQCString outName = args->getOption("o");
QCString ssize = args->getOption("size"); TQCString ssize = args->getOption("size");
if (!ssize.isEmpty()) if (!ssize.isEmpty())
{ {
int w,h; int w,h;
if (sscanf(ssize.data(), "%dx%d", &w, &h) == 2) if (sscanf(ssize.data(), "%dx%d", &w, &h) == 2)
mapSize = QSize(w,h); mapSize = TQSize(w,h);
} }
kdDebug() << "theme=" << themeName << " out=" << outName << " size=" << mapSize.width() << "x" << mapSize.height() << endl; kdDebug() << "theme=" << themeName << " out=" << outName << " size=" << mapSize.width() << "x" << mapSize.height() << endl;
@ -124,8 +124,8 @@ void WatchApplication::dumpMap()
w->setTheme(themeName); w->setTheme(themeName);
w->setSize(mapSize.width(), mapSize.height()); w->setSize(mapSize.width(), mapSize.height());
QPixmap pm = w->calculatePixmap(); TQPixmap pm = w->calculatePixmap();
QPainter p(&pm); TQPainter p(&pm);
w->paintContents(&p); w->paintContents(&p);
pm.save(outName, "PPM"); pm.save(outName, "PPM");
@ -154,8 +154,8 @@ int WatchApplication::newInstance()
static void listThemes() static void listThemes()
{ {
QPtrList<MapTheme> _themes = MapLoader::themes(); TQPtrList<MapTheme> _themes = MapLoader::themes();
QPtrListIterator<MapTheme> it(_themes); TQPtrListIterator<MapTheme> it(_themes);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
printf("%s\n", it.current()->tag().local8Bit().data()); printf("%s\n", it.current()->tag().local8Bit().data());

@ -43,7 +43,7 @@ class WorldWideWatch : public KMainWindow
public: public:
WorldWideWatch(bool restore=false, QWidget *parent=0, const char *name=0); WorldWideWatch(bool restore=false, TQWidget *parent=0, const char *name=0);
void save(KConfig *config); void save(KConfig *config);
void load(KConfig *load); void load(KConfig *load);

@ -27,12 +27,12 @@
*/ */
#include <time.h> #include <time.h>
#include <qvaluelist.h> #include <tqvaluelist.h>
#include <qdir.h> #include <tqdir.h>
#include <qimage.h> #include <tqimage.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qtl.h> #include <tqtl.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <kglobal.h> #include <kglobal.h>
@ -45,12 +45,12 @@
#include "maploader.h" #include "maploader.h"
QPtrList<MapTheme> MapLoader::themes() TQPtrList<MapTheme> MapLoader::themes()
{ {
QPtrList<MapTheme> result; TQPtrList<MapTheme> result;
QStringList files = KGlobal::dirs()->findAllResources("data", "kworldclock/maps/*/*.desktop"); TQStringList files = KGlobal::dirs()->findAllResources("data", "kworldclock/maps/*/*.desktop");
for (QStringList::Iterator it=files.begin(); it != files.end(); ++it) for (TQStringList::Iterator it=files.begin(); it != files.end(); ++it)
{ {
KDesktopFile conf(*it); KDesktopFile conf(*it);
conf.setGroup("Theme"); conf.setGroup("Theme");
@ -61,20 +61,20 @@ QPtrList<MapTheme> MapLoader::themes()
} }
QStringList MapLoader::maps(const QString &theme) TQStringList MapLoader::maps(const TQString &theme)
{ {
return KGlobal::dirs()->findAllResources("data", QString("kworldclock/maps/%1/*.jpg").arg(theme)); return KGlobal::dirs()->findAllResources("data", TQString("kworldclock/maps/%1/*.jpg").arg(theme));
} }
void MapLoader::load(unsigned int width, const QString &theme, unsigned int height, float opacity) void MapLoader::load(unsigned int width, const TQString &theme, unsigned int height, float opacity)
{ {
// find the maps available // find the maps available
QValueList<uint> sizes; TQValueList<uint> sizes;
QStringList files = maps(theme); TQStringList files = maps(theme);
for (uint i=0; i<files.count(); ++i) for (uint i=0; i<files.count(); ++i)
{ {
QString f = files[i]; TQString f = files[i];
int pos = f.findRev("/"); int pos = f.findRev("/");
if (pos >= 0) if (pos >= 0)
f = f.mid(pos+1); f = f.mid(pos+1);
@ -94,14 +94,14 @@ void MapLoader::load(unsigned int width, const QString &theme, unsigned int heig
break; break;
} }
QImage image; TQImage image;
if (size == 0) if (size == 0)
{ {
image = QImage(locate("data", "kworldclock/maps/depths/800.jpg")); image = TQImage(locate("data", "kworldclock/maps/depths/800.jpg"));
size = 800; size = 800;
} }
else else
image = QImage(locate("data", QString("kworldclock/maps/%1/%2.jpg").arg(theme).arg(size))); image = TQImage(locate("data", TQString("kworldclock/maps/%1/%2.jpg").arg(theme).arg(size)));
if (height == 0) if (height == 0)
height = width/2; height = width/2;
@ -117,14 +117,14 @@ void MapLoader::load(unsigned int width, const QString &theme, unsigned int heig
} }
QBitmap MapLoader::darkMask(int width, int height) TQBitmap MapLoader::darkMask(int width, int height)
{ {
time_t t; time_t t;
struct tm *tmp; struct tm *tmp;
double jt, sunra, sundec, sunrv, sunlong; double jt, sunra, sundec, sunrv, sunlong;
short *wtab; short *wtab;
QBitmap illuMask(width, height); TQBitmap illuMask(width, height);
// calculate the position of the sun // calculate the position of the sun
t = time(NULL); t = time(NULL);
@ -141,7 +141,7 @@ QBitmap MapLoader::darkMask(int width, int height)
// draw illumination // draw illumination
illuMask.fill(Qt::black); illuMask.fill(Qt::black);
QPainter p; TQPainter p;
p.begin(&illuMask); p.begin(&illuMask);
int start, stop; int start, stop;

@ -28,9 +28,9 @@
#ifndef MAP_LOADER_H #ifndef MAP_LOADER_H
#define MAP_LOADER_H #define MAP_LOADER_H
#include <qpixmap.h> #include <tqpixmap.h>
#include <qbitmap.h> #include <tqbitmap.h>
#include <qptrlist.h> #include <tqptrlist.h>
class MapTheme class MapTheme
@ -38,10 +38,10 @@ class MapTheme
public: public:
MapTheme() : _name(""), _tag(""), _id(0) {}; MapTheme() : _name(""), _tag(""), _id(0) {};
MapTheme(const QString &name, const QString &tag) : _name(name), _tag(tag), _id(0) {}; MapTheme(const TQString &name, const TQString &tag) : _name(name), _tag(tag), _id(0) {};
QString tag() { return _tag; }; TQString tag() { return _tag; };
QString name() { return _name; }; TQString name() { return _name; };
void setID(int i) { _id = i; }; void setID(int i) { _id = i; };
int ID() { return _id; }; int ID() { return _id; };
@ -49,7 +49,7 @@ public:
private: private:
QString _name, _tag; TQString _name, _tag;
int _id; int _id;
}; };
@ -59,21 +59,21 @@ class MapLoader
{ {
public: public:
static QPtrList<MapTheme> themes(); static TQPtrList<MapTheme> themes();
void load(unsigned int width=400, const QString &theme = "earth", unsigned int height=0, float opacity=0.5); void load(unsigned int width=400, const TQString &theme = "earth", unsigned int height=0, float opacity=0.5);
QPixmap lightMap() { return _light; }; TQPixmap lightMap() { return _light; };
QPixmap darkMap() { return _dark; }; TQPixmap darkMap() { return _dark; };
QBitmap darkMask(int width, int height); TQBitmap darkMask(int width, int height);
private: private:
QStringList maps(const QString &theme); TQStringList maps(const TQString &theme);
QPixmap _light, _dark; TQPixmap _light, _dark;
}; };

@ -30,7 +30,7 @@
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <kapplication.h> #include <kapplication.h>
#include <kcmdlineargs.h> #include <kcmdlineargs.h>
@ -42,12 +42,12 @@
#include <kmessagebox.h> #include <kmessagebox.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <qcursor.h> #include <tqcursor.h>
#include <qpainter.h> #include <tqpainter.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <qregexp.h> #include <tqregexp.h>
#include <qiconset.h> #include <tqiconset.h>
#include <qtooltip.h> #include <tqtooltip.h>
#include "cities.h" #include "cities.h"
@ -56,8 +56,8 @@
#include "mapwidget.moc" #include "mapwidget.moc"
MapWidget::MapWidget(bool applet, bool restore, QWidget *parent, const char *name) MapWidget::MapWidget(bool applet, bool restore, TQWidget *parent, const char *name)
: QWidget(parent, name), _loader(), _illumination(true), _cities(true), _flags(true), _cityList(0), : TQWidget(parent, name), _loader(), _illumination(true), _cities(true), _flags(true), _cityList(0),
_applet(applet), _width(0), _height(0) _applet(applet), _width(0), _height(0)
{ {
// this ugly construction is necessary so we don't load // this ugly construction is necessary so we don't load
@ -74,7 +74,7 @@ MapWidget::MapWidget(bool applet, bool restore, QWidget *parent, const char *nam
delete config; delete config;
} }
setBackgroundMode(QWidget::NoBackground); setBackgroundMode(TQWidget::NoBackground);
gmt_position = 0; gmt_position = 0;
time_t t = time(NULL); time_t t = time(NULL);
@ -83,37 +83,37 @@ MapWidget::MapWidget(bool applet, bool restore, QWidget *parent, const char *nam
_flagList = new FlagList; _flagList = new FlagList;
int id; int id;
_flagPopup = new QPopupMenu(this); _flagPopup = new TQPopupMenu(this);
QPixmap flag = QPixmap(locate("data", "kworldclock/pics/flag-red.png")); TQPixmap flag = TQPixmap(locate("data", "kworldclock/pics/flag-red.png"));
id = _flagPopup->insertItem(QIconSet(flag), i18n("Add &Red"), this, SLOT(addFlag(int))); id = _flagPopup->insertItem(TQIconSet(flag), i18n("Add &Red"), this, TQT_SLOT(addFlag(int)));
_flagPopup->setItemParameter(id, 0); _flagPopup->setItemParameter(id, 0);
flag = QPixmap(locate("data", "kworldclock/pics/flag-green.png")); flag = TQPixmap(locate("data", "kworldclock/pics/flag-green.png"));
id = _flagPopup->insertItem(QIconSet(flag), i18n("Add &Green"), this, SLOT(addFlag(int))); id = _flagPopup->insertItem(TQIconSet(flag), i18n("Add &Green"), this, TQT_SLOT(addFlag(int)));
_flagPopup->setItemParameter(id, 1); _flagPopup->setItemParameter(id, 1);
flag = QPixmap(locate("data", "kworldclock/pics/flag-blue.png")); flag = TQPixmap(locate("data", "kworldclock/pics/flag-blue.png"));
id = _flagPopup->insertItem(QIconSet(flag), i18n("Add &Blue"), this, SLOT(addFlag(int))); id = _flagPopup->insertItem(TQIconSet(flag), i18n("Add &Blue"), this, TQT_SLOT(addFlag(int)));
_flagPopup->setItemParameter(id, 2); _flagPopup->setItemParameter(id, 2);
id = _flagPopup->insertItem(i18n("Add &Custom..."), this, SLOT(addFlag(int))); id = _flagPopup->insertItem(i18n("Add &Custom..."), this, TQT_SLOT(addFlag(int)));
_flagPopup->setItemParameter(id, 3); _flagPopup->setItemParameter(id, 3);
_flagPopup->insertSeparator(); _flagPopup->insertSeparator();
_flagPopup->insertItem(i18n("&Remove Flag"), this, SLOT(removeFlag())); _flagPopup->insertItem(i18n("&Remove Flag"), this, TQT_SLOT(removeFlag()));
_flagPopup->insertItem(i18n("&Remove All Flags"), this, SLOT(removeAllFlags())); _flagPopup->insertItem(i18n("&Remove All Flags"), this, TQT_SLOT(removeAllFlags()));
_themePopup = new QPopupMenu(this); _themePopup = new TQPopupMenu(this);
_themes = MapLoader::themes(); _themes = MapLoader::themes();
int cnt=0; int cnt=0;
QPtrListIterator<MapTheme> it(_themes); TQPtrListIterator<MapTheme> it(_themes);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
int id = _themePopup->insertItem(it.current()->name(), this, SLOT(themeSelected(int))); int id = _themePopup->insertItem(it.current()->name(), this, TQT_SLOT(themeSelected(int)));
_themePopup->setItemParameter(id, cnt++); _themePopup->setItemParameter(id, cnt++);
it.current()->setID(id); it.current()->setID(id);
} }
QPopupMenu *_clocksPopup = new QPopupMenu(this); TQPopupMenu *_clocksPopup = new TQPopupMenu(this);
_clocksPopup->insertItem(i18n("&Add..."), this, SLOT(addClock())); _clocksPopup->insertItem(i18n("&Add..."), this, TQT_SLOT(addClock()));
_popup = new QPopupMenu(this); _popup = new TQPopupMenu(this);
_popup->insertItem(i18n("&Flags"), _flagPopup); _popup->insertItem(i18n("&Flags"), _flagPopup);
if (!applet) if (!applet)
@ -121,37 +121,37 @@ MapWidget::MapWidget(bool applet, bool restore, QWidget *parent, const char *nam
_popup->insertSeparator(); _popup->insertSeparator();
_popup->insertItem(i18n("&Map Theme"), _themePopup); _popup->insertItem(i18n("&Map Theme"), _themePopup);
_illuminationID = _popup->insertItem(i18n("Show &Daylight"), this, SLOT(toggleIllumination())); _illuminationID = _popup->insertItem(i18n("Show &Daylight"), this, TQT_SLOT(toggleIllumination()));
_citiesID = _popup->insertItem(i18n("Show &Cities"), this, SLOT(toggleCities())); _citiesID = _popup->insertItem(i18n("Show &Cities"), this, TQT_SLOT(toggleCities()));
_flagsID = _popup->insertItem(i18n("Show F&lags"), this, SLOT(toggleFlags())); _flagsID = _popup->insertItem(i18n("Show F&lags"), this, TQT_SLOT(toggleFlags()));
if (!applet) if (!applet)
{ {
_popup->insertSeparator(); _popup->insertSeparator();
_popup->insertItem(i18n("&Save Settings"), this, SLOT(slotSaveSettings())); _popup->insertItem(i18n("&Save Settings"), this, TQT_SLOT(slotSaveSettings()));
} }
_popup->insertSeparator(); _popup->insertSeparator();
_popup->insertItem(i18n("&About"), this, SLOT(about())); _popup->insertItem(i18n("&About"), this, TQT_SLOT(about()));
QTimer *timer = new QTimer(this); TQTimer *timer = new TQTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()));
timer->start(1000); timer->start(1000);
_cityIndicator = new QLabel(0,0, WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); _cityIndicator = new TQLabel(0,0, WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM );
_cityIndicator->setMargin(1); _cityIndicator->setMargin(1);
_cityIndicator->setIndent(0); _cityIndicator->setIndent(0);
_cityIndicator->setAutoMask(false); _cityIndicator->setAutoMask(false);
_cityIndicator->setLineWidth(1); _cityIndicator->setLineWidth(1);
_cityIndicator->setAlignment(QLabel::AlignAuto | QLabel::AlignTop); _cityIndicator->setAlignment(TQLabel::AlignAuto | TQLabel::AlignTop);
_cityIndicator->setAutoResize(true); _cityIndicator->setAutoResize(true);
_cityIndicator->setFrameStyle(QFrame::Box | QFrame::Plain); _cityIndicator->setFrameStyle(TQFrame::Box | TQFrame::Plain);
_cityIndicator->setPalette(QToolTip::palette()); _cityIndicator->setPalette(TQToolTip::palette());
if (restore && !applet) if (restore && !applet)
load(kapp->config()); load(kapp->config());
connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateCityIndicator())); connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateCityIndicator()));
} }
@ -178,7 +178,7 @@ void MapWidget::load(KConfig *config)
{ {
KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("theme")) if (args->isSet("theme"))
setTheme(QString::fromLocal8Bit(args->getOption("theme"))); setTheme(TQString::fromLocal8Bit(args->getOption("theme")));
else else
setTheme(config->readEntry("Theme", "depths")); setTheme(config->readEntry("Theme", "depths"));
@ -210,10 +210,10 @@ void MapWidget::addClock()
if (!_cityList) if (!_cityList)
_cityList = new CityList; _cityList = new CityList;
QPoint where; TQPoint where;
City *c = _cityList->getNearestCity(_width, _height, gmt_position, _flagPos.x(), _flagPos.y(), where); City *c = _cityList->getNearestCity(_width, _height, gmt_position, _flagPos.x(), _flagPos.y(), where);
QString zone = ""; TQString zone = "";
if (c) if (c)
zone = c->name(); zone = c->name();
@ -223,7 +223,7 @@ void MapWidget::addClock()
void MapWidget::addFlag(int index) void MapWidget::addFlag(int index)
{ {
QColor col = Qt::red; TQColor col = Qt::red;
switch (index) switch (index)
{ {
@ -262,7 +262,7 @@ void MapWidget::removeFlag()
void MapWidget::removeAllFlags() void MapWidget::removeAllFlags()
{ {
if ( KMessageBox::warningContinueCancel( this, i18n( "Do you really want to remove all flags?" ), QString::null, KStdGuiItem::del() ) == KMessageBox::Continue ) if ( KMessageBox::warningContinueCancel( this, i18n( "Do you really want to remove all flags?" ), TQString::null, KStdGuiItem::del() ) == KMessageBox::Continue )
_flagList->removeAllFlags(); _flagList->removeAllFlags();
update(); update();
@ -325,7 +325,7 @@ void MapWidget::updateBackground()
} }
QPixmap MapWidget::getPixmap() TQPixmap MapWidget::getPixmap()
{ {
return _pixmap; return _pixmap;
} }
@ -350,13 +350,13 @@ void MapWidget::timeout()
} }
QString MapWidget::cityTime(const QString &city) TQString MapWidget::cityTime(const TQString &city)
{ {
QString result = i18n(city.latin1()); // Time zone translation TQString result = i18n(city.latin1()); // Time zone translation
int pos = result.find("/"); int pos = result.find("/");
if (pos >= 0) if (pos >= 0)
result = result.mid(pos+1); result = result.mid(pos+1);
result.replace(QRegExp("_"), " "); result.replace(TQRegExp("_"), " ");
result.append(": "); result.append(": ");
char *initial_TZ = getenv("TZ"); char *initial_TZ = getenv("TZ");
@ -364,9 +364,9 @@ QString MapWidget::cityTime(const QString &city)
tzset(); tzset();
time_t t = time(NULL); time_t t = time(NULL);
QDateTime dt; TQDateTime dt;
dt.setTime_t(t); dt.setTime_t(t);
result.append(QString("%1, %2").arg(KGlobal::locale()->formatTime(dt.time(), true)).arg(KGlobal::locale()->formatDate(dt.date(), true))); result.append(TQString("%1, %2").arg(KGlobal::locale()->formatTime(dt.time(), true)).arg(KGlobal::locale()->formatDate(dt.date(), true)));
if (initial_TZ != 0) if (initial_TZ != 0)
setenv("TZ", initial_TZ, 1); setenv("TZ", initial_TZ, 1);
@ -377,13 +377,13 @@ QString MapWidget::cityTime(const QString &city)
} }
void MapWidget::enterEvent(QEvent *) void MapWidget::enterEvent(TQEvent *)
{ {
if ( _cities ) if ( _cities )
updateCityIndicator(); updateCityIndicator();
} }
void MapWidget::leaveEvent(QEvent *) void MapWidget::leaveEvent(TQEvent *)
{ {
_cityIndicator->hide(); _cityIndicator->hide();
m_timer.stop(); m_timer.stop();
@ -399,15 +399,15 @@ void MapWidget::about()
void MapWidget::themeSelected(int index) void MapWidget::themeSelected(int index)
{ {
QString t = _themes.at(index)->tag(); TQString t = _themes.at(index)->tag();
if (!t.isEmpty()) if (!t.isEmpty())
setTheme(t); setTheme(t);
} }
void MapWidget::mousePressEvent(QMouseEvent *ev) void MapWidget::mousePressEvent(TQMouseEvent *ev)
{ {
if (ev->button() == QMouseEvent::RightButton) if (ev->button() == TQMouseEvent::RightButton)
{ {
_flagPos = ev->pos(); _flagPos = ev->pos();
_popup->exec(ev->globalPos()); _popup->exec(ev->globalPos());
@ -415,7 +415,7 @@ void MapWidget::mousePressEvent(QMouseEvent *ev)
} }
void MapWidget::mouseMoveEvent(QMouseEvent *) void MapWidget::mouseMoveEvent(TQMouseEvent *)
{ {
if (!_cities) if (!_cities)
return; return;
@ -426,8 +426,8 @@ void MapWidget::mouseMoveEvent(QMouseEvent *)
void MapWidget::updateCityIndicator() void MapWidget::updateCityIndicator()
{ {
QPoint where; TQPoint where;
QPoint pos = mapFromGlobal(QCursor::pos()); TQPoint pos = mapFromGlobal(TQCursor::pos());
if (!_cityList) if (!_cityList)
_cityList = new CityList; _cityList = new CityList;
@ -436,23 +436,23 @@ void MapWidget::updateCityIndicator()
if (c) if (c)
{ {
_currentCity = c->name(); _currentCity = c->name();
showIndicator(QCursor::pos()); showIndicator(TQCursor::pos());
} }
else else
_cityIndicator->hide(); _cityIndicator->hide();
} }
void MapWidget::showIndicator(const QPoint &pos) void MapWidget::showIndicator(const TQPoint &pos)
{ {
_cityIndicator->setText(cityTime(_currentCity)); _cityIndicator->setText(cityTime(_currentCity));
int w = _cityIndicator->width(); int w = _cityIndicator->width();
int h = _cityIndicator->height(); int h = _cityIndicator->height();
QRect desk = KGlobalSettings::desktopGeometry(pos); TQRect desk = KGlobalSettings::desktopGeometry(pos);
QPoint newPos; TQPoint newPos;
if (pos.x()+w+10 > desk.right()) if (pos.x()+w+10 > desk.right())
newPos.setX(pos.x()-w-5); newPos.setX(pos.x()-w-5);
@ -471,11 +471,11 @@ void MapWidget::showIndicator(const QPoint &pos)
} }
void MapWidget::setTheme(const QString &theme) void MapWidget::setTheme(const TQString &theme)
{ {
_theme = theme; _theme = theme;
QPtrListIterator<MapTheme> it(_themes); TQPtrListIterator<MapTheme> it(_themes);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
_themePopup->setItemChecked(it.current()->ID(), theme == it.current()->tag()); _themePopup->setItemChecked(it.current()->ID(), theme == it.current()->tag());
@ -509,13 +509,13 @@ void MapWidget::setSize(int w, int h)
updateBackground(); updateBackground();
} }
void MapWidget::resizeEvent(QResizeEvent *ev) void MapWidget::resizeEvent(TQResizeEvent *ev)
{ {
setSize(width(), height()); setSize(width(), height());
QWidget::resizeEvent(ev); TQWidget::resizeEvent(ev);
} }
void MapWidget::paintContents(QPainter *p) void MapWidget::paintContents(TQPainter *p)
{ {
if (_cities) if (_cities)
_cityList->paint(p, _width, _height, gmt_position); _cityList->paint(p, _width, _height, gmt_position);
@ -523,13 +523,13 @@ void MapWidget::paintContents(QPainter *p)
_flagList->paint(p, _width, _height, gmt_position); _flagList->paint(p, _width, _height, gmt_position);
} }
void MapWidget::paintEvent(QPaintEvent *ev) void MapWidget::paintEvent(TQPaintEvent *ev)
{ {
QWidget::paintEvent(ev); TQWidget::paintEvent(ev);
if (_cities || _flags) if (_cities || _flags)
{ {
QPainter p(this); TQPainter p(this);
p.setClipping(true); p.setClipping(true);
p.setClipRegion(ev->region()); p.setClipRegion(ev->region());
@ -539,16 +539,16 @@ void MapWidget::paintEvent(QPaintEvent *ev)
} }
QPixmap MapWidget::calculatePixmap() TQPixmap MapWidget::calculatePixmap()
{ {
QPixmap map; TQPixmap map;
if (_illumination) if (_illumination)
{ {
map = _loader.darkMap(); map = _loader.darkMap();
QPixmap clean = _loader.lightMap(); TQPixmap clean = _loader.lightMap();
QPainter mp(&map); TQPainter mp(&map);
clean.setMask(_loader.darkMask(map.width(), map.height())); clean.setMask(_loader.darkMask(map.width(), map.height()));
mp.drawPixmap(0,0, clean); mp.drawPixmap(0,0, clean);
} }
@ -557,8 +557,8 @@ QPixmap MapWidget::calculatePixmap()
int greenwich = map.width()/2; int greenwich = map.width()/2;
QPixmap pm(_width, _height); TQPixmap pm(_width, _height);
QPainter p; TQPainter p;
p.begin(&pm); p.begin(&pm);
if (gmt_position >= greenwich) if (gmt_position >= greenwich)

@ -32,12 +32,12 @@
#include <time.h> #include <time.h>
#include <qwidget.h> #include <tqwidget.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qstringlist.h> #include <tqstringlist.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qpoint.h> #include <tqpoint.h>
#include <qtimer.h> #include <tqtimer.h>
class QPopupMenu; class QPopupMenu;
@ -59,10 +59,10 @@ class MapWidget : public QWidget
public: public:
MapWidget(bool applet=false, bool restore=false, QWidget *parent=0, const char *name=0); MapWidget(bool applet=false, bool restore=false, TQWidget *parent=0, const char *name=0);
~MapWidget(); ~MapWidget();
void setTheme(const QString &theme); void setTheme(const TQString &theme);
void setTime(struct tm *time); void setTime(struct tm *time);
void setIllumination(bool i); void setIllumination(bool i);
void setCities(bool c); void setCities(bool c);
@ -74,15 +74,15 @@ public:
void updateBackground(); void updateBackground();
QPixmap getPixmap(); TQPixmap getPixmap();
QPopupMenu* contextMenu() const { return _popup; } TQPopupMenu* contextMenu() const { return _popup; }
void paintContents(QPainter *p); void paintContents(TQPainter *p);
QPixmap calculatePixmap(); TQPixmap calculatePixmap();
signals: signals:
void addClockClicked(const QString &zone); void addClockClicked(const TQString &zone);
void saveSettings(); void saveSettings();
@ -107,12 +107,12 @@ public slots:
protected: protected:
void resizeEvent(QResizeEvent *ev); void resizeEvent(TQResizeEvent *ev);
void paintEvent(QPaintEvent *ev); void paintEvent(TQPaintEvent *ev);
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(TQMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev); void mouseMoveEvent(TQMouseEvent *ev);
void enterEvent(QEvent *ev); void enterEvent(TQEvent *ev);
void leaveEvent(QEvent *ev); void leaveEvent(TQEvent *ev);
private slots: private slots:
@ -125,34 +125,34 @@ private slots:
private: private:
void updateMap(); void updateMap();
QString cityTime(const QString &city); TQString cityTime(const TQString &city);
void showIndicator(const QPoint &pos); void showIndicator(const TQPoint &pos);
MapLoader _loader; MapLoader _loader;
QString _theme; TQString _theme;
QPixmap _pixmap; TQPixmap _pixmap;
int gmt_position; int gmt_position;
time_t sec; time_t sec;
QPopupMenu *_popup, *_themePopup, *_flagPopup; TQPopupMenu *_popup, *_themePopup, *_flagPopup;
QPtrList<MapTheme> _themes; TQPtrList<MapTheme> _themes;
bool _illumination, _cities, _flags; bool _illumination, _cities, _flags;
int _illuminationID, _citiesID, _flagsID; int _illuminationID, _citiesID, _flagsID;
CityList *_cityList; CityList *_cityList;
QLabel *_cityIndicator; TQLabel *_cityIndicator;
QString _currentCity; TQString _currentCity;
FlagList *_flagList; FlagList *_flagList;
QPoint _flagPos; TQPoint _flagPos;
bool _applet; bool _applet;
QTimer m_timer; TQTimer m_timer;
int _width, _height; int _width, _height;
}; };

@ -31,13 +31,13 @@
#include <time.h> #include <time.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <qtimer.h> #include <tqtimer.h>
#include <qcombobox.h> #include <tqcombobox.h>
#include <qlineedit.h> #include <tqlineedit.h>
#include <qpopupmenu.h> #include <tqpopupmenu.h>
#include <kglobal.h> #include <kglobal.h>
@ -51,24 +51,24 @@
#include "zoneclock.moc" #include "zoneclock.moc"
#include <kdebug.h> #include <kdebug.h>
ZoneClock::ZoneClock(const QString &zone, const QString &name, QWidget *parent, const char *n) ZoneClock::ZoneClock(const TQString &zone, const TQString &name, TQWidget *parent, const char *n)
: QFrame(parent, n), _zone(zone), _name(name) : TQFrame(parent, n), _zone(zone), _name(name)
{ {
setFrameStyle(QFrame::Panel | QFrame::Raised); setFrameStyle(TQFrame::Panel | TQFrame::Raised);
QHBoxLayout *hbox = new QHBoxLayout(this, 2,2); TQHBoxLayout *hbox = new TQHBoxLayout(this, 2,2);
_name.append(":"); _name.append(":");
_nameLabel = new QLabel(_name, this); _nameLabel = new TQLabel(_name, this);
hbox->addWidget(_nameLabel, 1); hbox->addWidget(_nameLabel, 1);
hbox->addSpacing(4); hbox->addSpacing(4);
_timeLabel = new QLabel(this); _timeLabel = new TQLabel(this);
hbox->addWidget(_timeLabel, 0, Qt::AlignRight); hbox->addWidget(_timeLabel, 0, Qt::AlignRight);
_popup = new QPopupMenu(this); _popup = new TQPopupMenu(this);
_popup->insertItem(i18n("&Edit..."), this, SLOT(editClock())); _popup->insertItem(i18n("&Edit..."), this, TQT_SLOT(editClock()));
_popup->insertItem(i18n("&Add..."), this, SLOT(slotAddClock())); _popup->insertItem(i18n("&Add..."), this, TQT_SLOT(slotAddClock()));
_popup->insertItem(i18n("&Remove"), this, SLOT(slotRemoveClock())); _popup->insertItem(i18n("&Remove"), this, TQT_SLOT(slotRemoveClock()));
_nameLabel->installEventFilter(this); _nameLabel->installEventFilter(this);
_timeLabel->installEventFilter(this); _timeLabel->installEventFilter(this);
@ -84,7 +84,7 @@ void ZoneClock::slotRemoveClock()
// So instead we fire up an idle event triggering the delete // So instead we fire up an idle event triggering the delete
// after the return. // after the return.
QTimer::singleShot(0, this, SLOT(removeTimeout())); TQTimer::singleShot(0, this, TQT_SLOT(removeTimeout()));
} }
@ -104,8 +104,8 @@ void ZoneClock::editClock()
{ {
ClockDialog *_dlg = new ClockDialog(this, 0, true); ClockDialog *_dlg = new ClockDialog(this, 0, true);
CityList cities; CityList cities;
QStringList timezones = cities.timezones(); TQStringList timezones = cities.timezones();
for (QStringList::iterator it = timezones.begin(); it != timezones.end(); ++it) for (TQStringList::iterator it = timezones.begin(); it != timezones.end(); ++it)
_dlg->ClockZone->insertItem(i18n((*it).utf8())); _dlg->ClockZone->insertItem(i18n((*it).utf8()));
_dlg->ClockCaption->setText(_nameLabel->text().left(_nameLabel->text().length()-1)); _dlg->ClockCaption->setText(_nameLabel->text().left(_nameLabel->text().length()-1));
@ -116,7 +116,7 @@ void ZoneClock::editClock()
break; break;
} }
if (_dlg->exec() == QDialog::Accepted) if (_dlg->exec() == TQDialog::Accepted)
{ {
_zone = timezones[_dlg->ClockZone->currentItem()]; _zone = timezones[_dlg->ClockZone->currentItem()];
_name = _dlg->ClockCaption->text().append(":"); _name = _dlg->ClockCaption->text().append(":");
@ -130,16 +130,16 @@ void ZoneClock::editClock()
} }
bool ZoneClock::eventFilter(QObject *obj, QEvent *ev) bool ZoneClock::eventFilter(TQObject *obj, TQEvent *ev)
{ {
if (ev->type() == QEvent::MouseButtonPress) if (ev->type() == TQEvent::MouseButtonPress)
{ {
QMouseEvent *e = (QMouseEvent*)ev; TQMouseEvent *e = (TQMouseEvent*)ev;
if (e->button() == QMouseEvent::RightButton) if (e->button() == TQMouseEvent::RightButton)
_popup->exec(e->globalPos()); _popup->exec(e->globalPos());
} }
return QFrame::eventFilter(obj, ev); return TQFrame::eventFilter(obj, ev);
} }
@ -150,9 +150,9 @@ void ZoneClock::updateTime()
tzset(); tzset();
time_t t = time(NULL); time_t t = time(NULL);
QDateTime dt; TQDateTime dt;
dt.setTime_t(t); dt.setTime_t(t);
_timeLabel->setText(QString("%1, %2").arg(KGlobal::locale()->formatTime(dt.time(), true)).arg(KGlobal::locale()->formatDate(dt.date(), true))); _timeLabel->setText(TQString("%1, %2").arg(KGlobal::locale()->formatTime(dt.time(), true)).arg(KGlobal::locale()->formatDate(dt.date(), true)));
if (initial_TZ != 0) if (initial_TZ != 0)
setenv("TZ", initial_TZ, 1); setenv("TZ", initial_TZ, 1);
@ -162,14 +162,14 @@ void ZoneClock::updateTime()
} }
ZoneClockPanel::ZoneClockPanel(QWidget *parent, const char *name) ZoneClockPanel::ZoneClockPanel(TQWidget *parent, const char *name)
: QFrame(parent, name), _dlg(0) : TQFrame(parent, name), _dlg(0)
{ {
_flow = new SimpleFlow(this,1,1); _flow = new SimpleFlow(this,1,1);
QTimer *t = new QTimer(this); TQTimer *t = new TQTimer(this);
connect(t, SIGNAL(timeout()), this, SLOT(updateTimer())); connect(t, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateTimer()));
t->start(500); t->start(500);
_clocks.setAutoDelete(true); _clocks.setAutoDelete(true);
@ -182,14 +182,14 @@ void ZoneClockPanel::createDialog()
{ {
_dlg = new ClockDialog(this, 0, true); _dlg = new ClockDialog(this, 0, true);
CityList cities; CityList cities;
QStringList timezones = cities.timezones(); TQStringList timezones = cities.timezones();
for (QStringList::iterator it = timezones.begin(); it != timezones.end(); ++it) for (TQStringList::iterator it = timezones.begin(); it != timezones.end(); ++it)
_dlg->ClockZone->insertItem(i18n((*it).utf8())); _dlg->ClockZone->insertItem(i18n((*it).utf8()));
} }
} }
void ZoneClockPanel::addClock(const QString &zone, const QString &name) void ZoneClockPanel::addClock(const TQString &zone, const TQString &name)
{ {
// add the clocks // add the clocks
ZoneClock *zc = new ZoneClock(zone, name, this); ZoneClock *zc = new ZoneClock(zone, name, this);
@ -199,9 +199,9 @@ void ZoneClockPanel::addClock(const QString &zone, const QString &name)
realign(); realign();
connect(zc, SIGNAL(addClock(const QString &)), this, SLOT(addClock(const QString &))); connect(zc, TQT_SIGNAL(addClock(const TQString &)), this, TQT_SLOT(addClock(const TQString &)));
connect(zc, SIGNAL(changed()), this, SLOT(realign())); connect(zc, TQT_SIGNAL(changed()), this, TQT_SLOT(realign()));
connect(zc, SIGNAL(removeMe(ZoneClock *)), this, SLOT(removeClock(ZoneClock *))); connect(zc, TQT_SIGNAL(removeMe(ZoneClock *)), this, TQT_SLOT(removeClock(ZoneClock *)));
} }
@ -216,7 +216,7 @@ void ZoneClockPanel::realign()
{ {
// realign the labels // realign the labels
int w = 0; int w = 0;
QPtrListIterator<ZoneClock> it(_clocks); TQPtrListIterator<ZoneClock> it(_clocks);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
if (it.current()->sizeHint().width() > w) if (it.current()->sizeHint().width() > w)
w = it.current()->sizeHint().width(); w = it.current()->sizeHint().width();
@ -228,12 +228,12 @@ void ZoneClockPanel::realign()
void ZoneClockPanel::updateTimer() void ZoneClockPanel::updateTimer()
{ {
QPtrListIterator<ZoneClock> it(_clocks); TQPtrListIterator<ZoneClock> it(_clocks);
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
it.current()->updateTime(); it.current()->updateTime();
} }
void ZoneClockPanel::addClock(const QString &zone) void ZoneClockPanel::addClock(const TQString &zone)
{ {
createDialog(); createDialog();
@ -245,11 +245,11 @@ void ZoneClockPanel::addClock(const QString &zone)
break; break;
} }
if (_dlg->exec() == QDialog::Accepted) if (_dlg->exec() == TQDialog::Accepted)
{ {
CityList cities; CityList cities;
QStringList timezones = cities.timezones(); TQStringList timezones = cities.timezones();
QString newzone = timezones[_dlg->ClockZone->currentItem()]; TQString newzone = timezones[_dlg->ClockZone->currentItem()];
addClock(newzone, _dlg->ClockCaption->text()); addClock(newzone, _dlg->ClockCaption->text());
update(); update();
} }
@ -260,14 +260,14 @@ void ZoneClockPanel::save(KConfig *config)
{ {
config->writeEntry("Clocks", _clocks.count()); config->writeEntry("Clocks", _clocks.count());
QPtrListIterator<ZoneClock> it(_clocks); TQPtrListIterator<ZoneClock> it(_clocks);
int cnt=0; int cnt=0;
for ( ; it.current(); ++it) for ( ; it.current(); ++it)
{ {
QString n = it.current()->name(); TQString n = it.current()->name();
n = n.left(n.length()-1); n = n.left(n.length()-1);
config->writeEntry(QString("Clock_%1_Name").arg(cnt), n); config->writeEntry(TQString("Clock_%1_Name").arg(cnt), n);
config->writeEntry(QString("Clock_%1_Zone").arg(cnt), it.current()->zone()); config->writeEntry(TQString("Clock_%1_Zone").arg(cnt), it.current()->zone());
cnt++; cnt++;
} }
} }
@ -281,7 +281,7 @@ void ZoneClockPanel::load(KConfig *config)
for (int i=0; i<num; ++i) for (int i=0; i<num; ++i)
{ {
addClock(config->readEntry(QString("Clock_%1_Zone").arg(i)), config->readEntry(QString("Clock_%1_Name").arg(i))); addClock(config->readEntry(TQString("Clock_%1_Zone").arg(i)), config->readEntry(TQString("Clock_%1_Name").arg(i)));
} }
} }

@ -29,10 +29,10 @@
#define ZONECLOCK_H #define ZONECLOCK_H
#include <qwidget.h> #include <tqwidget.h>
#include <qstring.h> #include <tqstring.h>
#include <qframe.h> #include <tqframe.h>
#include <qptrlist.h> #include <tqptrlist.h>
class QLabel; class QLabel;
@ -49,20 +49,20 @@ class ZoneClock : public QFrame
public: public:
ZoneClock(const QString &zone, const QString &name, QWidget *parent=0, const char *n=0); ZoneClock(const TQString &zone, const TQString &name, TQWidget *parent=0, const char *n=0);
QString zone() const { return _zone; }; TQString zone() const { return _zone; };
void setZone(const QString &z) { _zone = z; updateTime(); }; void setZone(const TQString &z) { _zone = z; updateTime(); };
QString name() const { return _name; }; TQString name() const { return _name; };
void setName( const QString &n) { _name = n; updateTime(); }; void setName( const TQString &n) { _name = n; updateTime(); };
signals: signals:
void removeMe(ZoneClock *t); void removeMe(ZoneClock *t);
void addClock(const QString &zone); void addClock(const TQString &zone);
void changed(); void changed();
@ -73,7 +73,7 @@ public slots:
protected: protected:
virtual bool eventFilter(QObject *, QEvent *); virtual bool eventFilter(TQObject *, TQEvent *);
private slots: private slots:
@ -86,10 +86,10 @@ private slots:
private: private:
QString _zone; TQString _zone;
QString _name; TQString _name;
QLabel *_timeLabel, *_nameLabel; TQLabel *_timeLabel, *_nameLabel;
QPopupMenu *_popup; TQPopupMenu *_popup;
}; };
@ -100,9 +100,9 @@ class ZoneClockPanel : public QFrame
public: public:
ZoneClockPanel(QWidget *parent=0, const char *name=0); ZoneClockPanel(TQWidget *parent=0, const char *name=0);
void addClock(const QString &zone, const QString &name); void addClock(const TQString &zone, const TQString &name);
void save(KConfig *config); void save(KConfig *config);
void load(KConfig *config); void load(KConfig *config);
@ -110,7 +110,7 @@ public:
public slots: public slots:
void addClock(const QString &zone); void addClock(const TQString &zone);
private slots: private slots:
@ -125,7 +125,7 @@ private:
void createDialog(); void createDialog();
SimpleFlow *_flow; SimpleFlow *_flow;
QPtrList<ZoneClock> _clocks; TQPtrList<ZoneClock> _clocks;
ClockDialog *_dlg; ClockDialog *_dlg;
}; };

Loading…
Cancel
Save