@@ -179,13 +179,13 @@ public:
180public Q_SLOTS:
180public Q_SLOTS:
182− void saveState(const QString &windowId, int state)
182+ void saveState(const QString &windowId, WindowStateStorage::WindowState state)
184 QSqlDatabase connection = QSqlDatabase::database(m_connectionName);
184 QSqlDatabase connection = QSqlDatabase::database(m_connectionName);
185 QSqlQuery query(connection);
185 QSqlQuery query(connection);
186 query.prepare(m_saveStateQuery);
186 query.prepare(m_saveStateQuery);
187 query.bindValue(":windowId", windowId);
187 query.bindValue(":windowId", windowId);
188− query.bindValue(":state", state);
188+ query.bindValue(":state", (int)state);
189 if (!query.exec()) {
189 if (!query.exec()) {
190 logSqlError(query);
190 logSqlError(query);
@@ -240,6 +240,7 @@ WindowStateStorage::WindowStateStorage(const QString& dbName, QObject *parent):
240 QObject(parent),
240 QObject(parent),
241 m_thread()
241 m_thread()
243+ qRegisterMetaType<WindowStateStorage::WindowState>("WindowStateStorage::WindowState");
243 QString dbFile;
244 QString dbFile;
244 if (dbName == nullptr) {
245 if (dbName == nullptr) {
245 const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/");
246 const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/");
@@ -262,6 +263,7 @@ WindowStateStorage::WindowStateStorage(const QString& dbName, QObject *parent):
262 m_asyncOk = false;
263 m_asyncOk = false;
263 m_thread.quit();
264 m_thread.quit();
266+ connect(this, &WindowStateStorage::saveState, m_asyncQuery, &AsyncQuery::saveState);
265 connect(this, &WindowStateStorage::saveGeometry, m_asyncQuery, &AsyncQuery::saveGeometry);
267 connect(this, &WindowStateStorage::saveGeometry, m_asyncQuery, &AsyncQuery::saveGeometry);
266 connect(this, &WindowStateStorage::saveStage, m_asyncQuery, &AsyncQuery::saveStage);
268 connect(this, &WindowStateStorage::saveStage, m_asyncQuery, &AsyncQuery::saveStage);
267 m_asyncOk = true;
269 m_asyncOk = true;
@@ -274,20 +276,6 @@ WindowStateStorage::~WindowStateStorage()
274 m_thread.wait();
276 m_thread.wait();
277−void WindowStateStorage::saveState(const QString &windowId, WindowStateStorage::WindowState windowState)
282− // This could be a simple connection like all the other save* methods
283− // on AsyncQuery, but WindowStateStorage::WindowState can't be used
285− QMetaObject::invokeMethod(m_asyncQuery, "saveState", Qt::QueuedConnection,
286− Q_ARG(const QString&, windowId),
287− Q_ARG(int, (int)windowState)
291WindowStateStorage::WindowState WindowStateStorage::getState(const QString &windowId, WindowStateStorage::WindowState defaultValue) const
279WindowStateStorage::WindowState WindowStateStorage::getState(const QString &windowId, WindowStateStorage::WindowState defaultValue) const
293 if (!m_asyncOk) {
281 if (!m_asyncOk) {