Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Prism to open an instance's window from command line #211

Merged
merged 3 commits into from Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion launcher/Application.cpp
Expand Up @@ -245,7 +245,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
{{"s", "server"}, "Join the specified server on launch (only valid in combination with --launch)", "address"},
{{"a", "profile"}, "Use the account specified by its profile name (only valid in combination with --launch)", "profile"},
{"alive", "Write a small '" + liveCheckFile + "' file after the launcher starts"},
{{"I", "import"}, "Import instance from specified zip (local path or URL)", "file"}
{{"I", "import"}, "Import instance from specified zip (local path or URL)", "file"},
{"show", "Opens the window for the specified instance (by instance ID)", "show"}
});
parser.addHelpOption();
parser.addVersionOption();
Expand All @@ -257,6 +258,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_profileToUse = parser.value("profile");
m_liveCheck = parser.isSet("alive");
m_zipToImport = parser.value("import");
m_instanceIdToShowWindowOf = parser.value("show");

// error if --launch is missing with --server or --profile
if((!m_serverToJoin.isEmpty() || !m_profileToUse.isEmpty()) && m_instanceIdToLaunch.isEmpty())
Expand Down Expand Up @@ -986,6 +988,16 @@ void Application::performMainStartupAction()
return;
}
}
if(!m_instanceIdToShowWindowOf.isEmpty())
{
auto inst = instances()->getInstanceById(m_instanceIdToShowWindowOf);
if(inst)
flowln marked this conversation as resolved.
Show resolved Hide resolved
{
qDebug() << "<> Showing window of instance " << m_instanceIdToShowWindowOf;
showInstanceWindow(inst);
return;
}
}
if(!m_mainWindow)
{
// normal main window
Expand Down
1 change: 1 addition & 0 deletions launcher/Application.h
Expand Up @@ -301,6 +301,7 @@ private slots:
QString m_profileToUse;
bool m_liveCheck = false;
QUrl m_zipToImport;
QString m_instanceIdToShowWindowOf;
std::unique_ptr<QFile> logFile;
};

3 changes: 3 additions & 0 deletions program_info/prismlauncher.6.scd
Expand Up @@ -26,6 +26,9 @@ Here are the current features of Prism Launcher.
*-l, --launch*=INSTANCE_ID
Launch the instance specified by INSTANCE_ID.

*--show*=INSTANCE_ID
Show the configuration window of the instance specified by INSTANCE_ID.

*--alive*
Write a small 'live.check' file after Prism Launcher starts.

Expand Down