dialogs.h 3.2 KB
Newer Older
1 2
/*
    Copyright (C) 1998-2001 Andreas Zehender <az@azweb.de>
3 4 5 6 7 8 9 10 11 12 13 14 15 16

    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/
17

Arto Hytönen's avatar
Arto Hytönen committed
18 19
#ifndef KSPACEDUEL_DIALOGS_H
#define KSPACEDUEL_DIALOGS_H
Andreas Zehender's avatar
Andreas Zehender committed
20

21 22 23 24 25
class QComboBox;
class QTabWidget;
class QSlider;
class QLCDNumber;

26
#include <kconfigdialog.h>
Andreas Zehender's avatar
Andreas Zehender committed
27 28 29 30

#include "defines.h"
#include "structs.h"

31

32
class ConfigSetup:public QWidget
Andreas Zehender's avatar
Andreas Zehender committed
33 34 35
{
   Q_OBJECT
public:
36
   explicit ConfigSetup(SConfig *custom,QWidget *parent=0);
37 38 39 40 41 42

   bool hasChanged();
   bool isDefault();
   void updateSettings();
   void updateWidgets();
   void updateWidgetsDefault();
Andreas Zehender's avatar
Andreas Zehender committed
43

44 45
signals:
   void changed();
46 47

protected slots:
Andreas Zehender's avatar
Andreas Zehender committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
   void configSelected(int num);
   void sliderChanged(int val);
protected:   
   void valueChanged(int ednum,int val);
   void valueChanged(int ednum,double val);
   void displayConfig(SConfig cfg);
   void setValue(int ednum,int val);
   void setValue(int ednum,double val);
   void setValue(int ednum,unsigned val);
private:
   enum {EditGamespeed=0,
         EditShotSpeed,EditShotEnergyNeed,EditMaxBullets,EditBulletDamage,
         EditBulletLifeTime,EditBulletReloadTime,
         EditMineFuel,EditMineEnergyNeed,EditMineActivateTime,
         EditMineDamage,EditMaxMines,EditMineReloadTime,
         EditAcc,EditEnergyNeed,EditRotationSpeed,
         EditRotationEnergyNeed,EditShipDamage,
         EditSunEnergy,EditGravity,
         EditPosX,EditPosY,EditVelX,EditVelY,
Andreas Zehender's avatar
Andreas Zehender committed
67 68
         EditPowerupRefreshTime,EditPowerupLifeTime,
         EditPowerupEnergyAmount,EditPowerupShieldAmount,
Andreas Zehender's avatar
Andreas Zehender committed
69 70
         EditNum};
   enum {TabGeneral=0,TabBullet,TabMine,
Andreas Zehender's avatar
Andreas Zehender committed
71
         TabShip,TabSun,TabStart,TabPowerups,TabNum};
Andreas Zehender's avatar
Andreas Zehender committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
   enum Type {VarInt,VarFloat};
   
   static char LabelName[EditNum][25];
   static int Parent[EditNum];
   static int Position[EditNum];
   static const char *TabName[TabNum];
   static double EditVal[EditNum][3];
   static int EditDiv[EditNum];
   static Type VarType[EditNum];
 
   QTabWidget *tabs;

   QSlider *slider[EditNum];
   QLCDNumber *value[EditNum];
   
   QComboBox *configCombo;
   SConfig *customConfig,config;
89 90 91 92 93 94 95 96
   
   int selectedConfig;
};

class SettingsDialog : public KConfigDialog
{
        Q_OBJECT
public:
Dirk Rathlev's avatar
EBN fix  
Dirk Rathlev committed
97
        explicit SettingsDialog(SConfig *customConfig, QWidget *parent=0, const char *name=0);
98 99 100 101 102 103
        ~SettingsDialog();

signals:
        void settingsUpdated();

private slots:
Laurent Montel's avatar
Laurent Montel committed
104 105 106
        void updateWidgets() Q_DECL_OVERRIDE;
        void updateWidgetsDefault() Q_DECL_OVERRIDE;
        void updateSettings() Q_DECL_OVERRIDE;
107 108
                                        
private:
Laurent Montel's avatar
Laurent Montel committed
109 110
        bool hasChanged() Q_DECL_OVERRIDE;
        bool isDefault() Q_DECL_OVERRIDE;
111 112 113

private:
        ConfigSetup* cs;
Andreas Zehender's avatar
Andreas Zehender committed
114 115
};

Arto Hytönen's avatar
Arto Hytönen committed
116
#endif // KSPACEDUEL_DIALOGS_H