summaryrefslogtreecommitdiffstats
path: root/knights/knightspixcache.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 01:24:36 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 01:24:36 +0000
commita8c9924456e5335c964e4e55b2dde1963c88726f (patch)
treef5bf107ba079ae460536da778ce2da5e6c68aa69 /knights/knightspixcache.h
downloadknights-a8c9924456e5335c964e4e55b2dde1963c88726f.tar.gz
knights-a8c9924456e5335c964e4e55b2dde1963c88726f.zip
Added KDE3 version of Knights
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knights@1091568 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knights/knightspixcache.h')
-rw-r--r--knights/knightspixcache.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/knights/knightspixcache.h b/knights/knightspixcache.h
new file mode 100644
index 0000000..75b9cc7
--- /dev/null
+++ b/knights/knightspixcache.h
@@ -0,0 +1,104 @@
+/***************************************************************************
+ knightspixcache.h - description
+ -------------------
+ begin : Mon Aug 20 2001
+ copyright : (C) 2003 by Troy Corbin Jr.
+ email : tcorbin@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNIGHTSPIXCACHE_H
+#define KNIGHTSPIXCACHE_H
+
+#include <qvaluelist.h>
+#include <qpixmap.h>
+#include <qimage.h>
+
+/**
+ *@author Troy Corbin Jr.
+ */
+
+typedef struct cacheItem
+{
+ QString label;
+ QPixmap item;
+ unsigned int bytes;
+ unsigned int age;
+};
+
+typedef QValueList<cacheItem> pixmapList;
+
+class KnightsPixCache
+{
+ public:
+ QPixmap SquareLight;
+ QPixmap SquareDark;
+ QPixmap HighlightSelect;
+ QPixmap HighlightMove;
+ QPixmap HighlightAttack;
+ QPixmap BlackKing;
+ QPixmap BlackQueen;
+ QPixmap BlackBishop;
+ QPixmap BlackKnight;
+ QPixmap BlackRook;
+ QPixmap BlackPawn;
+ QPixmap WhiteKing;
+ QPixmap WhiteQueen;
+ QPixmap WhiteBishop;
+ QPixmap WhiteKnight;
+ QPixmap WhiteRook;
+ QPixmap WhitePawn;
+ QPixmap Border;
+ QPixmap BorderLightOn;
+ QPixmap BorderLightOff;
+
+ QImage Orig_SquareLight;
+ QImage Orig_SquareDark;
+ QImage Orig_HighlightSelect;
+ QImage Orig_HighlightMove;
+ QImage Orig_HighlightAttack;
+ QImage Orig_BlackKing;
+ QImage Orig_BlackQueen;
+ QImage Orig_BlackBishop;
+ QImage Orig_BlackKnight;
+ QImage Orig_BlackRook;
+ QImage Orig_BlackPawn;
+ QImage Orig_WhiteKing;
+ QImage Orig_WhiteQueen;
+ QImage Orig_WhiteBishop;
+ QImage Orig_WhiteKnight;
+ QImage Orig_WhiteRook;
+ QImage Orig_WhitePawn;
+ QImage Orig_Border;
+ QImage Orig_BorderLightOn;
+ QImage Orig_BorderLightOff;
+
+ KnightsPixCache();
+ ~KnightsPixCache();
+ void clear( void );
+ void setCacheLimit( const unsigned int &limit );
+ unsigned int cacheLimit( void );
+ void add( const QString &label, const QPixmap &pixmap );
+ bool find( const QString &label, QPixmap &pixmap);
+ void resize( const int &size );
+
+ private:
+
+ pixmapList list;
+ pixmapList::Iterator IT;
+
+ unsigned int bytesUsed;
+ unsigned int bytesTotal;
+
+ void cleanCache( const unsigned int &space );
+};
+
+#endif