git-svn-id: svn://db.shs.com.ru/libs@159 a8b55f48-bf90-11e4-a774-851b48703e85
@@ -8,7 +8,6 @@ if (MINGW)
|
||||
endif()
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${PIP_INCLUDES})
|
||||
set(PULT_NAME "cd_pult")
|
||||
option(PULT "Build ${PULT_NAME}" 1)
|
||||
option(LIB "System install" 1)
|
||||
option(DEBUG "Build with -g3" 0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
|
||||
@@ -29,24 +28,6 @@ target_link_libraries(${PROJECT_NAME} ${PIP_LIBRARY})
|
||||
add_executable(cdutilstest "cdutilstest.cpp" "cdtest.h")
|
||||
target_link_libraries(cdutilstest ${PIP_LIBRARY} ${PROJECT_NAME})
|
||||
|
||||
if (NOT DEFINED ENV{QNX_HOST})
|
||||
if (PULT)
|
||||
add_subdirectory(pult)
|
||||
# find_package(Qt4 REQUIRED)
|
||||
# find_package(OpenGL REQUIRED)
|
||||
# include_directories(${QT_INCLUDES})
|
||||
# set(CPPS "kx_pult.cpp" "kx_pult.h" "kx_pult.ui" "main_kx_pult.cpp")
|
||||
# set(MOCS "kx_pult.h")
|
||||
# file(GLOB UIS "*.ui")
|
||||
# file(GLOB RES "*.qrc")
|
||||
# qt4_wrap_cpp(CMOCS ${MOCS} OPTIONS -nw)
|
||||
# qt4_wrap_ui(CUIS ${UIS})
|
||||
# qt4_add_resources(RESS ${RES})
|
||||
# add_executable(${KX_PULT_NAME} WIN32 ${CPPS} ${CMOCS} ${CUIS} ${RESS} ${MOCS})
|
||||
# set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${PIP_LIBRARY} qad_graphic qad_utils qad_widgets)
|
||||
# target_link_libraries(${KX_PULT_NAME} ${LIBS} ${PROJECT_NAME})
|
||||
endif ()
|
||||
endif ()
|
||||
if (LIB)
|
||||
if (WIN32)
|
||||
set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
|
||||
@@ -63,8 +44,3 @@ else ()
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
message(STATUS "Install to local \"bin\"")
|
||||
endif ()
|
||||
#if (NOT DEFINED ENV{QNX_HOST})
|
||||
# if (KX_PULT)
|
||||
# install(TARGETS ${KX_PULT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
# endif ()
|
||||
#endif ()
|
||||
|
||||
@@ -57,11 +57,11 @@ __Core_Initializer__::~__Core_Initializer__() {
|
||||
|
||||
CDCore::CDCore() {
|
||||
setName("CDCore");
|
||||
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
|
||||
PIString s(app_config);
|
||||
connection.configureFromString(&s);
|
||||
datatr.setPacketSize(960);
|
||||
connection.start();
|
||||
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
|
||||
/*PIString s(app_config);
|
||||
connection.configureFromString(&s);
|
||||
connection.start();*/
|
||||
k_.name = "__root__";
|
||||
k_.alias = "root";
|
||||
|
||||
@@ -78,7 +78,7 @@ CDCore::CDCore() {
|
||||
k_.section(11)[3] = KType(3, "1", "1", "88");
|
||||
k_.section(11)[4] = KType(4, "0", "0", "88");
|
||||
k_.section(11)[6] = KType(6, "0", "0", "88");*/
|
||||
//piCout << s;
|
||||
//piCout << s;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,8 @@ void CDCore::k_write(PIIODevice * d) {
|
||||
void CDCore::k_read(PIIODevice * d) {
|
||||
PIConfig conf(d, PIIODevice::ReadOnly);
|
||||
k_.read(&(conf.rootEntry()));
|
||||
k_.makePath();
|
||||
K_ChangedGlobal();
|
||||
PIVector<PIIODevice * > ds = connection.allDevices();
|
||||
// piForeach(PIIODevice * d, ds) {
|
||||
// if (d)
|
||||
@@ -109,6 +111,8 @@ void CDCore::k_read(PIIODevice * d) {
|
||||
|
||||
void CDCore::k_parse(PIIODevice * d) {
|
||||
k_ = CDParser::parse(d, CDType::cdK);
|
||||
k_.makePath();
|
||||
K_ChangedGlobal();
|
||||
k_.name = "__root__";
|
||||
k_.alias = "root";
|
||||
}
|
||||
@@ -126,15 +130,28 @@ void CDCore::k_update(PIIODevice * d) {
|
||||
uk.update(k_, kn);
|
||||
//piCout << k_.count() << uk.count();
|
||||
k_ = uk;
|
||||
k_.makePath();
|
||||
K_ChangedGlobal();
|
||||
}
|
||||
|
||||
|
||||
void CDCore::k_calculate() {
|
||||
k_.calculate();
|
||||
K_ChangedGlobal();
|
||||
}
|
||||
|
||||
|
||||
void CDCore::reinitConnection(const PIString & configuration) {
|
||||
void CDCore::initApp() {
|
||||
init(appConfig());
|
||||
}
|
||||
|
||||
|
||||
void CDCore::initPult() {
|
||||
init(pultConfig());
|
||||
}
|
||||
|
||||
|
||||
void CDCore::init(const PIString & configuration) {
|
||||
PIString c = configuration;
|
||||
connection.stop();
|
||||
connection.removeAllDevices();
|
||||
|
||||
@@ -25,6 +25,8 @@ class CDCore: public PIObject
|
||||
{
|
||||
PIOBJECT(CDUtils::CDCore)
|
||||
friend class __Core_Initializer__;
|
||||
friend class CDSection;
|
||||
friend class KInterface;
|
||||
public:
|
||||
static CDCore * instance() {return __Core_Initializer__::__instance__;}
|
||||
|
||||
@@ -32,23 +34,27 @@ public:
|
||||
EVENT(K_SendFail)
|
||||
EVENT(K_Received)
|
||||
EVENT(K_ReceiveFail)
|
||||
EVENT(K_ChangedGlobal)
|
||||
EVENT1(K_KeepNamesRequest, bool*, kn)
|
||||
EVENT_HANDLER(void, K_Send);
|
||||
EVENT_HANDLER(void, K_Request);
|
||||
|
||||
CDSection k_;
|
||||
|
||||
void k_write(PIIODevice * d);
|
||||
void k_read(PIIODevice * d);
|
||||
void k_parse(PIIODevice * d);
|
||||
void k_update(PIIODevice * d);
|
||||
void k_calculate();
|
||||
PIString pultConfig() {return PIString(pult_config);}
|
||||
PIString appConfig() {return PIString(app_config);}
|
||||
void reinitConnection(const PIString & configuration);
|
||||
void initApp();
|
||||
void initPult();
|
||||
void init(const PIString & configuration);
|
||||
void startPing();
|
||||
bool inProgress() {return sendt.isRunning();}
|
||||
|
||||
CDSection & k() {return k_;}
|
||||
|
||||
static PIString pultConfig() {return PIString(pult_config);}
|
||||
static PIString appConfig() {return PIString(app_config);}
|
||||
|
||||
private:
|
||||
CDCore();
|
||||
~CDCore();
|
||||
@@ -65,6 +71,7 @@ private:
|
||||
PIByteArray send_data;
|
||||
PIThread sendt;
|
||||
PITimer x_timer;
|
||||
CDSection k_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ bool KInterface::configure(const PIString & config, const PIString & sect) {
|
||||
|
||||
|
||||
void KInterface::reinitConnection(const PIString &configuration) {
|
||||
core->reinitConnection(configuration);
|
||||
core->init(configuration);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -231,6 +231,14 @@ CDType & CDSection::operator [](const PIString & name_) {
|
||||
}
|
||||
|
||||
|
||||
CDType & CDSection::operator [](const PIDeque<int> & path_) {
|
||||
if (path_.isEmpty()) return null;
|
||||
CDSection & s(*this);
|
||||
for (int i = 0; i < path_.size_s() - 1; ++i)
|
||||
s = s.section(path_[i]);
|
||||
return s[path_.back()];
|
||||
}
|
||||
|
||||
int CDSection::count(bool recursive) const {
|
||||
int ret = k.size_s();
|
||||
if (recursive) {
|
||||
@@ -333,18 +341,14 @@ void CDSection::read(const void * ep) {
|
||||
|
||||
void CDSection::update(CDSection & v, bool keep_names) {
|
||||
// piCout << "[CDSection] update start";
|
||||
PIMap<PIString, int> vk_ids;
|
||||
PIMap<PIString, PIString> prev_k_f;
|
||||
PISet<int> used;
|
||||
PIMap<int, CDType>::iterator i;
|
||||
for (i = v.k.begin(); i != v.k.end(); ++i)
|
||||
vk_ids[i.value().name_] = i.value().index_;
|
||||
if (keep_names) {
|
||||
for (i = k.begin(); i != k.end(); ++i)
|
||||
prev_k_f[i.value().name_] = i.value().formula();
|
||||
}
|
||||
for (i = k.begin(); i != k.end(); ++i) {
|
||||
if (keep_names) {
|
||||
if (vk_ids.contains(i.value().name_)) {
|
||||
k[i.key()] = v.k[vk_ids[i.value().name_]];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (v.k.contains(i.key())) {
|
||||
PIString f = k[i.key()].formula_;
|
||||
CDType & cdt = v.k[i.key()];
|
||||
@@ -352,10 +356,17 @@ void CDSection::update(CDSection & v, bool keep_names) {
|
||||
k[i.key()] = cdt;
|
||||
used << i.key();
|
||||
}
|
||||
if (keep_names) {
|
||||
CDType & ck(k[i.key()]);
|
||||
if (prev_k_f.contains(ck.name_))
|
||||
ck.setFormula(prev_k_f[ck.name_]);
|
||||
}
|
||||
}
|
||||
for (i = v.k.begin(); i != v.k.end(); ++i) {
|
||||
if (!used.contains(i.key()))
|
||||
k[i.key()] = i.value();
|
||||
CDType & ck(k[i.key()]);
|
||||
ck.setFormula(prev_k_f.value(ck.name_));
|
||||
}
|
||||
used.clear();
|
||||
PIMap<int, CDSection>::iterator j;
|
||||
@@ -415,3 +426,33 @@ void CDSection::calculateRecursive(PIEvaluator * e) {
|
||||
}
|
||||
|
||||
|
||||
void CDSection::makePath(PIDeque<int> p) {
|
||||
PIDeque<int> tp;
|
||||
PIMap<int, CDType>::iterator i;
|
||||
for (i = k.begin(); i != k.end(); ++i) {
|
||||
tp = p;
|
||||
tp << i.key();
|
||||
i.value().path_ = tp;
|
||||
}
|
||||
PIMap<int, CDSection>::iterator j;
|
||||
for (j = s.begin(); j != s.end(); ++j) {
|
||||
tp = p;
|
||||
tp << j.key();
|
||||
j.value().makePath(tp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PIVector<CDType * > CDSection::children(bool recursive) const {
|
||||
PIVector<CDType * > ret;
|
||||
PIMap<int, CDType>::const_iterator i;
|
||||
for (i = k.begin(); i != k.end(); ++i)
|
||||
ret << const_cast<CDType * >(&(i.value()));
|
||||
if (!recursive) return ret;
|
||||
PIMap<int, CDSection>::const_iterator j;
|
||||
for (j = s.begin(); j != s.end(); ++j)
|
||||
ret << j.value().children(true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
operator double() const {return value_d;}
|
||||
const PIStringList & enumValues() const {return enum_values;}
|
||||
const PIString & errorString() const {return error_;}
|
||||
PIDeque<int> path() const {return path_;}
|
||||
|
||||
protected:
|
||||
bool calculate(PIEvaluator * e, PIVector<const CDType * > stack = PIVector<const CDType * >());
|
||||
@@ -44,6 +45,7 @@ protected:
|
||||
PIString value_s, formula_, comment_, error_;
|
||||
PIStringList enum_values;
|
||||
CDSection * parent;
|
||||
PIDeque<int> path_;
|
||||
double value_d;
|
||||
int value_i;
|
||||
bool value_b, calculated;
|
||||
@@ -66,6 +68,8 @@ public:
|
||||
const CDType operator [](int v) const {return k[v];}
|
||||
CDType & operator [](const PIString & name_);
|
||||
const CDType operator [](const PIString & name_) const {return (*this)[name_];}
|
||||
CDType & operator [](const PIDeque<int> & path_);
|
||||
const CDType operator [](const PIDeque<int> & path_) const {return (*this)[path_];}
|
||||
CDSection & section(int v) {return s[v];}
|
||||
const CDSection section(int v) const {return s[v];}
|
||||
|
||||
@@ -75,6 +79,8 @@ public:
|
||||
PIVector<int> indexes() const {return k.keys();}
|
||||
PIStringList index_names() const;
|
||||
void calculate();
|
||||
void makePath(PIDeque<int> p = PIDeque<int>());
|
||||
PIVector<CDType * > children(bool recursive = true) const;
|
||||
|
||||
PIString name;
|
||||
PIString alias;
|
||||
@@ -110,7 +116,7 @@ inline PICout operator <<(PICout s, const CDUtils::CDType & v) {
|
||||
}
|
||||
s << v.name() << "(" << v.index() << ")] = " << v.value();
|
||||
s.restoreControl();
|
||||
return s;\
|
||||
return s;
|
||||
}
|
||||
|
||||
#endif // CDUTILS_TYPES_H
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
project(cd_pult)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
if (NOT LIBPROJECT)
|
||||
find_package(PIP REQUIRED)
|
||||
endif ()
|
||||
if (MINGW)
|
||||
find_package(MinGW REQUIRED)
|
||||
endif()
|
||||
find_package(Qt4 REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${PIP_INCLUDES} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
file(GLOB CPPS "*.cpp")
|
||||
file(GLOB MOCS "*.h")
|
||||
file(GLOB UIS "*.ui")
|
||||
file(GLOB RES "*.qrc")
|
||||
qt4_wrap_cpp(CMOCS ${MOCS} OPTIONS -nw)
|
||||
qt4_wrap_ui(CUIS ${UIS})
|
||||
qt4_add_resources(RESS ${RES})
|
||||
add_executable(${PROJECT_NAME} ${CPPS} ${CMOCS} ${CUIS} ${RESS} ${MOCS})
|
||||
set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${PIP_LIBRARY} qad_graphic qad_utils qad_widgets)
|
||||
target_link_libraries(${PROJECT_NAME} ${LIBS} cd_utils)
|
||||
|
||||
# if (NOT DEFINED ENV{QNX_HOST})
|
||||
# if (PULT)
|
||||
# find_package(Qt4 REQUIRED)
|
||||
# find_package(OpenGL REQUIRED)
|
||||
# include_directories(${QT_INCLUDES})
|
||||
# set(CPPS "kx_pult.cpp" "kx_pult.h" "kx_pult.ui" "main_kx_pult.cpp")
|
||||
# set(MOCS "kx_pult.h")
|
||||
# file(GLOB UIS "*.ui")
|
||||
# file(GLOB RES "*.qrc")
|
||||
# qt4_wrap_cpp(CMOCS ${MOCS} OPTIONS -nw)
|
||||
# qt4_wrap_ui(CUIS ${UIS})
|
||||
# qt4_add_resources(RESS ${RES})
|
||||
# add_executable(${KX_PULT_NAME} WIN32 ${CPPS} ${CMOCS} ${CUIS} ${RESS} ${MOCS})
|
||||
# set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${PIP_LIBRARY} qad_graphic qad_utils qad_widgets)
|
||||
# target_link_libraries(${KX_PULT_NAME} ${LIBS} ${PROJECT_NAME})
|
||||
# endif ()
|
||||
# endif ()
|
||||
# if (LIB)
|
||||
# if (WIN32)
|
||||
# set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
|
||||
# install(FILES ${HDRS_UTILS} DESTINATION ${MINGW_INCLUDE})
|
||||
# install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_LIB})
|
||||
# install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_BIN})
|
||||
# else ()
|
||||
# set(CMAKE_INSTALL_PREFIX /usr)
|
||||
# install(FILES ${HDRS_UTILS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
||||
# install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
# endif ()
|
||||
# message(STATUS "Install to system \"${CMAKE_INSTALL_PREFIX}\"")
|
||||
# else ()
|
||||
# install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
# message(STATUS "Install to local \"bin\"")
|
||||
# endif ()
|
||||
# if (NOT DEFINED ENV{QNX_HOST})
|
||||
# if (KX_PULT)
|
||||
# install(TARGETS ${KX_PULT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
# endif ()
|
||||
# endif ()
|
||||
@@ -1,309 +0,0 @@
|
||||
#include "cd_kmodel.h"
|
||||
#include "cdutils_k.h"
|
||||
#include "piqt.h"
|
||||
#include <QDebug>
|
||||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include "qvariantedit.h"
|
||||
|
||||
using namespace CDUtils;
|
||||
|
||||
|
||||
CDKItemModel::CDKItemModel(QObject *parent) : QAbstractItemModel(parent) {
|
||||
root = 0;
|
||||
internalRebuild();
|
||||
}
|
||||
|
||||
|
||||
CDKItemModel::~CDKItemModel() {
|
||||
delete root;
|
||||
}
|
||||
|
||||
|
||||
QVariant CDKItemModel::data(const QModelIndex &index, int role) const {
|
||||
if (!index.isValid()) return QVariant();
|
||||
CDKItem *item = getItem(index);
|
||||
return item->data(index.column(), role);
|
||||
}
|
||||
|
||||
|
||||
QVariant CDKItemModel::headerData(int section, Qt::Orientation orientation, int role) const {
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||
switch (section) {
|
||||
case 0: return trUtf8("Index");
|
||||
case 1: return trUtf8("Name");
|
||||
case 2: return trUtf8("Type");
|
||||
case 3: return trUtf8("Expression");
|
||||
case 4: return trUtf8("Value");
|
||||
case 5: return trUtf8("Comment");
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QModelIndex CDKItemModel::index(int row, int column, const QModelIndex &parent) const {
|
||||
if (parent.isValid() && parent.column() != 0) return QModelIndex();
|
||||
CDKItem * p = getItem(parent);
|
||||
CDKItem * c = p->childs.value(row, 0);
|
||||
if (c) return createIndex(row, column, c);
|
||||
else return QModelIndex();
|
||||
}
|
||||
|
||||
|
||||
QModelIndex CDKItemModel::parent(const QModelIndex &index) const {
|
||||
if (!index.isValid()) return QModelIndex();
|
||||
CDKItem * c = getItem(index);
|
||||
CDKItem * p = c->parent_;
|
||||
if (p == root) return QModelIndex();
|
||||
return createIndex(p->parent_->childs.indexOf(p), 0, p);
|
||||
}
|
||||
|
||||
|
||||
int CDKItemModel::rowCount(const QModelIndex &parent) const {
|
||||
CDKItem *p = getItem(parent);
|
||||
return p->childs.count();
|
||||
}
|
||||
|
||||
|
||||
int CDKItemModel::columnCount(const QModelIndex &parent) const {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
Qt::ItemFlags CDKItemModel::flags(const QModelIndex &index) const {
|
||||
if (!index.isValid()) return 0;
|
||||
Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
CDKItem * item = getItem(index);
|
||||
if ((index.column() == 3 || index.column() == 4) && item->type_ == CDKItem::ItemCDType) f |= Qt::ItemIsEditable;
|
||||
if (item->type_ == CDKItem::ItemCDType && index.column() == 4) {
|
||||
CDType t = K.section(item->buildPath())[item->index_];
|
||||
if (t.type() == "b") {
|
||||
f |= Qt::ItemIsUserCheckable;
|
||||
// piCout << "ItemIsUserCheckable";
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
bool CDKItemModel::setData(const QModelIndex &index, const QVariant &value, int role) {
|
||||
if (role == Qt::CheckStateRole && index.column() == 4) {
|
||||
CDKItem * item = getItem(index);
|
||||
if (item->type_ == CDKItem::ItemCDType) {
|
||||
CDType t = K.section(item->buildPath())[item->index_];
|
||||
if (t.type() == "b") {
|
||||
bool result = item->setData(index.column(), PI2QString(PIString::fromBool(value.toBool())));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (role != Qt::EditRole) return false;
|
||||
CDKItem * item = getItem(index);
|
||||
bool result = item->setData(index.column(), value);
|
||||
if (result) emit dataChanged(index, index);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void CDKItemModel::rebuildModel() {
|
||||
beginResetModel();
|
||||
internalRebuild();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
||||
void CDKItemModel::buildItem(CDKItem *it, CDSection & r) {
|
||||
//piCout << "build item" << r.name << r.alias;
|
||||
PIMap<int, CDType>::iterator i;
|
||||
for (i = r.k.begin(); i != r.k.end(); ++i) {
|
||||
it->childs << new CDKItem(i.key(), CDKItem::ItemCDType, it);
|
||||
}
|
||||
PIMap<int, CDSection>::iterator j;
|
||||
for (j = r.s.begin(); j != r.s.end(); ++j) {
|
||||
it->childs << new CDKItem(j.key(), CDKItem::ItemCDSection, it);
|
||||
buildItem(it->childs.back(), j.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CDKItemModel::internalRebuild() {
|
||||
//qDebug() << "[CDKItemModel]" << "internalRebuild()";
|
||||
if (root) delete root;
|
||||
root = new CDKItem(0, CDKItem::ItemCDSection, 0);
|
||||
CDSection & r = K.root();
|
||||
buildItem(root, r);
|
||||
}
|
||||
|
||||
|
||||
CDKItem * CDKItemModel::getItem(const QModelIndex &index) const {
|
||||
if (index.isValid()) {
|
||||
CDKItem * item = static_cast<CDKItem*>(index.internalPointer());
|
||||
if (item) return item;
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
// CDKItem
|
||||
|
||||
CDKItem::CDKItem(int index, CDKItem::CDKItemType type, CDKItem *parent) {
|
||||
index_ = index;
|
||||
parent_ = parent;
|
||||
type_ = type;
|
||||
}
|
||||
|
||||
|
||||
CDKItem::~CDKItem() {
|
||||
qDeleteAll(childs);
|
||||
}
|
||||
|
||||
|
||||
QVariant CDKItem::data(int column, int role) const {
|
||||
if (role == Qt::BackgroundRole) {
|
||||
switch (type_) {
|
||||
case ItemCDType: {
|
||||
CDType & t = K.section(buildPath())[index_];
|
||||
if (t.errorString().isEmpty()) return QBrush(QColor(255, 250, 230));
|
||||
else return QBrush(QColor(255, 128, 128));
|
||||
}
|
||||
case ItemCDSection: return QBrush(QColor(230, 250, 230));
|
||||
}
|
||||
}
|
||||
if (role == Qt::CheckStateRole && type_ == ItemCDType && column == 4) {
|
||||
CDType & t = K.section(buildPath())[index_];
|
||||
if (t.type() == "b") return t.toBool() ? Qt::Checked : Qt::Unchecked;
|
||||
else QVariant();
|
||||
}
|
||||
if (role == Qt::ToolTipRole && type_ == ItemCDType) {
|
||||
CDType & t = K.section(buildPath())[index_];
|
||||
return PI2QString(t.errorString());
|
||||
}
|
||||
if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant();
|
||||
PIDeque<int> path = buildPath();
|
||||
CDSection & rs = K.section(path);
|
||||
CDSection s;
|
||||
switch (type_) {
|
||||
case ItemCDType:
|
||||
switch (column) {
|
||||
case 0: return QString::number(index_);
|
||||
case 1: return PI2QString(rs[index_].name());
|
||||
case 2: return stringType(rs[index_].type());
|
||||
case 3: return PI2QString(rs[index_].formula());
|
||||
case 4: return value(rs[index_], role);
|
||||
case 5: return PI2QString(rs[index_].comment());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ItemCDSection:
|
||||
s = rs.section(index_);
|
||||
// piCout << rs.name << rs.alias << s.name << s.alias;
|
||||
switch (column) {
|
||||
case 0: return QString("[") + QString::number(index_) + QString("]");
|
||||
case 1: return PI2QString(s.alias);
|
||||
case 2: return PI2QString(s.name);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QVariant CDKItem::value(CDType t, int role) const {
|
||||
if (t.type() == "f") return t.toDouble();
|
||||
if (t.type() == "n") return t.toInt();
|
||||
if (t.type() == "b") return t.toBool();
|
||||
if (t.type() == "e") {
|
||||
QVariantEdit::EnumType et;
|
||||
et.enum_list = PI2QStringList(t.enumValues());
|
||||
et.value = et.enum_list.at(t.toInt());//et.enum_list.indexOf("");
|
||||
if (role == Qt::EditRole)return QVariant::fromValue<QVariantEdit::EnumType>(et);
|
||||
else return et.value;
|
||||
}
|
||||
return PI2QString(t.value());
|
||||
}
|
||||
|
||||
|
||||
bool CDKItem::setData(int column, const QVariant &value) {
|
||||
if ((column == 3 || column == 4) && type_ == ItemCDType) {
|
||||
K.section(buildPath())[index_].setValue(Q2PIString(value.toString()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
PIDeque<int> CDKItem::buildPath() const {
|
||||
PIDeque<int> path;
|
||||
CDKItem * p = parent_;
|
||||
while (p) {
|
||||
path.push_front(p->index_);
|
||||
p = p->parent_;
|
||||
}
|
||||
path.take_front();
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
QString CDKItem::stringType(const PIString & t) const {
|
||||
QString n = PI2QString(t);
|
||||
if (n.isEmpty()) return QString("");
|
||||
switch (n[0].toLatin1()) {
|
||||
case 'l': return QString("list"); break;
|
||||
case 'b': return QString("bool"); break;
|
||||
case 'n': return QString("int"); break;
|
||||
case 'f': return QString("double"); break;
|
||||
case 'c': return QString("color"); break;
|
||||
case 'r': return QString("rect"); break;
|
||||
case 'a': return QString("rect"); break;
|
||||
case 'p': return QString("point"); break;
|
||||
case 'v': return QString("vector"); break;
|
||||
case 'i': return QString("IP"); break;
|
||||
case 'e': return QString("enum"); break;
|
||||
case 'F': return QString("file"); break;
|
||||
case 'D': return QString("dir"); break;
|
||||
}
|
||||
return QString("double");
|
||||
}
|
||||
|
||||
|
||||
// CDKDelegate
|
||||
|
||||
CDKDelegate::CDKDelegate(QObject *parent) : QStyledItemDelegate(parent) {
|
||||
}
|
||||
|
||||
|
||||
QWidget *CDKDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
return new QVariantEdit(parent);
|
||||
}
|
||||
|
||||
|
||||
void CDKDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {
|
||||
QVariantEdit *edit = static_cast<QVariantEdit*>(editor);
|
||||
edit->setValue(index.model()->data(index, Qt::EditRole));
|
||||
}
|
||||
|
||||
|
||||
void CDKDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
|
||||
QVariantEdit *edit = static_cast<QVariantEdit*>(editor);
|
||||
QVariant v = edit->value();
|
||||
if (v.canConvert<QVariantEdit::EnumType>()) {
|
||||
QVariantEdit::EnumType et = v.value<QVariantEdit::EnumType>();
|
||||
model->setData(index, et.enum_list.indexOf(et.value), Qt::EditRole);
|
||||
} else model->setData(index, v, Qt::EditRole);
|
||||
}
|
||||
|
||||
|
||||
void CDKDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
|
||||
|
||||
QSize CDKDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
QSize s = QStyledItemDelegate::sizeHint(option, index);
|
||||
s.setWidth(s.width() + 20);
|
||||
return s;
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#ifndef CD_KMODEL_H
|
||||
#define CD_KMODEL_H
|
||||
|
||||
//#include "cdutils_k.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include <QItemDelegate>
|
||||
#include <QStyledItemDelegate>
|
||||
#include "pistring.h"
|
||||
|
||||
namespace CDUtils {
|
||||
class CDSection;
|
||||
class CDType;
|
||||
}
|
||||
class CDKItemModel;
|
||||
|
||||
class CDKItem {
|
||||
friend class CDKItemModel;
|
||||
public:
|
||||
enum CDKItemType{ItemCDType, ItemCDSection};
|
||||
CDKItem(int index, CDKItemType type, CDKItem * parent);
|
||||
~CDKItem();
|
||||
QVariant data(int column, int role) const;
|
||||
QVariant value(CDUtils::CDType t, int role) const;
|
||||
bool setData(int column, const QVariant & value);
|
||||
|
||||
private:
|
||||
PIDeque<int> buildPath() const;
|
||||
QString stringType(const PIString & t) const;
|
||||
|
||||
CDKItem * parent_;
|
||||
int index_;
|
||||
CDKItemType type_;
|
||||
QList<CDKItem *> childs;
|
||||
};
|
||||
|
||||
|
||||
class CDKDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDKDelegate(QObject *parent = 0);
|
||||
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
|
||||
class CDKItemModel : public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CDKItemModel(QObject *parent = 0);
|
||||
~CDKItemModel();
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
|
||||
void rebuildModel();
|
||||
void buildItem(CDKItem * it, CDUtils::CDSection &r);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
void internalRebuild();
|
||||
CDKItem * getItem(const QModelIndex & index) const;
|
||||
|
||||
CDKItem * root;
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // CD_KMODEL_H
|
||||
@@ -1,549 +0,0 @@
|
||||
#include <QScrollBar>
|
||||
#include <QMessageBox>
|
||||
#include <math.h>
|
||||
#include "cd_pult.h"
|
||||
#include "ui_cd_pult.h"
|
||||
#include "piqt.h"
|
||||
#include "pifile.h"
|
||||
#include "qpiconfig.h"
|
||||
|
||||
using namespace CDUtils;
|
||||
|
||||
|
||||
CD_Pult::CD_Pult(): QMainWindow(), config_("cd_pult.conf"),
|
||||
config(piqt(config_), QIODevice::ReadWrite) {
|
||||
//cout << sizeof(coeffsK.k_protocol->to_k) << endl;
|
||||
ui = new Ui::CD_Pult();
|
||||
ui->setupUi(this);
|
||||
ui->configWidget->setQPIConfig(&config);
|
||||
ui->configWidget->expandAll();
|
||||
ui->list->viewport()->installEventFilter(this);
|
||||
ui->treeK->viewport()->installEventFilter(this);
|
||||
ui->scrollArea->setAutoFillBackground(false);
|
||||
ui->scrollAreaWidgetContents->setAutoFillBackground(false);
|
||||
ui->widget->setAutoFillBackground(false);
|
||||
log_menu.addAction(ui->actionClear);
|
||||
show_x = config.getValue("show_x", true);
|
||||
if (!show_x)
|
||||
ui->tabWidget->removeTab(1);
|
||||
session.setFile("session_cd_pult.conf");
|
||||
session.addEntry(this);
|
||||
session.addEntry(ui->tabWidget);
|
||||
session.addEntry(ui->checkKHideNormal);
|
||||
session.addEntry(ui->checkKHideExpressions);
|
||||
session.addEntry(ui->checkKAutoCalculate);
|
||||
session.addEntry(ui->spinHistory);
|
||||
session.addEntry(ui->spinBuffer);
|
||||
needWrite = isPause = false;
|
||||
timer = 0;
|
||||
//x.resize(KX_X_PACKET_NUM);
|
||||
//k.resize(K_NUM);
|
||||
QPalette pal = palette();
|
||||
QColor col;
|
||||
ui->graphic->setGraphicsCount(0);
|
||||
//renew();
|
||||
ui->treeK->setColumnWidth(0, 60);
|
||||
ui->treeK->setColumnWidth(1, 250);
|
||||
ui->treeK->setColumnWidth(3, 100);
|
||||
ui->treeK->setColumnWidth(4, 100);
|
||||
//ui->table->setK(coeffsK.k()->data(), coeffsK.count());
|
||||
//addToList(trUtf8("Read K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(coeffs.fileName())).arg(K.size_s()).arg(coeffs.k_content.size_s()), Qt::darkMagenta);
|
||||
/*CONNECT(void, &coeffs, sendFailed, this, pip_sendFailed);
|
||||
CONNECT(void, &coeffs, sendSucceed, this, pip_sendSucceed);
|
||||
CONNECT(void, &coeffs, receiveFailed, this, pip_receiveFailed);
|
||||
CONNECT(void, &coeffs, receiveSucceed, this, pip_receiveSucceed);*/
|
||||
kmodel = new CDKItemModel();
|
||||
ui->treeCDK->setModel(kmodel);
|
||||
delegate = new CDKDelegate();
|
||||
ui->treeCDK->setItemDelegateForColumn(4, delegate);
|
||||
CONNECTU(&K, sended, this, pip_sendSucceed);
|
||||
CONNECTU(&K, sendFailed, this, pip_sendFailed);
|
||||
CONNECTU(&K, received, this, pip_receiveSucceed);
|
||||
CONNECTU(&K, receiveFailed, this, pip_receiveFailed);
|
||||
connect(this, SIGNAL(q_k_sendFailed()), this, SLOT(k_sendFailed()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(q_k_sendSucceed()), this, SLOT(k_sendSucceed()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(q_k_receiveFailed()), this, SLOT(k_receiveFailed()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(q_k_receiveSucceed()), this, SLOT(k_receiveSucceed()), Qt::QueuedConnection);
|
||||
connect(&timer_diag, SIGNAL(timeout()), this, SLOT(updateDiag()));
|
||||
connect(&session, SIGNAL(loading(QPIConfig&)), this, SLOT(loading(QPIConfig&)));
|
||||
connect(&session, SIGNAL(saving(QPIConfig&)), this, SLOT(saving(QPIConfig&)));
|
||||
connect(ui->checkKHideNormal, SIGNAL(toggled(bool)), this, SLOT(filterTree()));
|
||||
connect(ui->checkKHideExpressions, SIGNAL(toggled(bool)), this, SLOT(filterTree()));
|
||||
connect(ui->lineKSearch, SIGNAL(textChanged(QString)), this, SLOT(filterTree()));
|
||||
session.load();
|
||||
on_spinBuffer_editingFinished();
|
||||
K.reinitConnection(K.pultConfig());
|
||||
K.configure(config_);
|
||||
K.readFile();
|
||||
updateKDesc();
|
||||
updateCDesc();
|
||||
timer_diag.start(40);
|
||||
}
|
||||
|
||||
|
||||
CD_Pult::~CD_Pult() {
|
||||
session.save();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::loading(QPIConfig & conf) {
|
||||
kdesc_file = Q2PIString(conf.getValue("kdesc_file").stringValue());
|
||||
cdesc_file = Q2PIString(conf.getValue("cdesc_file").stringValue());
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::saving(QPIConfig & conf) {
|
||||
conf.setValue("kdesc_file", PI2QString(kdesc_file));
|
||||
conf.setValue("cdesc_file", PI2QString(cdesc_file));
|
||||
}
|
||||
|
||||
|
||||
bool CD_Pult::eventFilter(QObject * o, QEvent * e) {
|
||||
if (o == ui->list->viewport()) {
|
||||
if (e->type() == QEvent::ContextMenu) {
|
||||
clear_target = 0;
|
||||
log_menu.popup(((QContextMenuEvent*)e)->globalPos());
|
||||
}
|
||||
return QMainWindow::eventFilter(o, e);
|
||||
}
|
||||
if (o == ui->treeK->viewport()) {
|
||||
if (e->type() == QEvent::ContextMenu) {
|
||||
clear_target = 1;
|
||||
log_menu.popup(((QContextMenuEvent*)e)->globalPos());
|
||||
}
|
||||
return QMainWindow::eventFilter(o, e);
|
||||
}
|
||||
//int ind = o->property("index").toInt();
|
||||
//qDebug() << "event" << i << e->type();
|
||||
switch (e->type()) {
|
||||
case QEvent::Enter:
|
||||
ui->graphic->setAutoUpdate(false);
|
||||
//for (int i = 0; i < KX_X_PACKET_NUM; ++i)
|
||||
// ui->graphic->setGraphicLineWidth(ind == i ? 3. : 1., i);
|
||||
ui->graphic->setAutoUpdate(true);
|
||||
ui->graphic->update();
|
||||
break;
|
||||
case QEvent::Leave:
|
||||
ui->graphic->setAutoUpdate(false);
|
||||
//for (int i = 0; i < KX_X_PACKET_NUM; ++i)
|
||||
// ui->graphic->setGraphicLineWidth(1., i);
|
||||
ui->graphic->setAutoUpdate(true);
|
||||
ui->graphic->update();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return QMainWindow::eventFilter(o, e);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::timerEvent(QTimerEvent * e) {
|
||||
/*if (e->timerId() == timer_update) {
|
||||
if (need_update) {
|
||||
need_update = false;
|
||||
ui->graphic->updateGraphics();
|
||||
}
|
||||
}*/
|
||||
if (e->timerId() == timer) {
|
||||
static QString sPI = QString::number(atan(1) * 4., 'f', 14).leftJustified(14);
|
||||
static int cnt = 0;
|
||||
int si = qMax<int>(cnt - 6, 0);
|
||||
++cnt;
|
||||
cnt %= 23;
|
||||
ui->labelWait->setText(QString(si, QChar(' ')) + sPI.mid(cnt - 6, 6).trimmed());
|
||||
//if (!coeffs.isReady()) return;
|
||||
//ui->table->setK(coeffsK.k()->data(), coeffsK.count());
|
||||
//ui->table->showK();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::addToList(const QString & s, const QColor & c) {
|
||||
ui->list->addItem(QDateTime::currentDateTime().toString("dd/MM/yyyy hh:ss - ") + s);
|
||||
ui->list->item(ui->list->count() - 1)->setTextColor(c);
|
||||
ui->list->scrollToBottom();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_actionClear_triggered() {
|
||||
switch (clear_target) {
|
||||
case 0:
|
||||
ui->list->clear();
|
||||
break;
|
||||
case 1:
|
||||
clearSelected();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::clearSelected() {
|
||||
QList<QTreeWidgetItem * > si = ui->treeK->selectedItems();
|
||||
ui->treeK->setUpdatesEnabled(false);
|
||||
ui->treeK->blockSignals(true);
|
||||
foreach (QTreeWidgetItem * i, si) {
|
||||
// int ki = i->text(0).toInt();
|
||||
i->setText(2, "");
|
||||
//coeffs.setFormula(ki, "");
|
||||
}
|
||||
ui->treeK->blockSignals(false);
|
||||
ui->treeK->setUpdatesEnabled(true);
|
||||
if (ui->checkKAutoCalculate->isChecked()) {
|
||||
QApplication::processEvents();
|
||||
//calculate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString CD_Pult::typeName(const QString & n) const {
|
||||
if (n.isEmpty()) return "";
|
||||
switch (n[0].toLatin1()) {
|
||||
case 'l': return trUtf8("list"); break;
|
||||
case 'b': return trUtf8("bool"); break;
|
||||
case 'n': return trUtf8("int"); break;
|
||||
case 'f': return trUtf8("double"); break;
|
||||
case 'c': return trUtf8("color"); break;
|
||||
case 'r': return trUtf8("rect"); break;
|
||||
case 'a': return trUtf8("rect"); break;
|
||||
case 'p': return trUtf8("point"); break;
|
||||
case 'v': return trUtf8("vector"); break;
|
||||
case 'i': return trUtf8("IP"); break;
|
||||
case 'e': return trUtf8("enum"); break;
|
||||
case 'F': return trUtf8("file"); break;
|
||||
case 'D': return trUtf8("dir"); break;
|
||||
}
|
||||
return trUtf8("double");
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::makeTreeSection(CDSection & ks, QTreeWidgetItem * pi) {
|
||||
PIMap<int, CDType>::iterator ki;
|
||||
for (ki = ks.k.begin(); ki != ks.k.end(); ++ki) {
|
||||
QTreeWidgetItem * ti = new QTreeWidgetItem(pi);
|
||||
const CDType & ck(ki.value());
|
||||
ti->setText(0, QString::number(ck.index()));
|
||||
ti->setText(1, PI2QString(ck.name()));
|
||||
ti->setText(2, typeName(PI2QString(ck.type())));
|
||||
ti->setText(3, PI2QString(ck.formula()));
|
||||
ti->setText(5, PI2QString(ck.comment()));
|
||||
}
|
||||
PIMap<int, CDSection>::iterator si;
|
||||
for (si = ks.s.begin(); si != ks.s.end(); ++si) {
|
||||
QTreeWidgetItem * ti = new QTreeWidgetItem(pi);
|
||||
CDSection & cs(si.value());
|
||||
ti->setText(0, QString("[%1]").arg(si.key()));
|
||||
ti->setText(1, PI2QString(cs.alias));
|
||||
ti->setText(2, PI2QString(cs.name));
|
||||
makeTreeSection(cs, ti);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_treeK_itemClicked(QTreeWidgetItem * item, int column) {
|
||||
Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
if (column == 2) f |= Qt::ItemIsEditable;
|
||||
item->setFlags(f);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_treeK_itemChanged(QTreeWidgetItem * item, int column) {
|
||||
if (column != 2) return;
|
||||
// int ki = item->text(0).toInt();
|
||||
//coeffs.setFormula(ki, piqt(item->text(column)));
|
||||
if (ui->checkKAutoCalculate->isChecked())
|
||||
;//calculate();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonSendK_clicked() {
|
||||
// on_buttonWrite_clicked();
|
||||
K.send();
|
||||
//coeffs.sendCoeffs();
|
||||
if (timer != 0) killTimer(timer);
|
||||
timer = startTimer(100);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonReceiveK_clicked() {
|
||||
K.request();
|
||||
// K.se
|
||||
//coeffs.receiveCoeffs();
|
||||
if (timer != 0) killTimer(timer);
|
||||
timer = startTimer(100);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonShowAll_clicked() {
|
||||
/*for (int i = 0; i < KX_X_PACKET_NUM; ++i) {
|
||||
checks[i]->check.setChecked(true);
|
||||
//ui->graphic->setGraphicVisible(true, i);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonHideAll_clicked() {
|
||||
/*for (int i = 0; i < KX_X_PACKET_NUM; ++i) {
|
||||
checks[i]->check.setChecked(false);
|
||||
//ui->graphic->setGraphicVisible(false, i);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonRead_clicked() {
|
||||
K.readFile();
|
||||
addToList(trUtf8("Read K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(K.file())).arg(K.count()).arg(K.fileSize()), Qt::darkMagenta);
|
||||
updateTree();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonWrite_clicked() {
|
||||
K.writeFile();
|
||||
addToList(trUtf8("Write K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(K.file())).arg(K.count()).arg(K.fileSize()), Qt::darkMagenta);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonSetKDesc_clicked() {
|
||||
QString ret = QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with K description"), PI2QString(kdesc_file), "C/C++ header files(*.h *.hpp);;All files(*)");
|
||||
if (ret.isEmpty()) return;
|
||||
kdesc_file = Q2PIString(QDir::current().relativeFilePath(ret));
|
||||
PIFile f(kdesc_file, PIIODevice::ReadOnly);
|
||||
piCout << "open description:" << Q2PIString(ret);
|
||||
//K.update(&f);
|
||||
updateKDesc(true);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_buttonSetCDesc_clicked() {
|
||||
QString ret = QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with C description"), PI2QString(cdesc_file), "C/C++ header files(*.h *.hpp);;All files(*)");
|
||||
if (ret.isEmpty()) return;
|
||||
cdesc_file = Q2PIString(QDir::current().relativeFilePath(ret));
|
||||
updateCDesc();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::k_sendFailed() {
|
||||
addToList(trUtf8("K not sended"), Qt::darkRed);
|
||||
if (timer != 0) killTimer(timer);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::k_sendSucceed() {
|
||||
addToList(trUtf8("K sended"), Qt::darkGreen);;
|
||||
if (timer != 0) killTimer(timer);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::k_receiveFailed() {
|
||||
addToList(trUtf8("K not received"), Qt::darkRed);
|
||||
if (timer != 0) killTimer(timer);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::k_receiveSucceed() {
|
||||
addToList(trUtf8("K received"), Qt::darkGreen);
|
||||
if (timer != 0) killTimer(timer);
|
||||
updateTree();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::on_spinBuffer_editingFinished() {
|
||||
ui->graphic->setHistorySize(ui->spinBuffer->value());
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::updateGraph() {
|
||||
ui->graphic->updateGraphics();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::updateDiag() {
|
||||
/*ui->labelKReceiver->setText(piqt(coeffs.k_protocol->receiverDeviceName() + " - " + coeffs.k_protocol->receiverDeviceState()));
|
||||
ui->labelKSender->setText(piqt(coeffs.k_protocol->senderDeviceName()));
|
||||
ui->spinKSended->setValue(coeffs.k_protocol->sendCount());
|
||||
ui->spinKReceived->setValue(coeffs.k_protocol->receiveCount());
|
||||
ui->spinKWrong->setValue(coeffs.k_protocol->wrongCount());
|
||||
ui->spinKMissed->setValue(coeffs.k_protocol->missedCount());
|
||||
ui->labelKType->setText("0x" + QString::number(coeffs.k_protocol->from_k.type, 16).toUpper().rightJustified(2, '0'));
|
||||
ui->labelKAddrPult->setText("0x" + QString::number(coeffs.k_protocol->from_k.addr_to, 16).toUpper().rightJustified(2, '0'));
|
||||
ui->labelKAddr->setText("0x" + QString::number(coeffs.k_protocol->to_k.addr_to, 16).toUpper().rightJustified(2, '0'));
|
||||
|
||||
ui->labelXReceiver->setText(piqt(prot_x->receiverDeviceName() + " - " + prot_x->receiverDeviceState()));
|
||||
ui->labelXSender->setText(piqt(prot_x->senderDeviceName()));
|
||||
ui->spinXSended->setValue(prot_x->sendCount());
|
||||
ui->spinXReceived->setValue(prot_x->receiveCount());
|
||||
ui->spinXWrong->setValue(prot_x->wrongCount());
|
||||
ui->spinXMissed->setValue(prot_x->missedCount());
|
||||
ui->labelXType->setText("0x" + QString::number(prot_x->from_x.type, 16).toUpper().rightJustified(2, '0'));
|
||||
ui->labelXAddrPult->setText("0x" + QString::number(prot_x->from_x.addr_to, 16).toUpper().rightJustified(2, '0'));
|
||||
ui->labelXAddr->setText("0x" + QString::number(prot_x->to_x.addr_to, 16).toUpper().rightJustified(2, '0'));
|
||||
|
||||
ui->labelCReceiver->setText(piqt(prot_c->receiverDeviceName() + " - " + prot_c->receiverDeviceState()));
|
||||
ui->labelCSender->setText(piqt(prot_c->senderDeviceName()));
|
||||
ui->spinCSended->setValue(prot_c->sendCount());
|
||||
ui->spinCReceived->setValue(prot_c->receiveCount());
|
||||
ui->spinCWrong->setValue(prot_c->wrongCount());
|
||||
ui->spinCMissed->setValue(prot_c->missedCount());
|
||||
ui->labelCType->setText("0x" + QString::number(prot_c->from_c.type, 16).toUpper().rightJustified(2, '0'));
|
||||
ui->labelCAddrPult->setText("0x" + QString::number(prot_c->from_c.addr_to, 16).toUpper().rightJustified(2, '0'));
|
||||
ui->labelCAddr->setText("0x" + QString::number(prot_c->to_c.addr_to, 16).toUpper().rightJustified(2, '0'));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::updateKDesc(bool ask_move) {
|
||||
addToList(trUtf8("Update K description file \"%1\"").arg(PI2QString(kdesc_file)), Qt::darkMagenta);
|
||||
PIFile f(kdesc_file, PIIODevice::ReadOnly);
|
||||
//piCout << "call K.update():";
|
||||
K.root() = CDSection();
|
||||
K.update(&f);
|
||||
updateTree(ask_move);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::updateCDesc() {
|
||||
//parseHeader(cdesc_file, cdesc);
|
||||
updateCommands();
|
||||
}
|
||||
|
||||
|
||||
bool stringComp(const QString & s1, const QString & s2) {
|
||||
if (s1.size() != s2.size())
|
||||
return s1.size() > s2.size();
|
||||
return s1 > s2;
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::updateTree(bool move) {
|
||||
int sp = ui->treeK->verticalScrollBar()->value();
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
//qDebug() << "fill tree ...";
|
||||
ui->treeK->clear();
|
||||
ui->treeK->setUpdatesEnabled(false);
|
||||
eval.clearCustomVariables();
|
||||
CDSection r = K.root();
|
||||
makeTreeSection(r, ui->treeK->invisibleRootItem());
|
||||
/*for (int i = 0; i < K.size_s(); ++i) {
|
||||
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
||||
KDesc kd = kdesc[i];
|
||||
QString kn = QString("k%1").arg(i);
|
||||
knames[kn] = i;
|
||||
knames_sort << kn;
|
||||
if (eval.content.findVariable(kn) < 0)
|
||||
eval.content.addVariable(kn, 0., false);
|
||||
if (!kd.name.isEmpty()) {
|
||||
knames[kd.name] = i;
|
||||
knames_sort << kd.name;
|
||||
eval.content.addVariable(kd.name, 0., false);
|
||||
}
|
||||
if (move && !kd.name.isEmpty()) {
|
||||
if (prev_val.contains(kd.name))
|
||||
coeffs.setFormula(i, Q2PIString(prev_val[kd.name]));
|
||||
}
|
||||
ti->setText(0, QString::number(i));
|
||||
ti->setText(1, kd.name);
|
||||
ti->setText(2, PI2QString(coeffs.formula(i)));
|
||||
ti->setText(3, QString::number(K[i]));
|
||||
ti->setText(4, typeName(kd.type));
|
||||
ti->setText(5, kd.comment);
|
||||
ui->treeK->addTopLevelItem(ti);
|
||||
}*/
|
||||
eval.content.sortVariables();
|
||||
//qDebug() << "fill tree ok";
|
||||
//qDebug() << "sort ...";
|
||||
qSort(knames_sort.begin(), knames_sort.end(), stringComp);
|
||||
//qDebug() << "names" << knames_sort;
|
||||
//qDebug() << "sort ok";
|
||||
QApplication::restoreOverrideCursor();
|
||||
ui->treeK->setUpdatesEnabled(true);
|
||||
ui->treeK->verticalScrollBar()->setValue(sp);
|
||||
//calculate();
|
||||
filterTree();
|
||||
kmodel->rebuildModel();
|
||||
ui->treeCDK->expandAll();
|
||||
for (int i=0; i<6; i++) ui->treeCDK->resizeColumnToContents(i);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::updateCommands() {
|
||||
while (ui->layoutCommands->count() > 0)
|
||||
delete ui->layoutCommands->itemAt(0)->widget();
|
||||
/*QMapIterator<int, KDesc> it(cdesc);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
KDesc kd = it.value();
|
||||
QPushButton * b = new QPushButton();
|
||||
QString text = kd.name;
|
||||
if (!kd.comment.isEmpty())
|
||||
text += QString("\n(%1)").arg(kd.comment);
|
||||
b->setText(text);
|
||||
b->setProperty("_command", kd.index);
|
||||
connect(b, SIGNAL(clicked()), this, SLOT(commandClicked()));
|
||||
ui->layoutCommands->addWidget(b);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::filterTree() {
|
||||
bool hn = ui->checkKHideNormal->isChecked();
|
||||
bool hs = ui->checkKHideExpressions->isChecked();
|
||||
bool ok = false;
|
||||
QString fl = ui->lineKSearch->text();
|
||||
int lc = ui->treeK->topLevelItemCount();
|
||||
for (int i = 0; i < lc; ++i) {
|
||||
QTreeWidgetItem * ti = ui->treeK->topLevelItem(i);
|
||||
if (fl.isEmpty())
|
||||
ti->setHidden(false);
|
||||
else
|
||||
ti->setHidden(!ti->text(0).contains(fl, Qt::CaseInsensitive) &&
|
||||
!ti->text(1).contains(fl, Qt::CaseInsensitive) &&
|
||||
!ti->text(2).contains(fl, Qt::CaseInsensitive) &&
|
||||
!ti->text(3).contains(fl, Qt::CaseInsensitive) &&
|
||||
!ti->text(4).contains(fl, Qt::CaseInsensitive));
|
||||
if (hn)
|
||||
if (ti->data(0, Qt::UserRole).toBool())
|
||||
ti->setHidden(true);
|
||||
if (hs) {
|
||||
ti->data(2, Qt::DisplayRole).toDouble(&ok);
|
||||
if (!ok)
|
||||
ti->setHidden(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::markError(QTreeWidgetItem * item, const QString & tool_tip) {
|
||||
int cc = item->columnCount();
|
||||
for (int i = 0; i < cc; ++i)
|
||||
item->setBackgroundColor(i, QColor(255, 200, 200));
|
||||
if (item->toolTip(2).isEmpty())
|
||||
item->setToolTip(2, tool_tip);
|
||||
if (item->toolTip(3).isEmpty())
|
||||
item->setToolTip(3, tool_tip);
|
||||
item->setData(0, Qt::UserRole, false);
|
||||
item->setText(3, "Error");
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::markNormal(QTreeWidgetItem * item) {
|
||||
int cc = item->columnCount();
|
||||
for (int i = 0; i < cc; ++i)
|
||||
item->setBackground(i, Qt::NoBrush);
|
||||
item->setToolTip(2, QString());
|
||||
item->setToolTip(3, QString());
|
||||
item->setData(0, Qt::UserRole, true);
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::progress(int val, int max) {
|
||||
if (ctm.elapsed() < 50) return;
|
||||
ctm.restart();
|
||||
ui->progress->setValue(qRound(val * 100. / max));
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
|
||||
void CD_Pult::commandClicked() {
|
||||
QPushButton * b = qobject_cast<QPushButton*>(sender());
|
||||
if (!b) return;
|
||||
//prot_c->sendCommand(b->property("_command").toInt());
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
#ifndef CD_PULT_H
|
||||
#define CD_PULT_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSpinBox>
|
||||
#include <QFont>
|
||||
#include <QRect>
|
||||
#include <QFile>
|
||||
#include <QVector>
|
||||
#include <QDir>
|
||||
#include <QTextStream>
|
||||
#include <QDebug>
|
||||
#include <QBoxLayout>
|
||||
#include <QCheckBox>
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QMenu>
|
||||
#include <QMetaObject>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QLabel>
|
||||
#include "piqt.h"
|
||||
#include "session_manager.h"
|
||||
#include "qpievaluator.h"
|
||||
#include "cdutils_core.h"
|
||||
#include "cdutils_k.h"
|
||||
#include "cd_kmodel.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class CD_Pult;
|
||||
}
|
||||
|
||||
class CD_Pult: public QMainWindow, public PIObject
|
||||
{
|
||||
Q_OBJECT
|
||||
PIOBJECT(CD_Pult)
|
||||
public:
|
||||
CD_Pult();
|
||||
~CD_Pult();
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void timerEvent(QTimerEvent * );
|
||||
void addToList(const QString & s, const QColor & c);
|
||||
QColor invertColor(QColor col) {return QColor(255 - col.red(), 255 - col.green(), 255 - col.blue());}
|
||||
void stopWait();
|
||||
bool calculateExpression(int i, QVector<int> trace);
|
||||
void markError(QTreeWidgetItem * item, const QString & tool_tip = QString());
|
||||
void markNormal(QTreeWidgetItem * item);
|
||||
void progress(int val, int max);
|
||||
void clearSelected();
|
||||
QString typeName(const QString & n) const;
|
||||
void makeTreeSection(CDUtils::CDSection & ks, QTreeWidgetItem * pi);
|
||||
|
||||
EVENT_HANDLER(void, pip_sendFailed) {emit q_k_sendFailed();}
|
||||
EVENT_HANDLER(void, pip_sendSucceed) {emit q_k_sendSucceed();}
|
||||
EVENT_HANDLER(void, pip_receiveFailed) {emit q_k_receiveFailed();}
|
||||
EVENT_HANDLER(void, pip_receiveSucceed) {emit q_k_receiveSucceed();}
|
||||
|
||||
Ui::CD_Pult * ui;
|
||||
PIString config_, name_x, name_c;
|
||||
PIString kdesc_file, cdesc_file, xdesc_file;
|
||||
QMenu log_menu;
|
||||
QTime tm, ctm;
|
||||
QTimer timer_diag;
|
||||
QMap<QString, int> knames;
|
||||
QSet<int> calculated;
|
||||
QStringList knames_sort;
|
||||
QPIEvaluator eval;
|
||||
SessionManager session;
|
||||
QPIConfig config;
|
||||
CDKItemModel * kmodel;
|
||||
CDKDelegate * delegate;
|
||||
//QVector<float> k, x;
|
||||
int clear_target, timer;
|
||||
bool needWrite, isPause, need_update, show_x;
|
||||
|
||||
private slots:
|
||||
void loading(QPIConfig & conf);
|
||||
void saving(QPIConfig & conf);
|
||||
void updateGraph();
|
||||
void updateDiag();
|
||||
void updateKDesc(bool ask_move = false);
|
||||
void updateCDesc();
|
||||
void updateTree(bool move = false);
|
||||
void updateCommands();
|
||||
void filterTree();
|
||||
//void calculate();
|
||||
//void renew(bool write = true);
|
||||
void commandClicked();
|
||||
void k_sendFailed();
|
||||
void k_sendSucceed();
|
||||
void k_receiveFailed();
|
||||
void k_receiveSucceed();
|
||||
void on_spinBuffer_editingFinished();
|
||||
void on_buttonSendK_clicked();
|
||||
void on_buttonReceiveK_clicked();
|
||||
void on_buttonShowAll_clicked();
|
||||
void on_buttonHideAll_clicked();
|
||||
void on_buttonRead_clicked();
|
||||
void on_buttonWrite_clicked();
|
||||
void on_buttonSetKDesc_clicked();
|
||||
void on_buttonReparseKDesc_clicked() {updateKDesc(true);}
|
||||
void on_buttonSetCDesc_clicked();
|
||||
void on_buttonReparseCDesc_clicked() {updateCDesc();}
|
||||
//void on_buttonCalculate_clicked() {calculate();}
|
||||
//void on_buttonApply_clicked() {renew();}
|
||||
void on_buttonPause_toggled(bool on) {isPause = on;}
|
||||
void on_treeK_itemClicked(QTreeWidgetItem * item, int column);
|
||||
void on_treeK_itemChanged(QTreeWidgetItem * item, int column);
|
||||
void on_actionClear_triggered();
|
||||
|
||||
signals:
|
||||
void q_k_sendFailed();
|
||||
void q_k_sendSucceed();
|
||||
void q_k_receiveFailed();
|
||||
void q_k_receiveSucceed();
|
||||
|
||||
};
|
||||
|
||||
#endif // CD_PULT_H
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icons/dialog-close.png</file>
|
||||
<file>icons/edit-clear-.png</file>
|
||||
<file>icons/edit-guides.png</file>
|
||||
<file>icons/view-grid.png</file>
|
||||
<file>icons/zoom-fit-best.png</file>
|
||||
<file>icons/configure.png</file>
|
||||
<file>icons/alpha.png</file>
|
||||
<file>icons/document-save.png</file>
|
||||
<file>icons/edit-clear-locationbar-rtl.png</file>
|
||||
<file>icons/edit-find.png</file>
|
||||
<file>icons/list-add.png</file>
|
||||
<file>icons/edit-delete.png</file>
|
||||
<file>icons/item-add.png</file>
|
||||
<file>icons/item.png</file>
|
||||
<file>icons/node-add.png</file>
|
||||
<file>icons/node.png</file>
|
||||
<file>icons/edit-copy.png</file>
|
||||
<file>icons/edit-paste.png</file>
|
||||
<file>icons/expand_s_x.png</file>
|
||||
<file>icons/expand_s_y.png</file>
|
||||
<file>icons/expand_x.png</file>
|
||||
<file>icons/expand_y.png</file>
|
||||
<file>icons/media-playback-pause.png</file>
|
||||
<file>icons/media-playback-stop.png</file>
|
||||
<file>icons/media-record.png</file>
|
||||
<file>icons/application-exit.png</file>
|
||||
<file>icons/document-save-.png</file>
|
||||
<file>icons/view-refresh.png</file>
|
||||
<file>icons/document-open.png</file>
|
||||
<file>icons/archive-extract.png</file>
|
||||
<file>icons/document-export.png</file>
|
||||
<file>icons/document-import.png</file>
|
||||
<file>icons/zoom-fit-height.png</file>
|
||||
<file>icons/layer-visible-off.png</file>
|
||||
<file>icons/layer-visible-on.png</file>
|
||||
<file>icons/accessories-calculator.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,1284 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CD_Pult</class>
|
||||
<widget class="QMainWindow" name="CD_Pult">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1035</width>
|
||||
<height>728</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CD Pult</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Coefficients (K)</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="buttonReparseKDesc">
|
||||
<property name="text">
|
||||
<string>Update</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="buttonRead">
|
||||
<property name="text">
|
||||
<string>Read</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/archive-extract.png</normaloff>:/icons/archive-extract.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="buttonSendK">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/document-export.png</normaloff>:/icons/document-export.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="5">
|
||||
<widget class="QListWidget" name="list">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="buttonReceiveK">
|
||||
<property name="text">
|
||||
<string>Receive</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/document-import.png</normaloff>:/icons/document-import.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="labelWait">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="buttonWrite">
|
||||
<property name="text">
|
||||
<string>Write</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/document-save-.png</normaloff>:/icons/document-save-.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="buttonSetKDesc">
|
||||
<property name="text">
|
||||
<string>Make ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkKHideExpressions">
|
||||
<property name="text">
|
||||
<string>Hide expressions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkKHideNormal">
|
||||
<property name="text">
|
||||
<string>Show only errors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="pixmap">
|
||||
<pixmap resource="cd_pult.qrc">:/icons/edit-find.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string> Search:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CLineEdit" name="lineKSearch">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkKAutoCalculate">
|
||||
<property name="text">
|
||||
<string>Auto calculate</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonCalculate">
|
||||
<property name="toolTip">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/accessories-calculator.png</normaloff>:/icons/accessories-calculator.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progress">
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>Calculate %p%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeK">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<number>200</number>
|
||||
</attribute>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Index</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Expression</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Calculated</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeCDK">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Commands (C)</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSetCDesc">
|
||||
<property name="text">
|
||||
<string>Set C desc file ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonReparseCDesc">
|
||||
<property name="text">
|
||||
<string>Reparse C desc</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupCommands">
|
||||
<property name="title">
|
||||
<string>Commands</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="layoutCommands"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>66</width>
|
||||
<height>441</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Graphics (X)</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="widgetChecks" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonShowAll">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show all</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/layer-visible-on.png</normaloff>:/icons/layer-visible-on.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonHideAll">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide all</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/layer-visible-off.png</normaloff>:/icons/layer-visible-off.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonRecord">
|
||||
<property name="text">
|
||||
<string>Start record</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/media-record.png</normaloff>:/icons/media-record.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonPause">
|
||||
<property name="text">
|
||||
<string>Pause</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/media-playback-pause.png</normaloff>:/icons/media-playback-pause.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinHistory">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> с</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinBuffer">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> с</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>60.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Graphic" name="graphic">
|
||||
<property name="buttons">
|
||||
<set>Graphic::Autofit|Graphic::BorderInputs|Graphic::Clear|Graphic::Configure|Graphic::CursorAxis|Graphic::Grid|Graphic::OnlyExpandX|Graphic::OnlyExpandY|Graphic::Save</set>
|
||||
</property>
|
||||
<property name="borderInputsVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="legendVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="historySize">
|
||||
<double>60.000000000000000</double>
|
||||
</property>
|
||||
<property name="maxVisibleTime">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Configuration</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>K</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>receiver:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelKReceiver">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>sender:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelKSender">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>sended count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinKSended">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="spinKReceived">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>wrong received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="spinKWrong">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelKType">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelKType_2">
|
||||
<property name="text">
|
||||
<string>address K:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="labelKAddr">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="labelKAddrPult">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>missed received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="spinKMissed">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelKType_3">
|
||||
<property name="text">
|
||||
<string>address pult:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>X</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>receiver:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelXReceiver">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>sender:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelXSender">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelKType_4">
|
||||
<property name="text">
|
||||
<string>type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelXType">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelKType_5">
|
||||
<property name="text">
|
||||
<string>address X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelKType_6">
|
||||
<property name="text">
|
||||
<string>address pult:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="labelXAddrPult">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>sended count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinXSended">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="spinXReceived">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>wrong received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="spinXWrong">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="labelXAddr">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>missed received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="spinXMissed">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>C</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>receiver:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCReceiver">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>sender:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCSender">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelKType_7">
|
||||
<property name="text">
|
||||
<string>type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelCType">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelKType_8">
|
||||
<property name="text">
|
||||
<string>address C:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelKType_9">
|
||||
<property name="text">
|
||||
<string>address pult:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="labelCAddrPult">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>sended count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinCSended">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="spinCReceived">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>wrong received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="spinCWrong">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="labelCAddr">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>missed received count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="spinCMissed">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QPIConfigWidget" name="configWidget">
|
||||
<property name="readOnlyName">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnlyType">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnlyComment">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnTypeVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonApply">
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/document-save-.png</normaloff>:/icons/document-save-.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<action name="actionClear">
|
||||
<property name="icon">
|
||||
<iconset resource="cd_pult.qrc">
|
||||
<normaloff>:/icons/edit-clear-.png</normaloff>:/icons/edit-clear-.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Graphic</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>graphic.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QPIConfigWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>qpiconfigwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="cd_pult.qrc"/>
|
||||
<include location="cd_pult.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>spinHistory</sender>
|
||||
<signal>valueChanged(double)</signal>
|
||||
<receiver>graphic</receiver>
|
||||
<slot>setMaxVisibleTime(double)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>919</x>
|
||||
<y>107</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>932</x>
|
||||
<y>132</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,123 +0,0 @@
|
||||
#include <QDir>
|
||||
#include "cdutils_k.h"
|
||||
#include "cdkview.h"
|
||||
#include "cd_kmodel.h"
|
||||
#include "piqt.h"
|
||||
#include "pifile.h"
|
||||
|
||||
using namespace CDUtils;
|
||||
|
||||
|
||||
CDKView::CDKView(QWidget *parent) : QTreeView(parent) {
|
||||
kmodel = 0;
|
||||
CONNECTU(&K, sended, this, cdk_sendSucceed);
|
||||
CONNECTU(&K, sendFailed, this, cdk_sendFailed);
|
||||
CONNECTU(&K, received, this, cdk_receiveSucceed);
|
||||
CONNECTU(&K, receiveFailed, this, cdk_receiveFailed);
|
||||
connect(this, SIGNAL(_qcdk_sendFailed()), this, SLOT(k_sendFailed()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(_qcdk_sendSucceed()), this, SLOT(k_sendSucceed()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(_qcdk_receiveFailed()), this, SLOT(k_receiveFailed()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(_qcdk_receiveSucceed()), this, SLOT(k_receiveSucceed()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
||||
CDKView::~CDKView() {
|
||||
if (kmodel) delete kmodel;
|
||||
kmodel = 0;
|
||||
}
|
||||
|
||||
|
||||
void CDKView::refresh() {
|
||||
if (!kmodel) {
|
||||
K.reinitConnection(K.pultConfig());
|
||||
kmodel = new CDKItemModel();
|
||||
setModel(kmodel);
|
||||
setItemDelegateForColumn(4, new CDKDelegate());
|
||||
}
|
||||
kmodel->rebuildModel();
|
||||
expandAll();
|
||||
for (int i=0; i<6; i++) resizeColumnToContents(i);
|
||||
}
|
||||
|
||||
|
||||
void CDKView::setKFile(const QString &filename) {
|
||||
K.setFileName(Q2PIString(filename));
|
||||
}
|
||||
|
||||
|
||||
void CDKView::startPing() {
|
||||
K.startPing();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::sendK() {
|
||||
busyStatusChanged(true);
|
||||
K.send();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::receiveK() {
|
||||
busyStatusChanged(true);
|
||||
K.request();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::saveK() {
|
||||
K.writeFile();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::loadK() {
|
||||
K.readFile();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::clearK() {
|
||||
K.root() = CDSection();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::buildFromHeader(const QString &kdescription) {
|
||||
if (kdescription.isEmpty()) return;
|
||||
PIString kdesc_file = Q2PIString(QDir::current().relativeFilePath(kdescription));
|
||||
PIFile f(kdesc_file, PIIODevice::ReadOnly);
|
||||
K.update(&f);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::calculateK() {
|
||||
K.calculate();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::k_sendFailed() {
|
||||
busyStatusChanged(false);
|
||||
emit messageStatus("send failed");
|
||||
emit KSendFailed();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::k_sendSucceed() {
|
||||
busyStatusChanged(false);
|
||||
emit messageStatus("send success");
|
||||
emit KSendSucceed();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::k_receiveFailed() {
|
||||
busyStatusChanged(false);
|
||||
emit messageStatus("receive failed");
|
||||
emit KReceiveFailed();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::k_receiveSucceed() {
|
||||
busyStatusChanged(false);
|
||||
emit messageStatus("receive success");
|
||||
refresh();
|
||||
emit KReceiveSucceed();
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
#ifndef CDKVIEW_H
|
||||
#define CDKVIEW_H
|
||||
|
||||
#include "piobject.h"
|
||||
#include <QTreeView>
|
||||
|
||||
class CDKItemModel;
|
||||
|
||||
class CDKView : public QTreeView, public PIObject
|
||||
{
|
||||
Q_OBJECT
|
||||
PIOBJECT(CDKView)
|
||||
public:
|
||||
explicit CDKView(QWidget *parent = 0);
|
||||
~CDKView();
|
||||
void refresh();
|
||||
void setKFile(const QString & filename);
|
||||
void startPing();
|
||||
|
||||
CDKItemModel * CDKModel() {return kmodel;}
|
||||
|
||||
public slots:
|
||||
void sendK();
|
||||
void receiveK();
|
||||
void saveK();
|
||||
void loadK();
|
||||
void clearK();
|
||||
void buildFromHeader(const QString & kdescription);
|
||||
void calculateK();
|
||||
|
||||
private slots:
|
||||
void k_sendFailed();
|
||||
void k_sendSucceed();
|
||||
void k_receiveFailed();
|
||||
void k_receiveSucceed();
|
||||
|
||||
private:
|
||||
EVENT_HANDLER(void, cdk_sendFailed) {emit _qcdk_sendFailed();}
|
||||
EVENT_HANDLER(void, cdk_sendSucceed) {emit _qcdk_sendSucceed();}
|
||||
EVENT_HANDLER(void, cdk_receiveFailed) {emit _qcdk_receiveFailed();}
|
||||
EVENT_HANDLER(void, cdk_receiveSucceed) {emit _qcdk_receiveSucceed();}
|
||||
|
||||
CDKItemModel * kmodel;
|
||||
|
||||
signals:
|
||||
void KSendFailed();
|
||||
void KSendSucceed();
|
||||
void KReceiveFailed();
|
||||
void KReceiveSucceed();
|
||||
void messageStatus(QString msg);
|
||||
void busyStatusChanged(bool bisy);
|
||||
|
||||
void _qcdk_sendFailed(); // PRIVATE
|
||||
void _qcdk_sendSucceed(); // PRIVATE
|
||||
void _qcdk_receiveFailed(); // PRIVATE
|
||||
void _qcdk_receiveSucceed(); // PRIVATE
|
||||
|
||||
};
|
||||
|
||||
#endif // CDKVIEW_H
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "form.h"
|
||||
#include "ui_form.h"
|
||||
#include "QFileDialog"
|
||||
#include "cdutils_k.h"
|
||||
using namespace CDUtils;
|
||||
|
||||
Form::Form(QWidget *parent) : QWidget(parent), ui(new Ui::Form) {
|
||||
ui->setupUi(this);
|
||||
ui->treeView->setKFile("");
|
||||
ui->treeView->refresh();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Form::~Form() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void Form::on_pushButton_3_clicked() {
|
||||
ui->treeView->setKFile(QFileDialog::getSaveFileName(this, "Save"));
|
||||
ui->treeView->saveK();
|
||||
ui->treeView->setKFile("");
|
||||
}
|
||||
|
||||
|
||||
void Form::on_pushButton_4_clicked() {
|
||||
ui->treeView->setKFile(QFileDialog::getOpenFileName(this, "Open"));
|
||||
ui->treeView->loadK();
|
||||
ui->treeView->setKFile("");
|
||||
}
|
||||
|
||||
|
||||
void Form::on_pushButton_6_clicked() {
|
||||
ui->treeView->buildFromHeader(QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with K description"), "k_description.h", "C/C++ header files(*.h *.hpp);;All files(*)"));
|
||||
/*piCout << K.root()["Radar_WaveFreqTune"];
|
||||
piCout << K.root()["11.NVA_PulseGenFineTune"];
|
||||
piCout << K.root()[".NVA.NVA_PulseGenFineTune"];
|
||||
piCout << K.root()["NVA_A.1.NVA_Clk"];*/
|
||||
}
|
||||
|
||||
|
||||
void Form::on_buttonCalc_clicked() {
|
||||
ui->treeView->calculateK();
|
||||
ui->treeView->refresh();
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef FORM_H
|
||||
#define FORM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class Form;
|
||||
}
|
||||
|
||||
class Form : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Form(QWidget *parent = 0);
|
||||
~Form();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_3_clicked();
|
||||
void on_pushButton_4_clicked();
|
||||
void on_pushButton_6_clicked();
|
||||
void on_buttonCalc_clicked();
|
||||
|
||||
private:
|
||||
Ui::Form *ui;
|
||||
};
|
||||
|
||||
#endif // FORM_H
|
||||
@@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>581</width>
|
||||
<height>432</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="CDKView" name="treeView"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Receive</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<property name="text">
|
||||
<string>update from KDescription</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="buttonCalc">
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CDKView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header location="global">cdkview.h</header>
|
||||
<slots>
|
||||
<signal>busyStatusChanged(bool)</signal>
|
||||
<slot>sendK()</slot>
|
||||
<slot>receiveK()</slot>
|
||||
<slot>saveK()</slot>
|
||||
<slot>loadK()</slot>
|
||||
<slot>clear()</slot>
|
||||
<slot>clearK()</slot>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton_2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>treeView</receiver>
|
||||
<slot>receiveK()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>571</x>
|
||||
<y>60</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>410</x>
|
||||
<y>152</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>treeView</sender>
|
||||
<signal>busyStatusChanged(bool)</signal>
|
||||
<receiver>pushButton_2</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>309</x>
|
||||
<y>174</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>571</x>
|
||||
<y>60</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButton_5</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>treeView</receiver>
|
||||
<slot>clearK()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>571</x>
|
||||
<y>89</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>468</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>treeView</receiver>
|
||||
<slot>sendK()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>199</x>
|
||||
<y>60</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>198</x>
|
||||
<y>152</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>treeView</sender>
|
||||
<signal>busyStatusChanged(bool)</signal>
|
||||
<receiver>pushButton</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>177</x>
|
||||
<y>246</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>98</x>
|
||||
<y>46</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1005 B |
|
Before Width: | Height: | Size: 717 B |
|
Before Width: | Height: | Size: 813 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1017 B |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 563 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 644 B |
|
Before Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 485 B |
|
Before Width: | Height: | Size: 640 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 634 B |
|
Before Width: | Height: | Size: 544 B |
|
Before Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 571 B |
|
Before Width: | Height: | Size: 577 B |
|
Before Width: | Height: | Size: 579 B |
|
Before Width: | Height: | Size: 577 B |
|
Before Width: | Height: | Size: 639 B |
|
Before Width: | Height: | Size: 448 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 564 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 694 B |
|
Before Width: | Height: | Size: 658 B |
|
Before Width: | Height: | Size: 691 B |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 539 B |
|
Before Width: | Height: | Size: 929 B |
@@ -1,10 +0,0 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include "form.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
Form w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||