git-svn-id: svn://db.shs.com.ru/libs@105 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2016-07-24 14:03:59 +00:00
parent 1f71f140eb
commit 9fc412f646
9 changed files with 145 additions and 50 deletions

View File

@@ -58,6 +58,8 @@ config(piqt(config_), QIODevice::ReadWrite) {
connect(ui->checkKHideExpressions, SIGNAL(toggled(bool)), this, SLOT(filterTree()));
connect(ui->lineKSearch, SIGNAL(textChanged(QString)), this, SLOT(filterTree()));
session.load();
K.configure(config_);
K.readFile();
updateKDesc();
updateCDesc();
timer_diag.start(40);
@@ -70,14 +72,14 @@ CD_Pult::~CD_Pult() {
void CD_Pult::loading(QPIConfig & conf) {
kdesc_file = conf.getValue("kdesc_file").stringValue();
cdesc_file = conf.getValue("cdesc_file").stringValue();
kdesc_file = Q2PIString(conf.getValue("kdesc_file").stringValue());
cdesc_file = Q2PIString(conf.getValue("cdesc_file").stringValue());
}
void CD_Pult::saving(QPIConfig & conf) {
conf.setValue("kdesc_file", kdesc_file);
conf.setValue("cdesc_file", cdesc_file);
conf.setValue("kdesc_file", PI2QString(kdesc_file));
conf.setValue("cdesc_file", PI2QString(cdesc_file));
}
@@ -206,15 +208,19 @@ void CD_Pult::makeTreeSection(KSection & ks, QTreeWidgetItem * pi) {
const KType & ck(ki.value());
ti->setText(0, QString::number(ck.index()));
ti->setText(1, PI2QString(ck.name()));
ti->setText(2, PI2QString(ck.formula()));
ti->setText(4, PI2QString(ck.comment()));
ti->setText(2, typeName(PI2QString(ck.type())));
ti->setText(3, PI2QString(ck.formula()));
ti->setText(5, PI2QString(ck.comment()));
}
PIMap<int, KSection>::iterator si;
for (si = ks.s.begin(); si != ks.s.end(); ++si) {
QTreeWidgetItem * ti = new QTreeWidgetItem(pi);
const KSection & cs(si.value());
ti->setText(0, QString("[%1]").arg(si.key()));
ti->setText(1, PI2QString(cs.name));
QString sn("[%1]");
if (cs.index_name.isEmpty()) sn = sn.arg(si.key());
else sn = sn.arg(PI2QString(cs.index_name));
ti->setText(0, sn);
ti->setText(2, PI2QString(cs.name));
makeTreeSection(const_cast<KSection&>(cs), ti);
}
}
@@ -273,32 +279,32 @@ void CD_Pult::on_buttonHideAll_clicked() {
void CD_Pult::on_buttonRead_clicked() {
//coeffs.readCoeffs();
//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);
K.readFile();
addToList(trUtf8("Readed 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() {
//coeffs.writeCoeffs();
//addToList(trUtf8("Write K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(coeffs.fileName())).arg(K.size_s()).arg(coeffs.k_content.size_s()), Qt::darkMagenta);
K.writeFile();
addToList(trUtf8("Written K file \"%1\": %2 coeffs, %3 bytes").arg(PI2QString(K.file())).arg(K.count()).arg(K.fileSize()), Qt::darkMagenta);
}
void CD_Pult::on_buttonSetKDesc_clicked() {
QString ret = QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with K description"), kdesc_file, "C/C++ header files(*.h *.hpp);;All files(*)");
QString ret = QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with K description"), PI2QString(kdesc_file), "C/C++ header files(*.h *.hpp);;All files(*)");
if (ret.isEmpty()) return;
kdesc_file = QDir::current().relativeFilePath(ret);
PIFile f(Q2PIString(kdesc_file), PIIODevice::ReadOnly);
kdesc_file = Q2PIString(QDir::current().relativeFilePath(ret));
PIFile f(kdesc_file, PIIODevice::ReadOnly);
K.update(&f);
updateKDesc(true);
}
void CD_Pult::on_buttonSetCDesc_clicked() {
QString ret = QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with C description"), cdesc_file, "C/C++ header files(*.h *.hpp);;All files(*)");
QString ret = QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with C description"), PI2QString(cdesc_file), "C/C++ header files(*.h *.hpp);;All files(*)");
if (ret.isEmpty()) return;
cdesc_file = QDir::current().relativeFilePath(ret);
cdesc_file = Q2PIString(QDir::current().relativeFilePath(ret));
updateCDesc();
}