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/theme/managementdialog.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/theme/managementdialog.cpp')
-rw-r--r-- | src/modules/theme/managementdialog.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/src/modules/theme/managementdialog.cpp b/src/modules/theme/managementdialog.cpp index bfd75283..7ed10db7 100644 --- a/src/modules/theme/managementdialog.cpp +++ b/src/modules/theme/managementdialog.cpp @@ -37,28 +37,28 @@ #include "kvi_msgbox.h" -#include <qlayout.h> -#include <qpushbutton.h> +#include <tqlayout.h> +#include <tqpushbutton.h> #include "kvi_tal_listbox.h" -#include <qlineedit.h> +#include <tqlineedit.h> #include <kvi_tal_textedit.h> -#include <qregexp.h> -#include <qmessagebox.h> -#include <qdir.h> -#include <qstringlist.h> -#include <qdatetime.h> -#include <qfiledialog.h> +#include <tqregexp.h> +#include <tqmessagebox.h> +#include <tqdir.h> +#include <tqstringlist.h> +#include <tqdatetime.h> +#include <tqfiledialog.h> #include "kvi_tal_popupmenu.h" -#include <qcombobox.h> -#include <qpainter.h> -#include <qtooltip.h> -#include <qimage.h> +#include <tqcombobox.h> +#include <tqpainter.h> +#include <tqtooltip.h> +#include <tqimage.h> #include <kvi_tal_textedit.h> -//#include <qmultilineedit.h> +//#include <tqmultilineedit.h> #ifdef COMPILE_USE_QT4 -#include <QCloseEvent> +#include <TQCloseEvent> #endif -#include <qbuffer.h> +#include <tqbuffer.h> #include "kvi_options.h" #include "kvi_locale.h" @@ -77,7 +77,7 @@ #include <stdlib.h> // rand & srand -extern QRect g_rectManagementDialogGeometry; +extern TQRect g_rectManagementDialogGeometry; @@ -85,7 +85,7 @@ KviThemeListBoxItem::KviThemeListBoxItem(KviTalListBox * box,KviThemeInfo * inf) : KviTalListBoxText(box) { m_pThemeInfo = inf; - QString t; + TQString t; t = "<nobr><b>"; t += inf->name(); t += "</b>"; @@ -121,14 +121,14 @@ KviThemeListBoxItem::~KviThemeListBoxItem() delete m_pText; } -void KviThemeListBoxItem::paint(QPainter * p) +void KviThemeListBoxItem::paint(TQPainter * p) { KviTalListBoxText::paint(p); - p->drawPixmap(LVI_BORDER,LVI_BORDER, *(g_pIconManager->getBigIcon(QString(KVI_BIGICON_THEME))) ); + p->drawPixmap(LVI_BORDER,LVI_BORDER, *(g_pIconManager->getBigIcon(TQString(KVI_BIGICON_THEME))) ); int afterIcon = LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING; int www = p->window().width() - (afterIcon + LVI_BORDER); m_pText->setWidth(www); - m_pText->draw(p,afterIcon,LVI_BORDER,QRect(afterIcon,LVI_BORDER,www,p->window().height() - (LVI_BORDER * 2)),listBox()->viewport()->colorGroup()); + m_pText->draw(p,afterIcon,LVI_BORDER,TQRect(afterIcon,LVI_BORDER,www,p->window().height() - (LVI_BORDER * 2)),listBox()->viewport()->tqcolorGroup()); } int KviThemeListBoxItem::height(const KviTalListBox * lb) const @@ -141,8 +141,8 @@ int KviThemeListBoxItem::height(const KviTalListBox * lb) const KviThemeManagementDialog * KviThemeManagementDialog::m_pInstance = 0; -KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent) -: QDialog(parent,"theme_options_widget") +KviThemeManagementDialog::KviThemeManagementDialog(TQWidget * tqparent) +: TQDialog(tqparent,"theme_options_widget") { setCaption(__tr2qs_ctx("Manage Themes - KVIrc","theme")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_THEME))); @@ -151,70 +151,70 @@ KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent) m_pInstance = this; - QGridLayout * g = new QGridLayout(this,3,2,4,4); + TQGridLayout * g = new TQGridLayout(this,3,2,4,4); KviTalHBox *hb = new KviTalHBox(this); g->addMultiCellWidget(hb,0,0,0,1); KviStyledToolButton * tb; - QFrame * sep; + TQFrame * sep; tb = new KviStyledToolButton(hb); tb->setIconSet(*(g_pIconManager->getBigIcon(KVI_BIGICON_SAVE))); tb->setUsesBigPixmap(true); - QToolTip::add(tb,__tr2qs_ctx("Save Current Theme...","theme")); - connect(tb,SIGNAL(clicked()),this,SLOT(saveCurrentTheme())); + TQToolTip::add(tb,__tr2qs_ctx("Save Current Theme...","theme")); + connect(tb,TQT_SIGNAL(clicked()),this,TQT_SLOT(saveCurrentTheme())); - sep = new QFrame(hb); - sep->setFrameStyle(QFrame::VLine | QFrame::Sunken); + sep = new TQFrame(hb); + sep->setFrameStyle(TQFrame::VLine | TQFrame::Sunken); sep->setMinimumWidth(12); m_pPackThemeButton = new KviStyledToolButton(hb); m_pPackThemeButton->setIconSet(*(g_pIconManager->getBigIcon(KVI_BIGICON_PACK))); m_pPackThemeButton->setUsesBigPixmap(true); - QToolTip::add(m_pPackThemeButton,__tr2qs_ctx("Export Selected Themes to a Distributable Package","theme")); - connect(m_pPackThemeButton,SIGNAL(clicked()),this,SLOT(packTheme())); + TQToolTip::add(m_pPackThemeButton,__tr2qs_ctx("Export Selected Themes to a Distributable Package","theme")); + connect(m_pPackThemeButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(packTheme())); m_pDeleteThemeButton = new KviStyledToolButton(hb); m_pDeleteThemeButton->setIconSet(*(g_pIconManager->getBigIcon(KVI_BIGICON_REMOVE))); m_pDeleteThemeButton->setUsesBigPixmap(true); - QToolTip::add(m_pDeleteThemeButton,__tr2qs_ctx("Delete Selected Themes","theme")); - connect(m_pDeleteThemeButton,SIGNAL(clicked()),this,SLOT(deleteTheme())); + TQToolTip::add(m_pDeleteThemeButton,__tr2qs_ctx("Delete Selected Themes","theme")); + connect(m_pDeleteThemeButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(deleteTheme())); - sep = new QFrame(hb); - sep->setFrameStyle(QFrame::VLine | QFrame::Sunken); + sep = new TQFrame(hb); + sep->setFrameStyle(TQFrame::VLine | TQFrame::Sunken); sep->setMinimumWidth(12); tb = new KviStyledToolButton(hb); tb->setIconSet(*(g_pIconManager->getBigIcon(KVI_BIGICON_OPEN))); tb->setUsesBigPixmap(true); - QToolTip::add(tb,__tr2qs_ctx("Install Theme Package From Disk","theme")); - connect(tb,SIGNAL(clicked()),this,SLOT(installFromFile())); + TQToolTip::add(tb,__tr2qs_ctx("Install Theme Package From Disk","theme")); + connect(tb,TQT_SIGNAL(clicked()),this,TQT_SLOT(installFromFile())); tb = new KviStyledToolButton(hb); tb->setIconSet(*(g_pIconManager->getBigIcon(KVI_BIGICON_WWW))); tb->setUsesBigPixmap(true); - QToolTip::add(tb,__tr2qs_ctx("Get More Themes...","theme")); - connect(tb,SIGNAL(clicked()),this,SLOT(getMoreThemes())); + TQToolTip::add(tb,__tr2qs_ctx("Get More Themes...","theme")); + connect(tb,TQT_SIGNAL(clicked()),this,TQT_SLOT(getMoreThemes())); - QWidget *w= new QWidget(hb); - w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); + TQWidget *w= new TQWidget(hb); + w->tqsetSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Minimum); m_pListBox = new KviTalListBox(this); m_pListBox->setMinimumHeight(400); m_pListBox->setMinimumWidth(400); m_pListBox->setSelectionMode(KviTalListBox::Extended); - connect(m_pListBox,SIGNAL(doubleClicked(KviTalListBoxItem *)),this,SLOT(applyTheme(KviTalListBoxItem *))); - connect(m_pListBox,SIGNAL(contextMenuRequested(KviTalListBoxItem *,const QPoint &)), - this,SLOT(contextMenuRequested(KviTalListBoxItem *,const QPoint &))); - connect(m_pListBox,SIGNAL(selectionChanged()),this,SLOT(enableDisableButtons())); + connect(m_pListBox,TQT_SIGNAL(doubleClicked(KviTalListBoxItem *)),this,TQT_SLOT(applyTheme(KviTalListBoxItem *))); + connect(m_pListBox,TQT_SIGNAL(contextMenuRequested(KviTalListBoxItem *,const TQPoint &)), + this,TQT_SLOT(contextMenuRequested(KviTalListBoxItem *,const TQPoint &))); + connect(m_pListBox,TQT_SIGNAL(selectionChanged()),this,TQT_SLOT(enableDisableButtons())); g->addMultiCellWidget(m_pListBox,1,1,0,1); KviDynamicToolTip * tip = new KviDynamicToolTip(m_pListBox); - connect(tip,SIGNAL(tipRequest(KviDynamicToolTip *,const QPoint &)),this,SLOT(tipRequest(KviDynamicToolTip *,const QPoint &))); + connect(tip,TQT_SIGNAL(tipRequest(KviDynamicToolTip *,const TQPoint &)),this,TQT_SLOT(tipRequest(KviDynamicToolTip *,const TQPoint &))); - QPushButton * b = new QPushButton(__tr2qs("Close"),this); - connect(b,SIGNAL(clicked()),this,SLOT(closeClicked())); + TQPushButton * b = new TQPushButton(__tr2qs("Close"),this); + connect(b,TQT_SIGNAL(clicked()),this,TQT_SLOT(closeClicked())); g->addWidget(b,2,1); g->setRowStretch(1,0); @@ -235,7 +235,7 @@ KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent) KviThemeManagementDialog::~KviThemeManagementDialog() { - g_rectManagementDialogGeometry = QRect(pos().x(),pos().y(),size().width(),size().height()); + g_rectManagementDialogGeometry = TQRect(pos().x(),pos().y(),size().width(),size().height()); m_pInstance = 0; } @@ -277,14 +277,14 @@ void KviThemeManagementDialog::packTheme() } -void KviThemeManagementDialog::contextMenuRequested(KviTalListBoxItem * it,const QPoint & pos) +void KviThemeManagementDialog::contextMenuRequested(KviTalListBoxItem * it,const TQPoint & pos) { if(it) { m_pListBox->setCurrentItem(it); m_pContextPopup->clear(); - m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_MINUS)),__tr2qs_ctx("&Remove Theme","theme"),this,SLOT(deleteTheme())); - m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)),__tr2qs_ctx("&Apply Theme","theme"),this,SLOT(applyCurrentTheme())); + m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_MINUS)),__tr2qs_ctx("&Remove Theme","theme"),this,TQT_SLOT(deleteTheme())); + m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)),__tr2qs_ctx("&Apply Theme","theme"),this,TQT_SLOT(applyCurrentTheme())); m_pContextPopup->popup(pos); } } @@ -304,17 +304,17 @@ void KviThemeManagementDialog::applyCurrentTheme() __tr2qs_ctx("Do you wish to apply theme \"%Q\" (version %Q)?","theme"), &(it->themeInfo()->name()),&(it->themeInfo()->version()))) { - QString szPath = it->themeInfo()->absoluteDirectory(); + TQString szPath = it->themeInfo()->absoluteDirectory(); if(szPath.isEmpty())return; KviThemeInfo out; if(!KviTheme::load(szPath,out)) { - QString szErr = out.lastError(); - QString szMsg; - KviQString::sprintf(szMsg,__tr2qs_ctx("Failed to apply the specified theme: %Q","theme"),&szErr); - QMessageBox::critical(this,__tr2qs_ctx("Apply theme - KVIrc","theme"),szMsg, - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQString szErr = out.lastError(); + TQString szMsg; + KviTQString::sprintf(szMsg,__tr2qs_ctx("Failed to apply the specified theme: %Q","theme"),&szErr); + TQMessageBox::critical(this,__tr2qs_ctx("Apply theme - KVIrc","theme"),szMsg, + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); } } @@ -340,10 +340,10 @@ jump_out: void KviThemeManagementDialog::installFromFile() { int iThemeCount=0; - QString szFileName; - QString szError; + TQString szFileName; + TQString szError; - if(!KviFileDialog::askForOpenFileName(szFileName,__tr2qs_ctx("Open Theme - KVIrc","theme"),QString::null,"*.kvt")) + if(!KviFileDialog::askForOpenFileName(szFileName,__tr2qs_ctx("Open Theme - KVIrc","theme"),TQString(),"*.kvt")) return; if(!KviThemeFunctions::installThemePackage(szFileName,szError,this)) @@ -368,18 +368,18 @@ void KviThemeManagementDialog::saveCurrentTheme() fillThemeBox(); } -void KviThemeManagementDialog::fillThemeBox(const QString &szDir) +void KviThemeManagementDialog::fillThemeBox(const TQString &szDir) { - QDir d(szDir); + TQDir d(szDir); - QStringList sl = d.entryList(QDir::Dirs); + TQStringList sl = d.entryList(TQDir::Dirs); - for(QStringList::Iterator it = sl.begin();it != sl.end();++it) + for(TQStringList::Iterator it = sl.begin();it != sl.end();++it) { if(*it == ".")continue; if(*it == "..")continue; - QString szTest = szDir; + TQString szTest = szDir; szTest += KVI_PATH_SEPARATOR_CHAR; szTest += *it; @@ -399,7 +399,7 @@ void KviThemeManagementDialog::fillThemeBox() { m_pListBox->clear(); - QString szDir; + TQString szDir; g_pApp->getGlobalKvircDirectory(szDir,KviApp::Themes); fillThemeBox(szDir); g_pApp->getLocalKvircDirectory(szDir,KviApp::Themes); @@ -425,13 +425,13 @@ void KviThemeManagementDialog::enableDisableButtons() m_pDeleteThemeButton->setEnabled(b); } -void KviThemeManagementDialog::closeEvent(QCloseEvent * e) +void KviThemeManagementDialog::closeEvent(TQCloseEvent * e) { e->ignore(); delete this; } -void KviThemeManagementDialog::tipRequest(KviDynamicToolTip *pTip,const QPoint &pnt) +void KviThemeManagementDialog::tipRequest(KviDynamicToolTip *pTip,const TQPoint &pnt) { KviThemeListBoxItem * it = (KviThemeListBoxItem *)(m_pListBox->itemAt(pnt)); @@ -439,7 +439,7 @@ void KviThemeManagementDialog::tipRequest(KviDynamicToolTip *pTip,const QPoint & KviThemeInfo * pThemeInfo = it->themeInfo(); - QString szThemeDescription; + TQString szThemeDescription; KviThemeFunctions::getThemeHtmlDescription( szThemeDescription, @@ -455,5 +455,5 @@ void KviThemeManagementDialog::tipRequest(KviDynamicToolTip *pTip,const QPoint & 0 ); - pTip->tip(m_pListBox->itemRect(it),szThemeDescription); + pTip->tip(m_pListBox->tqitemRect(it),szThemeDescription); } |