git-svn-id: svn://db.shs.com.ru/libs@116 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -33,7 +33,7 @@ public:
|
|||||||
EVENT_HANDLER(void, K_Send);
|
EVENT_HANDLER(void, K_Send);
|
||||||
EVENT_HANDLER(void, K_Request);
|
EVENT_HANDLER(void, K_Request);
|
||||||
|
|
||||||
mutable CDSection k_;
|
CDSection k_;
|
||||||
|
|
||||||
void k_write(PIIODevice * d);
|
void k_write(PIIODevice * d);
|
||||||
void k_read(PIIODevice * d);
|
void k_read(PIIODevice * d);
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ const CDType KInterface::operator [](int v) const {
|
|||||||
|
|
||||||
|
|
||||||
CDSection & KInterface::section(int v) {
|
CDSection & KInterface::section(int v) {
|
||||||
CDSection & ret = core->k_.section(v);
|
// CDSection & ret = core->k_.section(v);
|
||||||
piCout << "[get section]" << v << ret.name;
|
// piCout << "[get section]" << v << ret.name;
|
||||||
return ret;
|
return core->k_.section(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CDSection KInterface::section(int v) const {
|
const CDSection KInterface::section(int v) const {
|
||||||
@@ -43,43 +43,17 @@ const CDSection KInterface::section(int v) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//CDSection & KInterface::section(const PIDeque<int> &path) {
|
CDSection & KInterface::section(const PIDeque<int> &path) {
|
||||||
// piCout << "error"; return root();
|
|
||||||
// PIDeque<int> spath = path;
|
|
||||||
// CDSection & rs = core->k_;
|
|
||||||
// CDSection trs = rs;
|
|
||||||
// piCout << "[get section from path]" << path << rs.name;
|
|
||||||
// PIString tab;
|
|
||||||
// while (!spath.isEmpty()) {
|
|
||||||
// piCout << "!1" << tab << rs.alias << rs.name;
|
|
||||||
// rs = rs.section(spath.take_front());
|
|
||||||
// tab += " ";
|
|
||||||
//// rs = trs;
|
|
||||||
// }
|
|
||||||
// piCout << "!2" << tab << rs.alias << rs.name;
|
|
||||||
// return rs;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
const CDSection KInterface::section(const PIDeque<int> &path) const {
|
|
||||||
PIDeque<int> spath = path;
|
PIDeque<int> spath = path;
|
||||||
CDSection rs = core->k_;
|
CDSection * rs = &core->k_;
|
||||||
CDSection trs = rs;
|
|
||||||
//piCout << "[get section from path]" << path << rs.name;
|
|
||||||
PIString tab;
|
|
||||||
while (!spath.isEmpty()) {
|
while (!spath.isEmpty()) {
|
||||||
//piCout << "!1" << tab << rs.alias << rs.name;
|
rs = &rs->section(spath.take_front());
|
||||||
trs = rs.section(spath.take_front());
|
|
||||||
tab += " ";
|
|
||||||
rs = trs;
|
|
||||||
}
|
}
|
||||||
//piCout << "!2" << tab << rs.alias << rs.name;
|
return *rs;
|
||||||
return rs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CDSection & KInterface::root() {
|
CDSection & KInterface::root() {
|
||||||
piCout << "[root]" << core->k_.name;
|
|
||||||
return core->k_;
|
return core->k_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ public:
|
|||||||
const CDType operator [](int v) const;
|
const CDType operator [](int v) const;
|
||||||
CDSection & section(int v);
|
CDSection & section(int v);
|
||||||
const CDSection section(int v) const;
|
const CDSection section(int v) const;
|
||||||
// CDSection & section(const PIDeque<int> &path);
|
CDSection & section(const PIDeque<int> &path);
|
||||||
const CDSection section(const PIDeque<int> &path) const;
|
|
||||||
CDSection & root();
|
CDSection & root();
|
||||||
const CDSection root() const;
|
const CDSection root() const;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,19 @@ CDType::CDType(int i, const PIString & n, const PIString & t, const PIString & v
|
|||||||
// piCout << comment_.size() << comment_.toUTF8();
|
// piCout << comment_.size() << comment_.toUTF8();
|
||||||
// debug_cnt = cdtype_debug_cnt;
|
// debug_cnt = cdtype_debug_cnt;
|
||||||
// cdtype_debug_cnt++;
|
// cdtype_debug_cnt++;
|
||||||
// piCout << "[CDType] create" << debug_cnt << index_ << ":" << name_ << ":" << type_ << ":" << value_s << ":" << value_d << ":" << formula_ << ":" << comment_ << ":" << (cd_type_ == cdK);
|
// piCout << "[CDType] create" << name_ << ":" << type_ << ":" << value_s << ":" << value_d << ":" << formula_ << ":" << comment_ << ":" << (cd_type_ == cdK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIString CDType::type() const {
|
||||||
|
if (type_.trimmed().isEmpty()) return "f";
|
||||||
|
// piCout << "type =" << type_.trimmed() << ";" << type_ << "#";
|
||||||
|
return type_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDType::setFormula(const PIString &f) {
|
||||||
|
formula_ = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -97,9 +109,9 @@ int CDSection::sectionsCount() const {
|
|||||||
|
|
||||||
PIStringList CDSection::index_names() const {
|
PIStringList CDSection::index_names() const {
|
||||||
PIStringList ret;
|
PIStringList ret;
|
||||||
PIMap<int, CDType>::iterator i;
|
PIMap<int, CDType>::const_iterator i;
|
||||||
for (i = k.begin(); i != k.end(); ++i)
|
for (i = k.begin(); i != k.end(); ++i)
|
||||||
ret << i.value().name();
|
ret << i->second.name();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +126,10 @@ void CDSection::write(PIIODevice * d, const PIString & prefix) {
|
|||||||
else l = "[" + prefix + ".k]";
|
else l = "[" + prefix + ".k]";
|
||||||
l += "\n";
|
l += "\n";
|
||||||
d->write(l.toUTF8());
|
d->write(l.toUTF8());
|
||||||
|
l = "name = " + name + " \n";
|
||||||
|
d->write(l.toUTF8());
|
||||||
|
l = "alias = " + alias + " \n";
|
||||||
|
d->write(l.toUTF8());
|
||||||
PIMap<int, CDType>::iterator i;
|
PIMap<int, CDType>::iterator i;
|
||||||
for (i = k.begin(); i != k.end(); ++i) {
|
for (i = k.begin(); i != k.end(); ++i) {
|
||||||
CDType & ck(i.value());
|
CDType & ck(i.value());
|
||||||
@@ -146,21 +162,23 @@ void CDSection::read(const void * ep) {
|
|||||||
k.clear();
|
k.clear();
|
||||||
s.clear();
|
s.clear();
|
||||||
PIConfig::Entry & e(*(PIConfig::Entry*)ep);
|
PIConfig::Entry & e(*(PIConfig::Entry*)ep);
|
||||||
|
name = e.getValue("k.name").value();
|
||||||
|
alias = e.getValue("k.alias").value();
|
||||||
PIConfig::Entry & kl = e.getValue("k");
|
PIConfig::Entry & kl = e.getValue("k");
|
||||||
for (int i = 0; i < kl.childCount(); ++i) {
|
for (int i = 0; i < kl.childCount(); ++i) {
|
||||||
const PIConfig::Entry * ke(kl.child(i));
|
const PIConfig::Entry * ke(kl.child(i));
|
||||||
int kid = ke->name().toInt();
|
bool ok = false;
|
||||||
|
int kid = ke->name().toInt(-1, &ok);
|
||||||
|
// piCout << "[read]" << ke->name() << ke->value() << ok;
|
||||||
// PIString n = ke->getValue("v").comment();
|
// PIString n = ke->getValue("v").comment();
|
||||||
// PIString t = n.takeLeft(1);
|
// PIString t = n.takeLeft(1);
|
||||||
k[kid] = CDType(kid, ke->getValue("v").comment(), ke->getValue("v").type(), ke->getValue("v").value(), ke->getValue("f").value(), ke->getValue("f").comment(), CDType::cdK);
|
if (ok) k[kid] = CDType(kid, ke->getValue("v").comment(), ke->getValue("v").type(), ke->getValue("v").value(), ke->getValue("f").value(), ke->getValue("f").comment(), CDType::cdK);
|
||||||
}
|
}
|
||||||
PIConfig::Entry & sl = e.getValue("s");
|
PIConfig::Entry & sl = e.getValue("s");
|
||||||
for (int i = 0; i < sl.childCount(); ++i) {
|
for (int i = 0; i < sl.childCount(); ++i) {
|
||||||
const PIConfig::Entry * se(sl.child(i));
|
const PIConfig::Entry * se(sl.child(i));
|
||||||
int sid = se->name().toInt();
|
int sid = se->name().toInt();
|
||||||
CDSection cs;
|
s[sid].read(se);
|
||||||
cs.read(se);
|
|
||||||
s[sid] = cs;
|
|
||||||
}
|
}
|
||||||
// piCout << "[CDSection] read end";
|
// piCout << "[CDSection] read end";
|
||||||
}
|
}
|
||||||
@@ -181,7 +199,10 @@ void CDSection::update(CDSection & v, bool keep_names) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (v.k.contains(i.key())) {
|
if (v.k.contains(i.key())) {
|
||||||
k[i.key()] = v.k[i.key()];
|
PIString f = k[i.key()].formula_;
|
||||||
|
CDType & cdt = v.k[i.key()];
|
||||||
|
cdt.formula_ = f;
|
||||||
|
k[i.key()] = cdt;
|
||||||
used << i.key();
|
used << i.key();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class CDSection;
|
|||||||
class CDType {
|
class CDType {
|
||||||
friend class CDSection;
|
friend class CDSection;
|
||||||
friend class ::CD_Pult;
|
friend class ::CD_Pult;
|
||||||
friend class ::CDKItem;
|
//friend class ::CDKItem;
|
||||||
public:
|
public:
|
||||||
enum cdT {cdNull, cdK, cdX, cdC};
|
enum cdT {cdNull, cdK, cdX, cdC};
|
||||||
CDType();
|
CDType();
|
||||||
@@ -26,14 +26,15 @@ public:
|
|||||||
// ~CDType();
|
// ~CDType();
|
||||||
int index() const {return index_;}
|
int index() const {return index_;}
|
||||||
PIString name() const {return name_;}
|
PIString name() const {return name_;}
|
||||||
PIString type() const {return type_;}
|
PIString type() const;
|
||||||
PIString value() const {return value_s;}
|
PIString value() const {return value_s;}
|
||||||
PIString formula() const {return formula_;}
|
PIString formula() const {return formula_;}
|
||||||
PIString comment() const {/*piCout << "[CDType] comment" << debug_cnt << name_ << comment_.size() << comment_;*/ return comment_;}
|
PIString comment() const {return comment_;}
|
||||||
double toDouble() const {return value_d;}
|
double toDouble() const {return value_d;}
|
||||||
int toInt() const {return value_i;}
|
int toInt() const {return value_i;}
|
||||||
bool toBool() const {return value_b;}
|
bool toBool() const {return value_b;}
|
||||||
cdT cd_type() const {return cd_type_;}
|
cdT cd_type() const {return cd_type_;}
|
||||||
|
void setFormula(const PIString & formula);
|
||||||
|
|
||||||
operator double() const {return value_d;}
|
operator double() const {return value_d;}
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ public:
|
|||||||
bool test(int v) {return k.value(v).toBool();}
|
bool test(int v) {return k.value(v).toBool();}
|
||||||
CDType & operator [](int v) {return k[v];}
|
CDType & operator [](int v) {return k[v];}
|
||||||
const CDType operator [](int v) const {return k[v];}
|
const CDType operator [](int v) const {return k[v];}
|
||||||
CDSection & section(int v) {piCout << "[CDSection &]"; return s[v];}
|
CDSection & section(int v) {return s[v];}
|
||||||
const CDSection section(int v) const {return s[v];}
|
const CDSection section(int v) const {return s[v];}
|
||||||
|
|
||||||
bool isEmpty() const {return k.isEmpty() && s.isEmpty();}
|
bool isEmpty() const {return k.isEmpty() && s.isEmpty();}
|
||||||
@@ -85,7 +86,7 @@ protected:
|
|||||||
void update(CDSection & v, bool keep_names);
|
void update(CDSection & v, bool keep_names);
|
||||||
bool isSameStructure(CDSection & v);
|
bool isSameStructure(CDSection & v);
|
||||||
|
|
||||||
mutable PIMap<int, CDType> k;
|
PIMap<int, CDType> k;
|
||||||
PIMap<int, CDSection> s;
|
PIMap<int, CDSection> s;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -62,6 +62,36 @@ private:
|
|||||||
#include "piscreentiles.h"
|
#include "piscreentiles.h"
|
||||||
PIScreen screen(false);
|
PIScreen screen(false);
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
PIString s;
|
||||||
|
int i = 0;
|
||||||
|
piCout << i++ << "!" << s << "!";
|
||||||
|
piCout << i << "!" << s.trimmed() << "!";
|
||||||
|
piCout << i << "!" << s.trim() << "!";
|
||||||
|
s = "";
|
||||||
|
piCout << i++ << "!" << s << "!";
|
||||||
|
piCout << i << "!" << s.trimmed() << "!";
|
||||||
|
piCout << i << "!" << s.trim() << "!";
|
||||||
|
s = " ";
|
||||||
|
piCout << i++ << "!" << s << "!";
|
||||||
|
piCout << i << "!" << s.trimmed() << "!";
|
||||||
|
piCout << i << "!" << s.trim() << "!";
|
||||||
|
s = " ";
|
||||||
|
piCout << i++ << "!" << s << "!";
|
||||||
|
piCout << i << "!" << s.trimmed() << "!";
|
||||||
|
piCout << i << "!" << s.trim() << "!";
|
||||||
|
s = " s ";
|
||||||
|
piCout << i++ << "!" << s << "!";
|
||||||
|
piCout << i << "!" << s.trimmed() << "!";
|
||||||
|
piCout << i << "!" << s.trim() << "!";
|
||||||
|
s = "f s ";
|
||||||
|
piCout << i++ << "!" << s << "!";
|
||||||
|
piCout << i << "!" << s.trimmed() << "!";
|
||||||
|
piCout << i << "!" << s.trim() << "!";
|
||||||
|
s = " kjdfsnfv;kjsfd ";
|
||||||
|
piCout << i++ << "!" << s << "!";
|
||||||
|
piCout << i << "!" << s.trimmed() << "!";
|
||||||
|
piCout << i << "!" << s.trim() << "!";
|
||||||
|
return 0;
|
||||||
// PIEthernet eth;
|
// PIEthernet eth;
|
||||||
// eth.send("127.0.0.1:16102", PIByteArray("data\n", 5));
|
// eth.send("127.0.0.1:16102", PIByteArray("data\n", 5));
|
||||||
// eth.send("127.0.0.1:26102", PIByteArray("data\n", 5));
|
// eth.send("127.0.0.1:26102", PIByteArray("data\n", 5));
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#include "cdutils_k.h"
|
#include "cdutils_k.h"
|
||||||
#include "piqt.h"
|
#include "piqt.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QBrush>
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
using namespace CDUtils;
|
using namespace CDUtils;
|
||||||
|
|
||||||
@@ -19,9 +21,8 @@ CDKItemModel::~CDKItemModel() {
|
|||||||
|
|
||||||
QVariant CDKItemModel::data(const QModelIndex &index, int role) const {
|
QVariant CDKItemModel::data(const QModelIndex &index, int role) const {
|
||||||
if (!index.isValid()) return QVariant();
|
if (!index.isValid()) return QVariant();
|
||||||
if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant();
|
|
||||||
CDKItem *item = getItem(index);
|
CDKItem *item = getItem(index);
|
||||||
return item->data(index.column());
|
return item->data(index.column(), role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ void CDKItemModel::rebuildModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDKItemModel::buildItem(CDKItem *it, CDSection r) {
|
void CDKItemModel::buildItem(CDKItem *it, CDSection & r) {
|
||||||
//piCout << "build item" << r.name << r.alias;
|
//piCout << "build item" << r.name << r.alias;
|
||||||
PIMap<int, CDType>::iterator i;
|
PIMap<int, CDType>::iterator i;
|
||||||
for (i = r.k.begin(); i != r.k.end(); ++i) {
|
for (i = r.k.begin(); i != r.k.end(); ++i) {
|
||||||
@@ -112,7 +113,7 @@ void CDKItemModel::internalRebuild() {
|
|||||||
qDebug() << "[CDKItemModel]" << "internalRebuild()";
|
qDebug() << "[CDKItemModel]" << "internalRebuild()";
|
||||||
if (root) delete root;
|
if (root) delete root;
|
||||||
root = new CDKItem(0, CDKItem::ItemCDSection, 0);
|
root = new CDKItem(0, CDKItem::ItemCDSection, 0);
|
||||||
CDSection r = K.root();
|
CDSection & r = K.root();
|
||||||
buildItem(root, r);
|
buildItem(root, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,15 +139,23 @@ CDKItem::~CDKItem() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant CDKItem::data(int column) const {
|
QVariant CDKItem::data(int column, int role) const {
|
||||||
CDSection rs = K.section(buildPath());
|
if (role == Qt::BackgroundRole) {
|
||||||
//piCout << rs.name << rs.alias << rs.count(false) << rs.sectionsCount() << K.root().name << K.root().alias <<K.root().count(false) << K.root().sectionsCount();
|
switch (type_) {
|
||||||
|
case ItemCDType: return QBrush(QColor(255, 250, 230));
|
||||||
|
case ItemCDSection: return QBrush(QColor(220, 220, 250));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant();
|
||||||
|
PIDeque<int> path = buildPath();
|
||||||
|
CDSection & rs = K.section(path);
|
||||||
|
CDSection s;
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case ItemCDType:
|
case ItemCDType:
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case 0: return QString::number(index_);
|
case 0: return QString::number(index_);
|
||||||
case 1: return PI2QString(rs[index_].name());
|
case 1: return PI2QString(rs[index_].name());
|
||||||
case 2: return PI2QString(rs[index_].type());
|
case 2: return stringType(rs[index_].type());
|
||||||
case 3: return PI2QString(rs[index_].formula());
|
case 3: return PI2QString(rs[index_].formula());
|
||||||
case 4: return PI2QString(rs[index_].value());
|
case 4: return PI2QString(rs[index_].value());
|
||||||
case 5: return PI2QString(rs[index_].comment());
|
case 5: return PI2QString(rs[index_].comment());
|
||||||
@@ -155,11 +164,12 @@ QVariant CDKItem::data(int column) const {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ItemCDSection:
|
case ItemCDSection:
|
||||||
rs = rs.section(index_);
|
s = rs.section(index_);
|
||||||
|
// piCout << rs.name << rs.alias << s.name << s.alias;
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case 0: return QString("[") + QString::number(index_) + QString("]");
|
case 0: return QString("[") + QString::number(index_) + QString("]");
|
||||||
case 1: return PI2QString(rs.alias);
|
case 1: return PI2QString(s.alias);
|
||||||
case 2: return PI2QString(rs.name);
|
case 2: return PI2QString(s.name);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -171,7 +181,7 @@ QVariant CDKItem::data(int column) const {
|
|||||||
|
|
||||||
bool CDKItem::setData(int column, const QVariant &value) {
|
bool CDKItem::setData(int column, const QVariant &value) {
|
||||||
if (column == 3 && type_ == ItemCDType) {
|
if (column == 3 && type_ == ItemCDType) {
|
||||||
//K.section(buildPath())[index_].formula_ = Q2PIString(value.toString());
|
K.section(buildPath())[index_].setFormula(Q2PIString(value.toString()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -186,7 +196,28 @@ PIDeque<int> CDKItem::buildPath() const {
|
|||||||
p = p->parent_;
|
p = p->parent_;
|
||||||
}
|
}
|
||||||
path.take_front();
|
path.take_front();
|
||||||
//piCout << path;
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString CDKItem::stringType(const PIString & t) const {
|
||||||
|
QString n = PI2QString(t);
|
||||||
|
if (n.isEmpty()) return QString("");
|
||||||
|
switch (n[0].toLatin1()) {
|
||||||
|
case 'l': return QString("list"); break;
|
||||||
|
case 'b': return QString("bool"); break;
|
||||||
|
case 'n': return QString("int"); break;
|
||||||
|
case 'f': return QString("double"); break;
|
||||||
|
case 'c': return QString("color"); break;
|
||||||
|
case 'r': return QString("rect"); break;
|
||||||
|
case 'a': return QString("rect"); break;
|
||||||
|
case 'p': return QString("point"); break;
|
||||||
|
case 'v': return QString("vector"); break;
|
||||||
|
case 'i': return QString("IP"); break;
|
||||||
|
case 'e': return QString("enum"); break;
|
||||||
|
case 'F': return QString("file"); break;
|
||||||
|
case 'D': return QString("dir"); break;
|
||||||
|
}
|
||||||
|
return QString("double");
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
#ifndef CD_KMODEL_H
|
#ifndef CD_KMODEL_H
|
||||||
#define CD_KMODEL_H
|
#define CD_KMODEL_H
|
||||||
|
|
||||||
#include "cdutils_k.h"
|
//#include "cdutils_k.h"
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
#include "pistring.h"
|
||||||
|
|
||||||
|
namespace CDUtils {
|
||||||
|
class CDSection;
|
||||||
|
}
|
||||||
class CDKItemModel;
|
class CDKItemModel;
|
||||||
|
|
||||||
class CDKItem {
|
class CDKItem {
|
||||||
@@ -12,11 +16,12 @@ public:
|
|||||||
enum CDKItemType{ItemCDType, ItemCDSection};
|
enum CDKItemType{ItemCDType, ItemCDSection};
|
||||||
CDKItem(int index, CDKItemType type, CDKItem * parent);
|
CDKItem(int index, CDKItemType type, CDKItem * parent);
|
||||||
~CDKItem();
|
~CDKItem();
|
||||||
QVariant data(int column) const;
|
QVariant data(int column, int role) const;
|
||||||
bool setData(int column, const QVariant & value);
|
bool setData(int column, const QVariant & value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PIDeque<int> buildPath() const;
|
PIDeque<int> buildPath() const;
|
||||||
|
QString stringType(const PIString & t) const;
|
||||||
|
|
||||||
CDKItem * parent_;
|
CDKItem * parent_;
|
||||||
int index_;
|
int index_;
|
||||||
@@ -40,7 +45,7 @@ public:
|
|||||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||||
|
|
||||||
void rebuildModel();
|
void rebuildModel();
|
||||||
void buildItem(CDKItem * it, CDUtils::CDSection r);
|
void buildItem(CDKItem * it, CDUtils::CDSection &r);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|||||||
@@ -398,6 +398,7 @@ void CD_Pult::updateKDesc(bool ask_move) {
|
|||||||
addToList(trUtf8("Update K description file \"%1\"").arg(PI2QString(kdesc_file)), Qt::darkMagenta);
|
addToList(trUtf8("Update K description file \"%1\"").arg(PI2QString(kdesc_file)), Qt::darkMagenta);
|
||||||
PIFile f(kdesc_file, PIIODevice::ReadOnly);
|
PIFile f(kdesc_file, PIIODevice::ReadOnly);
|
||||||
//piCout << "call K.update():";
|
//piCout << "call K.update():";
|
||||||
|
K.root() = CDSection();
|
||||||
K.update(&f);
|
K.update(&f);
|
||||||
updateTree(ask_move);
|
updateTree(ask_move);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,11 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
|
||||||
inline const QString PI2QString(const PIString & v) {return QString::fromLocal8Bit(v.data());}
|
//inline const QString PI2QString(const PIString & v) {return QString::fromLocal8Bit(v.data());}
|
||||||
|
inline const QString PI2QString(const PIString & v) {return QString::fromUtf8(v.dataUTF8());}
|
||||||
|
|
||||||
inline const PIString Q2PIString(const QString & v) {return PIString(v.toLocal8Bit().data());}
|
//inline const PIString Q2PIString(const QString & v) {return PIString(v.toLocal8Bit().data());}
|
||||||
|
inline const PIString Q2PIString(const QString & v) {return PIString::fromUTF8(v.toUtf8().data());}
|
||||||
|
|
||||||
|
|
||||||
inline const QStringList PI2QStringList(const PIStringList & v) {QStringList ret; piForeachC (PIString & s, v) ret << PI2QString(s); return ret;}
|
inline const QStringList PI2QStringList(const PIStringList & v) {QStringList ret; piForeachC (PIString & s, v) ret << PI2QString(s); return ret;}
|
||||||
|
|||||||
Reference in New Issue
Block a user