QTfrontend/model/ammoSchemeModel.h
changeset 6616 f77bb02b669f
parent 6061 15b4b485a1c5
child 6700 e04da46ee43c
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
    24 #include <QStringList>
    24 #include <QStringList>
    25 #include <QList>
    25 #include <QList>
    26 
    26 
    27 class AmmoSchemeModel : public QAbstractTableModel
    27 class AmmoSchemeModel : public QAbstractTableModel
    28 {
    28 {
    29     Q_OBJECT
    29         Q_OBJECT
    30 
    30 
    31 public:
    31     public:
    32     AmmoSchemeModel(QObject * parent, const QString & fileName);
    32         AmmoSchemeModel(QObject * parent, const QString & fileName);
    33 
    33 
    34     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    34         QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    35     int rowCount(const QModelIndex & parent) const;
    35         int rowCount(const QModelIndex & parent) const;
    36     int columnCount(const QModelIndex & parent) const;
    36         int columnCount(const QModelIndex & parent) const;
    37     Qt::ItemFlags flags(const QModelIndex & index) const;
    37         Qt::ItemFlags flags(const QModelIndex & index) const;
    38     bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
    38         bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
    39     bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
    39         bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
    40     bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
    40         bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
    41     QVariant data(const QModelIndex &index, int role) const;
    41         QVariant data(const QModelIndex &index, int role) const;
    42 
    42 
    43     int numberOfDefaultSchemes;
    43         int numberOfDefaultSchemes;
    44     QStringList predefSchemesNames;
    44         QStringList predefSchemesNames;
    45     QStringList spNames;
    45         QStringList spNames;
    46 
    46 
    47 public slots:
    47     public slots:
    48     void Save();
    48         void Save();
    49 
    49 
    50 signals:
    50     signals:
    51     void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
    51         void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
    52 
    52 
    53 protected:
    53     protected:
    54     QList< QList<QVariant> > schemes;
    54         QList< QList<QVariant> > schemes;
    55 
    55 
    56 private:
    56     private:
    57     QSettings fileConfig;
    57         QSettings fileConfig;
    58 };
    58 };
    59 
    59 
    60 class NetAmmoSchemeModel : public QAbstractTableModel
    60 class NetAmmoSchemeModel : public QAbstractTableModel
    61 {
    61 {
    62     Q_OBJECT
    62         Q_OBJECT
    63 
    63 
    64 public:
    64     public:
    65     NetAmmoSchemeModel(QObject * parent);
    65         NetAmmoSchemeModel(QObject * parent);
    66 
    66 
    67     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    67         QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    68     int rowCount(const QModelIndex & parent) const;
    68         int rowCount(const QModelIndex & parent) const;
    69     int columnCount(const QModelIndex & parent) const;
    69         int columnCount(const QModelIndex & parent) const;
    70     QVariant data(const QModelIndex &index, int role) const;
    70         QVariant data(const QModelIndex &index, int role) const;
    71 
    71 
    72 public slots:
    72     public slots:
    73     void setNetSchemeConfig(QStringList & cfg);
    73         void setNetSchemeConfig(QStringList & cfg);
    74 
    74 
    75 private:
    75     private:
    76     QList<QVariant> netScheme;
    76         QList<QVariant> netScheme;
    77 };
    77 };
    78 
    78 
    79 #endif // _AMMO_SCHEME_MODEL_INCLUDED
    79 #endif // _AMMO_SCHEME_MODEL_INCLUDED