MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / Application

Method Application

launcher/Application.cpp:217–1071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217Application::Application(int& argc, char** argv) : QApplication(argc, argv)
218{
219#if defined Q_OS_WIN32
220 // attach the parent console if stdout not already captured
221 if (AttachWindowsConsole()) {
222 consoleAttached = true;
223 }
224#endif
225 setOrganizationName(BuildConfig.LAUNCHER_NAME);
226 setOrganizationDomain(BuildConfig.LAUNCHER_DOMAIN);
227 setApplicationName(BuildConfig.LAUNCHER_NAME);
228 setApplicationDisplayName(QString("%1 %2").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString()));
229 setApplicationVersion(BuildConfig.printableVersionString() + "\n" + BuildConfig.GIT_COMMIT);
230 setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME);
231 m_startTime = QDateTime::currentDateTime();
232
233 // Don't quit on hiding the last window
234 this->setQuitOnLastWindowClosed(false);
235 this->setQuitLockEnabled(false);
236
237 // Commandline parsing
238 QCommandLineParser parser;
239 parser.setApplicationDescription(BuildConfig.LAUNCHER_DISPLAYNAME);
240
241 parser.addOptions(
242 { { { "d", "dir" }, "Use a custom path as application root (use '.' for current directory)", "directory" },
243 { { "l", "launch" }, "Launch the specified instance (by instance ID)", "instance" },
244 { { "s", "server" }, "Join the specified server on launch (only valid in combination with --launch)", "address" },
245 { { "w", "world" }, "Join the specified world on launch (only valid in combination with --launch)", "world" },
246 { { "a", "profile" }, "Use the account specified by its profile name (only valid in combination with --launch)", "profile" },
247 { "alive", "Write a small '" + liveCheckFile + "' file after the launcher starts" },
248 { { "I", "import" }, "Import instance or resource from specified local path or URL", "url" },
249 { "show", "Opens the window for the specified instance (by instance ID)", "show" } });
250 // Has to be positional for some OS to handle that properly
251 parser.addPositionalArgument("URL", "Import the resource(s) at the given URL(s) (same as -I / --import)", "[URL...]");
252
253 parser.addHelpOption();
254 parser.addVersionOption();
255
256 parser.process(arguments());
257
258 m_instanceIdToLaunch = parser.value("launch");
259 m_serverToJoin = parser.value("server");
260 m_worldToJoin = parser.value("world");
261 m_profileToUse = parser.value("profile");
262 m_liveCheck = parser.isSet("alive");
263
264 m_instanceIdToShowWindowOf = parser.value("show");
265
266 for (auto url : parser.values("import")) {
267 m_urlsToImport.append(normalizeImportUrl(url));
268 }
269
270 // treat unspecified positional arguments as import urls
271 for (auto url : parser.positionalArguments()) {
272 m_urlsToImport.append(normalizeImportUrl(url));
273 }
274

Callers

nothing calls this directly

Calls 15

showMainWindowMethod · 0.95
AttachWindowsConsoleFunction · 0.85
QStringClass · 0.85
PathCombineFunction · 0.85
updateTimestampFunction · 0.85
isSnapFunction · 0.85
ensureFolderPathExistsFunction · 0.85
moveFunction · 0.85
suitableMaxMemFunction · 0.85
checkProblemticPathJavaFunction · 0.85
QFileInfoClass · 0.85
readFunction · 0.85

Tested by

no test coverage detected