File indexing completed on 2024-04-21 15:07:59

0001 // Copyright (c) 2002-2004 Rob Kaper <cap@capsi.com>
0002 //
0003 // This program is free software; you can redistribute it and/or
0004 // modify it under the terms of the GNU General Public License
0005 // version 2 as published by the Free Software Foundation.
0006 //
0007 // This program is distributed in the hope that it will be useful,
0008 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0010 // General Public License for more details.
0011 //
0012 // You should have received a copy of the GNU General Public License
0013 // along with this program; see the file COPYING.  If not, write to
0014 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0015 // Boston, MA 02110-1301, USA.
0016 
0017 #ifndef ATLANTIK_SELECTCONFIGURATION_WIDGET_H
0018 #define ATLANTIK_SELECTCONFIGURATION_WIDGET_H
0019 
0020 #include <QMap>
0021 #include <QWidget>
0022 
0023 class QCheckBox;
0024 class QGroupBox;
0025 class QPushButton;
0026 class QVBoxLayout;
0027 
0028 class AtlanticCore;
0029 class ConfigOption;
0030 class Game;
0031 class Player;
0032 
0033 class SelectConfiguration : public QWidget
0034 {
0035 Q_OBJECT
0036 
0037 public:
0038     SelectConfiguration(AtlanticCore *atlanticCore, QWidget *parent);
0039 
0040 private Q_SLOTS:
0041     void addConfigOption(ConfigOption *configOption);
0042     void changeOption();
0043     void gameOption(const QString &title, const QString &type, const QString &value, const QString &edit, const QString &command);
0044     void optionChanged(ConfigOption *configOption);
0045     void optionChanged();
0046     void slotEndUpdate();
0047     void initGame();
0048     void playerChanged(Player *player);
0049     void gameChanged(Game *game);
0050 
0051 Q_SIGNALS:
0052     void startGame();
0053     void leaveGame();
0054     void joinConfiguration(int configurationId);
0055     void newConfiguration();
0056     void changeOption(int configId, const QString &value);
0057     void buttonCommand(const QString &);
0058     void iconSelected(const QString &);
0059     void statusMessage(const QString &message);
0060 
0061 private:
0062     void addConfigOptionBool(ConfigOption *configOption);
0063 
0064     QVBoxLayout *m_mainLayout;
0065     QGroupBox *m_configBox, *m_messageBox;
0066     QPushButton *m_backButton, *m_startButton;
0067     QMap <QObject *, QString> m_optionCommandMap;
0068     QMap <QObject *, ConfigOption *> m_configMap;
0069     QMap <ConfigOption *, QCheckBox *> m_configBoxMap;
0070     QMap <QString, QCheckBox *> m_checkBoxMap;
0071     Game *m_game;
0072     AtlanticCore *m_atlanticCore;
0073 };
0074 
0075 #endif