diff options
-rw-r--r-- | src/plugins/studiowelcome/studiowelcomeplugin.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 677113221df..62af8cb96a4 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -4,6 +4,7 @@ #include "studiowelcomeplugin.h" #include "examplecheckout.h" +#include "projectexplorer/target.h" #include "qdsnewdialog.h" #include <app/app_version.h> @@ -97,6 +98,20 @@ QPointer<QQuickView> s_viewWindow = nullptr; QPointer<QQuickWidget> s_viewWidget = nullptr; static StudioWelcomePlugin *s_pluginInstance = nullptr; +static Utils::FilePath getMainUiFile() +{ + auto project = ProjectExplorer::SessionManager::startupProject(); + if (!project) + return {}; + + if (!project->activeTarget()) + return {}; + + auto qmlBuildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>( + project->activeTarget()->buildSystem()); + return qmlBuildSystem->mainUiFilePath(); +} + std::unique_ptr<QSettings> makeUserFeedbackSettings() { QStringList domain = QCoreApplication::organizationDomain().split(QLatin1Char('.')); @@ -224,8 +239,15 @@ public: m_blockOpenRecent = true; const FilePath projectFile = FilePath::fromVariant(data(index(row, 0), ProjectModel::FilePathRole)); - if (projectFile.exists()) - ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile); + if (projectFile.exists()) { + const ProjectExplorerPlugin::OpenProjectResult result + = ProjectExplorer::ProjectExplorerPlugin::openProject(projectFile); + if (!result && !result.alreadyOpen().isEmpty()) { + const auto mainUiFile = getMainUiFile(); + if (mainUiFile.exists()) + Core::EditorManager::openEditor(mainUiFile, Utils::Id()); + }; + } resetProjects(); } |