From f82d9bed8be9d4374dc219def31b6a516687db48 Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Tue, 16 Jan 2007 01:28:40 +0000 Subject: First step in the Qt 4.x port git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@174 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/theme/themefunctions.cpp | 79 ++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 16 deletions(-) (limited to 'src/modules/theme/themefunctions.cpp') diff --git a/src/modules/theme/themefunctions.cpp b/src/modules/theme/themefunctions.cpp index d6fef4dc6..86b786f0e 100644 --- a/src/modules/theme/themefunctions.cpp +++ b/src/modules/theme/themefunctions.cpp @@ -33,6 +33,7 @@ #include "kvi_miscutils.h" #include "kvi_sourcesdate.h" #include "kvi_theme.h" +#include "kvi_frame.h" #include @@ -156,6 +157,11 @@ namespace KviThemeFunctions r.getStringInfoField(szTmp,szThemeAuthor); KviQString::sprintf(szTmp,"Theme%dThemeEngineVersion",iIdx); r.getStringInfoField(szTmp,szThemeThemeEngineVersion); + KviQString::sprintf(szTmp,"Theme%dScreenshot",iIdx); + QPixmap pixScreenshot; + pByteArray = r.binaryInfoFields()->find(szTmp); + if(pByteArray) + pixScreenshot.loadFromData(*pByteArray,0,0); if(szThemeName.isEmpty() || szThemeVersion.isEmpty() || szThemeSubdirectory.isEmpty() || szThemeThemeEngineVersion.isEmpty()) bValid = false; @@ -173,9 +179,14 @@ namespace KviThemeFunctions szThemeApplication, szThemeAuthor, szThemeDate, - szThemeThemeEngineVersion + szThemeThemeEngineVersion, + pixScreenshot, + iIdx ); + if(iIdx > 0) + szDetails += "
"; + szDetails += szDetailsBuffer; if(!bValid) @@ -186,16 +197,12 @@ namespace KviThemeFunctions iValidThemeCount--; } - if(iIdx > 0) - szDetails += "
"; - iIdx++; } - szDetails += "

"; + szDetails += "

"; szDetails += __tr2qs_ctx("Go Back to Package Data","theme"); szDetails += "

"; - szDetails += ""; if(iValidThemeCount < iThemeCount) @@ -244,7 +251,8 @@ namespace KviThemeFunctions &szPackageDate, &szCreatedOn, &szPackageApplication, - &szWarnings + &szWarnings, + &szShowDetails ); @@ -295,7 +303,9 @@ namespace KviThemeFunctions const QString &szThemeApplication, const QString &szThemeAuthor, const QString &szThemeDate, - const QString &szThemeThemeEngineVersion + const QString &szThemeThemeEngineVersion, + const QPixmap &pixScreenshot, + int iUniqueIndexInDocument ) { QString szAuthor = __tr2qs_ctx("Author","theme"); @@ -304,27 +314,40 @@ namespace KviThemeFunctions QString szThemeEngineVersion = __tr2qs_ctx("Theme Engine Version","theme"); QString szSubdirectory = __tr2qs_ctx("Subdirectory","theme"); + QString szScreenshot; + if(!pixScreenshot.isNull()) + { + KviQString::sprintf(szScreenshot,"

",iUniqueIndexInDocument); + QString szTmp; + KviQString::sprintf(szTmp,"theme_shot%d",iUniqueIndexInDocument); + QMimeSourceFactory::defaultFactory()->setPixmap(szTmp,pixScreenshot); + } else { + szScreenshot = ""; + } + KviQString::sprintf( szBuffer, - "

" \ + "

" \ "

%Q %Q

" \ - "

" \ - "

" \ + "

" \ + "%Q" \ + "

" \ "%Q" \ - "

" \ - "

" \ + "

" \ + "

" \ "%Q: %Q
" \ "%Q: %Q
" \ - "

" \ - "

" \ + "

" \ + "

" \ "" \ "%Q: %Q
" \ "%Q: %Q
" \ "%Q: %Q
" \ "
" \ - "

", + "

", &szThemeName, &szThemeVersion, + &szScreenshot, &szThemeDescription, &szAuthor, &szThemeAuthor, @@ -339,6 +362,30 @@ namespace KviThemeFunctions ); } + bool makeKVIrcScreenshot(const QString &szSavePngFilePath,bool bMaximizeFrame) + { + if(bMaximizeFrame) + { + if(g_pFrame->isMaximized()) + bMaximizeFrame = false; + } + + if(bMaximizeFrame) + g_pFrame->showMaximized(); + + QPixmap pix = QPixmap::grabWidget(g_pFrame); + bool bResult = true; + + if(pix.isNull()) + bResult = false; + else { + if(!pix.save(szSavePngFilePath,"PNG",100)) + bResult = false; + } + if(bMaximizeFrame) + g_pFrame->showNormal(); + return bResult; + } }; -- cgit v1.3.1-10-gc9f91