git-svn-id: svn://db.shs.com.ru/libs@533 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -146,3 +146,20 @@ PropertyStorage::Property PropertyStorage::parsePropertyLine(QString l) {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PropertyStorage::Property & PropertyStorage::operator[](const QString & name) {
|
||||||
|
for (int i = 0; i < props.size(); ++i)
|
||||||
|
if (props[i].name == name)
|
||||||
|
return props[i];
|
||||||
|
addProperty(name, "");
|
||||||
|
return props.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const PropertyStorage::Property PropertyStorage::operator[](const QString & name) const {
|
||||||
|
for (int i = 0; i < props.size(); ++i)
|
||||||
|
if (props[i].name == name)
|
||||||
|
return props[i];
|
||||||
|
return Property();
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ public:
|
|||||||
struct Property {
|
struct Property {
|
||||||
Property(const QString & n = QString(), const QString & c = QString(), const QVariant & v = QVariant(), int f = 0):
|
Property(const QString & n = QString(), const QString & c = QString(), const QVariant & v = QVariant(), int f = 0):
|
||||||
name(n), comment(c), value(v), flags(f) {}
|
name(n), comment(c), value(v), flags(f) {}
|
||||||
|
bool toBool() const {return value.toBool();}
|
||||||
|
int toInt() const {return value.toInt();}
|
||||||
|
float toFloat() const {return value.toFloat();}
|
||||||
|
double toDouble() const {return value.toDouble();}
|
||||||
|
QString toString() const {return value.toString();}
|
||||||
QString name;
|
QString name;
|
||||||
QString comment;
|
QString comment;
|
||||||
QVariant value;
|
QVariant value;
|
||||||
@@ -77,6 +82,8 @@ public:
|
|||||||
PropertyStorage & operator <<(const PropertyStorage & p) {props << p.props; return *this;}
|
PropertyStorage & operator <<(const PropertyStorage & p) {props << p.props; return *this;}
|
||||||
Property & operator[](int i) {return props[i];}
|
Property & operator[](int i) {return props[i];}
|
||||||
const Property & operator[](int i) const {return props[i];}
|
const Property & operator[](int i) const {return props[i];}
|
||||||
|
Property & operator[](const QString & name);
|
||||||
|
const Property operator[](const QString & name) const;
|
||||||
|
|
||||||
static Property parsePropertyLine(QString l);
|
static Property parsePropertyLine(QString l);
|
||||||
|
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ void SessionManager::save() {
|
|||||||
sr.setValue(o->objectName(), value, false);
|
sr.setValue(o->objectName(), value, false);
|
||||||
}
|
}
|
||||||
//qDebug() << mcl.size();
|
//qDebug() << mcl.size();
|
||||||
sr.writeAll();
|
|
||||||
emit saving(sr);
|
emit saving(sr);
|
||||||
|
sr.writeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,6 @@ public:
|
|||||||
void addEntry(const QString & name, float * e) {floats.push_back(QPair<QString, float * >(name, e));}
|
void addEntry(const QString & name, float * e) {floats.push_back(QPair<QString, float * >(name, e));}
|
||||||
void addMainWidget(const QString & name, QWidget * e) {widgets.push_back(QPair<QString, QWidget * >(name, e));}
|
void addMainWidget(const QString & name, QWidget * e) {widgets.push_back(QPair<QString, QWidget * >(name, e));}
|
||||||
|
|
||||||
void save();
|
|
||||||
void load(bool onlyMainwindow = false);
|
|
||||||
void clear(bool with_filename = true);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<const QMetaObject*, QByteArray> metaFunctions(const QSet<QObject*> & objects, QByteArray fname);
|
QMap<const QMetaObject*, QByteArray> metaFunctions(const QSet<QObject*> & objects, QByteArray fname);
|
||||||
|
|
||||||
@@ -94,6 +90,11 @@ private:
|
|||||||
QVector<QPair<QString, float * > > floats;
|
QVector<QPair<QString, float * > > floats;
|
||||||
QString file_;
|
QString file_;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void save();
|
||||||
|
void load(bool onlyMainwindow = false);
|
||||||
|
void clear(bool with_filename = true);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void loading(QPIConfig & );
|
void loading(QPIConfig & );
|
||||||
void saving(QPIConfig & );
|
void saving(QPIConfig & );
|
||||||
|
|||||||
Reference in New Issue
Block a user