Commit 214e0bf3 authored by con's avatar con
Browse files

Add a instance() method to the search result window singleton.

parent 8c920ee0
...@@ -148,7 +148,7 @@ public: ...@@ -148,7 +148,7 @@ public:
CppFindReferences::CppFindReferences(CppTools::CppModelManagerInterface *modelManager) CppFindReferences::CppFindReferences(CppTools::CppModelManagerInterface *modelManager)
: QObject(modelManager), : QObject(modelManager),
_modelManager(modelManager), _modelManager(modelManager),
_resultWindow(ExtensionSystem::PluginManager::instance()->getObject<Find::SearchResultWindow>()) _resultWindow(Find::SearchResultWindow::instance())
{ {
m_watcher.setPendingResultsLimit(1); m_watcher.setPendingResultsLimit(1);
connect(&m_watcher, SIGNAL(resultsReadyAt(int,int)), this, SLOT(displayResults(int,int))); connect(&m_watcher, SIGNAL(resultsReadyAt(int,int)), this, SLOT(displayResults(int,int)));
......
...@@ -211,8 +211,11 @@ namespace Internal { ...@@ -211,8 +211,11 @@ namespace Internal {
using namespace Find::Internal; using namespace Find::Internal;
SearchResultWindow *SearchResultWindow::m_instance = 0;
SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate) SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate)
{ {
m_instance = this;
d->m_widget = new QStackedWidget; d->m_widget = new QStackedWidget;
d->m_widget->setWindowTitle(displayName()); d->m_widget->setWindowTitle(displayName());
...@@ -271,6 +274,11 @@ SearchResultWindow::~SearchResultWindow() ...@@ -271,6 +274,11 @@ SearchResultWindow::~SearchResultWindow()
delete d; delete d;
} }
SearchResultWindow *SearchResultWindow::instance()
{
return m_instance;
}
void SearchResultWindow::setTextToReplace(const QString &textToReplace) void SearchResultWindow::setTextToReplace(const QString &textToReplace)
{ {
d->m_replaceTextEdit->setText(textToReplace); d->m_replaceTextEdit->setText(textToReplace);
......
...@@ -82,6 +82,7 @@ public: ...@@ -82,6 +82,7 @@ public:
SearchResultWindow(); SearchResultWindow();
virtual ~SearchResultWindow(); virtual ~SearchResultWindow();
static SearchResultWindow *instance();
QWidget *outputWidget(QWidget *); QWidget *outputWidget(QWidget *);
QList<QWidget*> toolBarWidgets() const; QList<QWidget*> toolBarWidgets() const;
...@@ -129,6 +130,7 @@ private: ...@@ -129,6 +130,7 @@ private:
QList<SearchResultItem> checkedItems() const; QList<SearchResultItem> checkedItems() const;
Internal::SearchResultWindowPrivate *d; Internal::SearchResultWindowPrivate *d;
static SearchResultWindow *m_instance;
}; };
} // namespace Find } // namespace Find
......
...@@ -318,11 +318,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er ...@@ -318,11 +318,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
AllProjectsFind *allProjectsFind = new AllProjectsFind(this, AllProjectsFind *allProjectsFind = new AllProjectsFind(this,
pm->getObject<Find::SearchResultWindow>()); Find::SearchResultWindow::instance());
addAutoReleasedObject(allProjectsFind); addAutoReleasedObject(allProjectsFind);
CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this, CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this,
pm->getObject<Find::SearchResultWindow>()); Find::SearchResultWindow::instance());
addAutoReleasedObject(currentProjectFind); addAutoReleasedObject(currentProjectFind);
addAutoReleasedObject(new LocalApplicationRunControlFactory); addAutoReleasedObject(new LocalApplicationRunControlFactory);
......
...@@ -157,7 +157,7 @@ void TextEditorPlugin::extensionsInitialized() ...@@ -157,7 +157,7 @@ void TextEditorPlugin::extensionsInitialized()
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
m_searchResultWindow = pluginManager->getObject<Find::SearchResultWindow>(); m_searchResultWindow = Find::SearchResultWindow::instance();
m_outlineFactory->setWidgetFactories(pluginManager->getObjects<TextEditor::IOutlineWidgetFactory>()); m_outlineFactory->setWidgetFactories(pluginManager->getObjects<TextEditor::IOutlineWidgetFactory>());
......
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