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/savethemedialog.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/savethemedialog.cpp')
-rw-r--r-- | src/modules/theme/savethemedialog.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/src/modules/theme/savethemedialog.cpp b/src/modules/theme/savethemedialog.cpp index 79319e60..fb7cee03 100644 --- a/src/modules/theme/savethemedialog.cpp +++ b/src/modules/theme/savethemedialog.cpp @@ -25,25 +25,25 @@ #include "savethemedialog.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 <tqbuffer.h> +#include <tqlabel.h> #include "kvi_options.h" @@ -64,18 +64,18 @@ -KviSaveThemeDialog::KviSaveThemeDialog(QWidget * pParent) +KviSaveThemeDialog::KviSaveThemeDialog(TQWidget * pParent) : KviTalWizard(pParent) { setCaption(__tr2qs_ctx("Save Current Theme - KVIrc","theme")); 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 save the current theme settings to a single directory. It is useful if you want to apply other themes or play with the theme settings and later come back to this theme with a single click. It will also allow you to manually modify the theme settings and later export them to a distributable package.","theme"); szText += "</p><p>"; szText += __tr2qs_ctx("You will be asked to provide a theme name, a description and, if you want, a screenshot.","theme"); @@ -95,31 +95,31 @@ KviSaveThemeDialog::KviSaveThemeDialog(QWidget * pParent) // 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 author) and a short description of the theme 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("Theme Name:","theme")); pLayout->addWidget(pLabel,1,0); - m_pThemeNameEdit = new QLineEdit(pPage); + m_pThemeNameEdit = new TQLineEdit(pPage); //m_pThemeNameEdit->setText(szThemeName); pLayout->addWidget(m_pThemeNameEdit,1,1); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Version:","theme")); pLayout->addWidget(pLabel,2,0); - m_pThemeVersionEdit = new QLineEdit(pPage); + m_pThemeVersionEdit = new TQLineEdit(pPage); //m_pThemeVersionEdit->setText(szThemeVersion); pLayout->addWidget(m_pThemeVersionEdit,2,1); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Description:","theme")); pLayout->addWidget(pLabel,3,0); @@ -127,11 +127,11 @@ KviSaveThemeDialog::KviSaveThemeDialog(QWidget * pParent) //m_pThemeDescriptionEdit->setText(szThemeDescription); pLayout->addWidget(m_pThemeDescriptionEdit,3,1); - pLabel = new QLabel(pPage); + pLabel = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Theme Author:","theme")); pLayout->addWidget(pLabel,4,0); - m_pAuthorNameEdit = new QLineEdit(pPage); + m_pAuthorNameEdit = new TQLineEdit(pPage); //m_pAuthorNameEdit->setText(szThemeAuthor); pLayout->addWidget(m_pAuthorNameEdit,4,1); @@ -147,28 +147,28 @@ KviSaveThemeDialog::KviSaveThemeDialog(QWidget * pParent) // screenshot/logo/icon ================================================================================ - 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 = new TQLabel(pPage); pLabel->setText(__tr2qs_ctx("Here you can either choose a screenshot image from disk or make one now. The screenshot will be displayed in the tooltips of the theme management dialog and will be also visible in the package installation dialog if you will export the theme to a distributable package.","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_szScreenshotPath,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); - QPushButton * pButton = new QPushButton(pPage); + TQPushButton * pButton = new TQPushButton(pPage); pButton->setText(__tr2qs_ctx("Make Screenshot Now","theme")); - connect(pButton,SIGNAL(clicked()),this,SLOT(makeScreenshot())); + connect(pButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(makeScreenshot())); pLayout->addWidget(pButton,3,0); pLayout->setRowStretch(1,1); @@ -185,17 +185,17 @@ KviSaveThemeDialog::~KviSaveThemeDialog() { } -void KviSaveThemeDialog::imageSelectionChanged(const QString &szImagePath) +void KviSaveThemeDialog::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)); + 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); @@ -203,11 +203,11 @@ void KviSaveThemeDialog::imageSelectionChanged(const QString &szImagePath) return; } - QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected image","theme"), - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Save Current 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()); } @@ -220,12 +220,12 @@ void KviSaveThemeDialog::accept() void KviSaveThemeDialog::makeScreenshot() { - QString szFileName; + TQString szFileName; g_pApp->getTmpFileName(szFileName,"screenshot.png"); if(!KviThemeFunctions::makeKVIrcScreenshot(szFileName)) { - QMessageBox::critical(this,__tr2qs_ctx("Acquire Screenshot - KVIrc","theme"),__tr2qs_ctx("Failed to make screenshot","theme"), - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Acquire Screenshot - KVIrc","theme"),__tr2qs_ctx("Failed to make screenshot","theme"), + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); return; } m_pImageSelector->setSelection(szFileName); @@ -240,29 +240,29 @@ bool KviSaveThemeDialog::saveTheme() sto.setName(m_pThemeNameEdit->text()); if(sto.name().isEmpty()) { - QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("You must choose a theme name!","theme"),QMessageBox::Ok, - QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("You must choose a theme name!","theme"),TQMessageBox::Ok, + TQMessageBox::NoButton,TQMessageBox::NoButton); return false; } sto.setAuthor(m_pAuthorNameEdit->text()); sto.setDescription(m_pThemeDescriptionEdit->text()); - sto.setDate(QDateTime::currentDateTime().toString()); + sto.setDate(TQDateTime::tqcurrentDateTime().toString()); sto.setVersion(m_pThemeVersionEdit->text()); sto.setApplication("KVIrc " KVI_VERSION "." KVI_SOURCES_DATE); if(sto.version().isEmpty())sto.setVersion("1.0.0"); - QString szSubdir = sto.name() + QString("-") + sto.version(); - szSubdir.replace(QRegExp("[ \\\\/:][ \\\\/:]*"),"_"); + TQString szSubdir = sto.name() + TQString("-") + sto.version(); + szSubdir.tqreplace(TQRegExp("[ \\\\/:][ \\\\/:]*"),"_"); sto.setSubdirectory(szSubdir); - QString szAbsDir; + TQString szAbsDir; g_pApp->getLocalKvircDirectory(szAbsDir,KviApp::Themes,sto.subdirectory(),true); if(!KviFileUtils::makeDir(szAbsDir)) { - QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("Unable to create theme directory.","theme"), - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("Unable to create theme directory.","theme"), + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); return false; } @@ -270,11 +270,11 @@ bool KviSaveThemeDialog::saveTheme() if(!KviTheme::save(sto)) { - QString szMsg2; - QString szErr = sto.lastError(); - KviQString::sprintf(szMsg2,__tr2qs_ctx("Unable to save theme: %Q","theme"),&szErr); - QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),szMsg2, - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQString szMsg2; + TQString szErr = sto.lastError(); + KviTQString::sprintf(szMsg2,__tr2qs_ctx("Unable to save theme: %Q","theme"),&szErr); + TQMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),szMsg2, + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); return false; } // write down the screenshot, if needed @@ -283,18 +283,18 @@ bool KviSaveThemeDialog::saveTheme() { if(!KviTheme::saveScreenshots(sto,m_szScreenshotPath)) { - QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected screenshot image: please fix it","theme"), - QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected screenshot image: please fix it","theme"), + TQMessageBox::Ok,TQMessageBox::NoButton,TQMessageBox::NoButton); setCurrentPage(m_pImageSelectionPage); return false; } } - QString szMsg = __tr2qs_ctx("Theme saved successfully to ","theme"); + TQString szMsg = __tr2qs_ctx("Theme saved successfully to ","theme"); szMsg += sto.absoluteDirectory(); - QMessageBox::information(this,__tr2qs_ctx("Save Theme - KVIrc","theme"),szMsg,QMessageBox::Ok, - QMessageBox::NoButton,QMessageBox::NoButton); + TQMessageBox::information(this,__tr2qs_ctx("Save Theme - KVIrc","theme"),szMsg,TQMessageBox::Ok, + TQMessageBox::NoButton,TQMessageBox::NoButton); return true; } |