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/packthemedialog.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/packthemedialog.cpp')
-rw-r--r-- | src/modules/theme/packthemedialog.cpp | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/src/modules/theme/packthemedialog.cpp b/src/modules/theme/packthemedialog.cpp index 88b248a8..de9b2333 100644 --- a/src/modules/theme/packthemedialog.cpp +++ b/src/modules/theme/packthemedialog.cpp @@ -25,26 +25,26 @@ #include "packthemedialog.h" #include "themefunctions.h" -#include <qlayout.h> -#include <qpushbutton.h> -#include <qlineedit.h> -#include <qregexp.h> -#include <qmessagebox.h> -#include <qdir.h> -#include <qcombobox.h> -#include <qpainter.h> -#include <qtooltip.h> -#include <qimage.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqlineedit.h> +#include <tqregexp.h> +#include <tqmessagebox.h> +#include <tqdir.h> +#include <tqcombobox.h> +#include <tqpainter.h> +#include <tqtooltip.h> +#include <tqimage.h> #include <kvi_tal_textedit.h> #ifdef COMPILE_USE_QT4 -#include <q3multilineedit.h> -#include <QDateTime> +#include <tq3multilineedit.h> +#include <TQDateTime> #else -#include <qmultilineedit.h> +#include <tqmultilineedit.h> #endif -#include <qbuffer.h> -#include <qlabel.h> -#include <qregexp.h> +#include <tqbuffer.h> +#include <tqlabel.h> +#include <tqregexp.h> #include "kvi_options.h" @@ -65,19 +65,19 @@ -KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviThemeInfo> * pThemeInfoList) +KviPackThemeDialog::KviPackThemeDialog(TQWidget * pParent,KviPointerList<KviThemeInfo> * pThemeInfoList) : KviTalWizard(pParent) { m_pThemeInfoList = pThemeInfoList; KviThemeInfo * pThemeInfo; - QString szPackageName; - QString szPackageAuthor; - QString szPackageDescription; - QString szPackageVersion; + TQString szPackageName; + TQString szPackageAuthor; + TQString szPackageDescription; + TQString szPackageVersion; - m_szPackagePath = QDir::homeDirPath(); - KviQString::ensureLastCharIs(m_szPackagePath,QChar(KVI_PATH_SEPARATOR_CHAR)); + m_szPackagePath = TQDir::homeDirPath(); + KviTQString::ensureLastCharIs(m_szPackagePath,TQChar(KVI_PATH_SEPARATOR_CHAR)); bool bPackagePathSet = false; @@ -97,7 +97,7 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme szPackageVersion = pThemeInfo->version(); m_szPackagePath += pThemeInfo->subdirectory(); - if(m_szPackagePath.find(QRegExp("[0-9]\\.[0-9]")) == -1) + if(m_szPackagePath.tqfind(TQRegExp("[0-9]\\.[0-9]")) == -1) { m_szPackagePath += "-"; m_szPackagePath += szPackageVersion; @@ -122,11 +122,11 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme setMinimumSize(400,350); // welcome page ================================================================================== - QWidget * pPage = new QWidget(this); - QGridLayout * pLayout = new QGridLayout(pPage,2,1,4,4); + TQWidget * pPage = new TQWidget(this); + TQGridLayout * pLayout = new TQGridLayout(pPage,2,1,4,4); - QLabel * pLabel = new QLabel(pPage); - QString szText = "<p>"; + TQLabel * pLabel = new TQLabel(pPage); + TQString szText = "<p>"; szText += __tr2qs_ctx("This procedure allows you to export the selected themes to a single package. It is useful when you want to distribute your themes to the public.","theme"); szText += "</p><p>"; szText += __tr2qs_ctx("You will be asked to provide a package name, a description and, if you want, an icon/screenshot.","theme"); @@ -146,23 +146,23 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme // theme data name ================================================================================ - pPage = new QWidget(this); - pLayout = new QGridLayout(pPage,2,1,4,4); + pPage = new TQWidget(this); + pLayout = new TQGridLayout(pPage,2,1,4,4); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("This is the information list for the themes you're packaging. If it looks OK press \"Next\" to continue, otherwise press \"Cancel\" and rewiew your themes first.","theme")); - pLabel->setTextFormat(Qt::RichText); + pLabel->setTextFormat(TQt::RichText); pLayout->addWidget(pLabel,0,0); - QString szThemesDescription = "<html><body bgcolor=\"#ffffff\">"; + TQString szThemesDescription = "<html><body bgcolor=\"#ffffff\">"; int iIdx = 0; - QPixmap pixScreenshot; - QString szScreenshotPath; + TQPixmap pixScreenshot; + TQString szScreenshotPath; for(pThemeInfo = m_pThemeInfoList->first();pThemeInfo;pThemeInfo = m_pThemeInfoList->next()) { - QString szThemeDescription; + TQString szThemeDescription; if(pixScreenshot.isNull()) { @@ -194,7 +194,7 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme szThemesDescription += "</body></html>"; KviTalTextEdit * pTextEdit = new KviTalTextEdit(pPage); - pTextEdit->setPaper(QBrush(QColor(255,255,255))); + pTextEdit->setPaper(TQBrush(TQColor(255,255,255))); pTextEdit->setReadOnly(true); pTextEdit->setText(szThemesDescription); pLayout->addWidget(pTextEdit,1,0); @@ -208,31 +208,31 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme // packager informations ================================================================================ - pPage = new QWidget(this); - pLayout = new QGridLayout(pPage,5,2,4,4); + pPage = new TQWidget(this); + pLayout = new TQGridLayout(pPage,5,2,4,4); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Here you need to provide informations about you (the packager) and a short description of the package you're creating.","theme")); - pLabel->setTextFormat(Qt::RichText); + pLabel->setTextFormat(TQt::RichText); pLayout->addMultiCellWidget(pLabel,0,0,0,1); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Package Name:","theme")); pLayout->addWidget(pLabel,1,0); - m_pPackageNameEdit = new QLineEdit(pPage); + m_pPackageNameEdit = new TQLineEdit(pPage); m_pPackageNameEdit->setText(szPackageName); pLayout->addWidget(m_pPackageNameEdit,1,1); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Version:","theme")); pLayout->addWidget(pLabel,2,0); - m_pPackageVersionEdit = new QLineEdit(pPage); + m_pPackageVersionEdit = new TQLineEdit(pPage); m_pPackageVersionEdit->setText(szPackageVersion); pLayout->addWidget(m_pPackageVersionEdit,2,1); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Description:","theme")); pLayout->addWidget(pLabel,3,0); @@ -240,11 +240,11 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme m_pPackageDescriptionEdit->setText(szPackageDescription); pLayout->addWidget(m_pPackageDescriptionEdit,3,1); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Package Author:","theme")); pLayout->addWidget(pLabel,4,0); - m_pPackagerNameEdit = new QLineEdit(pPage); + m_pPackagerNameEdit = new TQLineEdit(pPage); m_pPackagerNameEdit->setText(szPackageAuthor); pLayout->addWidget(m_pPackagerNameEdit,4,1); @@ -260,23 +260,23 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme // screenshot/logo/icon ================================================================================ - pPage = new QWidget(this); - pLayout = new QGridLayout(pPage,3,1,4,4); + pPage = new TQWidget(this); + pLayout = new TQGridLayout(pPage,3,1,4,4); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Here you can choose the image that will appear in the installation dialog for your theme package. It can be an icon, a logo or a screenshot and it should be not larger than 300x225. If you don't provide an image a simple default icon will be used at installation stage.","theme")); - pLabel->setTextFormat(Qt::RichText); + pLabel->setTextFormat(TQt::RichText); pLayout->addWidget(pLabel,0,0); - m_pImageLabel = new QLabel(pPage); - m_pImageLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_pImageLabel = new TQLabel(pPage); + m_pImageLabel->setFrameStyle(TQFrame::Sunken | TQFrame::Panel); m_pImageLabel->setMinimumSize(300,225); - m_pImageLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); + m_pImageLabel->tqsetAlignment(TQt::AlignCenter | TQt::AlignVCenter); pLayout->addWidget(m_pImageLabel,1,0); - QString szFilter = "*.png *.jpg *.xpm"; + TQString szFilter = "*.png *.jpg *.xpm"; m_pImageSelector = new KviFileSelector(pPage,"",&m_szImagePath,true,0,szFilter); - connect(m_pImageSelector,SIGNAL(selectionChanged(const QString &)),this,SLOT(imageSelectionChanged(const QString &))); + connect(m_pImageSelector,TQT_SIGNAL(selectionChanged(const TQString &)),this,TQT_SLOT(imageSelectionChanged(const TQString &))); pLayout->addWidget(m_pImageSelector,2,0); pLayout->setRowStretch(1,1); @@ -289,12 +289,12 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme // save file name ================================================================================ - pPage = new QWidget(this); - pLayout = new QGridLayout(pPage,4,1,4,4); + pPage = new TQWidget(this); + pLayout = new TQGridLayout(pPage,4,1,4,4); - pLabel = new QLabel(pPage); - pLabel->setText(__tr2qs_ctx("Here you must choose the file name for the theme package. It should have a *.%1 extension.","theme").arg(KVI_FILEEXTENSION_THEMEPACKAGE)); - pLabel->setTextFormat(Qt::RichText); + pLabel = new TQLabel(pPage); + pLabel->setText(__tr2qs_ctx("Here you must choose the file name for the theme package. It should have a *.%1 extension.","theme").tqarg(KVI_FILEEXTENSION_THEMEPACKAGE)); + pLabel->setTextFormat(TQt::RichText); pLayout->addWidget(pLabel,0,0); szFilter = "*."; @@ -302,9 +302,9 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme m_pPathSelector = new KviFileSelector(pPage,"",&m_szPackagePath,true,KviFileSelector::ChooseSaveFileName,szFilter); pLayout->addWidget(m_pPathSelector,1,0); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Finally hit the \"Finish\" button to complete the packaging operation.","theme")); - pLabel->setTextFormat(Qt::RichText); + pLabel->setTextFormat(TQt::RichText); pLayout->addWidget(pLabel,3,0); pLayout->setRowStretch(2,1); @@ -326,17 +326,17 @@ KviPackThemeDialog::~KviPackThemeDialog() { } -void KviPackThemeDialog::imageSelectionChanged(const QString &szImagePath) +void KviPackThemeDialog::imageSelectionChanged(const TQString &szImagePath) { - QImage pix(szImagePath); + TQImage pix(szImagePath); if(!pix.isNull()) { - QPixmap out; + TQPixmap out; if(pix.width() > 300 || pix.height() > 225) #ifdef COMPILE_USE_QT4 - out.convertFromImage(pix.scaled(300,225,Qt::KeepAspectRatio,Qt::SmoothTransformation)); + out.convertFromImage(pix.scaled(300,225,TQt::KeepAspectRatio,TQt::SmoothTransformation)); #else - out.convertFromImage(pix.smoothScale(300,225,QImage::ScaleMin)); + out.convertFromImage(pix.smoothScale(300,225,TQ_ScaleMin)); #endif else out.convertFromImage(pix); @@ -344,11 +344,11 @@ void KviPackThemeDialog::imageSelectionChanged(const QString &szImagePath) return; } - QMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected image","theme"), - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected image","theme"), + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); m_pImageSelector->setSelection(""); - m_pImageLabel->setPixmap(QPixmap()); + m_pImageLabel->setPixmap(TQPixmap()); } @@ -364,28 +364,28 @@ bool KviPackThemeDialog::packTheme() m_pImageSelector->commit(); m_pPathSelector->commit(); - QString szPackageAuthor = m_pPackagerNameEdit->text(); - QString szPackageName = m_pPackageNameEdit->text(); - QString szPackageDescription = m_pPackageDescriptionEdit->text(); - QString szPackageVersion = m_pPackageVersionEdit->text(); + TQString szPackageAuthor = m_pPackagerNameEdit->text(); + TQString szPackageName = m_pPackageNameEdit->text(); + TQString szPackageDescription = m_pPackageDescriptionEdit->text(); + TQString szPackageVersion = m_pPackageVersionEdit->text(); - QImage pix(m_szImagePath); - QPixmap out; + TQImage pix(m_szImagePath); + TQPixmap out; if(!pix.isNull()) { if(pix.width() > 300 || pix.height() > 225) #ifdef COMPILE_USE_QT4 - out.convertFromImage(pix.scaled(300,225,Qt::KeepAspectRatio)); + out.convertFromImage(pix.scaled(300,225,TQt::KeepAspectRatio)); #else - out.convertFromImage(pix.smoothScale(300,225,QImage::ScaleMin)); + out.convertFromImage(pix.smoothScale(300,225,TQ_ScaleMin)); #endif else out.convertFromImage(pix); } else { if(!m_szImagePath.isEmpty()) { - QMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected image: please fix it","theme"), - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected image: please fix it","theme"), + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); setCurrentPage(m_pImageSelectionPage); return false; } @@ -393,7 +393,7 @@ bool KviPackThemeDialog::packTheme() KviPackageWriter f; - QString szTmp = QDateTime::currentDateTime().toString(); + TQString szTmp = TQDateTime::tqcurrentDateTime().toString(); f.addInfoField("PackageType","ThemePack"); f.addInfoField("ThemePackVersion","1"); @@ -406,11 +406,11 @@ bool KviPackThemeDialog::packTheme() if(!out.isNull()) { - QByteArray * pba = new QByteArray(); + TQByteArray * pba = new TQByteArray(); #ifdef COMPILE_USE_QT4 - QBuffer buffer(pba,0); + TQBuffer buffer(pba,0); #else - QBuffer buffer(*pba); + TQBuffer buffer(*pba); #endif buffer.open(IO_WriteOnly); out.save(&buffer,"PNG"); @@ -424,31 +424,31 @@ bool KviPackThemeDialog::packTheme() int iIdx = 0; for(KviThemeInfo * pInfo = m_pThemeInfoList->first();pInfo;pInfo = m_pThemeInfoList->next()) { - KviQString::sprintf(szTmp,"Theme%dName",iIdx); + KviTQString::sprintf(szTmp,"Theme%dName",iIdx); f.addInfoField(szTmp,pInfo->name()); - KviQString::sprintf(szTmp,"Theme%dVersion",iIdx); + KviTQString::sprintf(szTmp,"Theme%dVersion",iIdx); f.addInfoField(szTmp,pInfo->version()); - KviQString::sprintf(szTmp,"Theme%dDescription",iIdx); + KviTQString::sprintf(szTmp,"Theme%dDescription",iIdx); f.addInfoField(szTmp,pInfo->description()); - KviQString::sprintf(szTmp,"Theme%dDate",iIdx); + KviTQString::sprintf(szTmp,"Theme%dDate",iIdx); f.addInfoField(szTmp,pInfo->date()); - KviQString::sprintf(szTmp,"Theme%dSubdirectory",iIdx); + KviTQString::sprintf(szTmp,"Theme%dSubdirectory",iIdx); f.addInfoField(szTmp,pInfo->subdirectory()); - KviQString::sprintf(szTmp,"Theme%dAuthor",iIdx); + KviTQString::sprintf(szTmp,"Theme%dAuthor",iIdx); f.addInfoField(szTmp,pInfo->author()); - KviQString::sprintf(szTmp,"Theme%dApplication",iIdx); + KviTQString::sprintf(szTmp,"Theme%dApplication",iIdx); f.addInfoField(szTmp,pInfo->application()); - KviQString::sprintf(szTmp,"Theme%dThemeEngineVersion",iIdx); + KviTQString::sprintf(szTmp,"Theme%dThemeEngineVersion",iIdx); f.addInfoField(szTmp,pInfo->themeEngineVersion()); - QPixmap pixScreenshot = pInfo->smallScreenshot(); + TQPixmap pixScreenshot = pInfo->smallScreenshot(); if(!pixScreenshot.isNull()) { - KviQString::sprintf(szTmp,"Theme%dScreenshot",iIdx); - QByteArray * pba = new QByteArray(); + KviTQString::sprintf(szTmp,"Theme%dScreenshot",iIdx); + TQByteArray * pba = new TQByteArray(); #ifdef COMPILE_USE_QT4 - QBuffer bufferz(pba,0); + TQBuffer bufferz(pba,0); #else - QBuffer bufferz(*pba); + TQBuffer bufferz(*pba); #endif bufferz.open(IO_WriteOnly); pixScreenshot.save(&bufferz,"PNG"); @@ -461,8 +461,8 @@ bool KviPackThemeDialog::packTheme() szTmp = __tr2qs_ctx("Packaging failed","theme"); szTmp += ": "; szTmp += f.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),szTmp, - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),szTmp, + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); } iIdx++; @@ -473,16 +473,16 @@ bool KviPackThemeDialog::packTheme() szTmp = __tr2qs_ctx("Packaging failed","theme"); szTmp += ": "; szTmp += f.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),szTmp, - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),szTmp, + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); return false; } //KviPackageReader r; //r.unpack("/root/test.kvt","/root/unpacked_test_kvt"); - QMessageBox::information(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),__tr2qs("Package saved succesfully"), - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::information(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),__tr2qs("Package saved succesfully"), + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); return true; } |