QTfrontend/model/MapModel.h
changeset 6947 1be3e48e1d53
parent 6943 1fe601a2761b
child 6948 7271ce89950f
equal deleted inserted replaced
6946:576c453822bf 6947:1be3e48e1d53
    33 #include <QComboBox>
    33 #include <QComboBox>
    34 
    34 
    35 #include "DataManager.h"
    35 #include "DataManager.h"
    36 
    36 
    37 /**
    37 /**
    38  * @brief A model listing available themes
    38  * @brief A model that vertically lists available maps
    39  *
    39  *
    40  * @author sheepluva
    40  * @author sheepluva
    41  * @since 0.9.18
    41  * @since 0.9.18
    42  */
    42  */
    43 class MapModel : public QStandardItemModel
    43 class MapModel : public QStandardItemModel
    64             QString scheme; ///< Default scheme name or "locked", for mission-maps.
    64             QString scheme; ///< Default scheme name or "locked", for mission-maps.
    65             QString weapons; ///< Default weaponset name or "locked", for missions-maps.
    65             QString weapons; ///< Default weaponset name or "locked", for missions-maps.
    66         };
    66         };
    67 
    67 
    68         /**
    68         /**
    69          * @brief Returns the number of available mission maps.
    69          * @brief Returns the number of available maps of a specified type.
    70          * @return mission map count.
    70          * @param type map type to get the count of.
       
    71          * @return count of maps that have the specified type.
    71          */
    72          */
    72         int missionCount() const;
    73         int mapCount(MapType type) const;
       
    74 
       
    75         /**
       
    76          * @brief Returns the row-index of a random map with a specified type.
       
    77          * @param type desired type of map.
       
    78          * @return row-index of a map with the desired type, -1 if none found.
       
    79          */
       
    80         int randomMap(MapType type) const;
    73 
    81 
    74 
    82 
    75     public slots:
    83     public slots:
    76         /// reloads the maps using the DataManager
    84         /// reloads the maps using the DataManager
    77         void loadMaps();
    85         void loadMaps();
    78 
    86 
    79 
    87 
    80     private:
    88     private:
    81         int m_nMissions; ///< used to keep track of the mission amount
    89         ///< start-index and map count for each map-type
       
    90         QMap<MapType, QPair<int,int> > typeLoc;
    82 
    91 
    83         /**
    92         /**
    84          * @brief Creates a QStandardItem, that holds the map info and item appearance.
    93          * @brief Creates a QStandardItem, that holds the map info and item appearance.
    85          * The used role for the data is Qt::UserRole + 1.
    94          * The used role for the data is Qt::UserRole + 1.
    86          * @param icon the icon to be displayed (can be an empty QIcon()).
    95          * @param icon the icon to be displayed (can be an empty QIcon()).