QTfrontend/ammoSchemeModel.h
changeset 2948 3f21a9dc93d0
parent 1940 bbdca883b5f9
child 3172 ae5c7f97df44
equal deleted inserted replaced
2947:803b277e4894 2948:3f21a9dc93d0
    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 	const int numberOfDefaultSchemes;
    43     const int numberOfDefaultSchemes;
    44 
    44 
    45 public slots:
    45 public slots:
    46 	void Save();
    46     void Save();
    47 
    47 
    48 signals:
    48 signals:
    49 	void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
    49     void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
    50 
    50 
    51 protected:
    51 protected:
    52 	QList< QList<QVariant> > schemes;
    52     QList< QList<QVariant> > schemes;
    53 
    53 
    54 private:
    54 private:
    55 	QSettings fileConfig;
    55     QSettings fileConfig;
    56 
    56 
    57 	QStringList spNames;
    57     QStringList spNames;
    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