aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/theme
diff options
context:
space:
mode:
authorGravatar Noldor2007-02-28 16:27:12 +0000
committerGravatar Noldor2007-02-28 16:27:12 +0000
commit2f5fc762ecde1b4c97006aa4343ccf447297cbfc (patch)
tree7288b13b904a6eea4d5ccaeab5dd9df33dca99f6 /src/modules/theme
parentsmall fix (diff)
downloadKVIrc-2f5fc762ecde1b4c97006aa4343ccf447297cbfc.tar.gz
KVIrc-2f5fc762ecde1b4c97006aa4343ccf447297cbfc.tar.bz2
KVIrc-2f5fc762ecde1b4c97006aa4343ccf447297cbfc.zip
more qt4 port
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@387 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/theme')
-rw-r--r--src/modules/theme/managementdialog.cpp7
-rw-r--r--src/modules/theme/managementdialog.h11
-rw-r--r--src/modules/theme/packthemedialog.cpp21
-rw-r--r--src/modules/theme/savethemedialog.cpp9
-rw-r--r--src/modules/theme/themefunctions.cpp15
5 files changed, 54 insertions, 9 deletions
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 <qtooltip.h>
#include <qimage.h>
#include <kvi_tal_textedit.h>
-#include <qmultilineedit.h>
+//#include <qmultilineedit.h>
+#ifdef COMPILE_USE_QT4
+#include <QCloseEvent>
+#endif
#include <qbuffer.h>
#include "kvi_options.h"
@@ -105,7 +108,7 @@ KviThemeListBoxItem::KviThemeListBoxItem(KviTalListBox * box,KviThemeInfo * inf)
t += "<br><nobr><font size=\"-1\">";
t += inf->description();
t += "</font></nobr>";
- 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 <qdialog.h>
+#ifdef COMPILE_USE_QT4
+#include <Q3SimpleRichText>
+#define KviTalSimpleRichText Q3SimpleRichText
+#else
#include <qsimplerichtext.h>
+#define KviTalSimpleRichText QSimpleRichText
+#endif
#include "kvi_tal_listbox.h"
#include <qcombobox.h>
#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 <qtooltip.h>
#include <qimage.h>
#include <kvi_tal_textedit.h>
+#ifdef COMPILE_USE_QT4
+#include <Q3MultiLineEdit>
+#include <QDateTime>
+#else
#include <qmultilineedit.h>
+#endif
#include <qbuffer.h>
#include <qlabel.h>
#include <qregexp.h>
@@ -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 <qtooltip.h>
#include <qimage.h>
#include <kvi_tal_textedit.h>
+#ifdef COMPILE_USE_QT4
+#include <Q3MultiLineEdit>
+#include <QDateTime>
+#else
#include <qmultilineedit.h>
+#endif
#include <qbuffer.h>
#include <qlabel.h>
@@ -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 <Q3MimeSourceFactory>
+#else
+#define KviTalMimeSourceFactory QMimeSourceFactory
+#endif
#include <qmime.h>
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 = "<center>";
QString endCenter = "</center>";
@@ -320,7 +325,7 @@ namespace KviThemeFunctions
KviQString::sprintf(szScreenshot,"<p><center><img src=\"theme_shot%d\"></center></p>",iUniqueIndexInDocument);
QString szTmp;
KviQString::sprintf(szTmp,"theme_shot%d",iUniqueIndexInDocument);
- QMimeSourceFactory::defaultFactory()->setPixmap(szTmp,pixScreenshot);
+ KviTalMimeSourceFactory::defaultFactory()->setPixmap(szTmp,pixScreenshot);
} else {
szScreenshot = "";
}