forked from qt-creator/qt-creator
Qml(Lite)Designer: Separate SingleAppInstances
Qt Design Studio has the option -qml-lite-designer that starts it in a simplified mode, e.g. for opening individual files from Qt Creator. When such a "lite" QDS is already running, we can and want to reuse it with the "-client" option, but if a "normal" QDS is running we do not want that to open instead. So we need to separate the SingleApp IDs depending on the command line option. It is a bit ugly to hack the -qml-lite-designer into the global command line handling, and it would probably be nicer to add a separate, generic "-singleappid <id>" command line option that could be used by Qt Creator when starting QDS. But that would require to wait for that new command line option to roll out with QDS before we can use it in QtC. This can still be added and switched to later when we assume that most QDS installations have it. Task-number: QTCREATORBUG-31005 Change-Id: Iad1d4ff7bf7ec7aa40cb2eae055ab8847a2e6730 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -86,6 +86,7 @@ const char SETTINGS_OPTION[] = "-settingspath";
|
|||||||
const char INSTALL_SETTINGS_OPTION[] = "-installsettingspath";
|
const char INSTALL_SETTINGS_OPTION[] = "-installsettingspath";
|
||||||
const char TEST_OPTION[] = "-test";
|
const char TEST_OPTION[] = "-test";
|
||||||
const char STYLE_OPTION[] = "-style";
|
const char STYLE_OPTION[] = "-style";
|
||||||
|
const char QML_LITE_DESIGNER_OPTION[] = "-qml-lite-designer";
|
||||||
const char TEMPORARY_CLEAN_SETTINGS1[] = "-temporarycleansettings";
|
const char TEMPORARY_CLEAN_SETTINGS1[] = "-temporarycleansettings";
|
||||||
const char TEMPORARY_CLEAN_SETTINGS2[] = "-tcs";
|
const char TEMPORARY_CLEAN_SETTINGS2[] = "-tcs";
|
||||||
const char PID_OPTION[] = "-pid";
|
const char PID_OPTION[] = "-pid";
|
||||||
@@ -325,6 +326,7 @@ struct Options
|
|||||||
QString installSettingsPath;
|
QString installSettingsPath;
|
||||||
QStringList customPluginPaths;
|
QStringList customPluginPaths;
|
||||||
QString uiLanguage;
|
QString uiLanguage;
|
||||||
|
QString singleAppIdPostfix;
|
||||||
// list of arguments that were handled and not passed to the application or plugin manager
|
// list of arguments that were handled and not passed to the application or plugin manager
|
||||||
QStringList preAppArguments;
|
QStringList preAppArguments;
|
||||||
// list of arguments to be passed to the application or plugin manager
|
// list of arguments to be passed to the application or plugin manager
|
||||||
@@ -373,6 +375,8 @@ Options parseCommandLine(int argc, char *argv[])
|
|||||||
options.hasStyleOption = true;
|
options.hasStyleOption = true;
|
||||||
if (arg == TEST_OPTION)
|
if (arg == TEST_OPTION)
|
||||||
options.hasTestOption = true;
|
options.hasTestOption = true;
|
||||||
|
if (arg == QML_LITE_DESIGNER_OPTION)
|
||||||
|
options.singleAppIdPostfix = QML_LITE_DESIGNER_OPTION;
|
||||||
options.appArguments.push_back(*it);
|
options.appArguments.push_back(*it);
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
@@ -701,9 +705,10 @@ int main(int argc, char **argv)
|
|||||||
// create a custom Qt message handler that shows messages in a bare bones UI
|
// create a custom Qt message handler that shows messages in a bare bones UI
|
||||||
// if creation of the QGuiApplication fails.
|
// if creation of the QGuiApplication fails.
|
||||||
auto handler = std::make_unique<ShowInGuiHandler>();
|
auto handler = std::make_unique<ShowInGuiHandler>();
|
||||||
std::unique_ptr<SharedTools::QtSingleApplication>
|
const QString singleAppId = QString(Core::Constants::IDE_DISPLAY_NAME)
|
||||||
appPtr(SharedTools::createApplication(QLatin1String(Core::Constants::IDE_DISPLAY_NAME),
|
+ options.singleAppIdPostfix;
|
||||||
numberOfArguments, options.appArguments.data()));
|
std::unique_ptr<SharedTools::QtSingleApplication> appPtr(
|
||||||
|
SharedTools::createApplication(singleAppId, numberOfArguments, options.appArguments.data()));
|
||||||
handler.reset();
|
handler.reset();
|
||||||
SharedTools::QtSingleApplication &app = *appPtr;
|
SharedTools::QtSingleApplication &app = *appPtr;
|
||||||
QCoreApplication::setApplicationName(Core::Constants::IDE_CASED_ID);
|
QCoreApplication::setApplicationName(Core::Constants::IDE_CASED_ID);
|
||||||
|
Reference in New Issue
Block a user