Commit ceb6f543 authored by hjk's avatar hjk
Browse files

BinEditor: Also camel-case the namespace



Follows the general pattern better

Change-Id: Icbd1f4ca83601c123873d9c0b362d56c13255b3e
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 8be49ba2
...@@ -84,7 +84,7 @@ static QByteArray calculateHexPattern(const QByteArray &pattern) ...@@ -84,7 +84,7 @@ static QByteArray calculateHexPattern(const QByteArray &pattern)
return result; return result;
} }
namespace BINEditor { namespace BinEditor {
BinEditorWidget::BinEditorWidget(QWidget *parent) BinEditorWidget::BinEditorWidget(QWidget *parent)
: QAbstractScrollArea(parent) : QAbstractScrollArea(parent)
...@@ -1617,4 +1617,4 @@ void BinEditorWidget::setMarkup(const QList<Markup> &markup) ...@@ -1617,4 +1617,4 @@ void BinEditorWidget::setMarkup(const QList<Markup> &markup)
viewport()->update(); viewport()->update();
} }
} // namespace BINEditor } // namespace BinEditor
...@@ -49,14 +49,14 @@ namespace Core { class IEditor; } ...@@ -49,14 +49,14 @@ namespace Core { class IEditor; }
namespace TextEditor { class FontSettings; } namespace TextEditor { class FontSettings; }
namespace BINEditor { namespace BinEditor {
class BinEditorWidget : public QAbstractScrollArea class BinEditorWidget : public QAbstractScrollArea
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false) Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE false) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE false)
Q_PROPERTY(QList<BINEditor::Markup> markup READ markup WRITE setMarkup DESIGNABLE false) Q_PROPERTY(QList<BinEditor::Markup> markup READ markup WRITE setMarkup DESIGNABLE false)
Q_PROPERTY(bool newWindowRequestAllowed READ newWindowRequestAllowed WRITE setNewWindowRequestAllowed DESIGNABLE false) Q_PROPERTY(bool newWindowRequestAllowed READ newWindowRequestAllowed WRITE setNewWindowRequestAllowed DESIGNABLE false)
public: public:
...@@ -245,6 +245,6 @@ private: ...@@ -245,6 +245,6 @@ private:
QList<Markup> m_markup; QList<Markup> m_markup;
}; };
} // namespace BINEditor } // namespace BinEditor
#endif // BINEDITOR_H #endif // BINEDITOR_H
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#ifndef BINEDITORCONSTANTS_H #ifndef BINEDITORCONSTANTS_H
#define BINEDITORCONSTANTS_H #define BINEDITORCONSTANTS_H
namespace BINEditor { namespace BinEditor {
namespace Constants { namespace Constants {
const char C_BINEDITOR[] = "BinEditor.BinaryEditor"; const char C_BINEDITOR[] = "BinEditor.BinaryEditor";
...@@ -38,6 +38,6 @@ const char C_BINEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", " ...@@ -38,6 +38,6 @@ const char C_BINEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "
const char C_BINEDITOR_MIMETYPE[] = "application/octet-stream"; const char C_BINEDITOR_MIMETYPE[] = "application/octet-stream";
} // namespace Constants } // namespace Constants
} // namespace BINEditor } // namespace BinEditor
#endif // BINEDITORCONSTANTS_H #endif // BINEDITORCONSTANTS_H
...@@ -61,9 +61,33 @@ ...@@ -61,9 +61,33 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace Core; using namespace Core;
using namespace BINEditor;
using namespace BINEditor::Internal;
namespace BinEditor {
///////////////////////////////// BinEditorWidgetFactory //////////////////////////////////
/*!
\class BinEditor::BinEditorWidgetFactory
\brief The BinEditorWidgetFactory class offers a service registered with
PluginManager to create bin editor widgets for plugins
without direct linkage.
\sa ExtensionSystem::PluginManager::getObjectByClassName, ExtensionSystem::invoke
*/
class BinEditorWidgetFactory : public QObject
{
Q_OBJECT
public:
BinEditorWidgetFactory() {}
Q_INVOKABLE QWidget *createWidget(QWidget *parent)
{
return new BinEditorWidget(parent);
}
};
namespace Internal {
class BinEditorFind : public Core::IFindSupport class BinEditorFind : public Core::IFindSupport
{ {
...@@ -206,7 +230,7 @@ public: ...@@ -206,7 +230,7 @@ public:
Core::IDocument(parent) Core::IDocument(parent)
{ {
setId(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); setId(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
setMimeType(QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE)); setMimeType(QLatin1String(BinEditor::Constants::C_BINEDITOR_MIMETYPE));
m_widget = parent; m_widget = parent;
connect(m_widget, SIGNAL(dataRequested(quint64)), connect(m_widget, SIGNAL(dataRequested(quint64)),
this, SLOT(provideData(quint64))); this, SLOT(provideData(quint64)));
...@@ -341,7 +365,7 @@ public: ...@@ -341,7 +365,7 @@ public:
m_widget = widget; m_widget = widget;
m_file = new BinEditorDocument(m_widget); m_file = new BinEditorDocument(m_widget);
m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context.add(BINEditor::Constants::C_BINEDITOR); m_context.add(Constants::C_BINEDITOR);
m_addressEdit = new QLineEdit; m_addressEdit = new QLineEdit;
QRegExpValidator * const addressValidator QRegExpValidator * const addressValidator
= new QRegExpValidator(QRegExp(QLatin1String("[0-9a-fA-F]{1,16}")), = new QRegExpValidator(QRegExp(QLatin1String("[0-9a-fA-F]{1,16}")),
...@@ -419,25 +443,6 @@ Core::IEditor *BinEditorFactory::createEditor() ...@@ -419,25 +443,6 @@ Core::IEditor *BinEditorFactory::createEditor()
} }
/*!
\class BINEditor::BinEditorWidgetFactory
\brief The BinEditorWidgetFactory class offers a service registered with
PluginManager to create bin editor widgets for plugins
without direct linkage.
\sa ExtensionSystem::PluginManager::getObjectByClassName, ExtensionSystem::invoke
*/
BinEditorWidgetFactory::BinEditorWidgetFactory(QObject *parent) :
QObject(parent)
{
}
QWidget *BinEditorWidgetFactory::createWidget(QWidget *parent)
{
return new BinEditorWidget(parent);
}
///////////////////////////////// BinEditorPlugin ////////////////////////////////// ///////////////////////////////// BinEditorPlugin //////////////////////////////////
BinEditorPlugin::BinEditorPlugin() : m_factory(0) BinEditorPlugin::BinEditorPlugin() : m_factory(0)
...@@ -551,7 +556,9 @@ void BinEditorPlugin::selectAllAction() ...@@ -551,7 +556,9 @@ void BinEditorPlugin::selectAllAction()
m_currentEditor->selectAll(); m_currentEditor->selectAll();
} }
} // namespace Internal
} // namespace BinEditor
Q_EXPORT_PLUGIN(BinEditorPlugin) Q_EXPORT_PLUGIN(BinEditor::Internal::BinEditorPlugin)
#include "bineditorplugin.moc" #include "bineditorplugin.moc"
...@@ -39,18 +39,9 @@ ...@@ -39,18 +39,9 @@
#include <QStringList> #include <QStringList>
#include <QAction> #include <QAction>
namespace BINEditor { namespace BinEditor {
class BinEditorWidget; class BinEditorWidget;
class BinEditorWidgetFactory : public QObject
{
Q_OBJECT
public:
explicit BinEditorWidgetFactory(QObject *parent = 0);
Q_INVOKABLE QWidget *createWidget(QWidget *parent);
};
namespace Internal { namespace Internal {
class BinEditorFactory; class BinEditorFactory;
...@@ -109,6 +100,6 @@ private: ...@@ -109,6 +100,6 @@ private:
}; };
} // namespace Internal } // namespace Internal
} // namespace BINEditor } // namespace BinEditor
#endif // BINEDITORPLUGIN_H #endif // BINEDITORPLUGIN_H
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "markup.h" #include "markup.h"
/*! /*!
\class BINEditor::Markup \class BinEditor::Markup
\brief The Markup class defines the range of the binary editor. \brief The Markup class defines the range of the binary editor.
Used for displaying class layouts by the debugger. Used for displaying class layouts by the debugger.
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <QList> #include <QList>
#include <QMetaType> #include <QMetaType>
namespace BINEditor { namespace BinEditor {
class Markup class Markup
{ {
...@@ -49,8 +49,9 @@ public: ...@@ -49,8 +49,9 @@ public:
QColor color; QColor color;
QString toolTip; QString toolTip;
}; };
} // namespace BINEditor
Q_DECLARE_METATYPE(QList<BINEditor::Markup>) } // namespace BinEditor
Q_DECLARE_METATYPE(QList<BinEditor::Markup>)
#endif // MARKUP_H #endif // MARKUP_H
...@@ -146,7 +146,7 @@ bool MemoryAgent::doCreateBinEditor(quint64 addr, unsigned flags, ...@@ -146,7 +146,7 @@ bool MemoryAgent::doCreateBinEditor(quint64 addr, unsigned flags,
if (flags & DebuggerEngine::MemoryView) { if (flags & DebuggerEngine::MemoryView) {
// Ask BIN editor plugin for factory service and have it create a bin editor widget. // Ask BIN editor plugin for factory service and have it create a bin editor widget.
QWidget *binEditor = 0; QWidget *binEditor = 0;
if (QObject *factory = ExtensionSystem::PluginManager::getObjectByClassName(QLatin1String("BINEditor::BinEditorWidgetFactory"))) if (QObject *factory = ExtensionSystem::PluginManager::getObjectByClassName(QLatin1String("BinEditor::BinEditorWidgetFactory")))
binEditor = ExtensionSystem::invoke<QWidget *>(factory, "createWidget", (QWidget *)0); binEditor = ExtensionSystem::invoke<QWidget *>(factory, "createWidget", (QWidget *)0);
if (!binEditor) if (!binEditor)
return false; return false;
......
...@@ -81,9 +81,9 @@ void MemoryView::setBinEditorNewWindowRequestAllowed(QWidget *w, bool a) ...@@ -81,9 +81,9 @@ void MemoryView::setBinEditorNewWindowRequestAllowed(QWidget *w, bool a)
void MemoryView::setBinEditorMarkup(QWidget *w, const QList<MemoryMarkup> &ml) void MemoryView::setBinEditorMarkup(QWidget *w, const QList<MemoryMarkup> &ml)
{ {
// Convert into bin editor markup and set. // Convert into bin editor markup and set.
QList<BINEditor::Markup> bml; QList<BinEditor::Markup> bml;
foreach (const MemoryMarkup &m, ml) foreach (const MemoryMarkup &m, ml)
bml.push_back(BINEditor::Markup(m.address, m.length, m.color, m.toolTip)); bml.push_back(BinEditor::Markup(m.address, m.length, m.color, m.toolTip));
w->setProperty("markup", qVariantFromValue(bml)); w->setProperty("markup", qVariantFromValue(bml));
} }
......
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