From 2f5fc762ecde1b4c97006aa4343ccf447297cbfc Mon Sep 17 00:00:00 2001 From: Noldor Date: Wed, 28 Feb 2007 16:27:12 +0000 Subject: more qt4 port git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@387 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/theme/managementdialog.cpp | 7 +++++-- src/modules/theme/managementdialog.h | 11 +++++++++-- src/modules/theme/packthemedialog.cpp | 21 +++++++++++++++++++++ src/modules/theme/savethemedialog.cpp | 9 +++++++++ src/modules/theme/themefunctions.cpp | 15 ++++++++++----- 5 files changed, 54 insertions(+), 9 deletions(-) (limited to 'src/modules/theme') diff --git a/src/modules/theme/managementdialog.cpp b/src/modules/theme/managementdialog.cpp index 4b0150731..e72ede3d6 100644 --- a/src/modules/theme/managementdialog.cpp +++ b/src/modules/theme/managementdialog.cpp @@ -54,7 +54,10 @@ #include #include #include -#include +//#include +#ifdef COMPILE_USE_QT4 +#include +#endif #include #include "kvi_options.h" @@ -105,7 +108,7 @@ KviThemeListBoxItem::KviThemeListBoxItem(KviTalListBox * box,KviThemeInfo * inf) t += "
"; t += inf->description(); t += ""; - m_pText = new QSimpleRichText(t,box->font()); + m_pText = new KviTalSimpleRichText(t,box->font()); int iWidth = box->visibleWidth(); if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; iWidth -= LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER; diff --git a/src/modules/theme/managementdialog.h b/src/modules/theme/managementdialog.h index 7f363618e..c01096af0 100644 --- a/src/modules/theme/managementdialog.h +++ b/src/modules/theme/managementdialog.h @@ -29,7 +29,13 @@ #include "kvi_theme.h" #include +#ifdef COMPILE_USE_QT4 +#include +#define KviTalSimpleRichText Q3SimpleRichText +#else #include +#define KviTalSimpleRichText QSimpleRichText +#endif #include "kvi_tal_listbox.h" #include #include "kvi_tal_popupmenu.h" @@ -42,7 +48,8 @@ class KviTalTextEdit; class QPushButton; class QLabel; class QCheckBox; -class QMultiLineEdit; + +//class QMultiLineEdit; class KviDynamicToolTip; class KviStyledToolButton; @@ -55,7 +62,7 @@ public: virtual ~KviThemeListBoxItem(); public: KviThemeInfo * m_pThemeInfo; - QSimpleRichText * m_pText; + KviTalSimpleRichText * m_pText; public: KviThemeInfo * themeInfo(){ return m_pThemeInfo; }; virtual int height ( const KviTalListBox * lb ) const ; diff --git a/src/modules/theme/packthemedialog.cpp b/src/modules/theme/packthemedialog.cpp index 43f80fa89..a9401f5c2 100644 --- a/src/modules/theme/packthemedialog.cpp +++ b/src/modules/theme/packthemedialog.cpp @@ -36,7 +36,12 @@ #include #include #include +#ifdef COMPILE_USE_QT4 +#include +#include +#else #include +#endif #include #include #include @@ -328,7 +333,11 @@ void KviPackThemeDialog::imageSelectionChanged(const QString &szImagePath) { QPixmap out; if(pix.width() > 300 || pix.height() > 225) +#ifdef COMPILE_USE_QT4 + out.convertFromImage(pix.scaled(300,225,Qt::KeepAspectRatio,Qt::SmoothTransformation)); +#else out.convertFromImage(pix.smoothScale(300,225,QImage::ScaleMin)); +#endif else out.convertFromImage(pix); m_pImageLabel->setPixmap(out); @@ -365,7 +374,11 @@ bool KviPackThemeDialog::packTheme() if(!pix.isNull()) { if(pix.width() > 300 || pix.height() > 225) + #ifdef COMPILE_USE_QT4 + out.convertFromImage(pix.scaled(300,225,Qt::KeepAspectRatio)); + #else out.convertFromImage(pix.smoothScale(300,225,QImage::ScaleMin)); +#endif else out.convertFromImage(pix); } else { @@ -394,7 +407,11 @@ bool KviPackThemeDialog::packTheme() if(!out.isNull()) { QByteArray * pba = new QByteArray(); +#ifdef COMPILE_USE_QT4 + QBuffer buffer(pba,0); +#else QBuffer buffer(*pba); +#endif buffer.open(IO_WriteOnly); out.save(&buffer,"PNG"); buffer.close(); @@ -428,7 +445,11 @@ bool KviPackThemeDialog::packTheme() { KviQString::sprintf(szTmp,"Theme%dScreenshot",iIdx); QByteArray * pba = new QByteArray(); +#ifdef COMPILE_USE_QT4 + QBuffer bufferz(pba,0); +#else QBuffer bufferz(*pba); +#endif bufferz.open(IO_WriteOnly); pixScreenshot.save(&bufferz,"PNG"); bufferz.close(); diff --git a/src/modules/theme/savethemedialog.cpp b/src/modules/theme/savethemedialog.cpp index b40620c54..62ca0116e 100644 --- a/src/modules/theme/savethemedialog.cpp +++ b/src/modules/theme/savethemedialog.cpp @@ -36,7 +36,12 @@ #include #include #include +#ifdef COMPILE_USE_QT4 +#include +#include +#else #include +#endif #include #include @@ -187,7 +192,11 @@ void KviSaveThemeDialog::imageSelectionChanged(const QString &szImagePath) { QPixmap out; if(pix.width() > 300 || pix.height() > 225) + #ifdef COMPILE_USE_QT4 + out.convertFromImage(pix.scaled(300,225,Qt::KeepAspectRatio)); + #else out.convertFromImage(pix.smoothScale(300,225,QImage::ScaleMin)); +#endif else out.convertFromImage(pix); m_pImageLabel->setPixmap(out); diff --git a/src/modules/theme/themefunctions.cpp b/src/modules/theme/themefunctions.cpp index 776eb23a9..fb508c7a4 100644 --- a/src/modules/theme/themefunctions.cpp +++ b/src/modules/theme/themefunctions.cpp @@ -34,7 +34,12 @@ #include "kvi_sourcesdate.h" #include "kvi_theme.h" #include "kvi_frame.h" - +#ifdef COMPILE_USE_QT4 +#define KviTalMimeSourceFactory Q3MimeSourceFactory +#include +#else +#define KviTalMimeSourceFactory QMimeSourceFactory +#endif #include namespace KviThemeFunctions @@ -257,9 +262,9 @@ namespace KviThemeFunctions - QMimeSourceFactory::defaultFactory()->setPixmap("theme_dialog_pack_image",pix); - QMimeSourceFactory::defaultFactory()->setText("theme_dialog_details",szDetails); - QMimeSourceFactory::defaultFactory()->setText("theme_dialog_main",hd.szHtmlText); + KviTalMimeSourceFactory::defaultFactory()->setPixmap("theme_dialog_pack_image",pix); + KviTalMimeSourceFactory::defaultFactory()->setText("theme_dialog_details",szDetails); + KviTalMimeSourceFactory::defaultFactory()->setText("theme_dialog_main",hd.szHtmlText); QString beginCenter = "
"; QString endCenter = "
"; @@ -320,7 +325,7 @@ namespace KviThemeFunctions KviQString::sprintf(szScreenshot,"

",iUniqueIndexInDocument); QString szTmp; KviQString::sprintf(szTmp,"theme_shot%d",iUniqueIndexInDocument); - QMimeSourceFactory::defaultFactory()->setPixmap(szTmp,pixScreenshot); + KviTalMimeSourceFactory::defaultFactory()->setPixmap(szTmp,pixScreenshot); } else { szScreenshot = ""; } -- cgit v1.3.1-10-gc9f91