MCPcopy Create free account
hub / github.com/YACReader/yacreader / main

Function main

YACReaderLibraryServer/main.cpp:42–134  ·  view source on GitHub ↗

----------------------------------------------------------------------------- main------------------------------------------------------------------------- -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

40// main-------------------------------------------------------------------------
41// -----------------------------------------------------------------------------
42int main(int argc, char **argv)
43{
44 qInstallMessageHandler(messageHandler);
45
46 QCoreApplication app(argc, argv);
47
48 QImageReader::setAllocationLimit(0);
49
50 app.setApplicationName("YACReaderLibrary");
51 app.setOrganizationName("YACReader");
52 YACReader::initializeSharedPluginPaths();
53
54 QString buildNumber = ".0";
55
56#ifdef BUILD_NUMBER
57 buildNumber = QString(".%1").arg(BUILD_NUMBER);
58#endif
59
60 app.setApplicationVersion(VERSION + buildNumber);
61
62 QTextStream qout(stdout);
63
64 // general help
65 QTranslator translator;
66 QString sufix = QLocale::system().name();
67
68#if defined Q_OS_UNIX && !defined Q_OS_MACOS
69 translator.load(QString(DATADIR) + "/yacreader/languages/yacreaderlibrary_" + sufix);
70#else
71 translator.load(QCoreApplication::applicationDirPath() + "/languages/yacreaderlibrary_" + sufix);
72#endif
73 app.installTranslator(&translator);
74
75 auto settingsPath = YACReader::getSettingsPath() + "/" + QCoreApplication::applicationName() + ".ini";
76
77 QCommandLineParser parser;
78 parser.setApplicationDescription(QString(QCoreApplication::tr("\nYACReaderLibraryServer is the headless (no gui) version of YACReaderLibrary.\n\n"
79 "This appplication supports persistent settings, to set them up edit this file %1\n"
80 "To learn about the available settings please check the documentation at https://raw.githubusercontent.com/YACReader/yacreader/develop/YACReaderLibraryServer/SETTINGS_README.md"))
81 .arg(settingsPath));
82 parser.addHelpOption();
83 const QCommandLineOption versionOption = parser.addVersionOption();
84 parser.addPositionalArgument("command", "The command to execute. [start, create-library, update-library, add-library, remove-library, list-libraries, set-port, rescan-xml-info]");
85 parser.addOption({ "loglevel", "Set log level. Valid values: trace, info, debug, warn, error.", "loglevel", "info" });
86 parser.addOption({ "port", "Set server port (temporary). Valid values: 1-65535", "port" });
87 parser.addOption({ "system-info", "Prints detailed information about the system environment, including OS version, hardware specifications, and available resources." });
88 parser.parse(app.arguments());
89
90 const QStringList args = parser.positionalArguments();
91 const QString command = args.isEmpty() ? QString() : args.first();
92
93 if (parser.isSet(versionOption)) {
94 qout << "YACReaderLibraryServer"
95 << " " << VERSION << Qt::endl;
96
97 return 0;
98 }
99

Callers

nothing calls this directly

Calls 15

startFunction · 0.85
createLibraryFunction · 0.85
updateLibraryFunction · 0.85
addLibraryFunction · 0.85
removeLibraryFunction · 0.85
listLibrariesFunction · 0.85
setPortFunction · 0.85
rescanXmlInfoFunction · 0.85
parseMethod · 0.80
isEmptyMethod · 0.80
splitMethod · 0.80
QStringClass · 0.50

Tested by

no test coverage detected