QTfrontend/ui/widget/selectWeapon.h
changeset 6616 f77bb02b669f
parent 6060 fdfc01419815
child 6700 e04da46ee43c
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
    29 class QLineEdit;
    29 class QLineEdit;
    30 class QSettings;
    30 class QSettings;
    31 
    31 
    32 class SelWeaponItem : public QWidget
    32 class SelWeaponItem : public QWidget
    33 {
    33 {
    34   Q_OBJECT
    34         Q_OBJECT
    35 
    35 
    36 public:
    36     public:
    37   SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent=0);
    37         SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent=0);
    38 
    38 
    39   unsigned char getItemsNum() const;
    39         unsigned char getItemsNum() const;
    40   void setItemsNum(const unsigned char num);
    40         void setItemsNum(const unsigned char num);
    41   void setEnabled(bool value);
    41         void setEnabled(bool value);
    42 
    42 
    43  private:
    43     private:
    44   WeaponItem* item;
    44         WeaponItem* item;
    45 };
    45 };
    46 
    46 
    47 class SelWeaponWidget : public QFrame
    47 class SelWeaponWidget : public QFrame
    48 {
    48 {
    49   Q_OBJECT
    49         Q_OBJECT
    50 
    50 
    51  public:
    51     public:
    52   SelWeaponWidget(int numItems, QWidget* parent=0);
    52         SelWeaponWidget(int numItems, QWidget* parent=0);
    53   QString getWeaponsString(const QString& name) const;
    53         QString getWeaponsString(const QString& name) const;
    54   QStringList getWeaponNames() const;
    54         QStringList getWeaponNames() const;
    55 
    55 
    56  public slots:
    56     public slots:
    57   void setDefault();
    57         void setDefault();
    58   void setWeapons(const QString& ammo);
    58         void setWeapons(const QString& ammo);
    59   //sets the name of the current set
    59         //sets the name of the current set
    60   void setWeaponsName(const QString& name);
    60         void setWeaponsName(const QString& name);
    61   void deleteWeaponsName();
    61         void deleteWeaponsName();
    62   void newWeaponsName();
    62         void newWeaponsName();
    63   void save();
    63         void save();
    64   void copy();
    64         void copy();
    65 
    65 
    66  signals:
    66     signals:
    67   void weaponsChanged();
    67         void weaponsChanged();
    68   void weaponsDeleted();
    68         void weaponsDeleted();
    69 
    69 
    70  private:
    70     private:
    71   //the name of the current weapon set
    71         //the name of the current weapon set
    72   QString curWeaponsName;
    72         QString curWeaponsName;
    73 
    73 
    74   QLineEdit* m_name;
    74         QLineEdit* m_name;
    75 
    75 
    76   //storage for all the weapons sets
    76         //storage for all the weapons sets
    77   QSettings* wconf;
    77         QSettings* wconf;
    78 
    78 
    79   const int m_numItems;
    79         const int m_numItems;
    80   int operator [] (unsigned int weaponIndex) const;
    80         int operator [] (unsigned int weaponIndex) const;
    81 
    81 
    82   typedef QList<SelWeaponItem*> ItemsList;
    82         typedef QList<SelWeaponItem*> ItemsList;
    83   typedef QMap<int, ItemsList> twi;
    83         typedef QMap<int, ItemsList> twi;
    84   twi weaponItems;
    84         twi weaponItems;
    85   //layout element for each tab:
    85         //layout element for each tab:
    86   QGridLayout* p1Layout;
    86         QGridLayout* p1Layout;
    87   QGridLayout* p2Layout;
    87         QGridLayout* p2Layout;
    88   QGridLayout* p3Layout;
    88         QGridLayout* p3Layout;
    89   QGridLayout* p4Layout;
    89         QGridLayout* p4Layout;
    90 };
    90 };
    91 
    91 
    92 #endif // _SELECT_WEAPON_INCLUDED
    92 #endif // _SELECT_WEAPON_INCLUDED