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

Function main

YACReaderLibrary/main.cpp:124–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124int main(int argc, char **argv)
125{
126 qInstallMessageHandler(messageHandler);
127
128 QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
129
130 QImageReader::setAllocationLimit(0);
131
132 QApplication app(argc, argv);
133
134 app.setApplicationName("YACReaderLibrary");
135 app.setOrganizationName("YACReader");
136 app.setApplicationVersion(VERSION);
137 YACReader::initializeSharedPluginPaths();
138
139 // Theme initialization
140 auto *appearanceConfig = new AppearanceConfiguration(
141 YACReader::getSettingsPath() + "/YACReaderLibrary.ini", qApp);
142 auto *themeRepo = new ThemeRepository(
143 ":/themes", YACReader::getSettingsPath() + "/themes/user", "YACReaderLibrary");
144 ThemeManager::instance().initialize(appearanceConfig, themeRepo);
145
146 // Set window icon according to Freedesktop icon specification
147 // This is mostly relevant for Linux and other Unix systems
148 if (QIcon::hasThemeIcon("YACReaderLibrary")) {
149 app.setWindowIcon(QIcon::fromTheme("YACReaderLibrary"));
150 }
151 // TODO: We might want to add a fallback icon here.
152
153 QString destLog = YACReader::getSettingsPath() + "/yacreaderlibrary.log";
154 QDir().mkpath(YACReader::getSettingsPath());
155
156 Logger &logger = Logger::instance();
157#ifdef QT_DEBUG
158 logger.setLoggingLevel(QsLogging::TraceLevel);
159#else
160 logger.setLoggingLevel(QsLogging::ErrorLevel);
161#endif
162
163 DestinationPtrU fileDestination(DestinationFactory::MakeFileDestination(
164 destLog, LogRotationOption::EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
165 DestinationPtrU debugDestination(DestinationFactory::MakeDebugOutputDestination());
166 logger.addDestination(std::move(debugDestination));
167 logger.addDestination(std::move(fileDestination));
168
169 QSettings uiSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat);
170 uiSettings.beginGroup("libraryConfig");
171 QString selectedLanguage = uiSettings.value(UI_LANGUAGE).toString();
172 uiSettings.endGroup();
173 YACReader::UiLanguage::applyLanguage("yacreaderlibrary", selectedLanguage);
174
175 /*QTranslator viewerTranslator;
176 #if defined Q_OS_UNIX && !defined Q_OS_MACOS
177 viewerTranslator.load(QString(DATADIR) + "/yacreader/languages/yacreader_" + sufix);
178 #else
179 viewerTranslator.load(QCoreApplication::applicationDirPath() + "/languages/yacreader_" + sufix);
180 #endif
181 app.installTranslator(&viewerTranslator);*/

Callers

nothing calls this directly

Calls 10

applyLanguageFunction · 0.85
logSystemAndConfigFunction · 0.85
toStringMethod · 0.80
startMethod · 0.80
execMethod · 0.80
initializeMethod · 0.45
processMethod · 0.45
showMethod · 0.45
stopMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected