From 28bf3cbba4139c8a0f81dc9d1a2f6c4ed724f22c Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:20:30 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaccessibility@1157633 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kbstateapplet/kbstate.cpp | 148 +++++++++++++++++++++++----------------------- kbstateapplet/kbstate.h | 86 +++++++++++++-------------- 2 files changed, 117 insertions(+), 117 deletions(-) (limited to 'kbstateapplet') diff --git a/kbstateapplet/kbstate.cpp b/kbstateapplet/kbstate.cpp index 05ee26a..09f6846 100644 --- a/kbstateapplet/kbstate.cpp +++ b/kbstateapplet/kbstate.cpp @@ -15,12 +15,12 @@ * along with this program; if not, write to the Free Software */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -50,7 +50,7 @@ extern "C" #include #include - KDE_EXPORT KPanelApplet* init(QWidget *parent, const QString& configFile) + KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile) { KGlobal::locale()->insertCatalogue("kbstateapplet"); KbStateApplet *applet = new KbStateApplet(configFile, KPanelApplet::Normal, KPanelApplet::About, parent, "kbstateapplet"); @@ -85,8 +85,8 @@ static ModifierKey modifierKeys[] = { /********************************************************************/ -KbStateApplet::KbStateApplet(const QString& configFile, Type t, int actions, - QWidget *parent, const char *name) +KbStateApplet::KbStateApplet(const TQString& configFile, Type t, int actions, + TQWidget *parent, const char *name) : KPanelApplet( configFile, t, actions, parent, name ) { for (int i = 0; i < 8; i++) { @@ -113,7 +113,7 @@ KbStateApplet::KbStateApplet(const QString& configFile, Type t, int actions, accessxFeatures = 0; //startTimer(100); // ten times a second - connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(paletteChanged())); + connect(kapp, TQT_SIGNAL(kdisplayPaletteChanged()), TQT_SLOT(paletteChanged())); kapp->installX11EventFilter (this); int opcode_rtn, error_rtn; @@ -139,27 +139,27 @@ void KbStateApplet::buildPopupMenu() sizePopup->insertItem(i18n("Small"), 13); sizePopup->insertItem(i18n("Medium"), 20); sizePopup->insertItem(i18n("Large"), 26); - connect(sizePopup,SIGNAL(activated(int)), this, SLOT(setIconDim(int))); + connect(sizePopup,TQT_SIGNAL(activated(int)), this, TQT_SLOT(setIconDim(int))); showPopup=new KPopupMenu(this); showPopup->setCheckable( true ); - modifierItem=showPopup->insertItem(i18n("Modifier Keys"), this, SLOT(toggleModifier())); - lockkeysItem=showPopup->insertItem(i18n("Lock Keys"), this, SLOT(toggleLockkeys())); - mouseItem=showPopup->insertItem(i18n("Mouse Status"), this, SLOT(toggleMouse())); - accessxItem=showPopup->insertItem(i18n("AccessX Status"), this, SLOT(toggleAccessX())); + modifierItem=showPopup->insertItem(i18n("Modifier Keys"), this, TQT_SLOT(toggleModifier())); + lockkeysItem=showPopup->insertItem(i18n("Lock Keys"), this, TQT_SLOT(toggleLockkeys())); + mouseItem=showPopup->insertItem(i18n("Mouse Status"), this, TQT_SLOT(toggleMouse())); + accessxItem=showPopup->insertItem(i18n("AccessX Status"), this, TQT_SLOT(toggleAccessX())); popup = new KPopupMenu(this); popup->setCheckable( true ); popup->insertTitle(0, i18n("Keyboard Status Applet")); popup->insertItem(i18n("Set Icon Size"),sizePopup); fillSpaceItem = popup->insertItem(i18n("Fill Available Space"), - this, SLOT(toggleFillSpace())); + this, TQT_SLOT(toggleFillSpace())); popup->insertItem(i18n("Show"),showPopup); - popup->insertItem(i18n("Configure AccessX Features..."), this, SLOT(configureAccessX())); - popup->insertItem(i18n("Configure Keyboard..."), this, SLOT(configureKeyboard())); - popup->insertItem(i18n("Configure Mouse..."), this, SLOT(configureMouse())); + popup->insertItem(i18n("Configure AccessX Features..."), this, TQT_SLOT(configureAccessX())); + popup->insertItem(i18n("Configure Keyboard..."), this, TQT_SLOT(configureKeyboard())); + popup->insertItem(i18n("Configure Mouse..."), this, TQT_SLOT(configureMouse())); popup->insertSeparator(); - popup->insertItem(i18n("About"), this, SLOT(about())); + popup->insertItem(i18n("About"), this, TQT_SLOT(about())); setCustomMenu(popup); updateMenu(); } @@ -263,7 +263,7 @@ int KbStateApplet::heightForWidth(int w) const { return length*size; } -void KbStateApplet::mousePressEvent(QMouseEvent *e) { +void KbStateApplet::mousePressEvent(TQMouseEvent *e) { if (e->button() == RightButton) popup->popup(e->globalPos()); } @@ -286,8 +286,8 @@ void KbStateApplet::toggleFillSpace() { emit updateLayout(); } -void KbStateApplet::resizeEvent( QResizeEvent*e ) { - QWidget::resizeEvent(e); +void KbStateApplet::resizeEvent( TQResizeEvent*e ) { + TQWidget::resizeEvent(e); layout(); } @@ -546,9 +546,9 @@ void KbStateApplet::initMasks() { } if ((map <= 7) && !(icons[map])) { icons[map] = new KeyIcon (i, instance, this, modifierKeys[i].name); - QToolTip::add (icons[map], i18n (modifierKeys[i].name)); - connect (icons[map], SIGNAL(stateChangeRequest (KeyIcon*,bool,bool)), - SLOT(stateChangeRequest (KeyIcon*,bool,bool))); + TQToolTip::add (icons[map], i18n (modifierKeys[i].name)); + connect (icons[map], TQT_SIGNAL(stateChangeRequest (KeyIcon*,bool,bool)), + TQT_SLOT(stateChangeRequest (KeyIcon*,bool,bool))); if (modifierKeys[i].isModifier) modifiers.append(icons[map]); else @@ -623,7 +623,7 @@ bool KbStateApplet::x11Event (XEvent *evt) { return false; } -void KbStateApplet::timerEvent(QTimerEvent*) { +void KbStateApplet::timerEvent(TQTimerEvent*) { XkbStateRec state_return; XkbGetState (this->x11Display(), XkbUseCoreKbd, &state_return); unsigned char latched = XkbStateMods (&state_return); @@ -747,7 +747,7 @@ void KbStateApplet::saveConfig() /********************************************************************/ KeyIcon::KeyIcon (int keyId, KInstance *instance, - QWidget *parent, const char *name) + TQWidget *parent, const char *name) : StatusIcon (modifierKeys[keyId].name, parent, name) { this->instance = instance; this->keyId = keyId; @@ -755,7 +755,7 @@ KeyIcon::KeyIcon (int keyId, KInstance *instance, isLocked = false; isLatched = false; updateImages (); - connect (this, SIGNAL(clicked()), SLOT(clickedSlot())); + connect (this, TQT_SIGNAL(clicked()), TQT_SLOT(clickedSlot())); } KeyIcon::~KeyIcon () { @@ -777,9 +777,9 @@ void KeyIcon::clickedSlot () { } -void KeyIcon::resizeEvent( QResizeEvent*e ) +void KeyIcon::resizeEvent( TQResizeEvent*e ) { - QWidget::resizeEvent(e); + TQWidget::resizeEvent(e); updateImages(); } @@ -791,7 +791,7 @@ void KeyIcon::updateImages () { latched = instance->iconLoader()->loadIcon(modifierKeys[keyId].icon, KIcon::NoGroup, size-4); unlatched = instance->iconLoader()->loadIcon(modifierKeys[keyId].icon, KIcon::NoGroup, size-4); - QImage img = latched.convertToImage(); + TQImage img = latched.convertToImage(); KIconEffect::colorize(img, KGlobalSettings::highlightedTextColor(), 1.0); latched.convertFromImage (img); @@ -803,8 +803,8 @@ void KeyIcon::updateImages () { update(); } -void KeyIcon::drawButton (QPainter *p) { - QColor black; +void KeyIcon::drawButton (TQPainter *p) { + TQColor black; int x = (width()-locked.width())/2; int y = (height()-locked.height())/2; @@ -824,12 +824,12 @@ void KeyIcon::drawButton (QPainter *p) { black = KGlobalSettings::textColor(); } - QString text = i18n(modifierKeys[keyId].text); + TQString text = i18n(modifierKeys[keyId].text); if (!text.isEmpty() && !text.isNull()) { - QFont font = KGlobalSettings::generalFont(); - font.setWeight(QFont::Black); - QFontMetrics metrics(font); - QRect rect = metrics.boundingRect (text); + TQFont font = KGlobalSettings::generalFont(); + font.setWeight(TQFont::Black); + TQFontMetrics metrics(font); + TQRect rect = metrics.boundingRect (text); int size; if (!strcmp(modifierKeys[keyId].name, "Alt Graph")) size = rect.width()>rect.height()?rect.width():rect.height(); @@ -855,14 +855,14 @@ void KeyIcon::drawButton (QPainter *p) { /********************************************************************/ -MouseIcon::MouseIcon (KInstance *instance, QWidget *parent, const char *name) +MouseIcon::MouseIcon (KInstance *instance, TQWidget *parent, const char *name) : StatusIcon ("", parent, name) { this->instance = instance; state = 0; activekey = 0; updateImages (); - connect (this, SIGNAL(clicked()), SLOT(clickedSlot())); + connect (this, TQT_SIGNAL(clicked()), TQT_SLOT(clickedSlot())); } MouseIcon::~MouseIcon () { @@ -880,17 +880,17 @@ void MouseIcon::setActiveKey (int activekey) { update(); } -void MouseIcon::resizeEvent( QResizeEvent*e ) +void MouseIcon::resizeEvent( TQResizeEvent*e ) { - QWidget::resizeEvent(e); + TQWidget::resizeEvent(e); updateImages(); } -QPixmap loadIcon(KInstance *instance, int size, QColor color, QString name) { +TQPixmap loadIcon(KInstance *instance, int size, TQColor color, TQString name) { KIconLoader *loader = instance->iconLoader(); - QPixmap result = loader->loadIcon(name, KIcon::NoGroup, size); + TQPixmap result = loader->loadIcon(name, KIcon::NoGroup, size); - QImage img = result.convertToImage(); + TQImage img = result.convertToImage(); KIconEffect::colorize(img, color, 1.0); result.convertFromImage (img); @@ -900,8 +900,8 @@ QPixmap loadIcon(KInstance *instance, int size, QColor color, QString name) { void MouseIcon::updateImages () { int size = width()drawPixmap(0,0, mouse); if ((state & Button1Mask) != 0) p->drawPixmap(0,0, leftSelected); @@ -956,15 +956,15 @@ void MouseIcon::drawButton (QPainter *p) { /********************************************************************/ -TimeoutIcon::TimeoutIcon (KInstance *instance, const QString &text, - const QString &featurename, - QWidget *parent, const char *name) +TimeoutIcon::TimeoutIcon (KInstance *instance, const TQString &text, + const TQString &featurename, + TQWidget *parent, const char *name) : StatusIcon (text, parent, name) { this->instance = instance; this->featurename = featurename; glyth = " "; setImage (featurename); - connect (&timer, SIGNAL(timeout()), this, SLOT(timeout())); + connect (&timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout())); } TimeoutIcon::~TimeoutIcon () { @@ -975,19 +975,19 @@ void TimeoutIcon::update () { if (pixmap.width() != size) pixmap = instance->iconLoader()->loadIcon(iconname, KIcon::NoGroup, size); - QImage img = pixmap.convertToImage(); + TQImage img = pixmap.convertToImage(); KIconEffect::colorize(img, KGlobalSettings::textColor(), 1.0); pixmap.convertFromImage (img); image = pixmap; - QWidget::update(); + TQWidget::update(); } -void TimeoutIcon::setGlyth (const QString &glyth) { +void TimeoutIcon::setGlyth (const TQString &glyth) { timer.stop(); this->glyth = glyth; - QImage img = pixmap.convertToImage(); + TQImage img = pixmap.convertToImage(); KIconEffect::colorize(img, KGlobalSettings::textColor(), 1.0); pixmap.convertFromImage (img); @@ -995,14 +995,14 @@ void TimeoutIcon::setGlyth (const QString &glyth) { update(); } -void TimeoutIcon::setImage (const QString &name, int timeout) { +void TimeoutIcon::setImage (const TQString &name, int timeout) { timer.stop(); iconname = name; if (!name.isNull() && !name.isEmpty()) { int size = width()iconLoader()->loadIcon(iconname, KIcon::NoGroup, size); - QImage img = pixmap.convertToImage(); + TQImage img = pixmap.convertToImage(); KIconEffect::colorize(img, KGlobalSettings::textColor(), 1.0); pixmap.convertFromImage (img); @@ -1019,8 +1019,8 @@ void TimeoutIcon::timeout () { } -void TimeoutIcon::drawButton (QPainter *p) { - QString text = glyth; +void TimeoutIcon::drawButton (TQPainter *p) { + TQString text = glyth; int count = 1; int factor = 19; @@ -1032,10 +1032,10 @@ void TimeoutIcon::drawButton (QPainter *p) { factor = 64; } - QFont font = KGlobalSettings::generalFont(); - font.setWeight(QFont::Black); - QFontMetrics metrics(font); - QRect rect = metrics.boundingRect (text); + TQFont font = KGlobalSettings::generalFont(); + font.setWeight(TQFont::Black); + TQFontMetrics metrics(font); + TQRect rect = metrics.boundingRect (text); int size = count*rect.width() > rect.height() ? count*rect.width() : rect.height(); if (font.pixelSize() != -1) @@ -1049,13 +1049,13 @@ void TimeoutIcon::drawButton (QPainter *p) { p->drawText (0,0, width()/2, height()/2, Qt::AlignCenter, text); } else { - QColor t = KGlobalSettings::textColor(); - QColor b = KGlobalSettings::baseColor(); - p->setPen (QColor ((2*t.red()+3*b.red())/5, + TQColor t = KGlobalSettings::textColor(); + TQColor b = KGlobalSettings::baseColor(); + p->setPen (TQColor ((2*t.red()+3*b.red())/5, (2*t.green()+3*b.green())/5, (2*t.blue()+3*b.blue())/5)); p->drawText (width()/2,0, width()/2, height(), Qt::AlignCenter, text); - p->setPen (QColor ((2*t.red()+b.red())/3, + p->setPen (TQColor ((2*t.red()+b.red())/3, (2*t.green()+b.green())/3, (2*t.blue()+b.blue())/3)); p->drawText (0,0, width(), height(), Qt::AlignCenter, text); @@ -1066,14 +1066,14 @@ void TimeoutIcon::drawButton (QPainter *p) { /********************************************************************/ -StatusIcon::StatusIcon (const QString &text, QWidget *parent, const char *name) - : QPushButton (text, parent, name) { - setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)); +StatusIcon::StatusIcon (const TQString &text, TQWidget *parent, const char *name) + : TQPushButton (text, parent, name) { + setSizePolicy(TQSizePolicy(TQSizePolicy::Ignored, TQSizePolicy::Ignored)); } StatusIcon::~StatusIcon () { } -QSize StatusIcon::minimumSizeHint () const { - return QSize (0,0); +TQSize StatusIcon::minimumSizeHint () const { + return TQSize (0,0); } diff --git a/kbstateapplet/kbstate.h b/kbstateapplet/kbstate.h index edcd3dc..5cf74ca 100644 --- a/kbstateapplet/kbstate.h +++ b/kbstateapplet/kbstate.h @@ -19,9 +19,9 @@ #define __kbstate_h__ #include -#include -#include -#include +#include +#include +#include extern "C" { @@ -33,37 +33,37 @@ class QLabel; class QGridLayout; class KPopupMenu; -class StatusIcon : public QPushButton { +class StatusIcon : public TQPushButton { Q_OBJECT public: - StatusIcon (const QString &text, QWidget *parent, const char *name=0); + StatusIcon (const TQString &text, TQWidget *parent, const char *name=0); ~StatusIcon (); - QSize minimumSizeHint () const; + TQSize minimumSizeHint () const; }; -typedef QPtrList IconList; +typedef TQPtrList IconList; class TimeoutIcon : public StatusIcon { Q_OBJECT public: - TimeoutIcon (KInstance *instance, const QString &text, - const QString &featurename, - QWidget *parent, const char *name=0); + TimeoutIcon (KInstance *instance, const TQString &text, + const TQString &featurename, + TQWidget *parent, const char *name=0); ~TimeoutIcon (); void update (); - void setGlyth (const QString &glyth); - void setImage (const QString &name, int timeout = 0); + void setGlyth (const TQString &glyth); + void setImage (const TQString &name, int timeout = 0); - void drawButton (QPainter *p); + void drawButton (TQPainter *p); private: - QString glyth; - QString iconname; - QString featurename; - QPixmap pixmap; - QPixmap image; - QTimer timer; + TQString glyth; + TQString iconname; + TQString featurename; + TQPixmap pixmap; + TQPixmap image; + TQTimer timer; KInstance *instance; private slots: @@ -74,25 +74,25 @@ class KeyIcon : public StatusIcon { Q_OBJECT public: KeyIcon (int keyId, KInstance *instance, - QWidget *parent, const char *name=0); + TQWidget *parent, const char *name=0); ~KeyIcon (); void setState (bool latched, bool locked); - void drawButton (QPainter *p); + void drawButton (TQPainter *p); void updateImages (); signals: void stateChangeRequest (KeyIcon *source, bool latched, bool locked); protected: - void resizeEvent(QResizeEvent*); + void resizeEvent(TQResizeEvent*); private slots: void clickedSlot(); private: - QPixmap locked; - QPixmap latched; - QPixmap unlatched; + TQPixmap locked; + TQPixmap latched; + TQPixmap unlatched; bool isLatched; bool isLocked; bool tristate; @@ -103,27 +103,27 @@ private: class MouseIcon : public StatusIcon { Q_OBJECT public: - MouseIcon (KInstance *instance, QWidget *parent, const char *name=0); + MouseIcon (KInstance *instance, TQWidget *parent, const char *name=0); ~MouseIcon (); void setState (int state); void setActiveKey (int activekey); - void drawButton (QPainter *p); + void drawButton (TQPainter *p); void updateImages (); protected: - void resizeEvent(QResizeEvent*); + void resizeEvent(TQResizeEvent*); private: - QPixmap mouse; - QPixmap leftSelected; - QPixmap middleSelected; - QPixmap rightSelected; - QPixmap leftDot; - QPixmap middleDot; - QPixmap rightDot; - QPixmap leftDotSelected; - QPixmap middleDotSelected; - QPixmap rightDotSelected; + TQPixmap mouse; + TQPixmap leftSelected; + TQPixmap middleSelected; + TQPixmap rightSelected; + TQPixmap leftDot; + TQPixmap middleDot; + TQPixmap rightDot; + TQPixmap leftDotSelected; + TQPixmap middleDotSelected; + TQPixmap rightDotSelected; int state, activekey; KInstance *instance; }; @@ -132,17 +132,17 @@ class KbStateApplet : public KPanelApplet { Q_OBJECT public: - KbStateApplet(const QString& configFile, Type t = Normal, int actions = 0, - QWidget *parent = 0, const char *name = 0); + KbStateApplet(const TQString& configFile, Type t = Normal, int actions = 0, + TQWidget *parent = 0, const char *name = 0); ~KbStateApplet(); int widthForHeight(int height) const; int heightForWidth(int width) const; protected: - void mousePressEvent(QMouseEvent *e); - void timerEvent(QTimerEvent*); - void resizeEvent(QResizeEvent*); + void mousePressEvent(TQMouseEvent *e); + void timerEvent(TQTimerEvent*); + void resizeEvent(TQResizeEvent*); bool x11Event (XEvent *); public slots: -- cgit v1.2.1