forked from qt-creator/qt-creator
Core: add ICore::isQtDesignStudio()
Change-Id: I3aed97b62abd05b283ac327be210af75f173383d Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -341,6 +341,12 @@ bool ICore::showWarningWithOptions(const QString &title, const QString &text,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ICore::isQtDesignStudio()
|
||||||
|
{
|
||||||
|
QtcSettings *settings = Core::ICore::settings();
|
||||||
|
return settings->value("QML/Designer/StandAloneMode", false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the application's main settings object.
|
Returns the application's main settings object.
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public:
|
|||||||
Utils::Id settingsId = {},
|
Utils::Id settingsId = {},
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
static bool isQtDesignStudio();
|
||||||
static Utils::QtcSettings *settings(QSettings::Scope scope = QSettings::UserScope);
|
static Utils::QtcSettings *settings(QSettings::Scope scope = QSettings::UserScope);
|
||||||
static SettingsDatabase *settingsDatabase();
|
static SettingsDatabase *settingsDatabase();
|
||||||
static QPrinter *printer();
|
static QPrinter *printer();
|
||||||
|
|||||||
@@ -114,13 +114,6 @@ McuSupportPlugin::~McuSupportPlugin()
|
|||||||
dd = nullptr;
|
dd = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isQtDesignStudio()
|
|
||||||
{
|
|
||||||
QSettings *settings = Core::ICore::settings();
|
|
||||||
const QString qdsStandaloneEntry = "QML/Designer/StandAloneMode";
|
|
||||||
return settings->value(qdsStandaloneEntry, false).toBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
void McuSupportPlugin::initialize()
|
void McuSupportPlugin::initialize()
|
||||||
{
|
{
|
||||||
setObjectName("McuSupportPlugin");
|
setObjectName("McuSupportPlugin");
|
||||||
@@ -133,7 +126,7 @@ void McuSupportPlugin::initialize()
|
|||||||
// Temporary fix for CodeModel/Checker race condition
|
// Temporary fix for CodeModel/Checker race condition
|
||||||
// Remove after https://bugreports.qt.io/browse/QTCREATORBUG-29269 is closed
|
// Remove after https://bugreports.qt.io/browse/QTCREATORBUG-29269 is closed
|
||||||
|
|
||||||
if (!isQtDesignStudio()) {
|
if (!Core::ICore::isQtDesignStudio()) {
|
||||||
connect(
|
connect(
|
||||||
QmlJS::ModelManagerInterface::instance(),
|
QmlJS::ModelManagerInterface::instance(),
|
||||||
&QmlJS::ModelManagerInterface::documentUpdated,
|
&QmlJS::ModelManagerInterface::documentUpdated,
|
||||||
|
|||||||
@@ -1908,9 +1908,7 @@ void DesignerActionManager::createDefaultDesignerActions()
|
|||||||
&addMouseAreaFillCheck,
|
&addMouseAreaFillCheck,
|
||||||
&singleSelection));
|
&singleSelection));
|
||||||
|
|
||||||
const bool standaloneMode = QmlProjectManager::QmlProject::isQtDesignStudio();
|
if (!Core::ICore::isQtDesignStudio()) {
|
||||||
|
|
||||||
if (!standaloneMode) {
|
|
||||||
addDesignerAction(new ModelNodeContextMenuAction(goToImplementationCommandId,
|
addDesignerAction(new ModelNodeContextMenuAction(goToImplementationCommandId,
|
||||||
goToImplementationDisplayName,
|
goToImplementationDisplayName,
|
||||||
{},
|
{},
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ DesignModeWidget::DesignModeWidget()
|
|||||||
, m_crumbleBar(new CrumbleBar(this))
|
, m_crumbleBar(new CrumbleBar(this))
|
||||||
{
|
{
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
if (Utils::StyleHelper::isQDSTheme() || QmlProjectManager::QmlProject::isQtDesignStudio())
|
if (Utils::StyleHelper::isQDSTheme() || Core::ICore::isQtDesignStudio())
|
||||||
qApp->setStyle(QmlDesignerBasePlugin::style());
|
qApp->setStyle(QmlDesignerBasePlugin::style());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
|||||||
return false;
|
return false;
|
||||||
d = new QmlDesignerPluginPrivate;
|
d = new QmlDesignerPluginPrivate;
|
||||||
d->timer.start();
|
d->timer.start();
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudio())
|
if (Core::ICore::isQtDesignStudio())
|
||||||
GenerateResource::generateMenuEntry(this);
|
GenerateResource::generateMenuEntry(this);
|
||||||
|
|
||||||
const QString fontPath
|
const QString fontPath
|
||||||
@@ -293,7 +293,7 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
|||||||
Core::AsynchronousMessageBox::warning(composedTitle, description.toString());
|
Core::AsynchronousMessageBox::warning(composedTitle, description.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudio()) {
|
if (Core::ICore::isQtDesignStudio()) {
|
||||||
d->toolBar = ToolBar::create();
|
d->toolBar = ToolBar::create();
|
||||||
d->statusBar = ToolBar::createStatusBar();
|
d->statusBar = ToolBar::createStatusBar();
|
||||||
}
|
}
|
||||||
@@ -328,7 +328,7 @@ void QmlDesignerPlugin::extensionsInitialized()
|
|||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag QmlDesignerPlugin::aboutToShutdown()
|
ExtensionSystem::IPlugin::ShutdownFlag QmlDesignerPlugin::aboutToShutdown()
|
||||||
{
|
{
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudio())
|
if (Core::ICore::isQtDesignStudio())
|
||||||
emitUsageStatistics("qdsShutdownCount");
|
emitUsageStatistics("qdsShutdownCount");
|
||||||
|
|
||||||
return SynchronousShutdown;
|
return SynchronousShutdown;
|
||||||
@@ -631,7 +631,7 @@ void QmlDesignerPlugin::enforceDelayedInitialize()
|
|||||||
d->viewManager.registerFormEditorTool(std::make_unique<PathTool>(d->externalDependencies));
|
d->viewManager.registerFormEditorTool(std::make_unique<PathTool>(d->externalDependencies));
|
||||||
d->viewManager.registerFormEditorTool(std::make_unique<TransitionTool>());
|
d->viewManager.registerFormEditorTool(std::make_unique<TransitionTool>());
|
||||||
|
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudio()) {
|
if (Core::ICore::isQtDesignStudio()) {
|
||||||
d->mainWidget.initialize();
|
d->mainWidget.initialize();
|
||||||
|
|
||||||
emitUsageStatistics("StandaloneMode");
|
emitUsageStatistics("StandaloneMode");
|
||||||
|
|||||||
@@ -473,16 +473,15 @@ void SettingsPageWidget::setSettings(const DesignerSettings &settings)
|
|||||||
m_askBeforeDeletingAssetCheckBox->setChecked(settings.value(
|
m_askBeforeDeletingAssetCheckBox->setChecked(settings.value(
|
||||||
DesignerSettingsKey::ASK_BEFORE_DELETING_ASSET).toBool());
|
DesignerSettingsKey::ASK_BEFORE_DELETING_ASSET).toBool());
|
||||||
|
|
||||||
const bool standaloneMode = QmlProjectManager::QmlProject::isQtDesignStudio();
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
const auto showDebugSettings = true;
|
const auto showDebugSettings = true;
|
||||||
#else
|
#else
|
||||||
const auto showDebugSettings = settings.value(DesignerSettingsKey::SHOW_DEBUG_SETTINGS).toBool();
|
const auto showDebugSettings = settings.value(DesignerSettingsKey::SHOW_DEBUG_SETTINGS).toBool();
|
||||||
#endif
|
#endif
|
||||||
const bool showAdvancedFeatures = !standaloneMode || showDebugSettings;
|
const bool showAdvancedFeatures = !Core::ICore::isQtDesignStudio() || showDebugSettings;
|
||||||
m_emulationGroupBox->setVisible(showAdvancedFeatures);
|
m_emulationGroupBox->setVisible(showAdvancedFeatures);
|
||||||
m_debugGroupBox->setVisible(showAdvancedFeatures);
|
m_debugGroupBox->setVisible(showAdvancedFeatures);
|
||||||
m_featureTimelineEditorCheckBox->setVisible(standaloneMode);
|
m_featureTimelineEditorCheckBox->setVisible(Core::ICore::isQtDesignStudio());
|
||||||
m_smoothRendering->setChecked(settings.value(DesignerSettingsKey::SMOOTH_RENDERING).toBool());
|
m_smoothRendering->setChecked(settings.value(DesignerSettingsKey::SMOOTH_RENDERING).toBool());
|
||||||
|
|
||||||
m_alwaysAutoFormatUICheckBox->setChecked(
|
m_alwaysAutoFormatUICheckBox->setChecked(
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ QmlProject::QmlProject(const Utils::FilePath &fileName)
|
|||||||
setNeedsBuildConfigurations(false);
|
setNeedsBuildConfigurations(false);
|
||||||
setBuildSystemCreator([](Target *t) { return new QmlBuildSystem(t); });
|
setBuildSystemCreator([](Target *t) { return new QmlBuildSystem(t); });
|
||||||
|
|
||||||
if (QmlProject::isQtDesignStudio()) {
|
if (Core::ICore::isQtDesignStudio()) {
|
||||||
if (allowOnlySingleProject()) {
|
if (allowOnlySingleProject()) {
|
||||||
EditorManager::closeAllDocuments();
|
EditorManager::closeAllDocuments();
|
||||||
ProjectManager::closeAllProjects();
|
ProjectManager::closeAllProjects();
|
||||||
@@ -111,7 +111,7 @@ Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *erro
|
|||||||
|
|
||||||
// FIXME: are there any other way?
|
// FIXME: are there any other way?
|
||||||
// What if it's not a Design Studio project? What should we do then?
|
// What if it's not a Design Studio project? What should we do then?
|
||||||
if (QmlProject::isQtDesignStudio()) {
|
if (Core::ICore::isQtDesignStudio()) {
|
||||||
int preferedVersion = preferedQtTarget(activeTarget());
|
int preferedVersion = preferedQtTarget(activeTarget());
|
||||||
|
|
||||||
setKitWithVersion(preferedVersion, kits);
|
setKitWithVersion(preferedVersion, kits);
|
||||||
@@ -205,13 +205,6 @@ Tasks QmlProject::projectIssues(const Kit *k) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProject::isQtDesignStudio()
|
|
||||||
{
|
|
||||||
QSettings *settings = Core::ICore::settings();
|
|
||||||
const QString qdsStandaloneEntry = "QML/Designer/StandAloneMode";
|
|
||||||
return settings->value(qdsStandaloneEntry, false).toBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmlProject::isQtDesignStudioStartedFromQtC()
|
bool QmlProject::isQtDesignStudioStartedFromQtC()
|
||||||
{
|
{
|
||||||
return qEnvironmentVariableIsSet(Constants::enviromentLaunchedQDS);
|
return qEnvironmentVariableIsSet(Constants::enviromentLaunchedQDS);
|
||||||
@@ -224,7 +217,7 @@ DeploymentKnowledge QmlProject::deploymentKnowledge() const
|
|||||||
|
|
||||||
bool QmlProject::isEditModePreferred() const
|
bool QmlProject::isEditModePreferred() const
|
||||||
{
|
{
|
||||||
return !isQtDesignStudio();
|
return !Core::ICore::isQtDesignStudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
int QmlProject::preferedQtTarget(Target *target)
|
int QmlProject::preferedQtTarget(Target *target)
|
||||||
@@ -238,7 +231,7 @@ int QmlProject::preferedQtTarget(Target *target)
|
|||||||
|
|
||||||
bool QmlProject::allowOnlySingleProject()
|
bool QmlProject::allowOnlySingleProject()
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::settings();
|
auto settings = Core::ICore::settings();
|
||||||
auto key = "QML/Designer/AllowMultipleProjects";
|
auto key = "QML/Designer/AllowMultipleProjects";
|
||||||
return !settings->value(QString::fromUtf8(key), false).toBool();
|
return !settings->value(QString::fromUtf8(key), false).toBool();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ class QMLPROJECTMANAGER_EXPORT QmlProject : public ProjectExplorer::Project
|
|||||||
public:
|
public:
|
||||||
explicit QmlProject(const Utils::FilePath &filename);
|
explicit QmlProject(const Utils::FilePath &filename);
|
||||||
|
|
||||||
static bool isQtDesignStudio();
|
|
||||||
static bool isQtDesignStudioStartedFromQtC();
|
static bool isQtDesignStudioStartedFromQtC();
|
||||||
bool isEditModePreferred() const override;
|
bool isEditModePreferred() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ void QmlProjectPlugin::initialize()
|
|||||||
Utils::FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png",
|
Utils::FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png",
|
||||||
"qmlproject");
|
"qmlproject");
|
||||||
|
|
||||||
if (QmlProject::isQtDesignStudio()) {
|
if (Core::ICore::isQtDesignStudio()) {
|
||||||
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
|
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
|
||||||
ProjectExplorer::Constants::M_FILECONTEXT);
|
ProjectExplorer::Constants::M_FILECONTEXT);
|
||||||
QAction *mainfileAction = new QAction(Tr::tr("Set as Main .qml File"), this);
|
QAction *mainfileAction = new QAction(Tr::tr("Set as Main .qml File"), this);
|
||||||
@@ -353,7 +353,7 @@ void QmlProjectPlugin::initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GenerateCmake::generateMenuEntry(this);
|
GenerateCmake::generateMenuEntry(this);
|
||||||
if (QmlProject::isQtDesignStudio())
|
if (Core::ICore::isQtDesignStudio())
|
||||||
GenerateCmake::CmakeProjectConverter::generateMenuEntry(this);
|
GenerateCmake::CmakeProjectConverter::generateMenuEntry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
|
|||||||
|
|
||||||
void QmlProjectRunConfiguration::createQtVersionAspect()
|
void QmlProjectRunConfiguration::createQtVersionAspect()
|
||||||
{
|
{
|
||||||
if (!QmlProject::isQtDesignStudio())
|
if (!Core::ICore::isQtDesignStudio())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_qtversionAspect = addAspect<SelectionAspect>();
|
m_qtversionAspect = addAspect<SelectionAspect>();
|
||||||
|
|||||||
@@ -548,7 +548,7 @@ void StudioWelcomePlugin::extensionsInitialized()
|
|||||||
Core::ModeManager::activateMode(m_welcomeMode->id());
|
Core::ModeManager::activateMode(m_welcomeMode->id());
|
||||||
|
|
||||||
// Enable QDS new project dialog and QDS wizards
|
// Enable QDS new project dialog and QDS wizards
|
||||||
if (QmlProjectManager::QmlProject::isQtDesignStudio()) {
|
if (Core::ICore::isQtDesignStudio()) {
|
||||||
ProjectExplorer::JsonWizardFactory::clearWizardPaths();
|
ProjectExplorer::JsonWizardFactory::clearWizardPaths();
|
||||||
ProjectExplorer::JsonWizardFactory::addWizardPath(
|
ProjectExplorer::JsonWizardFactory::addWizardPath(
|
||||||
Core::ICore::resourcePath("qmldesigner/studio_templates"));
|
Core::ICore::resourcePath("qmldesigner/studio_templates"));
|
||||||
|
|||||||
Reference in New Issue
Block a user