Commit 214e0bf3 authored by con's avatar con

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

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