From: APTX Date: Sun, 18 Jan 2026 14:26:43 +0000 (+0900) Subject: Do not store DB connection settings in MyList X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=ba537b7fd0e445eae72e43bc04f03a5438757374;p=localmylist.git Do not store DB connection settings in MyList Use the settings in Database directly. --- diff --git a/localmylist/mylist.cpp b/localmylist/mylist.cpp index 64a6e2d..ef13cf1 100644 --- a/localmylist/mylist.cpp +++ b/localmylist/mylist.cpp @@ -261,7 +261,7 @@ void MyList::setupWorkThread() { if (workThread) return; - workThread = new WorkThread("workThread", dbs, this); + workThread = new WorkThread("workThread", db->connectionSettings(), this); connect(workThread, SIGNAL(finished()), workThread, SLOT(deleteLater())); connect(database(), SIGNAL(reconnected()), workThread->database(), SLOT(reconnect()), Qt::QueuedConnection); workThread->start(); @@ -284,6 +284,7 @@ void MyList::loadLocalSettings(QSettings &s) s.beginGroup("host"); hostInfo.name = s.value("hostName", QHostInfo::localHostName().toLower()).toString(); s.endGroup(); + DatabaseConnectionSettings dbs; s.beginGroup("database"); dbs.host = s.value("host", "localhost").toString(); dbs.port = quint16(s.value("port", 0).toUInt()); @@ -306,6 +307,7 @@ void MyList::saveLocalSettings() s.beginGroup("host"); s.setValue("hostName", hostInfo.name); s.endGroup(); + const auto &dbs = db->connectionSettings(); s.beginGroup("database"); s.setValue("host", dbs.host); s.setValue("port", dbs.port); diff --git a/localmylist/mylist.h b/localmylist/mylist.h index 1641b44..de34139 100644 --- a/localmylist/mylist.h +++ b/localmylist/mylist.h @@ -104,7 +104,6 @@ signals: void debugMessage(const QString &message); private: - DatabaseConnectionSettings dbs; Database *db; WorkThread *workThread; ServiceManager *m_serviceManager;