QTfrontend/mapContainer.h
author Henek
Mon, 13 Dec 2010 19:26:20 +0100
changeset 4519 aee36896d46b
parent 4513 1dd97c710f5a
child 4520 e7882bd1a894
permissions -rw-r--r--
exposing seed for editing and viewing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 486
diff changeset
     2
 * Hedgewars, a free turn based strategy game
486
7ea71cd3acd5 - Change proto version to 4
unc0rr
parents: 331
diff changeset
     3
 * Copyright (c) 2006, 2007 Igor Ulyanov <iulyanov@gmail.com>
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     4
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
     8
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
    12
 * GNU General Public License for more details.
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    13
 *
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
    15
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 169
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    17
 */
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    18
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    19
#ifndef _HWMAP_CONTAINER_INCLUDED
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    20
#define _HWMAP_CONTAINER_INCLUDED
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    21
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    22
#include <QWidget>
1209
7f6cb1d7be2a Start remaking multiplayer page
unc0rr
parents: 1066
diff changeset
    23
#include <QGridLayout>
249
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    24
#include <QComboBox>
1802
dd148e2506e2 Move template filter to map widget (by nemo)
unc0rr
parents: 1797
diff changeset
    25
#include <QLabel>
4489
c4ca9ced258b - Pass map drawing data to engine
unc0rr
parents: 4337
diff changeset
    26
#include <QByteArray>
4519
aee36896d46b exposing seed for editing and viewing
Henek
parents: 4513
diff changeset
    27
#include <QLineEdit>
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    28
1210
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
    29
#include "hwmap.h"
bfed1b89bc85 Add themes list to map selection widget
unc0rr
parents: 1209
diff changeset
    30
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    31
class QPushButton;
1209
7f6cb1d7be2a Start remaking multiplayer page
unc0rr
parents: 1066
diff changeset
    32
class IconedGroupBox;
7f6cb1d7be2a Start remaking multiplayer page
unc0rr
parents: 1066
diff changeset
    33
