mirror of https://github.com/stella-emu/stella.git
Rename SettingsDb -> StellaDb .
This commit is contained in:
parent
ba24fe7430
commit
419a23183f
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#include "SettingsDb.hxx"
|
||||
#include "StellaDb.hxx"
|
||||
#include "Logger.hxx"
|
||||
#include "SqliteError.hxx"
|
||||
#include "repository/KeyValueRepositoryNoop.hxx"
|
||||
|
@ -34,14 +34,14 @@ namespace {
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsDb::SettingsDb(const string& databaseDirectory, const string& databaseName)
|
||||
StellaDb::StellaDb(const string& databaseDirectory, const string& databaseName)
|
||||
: myDatabaseDirectory{databaseDirectory},
|
||||
myDatabaseName{databaseName}
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsDb::initialize()
|
||||
void StellaDb::initialize()
|
||||
{
|
||||
try {
|
||||
myDb = make_unique<SqliteDatabase>(myDatabaseDirectory, myDatabaseName);
|
||||
|
@ -75,7 +75,7 @@ void SettingsDb::initialize()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsDb::initializeDb() const
|
||||
void StellaDb::initializeDb() const
|
||||
{
|
||||
FilesystemNode legacyConfigFile{myDatabaseDirectory};
|
||||
legacyConfigFile /= "stellarc";
|
||||
|
@ -87,7 +87,7 @@ void SettingsDb::initializeDb() const
|
|||
legacyPropertyFile /= "stella.pro";
|
||||
|
||||
if (legacyConfigDatabase.exists() && legacyConfigDatabase.isFile())
|
||||
importOldSettingsDB(legacyConfigDatabase);
|
||||
importOldStellaDb(legacyConfigDatabase);
|
||||
else if (legacyConfigFile.exists() && legacyConfigFile.isFile())
|
||||
importStellarc(legacyConfigFile);
|
||||
|
||||
|
@ -98,7 +98,7 @@ void SettingsDb::initializeDb() const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsDb::importStellarc(const FilesystemNode& node) const
|
||||
void StellaDb::importStellarc(const FilesystemNode& node) const
|
||||
{
|
||||
Logger::info("importing old settings from " + node.getPath());
|
||||
|
||||
|
@ -106,7 +106,7 @@ void SettingsDb::importStellarc(const FilesystemNode& node) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsDb::importOldSettingsDB(const FilesystemNode& node) const {
|
||||
void StellaDb::importOldStellaDb(const FilesystemNode& node) const {
|
||||
Logger::info("importing old settings from " + node.getPath());
|
||||
|
||||
try {
|
||||
|
@ -126,7 +126,7 @@ void SettingsDb::importOldSettingsDB(const FilesystemNode& node) const {
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsDb::importOldPropset(const FilesystemNode& node) const
|
||||
void StellaDb::importOldPropset(const FilesystemNode& node) const
|
||||
{
|
||||
Logger::info("importing old game properties from " + node.getPath());
|
||||
|
||||
|
@ -157,7 +157,7 @@ void SettingsDb::importOldPropset(const FilesystemNode& node) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsDb::migrate() const
|
||||
void StellaDb::migrate() const
|
||||
{
|
||||
Int32 version = myDb->getUserVersion();
|
||||
switch (version) {
|
|
@ -15,8 +15,8 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_DB_HXX
|
||||
#define SETTINGS_DB_HXX
|
||||
#ifndef STELLA_DB_HXX
|
||||
#define STELLA_DB_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "SqliteDatabase.hxx"
|
||||
|
@ -24,11 +24,11 @@
|
|||
#include "repository/CompositeKeyValueRepository.hxx"
|
||||
#include "FSNode.hxx"
|
||||
|
||||
class SettingsDb
|
||||
class StellaDb
|
||||
{
|
||||
public:
|
||||
|
||||
SettingsDb(const string& databaseDirectory, const string& databaseName);
|
||||
StellaDb(const string& databaseDirectory, const string& databaseName);
|
||||
|
||||
void initialize();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class SettingsDb
|
|||
|
||||
void initializeDb() const;
|
||||
void importStellarc(const FilesystemNode& node) const;
|
||||
void importOldSettingsDB(const FilesystemNode& node) const;
|
||||
void importOldStellaDb(const FilesystemNode& node) const;
|
||||
void importOldPropset(const FilesystemNode& node) const;
|
||||
|
||||
void migrate() const;
|
||||
|
@ -58,4 +58,4 @@ class SettingsDb
|
|||
unique_ptr<CompositeKeyValueRepository> myPropertyRepository;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_DB_HXX
|
||||
#endif // STELLA_DB_HXX
|
|
@ -4,7 +4,7 @@ MODULE_OBJS := \
|
|||
src/common/repository/sqlite/AbstractKeyValueRepositorySqlite.o \
|
||||
src/common/repository/sqlite/KeyValueRepositorySqlite.o \
|
||||
src/common/repository/sqlite/CompositeKeyValueRepositorySqlite.o \
|
||||
src/common/repository/sqlite/SettingsDb.o \
|
||||
src/common/repository/sqlite/StellaDb.o \
|
||||
src/common/repository/sqlite/SqliteDatabase.o \
|
||||
src/common/repository/sqlite/SqliteStatement.o \
|
||||
src/common/repository/sqlite/SqliteTransaction.o
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "Widget.hxx"
|
||||
#endif
|
||||
#include "KeyValueRepositorySqlite.hxx"
|
||||
#include "SettingsDb.hxx"
|
||||
#include "StellaDb.hxx"
|
||||
|
||||
#include "FSNode.hxx"
|
||||
#include "MD5.hxx"
|
||||
|
@ -223,9 +223,9 @@ void OSystem::loadConfig(const Settings::Options& options)
|
|||
if(!myHomeDir.isDirectory())
|
||||
myHomeDir.makeDir();
|
||||
|
||||
mySettingsDb = make_shared<SettingsDb>(myBaseDir.getPath(), "stella");
|
||||
mySettingsDb->initialize();
|
||||
myConfigFile = FilesystemNode(mySettingsDb->databaseFileName());
|
||||
myStellaDb = make_shared<StellaDb>(myBaseDir.getPath(), "stella");
|
||||
myStellaDb->initialize();
|
||||
myConfigFile = FilesystemNode(myStellaDb->databaseFileName());
|
||||
|
||||
mySettings->setRepository(getSettingsRepository());
|
||||
myPropSet->setRepository(getPropertyRepository());
|
||||
|
@ -881,12 +881,12 @@ void OSystem::mainLoop()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
shared_ptr<KeyValueRepository> OSystem::getSettingsRepository()
|
||||
{
|
||||
return shared_ptr<KeyValueRepository>(mySettingsDb, &mySettingsDb->settingsRepository());
|
||||
return shared_ptr<KeyValueRepository>(myStellaDb, &myStellaDb->settingsRepository());
|
||||
}
|
||||
|
||||
shared_ptr<CompositeKeyValueRepository> OSystem::getPropertyRepository()
|
||||
{
|
||||
return shared_ptr<CompositeKeyValueRepository>(mySettingsDb, &mySettingsDb->propertyRepository());
|
||||
return shared_ptr<CompositeKeyValueRepository>(myStellaDb, &myStellaDb->propertyRepository());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class AudioSettings;
|
|||
#ifdef PNG_SUPPORT
|
||||
class PNGLibrary;
|
||||
#endif
|
||||
class SettingsDb;
|
||||
class StellaDb;
|
||||
|
||||
#include <chrono>
|
||||
|
||||
|
@ -568,7 +568,7 @@ class OSystem
|
|||
static string ourOverrideBaseDir;
|
||||
static bool ourOverrideBaseDirWithApp;
|
||||
|
||||
shared_ptr<SettingsDb> mySettingsDb;
|
||||
shared_ptr<StellaDb> myStellaDb;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue