Commit 87ab357e authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Remove uses of 'once' (make build work on MSVC)

parent cfb394e0
......@@ -117,34 +117,6 @@ private:
QMetaObject::Connection _connection;
};
template<class T> struct Collection {
public:
explicit Collection (const int reserved) { _.reserve (reserved); }
inline int count (void) const { return _.count (); }
inline void clear (void) { return _.clear (); }
void add (T * item) {
if (item) {
QObject::connect (item, &T::destroyed, [&] (void) {
this->remove (item);
});
_.append (item);
}
}
inline void remove (T * item) { _.removeAll (item); }
typedef typename QList<T *>::const_iterator iterator;
inline iterator begin (void) const { return _.constBegin (); }
inline iterator end (void) const { return _.constEnd (); }
private:
QList<T *> _;
};
class BasicObject : public QObject, public QQmlParserStatus {
Q_OBJECT
Q_INTERFACES (QQmlParserStatus)
......
......@@ -57,19 +57,16 @@ SharedObject::SharedObject (QObject * parent)
{
m_mruModel = new QQmlVariantListModel (this);
m_mruModel->appendList (qListToVariant<QString> (m_settings.value ("mru").value<QStringList> ()));
once {
if (!m_settings.contains ("rememberTheme")) {
m_settings.setValue ("rememberTheme", 0);
}
m_rememberTheme = (m_settings.value ("rememberTheme").toInt () == 1);
if (!m_settings.contains ("rememberTheme")) {
m_settings.setValue ("rememberTheme", 0);
}
once {
if (!m_settings.contains ("lastFolderUsed") ||
!QFile::exists (m_settings.value ("lastFolderUsed").toString ())) {
m_settings.setValue ("lastFolderUsed", QDir::homePath ());
}
m_lastFolderUsed = m_settings.value ("lastFolderUsed").toString ();
m_rememberTheme = (m_settings.value ("rememberTheme").toInt () == 1);
if (!m_settings.contains ("lastFolderUsed") ||
!QFile::exists (m_settings.value ("lastFolderUsed").toString ())) {
m_settings.setValue ("lastFolderUsed", QDir::homePath ());
}
m_lastFolderUsed = m_settings.value ("lastFolderUsed").toString ();
connect (this, &SharedObject::rememberThemeChanged, this, &SharedObject::onRememberThemeChanged);
connect (this, &SharedObject::lastFolderUsedChanged, this, &SharedObject::onLastFolderUsedChanged);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment