mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 15:49:28 -08:00
Clean up inter-library dependencies with interfaces (#6280)
* Have CardDatabase::getPreferredPrintingInfo respect card provider ID overrides (pinned printings)
Took 13 minutes
Took 37 seconds
Took 10 seconds
Took 10 seconds
# Commit time for manual adjustment:
# Took 30 seconds
Took 15 seconds
Took 8 minutes
Took 21 seconds
* Move settings cache and settings card preference provider out of libcockatrice_settings and into cockatrice
Took 52 minutes
Took 9 minutes
Took 1 minute
* Temp cache.
Took 16 minutes
* Dependency Injection for SettingsCache
* Turn SettingsCache into a QSharedPointer.
* Implement interfaces for settings that need it
Took 2 hours 38 minutes
* Adjust oracle.
Took 5 minutes
* Move abstract/noop interfaces to libcockatrice_interfaces so they can be linked against independently.
Took 52 minutes
* Clean up some links.
Took 3 minutes
* Cleanup two includes.
Took 3 minutes
* More fixes.
Took 7 minutes
* More includes that slipped past.
Took 3 minutes
* Stop mocking and start injecting for tests.
Took 15 minutes
* I don't know why remote_client was including main.
Took 4 minutes
* Include.
Took 3 minutes
* Lint.
Took 2 minutes
* Don't use Qt pointers.
Took 1 hour 7 minutes
* Make parser use CardSettingsInterface
Took 13 minutes
* Also adjust constructor lol.
Took 8 minutes
* Lint.
Took 32 minutes
* Revert "Lint."
This reverts commit ecb596c39e.
Took 3 minutes
* Test.
Took 3 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
@@ -25,6 +25,7 @@ add_executable(dbconverter MACOSX_BUNDLE ${dbconverter_SOURCES})
|
||||
target_link_libraries(
|
||||
dbconverter
|
||||
PRIVATE libcockatrice_card
|
||||
PRIVATE libcockatrice_interfaces
|
||||
PRIVATE libcockatrice_settings
|
||||
PRIVATE ${DB_CONVERTER_QT_MODULES}
|
||||
)
|
||||
|
||||
@@ -54,7 +54,6 @@ int main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
|
||||
settingsCache = new SettingsCache;
|
||||
CardDatabaseConverter *db = new CardDatabaseConverter;
|
||||
|
||||
qInfo() << "---------------------------------------------";
|
||||
|
||||
@@ -3,10 +3,18 @@
|
||||
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
|
||||
#include <libcockatrice/interfaces/noop_card_preference_provider.h>
|
||||
|
||||
class CardDatabaseConverter : public CardDatabase
|
||||
{
|
||||
public:
|
||||
explicit CardDatabaseConverter()
|
||||
{
|
||||
// Replace querier with one that ignores SettingsCache
|
||||
delete querier;
|
||||
querier = new CardDatabaseQuerier(this, this, new NoopCardPreferenceProvider());
|
||||
};
|
||||
|
||||
LoadStatus loadCardDatabase(const QString &path)
|
||||
{
|
||||
return loader->loadCardDatabase(path);
|
||||
@@ -14,7 +22,7 @@ public:
|
||||
|
||||
bool saveCardDatabase(const QString &fileName)
|
||||
{
|
||||
CockatriceXml4Parser parser;
|
||||
CockatriceXml4Parser parser(new NoopCardPreferenceProvider());
|
||||
return parser.saveToFile(sets, cards, fileName);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,12 +46,7 @@ QString SettingsCache::getSafeConfigFilePath(QString /* configEntry */, QString
|
||||
{
|
||||
return defaultPath;
|
||||
}
|
||||
SettingsCache::SettingsCache()
|
||||
: settings{new QSettings("global.ini", QSettings::IniFormat, this)}, shortcutsSettings{nullptr},
|
||||
cardDatabaseSettings{new CardDatabaseSettings("", this)}, serversSettings{nullptr}, messageSettings{nullptr},
|
||||
gameFiltersSettings{nullptr}, layoutsSettings{nullptr}, downloadSettings{nullptr}
|
||||
{
|
||||
}
|
||||
|
||||
void SettingsCache::setUseTearOffMenus(bool /* _useTearOffMenus */)
|
||||
{
|
||||
}
|
||||
@@ -450,11 +445,4 @@ void SettingsCache::setRoundCardCorners(bool /* _roundCardCorners */)
|
||||
|
||||
void CardPictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
||||
{
|
||||
}
|
||||
|
||||
SettingsCache *settingsCache;
|
||||
|
||||
SettingsCache &SettingsCache::instance()
|
||||
{
|
||||
return *settingsCache;
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,9 @@
|
||||
|
||||
#define PICTURELOADER_H
|
||||
|
||||
#include "../../cockatrice/src/client/settings/cache_settings.h"
|
||||
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/utility/macros.h>
|
||||
|
||||
extern SettingsCache *settingsCache;
|
||||
|
||||
Reference in New Issue
Block a user