version 1.6.0
QAD::File add "is_save" flag
This commit is contained in:
@@ -45,7 +45,6 @@ namespace QAD {
|
||||
struct QAD_EXPORT Enum {
|
||||
Enum(const QString & n = QString()): enum_name(n) {}
|
||||
Enum(const QMetaEnum & meta, int selected = 0);
|
||||
QString toString() const {return selected;} // obsolete, use selectedName()
|
||||
int selectedValue() const;
|
||||
QString selectedName() const {return selected;}
|
||||
bool selectValue(int v);
|
||||
@@ -64,15 +63,18 @@ namespace QAD {
|
||||
};
|
||||
|
||||
struct QAD_EXPORT File {
|
||||
File(const QString & p = QString(), const QString & f = QString(), bool abs = false): file(p), filter(f), is_abs(abs) {}
|
||||
File(const QString & p = QString(), const QString & f = QString(), bool abs = false, bool save_mode = false):
|
||||
file(p), filter(f), is_abs(abs), is_save(save_mode) {}
|
||||
QString toString() const {return file;}
|
||||
QString file;
|
||||
QString filter;
|
||||
bool is_abs;
|
||||
bool is_save;
|
||||
};
|
||||
|
||||
struct QAD_EXPORT Dir {
|
||||
Dir(const QString & d = QString(), bool abs = false): dir(d), is_abs(abs) {}
|
||||
Dir(const QString & d = QString(), bool abs = false):
|
||||
dir(d), is_abs(abs) {}
|
||||
QString toString() const {return dir;}
|
||||
QString dir;
|
||||
bool is_abs;
|
||||
@@ -113,8 +115,8 @@ inline QDataStream & operator >>(QDataStream & s, QAD::Enum & v) {s >> v.enum_na
|
||||
inline QDebug operator <<(QDebug s, const QAD::Enum & v) {s.nospace() << v.selected; return s.space();}
|
||||
|
||||
Q_DECLARE_METATYPE(QAD::File)
|
||||
inline QDataStream & operator <<(QDataStream & s, const QAD::File & v) {s << v.file << v.filter << v.is_abs; return s;}
|
||||
inline QDataStream & operator >>(QDataStream & s, QAD::File & v) {s >> v.file >> v.filter >> v.is_abs; return s;}
|
||||
inline QDataStream & operator <<(QDataStream & s, const QAD::File & v) {s << v.file << v.filter << uchar((v.is_abs ? 1 : 0) + (v.is_save ? 2 : 0)); return s;}
|
||||
inline QDataStream & operator >>(QDataStream & s, QAD::File & v) {uchar f(0); s >> v.file >> v.filter >> f; v.is_abs = ((f & 1) == 1); v.is_save = ((f & 2) == 2); return s;}
|
||||
inline QDebug operator <<(QDebug s, const QAD::File & v) {s.nospace() << v.file; return s.space();}
|
||||
|
||||
Q_DECLARE_METATYPE(QAD::Dir)
|
||||
|
||||
Reference in New Issue
Block a user