diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/common/gui/misc_gui.cpp | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/common/gui/misc_gui.cpp')
-rw-r--r-- | src/common/gui/misc_gui.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/src/common/gui/misc_gui.cpp b/src/common/gui/misc_gui.cpp index 00f4997..fadf7a9 100644 --- a/src/common/gui/misc_gui.cpp +++ b/src/common/gui/misc_gui.cpp @@ -8,16 +8,16 @@ ***************************************************************************/ #include "misc_gui.h" -#include <qapplication.h> -#include <qpushbutton.h> -#include <qtimer.h> -#include <qwidgetstack.h> -#include <qobjectlist.h> -#include <qpainter.h> -#include <qheader.h> -#include <qmetaobject.h> -#include <qvariant.h> -#include <qpopupmenu.h> +#include <tqapplication.h> +#include <tqpushbutton.h> +#include <tqtimer.h> +#include <tqwidgetstack.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqheader.h> +#include <tqmetaobject.h> +#include <tqvariant.h> +#include <tqpopupmenu.h> #include <kcursor.h> #include <kiconloader.h> @@ -31,92 +31,92 @@ #include "common/gui/number_gui.h" //----------------------------------------------------------------------------- -bool BusyCursor::_overridePaused = false; +bool PBusyCursor::_overridePaused = false; -void BusyCursor::start() +void PBusyCursor::start() { - QApplication::setOverrideCursor(KCursor::waitCursor(), true); + TQApplication::setOverrideCursor(KCursor::waitCursor(), true); } -void BusyCursor::stop() +void PBusyCursor::stop() { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } -void BusyCursor::pause() +void PBusyCursor::pause() { - _overridePaused = QApplication::overrideCursor(); + _overridePaused = TQApplication::overrideCursor(); stop(); } -void BusyCursor::restore() +void PBusyCursor::restore() { if (_overridePaused) start(); } //----------------------------------------------------------------------------- -void MessageBox::information(const QString &text, Log::ShowMode show, const QString &dontShowAgainName) +void MessageBox::information(const TQString &text, Log::ShowMode show, const TQString &dontShowAgainName) { if ( show==Log::DontShow ) return; - BusyCursor::pause(); - KMessageBox::information(qApp->mainWidget(), text, QString::null, dontShowAgainName, KMessageBox::Notify | KMessageBox::AllowLink); - BusyCursor::restore(); + PBusyCursor::pause(); + KMessageBox::information(tqApp->mainWidget(), text, TQString(), dontShowAgainName, KMessageBox::Notify | KMessageBox::AllowLink); + PBusyCursor::restore(); } -void MessageBox::detailedSorry(const QString &text, const QString &details, Log::ShowMode show) +void MessageBox::detailedSorry(const TQString &text, const TQString &details, Log::ShowMode show) { if ( show==Log::DontShow ) return; - BusyCursor::pause(); - if ( details.isEmpty() ) KMessageBox::sorry(qApp->mainWidget(), text, QString::null, KMessageBox::Notify | KMessageBox::AllowLink); - else KMessageBox::detailedSorry(qApp->mainWidget(), text, details, QString::null, KMessageBox::Notify | KMessageBox::AllowLink); - BusyCursor::restore(); + PBusyCursor::pause(); + if ( details.isEmpty() ) KMessageBox::sorry(tqApp->mainWidget(), text, TQString(), KMessageBox::Notify | KMessageBox::AllowLink); + else KMessageBox::detailedSorry(tqApp->mainWidget(), text, details, TQString(), KMessageBox::Notify | KMessageBox::AllowLink); + PBusyCursor::restore(); } -bool MessageBox::askContinue(const QString &text, const KGuiItem &buttonContinue, const QString &caption) +bool MessageBox::askContinue(const TQString &text, const KGuiItem &buttonContinue, const TQString &caption) { - ::BusyCursor::pause(); - int res = KMessageBox::warningContinueCancel(qApp->mainWidget(), text, caption, buttonContinue); - ::BusyCursor::restore(); + ::PBusyCursor::pause(); + int res = KMessageBox::warningContinueCancel(tqApp->mainWidget(), text, caption, buttonContinue); + ::PBusyCursor::restore(); return ( res==KMessageBox::Continue ); } -bool MessageBox::questionYesNo(const QString &text, const KGuiItem &yesButton,const KGuiItem &noButton, const QString &caption) +bool MessageBox::questionYesNo(const TQString &text, const KGuiItem &yesButton,const KGuiItem &noButton, const TQString &caption) { - ::BusyCursor::pause(); - int res = KMessageBox::questionYesNo(qApp->mainWidget(), text, caption, yesButton, noButton); - ::BusyCursor::restore(); + ::PBusyCursor::pause(); + int res = KMessageBox::questionYesNo(tqApp->mainWidget(), text, caption, yesButton, noButton); + ::PBusyCursor::restore(); return ( res==KMessageBox::Yes ); } -MessageBox::Result MessageBox::questionYesNoCancel(const QString &text, const KGuiItem &yesButton, const KGuiItem &noButton, - const QString &caption) +MessageBox::Result MessageBox::questionYesNoCancel(const TQString &text, const KGuiItem &yesButton, const KGuiItem &noButton, + const TQString &caption) { - ::BusyCursor::pause(); - int res = KMessageBox::questionYesNoCancel(qApp->mainWidget(), text, caption, yesButton, noButton); - ::BusyCursor::restore(); + ::PBusyCursor::pause(); + int res = KMessageBox::questionYesNoCancel(tqApp->mainWidget(), text, caption, yesButton, noButton); + ::PBusyCursor::restore(); if ( res==KMessageBox::Yes ) return Yes; if ( res==KMessageBox::No ) return No; return Cancel; } -void MessageBox::text(const QString &text, Log::ShowMode show) +void MessageBox::text(const TQString &text, Log::ShowMode show) { if ( show==Log::DontShow ) return; - BusyCursor::pause(); - TextEditorDialog dialog(text, QString::null, false, qApp->mainWidget()); + PBusyCursor::pause(); + TextEditorDialog dialog(text, TQString(), false, tqApp->mainWidget()); dialog.exec(); - BusyCursor::restore(); + PBusyCursor::restore(); } //---------------------------------------------------------------------------- -PopupButton::PopupButton(QWidget *parent, const char *name) - : KPushButton(parent, name) +PopupButton::PopupButton(TQWidget *tqparent, const char *name) + : KPushButton(tqparent, name) { init(); } -PopupButton::PopupButton(const QString &text, QWidget *parent, const char *name) - : KPushButton(text, parent, name) +PopupButton::PopupButton(const TQString &text, TQWidget *tqparent, const char *name) + : KPushButton(text, tqparent, name) { init(); } @@ -125,8 +125,8 @@ void PopupButton::init() { _separator = false; setFlat(true); - QPopupMenu *popup = new QPopupMenu(this); - connect(popup, SIGNAL(activated(int)), SIGNAL(activated(int))); + TQPopupMenu *popup = new TQPopupMenu(this); + connect(popup, TQT_SIGNAL(activated(int)), TQT_SIGNAL(activated(int))); setPopup(popup); } @@ -137,20 +137,20 @@ void PopupButton::appendAction(KAction *action) action->plug(popup()); } -void PopupButton::appendAction(const QString &label, const QString &icon, - QObject *receiver, const char *slot) +void PopupButton::appendAction(const TQString &label, const TQString &icon, + TQObject *receiver, const char *slot) { appendAction(new KAction(label, icon, 0, receiver, slot, (KActionCollection *)0)); } -int PopupButton::appendItem(const QString &label, const QString &icon, int id) +int PopupButton::appendItem(const TQString &label, const TQString &icon, int id) { KIconLoader loader; - QPixmap pixmap = loader.loadIcon(icon, KIcon::Small); + TQPixmap pixmap = loader.loadIcon(icon, KIcon::Small); return appendItem(label, pixmap, id); } -int PopupButton::appendItem(const QString &label, const QPixmap &icon, int id) +int PopupButton::appendItem(const TQString &label, const TQPixmap &icon, int id) { if ( _separator && popup()->count()!=0 ) popup()->insertSeparator(); _separator = false; @@ -158,41 +158,41 @@ int PopupButton::appendItem(const QString &label, const QPixmap &icon, int id) } //----------------------------------------------------------------------------- -Splitter::Splitter(const QValueList<int> &defaultSizes, Orientation o, QWidget *parent, const char *name) - : QSplitter(o, parent, name), _defaultSizes(defaultSizes) +Splitter::Splitter(const TQValueList<int> &defaultSizes, Qt::Orientation o, TQWidget *tqparent, const char *name) + : TQSplitter(o, tqparent, name), _defaultSizes(defaultSizes) { Q_ASSERT(name); setOpaqueResize(true); - QTimer::singleShot(0, this, SLOT(updateSizes())); + TQTimer::singleShot(0, this, TQT_SLOT(updateSizes())); } Splitter::~Splitter() { GuiConfig gc; - gc.writeEntry(QString(name()) + "_sizes", sizes()); + gc.writeEntry(TQString(name()) + "_sizes", sizes()); } void Splitter::updateSizes() { GuiConfig gc; - QValueList<int> sizes = gc.readIntListEntry(QString(name()) + "_sizes"); + TQValueList<int> sizes = gc.readIntListEntry(TQString(name()) + "_sizes"); for (uint i=sizes.count(); i<_defaultSizes.count(); i++) sizes.append(_defaultSizes[i]); setSizes(sizes); } //----------------------------------------------------------------------------- -TabBar::TabBar(QWidget *parent, const char *name) - : KTabBar(parent, name), _ignoreWheelEvent(false) +TabBar::TabBar(TQWidget *tqparent, const char *name) + : KTabBar(tqparent, name), _ignoreWheelEvent(false) {} -void TabBar::wheelEvent(QWheelEvent *e) +void TabBar::wheelEvent(TQWheelEvent *e) { - if (_ignoreWheelEvent) QApplication::sendEvent(parent(), e); // #### not sure why ignoring is not enough... + if (_ignoreWheelEvent) TQApplication::sendEvent(tqparent(), e); // #### not sure why ignoring is not enough... else KTabBar::wheelEvent(e); } -TabWidget::TabWidget(QWidget *parent, const char *name) - : KTabWidget(parent, name) +TabWidget::TabWidget(TQWidget *tqparent, const char *name) + : KTabWidget(tqparent, name) { setTabBar(new TabBar(this)); } @@ -202,7 +202,7 @@ void TabWidget::setIgnoreWheelEvent(bool ignore) static_cast<TabBar *>(tabBar())->_ignoreWheelEvent = ignore; } -void TabWidget::wheelEvent(QWheelEvent *e) +void TabWidget::wheelEvent(TQWheelEvent *e) { if (static_cast<TabBar *>(tabBar())->_ignoreWheelEvent) e->ignore(); else KTabWidget::wheelEvent(e); @@ -211,24 +211,24 @@ void TabWidget::wheelEvent(QWheelEvent *e) void TabWidget::setTabBar(TabBar *tabbar) { KTabWidget::setTabBar(tabbar); - connect(tabBar(), SIGNAL(contextMenu( int, const QPoint & )), SLOT(contextMenu( int, const QPoint & ))); - connect(tabBar(), SIGNAL(mouseDoubleClick( int )), SLOT(mouseDoubleClick( int ))); - connect(tabBar(), SIGNAL(mouseMiddleClick( int )), SLOT(mouseMiddleClick( int ))); - connect(tabBar(), SIGNAL(initiateDrag( int )), SLOT(initiateDrag( int ))); - connect(tabBar(), SIGNAL(testCanDecode(const QDragMoveEvent *, bool & )), SIGNAL(testCanDecode(const QDragMoveEvent *, bool & ))); - connect(tabBar(), SIGNAL(receivedDropEvent( int, QDropEvent * )), SLOT(receivedDropEvent( int, QDropEvent * ))); - connect(tabBar(), SIGNAL(moveTab( int, int )), SLOT(moveTab( int, int ))); - connect(tabBar(), SIGNAL(closeRequest( int )), SLOT(closeRequest( int ))); - connect(tabBar(), SIGNAL(wheelDelta( int )), SLOT(wheelDelta( int ))); + connect(tabBar(), TQT_SIGNAL(contextMenu( int, const TQPoint & )), TQT_SLOT(contextMenu( int, const TQPoint & ))); + connect(tabBar(), TQT_SIGNAL(mouseDoubleClick( int )), TQT_SLOT(mouseDoubleClick( int ))); + connect(tabBar(), TQT_SIGNAL(mouseMiddleClick( int )), TQT_SLOT(mouseMiddleClick( int ))); + connect(tabBar(), TQT_SIGNAL(initiateDrag( int )), TQT_SLOT(initiateDrag( int ))); + connect(tabBar(), TQT_SIGNAL(testCanDecode(const TQDragMoveEvent *, bool & )), TQT_SIGNAL(testCanDecode(const TQDragMoveEvent *, bool & ))); + connect(tabBar(), TQT_SIGNAL(receivedDropEvent( int, TQDropEvent * )), TQT_SLOT(receivedDropEvent( int, TQDropEvent * ))); + connect(tabBar(), TQT_SIGNAL(moveTab( int, int )), TQT_SLOT(moveTab( int, int ))); + connect(tabBar(), TQT_SIGNAL(closeRequest( int )), TQT_SLOT(closeRequest( int ))); + connect(tabBar(), TQT_SIGNAL(wheelDelta( int )), TQT_SLOT(wheelDelta( int ))); } //----------------------------------------------------------------------------- -ComboBox::ComboBox(QWidget *parent, const char *name) - : QComboBox(parent, name), _ignoreWheelEvent(false) +ComboBox::ComboBox(TQWidget *tqparent, const char *name) + : TQComboBox(tqparent, name), _ignoreWheelEvent(false) {} -void ComboBox::wheelEvent(QWheelEvent *e) +void ComboBox::wheelEvent(TQWheelEvent *e) { - if (_ignoreWheelEvent) QApplication::sendEvent(parent(), e); // #### not sure why ignoring is not enough... - else QComboBox::wheelEvent(e); + if (_ignoreWheelEvent) TQApplication::sendEvent(tqparent(), e); // #### not sure why ignoring is not enough... + else TQComboBox::wheelEvent(e); } |