Commit 9d1cc971 authored by hjk's avatar hjk

Locator: Clean up LocatorManager interface

Change-Id: Ib401b6eca8c291526268ccea4d9e7e66f08abe1c
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 948a9a05
......@@ -33,27 +33,26 @@
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
using namespace Locator;
using namespace Locator::Internal;
namespace Locator {
LocatorManager *LocatorManager::m_instance = 0;
static Internal::LocatorWidget *m_locatorWidget = 0;
LocatorManager::LocatorManager(LocatorWidget *locatorWidget)
: QObject(locatorWidget),
m_locatorWidget(locatorWidget)
LocatorManager::LocatorManager(Internal::LocatorWidget *locatorWidget)
: QObject(locatorWidget)
{
m_instance = this;
m_locatorWidget = locatorWidget;
}
LocatorManager::~LocatorManager()
{
ExtensionSystem::PluginManager::removeObject(this);
m_instance = 0;
}
void LocatorManager::show(const QString &text,
int selectionStart, int selectionLength)
int selectionStart, int selectionLength)
{
QTC_ASSERT(m_locatorWidget, return);
m_locatorWidget->show(text, selectionStart, selectionLength);
}
} // namespace Internal
......@@ -36,9 +36,7 @@
namespace Locator {
namespace Internal {
class LocatorWidget;
}
namespace Internal { class LocatorWidget; }
class LOCATOR_EXPORT LocatorManager : public QObject
{
......@@ -48,13 +46,7 @@ public:
LocatorManager(Internal::LocatorWidget *locatorWidget);
~LocatorManager();
static LocatorManager *instance() { return m_instance; }
void show(const QString &text, int selectionStart = -1, int selectionLength = 0);
private:
Internal::LocatorWidget *m_locatorWidget;
static LocatorManager *m_instance;
static void show(const QString &text, int selectionStart = -1, int selectionLength = 0);
};
} // namespace Locator
......
......@@ -448,13 +448,11 @@ void TextEditorActionHandler::updateCopyAction()
void TextEditorActionHandler::gotoAction()
{
Locator::LocatorManager *locatorManager = Locator::LocatorManager::instance();
QTC_ASSERT(locatorManager, return);
QString locatorString = TextEditorPlugin::instance()->lineNumberFilter()->shortcutString();
locatorString += QLatin1Char(' ');
const int selectionStart = locatorString.size();
locatorString += tr("<line>:<column>");
locatorManager->show(locatorString, selectionStart, locatorString.size() - selectionStart);
Locator::LocatorManager::show(locatorString, selectionStart, locatorString.size() - selectionStart);
}
void TextEditorActionHandler::printAction()
......
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