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