Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+27
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
|
||||
SET(lt_SRCS
|
||||
main.cpp
|
||||
maindialog.h
|
||||
maindialog.cpp
|
||||
cod_numeral_code_model.h
|
||||
cod_numeral_code_model.cpp
|
||||
ui/maindialog.ui
|
||||
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(lt_SRCS ui/maindialog.ui)
|
||||
|
||||
NGL_ADD_EXECUTABLE(WS CODTest ${lt_SRCS})
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(CODTest
|
||||
Qt5::Widgets
|
||||
Qt5::Core
|
||||
nglapplication
|
||||
NGLLogger
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET_DEVEL(CODTest)
|
||||
NGL_INSTALL(WS FILES log4cxx_cod_test.props DESTINATION bin COMPONENT Devel)
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
/**
|
||||
* Model for numeral code table
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-11-02
|
||||
*/
|
||||
|
||||
|
||||
#include "cod_numeral_code_model.h"
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QTime>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
NumeralCodeModel::NumeralCodeModel(QWidget *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
, m_isEditMode(false)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("COD_Test_NumeralCodeTableModel"))
|
||||
{
|
||||
init();
|
||||
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NumeralCodeModel::~NumeralCodeModel()
|
||||
{
|
||||
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::init()
|
||||
{
|
||||
m_MatrixNumeralSet << '0' << '1' << '2' << '3' << '4'
|
||||
<< '5' << '6' << '7' << '8' << '9';
|
||||
|
||||
|
||||
m_MatrixCharacterSet1 << 'A' << 'B' << 'C' << 'D' << 'E' << 'F'
|
||||
<< 'G' << 'H' << 'I' << 'J' << 'K' << 'L'
|
||||
<< 'M' << 'N' << 'O' << 'P' << 'Q' << 'R'
|
||||
<< 'S' << 'T' << 'U' << 'V' << 'W' << 'X'
|
||||
<< 'Y' << 'Z';
|
||||
|
||||
m_MatrixCharacterSet2 << 'D' << 'E' << 'G' << 'H' << 'I' << 'L'
|
||||
<< 'N' << 'O' << 'R' << 'S' << 'T' << 'U';
|
||||
|
||||
|
||||
|
||||
// DefaultValues... werden spaeter mit den Werten aus csv-Datei oder DB gesetzt.
|
||||
m_ColumnSelectionValues << 'A' << 'B' << 'C'
|
||||
<< 'D' << 'E' << 'F'
|
||||
<< 'G' << 'H' << 'I'
|
||||
<< 'J' << 'K' << 'L'
|
||||
<< 'M' ;
|
||||
|
||||
// DefaultValues... werden spaeter mit den Werten aus csv-Datei oder DB gesetzt.
|
||||
m_RowSelectionValues << 'a' << 'b' << 'c'
|
||||
<< 'd' << 'e' << 'f'
|
||||
<< 'g' << 'h' << 'i'
|
||||
<< 'j' << 'k' << 'l'
|
||||
<< 'm' ;
|
||||
|
||||
|
||||
return initMatrix();
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::setColumnSelectionValues(const QVector <char> &data)
|
||||
{
|
||||
m_ColumnSelectionValues = data;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(0, columnCount() - 1));
|
||||
return true;
|
||||
} // end of setColumnSelectionValues()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::setColumnSelectionValuesCSV(const QVector<char> &csvData)
|
||||
{
|
||||
QStringList qsList;
|
||||
for (int i = 0; i < csvData.size(); ++i)
|
||||
{
|
||||
if (QLatin1Char(csvData.at(i)) != QLatin1Char(';'))
|
||||
qsList.append(QString(QLatin1Char(csvData.at(i))));
|
||||
}
|
||||
|
||||
// DEBUG_LOG(m_logger) << "setColumnSelectionValuesCSV() "
|
||||
// << " csvData.size(): " << csvData.size()
|
||||
// << " qsList.size: " << qsList.size()
|
||||
// ;
|
||||
|
||||
QVector <char> data;
|
||||
for (int i = 0; i < qsList.size(); ++i)
|
||||
{
|
||||
const QString &qs = qsList.at(i);
|
||||
if (qs.isEmpty())
|
||||
continue;
|
||||
|
||||
char c = qs.at(0).toLatin1();
|
||||
data.append(c);
|
||||
}
|
||||
return setColumnSelectionValues(data);;
|
||||
} // end of setColumnSelectionValuesCSV()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::setRowSelectionValues(const QVector <char> &data)
|
||||
{
|
||||
m_RowSelectionValues = data;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(0, columnCount() - 1));
|
||||
return true;
|
||||
} // end of setRowSelectionValues()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::setRowSelectionValuesCSV(const QVector<char> &csvData)
|
||||
{
|
||||
QStringList qsList;
|
||||
for (int i = 0; i < csvData.size(); ++i)
|
||||
{
|
||||
if (QLatin1Char(csvData.at(i)) != QLatin1Char(';'))
|
||||
qsList.append(QString(QLatin1Char(csvData.at(i))));
|
||||
}
|
||||
|
||||
QVector <char> data;
|
||||
for (int i = 0; i < qsList.size(); ++i)
|
||||
{
|
||||
const QString &qs = qsList.at(i);
|
||||
if (qs.isEmpty())
|
||||
continue;
|
||||
|
||||
char c = qs.at(0).toLatin1();
|
||||
data.append(c);
|
||||
}
|
||||
return setRowSelectionValues(data);
|
||||
} // end of setRowSelectionValuesCSV()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QVector<char> NumeralCodeModel::getHorizontalHeaderCSV() const
|
||||
{
|
||||
QVector <char> qVec;
|
||||
qVec.reserve(m_ColumnSelectionValues.size() * 2);
|
||||
for (int i = 0; i < m_ColumnSelectionValues.size(); ++i)
|
||||
{
|
||||
qVec.append(m_ColumnSelectionValues.at(i));
|
||||
qVec.append(';');
|
||||
}
|
||||
// remove last separator
|
||||
qVec.remove(m_ColumnSelectionValues.size() * 2 - 1);
|
||||
|
||||
return qVec;
|
||||
} // end of getHorizontalHeaderCSV()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QVector <char> NumeralCodeModel::getVerticalHeaderCSV() const
|
||||
{
|
||||
QVector <char> qVec;
|
||||
qVec.reserve(m_RowSelectionValues.size() * 2);
|
||||
for (int i = 0; i < m_RowSelectionValues.size(); ++i)
|
||||
{
|
||||
qVec.append(m_RowSelectionValues.at(i));
|
||||
qVec.append(';');
|
||||
}
|
||||
// remove last separator
|
||||
qVec.remove(m_RowSelectionValues.size() * 2 - 1);
|
||||
|
||||
return qVec;
|
||||
} // end of getVerticalHeaderCSV()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void NumeralCodeModel::setEditMode(bool isEditMode)
|
||||
{
|
||||
m_isEditMode = isEditMode;
|
||||
// DEBUG_LOG(m_logger) << "emit dataChanged() 0/0 up to row: " <<rowCount() << " col: " << columnCount();
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, columnCount() - 1));
|
||||
|
||||
} // end of setEditMode()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::isEditMode() const
|
||||
{
|
||||
return m_isEditMode;
|
||||
} // end of isEditMode();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int NumeralCodeModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return 14; // Matrixgroesse + 1 Character fuer RowIndex
|
||||
} // end of rowCount()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int NumeralCodeModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return 14; // Matrixgroesse + 1 Character fuer ColumnIndex
|
||||
} // end of columnCount()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QVariant NumeralCodeModel::headerData(int column, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QAbstractTableModel::headerData(column, orientation, role);
|
||||
|
||||
if (isEditMode())
|
||||
{
|
||||
// Im header nichts anzeigen bzw. in der view die Vertical/horizontal header ausblenden
|
||||
return QVariant();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (column == 0)
|
||||
return QVariant();
|
||||
if (orientation == Qt::Horizontal)
|
||||
return QChar::fromLatin1(m_ColumnSelectionValues.at(column - 1));
|
||||
if (orientation == Qt::Vertical)
|
||||
return QChar::fromLatin1(m_RowSelectionValues.at(column - 1));
|
||||
}
|
||||
|
||||
return QAbstractTableModel::headerData(column, orientation, role);
|
||||
} // end of headerData()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QVariant NumeralCodeModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if ((role == Qt::DisplayRole || role == Qt::EditRole))
|
||||
{
|
||||
// DEBUG_LOG(m_logger) << "data() display role row: " <<index.row() << " col: " << index.column();
|
||||
if ((index.column() == 0) && (index.row() == 0))
|
||||
return QVariant();
|
||||
|
||||
// row index ==> column index values
|
||||
if (index.row() == 0)
|
||||
return QChar::fromLatin1(m_ColumnSelectionValues[index.column() - 1]);
|
||||
|
||||
// column index ==> row index values
|
||||
if ((index.column() == 0))
|
||||
return QChar::fromLatin1(m_RowSelectionValues[index.row() - 1]);
|
||||
|
||||
// Code Matrix
|
||||
if ((index.column() > 0) && (index.row() > 0))
|
||||
{
|
||||
return QChar::fromLatin1(m_matrix[index.row() - 1][index.column() - 1]); // row/column fuer header abziehen
|
||||
}
|
||||
|
||||
// return QString(QLatin1String("R%1, C%2"))
|
||||
// .arg(index.row() +1)
|
||||
// .arg(index.column() +1 );
|
||||
|
||||
}
|
||||
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
return Qt::AlignCenter;
|
||||
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
if ((index.row() > 0) && (index.column() > 0))
|
||||
{
|
||||
if (m_isEditMode)
|
||||
return QColor(Qt::darkRed);
|
||||
else
|
||||
return QColor(Qt::darkGray);
|
||||
}
|
||||
else
|
||||
return QColor(Qt::darkYellow);
|
||||
}
|
||||
|
||||
if (role == Qt::ForegroundRole)
|
||||
{
|
||||
if ((index.row() == 0) && (index.column() == 0))
|
||||
return QColor(Qt::red);
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
||||
} // end of data()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setData() row/col: " << index.row() << "/" << index.column()
|
||||
<< " char:" << value.toString();
|
||||
|
||||
QString tmp = value.toString();
|
||||
if (tmp.isEmpty())
|
||||
return false;
|
||||
|
||||
const char c = tmp.at(0).toLatin1();
|
||||
|
||||
if (role == Qt::EditRole)
|
||||
{
|
||||
// Input for ColumnSelectionValues
|
||||
if (index.row() == 0)
|
||||
m_ColumnSelectionValues[index.column() - 1] = c;
|
||||
// Input for RowSelectionValues
|
||||
if (index.column() == 0 && (index.row() > 0))
|
||||
m_RowSelectionValues[index.row() - 1] = c;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end of setData()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Qt::ItemFlags NumeralCodeModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags flags = QAbstractTableModel::flags(index);
|
||||
if (((index.row() == 0) && (index.column() > 0)) ||
|
||||
((index.row() > 0) && (index.column() == 0)))
|
||||
flags |= Qt::ItemIsEditable;
|
||||
|
||||
return flags;
|
||||
} // end of flags()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool NumeralCodeModel::initMatrix()
|
||||
{
|
||||
int lastMatrixValueCnt = 0;
|
||||
int lastMatrixCharacterCnt = 0;
|
||||
int lastMatrixCharacterIndex = 0;
|
||||
int numOfCharacter = 4;
|
||||
|
||||
for (int row = 0; row < 13; ++row)
|
||||
{
|
||||
// Neue Zeile mit Ziffer der letzten Zeile beginnen
|
||||
if (row > 3)
|
||||
{
|
||||
numOfCharacter = 3;
|
||||
lastMatrixValueCnt -= 1;
|
||||
}
|
||||
|
||||
// Ab Zeile 9 CharacterSet2 verwenden
|
||||
if (row == 9)
|
||||
lastMatrixCharacterIndex = 0;
|
||||
|
||||
for (int col = 0; col < 13; ++col)
|
||||
{
|
||||
if (lastMatrixValueCnt < 10)
|
||||
{
|
||||
m_matrix[row][col] = m_MatrixNumeralSet.at(lastMatrixValueCnt);
|
||||
lastMatrixValueCnt += 1;
|
||||
|
||||
if (lastMatrixValueCnt == 10)
|
||||
lastMatrixCharacterCnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (row < 9)
|
||||
m_matrix[row][col] = m_MatrixCharacterSet1.at(lastMatrixCharacterIndex);
|
||||
else
|
||||
m_matrix[row][col] = m_MatrixCharacterSet2.at(lastMatrixCharacterIndex);
|
||||
lastMatrixCharacterCnt += 1;
|
||||
lastMatrixCharacterIndex += 1;
|
||||
|
||||
if (lastMatrixCharacterCnt == numOfCharacter)
|
||||
lastMatrixValueCnt = 0;
|
||||
}
|
||||
|
||||
// Im ersten Teil den CharacterSet1 verwenden
|
||||
if ((row < 9) && (lastMatrixCharacterIndex == 26))
|
||||
lastMatrixCharacterIndex = 0;
|
||||
|
||||
// Im restlichen Teil den CharacterSet2 verwenden
|
||||
if ((row >= 9) && (lastMatrixCharacterIndex == 12))
|
||||
lastMatrixCharacterIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Check m_matrix---
|
||||
QString qs;
|
||||
for (int row = 0; row < 13; ++row)
|
||||
{
|
||||
for (int col = 0; col < 13; ++col)
|
||||
{
|
||||
qs.append(QLatin1Char(m_matrix[row][col]));
|
||||
qs.append(QLatin1String("; "));
|
||||
}
|
||||
qs.append(QLatin1String("\n"));
|
||||
}
|
||||
QString qs1(QLatin1String("\n"));
|
||||
qs1.append(qs);
|
||||
// DEBUG_LOG(m_logger) << qs1;
|
||||
|
||||
return true;
|
||||
} // end of initMatrix()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* Model for numeral code table
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-11-02
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
class NumeralCodeModel final : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NumeralCodeModel(QWidget *parent);
|
||||
|
||||
~NumeralCodeModel();
|
||||
|
||||
/**
|
||||
* init model internal data matrix
|
||||
* @param -
|
||||
* @return Returns true on success, otherwise false
|
||||
*/
|
||||
bool init();
|
||||
|
||||
/**
|
||||
* set column selection values
|
||||
* @param data refernce to character set of column selection values
|
||||
* @return Returns true on success, otherwise false
|
||||
*/
|
||||
bool setColumnSelectionValues(const QVector<char> &data);
|
||||
bool setColumnSelectionValuesCSV(const QVector<char> &csvData);
|
||||
|
||||
/**
|
||||
* set model internal data matrix
|
||||
* @param data reference to character set of row selection values
|
||||
* @return Returns true on success, otherwise false
|
||||
*/
|
||||
bool setRowSelectionValues(const QVector<char> &data);
|
||||
bool setRowSelectionValuesCSV(const QVector<char> &csvData);
|
||||
|
||||
/**
|
||||
* get horizontal header in csv format
|
||||
* @param -
|
||||
* @return Returns horizontal header in csv format; (vectorsize must be 26).
|
||||
*/
|
||||
QVector <char> getHorizontalHeaderCSV() const;
|
||||
/**
|
||||
* get vertical header in csv format
|
||||
* @param -
|
||||
* @return Returns vertical header in csv format; (vectorsize must be 26).
|
||||
*/
|
||||
QVector <char> getVerticalHeaderCSV() 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;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* init the constant 13x13 code matrix
|
||||
* @param ModelIndex
|
||||
* @return flags Returns the flags
|
||||
*/
|
||||
bool initMatrix();
|
||||
|
||||
QVector <char> m_MatrixNumeralSet; ///< Numeral Set 0-9
|
||||
QVector <char> m_MatrixCharacterSet1; ///< Character set 1 A-Z 26 Character
|
||||
QVector <char> m_MatrixCharacterSet2; ///< Character set 2 especially 12 Character D...U
|
||||
|
||||
char m_matrix[13][13]; ///< Hold the numeral code table (without row/column selcet index fields)
|
||||
|
||||
QVector <char> m_RowSelectionValues; ///< Hold the row selcetion index field character
|
||||
QVector <char> m_ColumnSelectionValues; ///< Hold the column selcetion index field character
|
||||
|
||||
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
|
||||
};
|
||||
@@ -0,0 +1,78 @@
|
||||
log4j.reset=true
|
||||
log4j.rootLogger=WARN, file
|
||||
|
||||
# Test: Codification
|
||||
###########################################################
|
||||
|
||||
log4j.logger.COD_Test_NumeralCodeTableMainDialog=DEBUG
|
||||
log4j.logger.COD_Test_NumeralCodeTableModel=DEBUG
|
||||
|
||||
|
||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.file.MaxFileSize=1MB
|
||||
log4j.appender.file.MaxBackupIndex=9
|
||||
log4j.appender.file.file=${LOG4QT_LOGDIR}/${LOG4QT_USER}_cod.log
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d %-5p %c |#| %m (%.50F:%L) %n
|
||||
|
||||
|
||||
# Appnd_Console
|
||||
###########################################################
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern= %d %p %c %c{1} - %m (%-.30F:%L) %n
|
||||
|
||||
|
||||
# Appnd_Syslog
|
||||
###########################################################
|
||||
log4j.appender.syslog=org.apache.log4j.SyslogAppender
|
||||
log4j.appender.syslog.Threshold=ERROR
|
||||
log4j.appender.syslog.SysLogHost=localhost
|
||||
log4j.appender.syslog.Facility=LOCAL7
|
||||
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.syslog.layout.ConversionPattern= %-4r %-5p %c %x - %m
|
||||
log4j.appender.syslog.LevelRangeFilter.AcceptOnMatch=true
|
||||
log4j.appender.syslog.LevelRangeFilter.LevelMin=INFO
|
||||
log4j.appender.syslog.LevelRangeFilter.LevelMax=FATAL
|
||||
|
||||
|
||||
###########################################################
|
||||
###########################################################
|
||||
###########################################################
|
||||
# 1) Available Levels in LOG4CXX Version 0.10.0:
|
||||
# TRACE,
|
||||
# DEBUG,
|
||||
# INFO,
|
||||
# WARN,
|
||||
# ERROR
|
||||
# FATAL
|
||||
#
|
||||
# d = date/time
|
||||
# p = priority (Level)
|
||||
# c = category/channel
|
||||
# m = message
|
||||
# F = file
|
||||
# L = line
|
||||
# n = platform dependent line separator character or characters.
|
||||
# ....
|
||||
#
|
||||
# Examples for console:
|
||||
# a)
|
||||
# %d %p %c #%m# (%.50F:%L)%n
|
||||
# date/time
|
||||
# priority
|
||||
# category/channel
|
||||
# #message#
|
||||
# (Maximal 50Character des Filename von rechts:Line)
|
||||
# line separator
|
||||
#
|
||||
# b)
|
||||
# %d (%.15F:%L) %-5p %c |#| %m%n
|
||||
# date/time
|
||||
# (Maximal 15Character des Filename von rechts:Line)
|
||||
# priority, Right pad with spaces if the priority name is less than 5 characters long.
|
||||
# category/channel
|
||||
# message
|
||||
# line separator
|
||||
#
|
||||
# Examples for files:
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include <nglapplication/nglapplication.h>
|
||||
#include "maindialog.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
NGLApplication app(argc, argv);
|
||||
QCoreApplication::setApplicationName(QLatin1String("Numeral Codification Table"));
|
||||
QCoreApplication::setOrganizationName(QLatin1String("RME"));
|
||||
|
||||
app.createLogger("CodificationTable", "log4cxx_cod_test.props");
|
||||
NGL::INGLLogger &logger = app.baseLogger();
|
||||
|
||||
STARTUP_LOG(logger);
|
||||
|
||||
MainDialog w;
|
||||
w.init();
|
||||
w.show();
|
||||
|
||||
// app.setQuitOnLastWindowClosed(true);
|
||||
|
||||
int retval = app.exec();
|
||||
|
||||
SHUTDOWN_LOG(logger);
|
||||
|
||||
return retval;
|
||||
}
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* Maindialog for codification dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-11-02
|
||||
*/
|
||||
|
||||
#include "maindialog.h"
|
||||
#include "ui_maindialog.h"
|
||||
|
||||
#include "cod_numeral_code_model.h"
|
||||
|
||||
#include <QVector>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
|
||||
MainDialog::MainDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui::MainDialog)
|
||||
, m_numCodeModel(new NumeralCodeModel(parent))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("COD_Test_NumeralCodeTableMainDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
MainDialog::~MainDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
} // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool MainDialog::init()
|
||||
{
|
||||
bool bOk = initNumeralModel();
|
||||
|
||||
connect(m_ui->cbEditMode, &QCheckBox::toggled,
|
||||
this, &MainDialog::onCbEditModeToggled);
|
||||
|
||||
|
||||
// connect(m_ui->pbSetHorizontalHeader, &QPushButton::clicked,
|
||||
// this, &MainDialog::onPbSetHorizontalHeader);
|
||||
|
||||
connect(m_ui->pbSetHorizontalHeader, &QPushButton::clicked,
|
||||
this, &MainDialog::onPbSetHorizontalHeaderCSV);
|
||||
|
||||
// connect(m_ui->pbSetVerticalHeader, &QPushButton::clicked,
|
||||
// this, &MainDialog::onPbSetVerticalHeader);
|
||||
|
||||
connect(m_ui->pbSetVerticalHeader, &QPushButton::clicked,
|
||||
this, &MainDialog::onPbSetVerticalHeaderCSV);
|
||||
|
||||
// Starten im UserMode (nicht editierbar)
|
||||
m_ui->cbEditMode->setChecked(false);
|
||||
onCbEditModeToggled(false);
|
||||
m_ui->pbSetHorizontalHeader->setEnabled(false);
|
||||
m_ui->pbSetVerticalHeader->setEnabled(false);
|
||||
|
||||
return bOk;
|
||||
} // end of init()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool MainDialog::initNumeralModel()
|
||||
{
|
||||
m_ui->tvNumeralCode->setModel(m_numCodeModel);
|
||||
|
||||
QHeaderView *header = m_ui->tvNumeralCode->horizontalHeader();
|
||||
// header->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
header->setVisible(true);
|
||||
|
||||
QHeaderView *vheader = m_ui->tvNumeralCode->verticalHeader();
|
||||
vheader->setVisible(true);
|
||||
|
||||
m_ui->tvNumeralCode->setShowGrid(true);
|
||||
|
||||
m_ui->tvNumeralCode->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
return true;
|
||||
} // end of initNumeralModel()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MainDialog::onCbEditModeToggled(bool isChecked)
|
||||
{
|
||||
m_numCodeModel->setEditMode(isChecked);
|
||||
|
||||
QHeaderView *header = m_ui->tvNumeralCode->horizontalHeader();
|
||||
QHeaderView *vheader = m_ui->tvNumeralCode->verticalHeader();
|
||||
|
||||
if (isChecked)
|
||||
{
|
||||
header->setVisible(false);
|
||||
vheader->setVisible(false);
|
||||
m_ui->tvNumeralCode->setColumnHidden(0, false);
|
||||
m_ui->tvNumeralCode->setRowHidden(0, false);
|
||||
|
||||
m_ui->pbSetHorizontalHeader->setEnabled(true);
|
||||
m_ui->pbSetVerticalHeader->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
header->setVisible(true);
|
||||
vheader->setVisible(true);
|
||||
m_ui->tvNumeralCode->setColumnHidden(0, true);
|
||||
m_ui->tvNumeralCode->setRowHidden(0, true);
|
||||
|
||||
m_ui->pbSetHorizontalHeader->setEnabled(false);
|
||||
m_ui->pbSetVerticalHeader->setEnabled(false);
|
||||
|
||||
getNumeralCodeHeader();
|
||||
}
|
||||
} // end of onCbEditModeToggled()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MainDialog::onPbSetHorizontalHeader()
|
||||
{
|
||||
QVector <char> columnSelectionValues;
|
||||
columnSelectionValues << 'h' << 'o' << 'r'
|
||||
<< 'i' << 'z' << 'o'
|
||||
<< 'n' << 't' << 'a'
|
||||
<< 'l' << 'i' << 'd'
|
||||
<< 'x';
|
||||
|
||||
m_numCodeModel->setColumnSelectionValues(columnSelectionValues);
|
||||
} // end of onPbSetHorizontalHeader()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MainDialog::onPbSetHorizontalHeaderCSV()
|
||||
{
|
||||
QVector <char> columnSelectionValues;
|
||||
columnSelectionValues << 'h' << 'o' << 'r'
|
||||
<< 'i' << 'z' << 'o'
|
||||
<< 'n' << 't' << 'a'
|
||||
<< 'l' << 'c' << 's'
|
||||
<< 'v';
|
||||
|
||||
QVector <char> csvVec;
|
||||
csvVec.reserve(columnSelectionValues.size() * 2);
|
||||
for (int i = 0; i < columnSelectionValues.size(); ++i)
|
||||
{
|
||||
csvVec.append(columnSelectionValues.at(i));
|
||||
csvVec.append(';');
|
||||
}
|
||||
// remove last separator
|
||||
csvVec.remove(columnSelectionValues.size() * 2 - 1);
|
||||
|
||||
DEBUG_LOG(m_logger) << "onPbSetHorizontalHeaderCSV() "
|
||||
<< " csvVec.size(): " << csvVec.size();
|
||||
|
||||
m_numCodeModel->setColumnSelectionValuesCSV(csvVec);
|
||||
} // end of onPbSetHorizontalHeaderCSV()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MainDialog::onPbSetVerticalHeader()
|
||||
{
|
||||
QVector <char> rowSelectionValues;
|
||||
rowSelectionValues << 'v' << 'e' << 'r'
|
||||
<< 't' << 'i' << 'c'
|
||||
<< 'a' << 'l' << 'i'
|
||||
<< 'n' << 'd' << 'e'
|
||||
<< 'x' ;
|
||||
|
||||
m_numCodeModel->setRowSelectionValues(rowSelectionValues);
|
||||
} // end of onPbSetVerticalHeader()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MainDialog::onPbSetVerticalHeaderCSV()
|
||||
{
|
||||
QVector <char> rowSelectionValues;
|
||||
rowSelectionValues << 'v' << 'e' << 'r'
|
||||
<< 't' << 'i' << 'c'
|
||||
<< 'a' << 'l' << 'i'
|
||||
<< 'n' << 'c' << 's'
|
||||
<< 'v';
|
||||
|
||||
QVector <char> csvVec;
|
||||
csvVec.reserve(rowSelectionValues.size() * 2);
|
||||
for (int i = 0; i < rowSelectionValues.size(); ++i)
|
||||
{
|
||||
csvVec.append(rowSelectionValues.at(i));
|
||||
csvVec.append(';');
|
||||
}
|
||||
// remove last separator
|
||||
csvVec.remove(rowSelectionValues.size() * 2 - 1);
|
||||
|
||||
DEBUG_LOG(m_logger) << "onPbSetVerticalHeaderCSV() "
|
||||
<< " csvVec.size(): " << csvVec.size();
|
||||
|
||||
m_numCodeModel->setRowSelectionValuesCSV(csvVec);
|
||||
} // end of onPbSetVerticalHeaderCSV()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MainDialog::getNumeralCodeHeader()
|
||||
{
|
||||
QVector <char> qVecHH = m_numCodeModel->getHorizontalHeaderCSV();
|
||||
QByteArray qbaHH;
|
||||
|
||||
for (int i = 0; i < qVecHH.size(); ++i)
|
||||
qbaHH.append(qVecHH.at(i));
|
||||
|
||||
QVector <char> qVecVH = m_numCodeModel->getVerticalHeaderCSV();
|
||||
QByteArray qbaVH;
|
||||
|
||||
for (int i = 0; i < qVecVH.size(); ++i)
|
||||
qbaVH.append(qVecVH.at(i));
|
||||
|
||||
DEBUG_LOG(m_logger) << "getNumeralCodeHeader()"
|
||||
<< " HH: " << qbaHH << " size: " << qbaHH.size()
|
||||
<< " VH: " << qbaVH << " size: " << qbaVH.size();
|
||||
|
||||
|
||||
// -> DDS schicken
|
||||
|
||||
} // end of getNumeralCodeHeader()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Maindialog for codification dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by hjl, SLSE, 2016-11-02
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainDialog;
|
||||
}
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
class NumeralCodeModel;
|
||||
|
||||
class MainDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainDialog(QWidget *parent = nullptr);
|
||||
~MainDialog();
|
||||
|
||||
bool init();
|
||||
bool initNumeralModel();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCbEditModeToggled(bool isChecked);
|
||||
|
||||
void onPbSetHorizontalHeader();
|
||||
void onPbSetHorizontalHeaderCSV();
|
||||
void onPbSetVerticalHeader();
|
||||
void onPbSetVerticalHeaderCSV();
|
||||
|
||||
void getNumeralCodeHeader();
|
||||
|
||||
private:
|
||||
Ui::MainDialog *m_ui;
|
||||
NumeralCodeModel *m_numCodeModel;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainDialog</class>
|
||||
<widget class="QWidget" name="MainDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>610</width>
|
||||
<height>513</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Codification Table</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="tvNumeralCode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>30</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||
<number>30</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>30</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderMinimumSectionSize">
|
||||
<number>30</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbEditMode">
|
||||
<property name="text">
|
||||
<string>Edit&Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbSetHorizontalHeader">
|
||||
<property name="text">
|
||||
<string>Set default horizontal header</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbSetVerticalHeader">
|
||||
<property name="text">
|
||||
<string>Set default vertical header</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in new issue
Block a user