diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/eventeditor | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/eventeditor')
-rw-r--r-- | src/modules/eventeditor/eventeditor.cpp | 160 | ||||
-rw-r--r-- | src/modules/eventeditor/eventeditor.h | 46 |
2 files changed, 104 insertions, 102 deletions
diff --git a/src/modules/eventeditor/eventeditor.cpp b/src/modules/eventeditor/eventeditor.cpp index bedeca5f..b425319e 100644 --- a/src/modules/eventeditor/eventeditor.cpp +++ b/src/modules/eventeditor/eventeditor.cpp @@ -39,38 +39,38 @@ #include "kvi_kvs_eventmanager.h" -#include <qmessagebox.h> +#include <tqmessagebox.h> -#include <qsplitter.h> -#include <qlayout.h> +#include <tqsplitter.h> +#include <tqlayout.h> #include "kvi_tal_vbox.h" #include "kvi_tal_popupmenu.h" -#include <qtooltip.h> -#include <qpushbutton.h> -#include <qevent.h> +#include <tqtooltip.h> +#include <tqpushbutton.h> +#include <tqevent.h> extern KviEventEditorWindow * g_pEventEditorWindow; -const QPixmap * KviEventListViewItem::pixmap(int col) const +const TQPixmap * KviEventListViewItem::pixmap(int col) const { return g_pIconManager->getSmallIcon(firstChild() ? KVI_SMALLICON_EVENT : KVI_SMALLICON_EVENTNOHANDLERS); } -const QPixmap * KviEventHandlerListViewItem::pixmap(int col) const +const TQPixmap * KviEventHandlerListViewItem::pixmap(int col) const { return g_pIconManager->getSmallIcon(m_bEnabled ? KVI_SMALLICON_HANDLER : KVI_SMALLICON_HANDLERDISABLED); } -KviEventEditor::KviEventEditor(QWidget * par) -: QWidget(par,"event_editor") +KviEventEditor::KviEventEditor(TQWidget * par) +: TQWidget(par,"event_editor") { - QGridLayout * l = new QGridLayout(this,1,1,2,2); + TQGridLayout * l = new TQGridLayout(this,1,1,2,2); - QSplitter * spl = new QSplitter(Qt::Horizontal,this); + TQSplitter * spl = new TQSplitter(Qt::Horizontal,this); spl->setOpaqueResize(false); l->addWidget(spl,0,0); @@ -82,12 +82,12 @@ KviEventEditor::KviEventEditor(QWidget * par) m_pListView->setShowSortIndicator(true); m_pListView->setRootIsDecorated(true); - QPushButton * pb = new QPushButton(__tr2qs("&Export All To..."),boxi); - connect(pb,SIGNAL(clicked()),this,SLOT(exportAllEvents())); + TQPushButton * pb = new TQPushButton(__tr2qs("&Export All To..."),boxi); + connect(pb,TQT_SIGNAL(clicked()),this,TQT_SLOT(exportAllEvents())); KviTalVBox * box = new KviTalVBox(spl); - m_pNameEditor = new QLineEdit(box); - QToolTip::add(m_pNameEditor,__tr2qs("Edit the event handler name.")); + m_pNameEditor = new TQLineEdit(box); + TQToolTip::add(m_pNameEditor,__tr2qs("Edit the event handler name.")); m_pEditor = KviScriptEditor::createInstance(box); m_pEditor->setFocus(); @@ -129,56 +129,56 @@ void KviEventEditor::oneTimeSetup() m_pContextPopup = new KviTalPopupMenu(this); - connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), - this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); + connect(m_pListView,TQT_SIGNAL(selectionChanged(KviTalListViewItem *)),this,TQT_SLOT(selectionChanged(KviTalListViewItem *))); + connect(m_pListView,TQT_SIGNAL(rightButtonPressed(KviTalListViewItem *,const TQPoint &,int)), + this,TQT_SLOT(itemPressed(KviTalListViewItem *,const TQPoint &,int))); } -void KviEventEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) +void KviEventEditor::itemPressed(KviTalListViewItem *it,const TQPoint &pnt,int col) { __range_valid(m_bOneTimeSetupDone); if(it) { m_pContextPopup->clear(); - if(it->parent()) + if(it->tqparent()) { - QString tmp; + TQString tmp; if(!(((KviEventHandlerListViewItem *)it)->m_bEnabled)) m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_HANDLER)), - __tr2qs("&Enable Handler"),this,SLOT(toggleCurrentHandlerEnabled())); + __tr2qs("&Enable Handler"),this,TQT_SLOT(toggleCurrentHandlerEnabled())); else m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_HANDLERDISABLED)), - __tr2qs("&Disable Handler"),this,SLOT(toggleCurrentHandlerEnabled())); + __tr2qs("&Disable Handler"),this,TQT_SLOT(toggleCurrentHandlerEnabled())); //m_pContextPopup->setItemChecked(id,((KviEventHandlerListViewItem *)it)->m_bEnabled); m_pContextPopup->insertItem( - *(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)), + *(g_pIconManager->getSmallIcon(KVI_SMALLICON_TQUIT)), __tr2qs("Re&move Handler"), - this,SLOT(removeCurrentHandler())); + this,TQT_SLOT(removeCurrentHandler())); m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_FOLDER)), __tr2qs("&Export Handler To..."), - this,SLOT(exportCurrentHandler())); + this,TQT_SLOT(exportCurrentHandler())); } else { m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_HANDLER)), __tr2qs("&New Handler"), - this,SLOT(addHandlerForCurrentEvent())); + this,TQT_SLOT(addHandlerForCurrentEvent())); } m_pContextPopup->popup(pnt); } } -void KviEventEditor::getUniqueHandlerName(KviEventListViewItem *it,QString &buffer) +void KviEventEditor::getUniqueHandlerName(KviEventListViewItem *it,TQString &buffer) { __range_valid(m_bOneTimeSetupDone); - QString newName = buffer; + TQString newName = buffer; if(newName.isEmpty())newName = __tr2qs("unnamed"); bool bFound = true; @@ -190,10 +190,10 @@ void KviEventEditor::getUniqueHandlerName(KviEventListViewItem *it,QString &buff for(KviEventHandlerListViewItem * ch = (KviEventHandlerListViewItem *)(it->firstChild());ch;ch = (KviEventHandlerListViewItem *)ch->nextSibling()) { - if(KviQString::equalCI(newName,ch->m_szName)) + if(KviTQString::equalCI(newName,ch->m_szName)) { bFound = true; - KviQString::sprintf(newName,"%Q_%d",&buffer,idx); + KviTQString::sprintf(newName,"%TQ_%d",&buffer,idx); idx++; break; } @@ -210,9 +210,9 @@ void KviEventEditor::addHandlerForCurrentEvent() KviTalListViewItem * it = m_pListView->selectedItem(); if(it) { - if(it->parent() == 0) + if(it->tqparent() == 0) { - QString buffer = __tr2qs("default"); + TQString buffer = __tr2qs("default"); getUniqueHandlerName((KviEventListViewItem *)it,buffer); KviTalListViewItem * ch = new KviEventHandlerListViewItem(it,buffer,"",true); it->setOpen(true); @@ -240,7 +240,7 @@ void KviEventEditor::toggleCurrentHandlerEnabled() if(m_pLastEditedItem) { m_pLastEditedItem->m_bEnabled = !(m_pLastEditedItem->m_bEnabled); - m_pListView->repaintItem(m_pLastEditedItem); + m_pListView->tqrepaintItem(m_pLastEditedItem); selectionChanged(m_pLastEditedItem); } } @@ -255,11 +255,11 @@ void KviEventEditor::commit() { if(it->firstChild()) { - QString szContext; + TQString szContext; for(KviTalListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling()) { - KviQString::sprintf(szContext,"%Q::%Q",&(((KviEventListViewItem *)it)->m_szName),&(((KviEventHandlerListViewItem *)ch)->m_szName)); + KviTQString::sprintf(szContext,"%Q::%Q",&(((KviEventListViewItem *)it)->m_szName),&(((KviEventHandlerListViewItem *)ch)->m_szName)); KviKvsScriptEventHandler * s = KviKvsScriptEventHandler::createInstance( // msvc workaround ((KviEventHandlerListViewItem *)ch)->m_szName, @@ -281,14 +281,14 @@ void KviEventEditor::saveLastEditedItem() __range_valid(m_bOneTimeSetupDone); if(!m_pLastEditedItem)return; - QString buffer = m_pNameEditor->text(); - if(!KviQString::equalCI(buffer,m_pLastEditedItem->m_szName)) + TQString buffer = m_pNameEditor->text(); + if(!KviTQString::equalCI(buffer,m_pLastEditedItem->m_szName)) { - getUniqueHandlerName((KviEventListViewItem *)(m_pLastEditedItem->parent()),buffer); + getUniqueHandlerName((KviEventListViewItem *)(m_pLastEditedItem->tqparent()),buffer); } m_pLastEditedItem->m_szName = buffer; - QString tmp; + TQString tmp; m_pEditor->getText(tmp); m_pLastEditedItem->m_szBuffer = tmp; @@ -298,7 +298,7 @@ void KviEventEditor::selectionChanged(KviTalListViewItem * it) { __range_valid(m_bOneTimeSetupDone); saveLastEditedItem(); - if(it->parent()) + if(it->tqparent()) { m_pLastEditedItem = (KviEventHandlerListViewItem *)it; m_pNameEditor->setEnabled(true); @@ -310,34 +310,34 @@ void KviEventEditor::selectionChanged(KviTalListViewItem * it) m_pNameEditor->setEnabled(false); m_pNameEditor->setText(""); m_pEditor->setEnabled(false); - QString parms = ((KviEventListViewItem *)it)->m_szParams; + TQString parms = ((KviEventListViewItem *)it)->m_szParams; if(parms.isEmpty())parms = __tr2qs("none"); KviCommandFormatter::indent(parms); KviCommandFormatter::indent(parms); - QString tmp; - KviQString::sprintf(tmp,__tr2qs("\n\n Event:\n %s\n\n Parameters:\n%s"), + TQString tmp; + KviTQString::sprintf(tmp,__tr2qs("\n\n Event:\n %s\n\n Parameters:\n%s"), ((KviEventListViewItem *)it)->m_szName.utf8().data(),parms.utf8().data()); m_pEditor->setText(tmp); } } -void KviEventEditor::showEvent(QShowEvent *e) +void KviEventEditor::showEvent(TQShowEvent *e) { oneTimeSetup(); - QWidget::showEvent(e); + TQWidget::showEvent(e); } -void KviEventEditor::getExportEventBuffer(QString &buffer,KviEventHandlerListViewItem * it) +void KviEventEditor::getExportEventBuffer(TQString &buffer,KviEventHandlerListViewItem * it) { - if(!it->parent())return; + if(!it->tqparent())return; - QString szBuf = it->m_szBuffer; + TQString szBuf = it->m_szBuffer; KviCommandFormatter::blockFromBuffer(szBuf); buffer = "event("; - buffer += ((KviEventListViewItem *)(it->parent()))->m_szName; + buffer += ((KviEventListViewItem *)(it->tqparent()))->m_szName; buffer += ","; buffer += it->m_szName; buffer += ")\n"; @@ -348,7 +348,7 @@ void KviEventEditor::getExportEventBuffer(QString &buffer,KviEventHandlerListVie { buffer += "\n"; buffer += "eventctl -d "; - buffer += ((KviEventListViewItem *)(it->parent()))->m_szName; + buffer += ((KviEventListViewItem *)(it->tqparent()))->m_szName; buffer += " "; buffer += it->m_szName; } @@ -360,23 +360,23 @@ void KviEventEditor::exportCurrentHandler() saveLastEditedItem(); if(!m_pLastEditedItem)return; - QString szName = QDir::homeDirPath(); - if(!szName.endsWith(QString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR; - szName += ((KviEventListViewItem *)(m_pLastEditedItem->parent()))->m_szName; + TQString szName = TQDir::homeDirPath(); + if(!szName.endsWith(TQString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR; + szName += ((KviEventListViewItem *)(m_pLastEditedItem->tqparent()))->m_szName; szName += "."; szName += m_pLastEditedItem->m_szName; szName += ".kvs"; - QString szFile; + TQString szFile; if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,"*.kvs",true,true,true))return; - QString szOut; + TQString szOut; getExportEventBuffer(szOut,m_pLastEditedItem); if(!KviFileUtils::writeFile(szFile,szOut)) { - QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the event file."),__tr2qs("&OK")); + TQMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the event file."),__tr2qs("&OK")); } } @@ -386,14 +386,14 @@ void KviEventEditor::exportAllEvents() KviEventListViewItem * it = (KviEventListViewItem *)m_pListView->firstChild(); - QString out; + TQString out; while(it) { KviEventHandlerListViewItem * item = (KviEventHandlerListViewItem *)it->firstChild(); while(item) { - QString tmp; + TQString tmp; getExportEventBuffer(tmp,item); out += tmp; out += "\n"; @@ -402,17 +402,17 @@ void KviEventEditor::exportAllEvents() it = (KviEventListViewItem *)it->nextSibling(); } - QString szName = QDir::homeDirPath(); - if(!szName.endsWith(QString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR; + TQString szName = TQDir::homeDirPath(); + if(!szName.endsWith(TQString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR; szName += "events.kvs"; - QString szFile; + TQString szFile; - if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,QString::null,true,true))return; + if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,TQString(),true,true))return; if(!KviFileUtils::writeFile(szFile,out)) { - QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the events file."),__tr2qs("Ok")); + TQMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the events file."),__tr2qs("Ok")); } } @@ -426,21 +426,21 @@ KviEventEditorWindow::KviEventEditorWindow(KviFrame * lpFrm) m_pEditor = new KviEventEditor(this); - m_pBase = new QWidget(this); - QGridLayout * g = new QGridLayout(m_pBase,1,4,4,4); + m_pBase = new TQWidget(this); + TQGridLayout * g = new TQGridLayout(m_pBase,1,4,4,4); - QPushButton * btn = new QPushButton(__tr2qs("&OK"),m_pBase); - connect(btn,SIGNAL(clicked()),this,SLOT(okClicked())); + TQPushButton * btn = new TQPushButton(__tr2qs("&OK"),m_pBase); + connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(okClicked())); btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT))); g->addWidget(btn,0,1); - btn = new QPushButton(__tr2qs("&Apply"),m_pBase); - connect(btn,SIGNAL(clicked()),this,SLOT(applyClicked())); + btn = new TQPushButton(__tr2qs("&Apply"),m_pBase); + connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(applyClicked())); btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT))); g->addWidget(btn,0,2); - btn = new QPushButton(__tr2qs("Cancel"),m_pBase); - connect(btn,SIGNAL(clicked()),this,SLOT(cancelClicked())); + btn = new TQPushButton(__tr2qs("Cancel"),m_pBase); + connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(cancelClicked())); btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DISCARD))); g->addWidget(btn,0,3); @@ -469,14 +469,14 @@ void KviEventEditorWindow::cancelClicked() } -QPixmap * KviEventEditorWindow::myIconPtr() +TQPixmap * KviEventEditorWindow::myIconPtr() { return g_pIconManager->getSmallIcon(KVI_SMALLICON_EVENT); } -void KviEventEditorWindow::resizeEvent(QResizeEvent *e) +void KviEventEditorWindow::resizeEvent(TQResizeEvent *e) { - int hght = m_pBase->sizeHint().height(); + int hght = m_pBase->tqsizeHint().height(); m_pEditor->setGeometry(0,0,width(),height()- hght); m_pBase->setGeometry(0,height() - hght,width(),hght); } @@ -485,9 +485,9 @@ void KviEventEditorWindow::fillCaptionBuffers() { m_szPlainTextCaption = __tr2qs("Event Editor"); - static QString p1("<nobr><font color=\""); - static QString p2("\"><b>"); - static QString p3("</b></font></nobr>"); + static TQString p1("<nobr><font color=\""); + static TQString p2("\"><b>"); + static TQString p3("</b></font></nobr>"); m_szHtmlActiveCaption = p1; m_szHtmlActiveCaption += KVI_OPTION_COLOR(KviOption_colorCaptionTextActive).name(); @@ -524,7 +524,7 @@ void KviEventEditorWindow::loadProperties(KviConfig *cfg) { /* #ifdef COMPILE_SCRIPTTOOLBAR - QValueList<int> def; + TQValueList<int> def; def.append(20); def.append(80); m_pEditor->setSizes(cfg->readIntListEntry("Sizes",def)); diff --git a/src/modules/eventeditor/eventeditor.h b/src/modules/eventeditor/eventeditor.h index d94a07cc..367c14d9 100644 --- a/src/modules/eventeditor/eventeditor.h +++ b/src/modules/eventeditor/eventeditor.h @@ -25,9 +25,9 @@ #include "kvi_window.h" #include "kvi_string.h" -#include <qwidget.h> +#include <tqwidget.h> #include "kvi_tal_listview.h" -#include <qlineedit.h> +#include <tqlineedit.h> class KviScriptEditor; @@ -35,62 +35,63 @@ class KviEventListViewItem : public KviTalListViewItem { public: unsigned int m_uEventIdx; - QString m_szName; - QString m_szParams; + TQString m_szName; + TQString m_szParams; public: - KviEventListViewItem(KviTalListView * par,unsigned int uEvIdx,const QString &name,const QString ¶ms) + KviEventListViewItem(KviTalListView * par,unsigned int uEvIdx,const TQString &name,const TQString ¶ms) : KviTalListViewItem(par), m_uEventIdx(uEvIdx), m_szName(name), m_szParams(params) {}; ~KviEventListViewItem() {}; public: - virtual QString text(int col) const { return m_szName; }; - virtual const QPixmap * pixmap(int col) const; + virtual TQString text(int col) const { return m_szName; }; + virtual const TQPixmap * pixmap(int col) const; }; class KviEventHandlerListViewItem : public KviTalListViewItem { public: - QString m_szName; - QString m_szBuffer; + TQString m_szName; + TQString m_szBuffer; bool m_bEnabled; public: - KviEventHandlerListViewItem(KviTalListViewItem * par,const QString &name,const QString &buffer,bool bEnabled) + KviEventHandlerListViewItem(KviTalListViewItem * par,const TQString &name,const TQString &buffer,bool bEnabled) : KviTalListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {}; ~KviEventHandlerListViewItem() {}; public: - virtual QString text(int col) const { return m_szName; }; - virtual const QPixmap * pixmap(int col) const; + virtual TQString text(int col) const { return m_szName; }; + virtual const TQPixmap * pixmap(int col) const; }; class KviTalPopupMenu; -class KviEventEditor : public QWidget +class KviEventEditor : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KviEventEditor(QWidget * par); + KviEventEditor(TQWidget * par); ~KviEventEditor(); public: KviScriptEditor * m_pEditor; KviTalListView * m_pListView; - QLineEdit * m_pNameEditor; + TQLineEdit * m_pNameEditor; KviTalPopupMenu * m_pContextPopup; KviEventHandlerListViewItem * m_pLastEditedItem; bool m_bOneTimeSetupDone; public: void commit(); void saveLastEditedItem(); - void getUniqueHandlerName(KviEventListViewItem *it,QString &buffer); - void getExportEventBuffer(QString &szBuffer,KviEventHandlerListViewItem * it); + void getUniqueHandlerName(KviEventListViewItem *it,TQString &buffer); + void getExportEventBuffer(TQString &szBuffer,KviEventHandlerListViewItem * it); protected slots: void selectionChanged(KviTalListViewItem *it); - void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col); + void itemPressed(KviTalListViewItem *it,const TQPoint &pnt,int col); void toggleCurrentHandlerEnabled(); void removeCurrentHandler(); void addHandlerForCurrentEvent(); void exportAllEvents(); void exportCurrentHandler(); protected: - void showEvent(QShowEvent *e); + void showEvent(TQShowEvent *e); private: void oneTimeSetup(); }; @@ -98,16 +99,17 @@ private: class KviEventEditorWindow : public KviWindow { Q_OBJECT + TQ_OBJECT public: KviEventEditorWindow(KviFrame * lpFrm); ~KviEventEditorWindow(); protected: KviEventEditor * m_pEditor; - QWidget * m_pBase; + TQWidget * m_pBase; protected: - virtual QPixmap * myIconPtr(); + virtual TQPixmap * myIconPtr(); virtual void fillCaptionBuffers(); - virtual void resizeEvent(QResizeEvent *e); + virtual void resizeEvent(TQResizeEvent *e); virtual void getConfigGroupName(KviStr &szName); virtual void saveProperties(KviConfig *); virtual void loadProperties(KviConfig *); |