Files
Cockatrice/dbconverter/src/main.cpp
BruebachL a8a3fca8c9 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>
2025-11-08 22:19:40 +01:00

67 lines
2.8 KiB
C++

/***************************************************************************
* Copyright (C) 2019 by Fabio Bas *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "main.h"
#include "mocks.h"
#include "version_string.h"
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QDebug>
#include <QFileInfo>
#include <QtGlobal>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
app.setOrganizationName("Cockatrice");
app.setApplicationName("Dbconverter");
app.setApplicationVersion(VERSION_STRING);
QCommandLineParser parser;
parser.addPositionalArgument("olddb", "Read existing card database from <file>");
parser.addPositionalArgument("newdb", "Write new card database to <file>");
parser.addHelpOption();
parser.addVersionOption();
parser.process(app);
QString oldDbPath;
QString newDbPath;
QStringList args = parser.positionalArguments();
if (args.count() == 2) {
oldDbPath = QFileInfo(args.at(0)).absoluteFilePath();
newDbPath = QFileInfo(args.at(1)).absoluteFilePath();
} else {
qCritical() << "Usage: dbconverter <olddb> <newdb>";
parser.showHelp(1);
exit(0);
}
CardDatabaseConverter *db = new CardDatabaseConverter;
qInfo() << "---------------------------------------------";
qInfo() << "Loading cards from" << oldDbPath;
db->loadCardDatabase(oldDbPath);
qInfo() << "---------------------------------------------";
qInfo() << "Saving cards to" << newDbPath;
db->saveCardDatabase(newDbPath);
qInfo() << "---------------------------------------------";
}