git-svn-id: svn://db.shs.com.ru/libs@415 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -61,6 +61,7 @@ CDCore::CDCore() {
|
|||||||
setName("CDCore");
|
setName("CDCore");
|
||||||
datatr.setPacketSize(960);
|
datatr.setPacketSize(960);
|
||||||
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
|
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
|
||||||
|
CONNECTU(PICout::Notifier::object(), finished, this, piCoutFinished);
|
||||||
/*PIString s(app_config);
|
/*PIString s(app_config);
|
||||||
connection.configureFromString(&s);
|
connection.configureFromString(&s);
|
||||||
connection.start();*/
|
connection.start();*/
|
||||||
@@ -68,9 +69,11 @@ CDCore::CDCore() {
|
|||||||
k_.cd_type_ = CDType::cdK;
|
k_.cd_type_ = CDType::cdK;
|
||||||
x_.cd_type_ = CDType::cdX;
|
x_.cd_type_ = CDType::cdX;
|
||||||
c_.cd_type_ = CDType::cdC;
|
c_.cd_type_ = CDType::cdC;
|
||||||
|
m_.cd_type_ = CDType::cdM;
|
||||||
initRoot(&k_);
|
initRoot(&k_);
|
||||||
initRoot(&x_);
|
initRoot(&x_);
|
||||||
initRoot(&c_);
|
initRoot(&c_);
|
||||||
|
initRoot(&m_);
|
||||||
|
|
||||||
CONNECTU(&datatr, sendRequest, this, dtSendRequest)
|
CONNECTU(&datatr, sendRequest, this, dtSendRequest)
|
||||||
CONNECTU(&datatr, receiveFinished, this, dtReceiveFinished)
|
CONNECTU(&datatr, receiveFinished, this, dtReceiveFinished)
|
||||||
@@ -169,6 +172,7 @@ void CDCore::send(CDType::cdT cdt) {
|
|||||||
case CDType::cdK: pt = CD_KSend; break;
|
case CDType::cdK: pt = CD_KSend; break;
|
||||||
case CDType::cdX: pt = CD_XSend; break;
|
case CDType::cdX: pt = CD_XSend; break;
|
||||||
case CDType::cdC: pt = CD_CSend; break;
|
case CDType::cdC: pt = CD_CSend; break;
|
||||||
|
case CDType::cdM: pt = CD_MSend; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
piCoutObj << "send" << typeLetter(cdt);
|
piCoutObj << "send" << typeLetter(cdt);
|
||||||
@@ -182,6 +186,7 @@ void CDCore::request(CDType::cdT cdt) {
|
|||||||
case CDType::cdK: pt = CD_KQuery; break;
|
case CDType::cdK: pt = CD_KQuery; break;
|
||||||
case CDType::cdX: pt = CD_XQuery; break;
|
case CDType::cdX: pt = CD_XQuery; break;
|
||||||
case CDType::cdC: pt = CD_CQuery; break;
|
case CDType::cdC: pt = CD_CQuery; break;
|
||||||
|
case CDType::cdM: pt = CD_MQuery; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
piCoutObj << "request" << typeLetter(cdt);
|
piCoutObj << "request" << typeLetter(cdt);
|
||||||
@@ -253,11 +258,20 @@ void CDCore::registerCHandler(const CDType & c, PIObject * o, Handler h) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::sendMessage(const CDType & m, MessageType mt, const PIString & msg) {
|
||||||
|
if (msg.isEmpty() || (m.cd_type() != CDType::cdM)) return;
|
||||||
|
PIByteArray sba = makeHeader(CD_Message, 0);
|
||||||
|
sba << m.path() << int(mt) << msg;
|
||||||
|
sendDirect(sba);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CDSection * CDCore::root(CDType::cdT cdt) {
|
CDSection * CDCore::root(CDType::cdT cdt) {
|
||||||
switch (cdt) {
|
switch (cdt) {
|
||||||
case CDType::cdK: return &k_; break;
|
case CDType::cdK: return &k_; break;
|
||||||
case CDType::cdX: return &x_; break;
|
case CDType::cdX: return &x_; break;
|
||||||
case CDType::cdC: return &c_; break;
|
case CDType::cdC: return &c_; break;
|
||||||
|
case CDType::cdM: return &m_; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -269,6 +283,7 @@ PIString CDCore::typeLetter(CDType::cdT cdt) {
|
|||||||
case CDType::cdK: return PIStringAscii("k"); break;
|
case CDType::cdK: return PIStringAscii("k"); break;
|
||||||
case CDType::cdX: return PIStringAscii("x"); break;
|
case CDType::cdX: return PIStringAscii("x"); break;
|
||||||
case CDType::cdC: return PIStringAscii("c"); break;
|
case CDType::cdC: return PIStringAscii("c"); break;
|
||||||
|
case CDType::cdM: return PIStringAscii("m"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return PIString();
|
return PIString();
|
||||||
@@ -320,6 +335,13 @@ void CDCore::sendThread() {
|
|||||||
case CD_CQuery:
|
case CD_CQuery:
|
||||||
if (!ok) C_ReceiveFail();
|
if (!ok) C_ReceiveFail();
|
||||||
break;
|
break;
|
||||||
|
case CD_MSend:
|
||||||
|
if (ok) M_Sended();
|
||||||
|
else M_SendFail();
|
||||||
|
break;
|
||||||
|
case CD_MQuery:
|
||||||
|
if (!ok) M_ReceiveFail();
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,6 +373,15 @@ void CDCore::xTimerTick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::piCoutFinished(int id, PIString * buffer) {
|
||||||
|
if (!buffer || !(id == 1)) return;
|
||||||
|
PIString sp = buffer->takeRange("[", "]");
|
||||||
|
PIDeque<int> p = CDCore::stringToPath(sp);
|
||||||
|
sendMessage(m_[p], Log, *buffer);
|
||||||
|
delete buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::initRoot(CDSection * r) {
|
void CDCore::initRoot(CDSection * r) {
|
||||||
r->name = "__root__";
|
r->name = "__root__";
|
||||||
r->alias = "root";
|
r->alias = "root";
|
||||||
@@ -470,6 +501,31 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
|||||||
//piCoutObj << "found" << sp << h.first;
|
//piCoutObj << "found" << sp << h.first;
|
||||||
if (h.first && h.second) h.second(h.first);
|
if (h.first && h.second) h.second(h.first);
|
||||||
} break;
|
} break;
|
||||||
|
case CD_MQuery:
|
||||||
|
send(CDType::cdM);
|
||||||
|
break;
|
||||||
|
case CD_MSend: {
|
||||||
|
piCoutObj << "M received";
|
||||||
|
PIByteArray c;
|
||||||
|
ba >> c;
|
||||||
|
c << uchar(0);
|
||||||
|
PIString s = PIString::fromUTF8((const char *)c.data());
|
||||||
|
PIIOString ios(&s);
|
||||||
|
cd_read(&m_, &ios);
|
||||||
|
M_Received();
|
||||||
|
} break;
|
||||||
|
case CD_Message: {
|
||||||
|
PIDeque<int> p;
|
||||||
|
ba >> p;
|
||||||
|
piCoutObj << "M message" << p;
|
||||||
|
if (p.isEmpty()) return;
|
||||||
|
int t = 0;
|
||||||
|
PIString msg;
|
||||||
|
ba >> t >> msg;
|
||||||
|
//piCoutObj << "found" << sp << h.first;
|
||||||
|
//piCoutObj << "M message invoke";
|
||||||
|
M_Message(p, t, msg);
|
||||||
|
} break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,6 +536,7 @@ void CDCore::raiseChangedGlobal(CDType::cdT cdt) {
|
|||||||
case CDType::cdK: K_ChangedGlobal(); break;
|
case CDType::cdK: K_ChangedGlobal(); break;
|
||||||
case CDType::cdX: X_ChangedGlobal(); break;
|
case CDType::cdX: X_ChangedGlobal(); break;
|
||||||
case CDType::cdC: C_ChangedGlobal(); break;
|
case CDType::cdC: C_ChangedGlobal(); break;
|
||||||
|
case CDType::cdM: M_ChangedGlobal(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ public:
|
|||||||
EVENT(C_ReceiveFail)
|
EVENT(C_ReceiveFail)
|
||||||
EVENT(C_ChangedGlobal)
|
EVENT(C_ChangedGlobal)
|
||||||
|
|
||||||
|
EVENT(M_Sended)
|
||||||
|
EVENT(M_SendFail)
|
||||||
|
EVENT(M_Received)
|
||||||
|
EVENT(M_ReceiveFail)
|
||||||
|
EVENT(M_ChangedGlobal)
|
||||||
|
EVENT3(M_Message, PIDeque<int>, path, int, type, PIString, msg)
|
||||||
|
|
||||||
void cd_write (CDSection * cd, PIIODevice * d);
|
void cd_write (CDSection * cd, PIIODevice * d);
|
||||||
void cd_read (CDSection * cd, PIIODevice * d);
|
void cd_read (CDSection * cd, PIIODevice * d);
|
||||||
void cd_parse (CDSection * cd, PIIODevice * d);
|
void cd_parse (CDSection * cd, PIIODevice * d);
|
||||||
@@ -69,8 +76,8 @@ public:
|
|||||||
void sendCommand(const CDType & c);
|
void sendCommand(const CDType & c);
|
||||||
void registerCHandler(const CDType & c, PIObject * o, Handler h);
|
void registerCHandler(const CDType & c, PIObject * o, Handler h);
|
||||||
bool inProgress() {return sendt.isRunning();}
|
bool inProgress() {return sendt.isRunning();}
|
||||||
|
void sendMessage(const CDType & m, MessageType mt, const PIString & msg);
|
||||||
|
|
||||||
CDSection & k() {return k_;}
|
|
||||||
CDSection * root(CDType::cdT cdt);
|
CDSection * root(CDType::cdT cdt);
|
||||||
PIString typeLetter(CDType::cdT cdt);
|
PIString typeLetter(CDType::cdT cdt);
|
||||||
static PIString pathToString(const PIDeque<int> & p);
|
static PIString pathToString(const PIDeque<int> & p);
|
||||||
@@ -87,6 +94,7 @@ 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);
|
||||||
|
EVENT_HANDLER2(void, piCoutFinished, int, id, PIString*, buffer);
|
||||||
void initRoot(CDSection * r);
|
void initRoot(CDSection * r);
|
||||||
PIByteArray makeHeader(CDPacketType type, int session_id = 0) const;
|
PIByteArray makeHeader(CDPacketType type, int session_id = 0) const;
|
||||||
void sendDirect(PIByteArray & ba);
|
void sendDirect(PIByteArray & ba);
|
||||||
@@ -102,7 +110,7 @@ private:
|
|||||||
PIByteArray send_data;
|
PIByteArray send_data;
|
||||||
PIThread sendt;
|
PIThread sendt;
|
||||||
PITimer x_timer;
|
PITimer x_timer;
|
||||||
CDSection k_, x_, c_;
|
CDSection k_, x_, c_, m_;
|
||||||
PIMutex x_mutex;
|
PIMutex x_mutex;
|
||||||
PIVector<PIDeque<int> > x_selected;
|
PIVector<PIDeque<int> > x_selected;
|
||||||
PIMap<PIString, OHPair> c_handlers;
|
PIMap<PIString, OHPair> c_handlers;
|
||||||
|
|||||||
@@ -35,6 +35,13 @@ Interface::Interface(CDType::cdT type_) {
|
|||||||
CONNECTU(core, C_ReceiveFail, this, receiveFailed);
|
CONNECTU(core, C_ReceiveFail, this, receiveFailed);
|
||||||
CONNECTU(core, C_ChangedGlobal, this, changedGlobal);
|
CONNECTU(core, C_ChangedGlobal, this, changedGlobal);
|
||||||
break;
|
break;
|
||||||
|
case CDType::cdM:
|
||||||
|
CONNECTU(core, M_Sended, this, sended);
|
||||||
|
CONNECTU(core, M_SendFail, this, sendFailed);
|
||||||
|
CONNECTU(core, M_Received, this, received);
|
||||||
|
CONNECTU(core, M_ReceiveFail, this, receiveFailed);
|
||||||
|
CONNECTU(core, M_ChangedGlobal, this, changedGlobal);
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
cd_utils/cdutils_m.cpp
Normal file
22
cd_utils/cdutils_m.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "cdutils_m.h"
|
||||||
|
#include "cdutils_core.h"
|
||||||
|
|
||||||
|
using namespace CDUtils;
|
||||||
|
|
||||||
|
MInterface M;
|
||||||
|
|
||||||
|
|
||||||
|
MInterface::MInterface(): Interface(CDType::cdM) {
|
||||||
|
CONNECTU(core, M_Message, this, messageReceived);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MInterface::messageBox(const CDType & m, const PIString & msg) {
|
||||||
|
core->sendMessage(m, MessageBox, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PICout MInterface::createPICout(const CDType & m) const {
|
||||||
|
PIString * buff = new PIString("[" + CDCore::pathToString(m.path()) + "]");
|
||||||
|
return PICout(buff, 1);
|
||||||
|
}
|
||||||
36
cd_utils/cdutils_m.h
Normal file
36
cd_utils/cdutils_m.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef CDUTILS_M_H
|
||||||
|
#define CDUTILS_M_H
|
||||||
|
|
||||||
|
#include "cdutils_interface.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace CDUtils {
|
||||||
|
|
||||||
|
|
||||||
|
class MInterface: public Interface
|
||||||
|
{
|
||||||
|
PIOBJECT_SUBCLASS(MInterface, Interface)
|
||||||
|
public:
|
||||||
|
MInterface();
|
||||||
|
|
||||||
|
PICout operator [](int v) {return createPICout((*s)[v]);}
|
||||||
|
PICout operator [](int v) const {return createPICout((*s)[v]);}
|
||||||
|
PICout operator [](const PIString & name_) {return createPICout((*s)[name_]);}
|
||||||
|
PICout operator [](const PIString & name_) const {return createPICout((*s)[name_]);}
|
||||||
|
PICout operator [](const PIDeque<int> & path_) {return createPICout((*s)[path_]);}
|
||||||
|
PICout operator [](const PIDeque<int> & path_) const {return createPICout((*s)[path_]);}
|
||||||
|
|
||||||
|
void messageBox(const CDType & m, const PIString & msg);
|
||||||
|
|
||||||
|
EVENT3(messageReceived, PIDeque<int>, path, int, type, PIString, msg)
|
||||||
|
|
||||||
|
private:
|
||||||
|
PICout createPICout(const CDType & m) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extern CDUtils::MInterface M;
|
||||||
|
|
||||||
|
#endif // CDUTILS_M_H
|
||||||
@@ -184,10 +184,11 @@ CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
|||||||
}
|
}
|
||||||
// piCout << "[CDSection] parse end";
|
// piCout << "[CDSection] parse end";
|
||||||
switch (et) {
|
switch (et) {
|
||||||
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(et);
|
case CDType::cdM: return sections.value("MDescription");
|
||||||
|
default: return CDSection(et);
|
||||||
}
|
}
|
||||||
return CDSection(et);
|
return CDSection(et);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,22 +5,27 @@
|
|||||||
|
|
||||||
namespace CDUtils {
|
namespace CDUtils {
|
||||||
|
|
||||||
enum CDPacketType {CD_Ping,
|
enum CDPacketType {
|
||||||
CD_Pong,
|
CD_Ping,
|
||||||
|
CD_Pong,
|
||||||
|
|
||||||
CD_KQuery,
|
CD_KQuery,
|
||||||
CD_KSend,
|
CD_KSend,
|
||||||
CD_KDirectChange,
|
CD_KDirectChange,
|
||||||
|
|
||||||
CD_XQuery,
|
CD_XQuery,
|
||||||
CD_XSend,
|
CD_XSend,
|
||||||
CD_XRequest,
|
CD_XRequest,
|
||||||
CD_XValues,
|
CD_XValues,
|
||||||
|
|
||||||
CD_CQuery,
|
CD_CQuery,
|
||||||
CD_CSend,
|
CD_CSend,
|
||||||
CD_Command,
|
CD_Command,
|
||||||
};
|
|
||||||
|
CD_MQuery,
|
||||||
|
CD_MSend,
|
||||||
|
CD_Message,
|
||||||
|
};
|
||||||
|
|
||||||
# pragma pack(push,1)
|
# pragma pack(push,1)
|
||||||
|
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
// 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" << "m";
|
||||||
if (prefix.isEmpty()) l = "[" + cdtl[cd_type_] + "]";
|
if (prefix.isEmpty()) l = "[" + cdtl[cd_type_] + "]";
|
||||||
else l = "[" + prefix + "." + cdtl[cd_type_] + "]";
|
else l = "[" + prefix + "." + cdtl[cd_type_] + "]";
|
||||||
l += "\n";
|
l += "\n";
|
||||||
@@ -478,6 +478,7 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
break;
|
break;
|
||||||
case CDType::cdC:
|
case CDType::cdC:
|
||||||
|
case CDType::cdM:
|
||||||
l.clear(); l << ck.index() << ".name = " << ck.name() << " #s " << ck.comment() << " \n";
|
l.clear(); l << ck.index() << ".name = " << ck.name() << " #s " << ck.comment() << " \n";
|
||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
break;
|
break;
|
||||||
@@ -502,7 +503,7 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
void CDSection::read(const void * ep) {
|
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" << "m";
|
||||||
cd.clear();
|
cd.clear();
|
||||||
s.clear();
|
s.clear();
|
||||||
PIConfig::Entry & e(*(PIConfig::Entry*)ep);
|
PIConfig::Entry & e(*(PIConfig::Entry*)ep);
|
||||||
@@ -534,6 +535,7 @@ void CDSection::read(const void * ep) {
|
|||||||
c.x_enabled = e->getValue("sel", false).value().toBool();
|
c.x_enabled = e->getValue("sel", false).value().toBool();
|
||||||
break;
|
break;
|
||||||
case CDType::cdC:
|
case CDType::cdC:
|
||||||
|
case CDType::cdM:
|
||||||
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString() , e->getValue("name").comment(), cd_type_);
|
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString() , e->getValue("name").comment(), cd_type_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ enum UpdateMode {
|
|||||||
Merge = 0x04
|
Merge = 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MessageType {
|
||||||
|
Log = 1,
|
||||||
|
MessageBox,
|
||||||
|
};
|
||||||
|
|
||||||
typedef PIFlags<UpdateMode> UpdateModeFlags;
|
typedef PIFlags<UpdateMode> UpdateModeFlags;
|
||||||
|
|
||||||
class CDType {
|
class CDType {
|
||||||
@@ -29,7 +34,7 @@ class CDType {
|
|||||||
friend class Interface;
|
friend class Interface;
|
||||||
friend class XInterface;
|
friend class XInterface;
|
||||||
public:
|
public:
|
||||||
enum cdT {cdNull, cdK, cdX, cdC};
|
enum cdT {cdNull, cdK, cdX, cdC, cdM};
|
||||||
enum XMode {X_Current, X_All_Avg};
|
enum XMode {X_Current, X_All_Avg};
|
||||||
|
|
||||||
CDType();
|
CDType();
|
||||||
@@ -153,10 +158,11 @@ inline PICout operator <<(PICout s, const CDUtils::CDType & v) {
|
|||||||
s.space();
|
s.space();
|
||||||
s.setControl(0, true);
|
s.setControl(0, true);
|
||||||
switch (v.cd_type()) {
|
switch (v.cd_type()) {
|
||||||
case CDUtils::CDType::cdK : s << "K["; break;
|
case CDUtils::CDType::cdK : s << "K["; break;
|
||||||
case CDUtils::CDType::cdX : s << "X["; break;
|
case CDUtils::CDType::cdX : s << "X["; break;
|
||||||
case CDUtils::CDType::cdC : s << "C["; break;
|
case CDUtils::CDType::cdC : s << "C["; break;
|
||||||
default : s << "Null["; break;
|
case CDUtils::CDType::cdM : s << "M["; break;
|
||||||
|
default : s << "Null["; break;
|
||||||
}
|
}
|
||||||
s << v.name() << "(" << v.index() << ")] = " << v.value();
|
s << v.name() << "(" << v.index() << ")] = " << v.value();
|
||||||
s.restoreControl();
|
s.restoreControl();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
#include "cdutils_x.h"
|
#include "cdutils_x.h"
|
||||||
#include "cdutils_c.h"
|
#include "cdutils_c.h"
|
||||||
|
#include "cdutils_m.h"
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "cdtest.h"
|
#include "cdtest.h"
|
||||||
#include "pip.h"
|
#include "pip.h"
|
||||||
@@ -72,7 +73,11 @@ class Core : public PIObject
|
|||||||
}
|
}
|
||||||
EVENT_HANDLER(void, timerDone) {test();}
|
EVENT_HANDLER(void, timerDone) {test();}
|
||||||
EVENT_HANDLER(void, cmd) {piCout << "command cmd";}
|
EVENT_HANDLER(void, cmd) {piCout << "command cmd";}
|
||||||
EVENT_HANDLER(void, c_Pause) {piCout << "command pause";}
|
EVENT_HANDLER(void, c_Pause) {
|
||||||
|
piCout << "command pause";
|
||||||
|
M[KD::Main] << "rec command" << C[KD::Pause];
|
||||||
|
M.messageBox(M.root()[KD::Core], "init successfull");
|
||||||
|
}
|
||||||
EVENT_HANDLER(void, c_Spectrometer_Connection) {piCout << "command spec_conn";}
|
EVENT_HANDLER(void, c_Spectrometer_Connection) {piCout << "command spec_conn";}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ enum CDescription {
|
|||||||
Pause, //b Global fourier enable flag
|
Pause, //b Global fourier enable flag
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MDescription {
|
||||||
|
Main, //b
|
||||||
|
Core, //s
|
||||||
|
Warnings, //b Global fourier enable flag
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // K_DESCRIPTION_H
|
#endif // K_DESCRIPTION_H
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ void EvalSpinBox::wheelEvent(QWheelEvent * event) {
|
|||||||
|
|
||||||
void EvalSpinBox::stepByDouble(double steps) {
|
void EvalSpinBox::stepByDouble(double steps) {
|
||||||
//qDebug() << "step" << steps;
|
//qDebug() << "step" << steps;
|
||||||
|
if (isReadOnly()) return;
|
||||||
QString t = text();
|
QString t = text();
|
||||||
if (eval.check(t)) {
|
if (eval.check(t)) {
|
||||||
t = eval.expression();
|
t = eval.expression();
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
<file>icons/dialog-cancel.png</file>
|
<file>icons/dialog-cancel.png</file>
|
||||||
<file>icons/dialog-ok-apply.png</file>
|
<file>icons/dialog-ok-apply.png</file>
|
||||||
<file>icons/timer.png</file>
|
<file>icons/timer.png</file>
|
||||||
<file>icons/document-revert.png</file>
|
<file>icons/document-revert.png</file>
|
||||||
<file>icons/flame.png</file>
|
<file>icons/flame.png</file>
|
||||||
<file>icons/view-refresh.png</file>
|
<file>icons/view-refresh.png</file>
|
||||||
<file>icons/format-stroke-color.png</file>
|
<file>icons/format-stroke-color.png</file>
|
||||||
</qresource>
|
<file>icons/accessories-text-editor.png</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
#include "cdutils_x.h"
|
#include "cdutils_x.h"
|
||||||
|
#include "cdutils_m.h"
|
||||||
#include "qcd_core.h"
|
#include "qcd_core.h"
|
||||||
#include "qcd_view.h"
|
#include "qcd_view.h"
|
||||||
#include "qcd_model.h"
|
#include "qcd_model.h"
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
@@ -30,9 +32,11 @@ CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWin
|
|||||||
widgetK->setType(CDUtils::CDType::cdK);
|
widgetK->setType(CDUtils::CDType::cdK);
|
||||||
widgetX->setType(CDUtils::CDType::cdX);
|
widgetX->setType(CDUtils::CDType::cdX);
|
||||||
widgetC->setType(CDUtils::CDType::cdC);
|
widgetC->setType(CDUtils::CDType::cdC);
|
||||||
|
widgetM->setType(CDUtils::CDType::cdM);
|
||||||
editFileK->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
editFileK->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||||
editFileX->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
editFileX->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||||
editFileC->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
editFileC->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||||
|
editFileM->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||||
log_icons[CDViewWidget::OKIcon] = QIcon(":/icons/dialog-ok-apply.png");
|
log_icons[CDViewWidget::OKIcon] = QIcon(":/icons/dialog-ok-apply.png");
|
||||||
log_icons[CDViewWidget::FailIcon] = QIcon(":/icons/dialog-cancel.png");
|
log_icons[CDViewWidget::FailIcon] = QIcon(":/icons/dialog-cancel.png");
|
||||||
log_icons[CDViewWidget::WaitIcon] = QIcon(":/icons/timer.png");
|
log_icons[CDViewWidget::WaitIcon] = QIcon(":/icons/timer.png");
|
||||||
@@ -46,9 +50,11 @@ CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWin
|
|||||||
connect(widgetK, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
connect(widgetK, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||||
connect(widgetX, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
connect(widgetX, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||||
connect(widgetC, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
connect(widgetC, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||||
|
connect(widgetM, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||||
connect(widgetK->view, SIGNAL(changedGlobal()), widgetDirectK, SLOT(changedGlobal()));
|
connect(widgetK->view, SIGNAL(changedGlobal()), widgetDirectK, SLOT(changedGlobal()));
|
||||||
connect(widgetX->view, SIGNAL(changedGlobal()), widgetGraphics, SLOT(changedGlobal()));
|
connect(widgetX->view, SIGNAL(changedGlobal()), widgetGraphics, SLOT(changedGlobal()));
|
||||||
connect(widgetX->view, SIGNAL(receivedX()), widgetGraphics, SLOT(receivedX()));
|
connect(widgetX->view, SIGNAL(receivedX()), widgetGraphics, SLOT(receivedX()));
|
||||||
|
connect(widgetM->view, SIGNAL(messageReceived(QString,int,QString)), this, SLOT(messageReceived(QString,int,QString)));
|
||||||
QCDCore::instance()->bindWidget(widgetK->view);
|
QCDCore::instance()->bindWidget(widgetK->view);
|
||||||
QCDCore::instance()->setDirectKEnabled(true);
|
QCDCore::instance()->setDirectKEnabled(true);
|
||||||
X.start();
|
X.start();
|
||||||
@@ -71,6 +77,7 @@ void CDPultWindow::apply(bool sessions) {
|
|||||||
widgetK->setFile(editFileK->value().value<QAD::File>().file);
|
widgetK->setFile(editFileK->value().value<QAD::File>().file);
|
||||||
widgetX->setFile(editFileX->value().value<QAD::File>().file);
|
widgetX->setFile(editFileX->value().value<QAD::File>().file);
|
||||||
widgetC->setFile(editFileC->value().value<QAD::File>().file);
|
widgetC->setFile(editFileC->value().value<QAD::File>().file);
|
||||||
|
widgetM->setFile(editFileM->value().value<QAD::File>().file);
|
||||||
if (checkDefaultConfig->isChecked())
|
if (checkDefaultConfig->isChecked())
|
||||||
CDCore::instance()->initPult();
|
CDCore::instance()->initPult();
|
||||||
else
|
else
|
||||||
@@ -92,6 +99,7 @@ void CDPultWindow::apply(bool sessions) {
|
|||||||
dockCDKView->setVisible(checkHasK->isChecked());
|
dockCDKView->setVisible(checkHasK->isChecked());
|
||||||
dockCDXView->setVisible(checkHasX->isChecked());
|
dockCDXView->setVisible(checkHasX->isChecked());
|
||||||
dockCDCView->setVisible(checkHasC->isChecked());
|
dockCDCView->setVisible(checkHasC->isChecked());
|
||||||
|
dockCDMView->setVisible(checkHasM->isChecked());
|
||||||
QMetaObject::invokeMethod(this, "changedDock", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "changedDock", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +129,7 @@ bool CDPultWindow::load(const QString & path) {
|
|||||||
editFileK->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_k").value(), f.filter)));
|
editFileK->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_k").value(), f.filter)));
|
||||||
editFileX->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_x").value(), f.filter)));
|
editFileX->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_x").value(), f.filter)));
|
||||||
editFileC->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_c").value(), f.filter)));
|
editFileC->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_c").value(), f.filter)));
|
||||||
|
editFileM->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_m").value(), f.filter)));
|
||||||
checkSyncFiles->setChecked(conf.getValue("sync_files"));
|
checkSyncFiles->setChecked(conf.getValue("sync_files"));
|
||||||
lineSessionName->setText(conf.getValue("session_name"));
|
lineSessionName->setText(conf.getValue("session_name"));
|
||||||
last_icon = conf.getValue("icon_path", "").value();
|
last_icon = conf.getValue("icon_path", "").value();
|
||||||
@@ -128,6 +137,7 @@ bool CDPultWindow::load(const QString & path) {
|
|||||||
checkHasK->setChecked(conf.getValue("has_k"));
|
checkHasK->setChecked(conf.getValue("has_k"));
|
||||||
checkHasX->setChecked(conf.getValue("has_x"));
|
checkHasX->setChecked(conf.getValue("has_x"));
|
||||||
checkHasC->setChecked(conf.getValue("has_c"));
|
checkHasC->setChecked(conf.getValue("has_c"));
|
||||||
|
checkHasM->setChecked(conf.getValue("has_m"));
|
||||||
checkDefaultConfig->setChecked(conf.getValue("default_config"));
|
checkDefaultConfig->setChecked(conf.getValue("default_config"));
|
||||||
codeConfig->setText(QByteArray2QString(conf.getValue("config", QByteArray())));
|
codeConfig->setText(QByteArray2QString(conf.getValue("config", QByteArray())));
|
||||||
if (codeConfig->text().isEmpty())
|
if (codeConfig->text().isEmpty())
|
||||||
@@ -152,6 +162,7 @@ bool CDPultWindow::save(const QString & path) {
|
|||||||
conf.setValue("file_k", editFileK->value().value<QAD::File>().file);
|
conf.setValue("file_k", editFileK->value().value<QAD::File>().file);
|
||||||
conf.setValue("file_x", editFileX->value().value<QAD::File>().file);
|
conf.setValue("file_x", editFileX->value().value<QAD::File>().file);
|
||||||
conf.setValue("file_c", editFileC->value().value<QAD::File>().file);
|
conf.setValue("file_c", editFileC->value().value<QAD::File>().file);
|
||||||
|
conf.setValue("file_m", editFileM->value().value<QAD::File>().file);
|
||||||
conf.setValue("sync_files", checkSyncFiles->isChecked());
|
conf.setValue("sync_files", checkSyncFiles->isChecked());
|
||||||
conf.setValue("session_name", lineSessionName->text());
|
conf.setValue("session_name", lineSessionName->text());
|
||||||
conf.setValue("icon_path", last_icon);
|
conf.setValue("icon_path", last_icon);
|
||||||
@@ -159,7 +170,7 @@ bool CDPultWindow::save(const QString & path) {
|
|||||||
conf.setValue("has_k", checkHasK->isChecked());
|
conf.setValue("has_k", checkHasK->isChecked());
|
||||||
conf.setValue("has_x", checkHasX->isChecked());
|
conf.setValue("has_x", checkHasX->isChecked());
|
||||||
conf.setValue("has_c", checkHasC->isChecked());
|
conf.setValue("has_c", checkHasC->isChecked());
|
||||||
conf.setValue("has_c", checkHasC->isChecked());
|
conf.setValue("has_m", checkHasM->isChecked());
|
||||||
conf.setValue("default_config", checkDefaultConfig->isChecked());
|
conf.setValue("default_config", checkDefaultConfig->isChecked());
|
||||||
conf.setValue("config", QString2QByteArray(codeConfig->text()));
|
conf.setValue("config", QString2QByteArray(codeConfig->text()));
|
||||||
conf.setValue("session_gr", session_gr);
|
conf.setValue("session_gr", session_gr);
|
||||||
@@ -215,18 +226,29 @@ void CDPultWindow::addToLog(CDViewWidget::LogIcon icon, const QString & msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDPultWindow::messageReceived(QString path, int type, QString msg) {
|
||||||
|
MessageType mt = (MessageType)type;
|
||||||
|
const CDType & t(M.root()[CDCore::stringToPath(Q2PIString(path))]);
|
||||||
|
if (t.cd_type() != CDType::cdM) return;
|
||||||
|
if (mt == MessageBox)
|
||||||
|
QMessageBox::information(this, windowTitle(), QString("[%1]\n%2").arg(PI2QString(t.name()), msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
||||||
if (!checkSyncFiles->isChecked()) return;
|
if (!checkSyncFiles->isChecked()) return;
|
||||||
QFileInfo fi(p.value<QAD::File>().file);
|
QFileInfo fi(p.value<QAD::File>().file);
|
||||||
if (fi.path().isEmpty()) return;
|
if (fi.path().isEmpty()) return;
|
||||||
QString n = fi.baseName();
|
QString n = fi.baseName();
|
||||||
QString xn(n), cn(n);
|
QString xn(n), cn(n), mn(n);
|
||||||
if (n.contains("k")) {
|
if (n.contains("k")) {
|
||||||
xn.replace(n.indexOf("k"), 1, "x");
|
xn.replace(n.indexOf("k"), 1, "x");
|
||||||
cn.replace(n.indexOf("k"), 1, "c");
|
cn.replace(n.indexOf("k"), 1, "c");
|
||||||
|
mn.replace(n.indexOf("k"), 1, "m");
|
||||||
} else {
|
} else {
|
||||||
xn += "_x";
|
xn += "_x";
|
||||||
cn += "_c";
|
cn += "_c";
|
||||||
|
mn += "_m";
|
||||||
}
|
}
|
||||||
QString ext = fi.suffix(), dot, dir;
|
QString ext = fi.suffix(), dot, dir;
|
||||||
QString kfn(fi.filePath());
|
QString kfn(fi.filePath());
|
||||||
@@ -245,6 +267,7 @@ void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
|||||||
QAD::File f = editFileK->value().value<QAD::File>();
|
QAD::File f = editFileK->value().value<QAD::File>();
|
||||||
f.file = dir + xn + dot + ext; editFileX->setValue(QVariant::fromValue(f));
|
f.file = dir + xn + dot + ext; editFileX->setValue(QVariant::fromValue(f));
|
||||||
f.file = dir + cn + dot + ext; editFileC->setValue(QVariant::fromValue(f));
|
f.file = dir + cn + dot + ext; editFileC->setValue(QVariant::fromValue(f));
|
||||||
|
f.file = dir + mn + dot + ext; editFileM->setValue(QVariant::fromValue(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
|
void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
|
||||||
|
void messageReceived(QString path, int type, QString msg);
|
||||||
|
|
||||||
void on_editFileK_valueChanged(const QVariant & p);
|
void on_editFileK_valueChanged(const QVariant & p);
|
||||||
void on_buttonSessionApply_clicked();
|
void on_buttonSessionApply_clicked();
|
||||||
|
|
||||||
|
|||||||
@@ -218,14 +218,14 @@
|
|||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QVariantEdit" name="editFileC"/>
|
<widget class="QVariantEdit" name="editFileC"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="5" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="checkSyncFiles">
|
<widget class="QCheckBox" name="checkSyncFiles">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sync files</string>
|
<string>Sync files</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="6" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkHasK">
|
<widget class="QCheckBox" name="checkHasK">
|
||||||
@@ -248,15 +248,32 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkHasM">
|
||||||
|
<property name="text">
|
||||||
|
<string>M</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="7" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="checkDefaultConfig">
|
<widget class="QCheckBox" name="checkDefaultConfig">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Default config</string>
|
<string>Default config</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>M file:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QVariantEdit" name="editFileM"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -342,6 +359,25 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="EDockWidget" name="dockCDMView">
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="cdpult.qrc">
|
||||||
|
<normaloff>:/icons/accessories-text-editor.png</normaloff>:/icons/accessories-text-editor.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>M</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>1</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_8">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
|
<item>
|
||||||
|
<widget class="CDViewWidget" name="widgetM" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
<action name="actionOpen">
|
<action name="actionOpen">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../qad/application/qad_application.qrc">
|
<iconset resource="../../qad/application/qad_application.qrc">
|
||||||
@@ -516,11 +552,11 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
|||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>786</x>
|
<x>786</x>
|
||||||
<y>227</y>
|
<y>220</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>786</x>
|
<x>786</x>
|
||||||
<y>179</y>
|
<y>151</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@@ -532,11 +568,11 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
|||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>786</x>
|
<x>786</x>
|
||||||
<y>227</y>
|
<y>220</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>786</x>
|
<x>786</x>
|
||||||
<y>200</y>
|
<y>172</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@@ -547,8 +583,8 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
|||||||
<slot>setDisabled(bool)</slot>
|
<slot>setDisabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>579</x>
|
<x>786</x>
|
||||||
<y>280</y>
|
<y>276</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>581</x>
|
<x>581</x>
|
||||||
@@ -556,5 +592,21 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>checkSyncFiles</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>editFileM</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>767</x>
|
||||||
|
<y>205</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>767</x>
|
||||||
|
<y>187</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
BIN
qcd_utils/pult/icons/accessories-text-editor.png
Normal file
BIN
qcd_utils/pult/icons/accessories-text-editor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
@@ -3,6 +3,7 @@
|
|||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
#include "cdutils_x.h"
|
#include "cdutils_x.h"
|
||||||
#include "cdutils_c.h"
|
#include "cdutils_c.h"
|
||||||
|
#include "cdutils_m.h"
|
||||||
#include "cdutils_core.h"
|
#include "cdutils_core.h"
|
||||||
#include "qcd_view.h"
|
#include "qcd_view.h"
|
||||||
#include "qcd_model.h"
|
#include "qcd_model.h"
|
||||||
@@ -58,6 +59,14 @@ void CDView::setType(int cdt) {
|
|||||||
CONNECTU(&C, receiveFailed, this, pi_cd_receiveFailed);
|
CONNECTU(&C, receiveFailed, this, pi_cd_receiveFailed);
|
||||||
CONNECTU(&C, changedGlobal, this, pi_cd_changedGlobal);
|
CONNECTU(&C, changedGlobal, this, pi_cd_changedGlobal);
|
||||||
break;
|
break;
|
||||||
|
case CDType::cdM:
|
||||||
|
CONNECTU(&M, sended, this, pi_cd_sendSucceed);
|
||||||
|
CONNECTU(&M, sendFailed, this, pi_cd_sendFailed);
|
||||||
|
CONNECTU(&M, received, this, pi_cd_receiveSucceed);
|
||||||
|
CONNECTU(&M, receiveFailed, this, pi_cd_receiveFailed);
|
||||||
|
CONNECTU(&M, changedGlobal, this, pi_cd_changedGlobal);
|
||||||
|
CONNECTU(&M, messageReceived, this, pi_cd_messageReceived);
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +121,7 @@ void CDView::refresh() {
|
|||||||
setColumnHidden(cExpression, true);
|
setColumnHidden(cExpression, true);
|
||||||
break;
|
break;
|
||||||
case CDType::cdC:
|
case CDType::cdC:
|
||||||
|
case CDType::cdM:
|
||||||
setColumnHidden(cType, true);
|
setColumnHidden(cType, true);
|
||||||
setColumnHidden(cXMode, true);
|
setColumnHidden(cXMode, true);
|
||||||
setColumnHidden(cXAvg, true);
|
setColumnHidden(cXAvg, true);
|
||||||
@@ -136,6 +146,7 @@ void CDView::setFile(const QString & filename) {
|
|||||||
case CDType::cdK: K.setFileName(Q2PIString(filename)); break;
|
case CDType::cdK: K.setFileName(Q2PIString(filename)); break;
|
||||||
case CDType::cdX: X.setFileName(Q2PIString(filename)); break;
|
case CDType::cdX: X.setFileName(Q2PIString(filename)); break;
|
||||||
case CDType::cdC: C.setFileName(Q2PIString(filename)); break;
|
case CDType::cdC: C.setFileName(Q2PIString(filename)); break;
|
||||||
|
case CDType::cdM: M.setFileName(Q2PIString(filename)); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,6 +157,7 @@ bool CDView::inProgress() const {
|
|||||||
case CDType::cdK: return K.inProgress(); break;
|
case CDType::cdK: return K.inProgress(); break;
|
||||||
case CDType::cdX: return X.inProgress(); break;
|
case CDType::cdX: return X.inProgress(); break;
|
||||||
case CDType::cdC: return C.inProgress(); break;
|
case CDType::cdC: return C.inProgress(); break;
|
||||||
|
case CDType::cdM: return M.inProgress(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -176,6 +188,7 @@ void CDView::send() {
|
|||||||
case CDType::cdK: K.send(); break;
|
case CDType::cdK: K.send(); break;
|
||||||
case CDType::cdX: X.send(); break;
|
case CDType::cdX: X.send(); break;
|
||||||
case CDType::cdC: C.send(); break;
|
case CDType::cdC: C.send(); break;
|
||||||
|
case CDType::cdM: M.send(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,6 +200,7 @@ void CDView::receive() {
|
|||||||
case CDType::cdK: K.request(); break;
|
case CDType::cdK: K.request(); break;
|
||||||
case CDType::cdX: X.request(); break;
|
case CDType::cdX: X.request(); break;
|
||||||
case CDType::cdC: C.request(); break;
|
case CDType::cdC: C.request(); break;
|
||||||
|
case CDType::cdM: M.request(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,6 +211,7 @@ void CDView::save() {
|
|||||||
case CDType::cdK: K.writeFile(); break;
|
case CDType::cdK: K.writeFile(); break;
|
||||||
case CDType::cdX: X.writeFile(); break;
|
case CDType::cdX: X.writeFile(); break;
|
||||||
case CDType::cdC: C.writeFile(); break;
|
case CDType::cdC: C.writeFile(); break;
|
||||||
|
case CDType::cdM: M.writeFile(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,6 +231,10 @@ void CDView::load() {
|
|||||||
C.readFile();
|
C.readFile();
|
||||||
C.calculate();
|
C.calculate();
|
||||||
break;
|
break;
|
||||||
|
case CDType::cdM:
|
||||||
|
M.readFile();
|
||||||
|
M.calculate();
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
@@ -228,6 +247,7 @@ void CDView::clear() {
|
|||||||
case CDType::cdK: K.root() = CDSection(); break;
|
case CDType::cdK: K.root() = CDSection(); break;
|
||||||
case CDType::cdX: X.root() = CDSection(); break;
|
case CDType::cdX: X.root() = CDSection(); break;
|
||||||
case CDType::cdC: C.root() = CDSection(); break;
|
case CDType::cdC: C.root() = CDSection(); break;
|
||||||
|
case CDType::cdM: M.root() = CDSection(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
@@ -242,6 +262,7 @@ void CDView::buildFromHeader(const QString & description, int mode) {
|
|||||||
case CDType::cdK: K.update(&f, mode); break;
|
case CDType::cdK: K.update(&f, mode); break;
|
||||||
case CDType::cdX: X.update(&f, mode); break;
|
case CDType::cdX: X.update(&f, mode); break;
|
||||||
case CDType::cdC: C.update(&f, mode); break;
|
case CDType::cdC: C.update(&f, mode); break;
|
||||||
|
case CDType::cdM: M.update(&f, mode); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
@@ -253,6 +274,7 @@ void CDView::calculate() {
|
|||||||
case CDType::cdK: K.calculate(); break;
|
case CDType::cdK: K.calculate(); break;
|
||||||
case CDType::cdX: X.calculate(); break;
|
case CDType::cdX: X.calculate(); break;
|
||||||
case CDType::cdC: C.calculate(); break;
|
case CDType::cdC: C.calculate(); break;
|
||||||
|
case CDType::cdM: M.calculate(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,3 +343,11 @@ void CDView::cd_receivedX() {
|
|||||||
void CDView::cd_changedGlobal() {
|
void CDView::cd_changedGlobal() {
|
||||||
emit changedGlobal();
|
emit changedGlobal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDView::pi_cd_messageReceived(PIDeque<int> path, int type, PIString msg) {
|
||||||
|
QMetaObject::invokeMethod(this, "messageReceived", Qt::QueuedConnection,
|
||||||
|
Q_ARG(QString, PI2QString(CDCore::pathToString(path))),
|
||||||
|
Q_ARG(int, type),
|
||||||
|
Q_ARG(QString, PI2QString(msg)));
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ private:
|
|||||||
EVENT_HANDLER(void, pi_cd_receiveSucceed) {emit _qcd_receiveSucceed();}
|
EVENT_HANDLER(void, pi_cd_receiveSucceed) {emit _qcd_receiveSucceed();}
|
||||||
EVENT_HANDLER(void, pi_cd_receivedX) {emit _qcd_receivedX();}
|
EVENT_HANDLER(void, pi_cd_receivedX) {emit _qcd_receivedX();}
|
||||||
EVENT_HANDLER(void, pi_cd_changedGlobal) {emit _qcd_changedGlobal();}
|
EVENT_HANDLER(void, pi_cd_changedGlobal) {emit _qcd_changedGlobal();}
|
||||||
|
EVENT_HANDLER3(void, pi_cd_messageReceived, PIDeque<int>, path, int, type, PIString, msg);
|
||||||
|
|
||||||
CDItemModel * model_;
|
CDItemModel * model_;
|
||||||
int type_;
|
int type_;
|
||||||
@@ -73,6 +74,7 @@ signals:
|
|||||||
void changedGlobal();
|
void changedGlobal();
|
||||||
void messageStatus(QString msg);
|
void messageStatus(QString msg);
|
||||||
void commandSended(QString msg);
|
void commandSended(QString msg);
|
||||||
|
void messageReceived(QString path, int type, QString msg);
|
||||||
void busyStatusChanged(bool busy);
|
void busyStatusChanged(bool busy);
|
||||||
|
|
||||||
void _qcd_sendFailed(); // PRIVATE
|
void _qcd_sendFailed(); // PRIVATE
|
||||||
|
|||||||
Reference in New Issue
Block a user