QTfrontend/hats.cpp
changeset 2874 3c7c2bf1ba38
parent 2377 f3fab2b09e0c
child 2948 3f21a9dc93d0
--- a/QTfrontend/hats.cpp	Fri Feb 26 16:29:00 2010 +0000
+++ b/QTfrontend/hats.cpp	Fri Feb 26 19:52:22 2010 +0000
@@ -20,6 +20,7 @@
 #include <QPixmap>
 #include <QPainter>
 #include "hwconsts.h"
+#include "hwform.h"
 #include "hats.h"
 
 HatsModel::HatsModel(QObject* parent) :
@@ -51,6 +52,24 @@
 
 		hats.append(qMakePair(str, QIcon(tmppix)));
 	}
+    // Reserved hats
+    tmpdir.cd("Reserved");
+	hatsList = tmpdir.entryList(QStringList(playerHash+"*.png"));
+	for (QStringList::Iterator it = hatsList.begin(); it != hatsList.end(); ++it )
+	{
+		QString str = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
+		QPixmap pix(datadir->absolutePath() + "/Graphics/Hats/Reserved/" + str + ".png");
+
+		QPixmap tmppix(32, 37);
+		tmppix.fill(QColor(Qt::transparent));
+
+		QPainter painter(&tmppix);
+		painter.drawPixmap(QPoint(0, 5), hhpix);
+		painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32));
+		painter.end();
+
+		hats.append(qMakePair("Reserved "+str.remove(0,32), QIcon(tmppix)));
+	}
 }
 
 QVariant HatsModel::headerData(int section,