@@ -19,7 +19,7 | |||||
19 |
|
19 | |||
20 | Q_LOGGING_CATEGORY(LOG_CatalogueController, "CatalogueController") |
|
20 | Q_LOGGING_CATEGORY(LOG_CatalogueController, "CatalogueController") | |
21 |
|
21 | |||
22 |
namespace |
|
22 | namespace { | |
23 |
|
23 | |||
24 | static QString REPOSITORY_WORK_SUFFIX = QString{"Work"}; |
|
24 | static QString REPOSITORY_WORK_SUFFIX = QString{"Work"}; | |
25 |
|
25 | |||
@@ -63,9 +63,8 void CatalogueController::addDB(const QString &dbPath) | |||||
63 | qCCritical(LOG_CatalogueController()) |
|
63 | qCCritical(LOG_CatalogueController()) | |
64 | << tr("Impossible to addDB %1 from %2 ").arg(dirName, dbPath); |
|
64 | << tr("Impossible to addDB %1 from %2 ").arg(dirName, dbPath); | |
65 | } |
|
65 | } | |
66 | else |
|
66 | else { | |
67 | { |
|
67 | impl->m_RepositoryList.push_back(dirName); | |
68 | impl->m_RepositoryList << dirName; |
|
|||
69 | } |
|
68 | } | |
70 | } |
|
69 | } | |
71 | else { |
|
70 | else { | |
@@ -109,15 +108,24 void CatalogueController::initialize() | |||||
109 | << QThread::currentThread(); |
|
108 | << QThread::currentThread(); | |
110 | impl->m_WorkingMutex.lock(); |
|
109 | impl->m_WorkingMutex.lock(); | |
111 | impl->m_CatalogueDao.initialize(); |
|
110 | impl->m_CatalogueDao.initialize(); | |
112 |
auto defaultRepository |
|
111 | auto defaultRepositoryLocation | |
113 |
QStandardPaths:: |
|
112 | = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); | |
114 | QDir defaultRepositoryDir(defaultRepository); |
|
113 | ||
115 |
|
|
114 | QDir defaultRepositoryLocationDir; | |
116 | qCInfo(LOG_CatalogueController()) << tr("Persistant data loading from: ") |
|
115 | if (defaultRepositoryLocationDir.mkpath(defaultRepositoryLocation)) { | |
117 | << defaultRepository; |
|
116 | defaultRepositoryLocationDir.cd(defaultRepositoryLocation); | |
|
117 | auto defaultRepository = defaultRepositoryLocationDir.absoluteFilePath(REPOSITORY_DEFAULT); | |||
|
118 | qCInfo(LOG_CatalogueController()) | |||
|
119 | << tr("Persistant data loading from: ") << defaultRepository; | |||
118 | this->addDB(defaultRepository); |
|
120 | this->addDB(defaultRepository); | |
119 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END"); |
|
|||
120 | } |
|
121 | } | |
|
122 | else { | |||
|
123 | qCWarning(LOG_CatalogueController()) | |||
|
124 | << tr("Cannot load the persistent default repository from ") | |||
|
125 | << defaultRepositoryLocation; | |||
|
126 | } | |||
|
127 | ||||
|
128 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END"); | |||
121 | } |
|
129 | } | |
122 |
|
130 | |||
123 | void CatalogueController::finalize() |
|
131 | void CatalogueController::finalize() |
General Comments 0
You need to be logged in to leave comments.
Login now