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/themefunctions.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/themefunctions.cpp')
-rw-r--r-- | src/modules/theme/themefunctions.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/src/modules/theme/themefunctions.cpp b/src/modules/theme/themefunctions.cpp index 0a011956..c215d943 100644 --- a/src/modules/theme/themefunctions.cpp +++ b/src/modules/theme/themefunctions.cpp @@ -36,28 +36,28 @@ #include "kvi_frame.h" #ifdef COMPILE_USE_QT4 #define KviTalMimeSourceFactory Q3MimeSourceFactory -#include <q3mimefactory.h> +#include <tq3mimefactory.h> #else -#define KviTalMimeSourceFactory QMimeSourceFactory +#define KviTalMimeSourceFactory TQMimeSourceFactory #endif -#include <qmime.h> +#include <tqmime.h> namespace KviThemeFunctions { - static bool notAValidThemePackage(QString &szError) + static bool notAValidThemePackage(TQString &szError) { - KviQString::sprintf(szError,__tr2qs_ctx("The selected file does not seem to be a valid KVIrc theme package","theme")); + KviTQString::sprintf(szError,__tr2qs_ctx("The selected file does not seem to be a valid KVIrc theme package","theme")); return false; } - bool installThemePackage(const QString &szThemePackageFileName,QString &szError,QWidget * pDialogParent) + bool installThemePackage(const TQString &szThemePackageFileName,TQString &szError,TQWidget * pDialogParent) { - KviPointerHashTable<QString,QString> * pInfoFields; - QString * pValue; + KviPointerHashTable<TQString,TQString> * pInfoFields; + TQString * pValue; bool bInstall; - QPixmap pix; - QByteArray * pByteArray; + TQPixmap pix; + TQByteArray * pByteArray; KviHtmlDialogData hd; const char * check_fields[] = { "Name", "Version", "Author", "Description", "Date", "Application" }; @@ -66,28 +66,28 @@ namespace KviThemeFunctions KviPackageReader r; if(!r.readHeader(szThemePackageFileName)) { - QString szErr = r.lastError(); - KviQString::sprintf(szError,__tr2qs_ctx("The selected file does not seem to be a valid KVIrc package: %Q","theme"),&szErr); + TQString szErr = r.lastError(); + KviTQString::sprintf(szError,__tr2qs_ctx("The selected file does not seem to be a valid KVIrc package: %Q","theme"),&szErr); return false; } pInfoFields = r.stringInfoFields(); - pValue = pInfoFields->find("PackageType"); + pValue = pInfoFields->tqfind("PackageType"); if(!pValue)return notAValidThemePackage(szError); - if(!KviQString::equalCI(*pValue,"ThemePack"))return notAValidThemePackage(szError); - pValue = pInfoFields->find("ThemePackVersion"); + if(!KviTQString::equalCI(*pValue,"ThemePack"))return notAValidThemePackage(szError); + pValue = pInfoFields->tqfind("ThemePackVersion"); if(!pValue)return notAValidThemePackage(szError); - if(!KviQString::equalCI(*pValue,"1"))return notAValidThemePackage(szError); + if(!KviTQString::equalCI(*pValue,"1"))return notAValidThemePackage(szError); // make sure the default fields exist for(int i=0;i<6;i++) { - pValue = pInfoFields->find(check_fields[i]); + pValue = pInfoFields->tqfind(check_fields[i]); if(!pValue)return notAValidThemePackage(szError); } - pValue = pInfoFields->find("ThemeCount"); + pValue = pInfoFields->tqfind("ThemeCount"); if(!pValue)return notAValidThemePackage(szError); bool bOk; int iThemeCount = pValue->toInt(&bOk); @@ -97,7 +97,7 @@ namespace KviThemeFunctions // ok.. it should be really valid at this point // load its picture - pByteArray = r.binaryInfoFields()->find("Image"); + pByteArray = r.binaryInfoFields()->tqfind("Image"); if(pByteArray) pix.loadFromData(*pByteArray,0,0); @@ -107,17 +107,17 @@ namespace KviThemeFunctions pix = *(g_pIconManager->getBigIcon(KVI_BIGICON_THEME)); } - QString szPackageName; - QString szPackageVersion; - QString szPackageAuthor; - QString szPackageDescription; - QString szPackageDate; - QString szPackageThemeEngineVersion; - QString szPackageApplication; + TQString szPackageName; + TQString szPackageVersion; + TQString szPackageAuthor; + TQString szPackageDescription; + TQString szPackageDate; + TQString szPackageThemeEngineVersion; + TQString szPackageApplication; - QString szAuthor = __tr2qs_ctx("Author","theme"); - QString szCreatedAt = __tr2qs_ctx("Created at","theme"); - QString szCreatedOn = __tr2qs_ctx("Created with","theme"); + TQString szAuthor = __tr2qs_ctx("Author","theme"); + TQString szCreatedAt = __tr2qs_ctx("Created at","theme"); + TQString szCreatedOn = __tr2qs_ctx("Created with","theme"); r.getStringInfoField("Name",szPackageName); r.getStringInfoField("Version",szPackageVersion); @@ -126,9 +126,9 @@ namespace KviThemeFunctions r.getStringInfoField("Application",szPackageApplication); r.getStringInfoField("Date",szPackageDate); - QString szWarnings; - QString szDetails = "<html><body bgcolor=\"#ffffff\">"; - QString szTmp; + TQString szWarnings; + TQString szDetails = "<html><body bgcolor=\"#ffffff\">"; + TQString szTmp; int iIdx = 0; int iValidThemeCount = iThemeCount; @@ -137,34 +137,34 @@ namespace KviThemeFunctions { bool bValid = true; - QString szThemeName; - QString szThemeVersion; - QString szThemeDescription; - QString szThemeDate; - QString szThemeSubdirectory; - QString szThemeAuthor; - QString szThemeThemeEngineVersion; - QString szThemeApplication; - - KviQString::sprintf(szTmp,"Theme%dName",iIdx); + TQString szThemeName; + TQString szThemeVersion; + TQString szThemeDescription; + TQString szThemeDate; + TQString szThemeSubdirectory; + TQString szThemeAuthor; + TQString szThemeThemeEngineVersion; + TQString szThemeApplication; + + KviTQString::sprintf(szTmp,"Theme%dName",iIdx); r.getStringInfoField(szTmp,szThemeName); - KviQString::sprintf(szTmp,"Theme%dVersion",iIdx); + KviTQString::sprintf(szTmp,"Theme%dVersion",iIdx); r.getStringInfoField(szTmp,szThemeVersion); - KviQString::sprintf(szTmp,"Theme%dApplication",iIdx); + KviTQString::sprintf(szTmp,"Theme%dApplication",iIdx); r.getStringInfoField(szTmp,szThemeApplication); - KviQString::sprintf(szTmp,"Theme%dDescription",iIdx); + KviTQString::sprintf(szTmp,"Theme%dDescription",iIdx); r.getStringInfoField(szTmp,szThemeDescription); - KviQString::sprintf(szTmp,"Theme%dDate",iIdx); + KviTQString::sprintf(szTmp,"Theme%dDate",iIdx); r.getStringInfoField(szTmp,szThemeDate); - KviQString::sprintf(szTmp,"Theme%dSubdirectory",iIdx); + KviTQString::sprintf(szTmp,"Theme%dSubdirectory",iIdx); r.getStringInfoField(szTmp,szThemeSubdirectory); - KviQString::sprintf(szTmp,"Theme%dAuthor",iIdx); + KviTQString::sprintf(szTmp,"Theme%dAuthor",iIdx); r.getStringInfoField(szTmp,szThemeAuthor); - KviQString::sprintf(szTmp,"Theme%dThemeEngineVersion",iIdx); + KviTQString::sprintf(szTmp,"Theme%dThemeEngineVersion",iIdx); r.getStringInfoField(szTmp,szThemeThemeEngineVersion); - KviQString::sprintf(szTmp,"Theme%dScreenshot",iIdx); - QPixmap pixScreenshot; - pByteArray = r.binaryInfoFields()->find(szTmp); + KviTQString::sprintf(szTmp,"Theme%dScreenshot",iIdx); + TQPixmap pixScreenshot; + pByteArray = r.binaryInfoFields()->tqfind(szTmp); if(pByteArray) pixScreenshot.loadFromData(*pByteArray,0,0); @@ -173,7 +173,7 @@ namespace KviThemeFunctions if(KviMiscUtils::compareVersions(szThemeThemeEngineVersion,KVI_CURRENT_THEME_ENGINE_VERSION) < 0) bValid = false; - QString szDetailsBuffer; + TQString szDetailsBuffer; getThemeHtmlDescription( szDetailsBuffer, @@ -217,9 +217,9 @@ namespace KviThemeFunctions szWarnings += "</b></font></center></p>"; } - QString szShowDetails = __tr2qs_ctx("Show Details","theme"); + TQString szShowDetails = __tr2qs_ctx("Show Details","theme"); - KviQString::sprintf(hd.szHtmlText, + KviTQString::sprintf(hd.szHtmlText, "<html bgcolor=\"#ffffff\">" \ "<body bgcolor=\"#ffffff\">" \ "<p><center>" \ @@ -266,8 +266,8 @@ namespace KviThemeFunctions KviTalMimeSourceFactory::defaultFactory()->setText("theme_dialog_details",szDetails); KviTalMimeSourceFactory::defaultFactory()->setText("theme_dialog_main",hd.szHtmlText); - QString beginCenter = "<center>"; - QString endCenter = "</center>"; + TQString beginCenter = "<center>"; + TQString endCenter = "</center>"; hd.szCaption = __tr2qs_ctx("Install Theme Pack - KVIrc","theme"); hd.szUpperLabelText = beginCenter + __tr2qs_ctx("You're about to install the following theme package","theme") + endCenter; @@ -285,12 +285,12 @@ namespace KviThemeFunctions if(bInstall) { - QString szUnpackPath; + TQString szUnpackPath; g_pApp->getLocalKvircDirectory(szUnpackPath,KviApp::Themes); if(!r.unpack(szThemePackageFileName,szUnpackPath)) { - QString szErr2 = r.lastError(); - KviQString::sprintf(szError,__tr2qs_ctx("Failed to unpack the selected file: %Q","theme"),&szErr2); + TQString szErr2 = r.lastError(); + KviTQString::sprintf(szError,__tr2qs_ctx("Failed to unpack the selected file: %Q","theme"),&szErr2); return true; } } @@ -300,37 +300,37 @@ namespace KviThemeFunctions void getThemeHtmlDescription( - QString &szBuffer, - const QString &szThemeName, - const QString &szThemeVersion, - const QString &szThemeDescription, - const QString &szThemeSubdirectory, - const QString &szThemeApplication, - const QString &szThemeAuthor, - const QString &szThemeDate, - const QString &szThemeThemeEngineVersion, - const QPixmap &pixScreenshot, + TQString &szBuffer, + const TQString &szThemeName, + const TQString &szThemeVersion, + const TQString &szThemeDescription, + const TQString &szThemeSubdirectory, + const TQString &szThemeApplication, + const TQString &szThemeAuthor, + const TQString &szThemeDate, + const TQString &szThemeThemeEngineVersion, + const TQPixmap &pixScreenshot, int iUniqueIndexInDocument ) { - QString szAuthor = __tr2qs_ctx("Author","theme"); - QString szCreatedAt = __tr2qs_ctx("Created at","theme"); - QString szCreatedOn = __tr2qs_ctx("Created with","theme"); - QString szThemeEngineVersion = __tr2qs_ctx("Theme Engine Version","theme"); - QString szSubdirectory = __tr2qs_ctx("Subdirectory","theme"); + TQString szAuthor = __tr2qs_ctx("Author","theme"); + TQString szCreatedAt = __tr2qs_ctx("Created at","theme"); + TQString szCreatedOn = __tr2qs_ctx("Created with","theme"); + TQString szThemeEngineVersion = __tr2qs_ctx("Theme Engine Version","theme"); + TQString szSubdirectory = __tr2qs_ctx("Subdirectory","theme"); - QString szScreenshot; + TQString szScreenshot; if(!pixScreenshot.isNull()) { - KviQString::sprintf(szScreenshot,"<p><center><img src=\"theme_shot%d\"></center></p>",iUniqueIndexInDocument); - QString szTmp; - KviQString::sprintf(szTmp,"theme_shot%d",iUniqueIndexInDocument); + KviTQString::sprintf(szScreenshot,"<p><center><img src=\"theme_shot%d\"></center></p>",iUniqueIndexInDocument); + TQString szTmp; + KviTQString::sprintf(szTmp,"theme_shot%d",iUniqueIndexInDocument); KviTalMimeSourceFactory::defaultFactory()->setPixmap(szTmp,pixScreenshot); } else { szScreenshot = ""; } - KviQString::sprintf( + KviTQString::sprintf( szBuffer, "<p><center>" \ "<h2>%Q %Q</h2>" \ @@ -367,7 +367,7 @@ namespace KviThemeFunctions ); } - bool makeKVIrcScreenshot(const QString &szSavePngFilePath,bool bMaximizeFrame) + bool makeKVIrcScreenshot(const TQString &szSavePngFilePath,bool bMaximizeFrame) { if(bMaximizeFrame) { @@ -378,7 +378,7 @@ namespace KviThemeFunctions if(bMaximizeFrame) g_pFrame->showMaximized(); - QPixmap pix = QPixmap::grabWidget(g_pFrame); + TQPixmap pix = TQPixmap::grabWidget(g_pFrame); bool bResult = true; if(pix.isNull()) |