forked from qt-creator/qt-creator
StudioWelcome: Open design mode if project is opened again
If an already opened project is opened again we swtich to design mode instead of edit mode and showing an error message. Task-number: QDS-9183 Change-Id: I291e32a9824103a8f14f4fd618cc9211408ff2da Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "studiowelcomeplugin.h"
|
#include "studiowelcomeplugin.h"
|
||||||
#include "examplecheckout.h"
|
#include "examplecheckout.h"
|
||||||
|
|
||||||
|
#include "projectexplorer/target.h"
|
||||||
#include "qdsnewdialog.h"
|
#include "qdsnewdialog.h"
|
||||||
|
|
||||||
#include <app/app_version.h>
|
#include <app/app_version.h>
|
||||||
@@ -97,6 +98,20 @@ QPointer<QQuickView> s_viewWindow = nullptr;
|
|||||||
QPointer<QQuickWidget> s_viewWidget = nullptr;
|
QPointer<QQuickWidget> s_viewWidget = nullptr;
|
||||||
static StudioWelcomePlugin *s_pluginInstance = 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()
|
std::unique_ptr<QSettings> makeUserFeedbackSettings()
|
||||||
{
|
{
|
||||||
QStringList domain = QCoreApplication::organizationDomain().split(QLatin1Char('.'));
|
QStringList domain = QCoreApplication::organizationDomain().split(QLatin1Char('.'));
|
||||||
@@ -224,8 +239,15 @@ public:
|
|||||||
|
|
||||||
m_blockOpenRecent = true;
|
m_blockOpenRecent = true;
|
||||||
const FilePath projectFile = FilePath::fromVariant(data(index(row, 0), ProjectModel::FilePathRole));
|
const FilePath projectFile = FilePath::fromVariant(data(index(row, 0), ProjectModel::FilePathRole));
|
||||||
if (projectFile.exists())
|
if (projectFile.exists()) {
|
||||||
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile);
|
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();
|
resetProjects();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user