git-svn-id: svn://db.shs.com.ru/libs@378 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -18,8 +18,8 @@ endif()
|
|||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${PIP_INCLUDES})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${PIP_INCLUDES})
|
||||||
#file(GLOB HDRS_UTILS "*.h")
|
#file(GLOB HDRS_UTILS "*.h")
|
||||||
#file(GLOB CPPS_UTILS "*.cpp")
|
#file(GLOB CPPS_UTILS "*.cpp")
|
||||||
set(CPPS_UTILS "cdutils_core.cpp" "cdutils_types.cpp" "cdutils_parser.cpp" "cdutils_k.cpp")
|
set(CPPS_UTILS "cdutils_core.cpp" "cdutils_types.cpp" "cdutils_parser.cpp" "cdutils_interface.cpp" "cdutils_k.cpp")
|
||||||
set(HDRS_UTILS "cdutils_core.h" "cdutils_types.h" "cdutils_parser.h" "cdutils_k.h" "cdutils_protocol.h")
|
set(HDRS_UTILS "cdutils_core.h" "cdutils_types.h" "cdutils_parser.h" "cdutils_interface.h" "cdutils_k.h" "cdutils_protocol.h")
|
||||||
if (DEFINED ENV{QNX_HOST})
|
if (DEFINED ENV{QNX_HOST})
|
||||||
add_library(${PROJECT_NAME} STATIC ${CPPS_UTILS} ${HDRS_UTILS})
|
add_library(${PROJECT_NAME} STATIC ${CPPS_UTILS} ${HDRS_UTILS})
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ const char CDCore::pult_config[] =
|
|||||||
|
|
||||||
int __Core_Initializer__::count_(0);
|
int __Core_Initializer__::count_(0);
|
||||||
CDCore * __Core_Initializer__::__instance__(0);
|
CDCore * __Core_Initializer__::__instance__(0);
|
||||||
|
const uchar header_direct = 0x80;
|
||||||
|
const uchar header_transfer = 0x81;
|
||||||
|
|
||||||
|
|
||||||
__Core_Initializer__::__Core_Initializer__() {
|
__Core_Initializer__::__Core_Initializer__() {
|
||||||
@@ -62,7 +64,12 @@ CDCore::CDCore() {
|
|||||||
/*PIString s(app_config);
|
/*PIString s(app_config);
|
||||||
connection.configureFromString(&s);
|
connection.configureFromString(&s);
|
||||||
connection.start();*/
|
connection.start();*/
|
||||||
initRoot(k_);
|
k_.cd_type_ = CDType::cdK;
|
||||||
|
x_.cd_type_ = CDType::cdX;
|
||||||
|
c_.cd_type_ = CDType::cdC;
|
||||||
|
initRoot(&k_);
|
||||||
|
initRoot(&x_);
|
||||||
|
initRoot(&c_);
|
||||||
|
|
||||||
CONNECTU(&datatr, sendRequest, this, dtSendRequest)
|
CONNECTU(&datatr, sendRequest, this, dtSendRequest)
|
||||||
CONNECTU(&datatr, receiveFinished, this, dtReceiveFinished)
|
CONNECTU(&datatr, receiveFinished, this, dtReceiveFinished)
|
||||||
@@ -90,15 +97,15 @@ CDCore::~CDCore() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::k_write(PIIODevice * d) {
|
void CDCore::cd_write(CDSection * cd, PIIODevice * d) {
|
||||||
k_.write(d, CDType::cdK, PIString());
|
cd->write(d, PIString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::k_read(PIIODevice * d) {
|
void CDCore::cd_read(CDSection * cd, PIIODevice * d) {
|
||||||
PIConfig conf(d, PIIODevice::ReadOnly);
|
PIConfig conf(d, PIIODevice::ReadOnly);
|
||||||
k_.read(&(conf.rootEntry()), CDType::cdK);
|
cd->read(&(conf.rootEntry()));
|
||||||
initRoot(k_);
|
initRoot(cd);
|
||||||
K_ChangedGlobal();
|
K_ChangedGlobal();
|
||||||
/*PIVector<PIIODevice * > ds = connection.allDevices();
|
/*PIVector<PIIODevice * > ds = connection.allDevices();
|
||||||
piForeach(PIIODevice * d, ds) {
|
piForeach(PIIODevice * d, ds) {
|
||||||
@@ -108,36 +115,50 @@ void CDCore::k_read(PIIODevice * d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::k_parse(PIIODevice * d) {
|
void CDCore::cd_parse(CDSection * cd, PIIODevice * d) {
|
||||||
k_ = CDParser::parse(d, CDType::cdK);
|
*cd = CDParser::parse(d, cd->cd_type_);
|
||||||
initRoot(k_);
|
initRoot(cd);
|
||||||
K_ChangedGlobal();
|
K_ChangedGlobal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::k_update(PIIODevice * d, UpdateModeFlags mode) {
|
void CDCore::cd_update(CDSection * cd, PIIODevice * d, UpdateModeFlags mode) {
|
||||||
CDSection uk = k_;
|
CDSection ucd = *cd;
|
||||||
k_parse(d);
|
cd_parse(cd, d);
|
||||||
/*bool kn = true;
|
/*bool kn = true;
|
||||||
if (!uk.isEmpty())
|
if (!ucd.isEmpty())
|
||||||
if (!uk.isSameStructure(k_)) {
|
if (!ucd.isSameStructure(k_)) {
|
||||||
piCout << "ask for save names";
|
piCout << "ask for save names";
|
||||||
K_KeepNamesRequest(&kn);
|
K_KeepNamesRequest(&kn);
|
||||||
}*/
|
}*/
|
||||||
uk.update(k_, mode);
|
ucd.update(*cd, mode);
|
||||||
//piCout << k_.count() << uk.count();
|
//piCout << k_.count() << ucd.count();
|
||||||
k_ = uk;
|
*cd = ucd;
|
||||||
initRoot(k_);
|
initRoot(cd);
|
||||||
K_ChangedGlobal();
|
K_ChangedGlobal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::k_calculate() {
|
void CDCore::cd_calculate(CDSection * cd) {
|
||||||
k_.calculate();
|
cd->calculate();
|
||||||
K_ChangedGlobal();
|
K_ChangedGlobal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::cd_send(CDSection * cd, CDPacketType pt, bool direct) {
|
||||||
|
PIByteArray ba, sba;
|
||||||
|
PIIOByteArray iob(&ba, PIIODevice::ReadWrite);
|
||||||
|
cd_write(cd, &iob);
|
||||||
|
//piCoutObj << PIString(ba);
|
||||||
|
sba = makeHeader(pt, 0);
|
||||||
|
sba << ba;
|
||||||
|
if (direct)
|
||||||
|
sendDirect(sba);
|
||||||
|
else
|
||||||
|
sendThreaded(sba);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::initApp() {
|
void CDCore::initApp() {
|
||||||
init(appConfig());
|
init(appConfig());
|
||||||
}
|
}
|
||||||
@@ -163,30 +184,25 @@ void CDCore::startPing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDUtils::CDCore::dataReceived(const PIString & from, const PIByteArray & data) {
|
CDSection * CDCore::root(CDType::cdT cdt) {
|
||||||
// piCoutObj << "dataReceived" << from << data.size();
|
switch (cdt) {
|
||||||
PIIODevice * d = connection.deviceByName("cd");
|
case CDType::cdK: return &k_; break;
|
||||||
if (d && d == connection.deviceByFullPath(from)) {
|
case CDType::cdX: return &x_; break;
|
||||||
if (data.size() >= sizeof(4)) {
|
case CDType::cdC: return &c_; break;
|
||||||
const uint sig = *((const uint*)(data.data()));
|
default: break;
|
||||||
if (sig == PIBaseTransfer::packetSignature()) datatr.received(data);
|
|
||||||
else {
|
|
||||||
CDPacketType pt = (CDPacketType)sig;
|
|
||||||
switch(pt) {
|
|
||||||
case CD_Ping: {
|
|
||||||
//piCoutObj << "ping";
|
|
||||||
} break;
|
|
||||||
case CD_KDirectChange: {
|
|
||||||
PIByteArray ba = data;
|
|
||||||
PacketKDirectChange p;
|
|
||||||
ba >> p;
|
|
||||||
k_[p.path].setValue(p.value);
|
|
||||||
} break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIString CDCore::typeLetter(CDType::cdT cdt) {
|
||||||
|
switch (cdt) {
|
||||||
|
case CDType::cdK: return PIStringAscii("k"); break;
|
||||||
|
case CDType::cdX: return PIStringAscii("x"); break;
|
||||||
|
case CDType::cdC: return PIStringAscii("c"); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return PIString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -199,60 +215,34 @@ CDCore * CDCore::instance() {
|
|||||||
|
|
||||||
void CDCore::K_Send() {
|
void CDCore::K_Send() {
|
||||||
piCoutObj << "K_Send";
|
piCoutObj << "K_Send";
|
||||||
PIByteArray ba;
|
cd_send(&k_, CD_KSend);
|
||||||
PIIOByteArray iob(&ba, PIIODevice::ReadWrite);
|
|
||||||
k_write(&iob);
|
|
||||||
//piCoutObj << PIString(ba);
|
|
||||||
if (sendt.isRunning()) {
|
|
||||||
piCoutObj << "send in process...";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wheader.session_id = 0;
|
|
||||||
wheader.type = CD_KSend;
|
|
||||||
send_data.clear();
|
|
||||||
send_data << wheader << ba;
|
|
||||||
sendt.startOnce();
|
|
||||||
// ios.close();
|
|
||||||
// piCout << s;
|
|
||||||
//PIByteArray ba = PIByteArray::fromString(s);
|
|
||||||
// PIFile pf("k.txt", PIIODevice::ReadWrite);
|
|
||||||
// pf.resize(0);
|
|
||||||
// pf.write(s.toUTF8());
|
|
||||||
//k_write(&pf);
|
|
||||||
//piCout << pf.readLine();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::K_Request() {
|
void CDCore::K_Request() {
|
||||||
piCoutObj << "K_Request";
|
piCoutObj << "K_Request";
|
||||||
if (sendt.isRunning()) {
|
PIByteArray sba = makeHeader(CD_KQuery, 0);
|
||||||
piCoutObj << "send in process...";
|
sendThreaded(sba);
|
||||||
return;
|
|
||||||
}
|
|
||||||
wheader.session_id = 0;
|
|
||||||
wheader.type = CD_KQuery;
|
|
||||||
send_data.clear();
|
|
||||||
send_data << wheader;
|
|
||||||
sendt.startOnce();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDUtils::CDCore::K_DirectChange(PIDeque<int> path, PIString value) {
|
void CDUtils::CDCore::K_DirectChange(PIDeque<int> path, PIString value) {
|
||||||
|
piCoutObj << "K_DirectChange";
|
||||||
PacketKDirectChange p;
|
PacketKDirectChange p;
|
||||||
p.header.session_id = 0;
|
|
||||||
p.header.type = CD_KDirectChange;
|
|
||||||
p.path = path;
|
p.path = path;
|
||||||
p.value = value;
|
p.value = value;
|
||||||
PIByteArray ba;
|
PIByteArray sba = makeHeader(CD_KDirectChange, 0);
|
||||||
ba << p;
|
sba << p;
|
||||||
connection.writeByName("cd", ba);
|
sendDirect(sba);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::sendThread() {
|
void CDCore::sendThread() {
|
||||||
|
if (send_data.size_s() < 4) return;
|
||||||
|
PacketHeader h;
|
||||||
|
memcpy(&h, send_data.data(), sizeof(h));
|
||||||
bool ok = datatr.send(send_data);
|
bool ok = datatr.send(send_data);
|
||||||
CDPacketType pt = (CDPacketType)wheader.type;
|
switch (h.type) {
|
||||||
switch (pt) {
|
|
||||||
case CD_KSend:
|
case CD_KSend:
|
||||||
if (ok) K_Sended();
|
if (ok) K_Sended();
|
||||||
else K_SendFail();
|
else K_SendFail();
|
||||||
@@ -275,42 +265,97 @@ void CDCore::xTimerTick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::initRoot(CDSection & r) {
|
void CDCore::initRoot(CDSection * r) {
|
||||||
r.name = "__root__";
|
r->name = "__root__";
|
||||||
r.alias = "root";
|
r->alias = "root";
|
||||||
r.makePath();
|
r->makePath();
|
||||||
r.calculate();
|
r->calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::dtSendRequest(PIByteArray &data) {
|
PIByteArray CDCore::makeHeader(CDPacketType type, int session_id) const {
|
||||||
connection.writeByName("cd", data);
|
PacketHeader h;
|
||||||
// piCoutObj << "send" << data.size() << ret;
|
h.type = type;
|
||||||
|
h.session_id = session_id;
|
||||||
|
PIByteArray ret; ret << h;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::dtReceiveFinished(bool ok) {
|
void CDCore::sendDirect(PIByteArray & ba) {
|
||||||
if (ok) {
|
ba.push_front(header_direct);
|
||||||
PIByteArray ba = datatr.data();
|
connection.writeByName("cd", ba);
|
||||||
PacketHeader p;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::sendThreaded(PIByteArray & ba) {
|
||||||
|
if (sendt.isRunning()) {
|
||||||
|
piCoutObj << "Send in process, abort";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
send_data = ba;
|
||||||
|
sendt.startOnce();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::procReceivedPacket(PIByteArray & ba) {
|
||||||
|
PacketHeader h;
|
||||||
|
ba >> h;
|
||||||
|
switch(h.type) {
|
||||||
|
case CD_Ping:
|
||||||
|
//piCoutObj << "ping";
|
||||||
|
break;
|
||||||
|
case CD_KQuery:
|
||||||
|
K_Send();
|
||||||
|
break;
|
||||||
|
case CD_KSend: {
|
||||||
|
piCoutObj << "K received";
|
||||||
|
PIByteArray k;
|
||||||
|
ba >> k;
|
||||||
|
k << uchar(0);
|
||||||
|
PIString s = PIString::fromUTF8((const char *)k.data());
|
||||||
|
PIIOString ios(&s);
|
||||||
|
cd_read(&k_, &ios);
|
||||||
|
K_Received();
|
||||||
|
} break;
|
||||||
|
case CD_KDirectChange: {
|
||||||
|
PacketKDirectChange p;
|
||||||
ba >> p;
|
ba >> p;
|
||||||
CDPacketType pt = (CDPacketType)p.type;
|
k_[p.path].setValue(p.value);
|
||||||
switch (pt) {
|
} break;
|
||||||
case CD_KQuery:
|
default: break;
|
||||||
K_Send();
|
}
|
||||||
break;
|
}
|
||||||
case CD_KSend: {
|
|
||||||
piCoutObj << "K received";
|
|
||||||
PIByteArray k;
|
void CDUtils::CDCore::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||||
ba >> k;
|
//piCoutObj << "dataReceived" << from << data.size();
|
||||||
k << uchar(0);
|
PIIODevice * d = connection.deviceByName("cd");
|
||||||
PIString s = PIString::fromUTF8((const char *)k.data());
|
if (d && d == connection.deviceByFullPath(from)) {
|
||||||
PIIOString ios(&s);
|
if (data.size() >= sizeof(4)) {
|
||||||
k_read(&ios);
|
PIByteArray ba = data;
|
||||||
K_Received();
|
uchar header = ba.take_front();
|
||||||
} break;
|
if (header == header_transfer) {
|
||||||
default: break;
|
datatr.received(ba);
|
||||||
|
}
|
||||||
|
if (header == header_direct) {
|
||||||
|
procReceivedPacket(ba);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::dtSendRequest(PIByteArray & data) {
|
||||||
|
data.push_front(header_transfer);
|
||||||
|
connection.writeByName("cd", data);
|
||||||
|
//piCoutObj << "send" << data.size() << ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::dtReceiveFinished(bool ok) {
|
||||||
|
if (!ok) return;
|
||||||
|
PIByteArray ba = datatr.data();
|
||||||
|
procReceivedPacket(ba);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class CDCore: public PIObject
|
|||||||
PIOBJECT(CDUtils::CDCore)
|
PIOBJECT(CDUtils::CDCore)
|
||||||
friend class __Core_Initializer__;
|
friend class __Core_Initializer__;
|
||||||
friend class CDSection;
|
friend class CDSection;
|
||||||
friend class KInterface;
|
friend class Interface;
|
||||||
public:
|
public:
|
||||||
static CDCore * instance();
|
static CDCore * instance();
|
||||||
|
|
||||||
@@ -39,11 +39,12 @@ public:
|
|||||||
EVENT_HANDLER(void, K_Request);
|
EVENT_HANDLER(void, K_Request);
|
||||||
EVENT_HANDLER2(void, K_DirectChange, PIDeque<int>, path, PIString, value);
|
EVENT_HANDLER2(void, K_DirectChange, PIDeque<int>, path, PIString, value);
|
||||||
|
|
||||||
void k_write(PIIODevice * d);
|
void cd_write (CDSection * cd, PIIODevice * d);
|
||||||
void k_read(PIIODevice * d);
|
void cd_read (CDSection * cd, PIIODevice * d);
|
||||||
void k_parse(PIIODevice * d);
|
void cd_parse (CDSection * cd, PIIODevice * d);
|
||||||
void k_update(PIIODevice * d, UpdateModeFlags mode);
|
void cd_update (CDSection * cd, PIIODevice * d, UpdateModeFlags mode);
|
||||||
void k_calculate();
|
void cd_calculate(CDSection * cd);
|
||||||
|
void cd_send (CDSection * cd, CDPacketType pt, bool direct = false);
|
||||||
void initApp();
|
void initApp();
|
||||||
void initPult();
|
void initPult();
|
||||||
void init(const PIString & configuration);
|
void init(const PIString & configuration);
|
||||||
@@ -51,6 +52,8 @@ public:
|
|||||||
bool inProgress() {return sendt.isRunning();}
|
bool inProgress() {return sendt.isRunning();}
|
||||||
|
|
||||||
CDSection & k() {return k_;}
|
CDSection & k() {return k_;}
|
||||||
|
CDSection * root(CDType::cdT cdt);
|
||||||
|
PIString typeLetter(CDType::cdT cdt);
|
||||||
|
|
||||||
static PIString pultConfig() {return PIString(pult_config);}
|
static PIString pultConfig() {return PIString(pult_config);}
|
||||||
static PIString appConfig() {return PIString(app_config);}
|
static PIString appConfig() {return PIString(app_config);}
|
||||||
@@ -63,16 +66,19 @@ private:
|
|||||||
EVENT_HANDLER1(void, dtReceiveFinished, bool, ok);
|
EVENT_HANDLER1(void, dtReceiveFinished, bool, ok);
|
||||||
EVENT_HANDLER(void, sendThread);
|
EVENT_HANDLER(void, sendThread);
|
||||||
EVENT_HANDLER(void, xTimerTick);
|
EVENT_HANDLER(void, xTimerTick);
|
||||||
void initRoot(CDSection & r);
|
void initRoot(CDSection * r);
|
||||||
|
PIByteArray makeHeader(CDPacketType type, int session_id = 0) const;
|
||||||
|
void sendDirect(PIByteArray & ba);
|
||||||
|
void sendThreaded(PIByteArray & ba);
|
||||||
|
void procReceivedPacket(PIByteArray & ba);
|
||||||
|
|
||||||
static const char app_config[], pult_config[];
|
static const char app_config[], pult_config[];
|
||||||
PIConnection connection;
|
PIConnection connection;
|
||||||
PIDataTransfer datatr;
|
PIDataTransfer datatr;
|
||||||
PacketHeader wheader;
|
|
||||||
PIByteArray send_data;
|
PIByteArray send_data;
|
||||||
PIThread sendt;
|
PIThread sendt;
|
||||||
PITimer x_timer;
|
PITimer x_timer;
|
||||||
CDSection k_;
|
CDSection k_, x_, c_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
170
cd_utils/cdutils_interface.cpp
Normal file
170
cd_utils/cdutils_interface.cpp
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
#include "cdutils_interface.h"
|
||||||
|
#include "cdutils_core.h"
|
||||||
|
#include "piconfig.h"
|
||||||
|
#include "pifile.h"
|
||||||
|
|
||||||
|
using namespace CDUtils;
|
||||||
|
|
||||||
|
|
||||||
|
Interface::Interface(CDType::cdT type_) {
|
||||||
|
core = CDCore::instance();
|
||||||
|
s = core->root(type_);
|
||||||
|
//piCoutObj << (void*)this << core;
|
||||||
|
file_ = core->typeLetter(type_) + PIStringAscii(".dat");
|
||||||
|
file_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Interface::test(int v) {
|
||||||
|
return s->test(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CDType & Interface::operator [](const PIString & name_) {
|
||||||
|
return (*s)[name_];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const CDType Interface::operator [](const PIString & name_) const {
|
||||||
|
return (*s)[name_];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CDType & Interface::operator [](const PIDeque<int> & path_) {
|
||||||
|
return (*s)[path_];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const CDType Interface::operator [](const PIDeque<int> & path_) const {
|
||||||
|
return (*s)[path_];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CDType & Interface::operator [](int v) {
|
||||||
|
//piCout << (void*)this << "[]" << core;
|
||||||
|
return (*s)[v];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const CDType Interface::operator [](int v) const {
|
||||||
|
//piCout << (void*)this << "[]" << core;
|
||||||
|
return (*s)[v];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CDSection & Interface::section(int v) {
|
||||||
|
// CDSection & ret = s->section(v);
|
||||||
|
// piCout << "[get section]" << v << ret.name;
|
||||||
|
return s->section(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const CDSection Interface::section(int v) const {
|
||||||
|
return s->section(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CDSection & Interface::section(const PIDeque<int> &path) {
|
||||||
|
PIDeque<int> spath = path;
|
||||||
|
CDSection * rs = s;
|
||||||
|
while (!spath.isEmpty()) {
|
||||||
|
rs = &(rs->section(spath.take_front()));
|
||||||
|
}
|
||||||
|
return *rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CDSection & Interface::root() {
|
||||||
|
return *s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const CDSection & Interface::root() const {
|
||||||
|
return *s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Interface::count(bool recursive) const {
|
||||||
|
return s->count(recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::setFileName(const PIString & _file) {
|
||||||
|
file_ = _file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Interface::configure(const PIString & config) {
|
||||||
|
PIConfig conf(config, PIIODevice::ReadOnly);
|
||||||
|
PIConfig::Entry & e(conf.getValue(core->typeLetter(s->cd_type_)));
|
||||||
|
bool ret = false;
|
||||||
|
setFileName(e.getValue("file", file(), &ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::reinitConnection(const PIString &configuration) {
|
||||||
|
core->init(configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::startPing() {
|
||||||
|
core->startPing();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::write(PIIODevice * d) {
|
||||||
|
core->cd_write(s, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::read(PIIODevice * d) {
|
||||||
|
core->cd_read(s, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::parse(PIIODevice * d) {
|
||||||
|
core->cd_parse(s, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::update(PIIODevice * d, UpdateModeFlags mode) {
|
||||||
|
core->cd_update(s, d, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::calculate() {
|
||||||
|
core->cd_calculate(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIString Interface::appConfig() {
|
||||||
|
return core->appConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIString Interface::pultConfig() {
|
||||||
|
return core->pultConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::readFile() {
|
||||||
|
if (file_.isEmpty()) return;
|
||||||
|
PIFile f(file_, PIIODevice::ReadOnly);
|
||||||
|
read(&f);
|
||||||
|
file_size = f.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Interface::writeFile() {
|
||||||
|
if (file_.isEmpty()) return;
|
||||||
|
PIFile f(file_, PIIODevice::ReadWrite);
|
||||||
|
f.clear();
|
||||||
|
write(&f);
|
||||||
|
file_size = f.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Interface::inProgress() {
|
||||||
|
return core->inProgress();
|
||||||
|
}
|
||||||
66
cd_utils/cdutils_interface.h
Normal file
66
cd_utils/cdutils_interface.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#ifndef CDUTILS_INTERFACE_H
|
||||||
|
#define CDUTILS_INTERFACE_H
|
||||||
|
|
||||||
|
#include "cdutils_types.h"
|
||||||
|
#include "piobject.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace CDUtils {
|
||||||
|
|
||||||
|
class CDCore;
|
||||||
|
|
||||||
|
|
||||||
|
class Interface: public PIObject
|
||||||
|
{
|
||||||
|
PIOBJECT(CDUtils::Interface)
|
||||||
|
public:
|
||||||
|
Interface(CDType::cdT type_);
|
||||||
|
|
||||||
|
bool test(int v);
|
||||||
|
CDType & operator [](int v);
|
||||||
|
const CDType operator [](int v) const;
|
||||||
|
CDType & operator [](const PIString & name_);
|
||||||
|
const CDType operator [](const PIString & name_) const;
|
||||||
|
CDType & operator [](const PIDeque<int> & path_);
|
||||||
|
const CDType operator [](const PIDeque<int> & path_) const;
|
||||||
|
CDSection & section(int v);
|
||||||
|
const CDSection section(int v) const;
|
||||||
|
CDSection & section(const PIDeque<int> & path);
|
||||||
|
CDSection & root();
|
||||||
|
const CDSection & root() const;
|
||||||
|
|
||||||
|
int count(bool recursive = true) const;
|
||||||
|
const PIString file() const {return file_;}
|
||||||
|
int fileSize() const {return file_size;}
|
||||||
|
|
||||||
|
void setFileName(const PIString & _file);
|
||||||
|
bool configure(const PIString & config);
|
||||||
|
void reinitConnection(const PIString & configuration);
|
||||||
|
void startPing();
|
||||||
|
void write(PIIODevice * d);
|
||||||
|
void read(PIIODevice * d);
|
||||||
|
void parse(PIIODevice * d);
|
||||||
|
void update(PIIODevice * d, UpdateModeFlags mode = SaveByName);
|
||||||
|
void calculate();
|
||||||
|
|
||||||
|
PIString appConfig();
|
||||||
|
PIString pultConfig();
|
||||||
|
|
||||||
|
void readFile();
|
||||||
|
void writeFile();
|
||||||
|
bool inProgress();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CDCore * core;
|
||||||
|
CDSection * s;
|
||||||
|
CDType::cdT type;
|
||||||
|
PIString file_;
|
||||||
|
int file_size;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CDUTILS_K_H
|
||||||
@@ -1,18 +1,12 @@
|
|||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "piconfig.h"
|
|
||||||
#include "pifile.h"
|
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
KInterface K;
|
KInterface K;
|
||||||
|
|
||||||
|
|
||||||
KInterface::KInterface() {
|
KInterface::KInterface(): Interface(CDType::cdK) {
|
||||||
core = CDCore::instance();
|
|
||||||
//piCoutObj << (void*)this << core;
|
|
||||||
k_file = PIStringAscii("k.dat");
|
|
||||||
k_file_size = 0;
|
|
||||||
CONNECTU(core, K_Sended, this, sended);
|
CONNECTU(core, K_Sended, this, sended);
|
||||||
CONNECTU(core, K_SendFail, this, sendFailed);
|
CONNECTU(core, K_SendFail, this, sendFailed);
|
||||||
CONNECTU(core, K_Received, this, received);
|
CONNECTU(core, K_Received, this, received);
|
||||||
@@ -20,159 +14,16 @@ KInterface::KInterface() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool KInterface::test(int v) {
|
|
||||||
return core->k_.test(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CDType & KInterface::operator [](const PIString & name_) {
|
|
||||||
return core->k_[name_];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const CDType KInterface::operator [](const PIString & name_) const {
|
|
||||||
return core->k_[name_];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CDType & KInterface::operator [](const PIDeque<int> & path_) {
|
|
||||||
return core->k_[path_];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const CDType KInterface::operator [](const PIDeque<int> & path_) const {
|
|
||||||
return core->k_[path_];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CDType & KInterface::operator [](int v) {
|
|
||||||
//piCout << (void*)this << "[]" << core;
|
|
||||||
return core->k_[v];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const CDType KInterface::operator [](int v) const {
|
|
||||||
//piCout << (void*)this << "[]" << core;
|
|
||||||
return core->k_[v];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CDSection & KInterface::section(int v) {
|
|
||||||
// CDSection & ret = core->k_.section(v);
|
|
||||||
// piCout << "[get section]" << v << ret.name;
|
|
||||||
return core->k_.section(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
const CDSection KInterface::section(int v) const {
|
|
||||||
return core->k_.section(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CDSection & KInterface::section(const PIDeque<int> &path) {
|
|
||||||
PIDeque<int> spath = path;
|
|
||||||
CDSection * rs = &core->k_;
|
|
||||||
while (!spath.isEmpty()) {
|
|
||||||
rs = &rs->section(spath.take_front());
|
|
||||||
}
|
|
||||||
return *rs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CDSection & KInterface::root() {
|
|
||||||
return core->k_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const CDSection KInterface::root() const {
|
|
||||||
return core->k_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int KInterface::count(bool recursive) const {
|
|
||||||
return core->k_.count(recursive);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::send() {
|
void KInterface::send() {
|
||||||
core->K_Send();
|
core->K_Send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KInterface::request() {
|
void KInterface::request() {
|
||||||
core->K_Request();
|
core->K_Request();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool KInterface::configure(const PIString & config, const PIString & sect) {
|
void KInterface::directChange(const CDType & k, double v) {
|
||||||
PIConfig conf(config, PIIODevice::ReadOnly);
|
core->K_DirectChange(k.path(), PIString::fromNumber(v));
|
||||||
PIConfig::Entry & e(conf.getValue(sect));
|
|
||||||
bool ret = false;
|
|
||||||
k_file = e.getValue("file", "k.dat", &ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::reinitConnection(const PIString &configuration) {
|
|
||||||
core->init(configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::startPing() {
|
|
||||||
core->startPing();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::write(PIIODevice * d) {
|
|
||||||
core->k_write(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::read(PIIODevice * d) {
|
|
||||||
core->k_read(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::parse(PIIODevice * d) {
|
|
||||||
core->k_parse(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::update(PIIODevice * d, UpdateModeFlags mode) {
|
|
||||||
core->k_update(d, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::calculate() {
|
|
||||||
core->k_calculate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PIString KInterface::appConfig() {
|
|
||||||
return core->appConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PIString KInterface::pultConfig() {
|
|
||||||
return core->pultConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::readFile() {
|
|
||||||
if (k_file.isEmpty()) return;
|
|
||||||
PIFile f(k_file, PIIODevice::ReadOnly);
|
|
||||||
read(&f);
|
|
||||||
k_file_size = f.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KInterface::writeFile() {
|
|
||||||
if (k_file.isEmpty()) return;
|
|
||||||
PIFile f(k_file, PIIODevice::ReadWrite);
|
|
||||||
f.clear();
|
|
||||||
write(&f);
|
|
||||||
k_file_size = f.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool KInterface::inProgress() {
|
|
||||||
return core->inProgress();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,18 @@
|
|||||||
#ifndef CDUTILS_K_H
|
#ifndef CDUTILS_K_H
|
||||||
#define CDUTILS_K_H
|
#define CDUTILS_K_H
|
||||||
|
|
||||||
#include "cdutils_types.h"
|
#include "cdutils_interface.h"
|
||||||
#include "piobject.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
class CDCore;
|
|
||||||
|
|
||||||
|
class KInterface: public Interface
|
||||||
class KInterface: public PIObject
|
|
||||||
{
|
{
|
||||||
PIOBJECT(CDUtils::KInterface)
|
PIOBJECT(CDUtils::KInterface)
|
||||||
public:
|
public:
|
||||||
KInterface();
|
KInterface();
|
||||||
|
|
||||||
bool test(int v);
|
|
||||||
CDType & operator [](int v);
|
|
||||||
const CDType operator [](int v) const;
|
|
||||||
CDType & operator [](const PIString & name_);
|
|
||||||
const CDType operator [](const PIString & name_) const;
|
|
||||||
CDType & operator [](const PIDeque<int> & path_);
|
|
||||||
const CDType operator [](const PIDeque<int> & path_) const;
|
|
||||||
CDSection & section(int v);
|
|
||||||
const CDSection section(int v) const;
|
|
||||||
CDSection & section(const PIDeque<int> & path);
|
|
||||||
CDSection & root();
|
|
||||||
const CDSection root() const;
|
|
||||||
|
|
||||||
int count(bool recursive = true) const;
|
|
||||||
const PIString file() const {return k_file;}
|
|
||||||
int fileSize() const {return k_file_size;}
|
|
||||||
|
|
||||||
EVENT(sended)
|
EVENT(sended)
|
||||||
EVENT(sendFailed)
|
EVENT(sendFailed)
|
||||||
EVENT(received)
|
EVENT(received)
|
||||||
@@ -40,31 +20,11 @@ public:
|
|||||||
EVENT1(keepNamesRequest, bool*, kn)
|
EVENT1(keepNamesRequest, bool*, kn)
|
||||||
EVENT_HANDLER(void, send);
|
EVENT_HANDLER(void, send);
|
||||||
EVENT_HANDLER(void, request);
|
EVENT_HANDLER(void, request);
|
||||||
void setFileName(const PIString & file) {k_file = file;}
|
|
||||||
bool configure(const PIString & config, const PIString & sect = PIStringAscii("k"));
|
|
||||||
void reinitConnection(const PIString & configuration);
|
|
||||||
void startPing();
|
|
||||||
void write(PIIODevice * d);
|
|
||||||
void read(PIIODevice * d);
|
|
||||||
void parse(PIIODevice * d);
|
|
||||||
void update(PIIODevice * d, UpdateModeFlags mode = SaveByName);
|
|
||||||
void calculate();
|
|
||||||
|
|
||||||
PIString appConfig();
|
void directChange(const CDType & k, double v);
|
||||||
PIString pultConfig();
|
|
||||||
|
|
||||||
void readFile();
|
|
||||||
void writeFile();
|
|
||||||
bool inProgress();
|
|
||||||
|
|
||||||
private:
|
|
||||||
CDCore * core;
|
|
||||||
PIString k_file;
|
|
||||||
int k_file_size;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern CDUtils::KInterface K;
|
extern CDUtils::KInterface K;
|
||||||
|
|||||||
@@ -78,10 +78,10 @@ PIVector<int> enumValues(const PIString & e, const PIMap<PIString, CDSection> &
|
|||||||
|
|
||||||
CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
||||||
CDType::cdT et = (CDType::cdT)cdsection_type;
|
CDType::cdT et = (CDType::cdT)cdsection_type;
|
||||||
if (!d) return CDSection();
|
if (!d) return CDSection(et);
|
||||||
if (!d->canRead()) return CDSection();
|
if (!d->canRead()) return CDSection(et);
|
||||||
//piCout << "[CDSection] parse start";
|
//piCout << "[CDSection] parse start";
|
||||||
CDSection cs;
|
CDSection cs(et);
|
||||||
CDType ck;
|
CDType ck;
|
||||||
PIMap<PIString, CDSection> sections;
|
PIMap<PIString, CDSection> sections;
|
||||||
PIMap<PIString, int> enum_values;
|
PIMap<PIString, int> enum_values;
|
||||||
@@ -112,7 +112,7 @@ CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
|||||||
cind += 4;
|
cind += 4;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cs = CDSection();
|
cs = CDSection(et);
|
||||||
cs.name = line;
|
cs.name = line;
|
||||||
//piCout << "enum" << cs.name;
|
//piCout << "enum" << cs.name;
|
||||||
int cev = 0;
|
int cev = 0;
|
||||||
@@ -129,11 +129,11 @@ CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
|||||||
// piCout << "#" << enum_values;
|
// piCout << "#" << enum_values;
|
||||||
if (!enum_values.contains(alias)) {
|
if (!enum_values.contains(alias)) {
|
||||||
piCout << "Parse error: can`t find section alias \"" << alias << "\"!";
|
piCout << "Parse error: can`t find section alias \"" << alias << "\"!";
|
||||||
return CDSection();
|
return CDSection(et);
|
||||||
}
|
}
|
||||||
if (!sections.contains(iarr.front())) {
|
if (!sections.contains(iarr.front())) {
|
||||||
piCout << "Parse error: can`t find section \"" << iarr.front() << "\"!";
|
piCout << "Parse error: can`t find section \"" << iarr.front() << "\"!";
|
||||||
return CDSection();
|
return CDSection(et);
|
||||||
}
|
}
|
||||||
//piCout << "insert" << alias << iarr;
|
//piCout << "insert" << alias << iarr;
|
||||||
int aval = enum_values.value(alias);
|
int aval = enum_values.value(alias);
|
||||||
@@ -150,7 +150,7 @@ CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
|||||||
ts.name = is.name;
|
ts.name = is.name;
|
||||||
ts.name.insert(ibpos, PIString("[") << a << "]");
|
ts.name.insert(ibpos, PIString("[") << a << "]");
|
||||||
is = ts;
|
is = ts;
|
||||||
ts = CDSection();
|
ts = CDSection(et);
|
||||||
}
|
}
|
||||||
is.alias = alias;
|
is.alias = alias;
|
||||||
cs.section(aval) = is;
|
cs.section(aval) = is;
|
||||||
@@ -187,7 +187,7 @@ CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
|||||||
case CDType::cdK : return sections.value("KDescription");
|
case CDType::cdK : return sections.value("KDescription");
|
||||||
case CDType::cdX : return sections.value("XDescription");
|
case CDType::cdX : return sections.value("XDescription");
|
||||||
case CDType::cdC : return sections.value("CDescription");
|
case CDType::cdC : return sections.value("CDescription");
|
||||||
default: return CDSection();
|
default: return CDSection(et);
|
||||||
}
|
}
|
||||||
return CDSection();
|
return CDSection(et);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,19 @@
|
|||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
enum CDPacketType {CD_Ping, CD_Pong, CD_KQuery, CD_KSend, CD_KDirectChange, CD_XData, CD_XQuery, CD_Command};
|
enum CDPacketType {CD_Ping,
|
||||||
|
CD_Pong,
|
||||||
|
|
||||||
|
CD_KQuery,
|
||||||
|
CD_KSend,
|
||||||
|
CD_KDirectChange,
|
||||||
|
|
||||||
|
CD_XQuery,
|
||||||
|
CD_XSend,
|
||||||
|
CD_XValues,
|
||||||
|
|
||||||
|
CD_Command,
|
||||||
|
};
|
||||||
|
|
||||||
# pragma pack(push,1)
|
# pragma pack(push,1)
|
||||||
|
|
||||||
@@ -15,7 +27,6 @@ enum CDPacketType {CD_Ping, CD_Pong, CD_KQuery, CD_KSend, CD_KDirectChange, CD_X
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct PacketKDirectChange {
|
struct PacketKDirectChange {
|
||||||
PacketHeader header;
|
|
||||||
PIDeque<int> path;
|
PIDeque<int> path;
|
||||||
PIString value;
|
PIString value;
|
||||||
};
|
};
|
||||||
@@ -26,8 +37,8 @@ enum CDPacketType {CD_Ping, CD_Pong, CD_KQuery, CD_KSend, CD_KDirectChange, CD_X
|
|||||||
inline PIByteArray & operator <<(PIByteArray & s, const PacketHeader & v) {s << v.type << v.session_id; return s;}
|
inline PIByteArray & operator <<(PIByteArray & s, const PacketHeader & v) {s << v.type << v.session_id; return s;}
|
||||||
inline PIByteArray & operator >>(PIByteArray & s, PacketHeader & v) {s >> v.type >> v.session_id; return s;}
|
inline PIByteArray & operator >>(PIByteArray & s, PacketHeader & v) {s >> v.type >> v.session_id; return s;}
|
||||||
|
|
||||||
inline PIByteArray & operator <<(PIByteArray & s, const PacketKDirectChange & v) {s << v.header << v.path << v.value; return s;}
|
inline PIByteArray & operator <<(PIByteArray & s, const PacketKDirectChange & v) {s << v.path << v.value; return s;}
|
||||||
inline PIByteArray & operator >>(PIByteArray & s, PacketKDirectChange & v) {s >> v.header >> v.path >> v.value; return s;}
|
inline PIByteArray & operator >>(PIByteArray & s, PacketKDirectChange & v) {s >> v.path >> v.value; return s;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,11 +226,32 @@ PIVariantTypes::Enum CDType::parseEnumComment(PIString c) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CDSection::CDSection(CDType::cdT type_) {
|
||||||
|
cd_type_ = type_;
|
||||||
|
null.cd_type_ = type_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CDSection & CDSection::section(int v) {
|
||||||
|
CDSection & ret(s[v]);
|
||||||
|
ret.cd_type_ = cd_type_;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const CDSection CDSection::section(int v) const {
|
||||||
|
CDSection & ret(s[v]);
|
||||||
|
ret.cd_type_ = cd_type_;
|
||||||
|
return s[v];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int CDSection::count(bool recursive) const {
|
int CDSection::count(bool recursive) const {
|
||||||
int ret = cd.size_s();
|
int ret = cd.size_s();
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
PIMap<int, CDSection>::const_iterator i;
|
PIMap<int, CDSection>::const_iterator i;
|
||||||
for (i = s.begin(); i != s.end(); ++i)
|
for (i = s.constBegin(); i != s.constEnd(); ++i)
|
||||||
ret += i->second.count(recursive);
|
ret += i->second.count(recursive);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -252,7 +273,8 @@ PIStringList CDSection::index_names() const {
|
|||||||
|
|
||||||
|
|
||||||
void CDSection::calculate() {
|
void CDSection::calculate() {
|
||||||
/*CDCore::instance()->k_.*/prepareCalculate();
|
prepareCalculate();
|
||||||
|
if (cd_type_ != CDType::cdK) return;
|
||||||
PIEvaluator e;
|
PIEvaluator e;
|
||||||
calculateRecursive(&e);
|
calculateRecursive(&e);
|
||||||
}
|
}
|
||||||
@@ -265,7 +287,7 @@ CDType & CDSection::getByName(const PIString & name_) {
|
|||||||
CDSection * cs = this, * ns = 0;
|
CDSection * cs = this, * ns = 0;
|
||||||
if (np.front().isEmpty()) {
|
if (np.front().isEmpty()) {
|
||||||
if (np.size_s() < 2) return null;
|
if (np.size_s() < 2) return null;
|
||||||
cs = &(CDCore::instance()->k_);
|
cs = CDCore::instance()->root(cd_type_);
|
||||||
np.pop_front();
|
np.pop_front();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < np.size_s() - 1; ++i) {
|
for (int i = 0; i < np.size_s() - 1; ++i) {
|
||||||
@@ -318,15 +340,15 @@ CDType & CDSection::getByPath(const PIDeque<int> & path_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDSection::write(PIIODevice * d, CDType::cdT cdt, const PIString & prefix) {
|
void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
||||||
if (!d) return;
|
if (!d) return;
|
||||||
if (cd.isEmpty() && s.isEmpty()) return;
|
if (cd.isEmpty() && s.isEmpty()) return;
|
||||||
// piCout << "[CDSection] write start";
|
// piCout << "[CDSection] write start";
|
||||||
PIString l;
|
PIString l;
|
||||||
PIStringList cdtl;
|
PIStringList cdtl;
|
||||||
cdtl << "null" << "k" << "x" << "c";
|
cdtl << "null" << "k" << "x" << "c";
|
||||||
if (prefix.isEmpty()) l = "[" + cdtl[cdt] + "]";
|
if (prefix.isEmpty()) l = "[" + cdtl[cd_type_] + "]";
|
||||||
else l = "[" + prefix + "." + cdtl[cdt] + "]";
|
else l = "[" + prefix + "." + cdtl[cd_type_] + "]";
|
||||||
l += "\n";
|
l += "\n";
|
||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
l = "name = " + name + " \n";
|
l = "name = " + name + " \n";
|
||||||
@@ -336,8 +358,8 @@ void CDSection::write(PIIODevice * d, CDType::cdT cdt, const PIString & prefix)
|
|||||||
PIMap<int, CDType>::iterator i;
|
PIMap<int, CDType>::iterator i;
|
||||||
for (i = cd.begin(); i != cd.end(); ++i) {
|
for (i = cd.begin(); i != cd.end(); ++i) {
|
||||||
CDType & ck(i.value());
|
CDType & ck(i.value());
|
||||||
if (ck.cd_type() != cdt) continue;
|
if (ck.cd_type() != cd_type_) continue;
|
||||||
switch (cdt) {
|
switch (cd_type_) {
|
||||||
case CDType::cdNull: break;
|
case CDType::cdNull: break;
|
||||||
case CDType::cdK:
|
case CDType::cdK:
|
||||||
l.clear(); l << ck.index() << ".f = " << ck.formula() << " #s " << ck.comment() << " \n";
|
l.clear(); l << ck.index() << ".f = " << ck.formula() << " #s " << ck.comment() << " \n";
|
||||||
@@ -373,7 +395,7 @@ void CDSection::write(PIIODevice * d, CDType::cdT cdt, const PIString & prefix)
|
|||||||
else l = prefix + ".s";
|
else l = prefix + ".s";
|
||||||
PIMap<int, CDSection>::iterator j;
|
PIMap<int, CDSection>::iterator j;
|
||||||
for (j = s.begin(); j != s.end(); ++j) {
|
for (j = s.begin(); j != s.end(); ++j) {
|
||||||
j.value().write(d, cdt, l + "." + PIString::fromNumber(j.key()));
|
j.value().write(d, l + "." + PIString::fromNumber(j.key()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prefix.isEmpty()) {
|
if (prefix.isEmpty()) {
|
||||||
@@ -384,18 +406,18 @@ void CDSection::write(PIIODevice * d, CDType::cdT cdt, const PIString & prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDSection::read(const void * ep, CDType::cdT cdt) {
|
void CDSection::read(const void * ep) {
|
||||||
// piCout << "[CDSection] read start";
|
// piCout << "[CDSection] read start";
|
||||||
PIStringList cdtl;
|
PIStringList cdtl;
|
||||||
cdtl << "null" << "k" << "x" << "c";
|
cdtl << "null" << "k" << "x" << "c";
|
||||||
cd.clear();
|
cd.clear();
|
||||||
s.clear();
|
s.clear();
|
||||||
PIConfig::Entry & e(*(PIConfig::Entry*)ep);
|
PIConfig::Entry & e(*(PIConfig::Entry*)ep);
|
||||||
name = e.getValue(cdtl[cdt] + ".name").value();
|
name = e.getValue(cdtl[cd_type_] + ".name").value();
|
||||||
alias = e.getValue(cdtl[cdt] + ".alias").value();
|
alias = e.getValue(cdtl[cd_type_] + ".alias").value();
|
||||||
PIConfig::Entry & kl = e.getValue(cdtl[cdt]);
|
PIConfig::Entry & cdl = e.getValue(cdtl[cd_type_]);
|
||||||
for (int i = 0; i < kl.childCount(); ++i) {
|
for (int i = 0; i < cdl.childCount(); ++i) {
|
||||||
const PIConfig::Entry * e(kl.child(i));
|
const PIConfig::Entry * e(cdl.child(i));
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int id = e->name().toInt(-1, &ok);
|
int id = e->name().toInt(-1, &ok);
|
||||||
// piCout << "[read]" << ke->name() << ke->value() << ok;
|
// piCout << "[read]" << ke->name() << ke->value() << ok;
|
||||||
@@ -404,21 +426,21 @@ void CDSection::read(const void * ep, CDType::cdT cdt) {
|
|||||||
if (ok) {
|
if (ok) {
|
||||||
CDType c;
|
CDType c;
|
||||||
PIString ev;
|
PIString ev;
|
||||||
switch (cdt) {
|
switch (cd_type_) {
|
||||||
case CDType::cdNull: break;
|
case CDType::cdNull: break;
|
||||||
case CDType::cdK:
|
case CDType::cdK:
|
||||||
c = CDType(id, e->getValue("v").comment(), e->getValue("v").type(), e->getValue("v").value(), e->getValue("f").value(), e->getValue("f").comment(), cdt);
|
c = CDType(id, e->getValue("v").comment(), e->getValue("v").type(), e->getValue("v").value(), e->getValue("f").value(), e->getValue("f").comment(), cd_type_);
|
||||||
ev = e->getValue("ev", "");
|
ev = e->getValue("ev", "");
|
||||||
if (!ev.isEmpty())
|
if (!ev.isEmpty())
|
||||||
c.enum_values = c.parseEnumComment(ev);
|
c.enum_values = c.parseEnumComment(ev);
|
||||||
break;
|
break;
|
||||||
case CDType::cdX:
|
case CDType::cdX:
|
||||||
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString() , e->getValue("name").comment(), cdt);
|
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString() , e->getValue("name").comment(), cd_type_);
|
||||||
c.setXMode((CDType::XMode)e->getValue("mode").value().toInt());
|
c.setXMode((CDType::XMode)e->getValue("mode").value().toInt());
|
||||||
c.setAvg((CDType::XMode)e->getValue("avg").value().toInt());
|
c.setAvg((CDType::XMode)e->getValue("avg").value().toInt());
|
||||||
break;
|
break;
|
||||||
case CDType::cdC:
|
case CDType::cdC:
|
||||||
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString() , e->getValue("name").comment(), cdt);
|
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString() , e->getValue("name").comment(), cd_type_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cd[id] = c;
|
cd[id] = c;
|
||||||
@@ -428,7 +450,9 @@ void CDSection::read(const void * ep, CDType::cdT cdt) {
|
|||||||
for (int i = 0; i < sl.childCount(); ++i) {
|
for (int i = 0; i < sl.childCount(); ++i) {
|
||||||
const PIConfig::Entry * se(sl.child(i));
|
const PIConfig::Entry * se(sl.child(i));
|
||||||
int sid = se->name().toInt();
|
int sid = se->name().toInt();
|
||||||
s[sid].read(se, cdt);
|
CDSection & rs(s[sid]);
|
||||||
|
rs.cd_type_ = cd_type_;
|
||||||
|
rs.read(se);
|
||||||
}
|
}
|
||||||
// piCout << "[CDSection] read end";
|
// piCout << "[CDSection] read end";
|
||||||
}
|
}
|
||||||
@@ -442,16 +466,16 @@ void CDSection::update(CDSection & v, UpdateModeFlags mode) {
|
|||||||
//piCout << "[CDSection] update start";
|
//piCout << "[CDSection] update start";
|
||||||
//piCout << "before" << k.size() << v.k.size();
|
//piCout << "before" << k.size() << v.k.size();
|
||||||
|
|
||||||
PIMap<int, PIString> prev_k_f_bi;
|
PIMap<int, PIString> prev_cd_f_bi;
|
||||||
PIMap<PIString, PIString> prev_k_f_bn;
|
PIMap<PIString, PIString> prev_cd_f_bn;
|
||||||
PIMap<int, CDType>::iterator i;
|
PIMap<int, CDType>::iterator i;
|
||||||
if (mode[SaveByIndex]) {
|
if (mode[SaveByIndex]) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
for (i = cd.begin(); i != cd.end(); ++i)
|
||||||
prev_k_f_bi[i.key()] = i.value().formula();
|
prev_cd_f_bi[i.key()] = i.value().formula();
|
||||||
}
|
}
|
||||||
if (mode[SaveByName]) {
|
if (mode[SaveByName]) {
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
for (i = cd.begin(); i != cd.end(); ++i)
|
||||||
prev_k_f_bn[i.value().name_] = i.value().formula();
|
prev_cd_f_bn[i.value().name_] = i.value().formula();
|
||||||
}
|
}
|
||||||
if (!mode[Merge])
|
if (!mode[Merge])
|
||||||
cd.clear();
|
cd.clear();
|
||||||
@@ -460,12 +484,12 @@ void CDSection::update(CDSection & v, UpdateModeFlags mode) {
|
|||||||
PIString n = i.value().name();
|
PIString n = i.value().name();
|
||||||
cd[id] = i.value();
|
cd[id] = i.value();
|
||||||
if (mode[SaveByIndex]) {
|
if (mode[SaveByIndex]) {
|
||||||
if (prev_k_f_bi.contains(id))
|
if (prev_cd_f_bi.contains(id))
|
||||||
cd[id].setFormula(prev_k_f_bi[id]);
|
cd[id].setFormula(prev_cd_f_bi[id]);
|
||||||
}
|
}
|
||||||
if (mode[SaveByName]) {
|
if (mode[SaveByName]) {
|
||||||
if (prev_k_f_bn.contains(n))
|
if (prev_cd_f_bn.contains(n))
|
||||||
cd[id].setFormula(prev_k_f_bn[n]);
|
cd[id].setFormula(prev_cd_f_bn[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,14 +559,14 @@ void CDSection::update(CDSection & v, UpdateModeFlags mode) {
|
|||||||
|
|
||||||
|
|
||||||
bool CDSection::isSameStructure(CDSection & v) {
|
bool CDSection::isSameStructure(CDSection & v) {
|
||||||
PIMap<PIString, int> k_ids;
|
PIMap<PIString, int> cd_ids;
|
||||||
PIMap<int, CDType>::iterator i;
|
PIMap<int, CDType>::iterator i;
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
for (i = cd.begin(); i != cd.end(); ++i)
|
||||||
k_ids[i.value().name()] = i.key();
|
cd_ids[i.value().name()] = i.key();
|
||||||
for (i = v.cd.begin(); i != v.cd.end(); ++i) {
|
for (i = v.cd.begin(); i != v.cd.end(); ++i) {
|
||||||
if (!k_ids.contains(i.value().name())) continue;
|
if (!cd_ids.contains(i.value().name())) continue;
|
||||||
//piCout << i.key() << k[i.key()].name() << i.value().name();
|
//piCout << i.key() << k[i.key()].name() << i.value().name();
|
||||||
if (cd[k_ids[i.value().name()]].index() != i.key())
|
if (cd[cd_ids[i.value().name()]].index() != i.key())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PIMap<int, CDSection>::iterator j;
|
PIMap<int, CDSection>::iterator j;
|
||||||
@@ -602,7 +626,7 @@ PIVector<CDType * > CDSection::children(bool recursive) const {
|
|||||||
ret << const_cast<CDType * >(&(i.value()));
|
ret << const_cast<CDType * >(&(i.value()));
|
||||||
if (!recursive) return ret;
|
if (!recursive) return ret;
|
||||||
PIMap<int, CDSection>::const_iterator j;
|
PIMap<int, CDSection>::const_iterator j;
|
||||||
for (j = s.begin(); j != s.end(); ++j)
|
for (j = s.constBegin(); j != s.constEnd(); ++j)
|
||||||
ret << j.value().children(true);
|
ret << j.value().children(true);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -611,7 +635,7 @@ PIVector<CDType * > CDSection::children(bool recursive) const {
|
|||||||
PIVariantTypes::Enum CDSection::enumValues() const {
|
PIVariantTypes::Enum CDSection::enumValues() const {
|
||||||
PIVariantTypes::Enum ret;
|
PIVariantTypes::Enum ret;
|
||||||
PIMap<int, CDType>::const_iterator i;
|
PIMap<int, CDType>::const_iterator i;
|
||||||
for (i = cd.begin(); i != cd.end(); ++i)
|
for (i = cd.constBegin(); i != cd.constEnd(); ++i)
|
||||||
ret << PIVariantTypes::Enumerator(i.key(), i.value().name());
|
ret << PIVariantTypes::Enumerator(i.key(), i.value().name());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ typedef PIFlags<UpdateMode> UpdateModeFlags;
|
|||||||
|
|
||||||
class CDType {
|
class CDType {
|
||||||
friend class CDSection;
|
friend class CDSection;
|
||||||
|
friend class CDCore;
|
||||||
|
friend class Interface;
|
||||||
public:
|
public:
|
||||||
enum cdT {cdNull, cdK, cdX, cdC};
|
enum cdT {cdNull, cdK, cdX, cdC};
|
||||||
enum XMode {X_Current, X_All_Avg};
|
enum XMode {X_Current, X_All_Avg};
|
||||||
@@ -70,7 +72,7 @@ protected:
|
|||||||
int value_i;
|
int value_i;
|
||||||
bool value_b, calculated;
|
bool value_b, calculated;
|
||||||
PIVector<double> history;
|
PIVector<double> history;
|
||||||
PIVector <double> avg_h;
|
PIVector<double> avg_h;
|
||||||
int avg_size;
|
int avg_size;
|
||||||
XMode mode_;
|
XMode mode_;
|
||||||
};
|
};
|
||||||
@@ -78,12 +80,13 @@ protected:
|
|||||||
|
|
||||||
class CDSection {
|
class CDSection {
|
||||||
friend class CDCore;
|
friend class CDCore;
|
||||||
|
friend class Interface;
|
||||||
friend class ::CD_Pult;
|
friend class ::CD_Pult;
|
||||||
friend class ::CDKItem;
|
friend class ::CDKItem;
|
||||||
friend class ::CDKItemModel;
|
friend class ::CDKItemModel;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CDSection() {}
|
CDSection(CDType::cdT type_ = CDType::cdNull);
|
||||||
|
|
||||||
bool test(int v) {return cd.value(v).toBool();}
|
bool test(int v) {return cd.value(v).toBool();}
|
||||||
// CDType & operator [](int v) {if (!k.contains(v)) k[v].index_ = v; return k[v];}
|
// CDType & operator [](int v) {if (!k.contains(v)) k[v].index_ = v; return k[v];}
|
||||||
@@ -93,8 +96,8 @@ public:
|
|||||||
const CDType operator [](const PIString & name_) const {return const_cast<CDSection*>(this)->getByName(name_);}
|
const CDType operator [](const PIString & name_) const {return const_cast<CDSection*>(this)->getByName(name_);}
|
||||||
CDType & operator [](const PIDeque<int> & path_) {return getByPath(path_);}
|
CDType & operator [](const PIDeque<int> & path_) {return getByPath(path_);}
|
||||||
const CDType operator [](const PIDeque<int> & path_) const {return const_cast<CDSection*>(this)->getByPath(path_);}
|
const CDType operator [](const PIDeque<int> & path_) const {return const_cast<CDSection*>(this)->getByPath(path_);}
|
||||||
CDSection & section(int v) {return s[v];}
|
CDSection & section(int v);
|
||||||
const CDSection section(int v) const {return s[v];}
|
const CDSection section(int v) const;
|
||||||
|
|
||||||
bool isEmpty() const {return cd.isEmpty() && s.isEmpty();}
|
bool isEmpty() const {return cd.isEmpty() && s.isEmpty();}
|
||||||
int count(bool recursive = true) const;
|
int count(bool recursive = true) const;
|
||||||
@@ -116,16 +119,17 @@ protected:
|
|||||||
}
|
}
|
||||||
CDType & getByName(const PIString & name_);
|
CDType & getByName(const PIString & name_);
|
||||||
CDType & getByPath(const PIDeque<int> & path_);
|
CDType & getByPath(const PIDeque<int> & path_);
|
||||||
void write(PIIODevice * d, CDType::cdT cdt, const PIString & prefix = PIString());
|
void write(PIIODevice * d, const PIString & prefix = PIString());
|
||||||
void read(const void * ep, CDType::cdT cdt);
|
void read(const void * ep);
|
||||||
void update(CDSection & v, UpdateModeFlags mode = SaveByName);
|
void update(CDSection & v, UpdateModeFlags mode = SaveByName);
|
||||||
bool isSameStructure(CDSection & v);
|
bool isSameStructure(CDSection & v);
|
||||||
void prepareCalculate();
|
void prepareCalculate();
|
||||||
void calculateRecursive(PIEvaluator * e);
|
void calculateRecursive(PIEvaluator * e);
|
||||||
|
|
||||||
PIMap<int, CDType> cd;
|
PIMap<int, CDType> cd;
|
||||||
PIMap<int, CDSection> s;
|
mutable PIMap<int, CDSection> s;
|
||||||
CDType null;
|
CDType null;
|
||||||
|
CDType::cdT cd_type_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class Core : public PIObject
|
|||||||
PIOBJECT(Core)
|
PIOBJECT(Core)
|
||||||
public:
|
public:
|
||||||
Core() {
|
Core() {
|
||||||
|
CDCore::instance()->initApp();
|
||||||
// piCout << "testCore";
|
// piCout << "testCore";
|
||||||
CONNECTU(&t, tickEvent, this, timerDone);
|
CONNECTU(&t, tickEvent, this, timerDone);
|
||||||
t.start(1000);
|
t.start(1000);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
project(cd_pult)
|
project(cd_pult)
|
||||||
file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts")
|
|
||||||
find_qt(${QtVersions} Core Gui OpenGL)
|
find_qt(${QtVersions} Core Gui OpenGL)
|
||||||
|
qt_sources(SRC)
|
||||||
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
|
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
|
||||||
qt_add_executable(${PROJECT_NAME} WIN32 out_CPP)
|
qt_add_executable(${PROJECT_NAME} WIN32 out_CPP)
|
||||||
qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qad_graphic qcd_utils qad_application)
|
qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qad_graphic qcd_utils qad_application)
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), ui(new Ui::CDPultWindow) {
|
CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), ui(new Ui::CDPultWindow) {
|
||||||
CDUtils::CDCore::instance()->initPult();
|
CDUtils::CDCore::instance()->initPult();
|
||||||
qRegisterMetaType<LogIcon>("LogIcon");
|
qRegisterMetaType<LogIcon>("LogIcon");
|
||||||
log_icons[OKIcon] = QIcon("://icons/dialog-ok-apply.png");
|
log_icons[OKIcon] = QIcon(":/icons/dialog-ok-apply.png");
|
||||||
log_icons[FailIcon] = QIcon("://icons/dialog-cancel.png");
|
log_icons[FailIcon] = QIcon(":/icons/dialog-cancel.png");
|
||||||
log_icons[WaitIcon] = QIcon("://icons/timer.png");
|
log_icons[WaitIcon] = QIcon(":/icons/timer.png");
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
centralWidget()->hide();
|
centralWidget()->hide();
|
||||||
setRecentMenu(ui->menuOpen_recent);
|
setRecentMenu(ui->menuOpen_recent);
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ QString CDKItem::stringType(const PIString & t) const {
|
|||||||
case 'F': return QString("file"); break;
|
case 'F': return QString("file"); break;
|
||||||
case 'D': return QString("dir"); break;
|
case 'D': return QString("dir"); break;
|
||||||
}
|
}
|
||||||
return QString("double");
|
return QString("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user