git-svn-id: svn://db.shs.com.ru/libs@243 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -62,8 +62,7 @@ CDCore::CDCore() {
|
|||||||
/*PIString s(app_config);
|
/*PIString s(app_config);
|
||||||
connection.configureFromString(&s);
|
connection.configureFromString(&s);
|
||||||
connection.start();*/
|
connection.start();*/
|
||||||
k_.name = "__root__";
|
initRoot(k_);
|
||||||
k_.alias = "root";
|
|
||||||
|
|
||||||
CONNECTU(&datatr, sendRequest, this, dtSendRequest)
|
CONNECTU(&datatr, sendRequest, this, dtSendRequest)
|
||||||
CONNECTU(&datatr, receiveFinished, this, dtReceiveFinished)
|
CONNECTU(&datatr, receiveFinished, this, dtReceiveFinished)
|
||||||
@@ -99,22 +98,20 @@ void CDCore::k_write(PIIODevice * d) {
|
|||||||
void CDCore::k_read(PIIODevice * d) {
|
void CDCore::k_read(PIIODevice * d) {
|
||||||
PIConfig conf(d, PIIODevice::ReadOnly);
|
PIConfig conf(d, PIIODevice::ReadOnly);
|
||||||
k_.read(&(conf.rootEntry()));
|
k_.read(&(conf.rootEntry()));
|
||||||
k_.makePath();
|
initRoot(k_);
|
||||||
K_ChangedGlobal();
|
K_ChangedGlobal();
|
||||||
PIVector<PIIODevice * > ds = connection.allDevices();
|
/*PIVector<PIIODevice * > ds = connection.allDevices();
|
||||||
// piForeach(PIIODevice * d, ds) {
|
piForeach(PIIODevice * d, ds) {
|
||||||
// if (d)
|
if (d)
|
||||||
// piCoutObj << d->constructFullPath() << d->isOpened();
|
piCoutObj << d->constructFullPath() << d->isOpened();
|
||||||
// }
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::k_parse(PIIODevice * d) {
|
void CDCore::k_parse(PIIODevice * d) {
|
||||||
k_ = CDParser::parse(d, CDType::cdK);
|
k_ = CDParser::parse(d, CDType::cdK);
|
||||||
k_.makePath();
|
initRoot(k_);
|
||||||
K_ChangedGlobal();
|
K_ChangedGlobal();
|
||||||
k_.name = "__root__";
|
|
||||||
k_.alias = "root";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -130,8 +127,7 @@ void CDCore::k_update(PIIODevice * d, UpdateModeFlags mode) {
|
|||||||
uk.update(k_, mode);
|
uk.update(k_, mode);
|
||||||
//piCout << k_.count() << uk.count();
|
//piCout << k_.count() << uk.count();
|
||||||
k_ = uk;
|
k_ = uk;
|
||||||
k_.makePath();
|
initRoot(k_);
|
||||||
k_.calculate();
|
|
||||||
K_ChangedGlobal();
|
K_ChangedGlobal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,6 +257,14 @@ void CDCore::xTimerTick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDCore::initRoot(CDSection & r) {
|
||||||
|
r.name = "__root__";
|
||||||
|
r.alias = "root";
|
||||||
|
r.makePath();
|
||||||
|
r.calculate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDCore::dtSendRequest(PIByteArray &data) {
|
void CDCore::dtSendRequest(PIByteArray &data) {
|
||||||
connection.writeByName("cd", data);
|
connection.writeByName("cd", data);
|
||||||
// piCoutObj << "send" << data.size() << ret;
|
// piCoutObj << "send" << data.size() << ret;
|
||||||
|
|||||||
@@ -62,6 +62,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);
|
||||||
|
void initRoot(CDSection & r);
|
||||||
|
|
||||||
static const char app_config[], pult_config[];
|
static const char app_config[], pult_config[];
|
||||||
PIConnection connection;
|
PIConnection connection;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ config(piqt(config_), QIODevice::ReadWrite) {
|
|||||||
ui->configWidget->setQPIConfig(&config);
|
ui->configWidget->setQPIConfig(&config);
|
||||||
ui->configWidget->expandAll();
|
ui->configWidget->expandAll();
|
||||||
ui->list->viewport()->installEventFilter(this);
|
ui->list->viewport()->installEventFilter(this);
|
||||||
ui->treeK->viewport()->installEventFilter(this);
|
ui->treeCDK->viewport()->installEventFilter(this);
|
||||||
ui->scrollArea->setAutoFillBackground(false);
|
ui->scrollArea->setAutoFillBackground(false);
|
||||||
ui->scrollAreaWidgetContents->setAutoFillBackground(false);
|
ui->scrollAreaWidgetContents->setAutoFillBackground(false);
|
||||||
ui->widget->setAutoFillBackground(false);
|
ui->widget->setAutoFillBackground(false);
|
||||||
@@ -42,20 +42,16 @@ config(piqt(config_), QIODevice::ReadWrite) {
|
|||||||
QColor col;
|
QColor col;
|
||||||
ui->graphic->setGraphicsCount(0);
|
ui->graphic->setGraphicsCount(0);
|
||||||
//renew();
|
//renew();
|
||||||
ui->treeK->setColumnWidth(0, 60);
|
/*ui->treeK->setColumnWidth(0, 60);
|
||||||
ui->treeK->setColumnWidth(1, 250);
|
ui->treeK->setColumnWidth(1, 250);
|
||||||
ui->treeK->setColumnWidth(3, 100);
|
ui->treeK->setColumnWidth(3, 100);
|
||||||
ui->treeK->setColumnWidth(4, 100);
|
ui->treeK->setColumnWidth(4, 100);*/
|
||||||
//ui->table->setK(coeffsK.k()->data(), coeffsK.count());
|
//ui->table->setK(coeffsK.k()->data(), coeffsK.count());
|
||||||
//addToList(trUtf8("Read K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(coeffs.fileName())).arg(K.size_s()).arg(coeffs.k_content.size_s()), Qt::darkMagenta);
|
//addToList(trUtf8("Read K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(coeffs.fileName())).arg(K.size_s()).arg(coeffs.k_content.size_s()), Qt::darkMagenta);
|
||||||
/*CONNECT(void, &coeffs, sendFailed, this, pip_sendFailed);
|
/*CONNECT(void, &coeffs, sendFailed, this, pip_sendFailed);
|
||||||
CONNECT(void, &coeffs, sendSucceed, this, pip_sendSucceed);
|
CONNECT(void, &coeffs, sendSucceed, this, pip_sendSucceed);
|
||||||
CONNECT(void, &coeffs, receiveFailed, this, pip_receiveFailed);
|
CONNECT(void, &coeffs, receiveFailed, this, pip_receiveFailed);
|
||||||
CONNECT(void, &coeffs, receiveSucceed, this, pip_receiveSucceed);*/
|
CONNECT(void, &coeffs, receiveSucceed, this, pip_receiveSucceed);*/
|
||||||
kmodel = new CDKItemModel();
|
|
||||||
ui->treeCDK->setModel(kmodel);
|
|
||||||
delegate = new CDKDelegate();
|
|
||||||
ui->treeCDK->setItemDelegateForColumn(4, delegate);
|
|
||||||
CONNECTU(&K, sended, this, pip_sendSucceed);
|
CONNECTU(&K, sended, this, pip_sendSucceed);
|
||||||
CONNECTU(&K, sendFailed, this, pip_sendFailed);
|
CONNECTU(&K, sendFailed, this, pip_sendFailed);
|
||||||
CONNECTU(&K, received, this, pip_receiveSucceed);
|
CONNECTU(&K, received, this, pip_receiveSucceed);
|
||||||
@@ -106,7 +102,7 @@ bool CD_Pult::eventFilter(QObject * o, QEvent * e) {
|
|||||||
}
|
}
|
||||||
return QMainWindow::eventFilter(o, e);
|
return QMainWindow::eventFilter(o, e);
|
||||||
}
|
}
|
||||||
if (o == ui->treeK->viewport()) {
|
if (o == ui->treeCDK->viewport()) {
|
||||||
if (e->type() == QEvent::ContextMenu) {
|
if (e->type() == QEvent::ContextMenu) {
|
||||||
clear_target = 1;
|
clear_target = 1;
|
||||||
log_menu.popup(((QContextMenuEvent*)e)->globalPos());
|
log_menu.popup(((QContextMenuEvent*)e)->globalPos());
|
||||||
@@ -178,7 +174,7 @@ void CD_Pult::on_actionClear_triggered() {
|
|||||||
|
|
||||||
|
|
||||||
void CD_Pult::clearSelected() {
|
void CD_Pult::clearSelected() {
|
||||||
QList<QTreeWidgetItem * > si = ui->treeK->selectedItems();
|
/*QList<QTreeWidgetItem * > si = ui->treeK->selectedItems();
|
||||||
ui->treeK->setUpdatesEnabled(false);
|
ui->treeK->setUpdatesEnabled(false);
|
||||||
ui->treeK->blockSignals(true);
|
ui->treeK->blockSignals(true);
|
||||||
foreach (QTreeWidgetItem * i, si) {
|
foreach (QTreeWidgetItem * i, si) {
|
||||||
@@ -191,7 +187,7 @@ void CD_Pult::clearSelected() {
|
|||||||
if (ui->checkKAutoCalculate->isChecked()) {
|
if (ui->checkKAutoCalculate->isChecked()) {
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
//calculate();
|
//calculate();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -414,53 +410,6 @@ bool stringComp(const QString & s1, const QString & s2) {
|
|||||||
|
|
||||||
|
|
||||||
void CD_Pult::updateTree(bool move) {
|
void CD_Pult::updateTree(bool move) {
|
||||||
int sp = ui->treeK->verticalScrollBar()->value();
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
|
||||||
//qDebug() << "fill tree ...";
|
|
||||||
ui->treeK->clear();
|
|
||||||
ui->treeK->setUpdatesEnabled(false);
|
|
||||||
eval.clearCustomVariables();
|
|
||||||
CDSection r = K.root();
|
|
||||||
makeTreeSection(r, ui->treeK->invisibleRootItem());
|
|
||||||
/*for (int i = 0; i < K.size_s(); ++i) {
|
|
||||||
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
|
||||||
KDesc kd = kdesc[i];
|
|
||||||
QString kn = QString("k%1").arg(i);
|
|
||||||
knames[kn] = i;
|
|
||||||
knames_sort << kn;
|
|
||||||
if (eval.content.findVariable(kn) < 0)
|
|
||||||
eval.content.addVariable(kn, 0., false);
|
|
||||||
if (!kd.name.isEmpty()) {
|
|
||||||
knames[kd.name] = i;
|
|
||||||
knames_sort << kd.name;
|
|
||||||
eval.content.addVariable(kd.name, 0., false);
|
|
||||||
}
|
|
||||||
if (move && !kd.name.isEmpty()) {
|
|
||||||
if (prev_val.contains(kd.name))
|
|
||||||
coeffs.setFormula(i, Q2PIString(prev_val[kd.name]));
|
|
||||||
}
|
|
||||||
ti->setText(0, QString::number(i));
|
|
||||||
ti->setText(1, kd.name);
|
|
||||||
ti->setText(2, PI2QString(coeffs.formula(i)));
|
|
||||||
ti->setText(3, QString::number(K[i]));
|
|
||||||
ti->setText(4, typeName(kd.type));
|
|
||||||
ti->setText(5, kd.comment);
|
|
||||||
ui->treeK->addTopLevelItem(ti);
|
|
||||||
}*/
|
|
||||||
eval.content.sortVariables();
|
|
||||||
//qDebug() << "fill tree ok";
|
|
||||||
//qDebug() << "sort ...";
|
|
||||||
qSort(knames_sort.begin(), knames_sort.end(), stringComp);
|
|
||||||
//qDebug() << "names" << knames_sort;
|
|
||||||
//qDebug() << "sort ok";
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
ui->treeK->setUpdatesEnabled(true);
|
|
||||||
ui->treeK->verticalScrollBar()->setValue(sp);
|
|
||||||
//calculate();
|
|
||||||
filterTree();
|
|
||||||
kmodel->rebuildModel();
|
|
||||||
ui->treeCDK->expandAll();
|
|
||||||
for (int i=0; i<6; i++) ui->treeCDK->resizeColumnToContents(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -484,7 +433,7 @@ void CD_Pult::updateCommands() {
|
|||||||
|
|
||||||
|
|
||||||
void CD_Pult::filterTree() {
|
void CD_Pult::filterTree() {
|
||||||
bool hn = ui->checkKHideNormal->isChecked();
|
/*bool hn = ui->checkKHideNormal->isChecked();
|
||||||
bool hs = ui->checkKHideExpressions->isChecked();
|
bool hs = ui->checkKHideExpressions->isChecked();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString fl = ui->lineKSearch->text();
|
QString fl = ui->lineKSearch->text();
|
||||||
@@ -507,7 +456,7 @@ void CD_Pult::filterTree() {
|
|||||||
if (!ok)
|
if (!ok)
|
||||||
ti->setHidden(true);
|
ti->setHidden(true);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -535,10 +484,6 @@ void CD_Pult::markNormal(QTreeWidgetItem * item) {
|
|||||||
|
|
||||||
|
|
||||||
void CD_Pult::progress(int val, int max) {
|
void CD_Pult::progress(int val, int max) {
|
||||||
if (ctm.elapsed() < 50) return;
|
|
||||||
ctm.restart();
|
|
||||||
ui->progress->setValue(qRound(val * 100. / max));
|
|
||||||
QApplication::processEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,16 +62,9 @@ private:
|
|||||||
PIString config_, name_x, name_c;
|
PIString config_, name_x, name_c;
|
||||||
PIString kdesc_file, cdesc_file, xdesc_file;
|
PIString kdesc_file, cdesc_file, xdesc_file;
|
||||||
QMenu log_menu;
|
QMenu log_menu;
|
||||||
QTime tm, ctm;
|
|
||||||
QTimer timer_diag;
|
QTimer timer_diag;
|
||||||
QMap<QString, int> knames;
|
|
||||||
QSet<int> calculated;
|
|
||||||
QStringList knames_sort;
|
|
||||||
QPIEvaluator eval;
|
|
||||||
SessionManager session;
|
SessionManager session;
|
||||||
QPIConfig config;
|
QPIConfig config;
|
||||||
CDKItemModel * kmodel;
|
|
||||||
CDKDelegate * delegate;
|
|
||||||
//QVector<float> k, x;
|
//QVector<float> k, x;
|
||||||
int clear_target, timer;
|
int clear_target, timer;
|
||||||
bool needWrite, isPause, need_update, show_x;
|
bool needWrite, isPause, need_update, show_x;
|
||||||
|
|||||||
@@ -283,68 +283,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="treeK">
|
<widget class="CDKView" name="treeCDK">
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="columnCount">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<attribute name="headerDefaultSectionSize">
|
|
||||||
<number>200</number>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="headerMinimumSectionSize">
|
|
||||||
<number>20</number>
|
|
||||||
</attribute>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Index</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Name</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Type</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Expression</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Calculated</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Comment</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTreeView" name="treeCDK">
|
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||||
</property>
|
</property>
|
||||||
@@ -432,8 +371,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>819</width>
|
||||||
<height>30</height>
|
<height>613</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
@@ -1248,15 +1187,30 @@
|
|||||||
<extends>QFrame</extends>
|
<extends>QFrame</extends>
|
||||||
<header>graphic.h</header>
|
<header>graphic.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>CLineEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>clineedit.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QPIConfigWidget</class>
|
<class>QPIConfigWidget</class>
|
||||||
<extends>QTreeWidget</extends>
|
<extends>QTreeWidget</extends>
|
||||||
<header>qpiconfigwidget.h</header>
|
<header>qpiconfigwidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CLineEdit</class>
|
<class>CDKView</class>
|
||||||
<extends>QLineEdit</extends>
|
<extends>QTreeView</extends>
|
||||||
<header>clineedit.h</header>
|
<header location="global">qcd_kview.h</header>
|
||||||
|
<slots>
|
||||||
|
<signal>busyStatusChanged(bool)</signal>
|
||||||
|
<slot>sendK()</slot>
|
||||||
|
<slot>receiveK()</slot>
|
||||||
|
<slot>saveK()</slot>
|
||||||
|
<slot>loadK()</slot>
|
||||||
|
<slot>clear()</slot>
|
||||||
|
<slot>clearK()</slot>
|
||||||
|
<slot>refresh()</slot>
|
||||||
|
</slots>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user