forked from qt-creator/qt-creator
Enable -pid for qtcreator -client on Windows
Change-Id: Ib22674f77f68acc400966fc681953a384032f195 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
b2a39399e9
commit
be5c614b48
@@ -71,11 +71,8 @@ static const char fixedOptionsC[] =
|
|||||||
" -version Display program version\n"
|
" -version Display program version\n"
|
||||||
" -client Attempt to connect to already running first instance\n"
|
" -client Attempt to connect to already running first instance\n"
|
||||||
" -settingspath <path> Override the default path where user settings are stored\n"
|
" -settingspath <path> Override the default path where user settings are stored\n"
|
||||||
#if !defined(Q_OS_WIN)
|
|
||||||
" -pid <pid> Attempt to connect to instance given by pid\n";
|
" -pid <pid> Attempt to connect to instance given by pid\n";
|
||||||
#else
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char HELP_OPTION1[] = "-h";
|
static const char HELP_OPTION1[] = "-h";
|
||||||
static const char HELP_OPTION2[] = "-help";
|
static const char HELP_OPTION2[] = "-help";
|
||||||
@@ -84,9 +81,7 @@ static const char HELP_OPTION4[] = "--help";
|
|||||||
static const char VERSION_OPTION[] = "-version";
|
static const char VERSION_OPTION[] = "-version";
|
||||||
static const char CLIENT_OPTION[] = "-client";
|
static const char CLIENT_OPTION[] = "-client";
|
||||||
static const char SETTINGS_OPTION[] = "-settingspath";
|
static const char SETTINGS_OPTION[] = "-settingspath";
|
||||||
#if !defined(Q_OS_WIN)
|
|
||||||
static const char PID_OPTION[] = "-pid";
|
static const char PID_OPTION[] = "-pid";
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef QList<PluginSpec *> PluginSpecSet;
|
typedef QList<PluginSpec *> PluginSpecSet;
|
||||||
|
|
||||||
@@ -413,9 +408,7 @@ int main(int argc, char **argv)
|
|||||||
appOptions.insert(QLatin1String(HELP_OPTION4), false);
|
appOptions.insert(QLatin1String(HELP_OPTION4), false);
|
||||||
appOptions.insert(QLatin1String(VERSION_OPTION), false);
|
appOptions.insert(QLatin1String(VERSION_OPTION), false);
|
||||||
appOptions.insert(QLatin1String(CLIENT_OPTION), false);
|
appOptions.insert(QLatin1String(CLIENT_OPTION), false);
|
||||||
#if !defined(Q_OS_WIN)
|
|
||||||
appOptions.insert(QLatin1String(PID_OPTION), true);
|
appOptions.insert(QLatin1String(PID_OPTION), true);
|
||||||
#endif
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
if (!PluginManager::parseOptions(arguments, appOptions, &foundAppOptions, &errorMessage)) {
|
if (!PluginManager::parseOptions(arguments, appOptions, &foundAppOptions, &errorMessage)) {
|
||||||
displayError(errorMessage);
|
displayError(errorMessage);
|
||||||
@@ -455,7 +448,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
qint64 pid = -1;
|
qint64 pid = -1;
|
||||||
#if !defined(Q_OS_WIN)
|
|
||||||
if (foundAppOptions.contains(QLatin1String(PID_OPTION))) {
|
if (foundAppOptions.contains(QLatin1String(PID_OPTION))) {
|
||||||
QString pidString = foundAppOptions.value(QLatin1String(PID_OPTION));
|
QString pidString = foundAppOptions.value(QLatin1String(PID_OPTION));
|
||||||
bool pidOk;
|
bool pidOk;
|
||||||
@@ -463,7 +455,6 @@ int main(int argc, char **argv)
|
|||||||
if (pidOk)
|
if (pidOk)
|
||||||
pid = tmpPid;
|
pid = tmpPid;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (app.isRunning() && (pid != -1 || foundAppOptions.contains(QLatin1String(CLIENT_OPTION)))) {
|
if (app.isRunning() && (pid != -1 || foundAppOptions.contains(QLatin1String(CLIENT_OPTION)))) {
|
||||||
if (app.sendMessage(PluginManager::serializedArguments(), 5000 /*timeout*/, pid))
|
if (app.sendMessage(PluginManager::serializedArguments(), 5000 /*timeout*/, pid))
|
||||||
|
|||||||
Reference in New Issue
Block a user