QTfrontend/ui/widget/mapContainer.h
changeset 6157 9c474b8a8b5e
parent 5289 9d18b61bd3eb
child 6616 f77bb02b669f
equal deleted inserted replaced
6156:baf30b1a7a75 6157:9c474b8a8b5e
       
     1 /*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
       
     4  * Copyright (c) 2007-2011 Andrey Korotaev <unC0Rr@gmail.com>
       
     5  *
       
     6  * This program is free software; you can redistribute it and/or modify
       
     7  * it under the terms of the GNU General Public License as published by
       
     8  * the Free Software Foundation; version 2 of the License
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13  * GNU General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License
       
    16  * along with this program; if not, write to the Free Software
       
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    18  */
       
    19 
       
    20 #ifndef _HWMAP_CONTAINER_INCLUDED
       
    21 #define _HWMAP_CONTAINER_INCLUDED
       
    22 
       
    23 #include <QWidget>
       
    24 #include <QGridLayout>
       
    25 #include <QComboBox>
       
    26 #include <QLabel>
       
    27 #include <QByteArray>
       
    28 #include <QLineEdit>
       
    29 
       
    30 #include "hwmap.h"
       
    31 #include "drawmapscene.h"
       
    32 
       
    33 class QPushButton;
       
    34 class IconedGroupBox;
       
    35 class QListView;
       
    36 
       
    37 class MapFileErrorException
       
    38 {
       
    39 };
       
    40 
       
    41 class HWMapContainer : public QWidget
       
    42 {
       
    43   Q_OBJECT
       
    44 
       
    45  public:
       
    46   HWMapContainer(QWidget * parent=0);
       
    47   QString getCurrentSeed() const;
       
    48   QString getCurrentMap() const;
       
    49   QString getCurrentTheme() const;
       
    50   int     getCurrentHHLimit() const;
       
    51   QString getCurrentScheme() const;
       
    52   QString getCurrentWeapons() const;
       
    53   quint32 getTemplateFilter() const;
       
    54   MapGenerator get_mapgen(void) const;
       
    55   int getMazeSize(void) const;
       
    56   bool getCurrentIsMission() const;
       
    57   QByteArray getDrawnMapData();
       
    58   DrawMapScene * getDrawMapScene();
       
    59   void mapDrawingFinished();
       
    60   QLineEdit* seedEdit;
       
    61 
       
    62  public slots:
       
    63   void askForGeneratedPreview();
       
    64   void setSeed(const QString & seed);
       
    65   void setMap(const QString & map);
       
    66   void setTheme(const QString & theme);
       
    67   void setTemplateFilter(int);
       
    68   void setMapgen(MapGenerator m);
       
    69   void setMazeSize(int size);
       
    70   void setDrawnMapData(const QByteArray & ar);
       
    71   void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl);
       
    72 
       
    73  signals:
       
    74   void seedChanged(const QString & seed);
       
    75   void mapChanged(const QString & map);
       
    76   void themeChanged(const QString & theme);
       
    77   void newTemplateFilter(int filter);
       
    78   void mapgenChanged(MapGenerator m);
       
    79   void mazeSizeChanged(int s);
       
    80   void drawMapRequested();
       
    81   void drawnMapChanged(const QByteArray & data);
       
    82 
       
    83  private slots:
       
    84   void setImage(const QImage newImage);
       
    85   void setHHLimit(int hhLimit);
       
    86   void mapChanged(int index);
       
    87   void setRandomSeed();
       
    88   void setRandomTheme();
       
    89   void setRandomMap();
       
    90   void setRandomStatic();
       
    91   void setRandomMission();
       
    92   void themeSelected(const QModelIndex & current, const QModelIndex &);
       
    93   void addInfoToPreview(QPixmap image);
       
    94   void seedEdited();
       
    95 
       
    96  protected:
       
    97   virtual void resizeEvent ( QResizeEvent * event );
       
    98 
       
    99  private:
       
   100   QGridLayout mainLayout;
       
   101   QPushButton* imageButt;
       
   102   QComboBox* chooseMap;
       
   103   IconedGroupBox* gbThemes;
       
   104   QListView* lvThemes;
       
   105   HWMap* pMap;
       
   106   QString m_seed;
       
   107   QPushButton* seedSet;
       
   108   QLabel* seedLabel;
       
   109   int hhLimit;
       
   110   int templateFilter;
       
   111   QPixmap hhSmall;
       
   112   QLabel* lblFilter;
       
   113   QComboBox* cbTemplateFilter;
       
   114   QLabel *maze_size_label;
       
   115   QComboBox *cbMazeSize;
       
   116   MapGenerator mapgen;
       
   117   int numMissions;
       
   118   DrawMapScene drawMapScene;
       
   119 
       
   120   void intSetSeed(const QString & seed);
       
   121   void intSetMap(const QString & map);
       
   122   void intSetMapgen(MapGenerator m);
       
   123   void intSetTemplateFilter(int);
       
   124   void intSetMazeSize(int size);
       
   125   void updatePreview();
       
   126 };
       
   127 
       
   128 #endif // _HWMAP_CONTAINER_INCLUDED