1/*
2 Copyright (C) 1998-2001 Andreas Zehender <az@azweb.de>
3
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16*/
17
18#ifndef KSPACEDUEL_DIALOGS_H
19#define KSPACEDUEL_DIALOGS_H
20
21class QComboBox;
22class QTabWidget;
23class QSlider;
24class QLCDNumber;
25
26#include <kconfigdialog.h>
27
28#include "defines.h"
29#include "structs.h"
30
31
32class ConfigSetup:public QWidget
33{
34 Q_OBJECT
35public:
36 explicit ConfigSetup(SConfig *custom,QWidget *parent=0);
37
38 bool hasChanged();
39 bool isDefault();
40 void updateSettings();
41 void updateWidgets();
42 void updateWidgetsDefault();
43
44signals:
45 void changed();
46
47protected slots:
48 void configSelected(int num);
49 void sliderChanged(int val);
50protected:
51 void valueChanged(int ednum,int val);
52 void valueChanged(int ednum,double val);
53 void displayConfig(SConfig cfg);
54 void setValue(int ednum,int val);
55 void setValue(int ednum,double val);
56 void setValue(int ednum,unsigned val);
57private:
58 enum {EditGamespeed=0,
59 EditShotSpeed,EditShotEnergyNeed,EditMaxBullets,EditBulletDamage,
60 EditBulletLifeTime,EditBulletReloadTime,
61 EditMineFuel,EditMineEnergyNeed,EditMineActivateTime,
62 EditMineDamage,EditMaxMines,EditMineReloadTime,
63 EditAcc,EditEnergyNeed,EditRotationSpeed,
64 EditRotationEnergyNeed,EditShipDamage,
65 EditSunEnergy,EditGravity,
66 EditPosX,EditPosY,EditVelX,EditVelY,
67 EditPowerupRefreshTime,EditPowerupLifeTime,
68 EditPowerupEnergyAmount,EditPowerupShieldAmount,
69 EditNum};
70 enum {TabGeneral=0,TabBullet,TabMine,
71 TabShip,TabSun,TabStart,TabPowerups,TabNum};
72 enum Type {VarInt,VarFloat};
73
74 static char LabelName[EditNum][25];
75 static int Parent[EditNum];
76 static int Position[EditNum];
77 static const char *TabName[TabNum];
78 static double EditVal[EditNum][3];
79 static int EditDiv[EditNum];
80 static Type VarType[EditNum];
81
82 QTabWidget *tabs;
83
84 QSlider *slider[EditNum];
85 QLCDNumber *value[EditNum];
86
87 QComboBox *configCombo;
88 SConfig *customConfig,config;
89
90 int selectedConfig;
91};
92
93class SettingsDialog : public KConfigDialog
94{
95 Q_OBJECT
96public:
97 explicit SettingsDialog(SConfig *customConfig, QWidget *parent=0, const char *name=0);
98 ~SettingsDialog();
99
100signals:
101 void settingsUpdated();
102
103private slots:
104 void updateWidgets();
105 void updateWidgetsDefault();
106 void updateSettings();
107
108private:
109 bool hasChanged();
110 bool isDefault();
111
112private:
113 ConfigSetup* cs;
114};
115
116#endif // KSPACEDUEL_DIALOGS_H
117