remove operators in QPIConfig::Entry

git-svn-id: svn://db.shs.com.ru/libs@946 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
2020-04-14 18:51:00 +00:00
parent 5eefb1ebe5
commit 14bbb32503
10 changed files with 77 additions and 93 deletions

View File

@@ -15,7 +15,7 @@ int main(int argc, char * argv[]) {
ConnectionEdit w; ConnectionEdit w;
if (a.arguments().size() > 1) { if (a.arguments().size() > 1) {
QPIConfig cfg(a.arguments()[1]); QPIConfig cfg(a.arguments()[1]);
QByteArray model = cfg.getValue("connectionmodel", QByteArray()); QByteArray model = cfg.getValue("connectionmodel").toByteArray();
if (!model.isEmpty()) w.setModel(model); if (!model.isEmpty()) w.setModel(model);
} }
if (w.exec() == QDialog::Accepted) { if (w.exec() == QDialog::Accepted) {

View File

@@ -70,7 +70,7 @@ void QPIIntrospector::savingSession(QPIConfig & conf) {
void QPIIntrospector::loadingSession(QPIConfig & conf) { void QPIIntrospector::loadingSession(QPIConfig & conf) {
treeStat->header()->restoreState(conf.getValue("treeStat_header", QByteArray())); treeStat->header()->restoreState(conf.getValue("treeStat_header").toByteArray());
} }

View File

@@ -11,9 +11,8 @@ QPIConnection::QPIConnection(const QString & name): QObject(), PIConnection(Q2PI
bool QPIConnection::loadFromCMFile(const QString & file) { bool QPIConnection::loadFromCMFile(const QString & file) {
QPIConfig f(file, QIODevice::ReadOnly); QPIConfig f(file, QIODevice::ReadOnly);
if (!f.isOpen()) return false; if (!f.isOpen()) return false;
QByteArray cd = f.getValue("config", QByteArray()); PIString cs = Q2PIString(QString::fromLatin1(f.getValue("config").toByteArray()));
PIString cs = Q2PIString(QString::fromLatin1(cd)); configureFromString(&cs, Q2PIString(f.getValue("name").toString()));
configureFromString(&cs, Q2PIString(f.getValue("name", "")));
return true; return true;
} }

View File

@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0017 NEW) # need include() with .cmake cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(qad) project(qad)
set(_QAD_MAJOR 1) set(_QAD_MAJOR 1)
set(_QAD_MINOR 0) set(_QAD_MINOR 1)
set(_QAD_REVISION 0) set(_QAD_REVISION 0)
set(_QAD_SUFFIX ) set(_QAD_SUFFIX alpha)
set(_QAD_COMPANY SHS) set(_QAD_COMPANY SHS)
set(_QAD_DOMAIN org.SHS) set(_QAD_DOMAIN org.SHS)

View File

@@ -81,7 +81,7 @@ void MainWindow::redrawGraphics() {
void MainWindow::loading(QPIConfig & conf) { void MainWindow::loading(QPIConfig & conf) {
active_ = false; active_ = false;
QStringList vars = conf.getValue("variables", QStringList()); QStringList vars = conf.getValue("variables").toStringList();
int vc = vars.size() / 2; int vc = vars.size() / 2;
for (int i = 0; i < vc; ++i) { for (int i = 0; i < vc; ++i) {
QTreeWidgetItem * ti = new QTreeWidgetItem(treeVariables); QTreeWidgetItem * ti = new QTreeWidgetItem(treeVariables);
@@ -91,7 +91,8 @@ void MainWindow::loading(QPIConfig & conf) {
treeVariables->addTopLevelItem(ti); treeVariables->addTopLevelItem(ti);
} }
buttonVarClear->setEnabled(treeVariables->topLevelItemCount() > 0); buttonVarClear->setEnabled(treeVariables->topLevelItemCount() > 0);
QByteArray ba = QString2QByteArray(conf.getValue("graphics")); QDataStream s(ba); QByteArray ba = conf.getValue("graphics").toByteArray();
QDataStream s(ba);
QVector<GraphicType> g; QVector<GraphicType> g;
if (!ba.isEmpty()) s >> g; if (!ba.isEmpty()) s >> g;
graphic->setAllGraphics(g); graphic->setAllGraphics(g);
@@ -105,8 +106,8 @@ void MainWindow::loading(QPIConfig & conf) {
treeGraphics->addTopLevelItem(ti); treeGraphics->addTopLevelItem(ti);
} }
buttonGraphicClear->setEnabled(treeGraphics->topLevelItemCount() > 0); buttonGraphicClear->setEnabled(treeGraphics->topLevelItemCount() > 0);
graphic->setVisualRect(conf.getValue("graphicRect", QRectF(-1., -1., 2., 2.))); graphic->setVisualRect(conf.getValue("graphicRect", QRectF(-1., -1., 2., 2.)).toRectF());
ba = conf.getValue("graphic_state", QByteArray()); ba = conf.getValue("graphic_state").toByteArray();
if (!ba.isEmpty()) if (!ba.isEmpty())
graphic->load(ba); graphic->load(ba);
on_tabWidget_currentChanged(0); on_tabWidget_currentChanged(0);

View File

@@ -989,15 +989,15 @@ bool SQLTableWidget::connectToDatabase(const QString & config, const QString & c
if (!conf.isOpen()) if (!conf.isOpen())
ok = false; ok = false;
else { else {
QSqlDatabase base = QSqlDatabase::addDatabase(conf.getValue("driver", "QMYSQL").stringValue(), conn_name); QSqlDatabase base = QSqlDatabase::addDatabase(conf.getValue("driver", "QMYSQL").toString(), conn_name);
if (!base.isValid()) { if (!base.isValid()) {
qDebug() << "[QSqlDatabase::addDatabase] Error:" << base.lastError(); qDebug() << "[QSqlDatabase::addDatabase] Error:" << base.lastError();
ok = false; ok = false;
} else { } else {
base.setHostName(conf.getValue("host", "").stringValue()); base.setHostName(conf.getValue("host").toString());
base.setPort(conf.getValue("port", -1)); base.setPort(conf.getValue("port", -1).toInt());
base.setDatabaseName(conf.getValue("database", "").stringValue()); base.setDatabaseName(conf.getValue("database").toString());
if (!base.open(conf.getValue("login", "").stringValue(), conf.getValue("password", "").stringValue())) { if (!base.open(conf.getValue("login").toString(), conf.getValue("password").toString())) {
qDebug() << "[QSqlDatabase::open] Error:" << base.lastError(); qDebug() << "[QSqlDatabase::open] Error:" << base.lastError();
ok = false; ok = false;
} }

View File

@@ -243,7 +243,6 @@ QPIConfig::QPIConfig(const QString & path, QIODevice::OpenMode mode, QPIConfig::
type = type_; type = type_;
if (!path.isEmpty()) { if (!path.isEmpty()) {
open(mode); open(mode);
//stream.setDevice(this);
parse(); parse();
} }
} }
@@ -254,7 +253,6 @@ QPIConfig::QPIConfig(const QString & path, QIODevice::OpenMode mode): QFile(path
type = Config; type = Config;
if (!path.isEmpty()) { if (!path.isEmpty()) {
open(mode); open(mode);
//stream.setDevice(this);
parse(); parse();
} }
} }
@@ -265,7 +263,6 @@ QPIConfig::QPIConfig(const QString & path, QPIConfig::FileType type_): QFile(pat
type = type_; type = type_;
if (!path.isEmpty()) { if (!path.isEmpty()) {
open(QIODevice::ReadWrite); open(QIODevice::ReadWrite);
//stream.setDevice(this);
parse(); parse();
} }
} }
@@ -275,7 +272,6 @@ QPIConfig::QPIConfig(QString * str, QPIConfig::FileType type_) {
init(); init();
type = type_; type = type_;
buffer = str; buffer = str;
//stream.setDevice(this);
parse(); parse();
} }
@@ -565,7 +561,6 @@ void QPIConfig::removeEntry(Branch & b, QPIConfig::Entry * e) {
if (e->isLeaf()) other.removeAt(e->_line); if (e->isLeaf()) other.removeAt(e->_line);
if (!e->isLeaf() && !e->_value.isEmpty()) { if (!e->isLeaf() && !e->_value.isEmpty()) {
e->_value.clear(); e->_value.clear();
//leaf = false;
} else { } else {
int cc = e->_children.size(); int cc = e->_children.size();
for (int i = 0; i < cc; ++i) for (int i = 0; i < cc; ++i)
@@ -598,14 +593,12 @@ void QPIConfig::writeAll() {
buffer->clear(); buffer->clear();
} }
stream.seek(0); stream.seek(0);
//writeEntry(&root);
buildFullNames(&root); buildFullNames(&root);
Branch b = allLeaves(); Branch b = allLeaves();
QString prefix, tprefix; QString prefix, tprefix;
bool isPrefix; bool isPrefix;
int j = 0; int j = 0;
for (int i = 0; i < other.size(); ++i) { for (int i = 0; i < other.size(); ++i) {
//cout << j << endl;
if (j >= 0 && j < b.size()) { if (j >= 0 && j < b.size()) {
if (b[j]->_line == i) { if (b[j]->_line == i) {
b[j]->buildLine(); b[j]->buildLine();
@@ -657,12 +650,10 @@ QString QPIConfig::getPrefixFromLine(QString line, bool * exists) {
QString QPIConfig::writeAllToString() { QString QPIConfig::writeAllToString() {
QString str; QString str;
QTextStream s(&str); QTextStream s(&str);
//writeEntry(&root);
buildFullNames(&root); buildFullNames(&root);
Branch b = allLeaves(); Branch b = allLeaves();
int j = 0; int j = 0;
for (int i = 0; i < other.size(); ++i) { for (int i = 0; i < other.size(); ++i) {
//cout << j << endl;
if (j >= 0 && j < b.size()) { if (j >= 0 && j < b.size()) {
if (b[j]->_line == i) { if (b[j]->_line == i) {
b[j]->buildLine(); b[j]->buildLine();
@@ -803,7 +794,6 @@ void QPIConfig::parse(QString content) {
type = "s"; type = "s";
comm = ""; comm = "";
} }
//name = str.left(ind).trimmed();
tree = (prefix + str.left(ind).trimmed()).split(delim); tree = (prefix + str.left(ind).trimmed()).split(delim);
if (tree.front() == "include") { if (tree.front() == "include") {
name = str.right(str.length() - ind - 1).trimmed(); name = str.right(str.length() - ind - 1).trimmed();
@@ -815,7 +805,6 @@ void QPIConfig::parse(QString content) {
includes << iconf << iconf->includes; includes << iconf << iconf->includes;
updateIncludes(); updateIncludes();
} }
//piCout << "includes" << includes;
other.back() = src; other.back() = src;
} else { } else {
name = tree.back(); name = tree.back();
@@ -858,5 +847,4 @@ void QPIConfig::parse(QString content) {
} }
setEntryDelim(&root, delim); setEntryDelim(&root, delim);
buildFullNames(&root); buildFullNames(&root);
//if (content.isEmpty()) stream.setDevice(this);
} }

View File

@@ -88,8 +88,6 @@ public:
bool isEntryExists(const QString & name) const {foreach (const Entry * i, *this) if (entryExists(i, name)) return true; return false;} bool isEntryExists(const QString & name) const {foreach (const Entry * i, *this) if (entryExists(i, name)) return true; return false;}
int indexOf(const Entry * e) {for (int i = 0; i < size(); ++i) if (at(i) == e) return i; return -1;} int indexOf(const Entry * e) {for (int i = 0; i < size(); ++i) if (at(i) == e) return i; return -1;}
//void clear() {foreach (Entry * i, *this) delete i; QVector<Entry * >::clear();}
private: private:
bool entryExists(const Entry * e, const QString & name) const; bool entryExists(const Entry * e, const QString & name) const;
void allLeaves(Branch & b, Entry * e) {foreach (Entry * i, e->_children) {if (i->isLeaf()) b << i; else allLeaves(b, i);}} void allLeaves(Branch & b, Entry * e) {foreach (Entry * i, e->_children) {if (i->isLeaf()) b << i; else allLeaves(b, i);}}
@@ -150,27 +148,26 @@ public:
Branch getValues(const QString & vname); Branch getValues(const QString & vname);
bool isEntryExists(const QString & name) const {return entryExists(this, name);} bool isEntryExists(const QString & name) const {return entryExists(this, name);}
const QString & stringValue() const {return _value;}
operator bool() {return (_value.toLower().trimmed() == "true" || _value.toLower().trimmed() == "yes" || _value.toLower().trimmed() == "on" || _value.toInt() > 0);} bool toBool() const {return (_value.toLower().trimmed() == "true" || _value.toLower().trimmed() == "yes" || _value.toLower().trimmed() == "on" || _value.toInt() > 0);}
operator char() {return (_value.isEmpty() ? 0 : _value[0].toLatin1());} char toChar() const {return (_value.isEmpty() ? 0 : _value[0].toLatin1());}
operator short() {return _value.toShort();} short toShort() const {return _value.toShort();}
operator int() {return QString2int(_value);} int toInt() const {return QString2int(_value);}
operator long() {return QString2int(_value);} long toLong() const {return QString2int(_value);}
operator uchar() {return QString2int(_value);} uchar toUChar() const {return QString2int(_value);}
operator ushort() {return QString2int(_value);} ushort toUShort() const {return QString2int(_value);}
operator uint() {return QString2int(_value);} uint toUInt() const {return QString2int(_value);}
operator ulong() {return QString2int(_value);} ulong toULong() const {return QString2int(_value);}
operator float() {return _value.toFloat();} float toFloat() const {return _value.toFloat();}
operator double() {return _value.toDouble();} double toDouble() const {return _value.toDouble();}
operator QString() {return _value;} QString toString() const {return _value;}
operator QStringList() {return _value.split("%|%");} QStringList toStringList() const {return _value.split("%|%");}
operator QColor() {return QString2QColor(_value);} QColor toColor() const {return QString2QColor(_value);}
operator QRect() {return QString2QRect(_value);} QRect toRect() const {return QString2QRect(_value);}
operator QRectF() {return QString2QRectF(_value);} QRectF toRectF() const {return QString2QRectF(_value);}
operator QPoint() {return QString2QPoint(_value);} QPoint toPoint() const {return QString2QPoint(_value);}
operator QPointF() {return QString2QPointF(_value);} QPointF toPointF() const {return QString2QPointF(_value);}
operator QByteArray() {return QString2QByteArray(_value);} QByteArray toByteArray() const {return QString2QByteArray(_value);}
private: private:
static bool compare(const QPIConfig::Entry * f, const QPIConfig::Entry * s) {return f->_line < s->_line;} static bool compare(const QPIConfig::Entry * f, const QPIConfig::Entry * s) {return f->_line < s->_line;}
@@ -228,7 +225,7 @@ public:
int entryIndex(const QString & name); int entryIndex(const QString & name);
QString getName(uint number) {return entryByIndex(number)._name;} QString getName(uint number) {return entryByIndex(number)._name;}
QString getValue(uint number) {return entryByIndex(number)._value;} QString getValueByIndex(uint number) {return entryByIndex(number)._value;}
QChar getType(uint number) {return entryByIndex(number)._type[0];} QChar getType(uint number) {return entryByIndex(number)._type[0];}
QString getComment(uint number) {return entryByIndex(number)._comment;} QString getComment(uint number) {return entryByIndex(number)._comment;}

View File

@@ -109,10 +109,9 @@ void SessionManager::save() {
void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) { void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) {
int wstate = (int)sr.getValue(name + " window state", 0); int wstate = sr.getValue(name + " window state").toInt();
QByteArray ba0 = sr.getValue(name + " geometry 0", QByteArray());
w->setWindowState(Qt::WindowNoState); w->setWindowState(Qt::WindowNoState);
w->restoreGeometry(ba0); w->restoreGeometry(sr.getValue(name + " geometry 0").toByteArray());
if (wstate == Qt::WindowMaximized) if (wstate == Qt::WindowMaximized)
w->setWindowState((Qt::WindowState)wstate); w->setWindowState((Qt::WindowState)wstate);
bool wnd_ok = false; bool wnd_ok = false;
@@ -156,12 +155,12 @@ void SessionManager::load(bool onlyMainwindow) {
for (int i = 0; i < mwindows.size(); ++i) { for (int i = 0; i < mwindows.size(); ++i) {
QMainWindow * mw = mwindows[i].second; QMainWindow * mw = mwindows[i].second;
tsc << mw; tsc << mw;
QByteArray ba = sr.getValue(mwindows[i].first + " state", QByteArray()); QByteArray ba = sr.getValue(mwindows[i].first + " state").toByteArray();
if (!ba.isEmpty()) if (!ba.isEmpty())
mw->restoreState(ba); mw->restoreState(ba);
QList<QSplitter * > sp = mw->findChildren<QSplitter * >(); QList<QSplitter * > sp = mw->findChildren<QSplitter * >();
foreach (QSplitter * s, sp) { foreach (QSplitter * s, sp) {
ba = sr.getValue(mwindows[i].first + " splitter " + s->objectName(), QByteArray()); ba = sr.getValue(mwindows[i].first + " splitter " + s->objectName()).toByteArray();
if (!ba.isEmpty()) if (!ba.isEmpty())
s->restoreState(ba); s->restoreState(ba);
} }
@@ -174,49 +173,49 @@ void SessionManager::load(bool onlyMainwindow) {
} }
if (onlyMainwindow) return; if (onlyMainwindow) return;
for (int i = 0; i < checks.size(); ++i) for (int i = 0; i < checks.size(); ++i)
checks[i].second->setChecked(sr.getValue(checks[i].first, checks[i].second->isChecked())); checks[i].second->setChecked(sr.getValue(checks[i].first, checks[i].second->isChecked()).toBool());
for (int i = 0; i < lines.size(); ++i) for (int i = 0; i < lines.size(); ++i)
lines[i].second->setText(sr.getValue(lines[i].first, lines[i].second->text())); lines[i].second->setText(sr.getValue(lines[i].first, lines[i].second->text()).toString());
for (int i = 0; i < combos.size(); ++i) { for (int i = 0; i < combos.size(); ++i) {
QComboBox * c = combos[i].second; QComboBox * c = combos[i].second;
int v = sr.getValue(combos[i].first, c->currentIndex()); int v = sr.getValue(combos[i].first, c->currentIndex()).toInt();
if (v >= 0 && v < c->count()) if (v >= 0 && v < c->count())
c->setCurrentIndex(v); c->setCurrentIndex(v);
} }
for (int i = 0; i < dspins.size(); ++i) for (int i = 0; i < dspins.size(); ++i)
dspins[i].second->setValue(sr.getValue(dspins[i].first, dspins[i].second->value())); dspins[i].second->setValue(sr.getValue(dspins[i].first, dspins[i].second->value()).toDouble());
for (int i = 0; i < spins.size(); ++i) for (int i = 0; i < spins.size(); ++i)
spins[i].second->setValue(sr.getValue(spins[i].first, spins[i].second->value())); spins[i].second->setValue(sr.getValue(spins[i].first, spins[i].second->value()).toInt());
for (int i = 0; i < spinsliders.size(); ++i) for (int i = 0; i < spinsliders.size(); ++i)
spinsliders[i].second->setValue(sr.getValue(spinsliders[i].first, spinsliders[i].second->value())); spinsliders[i].second->setValue(sr.getValue(spinsliders[i].first, spinsliders[i].second->value()).toDouble());
for (int i = 0; i < evals.size(); ++i) for (int i = 0; i < evals.size(); ++i)
evals[i].second->setExpression(sr.getValue(evals[i].first, evals[i].second->expression())); evals[i].second->setExpression(sr.getValue(evals[i].first, evals[i].second->expression()).toString());
for (int i = 0; i < tabs.size(); ++i) { for (int i = 0; i < tabs.size(); ++i) {
QTabWidget * t = tabs[i].second; QTabWidget * t = tabs[i].second;
int v = sr.getValue(tabs[i].first, t->currentIndex()); int v = sr.getValue(tabs[i].first, t->currentIndex()).toDouble();
if (v >= 0 && v < t->count()) if (v >= 0 && v < t->count())
t->setCurrentIndex(v); t->setCurrentIndex(v);
} }
for (int i = 0; i < groups.size(); ++i) for (int i = 0; i < groups.size(); ++i)
groups[i].second->setChecked(sr.getValue(groups[i].first, groups[i].second->isChecked())); groups[i].second->setChecked(sr.getValue(groups[i].first, groups[i].second->isChecked()).toBool());
for (int i = 0; i < buttons.size(); ++i) for (int i = 0; i < buttons.size(); ++i)
buttons[i].second->setChecked(sr.getValue(buttons[i].first, buttons[i].second->isChecked())); buttons[i].second->setChecked(sr.getValue(buttons[i].first, buttons[i].second->isChecked()).toBool());
for (int i = 0; i < stacks.size(); ++i) for (int i = 0; i < stacks.size(); ++i)
stacks[i].second->setCurrentIndex(qMin((int)sr.getValue(stacks[i].first, stacks[i].second->currentIndex()), stacks[i].second->count())); stacks[i].second->setCurrentIndex(qMin<int>(sr.getValue(stacks[i].first, stacks[i].second->currentIndex()).toBool(), stacks[i].second->count()));
for (int i = 0; i < actions.size(); ++i) for (int i = 0; i < actions.size(); ++i)
actions[i].second->setChecked(sr.getValue(actions[i].first, actions[i].second->isChecked())); actions[i].second->setChecked(sr.getValue(actions[i].first, actions[i].second->isChecked()).toBool());
for (int i = 0; i < stringlists.size(); ++i) for (int i = 0; i < stringlists.size(); ++i)
*stringlists[i].second = sr.getValue(stringlists[i].first, *stringlists[i].second); *stringlists[i].second = sr.getValue(stringlists[i].first, *stringlists[i].second).toStringList();
for (int i = 0; i < strings.size(); ++i) for (int i = 0; i < strings.size(); ++i)
*strings[i].second = sr.getValue(strings[i].first, *strings[i].second).stringValue(); *strings[i].second = sr.getValue(strings[i].first, *strings[i].second).toString();
for (int i = 0; i < colors.size(); ++i) for (int i = 0; i < colors.size(); ++i)
*colors[i].second = sr.getValue(colors[i].first, *colors[i].second); *colors[i].second = sr.getValue(colors[i].first, *colors[i].second).toColor();
for (int i = 0; i < bools.size(); ++i) for (int i = 0; i < bools.size(); ++i)
*bools[i].second = sr.getValue(bools[i].first, *bools[i].second); *bools[i].second = sr.getValue(bools[i].first, *bools[i].second).toBool();
for (int i = 0; i < ints.size(); ++i) for (int i = 0; i < ints.size(); ++i)
*ints[i].second = sr.getValue(ints[i].first, *ints[i].second); *ints[i].second = sr.getValue(ints[i].first, *ints[i].second).toInt();
for (int i = 0; i < floats.size(); ++i) for (int i = 0; i < floats.size(); ++i)
*floats[i].second = sr.getValue(floats[i].first, *floats[i].second); *floats[i].second = sr.getValue(floats[i].first, *floats[i].second).toFloat();
QSet<QObject*> all_list; QSet<QObject*> all_list;
foreach (QObject * c, tsc) { foreach (QObject * c, tsc) {
all_list |= QSet<QObject*>::fromList(c->findChildren<QObject*>()); all_list |= QSet<QObject*>::fromList(c->findChildren<QObject*>());
@@ -227,7 +226,7 @@ void SessionManager::load(bool onlyMainwindow) {
const QMetaObject * mo = o->metaObject(); const QMetaObject * mo = o->metaObject();
QByteArray fn = funcs.value(mo); QByteArray fn = funcs.value(mo);
if (!mo || fn.isEmpty()) continue; if (!mo || fn.isEmpty()) continue;
QByteArray value = sr.getValue(o->objectName(), QByteArray()); QByteArray value = sr.getValue(o->objectName()).toByteArray();
//qDebug() << "load" << o->objectName(); //qDebug() << "load" << o->objectName();
mo->invokeMethod(o, fn.constData(), Q_ARG(QByteArray*, &value)); mo->invokeMethod(o, fn.constData(), Q_ARG(QByteArray*, &value));
} }

View File

@@ -126,25 +126,25 @@ bool CDPultWindow::load(const QString & path) {
QPIConfig conf(path, QIODevice::ReadOnly); QPIConfig conf(path, QIODevice::ReadOnly);
QAD::File f = editFileK->value().value<QAD::File>(); QAD::File f = editFileK->value().value<QAD::File>();
checkSyncFiles->setChecked(false); checkSyncFiles->setChecked(false);
editFileK->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_k").value(), f.filter))); editFileK->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_k").toString(), f.filter)));
editFileX->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_x").value(), f.filter))); editFileX->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_x").toString(), f.filter)));
editFileC->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_c").value(), f.filter))); editFileC->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_c").toString(), f.filter)));
editFileM->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_m").value(), f.filter))); editFileM->setValue(QVariant::fromValue(QAD::File(conf.getValue("file_m").toString(), f.filter)));
checkSyncFiles->setChecked(conf.getValue("sync_files")); checkSyncFiles->setChecked(conf.getValue("sync_files").toBool());
lineSessionName->setText(conf.getValue("session_name")); lineSessionName->setText(conf.getValue("session_name").toString());
last_icon = conf.getValue("icon_path", "").value(); last_icon = conf.getValue("icon_path").toString();
setAppIcon(conf.getValue("icon", QByteArray())); setAppIcon(conf.getValue("icon").toByteArray());
checkHasK->setChecked(conf.getValue("has_k")); checkHasK->setChecked(conf.getValue("has_k").toBool());
checkHasX->setChecked(conf.getValue("has_x")); checkHasX->setChecked(conf.getValue("has_x").toBool());
checkHasC->setChecked(conf.getValue("has_c")); checkHasC->setChecked(conf.getValue("has_c").toBool());
checkHasM->setChecked(conf.getValue("has_m")); checkHasM->setChecked(conf.getValue("has_m").toBool());
checkDefaultConfig->setChecked(conf.getValue("default_config")); checkDefaultConfig->setChecked(conf.getValue("default_config").toBool());
codeConfig->setText(QByteArray2QString(conf.getValue("config", QByteArray()))); codeConfig->setText(QByteArray2QString(conf.getValue("config").toByteArray()));
if (codeConfig->text().isEmpty()) if (codeConfig->text().isEmpty())
codeConfig->setText(def_config); codeConfig->setText(def_config);
session_gr = conf.getValue("session_gr", QByteArray()); session_gr = conf.getValue("session_gr").toByteArray();
session_dk = conf.getValue("session_dk", QByteArray()); session_dk = conf.getValue("session_dk").toByteArray();
session_mw = conf.getValue("session_mw", QByteArray()); session_mw = conf.getValue("session_mw").toByteArray();
setChanged(false); setChanged(false);
file_name = path; file_name = path;
apply(true); apply(true);
@@ -185,7 +185,7 @@ bool CDPultWindow::save(const QString & path) {
void CDPultWindow::loadingSession(QPIConfig & conf) { void CDPultWindow::loadingSession(QPIConfig & conf) {
setRecentFiles(conf.getValue("recent files", QStringList())); setRecentFiles(conf.getValue("recent files").toStringList());
} }