Commit 5b1cebc9 authored by dt's avatar dt
Browse files

Ensure always having a mode

Switch to Edit Mode once we constructed it in Core::init(). Switch to a
the Welcome Mode in Core::extensionsInitialized. Also works
parent bde1ebaa
......@@ -84,6 +84,7 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
if (success) {
EditorManager *editorManager = m_mainWindow->editorManager();
m_editMode = new EditMode(editorManager);
m_mainWindow->modeManager()->activateMode(m_editMode->id());
addObject(m_editMode);
m_designMode = new DesignMode(editorManager);
......@@ -95,6 +96,7 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
void CorePlugin::extensionsInitialized()
{
m_mainWindow->extensionsInitialized();
m_mainWindow->modeManager()->switchToDefaultMode();
}
void CorePlugin::remoteCommand(const QStringList & /* options */, const QStringList &args)
......
......@@ -309,6 +309,11 @@ void ModeManager::setFocusToCurrentMode()
}
}
void ModeManager::switchToDefaultMode()
{
d->m_modeStack->setCurrentIndex(0);
}
ModeManager *ModeManager::instance()
{
return ModeManagerPrivate::m_instance;
......
......@@ -66,6 +66,8 @@ public:
void addProjectSelector(QAction *action);
void addWidget(QWidget *widget);
void switchToDefaultMode();
signals:
void currentModeAboutToChange(Core::IMode *mode);
......
......@@ -76,7 +76,6 @@ bool WelcomePlugin::initialize(const QStringList & /* arguments */, QString * /*
void WelcomePlugin::extensionsInitialized()
{
m_welcomeMode->initPlugins();
Core::ModeManager::instance()->activateMode(m_welcomeMode->id());
}
Q_EXPORT_PLUGIN(WelcomePlugin)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment