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/toolbareditor/toolbareditor.cpp | |
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/toolbareditor/toolbareditor.cpp')
-rw-r--r-- | src/modules/toolbareditor/toolbareditor.cpp | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/src/modules/toolbareditor/toolbareditor.cpp b/src/modules/toolbareditor/toolbareditor.cpp index 5b00f47a..d80d8844 100644 --- a/src/modules/toolbareditor/toolbareditor.cpp +++ b/src/modules/toolbareditor/toolbareditor.cpp @@ -36,37 +36,37 @@ #include "kvi_kvs_useraction.h" #include "kvi_draganddrop.h" -#include <qpushbutton.h> -#include <qlayout.h> -#include <qapplication.h> -#include <qtooltip.h> - -#include <qlineedit.h> -#include <qlabel.h> -#include <qmessagebox.h> -#include <qframe.h> -#include <qdir.h> -#include <qtimer.h> -#include <qevent.h> +#include <tqpushbutton.h> +#include <tqlayout.h> +#include <tqapplication.h> +#include <tqtooltip.h> + +#include <tqlineedit.h> +#include <tqlabel.h> +#include <tqmessagebox.h> +#include <tqframe.h> +#include <tqdir.h> +#include <tqtimer.h> +#include <tqevent.h> KviCustomizeToolBarsDialog * KviCustomizeToolBarsDialog::m_pInstance = 0; -extern QRect g_rectToolBarEditorDialogGeometry; +extern TQRect g_rectToolBarEditorDialogGeometry; -KviTrashcanLabel::KviTrashcanLabel(QWidget * p) -: QLabel(p) +KviTrashcanLabel::KviTrashcanLabel(TQWidget * p) +: TQLabel(p) { setPixmap(*(g_pIconManager->getBigIcon("kvi_bigicon_trashcan.png"))); - QToolTip::add(this,__tr2qs("Drop here the icons from the toolbars to remove them")); - setFrameStyle(QFrame::Sunken | QFrame::WinPanel); + TQToolTip::add(this,__tr2qs("Drop here the icons from the toolbars to remove them")); + setFrameStyle(TQFrame::Sunken | TQFrame::WinPanel); setAcceptDrops(true); - setAlignment(Qt::AlignCenter); + tqsetAlignment(TQt::AlignCenter); setMinimumSize(40,40); m_uFlashCount = 0; m_pFlashTimer = 0; m_clrOriginal = paletteBackgroundColor(); - connect(KviActionManager::instance(),SIGNAL(removeActionsHintRequest()),this,SLOT(flash())); + connect(KviActionManager::instance(),TQT_SIGNAL(removeActionsHintRequest()),this,TQT_SLOT(flash())); } KviTrashcanLabel::~KviTrashcanLabel() @@ -82,8 +82,8 @@ void KviTrashcanLabel::flash() { m_uFlashCount = 0; if(m_pFlashTimer)return; - m_pFlashTimer = new QTimer(); - connect(m_pFlashTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); + m_pFlashTimer = new TQTimer(); + connect(m_pFlashTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(heartbeat())); m_pFlashTimer->start(200); } @@ -91,7 +91,7 @@ void KviTrashcanLabel::heartbeat() { m_uFlashCount++; if(m_uFlashCount % 2) - setPaletteBackgroundColor(QColor(0,0,0)); + setPaletteBackgroundColor(TQColor(0,0,0)); else setPaletteBackgroundColor(m_clrOriginal); update(); @@ -103,23 +103,23 @@ void KviTrashcanLabel::heartbeat() } } -void KviTrashcanLabel::dropEvent(QDropEvent * e) +void KviTrashcanLabel::dropEvent(TQDropEvent * e) { if(KviTextDrag::canDecode(e)) e->accept(); } -void KviTrashcanLabel::dragEnterEvent(QDragEnterEvent * e) +void KviTrashcanLabel::dragEnterEvent(TQDragEnterEvent * e) { - QString s; + TQString s; if(KviTextDrag::decode(e,s)) e->accept(); } -KviCustomToolBarPropertiesDialog::KviCustomToolBarPropertiesDialog(QWidget * p,const QString &szText,const QString &szId,const QString &szLabel,const QString &szIconId) -: QDialog(p) +KviCustomToolBarPropertiesDialog::KviCustomToolBarPropertiesDialog(TQWidget * p,const TQString &szText,const TQString &szId,const TQString &szLabel,const TQString &szIconId) +: TQDialog(p) { m_szId = szId; m_szOriginalId = szId; @@ -128,40 +128,40 @@ KviCustomToolBarPropertiesDialog::KviCustomToolBarPropertiesDialog(QWidget * p,c setCaption(__tr2qs("ToolBar Properties")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TOOLBAR))); - QGridLayout * g = new QGridLayout(this,5,6,5,3); + TQGridLayout * g = new TQGridLayout(this,5,6,5,3); - QLabel * l = new QLabel(szText,this); + TQLabel * l = new TQLabel(szText,this); g->addMultiCellWidget(l,0,0,0,5); - l = new QLabel(__tr2qs("Label") + ":",this); + l = new TQLabel(__tr2qs("Label") + ":",this); g->addWidget(l,1,0); - m_pLabelEdit = new QLineEdit(this); + m_pLabelEdit = new TQLineEdit(this); g->addMultiCellWidget(m_pLabelEdit,1,1,1,5); m_pLabelEdit->setText(szLabel); - connect(m_pLabelEdit,SIGNAL(textChanged(const QString &)),this,SLOT(labelTextChanged(const QString &))); + connect(m_pLabelEdit,TQT_SIGNAL(textChanged(const TQString &)),this,TQT_SLOT(labelTextChanged(const TQString &))); - l = new QLabel(__tr2qs("Icon") + ":",this); + l = new TQLabel(__tr2qs("Icon") + ":",this); g->addWidget(l,2,0); - m_pIconEdit = new QLineEdit(this); + m_pIconEdit = new TQLineEdit(this); m_pIconEdit->setReadOnly(true); g->addMultiCellWidget(m_pIconEdit,2,2,1,4); - m_pIconButton = new QPushButton(this); + m_pIconButton = new TQPushButton(this); g->addMultiCellWidget(m_pIconButton,2,2,5,5); - connect(m_pIconButton,SIGNAL(clicked()),this,SLOT(iconButtonClicked())); + connect(m_pIconButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(iconButtonClicked())); iconSelected(szIconId); - m_pAdvanced = new QWidget(this); - QGridLayout * ag = new QGridLayout(m_pAdvanced,1,2,0,3); + m_pAdvanced = new TQWidget(this); + TQGridLayout * ag = new TQGridLayout(m_pAdvanced,1,2,0,3); - l = new QLabel(__tr2qs("Id") + ":",m_pAdvanced); + l = new TQLabel(__tr2qs("Id") + ":",m_pAdvanced); l->setMinimumWidth(100); ag->addWidget(l,0,0); - m_pIdEdit = new QLineEdit(m_pAdvanced); + m_pIdEdit = new TQLineEdit(m_pAdvanced); ag->addWidget(m_pIdEdit,0,1); ag->setRowStretch(0,1); @@ -172,18 +172,18 @@ KviCustomToolBarPropertiesDialog::KviCustomToolBarPropertiesDialog(QWidget * p,c m_pLabelEdit->setFocus(); - QPushButton * pb = new QPushButton(__tr2qs("OK"),this); - connect(pb,SIGNAL(clicked()),this,SLOT(okClicked())); + TQPushButton * pb = new TQPushButton(__tr2qs("OK"),this); + connect(pb,TQT_SIGNAL(clicked()),this,TQT_SLOT(okClicked())); pb->setMinimumWidth(80); g->addMultiCellWidget(pb,4,4,4,5); - pb = new QPushButton(__tr2qs("Cancel"),this); - connect(pb,SIGNAL(clicked()),this,SLOT(reject())); + pb = new TQPushButton(__tr2qs("Cancel"),this); + connect(pb,TQT_SIGNAL(clicked()),this,TQT_SLOT(reject())); pb->setMinimumWidth(80); g->addWidget(pb,4,3); - m_pAdvancedButton = new QPushButton(__tr2qs("Advanced..."),this); - connect(m_pAdvancedButton,SIGNAL(clicked()),this,SLOT(advancedClicked())); + m_pAdvancedButton = new TQPushButton(__tr2qs("Advanced..."),this); + connect(m_pAdvancedButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(advancedClicked())); m_pAdvancedButton->setMinimumWidth(100); g->addMultiCellWidget(m_pAdvancedButton,4,4,0,1); @@ -197,9 +197,9 @@ KviCustomToolBarPropertiesDialog::~KviCustomToolBarPropertiesDialog() { } -void KviCustomToolBarPropertiesDialog::iconSelected(const QString &szIconId) +void KviCustomToolBarPropertiesDialog::iconSelected(const TQString &szIconId) { - QPixmap * p = g_pIconManager->getImage(szIconId.utf8().data()); + TQPixmap * p = g_pIconManager->getImage(szIconId.utf8().data()); if(p) { m_pIconButton->setPixmap(*p); @@ -215,22 +215,22 @@ void KviCustomToolBarPropertiesDialog::iconSelected(const QString &szIconId) void KviCustomToolBarPropertiesDialog::iconButtonClicked() { KviImageDialog * dlg = new KviImageDialog(this,__tr2qs("Please choose the icon for the ToolBar")); - if(dlg->exec() != QDialog::Accepted) + if(dlg->exec() != TQDialog::Accepted) { delete dlg; return; } - QString s = dlg->selectedImage(); + TQString s = dlg->selectedImage(); delete dlg; iconSelected(s); } -void KviCustomToolBarPropertiesDialog::labelTextChanged(const QString &s) +void KviCustomToolBarPropertiesDialog::labelTextChanged(const TQString &s) { if(m_szOriginalId.isEmpty()) { - QString szId = KviCustomToolBarManager::instance()->idForNewToolBar(s); + TQString szId = KviCustomToolBarManager::instance()->idForNewToolBar(s); m_pIdEdit->setText(szId); } } @@ -240,7 +240,7 @@ void KviCustomToolBarPropertiesDialog::okClicked() { if(m_szLabel.isEmpty()) { - QMessageBox::information(this,__tr2qs("Invalid ToolBar Label"),__tr2qs("The ToolBar Label can't be empty!"),__tr2qs("OK")); + TQMessageBox::information(this,__tr2qs("Invalid ToolBar Label"),__tr2qs("The ToolBar Label can't be empty!"),__tr2qs("OK")); return; } @@ -249,11 +249,11 @@ void KviCustomToolBarPropertiesDialog::okClicked() m_szId = KviCustomToolBarManager::instance()->idForNewToolBar(m_szLabel); } - if(KviCustomToolBarManager::instance()->find(m_szId)) + if(KviCustomToolBarManager::instance()->tqfind(m_szId)) { if(m_szId != m_szOriginalId) { - if(QMessageBox::information(this,__tr2qs("Duplicate ToolBar Id"), + if(TQMessageBox::information(this,__tr2qs("Duplicate ToolBar Id"), __tr2qs("The specified ToolBar Id already exists.<br>" \ "Would you like KVIrc to assign it automatically (so it doesn't " "collide with any other toolbar) or you prefer to do it manually ?"), @@ -281,43 +281,43 @@ void KviCustomToolBarPropertiesDialog::advancedClicked() } -KviCustomizeToolBarsDialog::KviCustomizeToolBarsDialog(QWidget * p) -: QDialog(p,"" /*,WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_StaysOnTop | WStyle_DialogBorder*/) +KviCustomizeToolBarsDialog::KviCustomizeToolBarsDialog(TQWidget * p) +: TQDialog(p,"" /*,WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_StaysOnTop | WStyle_DialogBorder*/) { setCaption(__tr2qs("Customize Toolbars")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TOOLBAR))); m_pInstance = this; - QGridLayout * g = new QGridLayout(this,8,2,4,5); + TQGridLayout * g = new TQGridLayout(this,8,2,4,5); m_pDrawer = new KviActionDrawer(this); g->addMultiCellWidget(m_pDrawer,0,6,0,0); - QPushButton * b = new QPushButton(__tr2qs("New ToolBar"),this); - connect(b,SIGNAL(clicked()),this,SLOT(newToolBar())); + TQPushButton * b = new TQPushButton(__tr2qs("New ToolBar"),this); + connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(newToolBar())); g->addWidget(b,0,1); - m_pDeleteToolBarButton = new QPushButton(__tr2qs("Delete ToolBar"),this); - connect(m_pDeleteToolBarButton,SIGNAL(clicked()),this,SLOT(deleteToolBar())); + m_pDeleteToolBarButton = new TQPushButton(__tr2qs("Delete ToolBar"),this); + connect(m_pDeleteToolBarButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(deleteToolBar())); g->addWidget(m_pDeleteToolBarButton,1,1); - m_pRenameToolBarButton = new QPushButton(__tr2qs("Edit ToolBar"),this); - connect(m_pRenameToolBarButton,SIGNAL(clicked()),this,SLOT(renameToolBar())); + m_pRenameToolBarButton = new TQPushButton(__tr2qs("Edit ToolBar"),this); + connect(m_pRenameToolBarButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(renameToolBar())); g->addWidget(m_pRenameToolBarButton,2,1); - QFrame * f = new QFrame(this); - f->setFrameStyle(QFrame::HLine | QFrame::Sunken); + TQFrame * f = new TQFrame(this); + f->setFrameStyle(TQFrame::HLine | TQFrame::Sunken); g->addWidget(f,3,1); - m_pExportToolBarButton = new QPushButton(__tr2qs("Export ToolBar"),this); - connect(m_pExportToolBarButton,SIGNAL(clicked()),this,SLOT(exportToolBar())); + m_pExportToolBarButton = new TQPushButton(__tr2qs("Export ToolBar"),this); + connect(m_pExportToolBarButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(exportToolBar())); g->addWidget(m_pExportToolBarButton,4,1); KviTrashcanLabel * t = new KviTrashcanLabel(this); g->addWidget(t,6,1); - b = new QPushButton(__tr2qs("Close"),this); - connect(b,SIGNAL(clicked()),this,SLOT(closeClicked())); + b = new TQPushButton(__tr2qs("Close"),this); + connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(closeClicked())); g->addWidget(b,7,1); g->setRowStretch(5,1); @@ -325,7 +325,7 @@ KviCustomizeToolBarsDialog::KviCustomizeToolBarsDialog(QWidget * p) m_pDrawer->fill(); - connect(KviActionManager::instance(),SIGNAL(currentToolBarChanged()),this,SLOT(currentToolBarChanged())); + connect(KviActionManager::instance(),TQT_SIGNAL(currentToolBarChanged()),this,TQT_SLOT(currentToolBarChanged())); KviActionManager::instance()->customizeToolBarsDialogCreated(); currentToolBarChanged(); @@ -343,7 +343,7 @@ KviCustomizeToolBarsDialog::KviCustomizeToolBarsDialog(QWidget * p) KviCustomizeToolBarsDialog::~KviCustomizeToolBarsDialog() { - g_rectToolBarEditorDialogGeometry = QRect(pos().x(),pos().y(),size().width(),size().height()); + g_rectToolBarEditorDialogGeometry = TQRect(pos().x(),pos().y(),size().width(),size().height()); KviActionManager::instance()->customizeToolBarsDialogDestroyed(); m_pInstance = 0; @@ -355,10 +355,10 @@ void KviCustomizeToolBarsDialog::currentToolBarChanged() m_pRenameToolBarButton->setEnabled(KviActionManager::instance()->currentToolBar()); } -void KviCustomizeToolBarsDialog::showEvent(QShowEvent * e) +void KviCustomizeToolBarsDialog::showEvent(TQShowEvent * e) { -// repaintContents(); -// QRect r = parentWidget() ? parentWidget()->rect() : QApplication::desktop()->rect(); +// tqrepaintContents(); +// TQRect r = tqparentWidget() ? tqparentWidget()->rect() : TQApplication::desktop()->rect(); // int x = (r.width() - width()) / 2; // int y = (r.height() - height()) / 2; // move(x,y); @@ -369,9 +369,9 @@ void KviCustomizeToolBarsDialog::deleteToolBar() { KviCustomToolBar * t = KviActionManager::currentToolBar(); if(!t)return; - if(QMessageBox::question(this, + if(TQMessageBox::question(this, __tr2qs("Confirm ToolBar Deletion"), - __tr2qs("Do you really want to delete toolbar \"%1\" ?").arg(t->label()), + __tr2qs("Do you really want to delete toolbar \"%1\" ?").tqarg(t->label()), __tr2qs("No"), __tr2qs("Yes")) == 0)return; KviCustomToolBarManager::instance()->destroyDescriptor(t->descriptor()->id()); @@ -382,18 +382,18 @@ void KviCustomizeToolBarsDialog::exportToolBar() KviCustomToolBar * t = KviActionManager::currentToolBar(); if(!t)return; - 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 += t->descriptor()->id(); szName += ".kvs"; - QString szFile; + TQString szFile; if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,"*.kvs",true,true,true))return; - QString szCode; + TQString szCode; - int ret = QMessageBox::question(this, + int ret = TQMessageBox::question(this, __tr2qs("ToolBar Export"), __tr2qs("Do you want the associated actions to be exported with the toolbar ?"), __tr2qs("Yes"), @@ -406,10 +406,10 @@ void KviCustomizeToolBarsDialog::exportToolBar() if(bExportActions) { - KviPointerList<QString> * a = t->descriptor()->actions(); + KviPointerList<TQString> * a = t->descriptor()->actions(); if(a) { - for(QString * s = a->first();s;s = a->next()) + for(TQString * s = a->first();s;s = a->next()) { KviAction * act = KviActionManager::instance()->getAction(*s); if(act) @@ -432,10 +432,10 @@ void KviCustomizeToolBarsDialog::exportToolBar() szCode += t->descriptor()->iconId(); szCode += "\n"; - KviPointerList<QString> * aa = t->descriptor()->actions(); + KviPointerList<TQString> * aa = t->descriptor()->actions(); if(aa) { - for(QString * ss = aa->first();ss;ss = aa->next()) + for(TQString * ss = aa->first();ss;ss = aa->next()) { szCode += "toolbar.additem "; szCode += t->descriptor()->id(); @@ -451,7 +451,7 @@ void KviCustomizeToolBarsDialog::exportToolBar() if(!KviFileUtils::writeFile(szFile,szCode)) { - QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the toolbar file."),__tr2qs("OK")); + TQMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the toolbar file."),__tr2qs("OK")); } } @@ -462,21 +462,21 @@ void KviCustomizeToolBarsDialog::renameToolBar() if(!t)return; KviCustomToolBarPropertiesDialog * dlg = new KviCustomToolBarPropertiesDialog(this, - __tr2qs("Please specify the properties for the toolbar \"%1\"").arg(t->label()), + __tr2qs("Please specify the properties for the toolbar \"%1\"").tqarg(t->label()), t->descriptor()->id(), t->descriptor()->labelCode(), t->descriptor()->iconId()); dlg->show(); - if(dlg->exec() != QDialog::Accepted) + if(dlg->exec() != TQDialog::Accepted) { delete dlg; return; } - QString id = dlg->id(); - QString label = dlg->label(); - QString icon = dlg->iconId(); + TQString id = dlg->id(); + TQString label = dlg->label(); + TQString icon = dlg->iconId(); delete dlg; if((id == t->descriptor()->id()) && (label == t->descriptor()->labelCode()) && (icon == t->descriptor()->iconId()))return; @@ -493,15 +493,15 @@ void KviCustomizeToolBarsDialog::newToolBar() __tr2qs("My ToolBar")); dlg->show(); - if(dlg->exec() != QDialog::Accepted) + if(dlg->exec() != TQDialog::Accepted) { delete dlg; return; } - QString id = dlg->id(); - QString label = dlg->label(); - QString icon = dlg->iconId(); + TQString id = dlg->id(); + TQString label = dlg->label(); + TQString icon = dlg->iconId(); delete dlg; KviCustomToolBarDescriptor * d = KviCustomToolBarManager::instance()->create(id,label); @@ -529,7 +529,7 @@ void KviCustomizeToolBarsDialog::display() m_pInstance->show(); } -void KviCustomizeToolBarsDialog::closeEvent(QCloseEvent * e) +void KviCustomizeToolBarsDialog::closeEvent(TQCloseEvent * e) { e->ignore(); delete this; |