Skip to content
Snippets Groups Projects
Commit 57ee6f07 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

F4 functionality for bauhaus

parent 46795bff
No related branches found
No related tags found
No related merge requests found
......@@ -75,11 +75,12 @@ void SiblingComboBox::setup()
clear();
foreach (const QmlItemNode &itemNode, m_itemList) {
if (itemNode.isValid())
if (itemNode.isValid()) {
if (itemNode.id().isEmpty())
addItem(itemNode.simplfiedTypeName());
else
addItem(itemNode.id());
}
}
QmlItemNode parent(m_itemNode.instanceParent().toQmlItemNode());
......
......@@ -35,18 +35,21 @@
namespace QmlDesigner {
namespace Constants {
const char * const DELETE = "QmlDesigner.Delete";
const char * const DELETE = "QmlDesigner.Delete";
// context
const char * const C_DESIGN_MODE = "QmlDesigner::DesignMode";
const char * const C_FORMEDITOR = "QmlDesigner::FormEditor";
const char * const C_DESIGN_MODE = "QmlDesigner::DesignMode";
const char * const C_FORMEDITOR = "QmlDesigner::FormEditor";
// actions
const char * const SWITCH_TEXT_DESIGN = "QmlDesigner.SwitchTextDesign";
// mode
const char * const DESIGN_MODE_NAME = "Design";
const int DESIGN_MODE_PRIORITY = Core::Constants::P_MODE_EDIT - 1;
const char * const DESIGN_MODE_NAME = "Design";
const int DESIGN_MODE_PRIORITY = Core::Constants::P_MODE_EDIT - 1;
// Wizard type
const char * const FORM_MIMETYPE = "application/x-qmldesigner";
const char * const FORM_MIMETYPE = "application/x-qmldesigner";
namespace Internal {
enum { debug = 0 };
......
......@@ -34,6 +34,11 @@
#include "pluginmanager.h"
#include "settingspage.h"
#include <qmljseditor/qmljseditorconstants.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/iwizard.h>
#include <coreplugin/editormanager/ieditorfactory.h>
......@@ -86,6 +91,17 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(QmlDesigner::Constants::C_FORMEDITOR));
const QList<int> context = QList<int>() << uid;
const QList<int> switchContext = QList<int() << uid
<< core->uniqueIDManager()->uniqueIdentifier(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
Core::ActionManager *am = core->actionManager();
QAction *switchAction = new QAction(tr("Switch Text/Design"), this);
Core::Command *command = am->registerAction(switchAction, QmlDesigner::Constants::SWITCH_TEXT_DESIGN, switchContext);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
connect(switchAction, SIGNAL(triggered()), this, SLOT(switchTextDesign()));
m_designerCore = new QmlDesigner::IntegrationCore;
m_pluginInstance = this;
......@@ -116,6 +132,24 @@ BauhausPlugin *BauhausPlugin::pluginInstance()
return m_pluginInstance;
}
void BauhausPlugin::switchTextDesign()
{
Core::ModeManager *modeManager = Core::ModeManager::instance();
if (modeManager->currentMode() == Core::Constants::MODE_EDIT) {
} else if (modeManager->currentMode() == Core::Constants::MODE_DESIGN) {
}
Core::IEditor *editor = editorManager->currentEditor();
QString otherFile = correspondingHeaderOrSource(editor->file()->fileName());
if (!otherFile.isEmpty()) {
editorManager->openEditor(otherFile);
editorManager->ensureEditorManagerVisible();
}
}
DesignerSettings BauhausPlugin::settings() const
{
return m_settings;
......
......@@ -65,6 +65,9 @@ public:
DesignerSettings settings() const;
void setSettings(const DesignerSettings &s);
private slots:
void switchTextDesign();
private:
QmlDesigner::IntegrationCore *m_designerCore;
static BauhausPlugin *m_pluginInstance;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment