Commit a24738ff authored by con's avatar con

Fixes: Diff editors don't get correct name.

They were no longer showing e.g. the file name of the diffed file.
Also separate editor id and editor context a bit.
parent 033a094a
......@@ -33,7 +33,7 @@
namespace BINEditor {
namespace Constants {
const char * const C_BINEDITOR_ID = "BinEditor.BinaryEditor";
const char * const C_BINEDITOR = "BinEditor.BinaryEditor";
const char * const C_BINEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "Binary Editor");
const char * const C_BINEDITOR_MIMETYPE = "application/octet-stream";
......
......@@ -304,7 +304,7 @@ public:
m_editor = parent;
m_file = new BinEditorFile(parent);
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR_ID);
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
m_cursorPositionLabel = new Utils::LineColumnLabel;
QHBoxLayout *l = new QHBoxLayout;
......@@ -443,7 +443,7 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
editor->setEditorInterface(editorInterface);
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR_ID);
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
if (!m_undoAction) {
m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO),
this, SLOT(undoAction()),
......
......@@ -53,7 +53,7 @@ using namespace Core;
{
[...]
addObject(new Core::BaseMode("mymode",
"MyPlugin.Id",
"MyPlugin.ModeId",
icon,
50, // priority
new MyWidget));
......
......@@ -1205,7 +1205,7 @@ IEditor *EditorManager::openEditorWithContents(const QString &editorId,
QString title = edt->displayName();
if (title.isEmpty() && titlePattern) {
if (titlePattern) {
const QChar dollar = QLatin1Char('$');
const QChar dot = QLatin1Char('.');
......
......@@ -594,11 +594,9 @@ CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
: BaseTextEditorEditable(editor)
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
m_context << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
m_context << uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
setDisplayName(tr(CppEditor::Constants::CPPEDITOR_DISPLAY_NAME));
}
CPPEditor::CPPEditor(QWidget *parent)
......
......@@ -35,6 +35,7 @@ namespace Constants {
const char * const FORMATCODE = "CppEditor.FormatCode";
const char * const M_CONTEXT = "CppEditor.ContextMenu";
const char * const C_CPPEDITOR = "CppPlugin.C++Editor";
const char * const CPPEDITOR_ID = "CppPlugin.C++Editor";
const char * const CPPEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor");
const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationDefinition";
......
......@@ -227,7 +227,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
QList<int> context;
context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
Core::ActionManager *am = core->actionManager();
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
......@@ -278,7 +278,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
cppToolsMenu->addAction(cmd);
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::CPPEDITOR_ID,
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
......
......@@ -128,7 +128,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
mtools->addMenu(mcpptools);
// Actions
m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
QList<int> context = QList<int>() << m_context;
QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
......
......@@ -42,7 +42,6 @@ CVSSubmitEditor::CVSSubmitEditor(const VCSBase::VCSBaseSubmitEditorParameters *p
m_msgRemoved(tr("Removed")),
m_msgModified(tr("Modified"))
{
setDisplayName(tr("CVS Submit"));
}
QString CVSSubmitEditor::stateName(State st) const
......
......@@ -678,7 +678,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
debuggercontext << uidm->uniqueIdentifier(C_GDBDEBUGGER);
QList<int> cppeditorcontext;
cppeditorcontext << uidm->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
cppeditorcontext << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
QList<int> texteditorcontext;
texteditorcontext << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
......
......@@ -96,7 +96,7 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
// UI
Core::GeneratedFile uiFile(formFileName);
uiFile.setContents(params.uiTemplate());
uiFile.setEditorId(QLatin1String(Constants::C_FORMEDITOR_ID));
uiFile.setEditorId(QLatin1String(Constants::FORMEDITOR_ID));
QString source, header;
Designer::FormClassWizardGenerationParameters generationParameters;
......
......@@ -41,7 +41,8 @@ const char * const SETTINGS_CPP_SETTINGS_ID = "Class Generation";
const char * const SETTINGS_CPP_SETTINGS_NAME = QT_TRANSLATE_NOOP("Designer", "Class Generation");
// context
const char * const C_FORMEDITOR_ID = "FormEditor";
const char * const C_FORMEDITOR = "FormEditor.FormEditor";
const char * const FORMEDITOR_ID = "FormEditor";
const char * const C_FORMEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("Designer", "Form Editor");
const char * const T_FORMEDITOR = "FormEditor.Toolbar";
const char * const M_FORMEDITOR = "FormEditor.Menu";
......
......@@ -53,7 +53,7 @@ FormEditorFactory::FormEditorFactory()
QString FormEditorFactory::id() const
{
return QLatin1String(C_FORMEDITOR_ID);
return QLatin1String(FORMEDITOR_ID);
}
QString FormEditorFactory::displayName() const
......
......@@ -86,7 +86,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
initializeTemplates();
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR_ID));
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
const QList<int> context = QList<int>() << uid;
addAutoReleasedObject(new FormEditorFactory);
......
......@@ -217,7 +217,7 @@ FormEditorW::FormEditorW() :
m_fwm = qobject_cast<qdesigner_internal::QDesignerFormWindowManager*>(m_formeditor->formWindowManager());
QTC_ASSERT(m_fwm, return);
const int uid = m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR_ID));
const int uid = m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
m_context << uid;
setupActions();
......@@ -705,7 +705,7 @@ void FormEditorW::currentEditorChanged(Core::IEditor *editor)
qDebug() << Q_FUNC_INFO << editor << " of " << m_fwm->formWindowCount();
// Deactivate Designer if a non-form is being edited
if (editor && editor->id() == QLatin1String(Constants::C_FORMEDITOR_ID)) {
if (editor && editor->id() == QLatin1String(Constants::FORMEDITOR_ID)) {
FormWindowEditor *fw = qobject_cast<FormWindowEditor *>(editor);
QTC_ASSERT(fw, return);
fw->activate();
......
......@@ -265,7 +265,7 @@ Core::IFile *FormWindowEditor::file()
QString FormWindowEditor::id() const
{
return QLatin1String(C_FORMEDITOR_ID);
return QLatin1String(FORMEDITOR_ID);
}
QString FormWindowEditor::displayName() const
......
......@@ -66,6 +66,6 @@ Core::GeneratedFiles FormWizard::generateFiles(const QWizard *w,
Core::GeneratedFile file(fileName);
file.setContents(formTemplate);
file.setEditorId(QLatin1String(Constants::C_FORMEDITOR_ID));
file.setEditorId(QLatin1String(Constants::FORMEDITOR_ID));
return Core::GeneratedFiles() << file;
}
......@@ -280,8 +280,6 @@ QmlEditorEditable::QmlEditorEditable(QmlTextEditor *editor)
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(QmlEditor::Constants::C_QMLEDITOR_ID);
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
setDisplayName(tr(QmlEditor::Constants::C_QMLEDITOR_DISPLAY_NAME));
}
QmlTextEditor::QmlTextEditor(QWidget *parent) :
......
......@@ -104,8 +104,6 @@ ProjectFilesEditable::ProjectFilesEditable(ProjectFilesEditor *editor)
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(Constants::C_FILESEDITOR);
setDisplayName(tr(Constants::FILES_EDITOR_DISPLAY_NAME));
}
ProjectFilesEditable::~ProjectFilesEditable()
......
......@@ -33,7 +33,8 @@
namespace ResourceEditor {
namespace Constants {
const char * const C_RESOURCEEDITOR_ID = "Qt4.ResourceEditor";
const char * const C_RESOURCEEDITOR = "Qt4.ResourceEditor";
const char * const RESOURCEEDITOR_ID = "Qt4.ResourceEditor";
const char * const C_RESOURCEEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "Resource Editor");
const char * const C_RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource";
......
......@@ -48,7 +48,7 @@ ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
m_plugin(plugin)
{
m_context += Core::UniqueIDManager::instance()
->uniqueIdentifier(QLatin1String(ResourceEditor::Constants::C_RESOURCEEDITOR_ID));
->uniqueIdentifier(QLatin1String(ResourceEditor::Constants::C_RESOURCEEDITOR));
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
iconProvider->registerIconOverlayForSuffix(QIcon(":/resourceeditor/images/qt_qrc.png"),
QLatin1String("qrc"));
......@@ -56,7 +56,7 @@ ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
QString ResourceEditorFactory::id() const
{
return QLatin1String(C_RESOURCEEDITOR_ID);
return QLatin1String(RESOURCEEDITOR_ID);
}
QString ResourceEditorFactory::displayName() const
......
......@@ -88,13 +88,13 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
// Register undo and redo
Core::ActionManager * const actionManager = core->actionManager();
int const pluginId = core->uniqueIDManager()->uniqueIdentifier(
Constants::C_RESOURCEEDITOR_ID);
const QList<int> idList = QList<int>() << pluginId;
int const contextId = core->uniqueIDManager()->uniqueIdentifier(
Constants::C_RESOURCEEDITOR);
const QList<int> context = QList<int>() << contextId;
m_undoAction = new QAction(tr("&Undo"), this);
m_redoAction = new QAction(tr("&Redo"), this);
actionManager->registerAction(m_undoAction, Core::Constants::UNDO, idList);
actionManager->registerAction(m_redoAction, Core::Constants::REDO, idList);
actionManager->registerAction(m_undoAction, Core::Constants::UNDO, context);
actionManager->registerAction(m_redoAction, Core::Constants::REDO, context);
connect(m_undoAction, SIGNAL(triggered()), this, SLOT(onUndo()));
connect(m_redoAction, SIGNAL(triggered()), this, SLOT(onRedo()));
......
......@@ -158,7 +158,7 @@ bool ResourceEditorFile::save(const QString &name /*= QString()*/)
}
QString ResourceEditorW::id() const {
return QLatin1String(ResourceEditor::Constants::C_RESOURCEEDITOR_ID);
return QLatin1String(ResourceEditor::Constants::RESOURCEEDITOR_ID);
}
QString ResourceEditorFile::fileName() const
......
......@@ -49,6 +49,6 @@ ResourceWizard::generateFilesFromPath(const QString &path,
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, suffix);
Core::GeneratedFile file(fileName);
file.setContents(QLatin1String("<RCC/>"));
file.setEditorId(QLatin1String(Constants::C_RESOURCEEDITOR_ID));
file.setEditorId(QLatin1String(Constants::RESOURCEEDITOR_ID));
return Core::GeneratedFiles() << file;
}
......@@ -44,8 +44,6 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor)
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
setDisplayName(tr(Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME));
}
PlainTextEditor::PlainTextEditor(QWidget *parent)
......
......@@ -81,7 +81,6 @@ public:
bool duplicateSupported() const { return false; }
Core::IEditor *duplicate(QWidget * /*parent*/) { return 0; }
QString id() const { return m_id; }
QString displayName() const { return m_displayName; }
bool isTemporary() const { return true; }
......@@ -91,15 +90,13 @@ signals:
private:
QString m_id;
QString m_displayName;
QList<int> m_context;
};
VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor,
const VCSBaseEditorParameters *type) :
BaseTextEditorEditable(editor),
m_id(type->id),
m_displayName(QCoreApplication::translate("VCS", type->displayName))
m_id(type->id)
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(QLatin1String(type->context))
......
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