| 69 | const static int GROUP_FILE_FORMAT_VERSION = 1; |
| 70 | |
| 71 | InstanceList::InstanceList(SettingsObjectPtr settings, const QString& instDir, QObject* parent) |
| 72 | : QAbstractListModel(parent), m_globalSettings(settings) |
| 73 | { |
| 74 | resumeWatch(); |
| 75 | // Create aand normalize path |
| 76 | if (!QDir::current().exists(instDir)) { |
| 77 | QDir::current().mkpath(instDir); |
| 78 | } |
| 79 | |
| 80 | connect(this, &InstanceList::instancesChanged, this, &InstanceList::providerUpdated); |
| 81 | |
| 82 | // NOTE: canonicalPath requires the path to exist. Do not move this above the creation block! |
| 83 | m_instDir = QDir(instDir).canonicalPath(); |
| 84 | m_watcher = new QFileSystemWatcher(this); |
| 85 | connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &InstanceList::instanceDirContentsChanged); |
| 86 | m_watcher->addPath(m_instDir); |
| 87 | } |
| 88 | |
| 89 | InstanceList::~InstanceList() {} |
| 90 | |