From 9e70ad30d9eb8c30a6b6d590f27ecd4754245647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Sun, 24 Jul 2016 20:23:14 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/libs@107 a8b55f48-bf90-11e4-a774-851b48703e85 --- cd_utils/cdutils_core.cpp | 8 ++++++-- cd_utils/cdutils_core.h | 1 + cd_utils/cdutils_k.cpp | 1 + cd_utils/cdutils_k.h | 1 + cd_utils/cdutils_k_parser.cpp | 2 +- cd_utils/pult/cd_pult.cpp | 16 +++++----------- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cd_utils/cdutils_core.cpp b/cd_utils/cdutils_core.cpp index ab788b9..e8a8117 100644 --- a/cd_utils/cdutils_core.cpp +++ b/cd_utils/cdutils_core.cpp @@ -129,10 +129,14 @@ void Core::k_parse(PIIODevice * d) { void Core::k_update(PIIODevice * d) { KSection uk = k_; k_parse(d); + bool kn = false; if (!uk.isEmpty()) - if (!uk.isSameStructure(k_)) + if (!uk.isSameStructure(k_)) { piCout << "ask for save names"; - + K_KeepNamesRequest(&kn); + } + uk.update(k_, kn); + k_ = uk; } diff --git a/cd_utils/cdutils_core.h b/cd_utils/cdutils_core.h index ab24df7..625b693 100644 --- a/cd_utils/cdutils_core.h +++ b/cd_utils/cdutils_core.h @@ -29,6 +29,7 @@ public: EVENT(K_Sended) EVENT(K_Received) + EVENT1(K_KeepNamesRequest, bool*, kn) EVENT_HANDLER(void, K_Send); EVENT_HANDLER(void, K_Request); diff --git a/cd_utils/cdutils_k.cpp b/cd_utils/cdutils_k.cpp index 867a6d3..8ab51e7 100644 --- a/cd_utils/cdutils_k.cpp +++ b/cd_utils/cdutils_k.cpp @@ -12,6 +12,7 @@ KInterface::KInterface() { k_file_size = 0; CONNECTU(core, K_Sended, this, sended); CONNECTU(core, K_Received, this, received); + CONNECTU(core, K_KeepNamesRequest, this, keepNamesRequest); } diff --git a/cd_utils/cdutils_k.h b/cd_utils/cdutils_k.h index 34bd175..0c25e91 100644 --- a/cd_utils/cdutils_k.h +++ b/cd_utils/cdutils_k.h @@ -29,6 +29,7 @@ public: EVENT(sended) EVENT(received) + EVENT1(keepNamesRequest, bool*, kn) EVENT_HANDLER(void, send); EVENT_HANDLER(void, request); bool configure(const PIString & config, const PIString & sect = PIStringAscii("k")); diff --git a/cd_utils/cdutils_k_parser.cpp b/cd_utils/cdutils_k_parser.cpp index da01956..765fd34 100644 --- a/cd_utils/cdutils_k_parser.cpp +++ b/cd_utils/cdutils_k_parser.cpp @@ -154,7 +154,7 @@ KSection KParser::parse(PIIODevice * d) { } } else { parseEnumLine(line, &cev, &type, &comment); - piCout << line << "=" << cev << "//" << type << comment; + //piCout << line << "=" << cev << "//" << type << comment; ck = KType(cev, line, type, "", "", comment); cs[cev] = ck; cevalues[line] = cev; diff --git a/cd_utils/pult/cd_pult.cpp b/cd_utils/pult/cd_pult.cpp index 344f099..71078a3 100644 --- a/cd_utils/pult/cd_pult.cpp +++ b/cd_utils/pult/cd_pult.cpp @@ -280,14 +280,14 @@ void CD_Pult::on_buttonHideAll_clicked() { void CD_Pult::on_buttonRead_clicked() { K.readFile(); - addToList(trUtf8("Readed K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(K.file())).arg(K.count()).arg(K.fileSize()), Qt::darkMagenta); + addToList(trUtf8("Read K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(K.file())).arg(K.count()).arg(K.fileSize()), Qt::darkMagenta); updateTree(); } void CD_Pult::on_buttonWrite_clicked() { K.writeFile(); - addToList(trUtf8("Written K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(K.file())).arg(K.count()).arg(K.fileSize()), Qt::darkMagenta); + addToList(trUtf8("Write K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(K.file())).arg(K.count()).arg(K.fileSize()), Qt::darkMagenta); } @@ -389,15 +389,9 @@ void CD_Pult::updateDiag() { void CD_Pult::updateKDesc(bool ask_move) { - /*int cind = parseHeader(kdesc_file, kdesc); - if (K.size_s() < cind) { - ui->spinSize->setValue(cind); - ui->spinSize->setStyleSheet("background-color: rgb(220, 220, 255);"); - } - bool move = false; - if (ask_move) - move = (QMessageBox::question(this, "KX Pult", "Save values at associated names?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes); - */ + addToList(trUtf8("Update K description file \"%1\"").arg(PI2QString(kdesc_file)), Qt::darkMagenta); + PIFile f(kdesc_file, PIIODevice::ReadOnly); + K.update(&f); updateTree(ask_move); }