Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+145
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
* Model for authentication code table
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2017-01-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <CodificationManagement/logger.h>
|
||||
#include <CodificationManagement/cod_dtc.h>
|
||||
|
||||
|
||||
namespace CodificationManagement
|
||||
{
|
||||
|
||||
class AuthenticationCodeModel final : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AuthenticationCodeModel(QObject *parent);
|
||||
|
||||
/**
|
||||
* init model internal data matrix
|
||||
* @param dtc access to Data Topic Client
|
||||
* @param codificationDataId id of the used codification data set
|
||||
* @param isEditMode true means model used for edit, otherwise used for show only
|
||||
* in edit mode non update will be done by external data change
|
||||
* @return Returns true on success, otherwise false
|
||||
*/
|
||||
bool init(const std::shared_ptr<CodificationManagement::Interface::Dtc> &dtc,
|
||||
int codificationDataId,
|
||||
bool isEditMode = false);
|
||||
|
||||
/**
|
||||
* set the 13x5 code matrix to zero
|
||||
*/
|
||||
void resetMatrix();
|
||||
|
||||
/**
|
||||
* set matrix values
|
||||
* The formatting of the data must correspond to the appearance of the table!
|
||||
* @param data reference to int data set of matrix values
|
||||
* @return Returns true on success, otherwise false
|
||||
*/
|
||||
bool setMatrixValuesCSV(const QString &csvData);
|
||||
|
||||
/**
|
||||
* get matrix data in csv format.
|
||||
* The formatting of the data corresponds to the appearance of the table
|
||||
* @param -
|
||||
* @return Returns matrix data in csv format;
|
||||
*/
|
||||
QString getMatrixDataCSVString() const;
|
||||
|
||||
/**
|
||||
* set/get edit mode flag used for internal data handling
|
||||
* @param isEditMode true means set edit mode
|
||||
* @return Returns true if edit mode is set, otherwise false
|
||||
*/
|
||||
void setEditMode(bool isEditMode);
|
||||
bool isEditMode() const;
|
||||
|
||||
/**
|
||||
* get the row count (MVC-model)
|
||||
* @param ModelIndex
|
||||
* @return int Returns the count
|
||||
*/
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
/**
|
||||
* get the row column (MVC-model)
|
||||
* @param ModelIndex
|
||||
* @return int Returns the count
|
||||
*/
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
/**
|
||||
* get the header data (MVC-model)
|
||||
* @param section (column)
|
||||
* @param Qt::Orientation
|
||||
* @param role
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant headerData(int column, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
/**
|
||||
* get the data (MVC-model)
|
||||
* @param QModelIndex
|
||||
* @return QVariant
|
||||
*/
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
/**
|
||||
* set the data (MVC-model)
|
||||
* @param QModelIndex
|
||||
* @return bool Returns true if successfull, otherwise returns false
|
||||
*/
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
|
||||
/**
|
||||
* get flags for the given QModelIndex (MVC-model)
|
||||
* @param ModelIndex
|
||||
* @return flags Returns the flags
|
||||
*/
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
/**
|
||||
* emits when data was changed (used to enable add/okay button)
|
||||
*/
|
||||
void dataModified();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCodificationDataChanged(const CodificationManagement::CodificationData &data,
|
||||
DataModification modType);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* set the 13x5 code matrix to
|
||||
* @param data reference to character set of row selection values
|
||||
* @return Returns true on success, otherwise false
|
||||
*/
|
||||
void setMatrix(const QVector <int> &data);
|
||||
|
||||
int m_matrix[13][5]; ///< Hold the authentication code table (without row/column selcet index fields)
|
||||
|
||||
QVector <QChar> m_RowSelectionValues; ///< Hold the row selection index field character
|
||||
QVector <QChar> m_ColumnSelectionValues; ///< Hold the column selection index field character
|
||||
|
||||
std::shared_ptr<CodificationManagement::Interface::Dtc> m_dtc;
|
||||
|
||||
int m_codificationDataId; ///< Id of the used codification data set
|
||||
bool m_isEditMode; ///< Hold the dialog mode setting; if true the indices in row 0 and column 0 can be modified
|
||||
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
|
||||
};
|
||||
|
||||
} //namespace CodificationManagement
|
||||
Reference in new issue
Block a user