summaryrefslogtreecommitdiffstats
path: root/kmahjongg/Preview.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /kmahjongg/Preview.h
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmahjongg/Preview.h')
-rw-r--r--kmahjongg/Preview.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/kmahjongg/Preview.h b/kmahjongg/Preview.h
new file mode 100644
index 00000000..4f58e2cd
--- /dev/null
+++ b/kmahjongg/Preview.h
@@ -0,0 +1,104 @@
+#ifndef _PreviewLoadBase_H
+#define _PreviewLoadBase_H
+
+#include <kdialogbase.h>
+
+#include <qframe.h>
+
+#include "Tileset.h"
+#include "BoardLayout.h"
+#include "Background.h"
+
+class QComboBox;
+class QPixmap;
+
+class FrameImage: public QFrame
+{
+ Q_OBJECT
+public:
+ FrameImage(QWidget *parent=NULL, const char *name = NULL);
+ ~FrameImage();
+ void setGeometry(int x, int y, int w, int h);
+ QPixmap *getPreviewPixmap() {return thePixmap;}
+ void setRect(int x, int y, int w, int h, int ss, int type);
+signals:
+ void mousePressed(QMouseEvent *e);
+ void mouseMoved(QMouseEvent *e);
+protected:
+ void mousePressEvent(QMouseEvent *e);
+ void mouseMoveEvent(QMouseEvent *e);
+ void paintEvent( QPaintEvent* pa );
+private:
+ QPixmap *thePixmap;
+ int rx;
+ int ry;
+ int rw;
+ int rh;
+ int rs;
+ int rt;
+};
+
+
+
+class Preview: public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ enum PreviewType {background, tileset, board, theme};
+
+ Preview(QWidget* parent);
+ ~Preview();
+
+ void initialise(const PreviewType type);
+ void saveTheme();
+
+protected:
+ void markUnchanged();
+ void markChanged();
+ bool isChanged();
+ QPixmap *getPreviewPixmap() {return m_drawFrame->getPreviewPixmap(); }
+ virtual void drawPreview();
+ void applyChange() ;
+ void renderBackground(const QString &bg);
+ void renderTiles(const QString &file, const QString &layout);
+ void paintEvent( QPaintEvent* pa );
+
+signals:
+ void boardRedraw(bool);
+ void loadTileset(const QString &);
+ void loadBackground(const QString &, bool);
+ void loadBoard(const QString &);
+ void layoutChange();
+
+public slots:
+ void selectionChanged(int which);
+
+protected slots:
+ void slotApply();
+ void slotOk();
+
+private slots:
+ void load();
+
+protected:
+ FrameImage *m_drawFrame;
+ QComboBox *m_combo;
+
+ QString m_selectedFile;
+ Tileset m_tiles;
+ BoardLayout m_boardLayout;
+ Background m_back;
+
+private:
+ QString m_fileSelector;
+ bool m_changed;
+ QStringList m_fileList;
+ PreviewType m_previewType;
+
+ QString m_themeBack;
+ QString m_themeLayout;
+ QString m_themeTileset;
+};
+
+#endif