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

@@ -109,10 +109,9 @@ void SessionManager::save() {
void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) {
int wstate = (int)sr.getValue(name + " window state", 0);
QByteArray ba0 = sr.getValue(name + " geometry 0", QByteArray());
int wstate = sr.getValue(name + " window state").toInt();
w->setWindowState(Qt::WindowNoState);
w->restoreGeometry(ba0);
w->restoreGeometry(sr.getValue(name + " geometry 0").toByteArray());
if (wstate == Qt::WindowMaximized)
w->setWindowState((Qt::WindowState)wstate);
bool wnd_ok = false;
@@ -156,12 +155,12 @@ void SessionManager::load(bool onlyMainwindow) {
for (int i = 0; i < mwindows.size(); ++i) {
QMainWindow * mw = mwindows[i].second;
tsc << mw;
QByteArray ba = sr.getValue(mwindows[i].first + " state", QByteArray());
QByteArray ba = sr.getValue(mwindows[i].first + " state").toByteArray();
if (!ba.isEmpty())
mw->restoreState(ba);
QList<QSplitter * > sp = mw->findChildren<QSplitter * >();
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())
s->restoreState(ba);
}
@@ -174,49 +173,49 @@ void SessionManager::load(bool onlyMainwindow) {
}
if (onlyMainwindow) return;
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)
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) {
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())
c->setCurrentIndex(v);
}
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)
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)
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)
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) {
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())
t->setCurrentIndex(v);
}
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)
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)
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)
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)
*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)
*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)
*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)
*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)
*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)
*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;
foreach (QObject * c, tsc) {
all_list |= QSet<QObject*>::fromList(c->findChildren<QObject*>());
@@ -227,7 +226,7 @@ void SessionManager::load(bool onlyMainwindow) {
const QMetaObject * mo = o->metaObject();
QByteArray fn = funcs.value(mo);
if (!mo || fn.isEmpty()) continue;
QByteArray value = sr.getValue(o->objectName(), QByteArray());
QByteArray value = sr.getValue(o->objectName()).toByteArray();
//qDebug() << "load" << o->objectName();
mo->invokeMethod(o, fn.constData(), Q_ARG(QByteArray*, &value));
}