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");
|
||||
datatr.setPacketSize(960);
|
||||
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
|
||||
CONNECTU(PICout::Notifier::object(), finished, this, piCoutFinished);
|
||||
/*PIString s(app_config);
|
||||
connection.configureFromString(&s);
|
||||
connection.start();*/
|
||||
@@ -68,9 +69,11 @@ CDCore::CDCore() {
|
||||
k_.cd_type_ = CDType::cdK;
|
||||
x_.cd_type_ = CDType::cdX;
|
||||
c_.cd_type_ = CDType::cdC;
|
||||
m_.cd_type_ = CDType::cdM;
|
||||
initRoot(&k_);
|
||||
initRoot(&x_);
|
||||
initRoot(&c_);
|
||||
initRoot(&m_);
|
||||
|
||||
CONNECTU(&datatr, sendRequest, this, dtSendRequest)
|
||||
CONNECTU(&datatr, receiveFinished, this, dtReceiveFinished)
|
||||
@@ -169,6 +172,7 @@ void CDCore::send(CDType::cdT cdt) {
|
||||
case CDType::cdK: pt = CD_KSend; break;
|
||||
case CDType::cdX: pt = CD_XSend; break;
|
||||
case CDType::cdC: pt = CD_CSend; break;
|
||||
case CDType::cdM: pt = CD_MSend; break;
|
||||
default: break;
|
||||
}
|
||||
piCoutObj << "send" << typeLetter(cdt);
|
||||
@@ -182,6 +186,7 @@ void CDCore::request(CDType::cdT cdt) {
|
||||
case CDType::cdK: pt = CD_KQuery; break;
|
||||
case CDType::cdX: pt = CD_XQuery; break;
|
||||
case CDType::cdC: pt = CD_CQuery; break;
|
||||
case CDType::cdM: pt = CD_MQuery; break;
|
||||
default: break;
|
||||
}
|
||||
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) {
|
||||
switch (cdt) {
|
||||
case CDType::cdK: return &k_; break;
|
||||
case CDType::cdX: return &x_; break;
|
||||
case CDType::cdC: return &c_; break;
|
||||
case CDType::cdM: return &m_; break;
|
||||
default: break;
|
||||
}
|
||||
return 0;
|
||||
@@ -269,6 +283,7 @@ PIString CDCore::typeLetter(CDType::cdT cdt) {
|
||||
case CDType::cdK: return PIStringAscii("k"); break;
|
||||
case CDType::cdX: return PIStringAscii("x"); break;
|
||||
case CDType::cdC: return PIStringAscii("c"); break;
|
||||
case CDType::cdM: return PIStringAscii("m"); break;
|
||||
default: break;
|
||||
}
|
||||
return PIString();
|
||||
@@ -320,6 +335,13 @@ void CDCore::sendThread() {
|
||||
case CD_CQuery:
|
||||
if (!ok) C_ReceiveFail();
|
||||
break;
|
||||
case CD_MSend:
|
||||
if (ok) M_Sended();
|
||||
else M_SendFail();
|
||||
break;
|
||||
case CD_MQuery:
|
||||
if (!ok) M_ReceiveFail();
|
||||
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) {
|
||||
r->name = "__root__";
|
||||
r->alias = "root";
|
||||
@@ -470,6 +501,31 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
|
||||
//piCoutObj << "found" << sp << h.first;
|
||||
if (h.first && h.second) h.second(h.first);
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -480,6 +536,7 @@ void CDCore::raiseChangedGlobal(CDType::cdT cdt) {
|
||||
case CDType::cdK: K_ChangedGlobal(); break;
|
||||
case CDType::cdX: X_ChangedGlobal(); break;
|
||||
case CDType::cdC: C_ChangedGlobal(); break;
|
||||
case CDType::cdM: M_ChangedGlobal(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,13 @@ public:
|
||||
EVENT(C_ReceiveFail)
|
||||
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_read (CDSection * cd, PIIODevice * d);
|
||||
void cd_parse (CDSection * cd, PIIODevice * d);
|
||||
@@ -69,8 +76,8 @@ public:
|
||||
void sendCommand(const CDType & c);
|
||||
void registerCHandler(const CDType & c, PIObject * o, Handler h);
|
||||
bool inProgress() {return sendt.isRunning();}
|
||||
void sendMessage(const CDType & m, MessageType mt, const PIString & msg);
|
||||
|
||||
CDSection & k() {return k_;}
|
||||
CDSection * root(CDType::cdT cdt);
|
||||
PIString typeLetter(CDType::cdT cdt);
|
||||
static PIString pathToString(const PIDeque<int> & p);
|
||||
@@ -87,6 +94,7 @@ private:
|
||||
EVENT_HANDLER1(void, dtReceiveFinished, bool, ok);
|
||||
EVENT_HANDLER(void, sendThread);
|
||||
EVENT_HANDLER(void, xTimerTick);
|
||||
EVENT_HANDLER2(void, piCoutFinished, int, id, PIString*, buffer);
|
||||
void initRoot(CDSection * r);
|
||||
PIByteArray makeHeader(CDPacketType type, int session_id = 0) const;
|
||||
void sendDirect(PIByteArray & ba);
|
||||
@@ -102,7 +110,7 @@ private:
|
||||
PIByteArray send_data;
|
||||
PIThread sendt;
|
||||
PITimer x_timer;
|
||||
CDSection k_, x_, c_;
|
||||
CDSection k_, x_, c_, m_;
|
||||
PIMutex x_mutex;
|
||||
PIVector<PIDeque<int> > x_selected;
|
||||
PIMap<PIString, OHPair> c_handlers;
|
||||
|
||||
@@ -35,6 +35,13 @@ Interface::Interface(CDType::cdT type_) {
|
||||
CONNECTU(core, C_ReceiveFail, this, receiveFailed);
|
||||
CONNECTU(core, C_ChangedGlobal, this, changedGlobal);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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,9 +184,10 @@ CDSection CDParser::parse(PIIODevice * d, int cdsection_type) {
|
||||
}
|
||||
// piCout << "[CDSection] parse end";
|
||||
switch (et) {
|
||||
case CDType::cdK : return sections.value("KDescription");
|
||||
case CDType::cdX : return sections.value("XDescription");
|
||||
case CDType::cdC : return sections.value("CDescription");
|
||||
case CDType::cdK: return sections.value("KDescription");
|
||||
case CDType::cdX: return sections.value("XDescription");
|
||||
case CDType::cdC: return sections.value("CDescription");
|
||||
case CDType::cdM: return sections.value("MDescription");
|
||||
default: return CDSection(et);
|
||||
}
|
||||
return CDSection(et);
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
namespace CDUtils {
|
||||
|
||||
enum CDPacketType {CD_Ping,
|
||||
enum CDPacketType {
|
||||
CD_Ping,
|
||||
CD_Pong,
|
||||
|
||||
CD_KQuery,
|
||||
@@ -20,6 +21,10 @@ enum CDPacketType {CD_Ping,
|
||||
CD_CQuery,
|
||||
CD_CSend,
|
||||
CD_Command,
|
||||
|
||||
CD_MQuery,
|
||||
CD_MSend,
|
||||
CD_Message,
|
||||
};
|
||||
|
||||
# pragma pack(push,1)
|
||||
|
||||
@@ -437,7 +437,7 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
||||
// piCout << "[CDSection] write start";
|
||||
PIString l;
|
||||
PIStringList cdtl;
|
||||
cdtl << "null" << "k" << "x" << "c";
|
||||
cdtl << "null" << "k" << "x" << "c" << "m";
|
||||
if (prefix.isEmpty()) l = "[" + cdtl[cd_type_] + "]";
|
||||
else l = "[" + prefix + "." + cdtl[cd_type_] + "]";
|
||||
l += "\n";
|
||||
@@ -478,6 +478,7 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
||||
d->write(l.toUTF8());
|
||||
break;
|
||||
case CDType::cdC:
|
||||
case CDType::cdM:
|
||||
l.clear(); l << ck.index() << ".name = " << ck.name() << " #s " << ck.comment() << " \n";
|
||||
d->write(l.toUTF8());
|
||||
break;
|
||||
@@ -502,7 +503,7 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
||||
void CDSection::read(const void * ep) {
|
||||
// piCout << "[CDSection] read start";
|
||||
PIStringList cdtl;
|
||||
cdtl << "null" << "k" << "x" << "c";
|
||||
cdtl << "null" << "k" << "x" << "c" << "m";
|
||||
cd.clear();
|
||||
s.clear();
|
||||
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();
|
||||
break;
|
||||
case CDType::cdC:
|
||||
case CDType::cdM:
|
||||
c = CDType(id, e->getValue("name").value(), PIString(), PIString(), PIString() , e->getValue("name").comment(), cd_type_);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,11 @@ enum UpdateMode {
|
||||
Merge = 0x04
|
||||
};
|
||||
|
||||
enum MessageType {
|
||||
Log = 1,
|
||||
MessageBox,
|
||||
};
|
||||
|
||||
typedef PIFlags<UpdateMode> UpdateModeFlags;
|
||||
|
||||
class CDType {
|
||||
@@ -29,7 +34,7 @@ class CDType {
|
||||
friend class Interface;
|
||||
friend class XInterface;
|
||||
public:
|
||||
enum cdT {cdNull, cdK, cdX, cdC};
|
||||
enum cdT {cdNull, cdK, cdX, cdC, cdM};
|
||||
enum XMode {X_Current, X_All_Avg};
|
||||
|
||||
CDType();
|
||||
@@ -156,6 +161,7 @@ inline PICout operator <<(PICout s, const CDUtils::CDType & v) {
|
||||
case CDUtils::CDType::cdK : s << "K["; break;
|
||||
case CDUtils::CDType::cdX : s << "X["; break;
|
||||
case CDUtils::CDType::cdC : s << "C["; break;
|
||||
case CDUtils::CDType::cdM : s << "M["; break;
|
||||
default : s << "Null["; break;
|
||||
}
|
||||
s << v.name() << "(" << v.index() << ")] = " << v.value();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "cdutils_k.h"
|
||||
#include "cdutils_x.h"
|
||||
#include "cdutils_c.h"
|
||||
#include "cdutils_m.h"
|
||||
#include "cdutils_core.h"
|
||||
#include "cdtest.h"
|
||||
#include "pip.h"
|
||||
@@ -72,7 +73,11 @@ class Core : public PIObject
|
||||
}
|
||||
EVENT_HANDLER(void, timerDone) {test();}
|
||||
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";}
|
||||
|
||||
private:
|
||||
|
||||
@@ -136,6 +136,12 @@ enum CDescription {
|
||||
Pause, //b Global fourier enable flag
|
||||
};
|
||||
|
||||
enum MDescription {
|
||||
Main, //b
|
||||
Core, //s
|
||||
Warnings, //b Global fourier enable flag
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // K_DESCRIPTION_H
|
||||
|
||||
@@ -279,6 +279,7 @@ void EvalSpinBox::wheelEvent(QWheelEvent * event) {
|
||||
|
||||
void EvalSpinBox::stepByDouble(double steps) {
|
||||
//qDebug() << "step" << steps;
|
||||
if (isReadOnly()) return;
|
||||
QString t = text();
|
||||
if (eval.check(t)) {
|
||||
t = eval.expression();
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
<file>icons/flame.png</file>
|
||||
<file>icons/view-refresh.png</file>
|
||||
<file>icons/format-stroke-color.png</file>
|
||||
<file>icons/accessories-text-editor.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "cdutils_core.h"
|
||||
#include "cdutils_k.h"
|
||||
#include "cdutils_x.h"
|
||||
#include "cdutils_m.h"
|
||||
#include "qcd_core.h"
|
||||
#include "qcd_view.h"
|
||||
#include "qcd_model.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
#include <QImageReader>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace CDUtils;
|
||||
|
||||
@@ -30,9 +32,11 @@ CDPultWindow::CDPultWindow(QWidget *parent) : EMainWindow(parent), Ui::CDPultWin
|
||||
widgetK->setType(CDUtils::CDType::cdK);
|
||||
widgetX->setType(CDUtils::CDType::cdX);
|
||||
widgetC->setType(CDUtils::CDType::cdC);
|
||||
widgetM->setType(CDUtils::CDType::cdM);
|
||||
editFileK->setValue(QVariant::fromValue(QAD::File("", "*.dat")));
|
||||
editFileX->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::FailIcon] = QIcon(":/icons/dialog-cancel.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(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(widgetM, SIGNAL(addToLog(CDViewWidget::LogIcon,QString)), this, SLOT(addToLog(CDViewWidget::LogIcon,QString)));
|
||||
connect(widgetK->view, SIGNAL(changedGlobal()), widgetDirectK, SLOT(changedGlobal()));
|
||||
connect(widgetX->view, SIGNAL(changedGlobal()), widgetGraphics, SLOT(changedGlobal()));
|
||||
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()->setDirectKEnabled(true);
|
||||
X.start();
|
||||
@@ -71,6 +77,7 @@ void CDPultWindow::apply(bool sessions) {
|
||||
widgetK->setFile(editFileK->value().value<QAD::File>().file);
|
||||
widgetX->setFile(editFileX->value().value<QAD::File>().file);
|
||||
widgetC->setFile(editFileC->value().value<QAD::File>().file);
|
||||
widgetM->setFile(editFileM->value().value<QAD::File>().file);
|
||||
if (checkDefaultConfig->isChecked())
|
||||
CDCore::instance()->initPult();
|
||||
else
|
||||
@@ -92,6 +99,7 @@ void CDPultWindow::apply(bool sessions) {
|
||||
dockCDKView->setVisible(checkHasK->isChecked());
|
||||
dockCDXView->setVisible(checkHasX->isChecked());
|
||||
dockCDCView->setVisible(checkHasC->isChecked());
|
||||
dockCDMView->setVisible(checkHasM->isChecked());
|
||||
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)));
|
||||
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)));
|
||||
editFileM->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_m").value(), f.filter)));
|
||||
checkSyncFiles->setChecked(conf.getValue("sync_files"));
|
||||
lineSessionName->setText(conf.getValue("session_name"));
|
||||
last_icon = conf.getValue("icon_path", "").value();
|
||||
@@ -128,6 +137,7 @@ bool CDPultWindow::load(const QString & path) {
|
||||
checkHasK->setChecked(conf.getValue("has_k"));
|
||||
checkHasX->setChecked(conf.getValue("has_x"));
|
||||
checkHasC->setChecked(conf.getValue("has_c"));
|
||||
checkHasM->setChecked(conf.getValue("has_m"));
|
||||
checkDefaultConfig->setChecked(conf.getValue("default_config"));
|
||||
codeConfig->setText(QByteArray2QString(conf.getValue("config", QByteArray())));
|
||||
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_x", editFileX->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("session_name", lineSessionName->text());
|
||||
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_x", checkHasX->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("config", QString2QByteArray(codeConfig->text()));
|
||||
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) {
|
||||
if (!checkSyncFiles->isChecked()) return;
|
||||
QFileInfo fi(p.value<QAD::File>().file);
|
||||
if (fi.path().isEmpty()) return;
|
||||
QString n = fi.baseName();
|
||||
QString xn(n), cn(n);
|
||||
QString xn(n), cn(n), mn(n);
|
||||
if (n.contains("k")) {
|
||||
xn.replace(n.indexOf("k"), 1, "x");
|
||||
cn.replace(n.indexOf("k"), 1, "c");
|
||||
mn.replace(n.indexOf("k"), 1, "m");
|
||||
} else {
|
||||
xn += "_x";
|
||||
cn += "_c";
|
||||
mn += "_m";
|
||||
}
|
||||
QString ext = fi.suffix(), dot, dir;
|
||||
QString kfn(fi.filePath());
|
||||
@@ -245,6 +267,7 @@ void CDPultWindow::on_editFileK_valueChanged(const QVariant & p) {
|
||||
QAD::File f = editFileK->value().value<QAD::File>();
|
||||
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 + mn + dot + ext; editFileM->setValue(QVariant::fromValue(f));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ private:
|
||||
|
||||
private slots:
|
||||
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_buttonSessionApply_clicked();
|
||||
|
||||
|
||||
@@ -218,14 +218,14 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="QVariantEdit" name="editFileC"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkSyncFiles">
|
||||
<property name="text">
|
||||
<string>Sync files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkHasK">
|
||||
@@ -248,15 +248,32 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkHasM">
|
||||
<property name="text">
|
||||
<string>M</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkDefaultConfig">
|
||||
<property name="text">
|
||||
<string>Default config</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
<item>
|
||||
@@ -342,6 +359,25 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
||||
</layout>
|
||||
</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">
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/application/qad_application.qrc">
|
||||
@@ -516,11 +552,11 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>786</x>
|
||||
<y>227</y>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>786</x>
|
||||
<y>179</y>
|
||||
<y>151</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -532,11 +568,11 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>786</x>
|
||||
<y>227</y>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>786</x>
|
||||
<y>200</y>
|
||||
<y>172</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -547,8 +583,8 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>579</x>
|
||||
<y>280</y>
|
||||
<x>786</x>
|
||||
<y>276</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>581</x>
|
||||
@@ -556,5 +592,21 @@ device.cd = eth://udp:${ip.pult}:27002:${ip.app}:27001 #s
|
||||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
</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_x.h"
|
||||
#include "cdutils_c.h"
|
||||
#include "cdutils_m.h"
|
||||
#include "cdutils_core.h"
|
||||
#include "qcd_view.h"
|
||||
#include "qcd_model.h"
|
||||
@@ -58,6 +59,14 @@ void CDView::setType(int cdt) {
|
||||
CONNECTU(&C, receiveFailed, this, pi_cd_receiveFailed);
|
||||
CONNECTU(&C, changedGlobal, this, pi_cd_changedGlobal);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -112,6 +121,7 @@ void CDView::refresh() {
|
||||
setColumnHidden(cExpression, true);
|
||||
break;
|
||||
case CDType::cdC:
|
||||
case CDType::cdM:
|
||||
setColumnHidden(cType, true);
|
||||
setColumnHidden(cXMode, true);
|
||||
setColumnHidden(cXAvg, true);
|
||||
@@ -136,6 +146,7 @@ void CDView::setFile(const QString & filename) {
|
||||
case CDType::cdK: K.setFileName(Q2PIString(filename)); break;
|
||||
case CDType::cdX: X.setFileName(Q2PIString(filename)); break;
|
||||
case CDType::cdC: C.setFileName(Q2PIString(filename)); break;
|
||||
case CDType::cdM: M.setFileName(Q2PIString(filename)); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -146,6 +157,7 @@ bool CDView::inProgress() const {
|
||||
case CDType::cdK: return K.inProgress(); break;
|
||||
case CDType::cdX: return X.inProgress(); break;
|
||||
case CDType::cdC: return C.inProgress(); break;
|
||||
case CDType::cdM: return M.inProgress(); break;
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
@@ -176,6 +188,7 @@ void CDView::send() {
|
||||
case CDType::cdK: K.send(); break;
|
||||
case CDType::cdX: X.send(); break;
|
||||
case CDType::cdC: C.send(); break;
|
||||
case CDType::cdM: M.send(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -187,6 +200,7 @@ void CDView::receive() {
|
||||
case CDType::cdK: K.request(); break;
|
||||
case CDType::cdX: X.request(); break;
|
||||
case CDType::cdC: C.request(); break;
|
||||
case CDType::cdM: M.request(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -197,6 +211,7 @@ void CDView::save() {
|
||||
case CDType::cdK: K.writeFile(); break;
|
||||
case CDType::cdX: X.writeFile(); break;
|
||||
case CDType::cdC: C.writeFile(); break;
|
||||
case CDType::cdM: M.writeFile(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -216,6 +231,10 @@ void CDView::load() {
|
||||
C.readFile();
|
||||
C.calculate();
|
||||
break;
|
||||
case CDType::cdM:
|
||||
M.readFile();
|
||||
M.calculate();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
refresh();
|
||||
@@ -228,6 +247,7 @@ void CDView::clear() {
|
||||
case CDType::cdK: K.root() = CDSection(); break;
|
||||
case CDType::cdX: X.root() = CDSection(); break;
|
||||
case CDType::cdC: C.root() = CDSection(); break;
|
||||
case CDType::cdM: M.root() = CDSection(); break;
|
||||
default: break;
|
||||
}
|
||||
refresh();
|
||||
@@ -242,6 +262,7 @@ void CDView::buildFromHeader(const QString & description, int mode) {
|
||||
case CDType::cdK: K.update(&f, mode); break;
|
||||
case CDType::cdX: X.update(&f, mode); break;
|
||||
case CDType::cdC: C.update(&f, mode); break;
|
||||
case CDType::cdM: M.update(&f, mode); break;
|
||||
default: break;
|
||||
}
|
||||
refresh();
|
||||
@@ -253,6 +274,7 @@ void CDView::calculate() {
|
||||
case CDType::cdK: K.calculate(); break;
|
||||
case CDType::cdX: X.calculate(); break;
|
||||
case CDType::cdC: C.calculate(); break;
|
||||
case CDType::cdM: M.calculate(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -321,3 +343,11 @@ void CDView::cd_receivedX() {
|
||||
void CDView::cd_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_receivedX) {emit _qcd_receivedX();}
|
||||
EVENT_HANDLER(void, pi_cd_changedGlobal) {emit _qcd_changedGlobal();}
|
||||
EVENT_HANDLER3(void, pi_cd_messageReceived, PIDeque<int>, path, int, type, PIString, msg);
|
||||
|
||||
CDItemModel * model_;
|
||||
int type_;
|
||||
@@ -73,6 +74,7 @@ signals:
|
||||
void changedGlobal();
|
||||
void messageStatus(QString msg);
|
||||
void commandSended(QString msg);
|
||||
void messageReceived(QString path, int type, QString msg);
|
||||
void busyStatusChanged(bool busy);
|
||||
|
||||
void _qcd_sendFailed(); // PRIVATE
|
||||
|
||||
Reference in New Issue
Block a user