QTfrontend/model/MapModel.h
branchqmlfrontend
changeset 11828 a69124eb7ce7
parent 11757 6874644a2d00
equal deleted inserted replaced
11827:8c71c5a1172f 11828:a69124eb7ce7
    23 
    23 
    24 #ifndef HEDGEWARS_MAPMODEL_H
    24 #ifndef HEDGEWARS_MAPMODEL_H
    25 #define HEDGEWARS_MAPMODEL_H
    25 #define HEDGEWARS_MAPMODEL_H
    26 
    26 
    27 #include <QStandardItemModel>
    27 #include <QStandardItemModel>
       
    28 #include <QSortFilterProxyModel>
    28 #include <QStringList>
    29 #include <QStringList>
    29 #include <QTextStream>
    30 #include <QTextStream>
    30 #include <QHash>
    31 #include <QHash>
    31 #include <QMap>
    32 #include <QMap>
    32 #include <QIcon>
    33 #include <QIcon>
    50             GeneratedMap,
    51             GeneratedMap,
    51             GeneratedMaze,
    52             GeneratedMaze,
    52             GeneratedPerlin,
    53             GeneratedPerlin,
    53             HandDrawnMap,
    54             HandDrawnMap,
    54             MissionMap,
    55             MissionMap,
    55             StaticMap
    56             StaticMap,
       
    57             FortsMap
    56         };
    58         };
    57 
    59 
    58         /// a struct for holding the attributes of a map.
    60         /// a struct for holding the attributes of a map.
    59         struct MapInfo
    61         struct MapInfo
    60         {
    62         {
    97          * @return QStandardItem of map, or NULL if map not found
    99          * @return QStandardItem of map, or NULL if map not found
    98          */
   100          */
    99         QStandardItem * getMap(const QString & map);
   101         QStandardItem * getMap(const QString & map);
   100 
   102 
   101         // Static MapInfos for drawn and generated maps
   103         // Static MapInfos for drawn and generated maps
   102         static MapInfo MapInfoRandom, MapInfoMaze, MapInfoPerlin, MapInfoDrawn;
   104         static MapInfo MapInfoRandom, MapInfoMaze, MapInfoPerlin, MapInfoDrawn, MapInfoForts;
   103 
   105 
   104         /// Loads the maps
   106         /// Loads the maps
   105         bool loadMaps();
   107         bool loadMaps();
   106 
   108 
       
   109         /// returns this model but excluding DLC themes
       
   110         QSortFilterProxyModel * withoutDLC();
   107 
   111 
   108     private:
   112     private:
   109         /// map index lookup table. QPair<int, int> contains: <column, index>
   113         /// map index lookup table. QPair<int, int> contains: <column, index>
   110         //QHash<QString, QPair<int, int> > m_mapIndexes;
   114         //QHash<QString, QPair<int, int> > m_mapIndexes;
   111         QHash<QString, int> m_mapIndexes;
   115         QHash<QString, int> m_mapIndexes;
   112         MapType m_maptype;
   116         MapType m_maptype;
   113         bool m_loaded;
   117         bool m_loaded;
       
   118         QSortFilterProxyModel * m_filteredNoDLC;
   114 
   119 
   115         /**
   120         /**
   116          * @brief Creates a QStandardItem, that holds the map info and item appearance.
   121          * @brief Creates a QStandardItem, that holds the map info and item appearance.
   117          * The used role for the data is Qt::UserRole + 1.
   122          * The used role for the data is Qt::UserRole + 1.
   118          * @param icon the icon to be displayed (can be an empty QIcon()).
   123          * @param icon the icon to be displayed (can be an empty QIcon()).