first commit
This commit is contained in:
60
project/fm_viewer/cfg/rm_value_selector.h
Normal file
60
project/fm_viewer/cfg/rm_value_selector.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#ifndef RM_VALUE_SELECTOR_H
|
||||
#define RM_VALUE_SELECTOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
|
||||
class QJsonObject;
|
||||
class RMValueSelector
|
||||
{
|
||||
public:
|
||||
|
||||
#if (USE_JSON_SETTINGS)
|
||||
explicit RMValueSelector(int object);
|
||||
protected:
|
||||
int _object;
|
||||
unsigned char realValue(int index);
|
||||
int realIndex(unsigned char value);
|
||||
#else // USE_JSON_SETTINGS
|
||||
public:
|
||||
RMValueSelector(unsigned char* value,QList<int> indexMap);
|
||||
unsigned char realValue(int index)
|
||||
{
|
||||
return _indexMap.isEmpty() ? (unsigned char)index : (unsigned char)_indexMap[index];
|
||||
}
|
||||
|
||||
int realIndex(unsigned char value)
|
||||
{
|
||||
return _indexMap.isEmpty() ? (int)value : _indexMap.indexOf(value);
|
||||
}
|
||||
protected:
|
||||
QList<int> _indexMap;
|
||||
unsigned char* _value;
|
||||
#endif // USE_JSON_SETTINGS
|
||||
};
|
||||
|
||||
class RMValueUpdater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMValueUpdater(QObject* parent = nullptr) : QObject(parent){
|
||||
|
||||
}
|
||||
|
||||
// SIGNAL 연동을 위해 사용
|
||||
static RMValueUpdater* instance()
|
||||
{
|
||||
static RMValueUpdater * _instance = 0;
|
||||
if ( _instance == 0 ) {
|
||||
_instance = new RMValueUpdater();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
|
||||
signals:
|
||||
void updateByValues();
|
||||
};
|
||||
|
||||
|
||||
#endif // RM_VALUE_SELECTOR_H
|
||||
Reference in New Issue
Block a user