QTfrontend/model/MapModel.h
changeset 6983 ede55af89e78
parent 6952 7f70f37bbf08
child 8377 869f80966a77
--- a/QTfrontend/model/MapModel.h	Tue May 01 19:56:55 2012 +0200
+++ b/QTfrontend/model/MapModel.h	Tue May 01 21:24:04 2012 +0200
@@ -27,6 +27,7 @@
 #include <QStandardItemModel>
 #include <QStringList>
 #include <QTextStream>
+#include <QHash>
 #include <QMap>
 #include <QIcon>
 #include <QComboBox>
@@ -65,11 +66,11 @@
         };
 
         /**
-         * @brief Returns the number of available maps of a specified type.
-         * @param type map type to get the count of.
-         * @return count of maps that have the specified type.
+         * @brief Returns the row-index of the given map.
+         * @param map map of which to get the row-index of.
+         * @return row-index of map or -1 if not available.
          */
-        int mapCount(MapType type) const;
+        int indexOf(const QString & map) const;
 
         /**
          * @brief Returns the row-index of a random map with a specified type.
@@ -78,7 +79,6 @@
          */
         int randomMap(MapType type) const;
 
-
     public slots:
         /// Reloads the maps using the DataManager.
         void loadMaps();
@@ -86,7 +86,10 @@
 
     private:
         /// start-index and map count for each map-type.
-        QMap<MapType, QPair<int,int> > typeLoc;
+        QMap<MapType, QPair<int,int> > m_typeLoc;
+
+        /// map index lookup table
+        QHash<QString, int> m_mapIndexes;
 
         /**
          * @brief Creates a QStandardItem, that holds the map info and item appearance.