File indexing completed on 2025-01-19 03:53:33

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-06-27
0007  * Description : Database engine configuration
0008  *
0009  * SPDX-FileCopyrightText: 2009-2010 by Holger Foerster <hamsi2k at freenet dot de>
0010  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "dbengineconfig.h"
0017 
0018 // Qt includes
0019 
0020 #include <QtGlobal>
0021 #include <QStandardPaths>
0022 
0023 // Local includes
0024 
0025 #include "digikam_dbconfig.h"
0026 #include "dbengineconfigloader.h"
0027 
0028 namespace Digikam
0029 {
0030 
0031 Q_GLOBAL_STATIC_WITH_ARGS(DbEngineConfigSettingsLoader,
0032                           dbcoreloader,
0033                           (QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("digikam/database/dbconfig.xml")),
0034                            dbcoreconfig_xml_version)
0035                          )
0036 
0037 DbEngineConfigSettings DbEngineConfig::element(const QString& databaseType)
0038 {
0039     // Unprotected read-only access? Usually accessed under CoreDbAccess protection anyway
0040     return dbcoreloader->databaseConfigs.value(databaseType);
0041 }
0042 
0043 bool DbEngineConfig::checkReadyForUse()
0044 {
0045     return dbcoreloader->isValid;
0046 }
0047 
0048 QString DbEngineConfig::errorMessage()
0049 {
0050     return dbcoreloader->errorMessage;
0051 }
0052 
0053 } // namespace Digikam