git-svn-id: svn://db.shs.com.ru/libs@415 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -7,9 +7,10 @@
|
||||
<file>icons/dialog-cancel.png</file>
|
||||
<file>icons/dialog-ok-apply.png</file>
|
||||
<file>icons/timer.png</file>
|
||||
<file>icons/document-revert.png</file>
|
||||
<file>icons/flame.png</file>
|
||||
<file>icons/view-refresh.png</file>
|
||||
<file>icons/format-stroke-color.png</file>
|
||||
</qresource>
|
||||
<file>icons/document-revert.png</file>
|
||||
<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