| 89 | } |
| 90 | |
| 91 | int main(int argc, char *argv[]) |
| 92 | { |
| 93 | qInstallMessageHandler(messageHandler); |
| 94 | |
| 95 | QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); |
| 96 | |
| 97 | QImageReader::setAllocationLimit(0); |
| 98 | |
| 99 | #if defined(_MSC_VER) && defined(_DEBUG) |
| 100 | _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); |
| 101 | #endif |
| 102 | |
| 103 | #ifdef Q_OS_MACOS |
| 104 | YACReaderApplication app(argc, argv); |
| 105 | #else |
| 106 | QApplication app(argc, argv); |
| 107 | #endif |
| 108 | |
| 109 | app.setApplicationName("YACReader"); |
| 110 | app.setOrganizationName("YACReader"); |
| 111 | YACReader::initializeSharedPluginPaths(); |
| 112 | |
| 113 | auto *appearanceConfig = new AppearanceConfiguration( |
| 114 | YACReader::getSettingsPath() + "/YACReader.ini", qApp); |
| 115 | auto *themeRepo = new ThemeRepository( |
| 116 | ":/themes", YACReader::getSettingsPath() + "/themes/user", "YACReader"); |
| 117 | ThemeManager::instance().initialize(appearanceConfig, themeRepo); |
| 118 | |
| 119 | if (QIcon::hasThemeIcon("YACReader")) { |
| 120 | app.setWindowIcon(QIcon::fromTheme("YACReader")); |
| 121 | } |
| 122 | |
| 123 | // simple commandline parser |
| 124 | QCommandLineParser parser; |
| 125 | parser.addHelpOption(); |
| 126 | parser.addVersionOption(); |
| 127 | parser.addOption({ "loglevel", "Set log level. Valid values: trace, info, debug, warn, error.", "loglevel", "warning" }); |
| 128 | parser.addPositionalArgument("[File|Directory]", "File or directory to open."); |
| 129 | QCommandLineOption comicId("comicId", "", "comicId"); |
| 130 | QCommandLineOption libraryId("libraryId", "", "libraryId"); |
| 131 | QCommandLineOption readingListId("readingListId", "", "readingListId"); |
| 132 | // hide comicId and libraryId from help |
| 133 | comicId.setFlags(QCommandLineOption::HiddenFromHelp); |
| 134 | libraryId.setFlags(QCommandLineOption::HiddenFromHelp); |
| 135 | readingListId.setFlags(QCommandLineOption::HiddenFromHelp); |
| 136 | |
| 137 | // process |
| 138 | parser.addOption(comicId); |
| 139 | parser.addOption(libraryId); |
| 140 | parser.addOption(readingListId); |
| 141 | parser.process(app); |
| 142 | |
| 143 | QString destLog = YACReader::getSettingsPath() + "/yacreader.log"; |
| 144 | QDir().mkpath(YACReader::getSettingsPath()); |
| 145 | |
| 146 | Logger &logger = Logger::instance(); |
| 147 | logger.setLoggingLevel(QsLogging::TraceLevel); |
| 148 |
nothing calls this directly
no test coverage detected