summaryrefslogtreecommitdiffstats
path: root/src/kima.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 20:48:23 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 20:48:23 +0000
commit383adc283801b6238d8acfc750890613a63f8060 (patch)
treeaf3a65389067c05263db2ef4551a541501422998 /src/kima.cpp
parentda7847adb43726079c7a4be1f06acbebe0bdde57 (diff)
downloadkima-383adc283801b6238d8acfc750890613a63f8060.tar.gz
kima-383adc283801b6238d8acfc750890613a63f8060.zip
TQt4 port kima
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kima@1239290 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kima.cpp')
-rw-r--r--src/kima.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/kima.cpp b/src/kima.cpp
index 56d4bfe..0e3f54c 100644
--- a/src/kima.cpp
+++ b/src/kima.cpp
@@ -20,17 +20,17 @@
#include <list>
-// Qt
-#include <qlabel.h>
-#include <qfile.h>
-#include <qspinbox.h>
-#include <qcombobox.h>
-#include <qtextedit.h>
-#include <qtimer.h>
-#include <qcursor.h>
+// TQt
+#include <tqlabel.h>
+#include <tqfile.h>
+#include <tqspinbox.h>
+#include <tqcombobox.h>
+#include <tqtextedit.h>
+#include <tqtimer.h>
+#include <tqcursor.h>
#include <klistview.h>
-#include <qlistview.h>
-#include <qwidgetstack.h>
+#include <tqlistview.h>
+#include <tqwidgetstack.h>
// KDE
#include <kmessagebox.h>
@@ -73,7 +73,7 @@
//#include "kdebug.h"
extern "C" {
- KPanelApplet* init( QWidget* inParent, const QString& inConfigFile) {
+ KPanelApplet* init( TQWidget* inParent, const TQString& inConfigFile) {
KGlobal::locale()->insertCatalogue("kima");
return new Kima(inConfigFile, KPanelApplet::Normal,
//KPanelApplet::About | KPanelApplet::Help | KPanelApplet::Preferences,
@@ -82,9 +82,9 @@ extern "C" {
}
}
-Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inParent, const char* inName):
+Kima::Kima(const TQString& inConfigFile, Type inType, int inActions, TQWidget* inParent, const char* inName):
KPanelApplet(inConfigFile, inType, inActions, inParent, inName),
- QToolTip(this),
+ TQToolTip(this),
mCachedWFH(0),
mCachedHeight(0),
mDraggedSourceItem(NULL){
@@ -99,7 +99,7 @@ Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inP
// automatically delete pointers
mSources.setAutoDelete(TRUE);
- // create layout
+ // create tqlayout
mLayout = new FlowLayout(this, orientation() );
mLayout->setSpacing(8);
@@ -122,7 +122,7 @@ Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inP
addSources(BatterySrc::createInstances(this));
- QPtrListIterator<Source> itSync(mSources);
+ TQPtrListIterator<Source> itSync(mSources);
Source* source;
while((source = itSync.current()) != 0){
++itSync;
@@ -140,16 +140,16 @@ Kima::Kima(const QString& inConfigFile, Type inType, int inActions, QWidget* inP
KActionCollection* actionCollection = new KActionCollection(this, "actionCollection", kapp);
- KAction* action = KStdAction::preferences(this, SLOT(preferences()), actionCollection);
+ KAction* action = KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(preferences()), actionCollection);
action->setText(i18n("&Preferences"));
action->plug(mMenu);
- action = KStdAction::aboutApp(this, SLOT(about()), actionCollection);
+ action = KStdAction::aboutApp(TQT_TQOBJECT(this), TQT_SLOT(about()), actionCollection);
action->setText(i18n("&About Kima"));
action->plug(mMenu);
//menu->insertSeparator();
- //KStdAction::quit( kapp, SLOT( quit() ), actionCollection )->plug( menu );
+ //KStdAction::quit( kapp, TQT_SLOT( quit() ), actionCollection )->plug( menu );
}
Kima::~Kima() {
@@ -222,12 +222,12 @@ void Kima::preferences() {
//setup the dialog
//mPrefsDlg->setFixedSize(mPrefs->size());
mPrefsDlg->setMainWidget(mPrefs); //embed the uic generated class into the kde dialog
- connect(mPrefsDlg, SIGNAL(applyClicked()), this, SLOT(savePreferences()));
- connect(mPrefsDlg, SIGNAL(okClicked()), this, SLOT(savePreferences()));
- connect(mPrefsDlg, SIGNAL(cancelClicked()), this, SLOT(cancelPreferences()));
+ connect(mPrefsDlg, TQT_SIGNAL(applyClicked()), TQT_TQOBJECT(this), TQT_SLOT(savePreferences()));
+ connect(mPrefsDlg, TQT_SIGNAL(okClicked()), TQT_TQOBJECT(this), TQT_SLOT(savePreferences()));
+ connect(mPrefsDlg, TQT_SIGNAL(cancelClicked()), TQT_TQOBJECT(this), TQT_SLOT(cancelPreferences()));
// create new list items and the widgetStack widgets
- QPtrListIterator<Source> it(mSources);
+ TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;
@@ -237,9 +237,9 @@ void Kima::preferences() {
// create the SourceListItem to switch and to enable/disable the widgetstack item (the source)
// and connect the apply/ok signals to the item, so it can change it's text to a potentially
// new source name.
- SourceListItem * item = new SourceListItem(source, mPrefs->sourceListView, QCheckListItem::CheckBox);
- connect(mPrefsDlg, SIGNAL(applyClicked()), item, SLOT(updateText()));
- connect(mPrefsDlg, SIGNAL(okClicked()), item, SLOT(updateText()));
+ SourceListItem * item = new SourceListItem(source, mPrefs->sourceListView, TQCheckListItem::CheckBox);
+ connect(mPrefsDlg, TQT_SIGNAL(applyClicked()), item, TQT_SLOT(updateText()));
+ connect(mPrefsDlg, TQT_SIGNAL(okClicked()), item, TQT_SLOT(updateText()));
}
if(mPrefs->sourceListView->firstChild()){
@@ -247,11 +247,11 @@ void Kima::preferences() {
raiseSourcePrefsWidget(mPrefs->sourceListView->firstChild()); // raise that item
}
- connect(mPrefs->sourceListView, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(raiseSourcePrefsWidget(QListViewItem*)));
+ connect(mPrefs->sourceListView, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_TQOBJECT(this), TQT_SLOT(raiseSourcePrefsWidget(TQListViewItem*)));
}
// update prefs gui
- QPtrListIterator<Source> srcIt(mSources);
+ TQPtrListIterator<Source> srcIt(mSources);
Source* source;
while((source = srcIt.current()) != 0){
++srcIt;
@@ -259,8 +259,8 @@ void Kima::preferences() {
}
// update the sourcelist checkbox
- QPtrList<QListViewItem> lst;
- QListViewItemIterator lvIt(mPrefs->sourceListView);
+ TQPtrList<TQListViewItem> lst;
+ TQListViewItemIterator lvIt(mPrefs->sourceListView);
while(lvIt.current()){
SourceListItem* sli = static_cast<SourceListItem*>(lvIt.current());
sli->setOn(sli->getSource()->isEnabled());
@@ -271,13 +271,13 @@ void Kima::preferences() {
mPrefsDlg->show();
}
-void Kima::raiseSourcePrefsWidget(QListViewItem* inListViewItem){
+void Kima::raiseSourcePrefsWidget(TQListViewItem* inListViewItem){
mPrefs->widgetStack->raiseWidget(static_cast<SourceListItem*>(inListViewItem)->getSource()->getPrefs());
}
void Kima::cancelPreferences(){
// update prefs gui
- QPtrListIterator<Source> it(mSources);
+ TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;
@@ -287,7 +287,7 @@ void Kima::cancelPreferences(){
void Kima::savePreferences(){
// save prefs
- QPtrListIterator<Source> it(mSources);
+ TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;
@@ -311,7 +311,7 @@ int Kima::widthForHeight(int inHeight) const{
mCachedHeight = inHeight;
mCachedWFH = 0;
}
- mCachedWFH = QMAX(mLayout->widthForHeight(inHeight), mCachedWFH);
+ mCachedWFH = TQMAX(mLayout->widthForHeight(inHeight), mCachedWFH);
return mCachedWFH;
}
@@ -319,22 +319,22 @@ int Kima::heightForWidth(int inWidth) const{
//kdDebug() << "heightForWidth: " << width << endl;
mLayout->setOrientation(Qt::Vertical);
return mLayout->heightForWidth(inWidth);
- //return sizeHint().height();
+ //return tqsizeHint().height();
}
-void Kima::mousePressEvent(QMouseEvent* inEvent ){
- if(inEvent->button() == QMouseEvent::RightButton){
+void Kima::mousePressEvent(TQMouseEvent* inEvent ){
+ if(inEvent->button() == Qt::RightButton){
mMenu->popup( inEvent->globalPos() );
if(mDraggedSourceItem)
mDraggedSourceItem->widget()->unsetCursor(); // unset drag cursor
}
- else if(inEvent->button() == QMouseEvent::LeftButton){
- QLayoutIterator it = mLayout->iterator();
+ else if(inEvent->button() == Qt::LeftButton){
+ TQLayoutIterator it = mLayout->iterator();
while(it.current()){
- QWidget * c = it.current()->widget();
- if(c->rect().contains(c->mapFromGlobal(inEvent->globalPos()))){
+ TQWidget * c = it.current()->widget();
+ if(TQT_TQRECT_OBJECT(c->rect()).tqcontains(c->mapFromGlobal(inEvent->globalPos()))){
mDraggedSourceItem = it.current(); // remenber the clicked source
- c->setCursor(Qt::SizeAllCursor); // set drag cursor
+ c->setCursor(TQt::SizeAllCursor); // set drag cursor
mDragFactor = (c->rect().height()/2.0) / (double)c->mapFromGlobal(inEvent->globalPos()).y();
break;
}
@@ -343,8 +343,8 @@ void Kima::mousePressEvent(QMouseEvent* inEvent ){
}
}
-void Kima::mouseReleaseEvent(QMouseEvent* inEvent){
- //if(inEvent->button() == QMouseEvent::LeftButton && mDraggedSourceItem){
+void Kima::mouseReleaseEvent(TQMouseEvent* inEvent){
+ //if(inEvent->button() == TQMouseEvent::LeftButton && mDraggedSourceItem){
if(mDraggedSourceItem){
mCachedWFH = 0; // reset cached witdh for height to force recalculation of the applets width
mDraggedSourceItem->widget()->unsetCursor(); // unset drag cursor
@@ -352,19 +352,19 @@ void Kima::mouseReleaseEvent(QMouseEvent* inEvent){
}
}
-void Kima::mouseMoveEvent( QMouseEvent* inEvent ) {
+void Kima::mouseMoveEvent( TQMouseEvent* inEvent ) {
if(!mDraggedSourceItem)
return;
- QLayoutIterator it = mLayout->iterator();
+ TQLayoutIterator it = mLayout->iterator();
while(it.current()){
- QWidget * c = it.current()->widget();
- if(c->rect().contains(c->mapFromGlobal(inEvent->globalPos()))){
+ TQWidget * c = it.current()->widget();
+ if(TQT_TQRECT_OBJECT(c->rect()).tqcontains(c->mapFromGlobal(inEvent->globalPos()))){
if(it.current() == mDraggedSourceItem)
break;
// we are over a source-widget.
// move the dragged widget above / below that
// widget, depending where the cursor is.
- QRect crect = c->rect();
+ TQRect crect = c->rect();
double relPos = c->mapFromGlobal(inEvent->globalPos()).y() * mDragFactor;
if(mLayout->moveItem(mDraggedSourceItem, it.current(), crect.height()/2.0 > relPos ? FlowLayout::ABOVE : FlowLayout::BELOW)){
mLayout->updatePositions(mKConfig);
@@ -377,19 +377,19 @@ void Kima::mouseMoveEvent( QMouseEvent* inEvent ) {
++it;
}
// outside kima?
- if(!rect().contains(mapToParent(inEvent->pos())))
- mDraggedSourceItem->widget()->setCursor(Qt::ForbiddenCursor);
+ if(!TQT_TQRECT_OBJECT(rect()).tqcontains(mapToParent(inEvent->pos())))
+ mDraggedSourceItem->widget()->setCursor(TQt::ForbiddenCursor);
else
- mDraggedSourceItem->widget()->setCursor(Qt::SizeAllCursor);
+ mDraggedSourceItem->widget()->setCursor(TQt::SizeAllCursor);
}
-void Kima::paintEvent(QPaintEvent* inEvent){
+void Kima::paintEvent(TQPaintEvent* inEvent){
KPanelApplet::paintEvent(inEvent);
updateSourceWidgets();
}
void Kima::updateSourceWidgets(){
- // repaint the source widgets
+ // tqrepaint the source widgets
for(Source* source = mSources.first(); source; source = mSources.next())
if(source->showOnApplet())
source->getWidget()->update();
@@ -406,19 +406,19 @@ void Kima::registerSource(Source* source) {
// this call also emits enabledChanged
source->loadPrefs(mKConfig);
- // add the source to the layout if necessary
+ // add the source to the tqlayout if necessary
displaySource(source->isEnabled() && source->showOnApplet(), source);
// connection to add and remove sources from mLayout
- connect(source, SIGNAL(displaySource(bool, Source*)), this, SLOT(displaySource(bool, Source*)));
+ connect(source, TQT_SIGNAL(displaySource(bool, Source*)), TQT_TQOBJECT(this), TQT_SLOT(displaySource(bool, Source*)));
}
-void Kima::maybeTip(const QPoint& inPos){
- if(!rect().contains(inPos))
+void Kima::maybeTip(const TQPoint& inPos){
+ if(!TQT_TQRECT_OBJECT(rect()).tqcontains(inPos))
return;
- QString text = "<b>" + i18n("Sources:") + "</b><br><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
+ TQString text = "<b>" + i18n("Sources:") + "</b><br><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
- QPtrListIterator<Source> it(mSources);
+ TQPtrListIterator<Source> it(mSources);
Source* source;
while((source = it.current()) != 0){
++it;