QTfrontend/ammoSchemeModel.h
changeset 1897 e9dcb47013c7
parent 1890 de5cfe3beb22
child 1899 5763f46d7486
equal deleted inserted replaced
1896:fdacad5d0acc 1897:e9dcb47013c7
    17  */
    17  */
    18 
    18 
    19 #ifndef _AMMO_SCHEME_MODEL_INCLUDED
    19 #ifndef _AMMO_SCHEME_MODEL_INCLUDED
    20 #define _AMMO_SCHEME_MODEL_INCLUDED
    20 #define _AMMO_SCHEME_MODEL_INCLUDED
    21 
    21 
       
    22 #include <QSettings>
    22 #include <QAbstractTableModel>
    23 #include <QAbstractTableModel>
       
    24 #include <QStringList>
    23 #include <QList>
    25 #include <QList>
    24 
    26 
    25 class AmmoSchemeModel : public QAbstractTableModel
    27 class AmmoSchemeModel : public QAbstractTableModel
    26 {
    28 {
    27 	Q_OBJECT
    29 	Q_OBJECT
    28 
    30 
    29 public:
    31 public:
    30 	AmmoSchemeModel(QObject *parent = 0);
    32 	AmmoSchemeModel(QObject * parent, const QString & fileName);
    31 
    33 
    32 	QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    34 	QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    33 	int rowCount(const QModelIndex & parent) const;
    35 	int rowCount(const QModelIndex & parent) const;
    34 	int columnCount(const QModelIndex & parent) const;
    36 	int columnCount(const QModelIndex & parent) const;
    35 	Qt::ItemFlags flags(const QModelIndex & index) const;
    37 	Qt::ItemFlags flags(const QModelIndex & index) const;
    36 	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);
    37 	bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
    39 	bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
    38 	bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
    40 	bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
    39 	QVariant data(const QModelIndex &index, int role) const;
    41 	QVariant data(const QModelIndex &index, int role) const;
    40 
    42 
       
    43 public slots:
       
    44 	void Save();
       
    45 
    41 signals:
    46 signals:
    42 	void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
    47 	void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
    43 
    48 
    44 protected:
    49 protected:
    45 	QList< QList<QVariant> > schemes;
    50 	QList< QList<QVariant> > schemes;
    46 
    51 
    47 private:
    52 private:
    48 	QList<QVariant> defaultScheme;
    53 	QList<QVariant> defaultScheme;
       
    54 
       
    55 	QSettings fileConfig;
       
    56 
       
    57 	QStringList spNames;
    49 };
    58 };
    50 
    59 
    51 #endif // _AMMO_SCHEME_MODEL_INCLUDED
    60 #endif // _AMMO_SCHEME_MODEL_INCLUDED