CppEditor: Add action to open a preprocessor dialog

Change-Id: I5ed09f6b8a358652145012e137ab717729999aca
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
David Schulz
2013-10-17 14:52:16 +02:00
parent ffe50efa00
commit 34ef3f244e
4 changed files with 17 additions and 2 deletions

View File

@@ -210,6 +210,13 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
QAction *openPreprocessorDialog = new QAction(tr("Additional Preprocessor Directives"), this);
cmd = ActionManager::registerAction(openPreprocessorDialog,
Constants::OPEN_PREPROCESSOR_DIALOG, context);
cmd->setDefaultKeySequence(QKeySequence());
connect(openPreprocessorDialog, SIGNAL(triggered()), this, SLOT(showPreProcessorDialog()));
cppToolsMenu->addAction(cmd);
QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Function Declaration/Definition"), this);
cmd = ActionManager::registerAction(switchDeclarationDefinition,
Constants::SWITCH_DECLARATION_DEFINITION, context, true);
@@ -354,6 +361,13 @@ void CppEditorPlugin::findUsages()
editor->findUsages();
}
void CppEditorPlugin::showPreProcessorDialog()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->showPreProcessorWidget();
}
void CppEditorPlugin::onTaskStarted(Core::Id type)
{
if (type == CppTools::Constants::TASK_INDEX) {