diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-03-25 20:03:28 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-03-25 20:03:28 +0100 |
commit | 2ee99ab520931c5efe91123c85ba10064a45e95d (patch) | |
tree | a367666e410de28d0f258aed77b11e17cafb28e4 /starter/starter.cpp | |
parent | cfa36e1a95e82492c17225ff376911abb3688f62 (diff) | |
download | tde-style-baghira-2ee99ab520931c5efe91123c85ba10064a45e95d.tar.gz tde-style-baghira-2ee99ab520931c5efe91123c85ba10064a45e95d.zip |
Initial TQt conversion
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'starter/starter.cpp')
-rw-r--r-- | starter/starter.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/starter/starter.cpp b/starter/starter.cpp index 9740888..d7e8d83 100644 --- a/starter/starter.cpp +++ b/starter/starter.cpp @@ -1,20 +1,20 @@ -#include <qcombobox.h> -#include <qcursor.h> -#include <qdesktopwidget.h> +#include <tqcombobox.h> +#include <tqcursor.h> +#include <tqdesktopwidget.h> #include <kglobal.h> #include <klocale.h> #include <kconfig.h> #include <kmessagebox.h> #include <kapplication.h> # include <kpopupmenu.h> -#include <qimage.h> -#include <qfile.h> -#include <qlabel.h> -#include <qradiobutton.h> -#include <qspinbox.h> -#include <qcheckbox.h> -#include <qtimer.h> +#include <tqimage.h> +#include <tqfile.h> +#include <tqlabel.h> +#include <tqradiobutton.h> +#include <tqspinbox.h> +#include <tqcheckbox.h> +#include <tqtimer.h> #include <kiconloader.h> #include <dcopclient.h> #include <kdebug.h> @@ -35,15 +35,15 @@ (_v_ == 2) ? 32 :\ (_v_ == 3) ? 48 : 64 -starter::starter(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) +starter::starter(const TQString& configFile, Type type, int actions, TQWidget *parent, const char *name) : DCOPObject("StarterIface"), KPanelApplet(configFile, type, actions, parent, name) { configPopup = new KPopupMenu(this); popupBlocked = false; - mainView = new QLabel(this); + mainView = new TQLabel(this); configDialog = new StarterConfig(this); - QRect desktop = QDesktopWidget().availableGeometry( configDialog ); + TQRect desktop = TQDesktopWidget().availableGeometry( configDialog ); configDialog->move((desktop.width() - configDialog->width())/2, (desktop.height() - configDialog->height())/2); KConfig config("bStarter", false, false); config.setGroup("Settings"); @@ -71,7 +71,7 @@ starter::starter(const QString& configFile, Type type, int actions, QWidget *par _iconSize = config.readNumEntry("IconSize", 32 ); configDialog->iconSize->setCurrentItem(_SIZE2VALUE_(_iconSize)); - startMenu = new StartMenu(_iconSize, this, Qt::WType_Popup); + startMenu = new StartMenu(_iconSize, this, TQt::WType_Popup); shortcutList = startMenu->shortcutList; configDialog->categoryList->insertStringList(startMenu->categories()); connect (startMenu, SIGNAL(aboutToHide()), this, SLOT(unblockPopupDelayed())); @@ -80,7 +80,7 @@ starter::starter(const QString& configFile, Type type, int actions, QWidget *par //--- connect(configDialog->categoryList, SIGNAL(highlighted(int)), this, SLOT(activateShortcutButton(int))); connect(configDialog->buttonShortcut, SIGNAL(capturedShortcut (const KShortcut &)), this, SLOT(addShortcut(const KShortcut &))); - connect(configDialog->categoryList, SIGNAL(highlighted ( const QString & )), this, SLOT(updateShortcutButton(const QString &))); + connect(configDialog->categoryList, SIGNAL(highlighted ( const TQString & )), this, SLOT(updateShortcutButton(const TQString &))); connect(configDialog->buttonOk, SIGNAL(clicked()), this, SLOT(updateSettings())); StarterHelp *helpDialog = new StarterHelp(configDialog); connect(configDialog->buttonHelp, SIGNAL(clicked()), helpDialog, SLOT(show())); @@ -120,14 +120,14 @@ void starter::addShortcut(const KShortcut &cut) // generate MyKey short state = 0; if (cut.seq(0).key(0).modFlags() & KKey::CTRL) - state |= Qt::ControlButton; + state |= TQt::ControlButton; if (cut.seq(0).key(0).modFlags() & KKey::ALT) - state |= Qt::AltButton; + state |= TQt::AltButton; if (cut.seq(0).key(0).modFlags() & KKey::SHIFT) - state |= Qt::ShiftButton; + state |= TQt::ShiftButton; MyKey key(cut.seq(0).keyCodeQt(), state); // Test if this is a valid shotrcut, i.e. contains 'ctrl' or 'alt', returns iff not - if (!(state & Qt::ControlButton || state & Qt::AltButton)) + if (!(state & TQt::ControlButton || state & TQt::AltButton)) { KMessageBox::sorry(this, i18n("<qt>To ensure usefull behaviour of the searchline, the shortcut <b>must contain</b> a metabutton, i.e. <b>'ctrl' and/or 'alt'</b></qt>"), i18n("Sorry, invalid Shortcut")); return; @@ -154,13 +154,13 @@ void starter::addShortcut(const KShortcut &cut) configDialog->buttonShortcut->setShortcut(cut, false); } -void starter::updateShortcutButton(const QString & category) +void starter::updateShortcutButton(const TQString & category) { ShortcutList::Iterator it; for ( it = shortcutList.begin(); it != shortcutList.end(); ++it ) if (it.data() == category) { - QKeyEvent qke( QEvent::KeyPress, it.key().key(), 0, it.key().modFlags()); + TQKeyEvent qke( TQEvent::KeyPress, it.key().key(), 0, it.key().modFlags()); KKey kkey(&qke); KShortcut ksc(kkey); configDialog->buttonShortcut->setShortcut(ksc, false); @@ -205,7 +205,7 @@ void starter::updateSettings() } startMenu->setFavItemAmount(configDialog->favItemAmount->value()); config->setGroup("Shortcuts"); - QStringList cuts; QStringList cats; + TQStringList cuts; TQStringList cats; ShortcutList::Iterator it; for ( it = shortcutList.begin(); it != shortcutList.end(); ++it ) { @@ -218,46 +218,46 @@ void starter::updateSettings() delete config; } -#define _VALID_(_url_) configDialog && !configDialog->_url_->url().isEmpty() && QFile::exists(configDialog->_url_->url()) +#define _VALID_(_url_) configDialog && !configDialog->_url_->url().isEmpty() && TQFile::exists(configDialog->_url_->url()) void starter::reloadImages() { KIconLoader* iLoader = KGlobal::iconLoader(); - QString pth; + TQString pth; if (_VALID_(BaseURL)) pth = configDialog->BaseURL->url(); else pth = iLoader->iconPath("bStarter", KIcon::Small, true); if (pth) - pixmap = QImage(pth); + pixmap = TQImage(pth); if (!pth || pixmap.isNull()) { - pixmap = QPixmap(22,22); - pixmap.fill(Qt::black); + pixmap = TQPixmap(22,22); + pixmap.fill(TQt::black); } - pth = QString(); + pth = TQString(); if (_VALID_(HoverURL)) pth = configDialog->HoverURL->url(); else pth = iLoader->iconPath("bStarter_hover", KIcon::Small, true); if (pth) - hoverPixmap = QImage(pth); + hoverPixmap = TQImage(pth); if (!pth || hoverPixmap.isNull()) { - hoverPixmap = QPixmap(22,22); - hoverPixmap.fill(Qt::black); + hoverPixmap = TQPixmap(22,22); + hoverPixmap.fill(TQt::black); } - pth = QString(); + pth = TQString(); if (_VALID_(DownURL)) pth = configDialog->DownURL->url(); else pth = iLoader->iconPath("bStarter_down", KIcon::Small, true); if (pth) - downPixmap = QImage(pth); + downPixmap = TQImage(pth); if (!pth || downPixmap.isNull()) { - downPixmap = QPixmap(22,22); - downPixmap.fill(Qt::white); + downPixmap = TQPixmap(22,22); + downPixmap.fill(TQt::white); } int wd = pixmap.width(); int ht = pixmap.height(); @@ -269,7 +269,7 @@ void starter::reloadImages() repaint(); } -void starter::resizeEvent ( QResizeEvent *rev ) +void starter::resizeEvent ( TQResizeEvent *rev ) { pixmap = pixmap.convertToImage().smoothScale(rev->size().height()*pixmap.width()/pixmap.height(),rev->size().height()); downPixmap = downPixmap.convertToImage().smoothScale(rev->size().height()*downPixmap.width()/downPixmap.height(),rev->size().height()); @@ -281,12 +281,12 @@ void starter::resizeEvent ( QResizeEvent *rev ) void starter::configureMenu() { - KApplication::startServiceByDesktopName("kmenuedit", QStringList(), 0, 0, 0, "", true); + KApplication::startServiceByDesktopName("kmenuedit", TQStringList(), 0, 0, 0, "", true); } void starter::preferences() { - KApplication::startServiceByDesktopName("kmenuedit", QStringList(), 0, 0, 0, "", true); + KApplication::startServiceByDesktopName("kmenuedit", TQStringList(), 0, 0, 0, "", true); } int starter::widthForHeight(int height) const @@ -302,7 +302,7 @@ int starter::heightForWidth(int width) const void starter::unblockPopupDelayed() { popupBlocked = true; - QTimer::singleShot ( 50, this, SLOT(unblockPopup()) ); + TQTimer::singleShot ( 50, this, SLOT(unblockPopup()) ); } void starter::unblockPopup() @@ -335,14 +335,14 @@ void starter::popupMenu() } else { - QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + TQRect desktop = TQDesktopWidget().availableGeometry( startMenu ); startMenu->resize(desktop.width()/5, 2*desktop.height()/3); startMenu->setFixedSize(startMenu->size()); // startMenu->setFixedSize(_MAX_(startMenu->minimumWidth(), desktop.width()/5) ,_MAX_(startMenu->minimumHeight(), 2*desktop.height()/3)); // 1/5 screen width, 2/3 screen height } - QPoint pt = mapToGlobal(pos()); - QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + TQPoint pt = mapToGlobal(pos()); + TQRect desktop = TQDesktopWidget().availableGeometry( startMenu ); int x = pt.x(); int y = pt.y(); @@ -372,9 +372,9 @@ void starter::popupMenu() y = desktop.bottom() - startMenu->height(); if (y < 0) y = 0; } - pt = QPoint(x, y); + pt = TQPoint(x, y); - startMenu->reparent(this, Qt::WType_Popup, pt, true); + startMenu->reparent(this, TQt::WType_Popup, pt, true); } } @@ -391,63 +391,63 @@ void starter::showMenu() } else { - QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + TQRect desktop = TQDesktopWidget().availableGeometry( startMenu ); // setActiveWindow(); startMenu->resize(desktop.width()/2, desktop.width()*9/32); startMenu->setFixedSize(startMenu->size()); // startMenu->setFixedSize(_MAX_(startMenu->minimumWidth(), desktop.width()/2) , _MAX_(startMenu->minimumHeight(), desktop.width()*9/32)); // 16:9 window, width == 1/2 screen } - QPoint pt; + TQPoint pt; if (configDialog->customDialogPos->isChecked()) { if (configDialog->dialogFollowMouse->isChecked()) { - QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + TQRect desktop = TQDesktopWidget().availableGeometry( startMenu ); int x,y; - x = QCursor::pos().x() + startMenu->width()/2 < desktop.width() ? QCursor::pos().x() - startMenu->width()/2 : desktop.width() - startMenu->width(); + x = TQCursor::pos().x() + startMenu->width()/2 < desktop.width() ? TQCursor::pos().x() - startMenu->width()/2 : desktop.width() - startMenu->width(); if (x < 0) x = 0; - y = QCursor::pos().y() + startMenu->height()/2 < desktop.height() ? QCursor::pos().y() - startMenu->height()/2 : desktop.height() - startMenu->height(); + y = TQCursor::pos().y() + startMenu->height()/2 < desktop.height() ? TQCursor::pos().y() - startMenu->height()/2 : desktop.height() - startMenu->height(); if (y < 0) y = 0; - pt = QPoint(x, y); + pt = TQPoint(x, y); } else - pt = QPoint(configDialog->dialogX->value(), configDialog->dialogY->value()); + pt = TQPoint(configDialog->dialogX->value(), configDialog->dialogY->value()); } else { - QRect desktop = QDesktopWidget().availableGeometry( startMenu ); - pt = QPoint((desktop.right() - startMenu->width())/2, (desktop.bottom() - startMenu->height())/2); + TQRect desktop = TQDesktopWidget().availableGeometry( startMenu ); + pt = TQPoint((desktop.right() - startMenu->width())/2, (desktop.bottom() - startMenu->height())/2); } if (configDialog->showDialogTitlebar->isChecked()) - startMenu->reparent(this, Qt::WType_TopLevel, pt, true); + startMenu->reparent(this, TQt::WType_TopLevel, pt, true); else - startMenu->reparent(this, Qt::WType_TopLevel | Qt::WStyle_Customize | Qt::WStyle_NoBorder, pt, true); + startMenu->reparent(this, TQt::WType_TopLevel | TQt::WStyle_Customize | TQt::WStyle_NoBorder, pt, true); } -bool starter::eventFilter( QObject*, QEvent *e ) +bool starter::eventFilter( TQObject*, TQEvent *e ) { switch (e->type()) { - case QEvent::Enter: + case TQEvent::Enter: { mainView->setPixmap(hoverPixmap); mainView->repaint(); return TRUE; } - case QEvent::Leave: + case TQEvent::Leave: { mainView->setPixmap(startMenu->isShown() ? downPixmap : pixmap); mainView->repaint(); return TRUE; } - case QEvent::MouseButtonPress: + case TQEvent::MouseButtonPress: { - if (((QMouseEvent*)e)->button() == Qt::RightButton) + if (((TQMouseEvent*)e)->button() == TQt::RightButton) { - configPopup->popup(((QMouseEvent*)e)->globalPos()); + configPopup->popup(((TQMouseEvent*)e)->globalPos()); return TRUE; } - if (((QMouseEvent*)e)->button() == Qt::LeftButton) + if (((TQMouseEvent*)e)->button() == TQt::LeftButton) { mainView->setPixmap(downPixmap); mainView->repaint(); @@ -455,9 +455,9 @@ bool starter::eventFilter( QObject*, QEvent *e ) } return TRUE; } - case QEvent::MouseButtonRelease: + case TQEvent::MouseButtonRelease: { - if (((QMouseEvent*)e)->button() != Qt::LeftButton) + if (((TQMouseEvent*)e)->button() != TQt::LeftButton) return FALSE; if (mainView->hasMouse()) mainView->setPixmap(hoverPixmap); @@ -473,7 +473,7 @@ bool starter::eventFilter( QObject*, QEvent *e ) extern "C" { - KPanelApplet* init( QWidget *parent, const QString& configFile) + KPanelApplet* init( TQWidget *parent, const TQString& configFile) { KGlobal::locale()->insertCatalogue("starter"); return new starter(configFile, KPanelApplet::Normal, |