forked from qt-creator/qt-creator
QmlDesigner: Add setting for new states editor
This makes it easy to enable/disable the new states editor. [QML} Designer\OldStatesEditor=false Change-Id: Ib3545bf0be8547af06eb0e9dda0cee2a143659b1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
@@ -80,10 +80,10 @@ WidgetInfo StatesEditorView::widgetInfo()
|
||||
m_statesEditorWidget = new StatesEditorWidget(this, m_statesEditorModel.data());
|
||||
|
||||
return createWidgetInfo(m_statesEditorWidget.data(),
|
||||
QLatin1String("StatesEditorNew"),
|
||||
"StatesEditor",
|
||||
WidgetInfo::BottomPane,
|
||||
0,
|
||||
tr("States New"));
|
||||
tr("States"));
|
||||
}
|
||||
|
||||
void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
|
||||
|
@@ -58,6 +58,14 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static bool useOldStatesEditor()
|
||||
{
|
||||
return QmlDesignerPlugin::instance()
|
||||
->settings()
|
||||
.value(DesignerSettingsKey::OLD_STATES_EDITOR)
|
||||
.toBool();
|
||||
}
|
||||
|
||||
static Q_LOGGING_CATEGORY(viewBenchmark, "qtc.viewmanager.attach", QtWarningMsg)
|
||||
|
||||
class ViewManagerData
|
||||
@@ -166,26 +174,30 @@ void ViewManager::detachRewriterView()
|
||||
|
||||
void ViewManager::switchStateEditorViewToBaseState()
|
||||
{
|
||||
if (useOldStatesEditor()) {
|
||||
if (d->statesEditorView.isAttached()) {
|
||||
d->savedState = d->statesEditorView.currentState();
|
||||
d->statesEditorView.setCurrentState(d->statesEditorView.baseState());
|
||||
}
|
||||
|
||||
// TODO Settings branch
|
||||
} else {
|
||||
// TODO remove old statesview
|
||||
if (d->newStatesEditorView.isAttached()) {
|
||||
d->savedState = d->newStatesEditorView.currentState();
|
||||
d->newStatesEditorView.setCurrentState(d->newStatesEditorView.baseState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewManager::switchStateEditorViewToSavedState()
|
||||
{
|
||||
if (useOldStatesEditor()) {
|
||||
if (d->savedState.isValid() && d->statesEditorView.isAttached())
|
||||
d->statesEditorView.setCurrentState(d->savedState);
|
||||
|
||||
// TODO Settings branch
|
||||
} else {
|
||||
// TODO remove old statesview
|
||||
if (d->savedState.isValid() && d->newStatesEditorView.isAttached())
|
||||
d->newStatesEditorView.setCurrentState(d->savedState);
|
||||
}
|
||||
}
|
||||
|
||||
QList<AbstractView *> ViewManager::views() const
|
||||
@@ -211,8 +223,15 @@ QList<AbstractView *> ViewManager::standardViews() const
|
||||
&d->newStatesEditorView, // TODO
|
||||
&d->designerActionManagerView};
|
||||
|
||||
if (QmlDesignerPlugin::instance()->settings().value(
|
||||
DesignerSettingsKey::ENABLE_DEBUGVIEW).toBool())
|
||||
if (useOldStatesEditor())
|
||||
list.removeAll(&d->newStatesEditorView);
|
||||
else
|
||||
list.removeAll(&d->statesEditorView);
|
||||
|
||||
if (QmlDesignerPlugin::instance()
|
||||
->settings()
|
||||
.value(DesignerSettingsKey::ENABLE_DEBUGVIEW)
|
||||
.toBool())
|
||||
list.append(&d->debugView);
|
||||
|
||||
return list;
|
||||
@@ -343,8 +362,11 @@ QList<WidgetInfo> ViewManager::widgetInfos() const
|
||||
widgetInfoList.append(d->propertyEditorView.widgetInfo());
|
||||
widgetInfoList.append(d->materialEditorView.widgetInfo());
|
||||
widgetInfoList.append(d->materialBrowserView.widgetInfo());
|
||||
if (useOldStatesEditor())
|
||||
widgetInfoList.append(d->statesEditorView.widgetInfo());
|
||||
widgetInfoList.append(d->newStatesEditorView.widgetInfo()); // TODO
|
||||
else
|
||||
widgetInfoList.append(d->newStatesEditorView.widgetInfo());
|
||||
|
||||
if (d->debugView.hasWidget())
|
||||
widgetInfoList.append(d->debugView.widgetInfo());
|
||||
|
||||
|
@@ -85,6 +85,7 @@ void DesignerSettings::fromSettings(QSettings *settings)
|
||||
restoreValue(settings, DesignerSettingsKey::EDIT3DVIEW_GRID_COLOR, "#aaaaaa");
|
||||
restoreValue(settings, DesignerSettingsKey::SMOOTH_RENDERING, false);
|
||||
restoreValue(settings, DesignerSettingsKey::SHOW_DEBUG_SETTINGS, false);
|
||||
restoreValue(settings, DesignerSettingsKey::OLD_STATES_EDITOR, true);
|
||||
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
|
@@ -74,6 +74,7 @@ const char ALWAYS_DESIGN_MODE[] = "AlwaysDesignMode";
|
||||
const char DISABLE_ITEM_LIBRARY_UPDATE_TIMER[] = "DisableItemLibraryUpdateTimer";
|
||||
const char ASK_BEFORE_DELETING_ASSET[] = "AskBeforeDeletingAsset";
|
||||
const char SMOOTH_RENDERING[] = "SmoothRendering";
|
||||
const char OLD_STATES_EDITOR[] = "OldStatesEditor";
|
||||
}
|
||||
|
||||
class QMLDESIGNERCORE_EXPORT DesignerSettings : public QHash<QByteArray, QVariant>
|
||||
|
Reference in New Issue
Block a user