Add argument to show instance window
This commit is contained in:
parent
819296cc9c
commit
1288b92615
@ -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"},
|
{{"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"},
|
{{"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"},
|
{"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.addHelpOption();
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
@ -257,6 +258,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
m_profileToUse = parser.value("profile");
|
m_profileToUse = parser.value("profile");
|
||||||
m_liveCheck = parser.isSet("alive");
|
m_liveCheck = parser.isSet("alive");
|
||||||
m_zipToImport = parser.value("import");
|
m_zipToImport = parser.value("import");
|
||||||
|
m_instanceIdToShowWindowOf = parser.value("show");
|
||||||
|
|
||||||
// error if --launch is missing with --server or --profile
|
// error if --launch is missing with --server or --profile
|
||||||
if((!m_serverToJoin.isEmpty() || !m_profileToUse.isEmpty()) && m_instanceIdToLaunch.isEmpty())
|
if((!m_serverToJoin.isEmpty() || !m_profileToUse.isEmpty()) && m_instanceIdToLaunch.isEmpty())
|
||||||
@ -986,6 +988,16 @@ void Application::performMainStartupAction()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!m_instanceIdToShowWindowOf.isEmpty())
|
||||||
|
{
|
||||||
|
auto inst = instances()->getInstanceById(m_instanceIdToShowWindowOf);
|
||||||
|
if(inst)
|
||||||
|
{
|
||||||
|
qDebug() << "<> Showing window of instance " << m_instanceIdToShowWindowOf;
|
||||||
|
showInstanceWindow(inst);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!m_mainWindow)
|
if(!m_mainWindow)
|
||||||
{
|
{
|
||||||
// normal main window
|
// normal main window
|
||||||
|
@ -301,6 +301,7 @@ public:
|
|||||||
QString m_profileToUse;
|
QString m_profileToUse;
|
||||||
bool m_liveCheck = false;
|
bool m_liveCheck = false;
|
||||||
QUrl m_zipToImport;
|
QUrl m_zipToImport;
|
||||||
|
QString m_instanceIdToShowWindowOf;
|
||||||
std::unique_ptr<QFile> logFile;
|
std::unique_ptr<QFile> logFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user