class QListWidget;
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    34
249
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    35
class MapFileErrorException
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    36
{
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    37
};
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    38
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    39
class HWMapContainer : public QWidget
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    40
{
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    41
  Q_OBJECT
320
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 249
diff changeset
    42
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    43
 public:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    44
  HWMapContainer(QWidget * parent=0);
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    45
  QString getCurrentSeed() const;
249
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    46
  QString getCurrentMap() const;
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    47
  QString getCurrentTheme() const;
1790
c84223511ca8 frontend's part of nemo patch
unc0rr
parents: 1366
diff changeset
    48
  int     getCurrentHHLimit() const;
4513
1dd97c710f5a added general scripts to multiplayer and added option for scripts to allow user set schemes or weapon sets.
Henek
parents: 4511
diff changeset
    49
  QString getCurrentScheme() const;
1dd97c710f5a added general scripts to multiplayer and added option for scripts to allow user set schemes or weapon sets.
Henek
parents: 4511
diff changeset
    50
  QString getCurrentWeapons() const;
1802
dd148e2506e2 Move template filter to map widget (by nemo)
unc0rr
parents: 1797
diff changeset
    51
  quint32 getTemplateFilter() const;
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
    52
  MapGenerator get_mapgen(void) const;
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
    53
  int get_maze_size(void) const;
3008
e57cafce4227 Frontend:
smxx
parents: 1802
diff changeset
    54
  bool getCurrentIsMission() const;
4489
c4ca9ced258b - Pass map drawing data to engine
unc0rr
parents: 4337
diff changeset
    55
  QByteArray getDrawnMapData();
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    56
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    57
 public slots:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    58
  void changeImage();
320
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 249
diff changeset
    59
  void setSeed(const QString & seed);
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 249
diff changeset
    60
  void setMap(const QString & map);
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 249
diff changeset
    61
  void setTheme(const QString & theme);
1797
fedd8649fdd9 Templates filter by nemo
unc0rr
parents: 1790
diff changeset
    62
  void setTemplateFilter(int);
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
    63
  void setMapgen(MapGenerator m);
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
    64
  void setMaze_size(int size);
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    65
325
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    66
 signals:
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    67
  void seedChanged(const QString & seed);
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    68
  void mapChanged(const QString & map);
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    69
  void themeChanged(const QString & theme);
1802
dd148e2506e2 Move template filter to map widget (by nemo)
unc0rr
parents: 1797
diff changeset
    70
  void newTemplateFilter(int filter);
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
    71
  void mapgenChanged(MapGenerator m);
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
    72
  void maze_sizeChanged(int s);
4511
df827e70ae63 Pretension to switch to draw map page
unc0rr
parents: 4489
diff changeset
    73
  void drawMapRequested();
325
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    74
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    75
 private slots:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    76
  void setImage(const QImage newImage);
1790
c84223511ca8 frontend's part of nemo patch
unc0rr
parents: 1366
diff changeset
    77
  void setHHLimit(int hhLimit);
249
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    78
  void mapChanged(int index);
320
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 249
diff changeset
    79
  void setRandomSeed();
1318
18da1c5e960d - Shut the client's tries to configure server up
unc0rr
parents: 1215
diff changeset
    80
  void setRandomTheme();
4337
85e02b1a8e8f merge 0.9.14.1 to trunk
nemo
parents: 4322
diff changeset
    81
  void setRandomMap();
85e02b1a8e8f merge 0.9.14.1 to trunk
nemo
parents: 4322
diff changeset
    82
  void setRandomStatic();
85e02b1a8e8f merge 0.9.14.1 to trunk
nemo
parents: 4322
diff changeset
    83
  void setRandomMission();
1215
0c1c294c0f7e Themes list now works
unc0rr
parents: 1210
diff changeset
    84
  void themeSelected(int currentRow);
1790
c84223511ca8 frontend's part of nemo patch
unc0rr
parents: 1366
diff changeset
    85
  void addInfoToPreview(QPixmap image);
1802
dd148e2506e2 Move template filter to map widget (by nemo)
unc0rr
parents: 1797
diff changeset
    86
  void templateFilterChanged(int filter);
4519
aee36896d46b exposing seed for editing and viewing
Henek
parents: 4513
diff changeset
    87
  void seedEdited(const QString & seed);
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    88
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    89
 protected:
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    90
  virtual void resizeEvent ( QResizeEvent * event );
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    91
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    92
 private:
1209
7f6cb1d7be2a Start remaking multiplayer page
unc0rr
parents: 1066
diff changeset
    93
  QGridLayout mainLayout;
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    94
  QPushButton* imageButt;
249
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    95
  QComboBox* chooseMap;
1209
7f6cb1d7be2a Start remaking multiplayer page
unc0rr
parents: 1066
diff changeset
    96
  IconedGroupBox* gbThemes;
7f6cb1d7be2a Start remaking multiplayer page
unc0rr
parents: 1066
diff changeset
    97
  QListWidget* lwThemes;
169
a78d4a552500 new more working, but still not completely working version :)
displacer
parents: 168
diff changeset
    98
  HWMap* pMap;
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
    99
  QString m_seed;
4519
aee36896d46b exposing seed for editing and viewing
Henek
parents: 4513
diff changeset
   100
  QLineEdit* seedEdit;
1790
c84223511ca8 frontend's part of nemo patch
unc0rr
parents: 1366
diff changeset
   101
  int hhLimit;
1797
fedd8649fdd9 Templates filter by nemo
unc0rr
parents: 1790
diff changeset
   102
  int templateFilter;
1790
c84223511ca8 frontend's part of nemo patch
unc0rr
parents: 1366
diff changeset
   103
  QPixmap hhSmall;
1802
dd148e2506e2 Move template filter to map widget (by nemo)
unc0rr
parents: 1797
diff changeset
   104
  QLabel* lblFilter;
dd148e2506e2 Move template filter to map widget (by nemo)
unc0rr
parents: 1797
diff changeset
   105
  QComboBox* CB_TemplateFilter;
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
   106
  QLabel *maze_size_label;
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
   107
  QComboBox *maze_size_selection;
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
   108
  MapGenerator mapgen;
4489
c4ca9ced258b - Pass map drawing data to engine
unc0rr
parents: 4337
diff changeset
   109
  QByteArray drawnMapData;
4337
85e02b1a8e8f merge 0.9.14.1 to trunk
nemo
parents: 4322
diff changeset
   110
  int numMissions;
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 3008
diff changeset
   111
  int maze_size;
331
6bfc326e4976 Selecting map works in net game
unc0rr
parents: 325
diff changeset
   112
6bfc326e4976 Selecting map works in net game
unc0rr
parents: 325
diff changeset
   113
  void loadMap(int index);
164
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
   114
};
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
   115
92cff18a3ab6 first map preview added (still experimental)
displacer
parents:
diff changeset
   116
#endif // _HWMAP_CONTAINER_INCLUDED