summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-03-24 10:43:01 +0100
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-03-24 10:43:01 +0100
commit8a58a2fe71c36a233f5d056aba6c588f24fd2f87 (patch)
tree5529590df92f411101d4793bf5f2f776b99d47e0 /src/plugins
parentc750facb7767ea5a89122a0761d4d7bccbe7f12a (diff)
downloadqt-creator-8a58a2fe71c36a233f5d056aba6c588f24fd2f87.tar.gz
Header cleaning mainly in find/cpaster.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/cpaster/codepasterprotocol.cpp3
-rw-r--r--src/plugins/cpaster/codepasterprotocol.h7
-rw-r--r--src/plugins/cpaster/codepastersettings.cpp1
-rw-r--r--src/plugins/cpaster/codepastersettings.h6
-rw-r--r--src/plugins/cpaster/cpasterplugin.cpp5
-rw-r--r--src/plugins/cpaster/cpasterplugin.h12
-rw-r--r--src/plugins/cpaster/pastebindotcaprotocol.cpp2
-rw-r--r--src/plugins/cpaster/pastebindotcaprotocol.h1
-rw-r--r--src/plugins/cpaster/pastebindotcomprotocol.cpp10
-rw-r--r--src/plugins/cpaster/pastebindotcomprotocol.h1
-rw-r--r--src/plugins/cpaster/pasteview.cpp11
-rw-r--r--src/plugins/cpaster/pasteview.h7
-rw-r--r--src/plugins/cpaster/protocol.h5
-rw-r--r--src/plugins/cpaster/settingspage.h2
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp10
-rw-r--r--src/plugins/find/currentdocumentfind.cpp1
-rw-r--r--src/plugins/find/currentdocumentfind.h1
-rw-r--r--src/plugins/find/findplugin.cpp163
-rw-r--r--src/plugins/find/findplugin.h34
-rw-r--r--src/plugins/find/findtoolbar.cpp4
-rw-r--r--src/plugins/find/findtoolbar.h14
-rw-r--r--src/plugins/find/findtoolwindow.cpp2
-rw-r--r--src/plugins/find/findtoolwindow.h12
-rw-r--r--src/plugins/find/searchresulttreeitems.h2
-rw-r--r--src/plugins/find/searchresulttreeview.cpp1
-rw-r--r--src/plugins/find/searchresulttreeview.h3
-rw-r--r--src/plugins/find/searchresultwindow.cpp254
-rw-r--r--src/plugins/find/searchresultwindow.h29
-rw-r--r--src/plugins/locator/basefilefilter.h7
-rw-r--r--src/plugins/locator/directoryfilter.cpp14
-rw-r--r--src/plugins/locator/directoryfilter.h2
-rw-r--r--src/plugins/locator/filesystemfilter.cpp1
-rw-r--r--src/plugins/locator/filesystemfilter.h6
-rw-r--r--src/plugins/locator/locatorwidget.cpp1
-rw-r--r--src/plugins/locator/locatorwidget.h3
-rw-r--r--src/plugins/locator/opendocumentsfilter.cpp3
-rw-r--r--src/plugins/locator/opendocumentsfilter.h11
-rw-r--r--src/plugins/projectexplorer/allprojectsfilter.cpp6
-rw-r--r--src/plugins/projectexplorer/currentprojectfilter.cpp6
-rw-r--r--src/plugins/resourceeditor/resourceeditorw.h1
-rw-r--r--src/plugins/welcome/communitywelcomepagewidget.cpp1
-rw-r--r--src/plugins/welcome/communitywelcomepagewidget.h4
-rw-r--r--src/plugins/welcome/rssfetcher.h4
43 files changed, 353 insertions, 320 deletions
diff --git a/src/plugins/cpaster/codepasterprotocol.cpp b/src/plugins/cpaster/codepasterprotocol.cpp
index 118455ad25..c9467e92cb 100644
--- a/src/plugins/cpaster/codepasterprotocol.cpp
+++ b/src/plugins/cpaster/codepasterprotocol.cpp
@@ -38,6 +38,9 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/messageoutputwindow.h>
+#include <QtGui/QListWidget>
+#include <QtNetwork/QNetworkReply>
+
using namespace CodePaster;
using namespace Core;
diff --git a/src/plugins/cpaster/codepasterprotocol.h b/src/plugins/cpaster/codepasterprotocol.h
index f7c98e6465..6a4ef01c11 100644
--- a/src/plugins/cpaster/codepasterprotocol.h
+++ b/src/plugins/cpaster/codepasterprotocol.h
@@ -32,10 +32,13 @@
#include "protocol.h"
-#include <QtGui/QListWidget>
#include <QtNetwork/QHttp>
#include <QtNetwork/QNetworkAccessManager>
-#include <QtNetwork/QNetworkReply>
+
+QT_BEGIN_NAMESPACE
+class QListWidget;
+class QNetworkReply;
+QT_END_NAMESPACE
namespace CodePaster {
diff --git a/src/plugins/cpaster/codepastersettings.cpp b/src/plugins/cpaster/codepastersettings.cpp
index 1d88242cba..b5d310ed31 100644
--- a/src/plugins/cpaster/codepastersettings.cpp
+++ b/src/plugins/cpaster/codepastersettings.cpp
@@ -39,6 +39,7 @@
#include <QtGui/QGroupBox>
#include <QtGui/QFormLayout>
#include <QtGui/QVBoxLayout>
+#include <QtGui/QLabel>
#include <QtCore/QDebug>
#include <QtCore/QVariant>
diff --git a/src/plugins/cpaster/codepastersettings.h b/src/plugins/cpaster/codepastersettings.h
index 370f3caab2..42c2bdb5a9 100644
--- a/src/plugins/cpaster/codepastersettings.h
+++ b/src/plugins/cpaster/codepastersettings.h
@@ -30,14 +30,8 @@
#ifndef CODEPASTERSETTINGSPAGE_H
#define CODEPASTERSETTINGSPAGE_H
-#include "ui_settingspage.h"
-
#include <coreplugin/dialogs/ioptionspage.h>
-#include <QtCore/QStringList>
-#include <QtCore/QUrl>
-#include <QtGui/QWidget>
-
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index 4bc7c500cc..572e3f8621 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -36,16 +36,15 @@
#include "codepasterprotocol.h"
#include "pastebindotcomprotocol.h"
#include "pastebindotcaprotocol.h"
+#include "settingspage.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/filemanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
-#include <coreplugin/messageoutputwindow.h>
#include <coreplugin/uniqueidmanager.h>
#include <texteditor/itexteditor.h>
@@ -55,9 +54,7 @@
#include <QtGui/QApplication>
#include <QtGui/QClipboard>
#include <QtGui/QMenu>
-#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
-#include <QtGui/QListWidget>
using namespace CodePaster;
using namespace Core;
diff --git a/src/plugins/cpaster/cpasterplugin.h b/src/plugins/cpaster/cpasterplugin.h
index 582325e299..9306813d58 100644
--- a/src/plugins/cpaster/cpasterplugin.h
+++ b/src/plugins/cpaster/cpasterplugin.h
@@ -30,22 +30,18 @@
#ifndef CODEPASTERPLUGIN_H
#define CODEPASTERPLUGIN_H
-#include "settingspage.h"
-#include "protocol.h"
-
-#include <coreplugin/editormanager/ieditorfactory.h>
-#include <coreplugin/icorelistener.h>
#include <extensionsystem/iplugin.h>
-#include <QtCore/QObject>
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
-class QListWidget;
+class QAction;
QT_END_NAMESPACE
-namespace CodePaster {
+class Protocol;
+namespace CodePaster {
+class SettingsPage;
class CustomFetcher;
class CustomPoster;
diff --git a/src/plugins/cpaster/pastebindotcaprotocol.cpp b/src/plugins/cpaster/pastebindotcaprotocol.cpp
index 716162794f..36e2a52778 100644
--- a/src/plugins/cpaster/pastebindotcaprotocol.cpp
+++ b/src/plugins/cpaster/pastebindotcaprotocol.cpp
@@ -30,6 +30,8 @@
#include "pastebindotcaprotocol.h"
#include "cgi.h"
+#include <QtNetwork/QNetworkReply>
+
using namespace Core;
PasteBinDotCaProtocol::PasteBinDotCaProtocol()
diff --git a/src/plugins/cpaster/pastebindotcaprotocol.h b/src/plugins/cpaster/pastebindotcaprotocol.h
index be2ce17e5e..813a6fe30a 100644
--- a/src/plugins/cpaster/pastebindotcaprotocol.h
+++ b/src/plugins/cpaster/pastebindotcaprotocol.h
@@ -33,7 +33,6 @@
#include "protocol.h"
#include <QtNetwork/QNetworkAccessManager>
-#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QHttp>
class PasteBinDotCaProtocol : public Protocol
diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp
index 6c943e348e..2f5a3fa5b9 100644
--- a/src/plugins/cpaster/pastebindotcomprotocol.cpp
+++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp
@@ -29,16 +29,10 @@
#include "pastebindotcomprotocol.h"
#include "pastebindotcomsettings.h"
-#include <coreplugin/coreconstants.h>
-#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
-#include <coreplugin/messagemanager.h>
-#include <coreplugin/messageoutputwindow.h>
-#include <QDebug>
-#include <QtNetwork/QHttp>
-#include <QtGui/QApplication>
-#include <QtGui/QClipboard>
+#include <QtCore/QDebug>
+#include <QtNetwork/QNetworkReply>
using namespace Core;
diff --git a/src/plugins/cpaster/pastebindotcomprotocol.h b/src/plugins/cpaster/pastebindotcomprotocol.h
index 4803dadfc6..ae6a021d08 100644
--- a/src/plugins/cpaster/pastebindotcomprotocol.h
+++ b/src/plugins/cpaster/pastebindotcomprotocol.h
@@ -33,7 +33,6 @@
#include "protocol.h"
#include <QtNetwork/QNetworkAccessManager>
-#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QHttp>
class PasteBinDotComSettings;
diff --git a/src/plugins/cpaster/pasteview.cpp b/src/plugins/cpaster/pasteview.cpp
index 2e06109081..78b9a4074e 100644
--- a/src/plugins/cpaster/pasteview.cpp
+++ b/src/plugins/cpaster/pasteview.cpp
@@ -29,11 +29,12 @@
#include "pasteview.h"
-#include <QFontMetrics>
-#include <QPainter>
-#include <QScrollBar>
-#include <QPushButton>
-#include <QSettings>
+#include <QtGui/QFontMetrics>
+#include <QtGui/QPainter>
+#include <QtGui/QScrollBar>
+#include <QtGui/QPushButton>
+#include <QtCore/QSettings>
+#include <QtCore/QByteArray>
class ColumnIndicatorTextEdit : public QTextEdit
{
diff --git a/src/plugins/cpaster/pasteview.h b/src/plugins/cpaster/pasteview.h
index 013a2a1d4c..62ed44745e 100644
--- a/src/plugins/cpaster/pasteview.h
+++ b/src/plugins/cpaster/pasteview.h
@@ -30,17 +30,16 @@
#ifndef PASTEVIEW_H
#define PASTEVIEW_H
-#include "splitter.h"
#include "ui_pasteview.h"
+#include "splitter.h"
-#include <QDialog>
-#include <QByteArray>
+#include <QtGui/QDialog>
class PasteView : public QDialog
{
Q_OBJECT
public:
- PasteView(QWidget *parent);
+ explicit PasteView(QWidget *parent);
~PasteView();
int show(const QString &user, const QString &description, const QString &comment,
diff --git a/src/plugins/cpaster/protocol.h b/src/plugins/cpaster/protocol.h
index 3131a9078c..21066fd77e 100644
--- a/src/plugins/cpaster/protocol.h
+++ b/src/plugins/cpaster/protocol.h
@@ -30,13 +30,8 @@
#ifndef PROTOCOL_H
#define PROTOCOL_H
-#include "settingspage.h"
-
#include <coreplugin/dialogs/ioptionspage.h>
-#include <QtCore/QObject>
-#include <QtCore/QString>
-
QT_BEGIN_NAMESPACE
class QListWidget;
QT_END_NAMESPACE
diff --git a/src/plugins/cpaster/settingspage.h b/src/plugins/cpaster/settingspage.h
index 1846a08e01..834c4ef266 100644
--- a/src/plugins/cpaster/settingspage.h
+++ b/src/plugins/cpaster/settingspage.h
@@ -35,8 +35,6 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QStringList>
-#include <QtCore/QUrl>
-#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class QSettings;
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index 5c6aa71004..9ae22c9079 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -739,11 +739,11 @@ void FakeVimPluginPrivate::windowCommand(int key)
void FakeVimPluginPrivate::find(bool reverse)
{
- if (Find::Internal::FindPlugin *plugin = Find::Internal::FindPlugin::instance()) {
+ if (Find::FindPlugin *plugin = Find::FindPlugin::instance()) {
plugin->setUseFakeVim(true);
plugin->openFindToolBar(reverse
- ? Find::Internal::FindPlugin::FindBackward
- : Find::Internal::FindPlugin::FindForward);
+ ? Find::FindPlugin::FindBackward
+ : Find::FindPlugin::FindForward);
}
}
@@ -847,8 +847,8 @@ void FakeVimPluginPrivate::setUseFakeVim(const QVariant &value)
{
//qDebug() << "SET USE FAKEVIM" << value;
bool on = value.toBool();
- if (Find::Internal::FindPlugin::instance())
- Find::Internal::FindPlugin::instance()->setUseFakeVim(on);
+ if (Find::FindPlugin::instance())
+ Find::FindPlugin::instance()->setUseFakeVim(on);
if (on) {
Core::EditorManager::instance()->showEditorStatusBar(
QLatin1String(Constants::MINI_BUFFER),
diff --git a/src/plugins/find/currentdocumentfind.cpp b/src/plugins/find/currentdocumentfind.cpp
index 2ecdc533b7..448eba3ba5 100644
--- a/src/plugins/find/currentdocumentfind.cpp
+++ b/src/plugins/find/currentdocumentfind.cpp
@@ -36,6 +36,7 @@
#include <QtCore/QDebug>
#include <QtGui/QApplication>
+#include <QtGui/QWidget>
using namespace Core;
using namespace Find;
diff --git a/src/plugins/find/currentdocumentfind.h b/src/plugins/find/currentdocumentfind.h
index 016a9332e3..6e3def7791 100644
--- a/src/plugins/find/currentdocumentfind.h
+++ b/src/plugins/find/currentdocumentfind.h
@@ -33,7 +33,6 @@
#include "ifindsupport.h"
#include <QtCore/QPointer>
-#include <QtGui/QWidget>
namespace Find {
namespace Internal {
diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp
index d488b5c3f9..4b215a903f 100644
--- a/src/plugins/find/findplugin.cpp
+++ b/src/plugins/find/findplugin.cpp
@@ -34,6 +34,7 @@
#include "findtoolbar.h"
#include "findtoolwindow.h"
#include "searchresultwindow.h"
+#include "ifindfilter.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
@@ -46,6 +47,8 @@
#include <utils/qtcassert.h>
#include <QtGui/QMenu>
+#include <QtGui/QStringListModel>
+#include <QtGui/QAction>
#include <QtCore/QtPlugin>
#include <QtCore/QSettings>
@@ -70,43 +73,64 @@ namespace {
const int MAX_COMPLETIONS = 50;
}
-using namespace Find;
-using namespace Find::Internal;
+namespace Find {
-FindPlugin *FindPlugin::m_instance = 0;
+struct FindPluginPrivate {
+ explicit FindPluginPrivate(FindPlugin *q);
-FindPlugin::FindPlugin()
- : m_currentDocumentFind(0),
- m_findToolBar(0),
- m_findDialog(0),
- m_findCompletionModel(new QStringListModel(this)),
- m_replaceCompletionModel(new QStringListModel(this))
+ //variables
+ static FindPlugin *m_instance;
+
+ QHash<IFindFilter *, QAction *> m_filterActions;
+
+ Internal::CurrentDocumentFind *m_currentDocumentFind;
+ Internal::FindToolBar *m_findToolBar;
+ Internal::FindToolWindow *m_findDialog;
+ QTextDocument::FindFlags m_findFlags;
+ QStringListModel *m_findCompletionModel;
+ QStringListModel *m_replaceCompletionModel;
+ QStringList m_findCompletions;
+ QStringList m_replaceCompletions;
+ QAction *m_openFindDialog;
+};
+
+FindPluginPrivate::FindPluginPrivate(FindPlugin *q) :
+ m_currentDocumentFind(0), m_findToolBar(0), m_findDialog(0),
+ m_findCompletionModel(new QStringListModel(q)),
+ m_replaceCompletionModel(new QStringListModel(q))
+{
+}
+
+FindPlugin *FindPluginPrivate::m_instance = 0;
+
+FindPlugin::FindPlugin() : d(new FindPluginPrivate(this))
{
- QTC_ASSERT(!m_instance, return);
- m_instance = this;
+ QTC_ASSERT(!FindPluginPrivate::m_instance, return);
+ FindPluginPrivate::m_instance = this;
}
FindPlugin::~FindPlugin()
{
- m_instance = 0;
- delete m_currentDocumentFind;
- delete m_findToolBar;
- delete m_findDialog;
+ FindPluginPrivate::m_instance = 0;
+ delete d->m_currentDocumentFind;
+ delete d->m_findToolBar;
+ delete d->m_findDialog;
+ delete d;
}
FindPlugin *FindPlugin::instance()
{
- return m_instance;
+ return FindPluginPrivate::m_instance;
}
bool FindPlugin::initialize(const QStringList &, QString *)
{
setupMenu();
- m_currentDocumentFind = new CurrentDocumentFind;
+ d->m_currentDocumentFind = new Internal::CurrentDocumentFind;
- m_findToolBar = new FindToolBar(this, m_currentDocumentFind);
- m_findDialog = new FindToolWindow(this);
+ d->m_findToolBar = new Internal::FindToolBar(this, d->m_currentDocumentFind);
+ d->m_findDialog = new Internal::FindToolWindow(this);
SearchResultWindow *searchResultWindow = new SearchResultWindow;
addAutoReleasedObject(searchResultWindow);
return true;
@@ -120,27 +144,27 @@ void FindPlugin::extensionsInitialized()
void FindPlugin::shutdown()
{
- m_findToolBar->setVisible(false);
- m_findToolBar->setParent(0);
- m_currentDocumentFind->removeConnections();
+ d->m_findToolBar->setVisible(false);
+ d->m_findToolBar->setParent(0);
+ d->m_currentDocumentFind->removeConnections();
writeSettings();
}
void FindPlugin::filterChanged()
{
IFindFilter *changedFilter = qobject_cast<IFindFilter *>(sender());
- QAction *action = m_filterActions.value(changedFilter);
+ QAction *action = d->m_filterActions.value(changedFilter);
QTC_ASSERT(changedFilter, return);
QTC_ASSERT(action, return);
action->setEnabled(changedFilter->isEnabled());
bool haveEnabledFilters = false;
- foreach (IFindFilter *filter, m_filterActions.keys()) {
+ foreach (IFindFilter *filter, d->m_filterActions.keys()) {
if (filter->isEnabled()) {
haveEnabledFilters = true;
break;
}
}
- m_openFindDialog->setEnabled(haveEnabledFilters);
+ d->m_openFindDialog->setEnabled(haveEnabledFilters);
}
void FindPlugin::openFindFilter()
@@ -148,12 +172,12 @@ void FindPlugin::openFindFilter()
QAction *action = qobject_cast<QAction*>(sender());
QTC_ASSERT(action, return);
IFindFilter *filter = action->data().value<IFindFilter *>();
- if (m_currentDocumentFind->candidateIsEnabled())
- m_currentDocumentFind->acceptCandidate();
- QString currentFindString = (m_currentDocumentFind->isEnabled() ? m_currentDocumentFind->currentFindString() : "");
+ if (d->m_currentDocumentFind->candidateIsEnabled())
+ d->m_currentDocumentFind->acceptCandidate();
+ QString currentFindString = (d->m_currentDocumentFind->isEnabled() ? d->m_currentDocumentFind->currentFindString() : "");
if (!currentFindString.isEmpty())
- m_findDialog->setFindText(currentFindString);
- m_findDialog->open(filter);
+ d->m_findDialog->setFindText(currentFindString);
+ d->m_findDialog->open(filter);
}
void FindPlugin::setupMenu()
@@ -182,11 +206,11 @@ void FindPlugin::setupMenu()
Core::ActionContainer *mfindadvanced = am->createMenu(Constants::M_FIND_ADVANCED);
mfindadvanced->menu()->setTitle(tr("Advanced Find"));
mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS);
- m_openFindDialog = new QAction(tr("Open Advanced Find..."), this);
- cmd = am->registerAction(m_openFindDialog, QLatin1String("Find.Dialog"), globalcontext);
+ d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this);
+ cmd = am->registerAction(d->m_openFindDialog, QLatin1String("Find.Dialog"), globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F")));
mfindadvanced->addAction(cmd);
- connect(m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter()));
+ connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter()));
}
void FindPlugin::setupFilterMenuItems()
@@ -198,10 +222,10 @@ void FindPlugin::setupFilterMenuItems()
QList<int> globalcontext = QList<int>() << Core::Constants::C_GLOBAL_ID;
Core::ActionContainer *mfindadvanced = am->actionContainer(Constants::M_FIND_ADVANCED);
- m_filterActions.clear();
+ d->m_filterActions.clear();
bool haveEnabledFilters = false;
foreach (IFindFilter *filter, findInterfaces) {
- QAction *action = new QAction(QString(" %1").arg(filter->name()), this);
+ QAction *action = new QAction(QLatin1String(" ") + filter->name(), this);
bool isEnabled = filter->isEnabled();
if (isEnabled)
haveEnabledFilters = true;
@@ -210,17 +234,17 @@ void FindPlugin::setupFilterMenuItems()
cmd = am->registerAction(action, QLatin1String("FindFilter.")+filter->id(), globalcontext);
cmd->setDefaultKeySequence(filter->defaultShortcut());
mfindadvanced->addAction(cmd);
- m_filterActions.insert(filter, action);
+ d->m_filterActions.insert(filter, action);
connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter()));
connect(filter, SIGNAL(changed()), this, SLOT(filterChanged()));
}
- m_findDialog->setFindFilters(findInterfaces);
- m_openFindDialog->setEnabled(haveEnabledFilters);
+ d->m_findDialog->setFindFilters(findInterfaces);
+ d->m_openFindDialog->setEnabled(haveEnabledFilters);
}
QTextDocument::FindFlags FindPlugin::findFlags() const
{
- return m_findFlags;
+ return d->m_findFlags;
}
void FindPlugin::setCaseSensitive(bool sensitive)
@@ -244,30 +268,30 @@ void FindPlugin::setFindFlag(QTextDocument::FindFlag flag, bool enabled)
if ((hasFlag && enabled) || (!hasFlag && !enabled))
return;
if (enabled)
- m_findFlags |= flag;
+ d->m_findFlags |= flag;
else
- m_findFlags &= ~flag;
+ d->m_findFlags &= ~flag;
if (flag != QTextDocument::FindBackward)
emit findFlagsChanged();
}
bool FindPlugin::hasFindFlag(QTextDocument::FindFlag flag)
{
- return m_findFlags & flag;
+ return d->m_findFlags & flag;
}
void FindPlugin::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find");
- settings->setValue("Backward", QVariant((m_findFlags & QTextDocument::FindBackward) != 0));
- settings->setValue("CaseSensitively", QVariant((m_findFlags & QTextDocument::FindCaseSensitively) != 0));
- settings->setValue("WholeWords", QVariant((m_findFlags & QTextDocument::FindWholeWords) != 0));
- settings->setValue("FindStrings", m_findCompletions);
- settings->setValue("ReplaceStrings", m_replaceCompletions);
+ settings->setValue("Backward", QVariant((d->m_findFlags & QTextDocument::FindBackward) != 0));
+ settings->setValue("CaseSensitively", QVariant((d->m_findFlags & QTextDocument::FindCaseSensitively) != 0));
+ settings->setValue("WholeWords", QVariant((d->m_findFlags & QTextDocument::FindWholeWords) != 0));
+ settings->setValue("FindStrings", d->m_findCompletions);
+ settings->setValue("ReplaceStrings", d->m_replaceCompletions);
settings->endGroup();
- m_findToolBar->writeSettings();
- m_findDialog->writeSettings();
+ d->m_findToolBar->writeSettings();
+ d->m_findDialog->writeSettings();
}
void FindPlugin::readSettings()
@@ -279,24 +303,24 @@ void FindPlugin::readSettings()
setCaseSensitive(settings->value("CaseSensitively", false).toBool());
setWholeWord(settings->value("WholeWords", false).toBool());
blockSignals(block);
- m_findCompletions = settings->value("FindStrings").toStringList();
- m_replaceCompletions = settings->value("ReplaceStrings").toStringList();
- m_findCompletionModel->setStringList(m_findCompletions);
- m_replaceCompletionModel->setStringList(m_replaceCompletions);
+ d->m_findCompletions = settings->value("FindStrings").toStringList();
+ d->m_replaceCompletions = settings->value("ReplaceStrings").toStringList();
+ d->m_findCompletionModel->setStringList(d->m_findCompletions);
+ d->m_replaceCompletionModel->setStringList(d->m_replaceCompletions);
settings->endGroup();
- m_findToolBar->readSettings();
- m_findDialog->readSettings();
+ d->m_findToolBar->readSettings();
+ d->m_findDialog->readSettings();
emit findFlagsChanged(); // would have been done in the setXXX methods above
}
void FindPlugin::updateFindCompletion(const QString &text)
{
- updateCompletion(text, m_findCompletions, m_findCompletionModel);
+ updateCompletion(text, d->m_findCompletions, d->m_findCompletionModel);
}
void FindPlugin::updateReplaceCompletion(const QString &text)
{
- updateCompletion(text, m_replaceCompletions, m_replaceCompletionModel);
+ updateCompletion(text, d->m_replaceCompletions, d->m_replaceCompletionModel);
}
void FindPlugin::updateCompletion(const QString &text, QStringList &completions, QStringListModel *model)
@@ -312,16 +336,29 @@ void FindPlugin::updateCompletion(const QString &text, QStringList &completions,
void FindPlugin::setUseFakeVim(bool on)
{
- if (m_findToolBar)
- m_findToolBar->setUseFakeVim(on);
+ if (d->m_findToolBar)
+ d->m_findToolBar->setUseFakeVim(on);
}
void FindPlugin::openFindToolBar(FindDirection direction)
{
- if (m_findToolBar) {
- m_findToolBar->setBackward(direction == FindBackward);
- m_findToolBar->openFindToolBar();
+ if (d->m_findToolBar) {
+ d->m_findToolBar->setBackward(direction == FindBackward);
+ d->m_findToolBar->openFindToolBar();
}
}
-Q_EXPORT_PLUGIN(FindPlugin)
+QStringListModel *FindPlugin::findCompletionModel() const
+{
+ return d->m_findCompletionModel;
+}
+
+QStringListModel *FindPlugin::replaceCompletionModel() const
+{
+ return d->m_replaceCompletionModel;
+}
+
+
+} // namespace Find
+
+Q_EXPORT_PLUGIN(Find::FindPlugin)
diff --git a/src/plugins/find/findplugin.h b/src/plugins/find/findplugin.h
index 475def0f61..6d0bfe10f9 100644
--- a/src/plugins/find/findplugin.h
+++ b/src/plugins/find/findplugin.h
@@ -30,22 +30,25 @@
#ifndef FINDPLUGIN_H
#define FINDPLUGIN_H
-#include "ifindfilter.h"
+#include "find_global.h"
#include <extensionsystem/iplugin.h>
-#include <QtCore/QHash>
-#include <QtCore/QStringList>
-#include <QtGui/QAction>
#include <QtGui/QTextDocument>
-#include <QtGui/QStringListModel>
+
+QT_BEGIN_NAMESPACE
+class QStringListModel;
+QT_END_NAMESPACE
namespace Find {
-namespace Internal {
+class IFindFilter;
+struct FindPluginPrivate;
+namespace Internal {
class FindToolBar;
class FindToolWindow;
class CurrentDocumentFind;
+} // namespace Internal
class FIND_EXPORT FindPlugin : public ExtensionSystem::IPlugin
{
@@ -69,8 +72,8 @@ public:
QTextDocument::FindFlags findFlags() const;
void updateFindCompletion(const QString &text);
void updateReplaceCompletion(const QString &text);
- QStringListModel *findCompletionModel() { return m_findCompletionModel; }
- QStringListModel *replaceCompletionModel() { return m_replaceCompletionModel; }
+ QStringListModel *findCompletionModel() const;
+ QStringListModel *replaceCompletionModel() const;
void setUseFakeVim(bool on);
void openFindToolBar(FindDirection direction);
@@ -96,22 +99,9 @@ private:
void readSettings();
//variables
- static FindPlugin *m_instance;
-
- QHash<IFindFilter *, QAction *> m_filterActions;
-
- CurrentDocumentFind *m_currentDocumentFind;
- FindToolBar *m_findToolBar;
- FindToolWindow *m_findDialog;
- QTextDocument::FindFlags m_findFlags;
- QStringListModel *m_findCompletionModel;
- QStringListModel *m_replaceCompletionModel;
- QStringList m_findCompletions;
- QStringList m_replaceCompletions;
- QAction *m_openFindDialog;
+ FindPluginPrivate *d;
};
-} // namespace Internal
} // namespace Find
#endif // FINDPLUGIN_H
diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp
index 3f3449a5c2..a497cfd4e1 100644
--- a/src/plugins/find/findtoolbar.cpp
+++ b/src/plugins/find/findtoolbar.cpp
@@ -36,7 +36,10 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
+#include <coreplugin/findplaceholder.h>
+
#include <extensionsystem/pluginmanager.h>
+
#include <utils/stylehelper.h>
#include <QtCore/QDebug>
@@ -51,6 +54,7 @@
#include <QtGui/QToolButton>
#include <QtGui/QPainter>
#include <QtGui/QPixmapCache>
+#include <QtGui/QStringListModel>
Q_DECLARE_METATYPE(QStringList)
Q_DECLARE_METATYPE(Find::IFindFilter*)
diff --git a/src/plugins/find/findtoolbar.h b/src/plugins/find/findtoolbar.h
index a35438744c..ab8d8a4132 100644
--- a/src/plugins/find/findtoolbar.h
+++ b/src/plugins/find/findtoolbar.h
@@ -31,29 +31,27 @@
#define FINDTOOLBAR_H
#include "ui_findwidget.h"
-#include "ifindfilter.h"
#include "currentdocumentfind.h"
-#include <coreplugin/findplaceholder.h>
#include <utils/styledbar.h>
#include <QtCore/QTimer>
-#include <QtGui/QStringListModel>
-#include <QtGui/QWidget>
-#include <QtGui/QLabel>
+namespace Core {
+class FindToolBarPlaceHolder;
+}
namespace Find {
-namespace Internal {
-
class FindPlugin;
+namespace Internal {
+
class FindToolBar : public Utils::StyledBar
{
Q_OBJECT
public:
- FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind);
+ explicit FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind);
~FindToolBar();
void readSettings();
diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp
index 0c61c7ff95..2058af703e 100644
--- a/src/plugins/find/findtoolwindow.cpp
+++ b/src/plugins/find/findtoolwindow.cpp
@@ -34,6 +34,8 @@
#include <QtCore/QSettings>
#include <QtGui/QMainWindow>
+#include <QtGui/QStringListModel>
+#include <QtGui/QCompleter>
using namespace Find;
using namespace Find::Internal;
diff --git a/src/plugins/find/findtoolwindow.h b/src/plugins/find/findtoolwindow.h
index f06b2cbb98..b4575edbce 100644
--- a/src/plugins/find/findtoolwindow.h
+++ b/src/plugins/find/findtoolwindow.h
@@ -34,20 +34,20 @@
#include "ifindfilter.h"
#include <QtCore/QList>
-#include <QtGui/QCompleter>
-#include <QtGui/QWidget>
-namespace Find {
-namespace Internal {
+QT_FORWARD_DECLARE_CLASS(QCompleter)
+namespace Find {
class FindPlugin;
+namespace Internal {
+
class FindToolWindow : public QDialog
{
Q_OBJECT
public:
- FindToolWindow(FindPlugin *plugin);
+ explicit FindToolWindow(FindPlugin *plugin);
~FindToolWindow();
void setFindFilters(const QList<IFindFilter *> &filters);
@@ -70,7 +70,7 @@ private:
FindPlugin *m_plugin;
QList<IFindFilter *> m_filters;
QCompleter *m_findCompleter;
- QList<QWidget *> m_configWidgets;
+ QWidgetList m_configWidgets;
IFindFilter *m_currentFilter;
};
diff --git a/src/plugins/find/searchresulttreeitems.h b/src/plugins/find/searchresulttreeitems.h
index c5f934dbb0..18ff329a0e 100644
--- a/src/plugins/find/searchresulttreeitems.h
+++ b/src/plugins/find/searchresulttreeitems.h
@@ -30,9 +30,9 @@
#ifndef SEARCHRESULTTREEITEMS_H
#define SEARCHRESULTTREEITEMS_H
-#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QList>
+#include <QtCore/qnamespace.h>
namespace Find {
namespace Internal {
diff --git a/src/plugins/find/searchresulttreeview.cpp b/src/plugins/find/searchresulttreeview.cpp
index 85dcdc5591..22e84f2628 100644
--- a/src/plugins/find/searchresulttreeview.cpp
+++ b/src/plugins/find/searchresulttreeview.cpp
@@ -33,6 +33,7 @@
#include "searchresulttreeitemdelegate.h"
#include <QtGui/QHeaderView>
+#include <QtGui/QKeyEvent>
using namespace Find::Internal;
diff --git a/src/plugins/find/searchresulttreeview.h b/src/plugins/find/searchresulttreeview.h
index a900c9d724..8337de6295 100644
--- a/src/plugins/find/searchresulttreeview.h
+++ b/src/plugins/find/searchresulttreeview.h
@@ -31,7 +31,6 @@
#define SEARCHRESULTTREEVIEW_H
#include <QtGui/QTreeView>
-#include <QtGui/QKeyEvent>
namespace Find {
namespace Internal {
@@ -43,7 +42,7 @@ class SearchResultTreeView : public QTreeView
Q_OBJECT
public:
- SearchResultTreeView(QWidget *parent = 0);
+ explicit SearchResultTreeView(QWidget *parent = 0);
void setAutoExpandResults(bool expand);
void setTextEditorFont(const QFont &font);
diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp
index 84bd59ba77..0289b71e57 100644
--- a/src/plugins/find/searchresultwindow.cpp
+++ b/src/plugins/find/searchresultwindow.cpp
@@ -30,6 +30,7 @@
#include "searchresultwindow.h"
#include "searchresulttreemodel.h"
#include "searchresulttreeitems.h"
+#include "searchresulttreeview.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
@@ -43,53 +44,72 @@
#include <QtGui/QLineEdit>
#include <QtGui/QStackedWidget>
#include <QtGui/QLabel>
+#include <QtGui/QFont>
-using namespace Find;
-using namespace Find::Internal;
+static const char SETTINGSKEYSECTIONNAME[] = "SearchResults";
+static const char SETTINGSKEYEXPANDRESULTS[] = "ExpandResults";
-static const QString SETTINGSKEYSECTIONNAME("SearchResults");
-static const QString SETTINGSKEYEXPANDRESULTS("ExpandResults");
+namespace Find {
-SearchResultWindow::SearchResultWindow()
- : m_currentSearch(0),
- m_isShowingReplaceUI(false),
- m_focusReplaceEdit(false)
-{
- m_widget = new QStackedWidget;
- m_widget->setWindowTitle(name());
-
- m_searchResultTreeView = new SearchResultTreeView(m_widget);
- m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
- m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
- m_widget->addWidget(m_searchResultTreeView);
+struct SearchResultWindowPrivate {
+ SearchResultWindowPrivate();
- m_noMatchesFoundDisplay = new QListWidget(m_widget);
- m_noMatchesFoundDisplay->addItem(tr("No matches found!"));
- m_noMatchesFoundDisplay->setFrameStyle(QFrame::NoFrame);
- m_widget->addWidget(m_noMatchesFoundDisplay);
+ Internal::SearchResultTreeView *m_searchResultTreeView;
+ QListWidget *m_noMatchesFoundDisplay;
+ QToolButton *m_expandCollapseToolButton;
+ QLabel *m_replaceLabel;
+ QLineEdit *m_replaceTextEdit;
+ QToolButton *m_replaceButton;
+ static const bool m_initiallyExpand = false;
+ QStackedWidget *m_widget;
+ SearchResult *m_currentSearch;
+ QList<SearchResultItem> m_items;
+ bool m_isShowingReplaceUI;
+ bool m_focusReplaceEdit;
+};
- m_expandCollapseToolButton = new QToolButton(m_widget);
- m_expandCollapseToolButton->setAutoRaise(true);
- m_expandCollapseToolButton->setCheckable(true);
- m_expandCollapseToolButton->setIcon(QIcon(":/find/images/expand.png"));
- m_expandCollapseToolButton->setToolTip(tr("Expand All"));
-
- m_replaceLabel = new QLabel(tr("Replace with:"), m_widget);
- m_replaceLabel->setContentsMargins(12, 0, 5, 0);
- m_replaceTextEdit = new QLineEdit(m_widget);
- m_replaceButton = new QToolButton(m_widget);
- m_replaceButton->setToolTip(tr("Replace all occurrences"));
- m_replaceButton->setText(tr("Replace"));
- m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
- m_replaceButton->setAutoRaise(true);
- m_replaceTextEdit->setTabOrder(m_replaceTextEdit, m_searchResultTreeView);
+SearchResultWindowPrivate::SearchResultWindowPrivate()
+ : m_currentSearch(0), m_isShowingReplaceUI(false), m_focusReplaceEdit(false)
+{
+}
- connect(m_searchResultTreeView, SIGNAL(jumpToSearchResult(int,bool)),
+SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate)
+{
+ d->m_widget = new QStackedWidget;
+ d->m_widget->setWindowTitle(name());
+
+ d->m_searchResultTreeView = new Internal::SearchResultTreeView(d->m_widget);
+ d->m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
+ d->m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
+ d->m_widget->addWidget(d->m_searchResultTreeView);
+
+ d->m_noMatchesFoundDisplay = new QListWidget(d->m_widget);
+ d->m_noMatchesFoundDisplay->addItem(tr("No matches found!"));
+ d->m_noMatchesFoundDisplay->setFrameStyle(QFrame::NoFrame);
+ d->m_widget->addWidget(d->m_noMatchesFoundDisplay);
+
+ d->m_expandCollapseToolButton = new QToolButton(d->m_widget);
+ d->m_expandCollapseToolButton->setAutoRaise(true);
+ d->m_expandCollapseToolButton->setCheckable(true);
+ d->m_expandCollapseToolButton->setIcon(QIcon(":/find/images/expand.png"));
+ d->m_expandCollapseToolButton->setToolTip(tr("Expand All"));
+
+ d->m_replaceLabel = new QLabel(tr("Replace with:"), d->m_widget);
+ d->m_replaceLabel->setContentsMargins(12, 0, 5, 0);
+ d->m_replaceTextEdit = new QLineEdit(d->m_widget);
+ d->m_replaceButton = new QToolButton(d->m_widget);
+ d->m_replaceButton->setToolTip(tr("Replace all occurrences"));
+ d->m_replaceButton->setText(tr("Replace"));
+ d->m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
+ d->m_replaceButton->setAutoRaise(true);
+ d->m_replaceTextEdit->setTabOrder(d->m_replaceTextEdit, d->m_searchResultTreeView);
+
+ connect(d->m_searchResultTreeView, SIGNAL(jumpToSearchResult(int,bool)),
this, SLOT(handleJumpToSearchResult(int,bool)));
- connect(m_expandCollapseToolButton, SIGNAL(toggled(bool)), this, SLOT(handleExpandCollapseToolButton(bool)));
- connect(m_replaceTextEdit, SIGNAL(returnPressed()), this, SLOT(handleReplaceButton()));
- connect(m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton()));
+ connect(d->m_expandCollapseToolButton, SIGNAL(toggled(bool)), this, SLOT(handleExpandCollapseToolButton(bool)));
+ connect(d->m_replaceTextEdit, SIGNAL(returnPressed()), this, SLOT(handleReplaceButton()));
+ connect(d->m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton()));
readSettings();
setShowReplaceUI(false);
@@ -98,55 +118,56 @@ SearchResultWindow::SearchResultWindow()
SearchResultWindow::~SearchResultWindow()
{
writeSettings();
- delete m_currentSearch;
- m_currentSearch = 0;
- delete m_widget;
- m_widget = 0;
- m_items.clear();
+ delete d->m_currentSearch;
+ d->m_currentSearch = 0;
+ delete d->m_widget;
+ d->m_widget = 0;
+ d->m_items.clear();
+ delete d;
}
void SearchResultWindow::setTextToReplace(const QString &textToReplace)
{
- m_replaceTextEdit->setText(textToReplace);
+ d->m_replaceTextEdit->setText(textToReplace);
}
QString SearchResultWindow::textToReplace() const
{
- return m_replaceTextEdit->text();
+ return d->m_replaceTextEdit->text();
}
void SearchResultWindow::setShowReplaceUI(bool show)
{
- m_searchResultTreeView->model()->setShowReplaceUI(show);
- m_replaceLabel->setVisible(show);
- m_replaceTextEdit->setVisible(show);
- m_replaceButton->setVisible(show);
- m_isShowingReplaceUI = show;
+ d->m_searchResultTreeView->model()->setShowReplaceUI(show);
+ d->m_replaceLabel->setVisible(show);
+ d->m_replaceTextEdit->setVisible(show);
+ d->m_replaceButton->setVisible(show);
+ d->m_isShowingReplaceUI = show;
}
void SearchResultWindow::handleReplaceButton()
{
- QTC_ASSERT(m_currentSearch, return);
+ QTC_ASSERT(d->m_currentSearch, return);
// check if button is actually enabled, because this is also triggered
// by pressing return in replace line edit
- if (m_replaceButton->isEnabled())
- m_currentSearch->replaceButtonClicked(m_replaceTextEdit->text(), checkedItems());
+ if (d->m_replaceButton->isEnabled())
+ d->m_currentSearch->replaceButtonClicked(d->m_replaceTextEdit->text(), checkedItems());
}
QList<SearchResultItem> SearchResultWindow::checkedItems() const
{
QList<SearchResultItem> result;
- SearchResultTreeModel *model = m_searchResultTreeView->model();
+ Internal::SearchResultTreeModel *model = d->m_searchResultTreeView->model();
const int fileCount = model->rowCount(QModelIndex());
for (int i = 0; i < fileCount; ++i) {
QModelIndex fileIndex = model->index(i, 0, QModelIndex());
- SearchResultFile *fileItem = static_cast<SearchResultFile *>(fileIndex.internalPointer());
+ Internal::SearchResultFile *fileItem = static_cast<Internal::SearchResultFile *>(fileIndex.internalPointer());
Q_ASSERT(fileItem != 0);
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
QModelIndex textIndex = model->index(rowIndex, 0, fileIndex);
- SearchResultTextRow *rowItem = static_cast<SearchResultTextRow *>(textIndex.internalPointer());
+ Internal::SearchResultTextRow *rowItem = static_cast<Internal::SearchResultTextRow *>(textIndex.internalPointer());
if (rowItem->checkState())
- result << m_items.at(rowItem->index());
+ result << d->m_items.at(rowItem->index());
}
}
return result;
@@ -158,27 +179,27 @@ void SearchResultWindow::visibilityChanged(bool /*visible*/)
QWidget *SearchResultWindow::outputWidget(QWidget *)
{
- return m_widget;
+ return d->m_widget;
}
QList<QWidget*> SearchResultWindow::toolBarWidgets() const
{
- return QList<QWidget*>() << m_expandCollapseToolButton << m_replaceLabel << m_replaceTextEdit << m_replaceButton;
+ return QList<QWidget*>() << d->m_expandCollapseToolButton << d->m_replaceLabel << d->m_replaceTextEdit << d->m_replaceButton;
}
SearchResult *SearchResultWindow::startNewSearch(SearchMode searchOrSearchAndReplace)
{
clearContents();
setShowReplaceUI(searchOrSearchAndReplace != SearchOnly);
- delete m_currentSearch;
- m_currentSearch = new SearchResult;
- return m_currentSearch;
+ delete d->m_currentSearch;
+ d->m_currentSearch = new SearchResult;
+ return d->m_currentSearch;
}
void SearchResultWindow::finishSearch()
{
- if (m_items.count()) {
- m_replaceButton->setEnabled(true);
+ if (d->m_items.count()) {
+ d->m_replaceButton->setEnabled(true);
} else {
showNoMatchesFound();
}
@@ -186,55 +207,55 @@ void SearchResultWindow::finishSearch()
void SearchResultWindow::clearContents()
{
- m_replaceTextEdit->setEnabled(false);
- m_replaceButton->setEnabled(false);
- m_replaceTextEdit->clear();
- m_searchResultTreeView->clear();
- m_items.clear();
- m_widget->setCurrentWidget(m_searchResultTreeView);
+ d->m_replaceTextEdit->setEnabled(false);
+ d->m_replaceButton->setEnabled(false);
+ d->m_replaceTextEdit->clear();
+ d->m_searchResultTreeView->clear();
+ d->m_items.clear();
+ d->m_widget->setCurrentWidget(d->m_searchResultTreeView);
navigateStateChanged();
}
void SearchResultWindow::showNoMatchesFound()
{
- m_replaceTextEdit->setEnabled(false);
- m_replaceButton->setEnabled(false);
- m_widget->setCurrentWidget(m_noMatchesFoundDisplay);
+ d->m_replaceTextEdit->setEnabled(false);
+ d->m_replaceButton->setEnabled(false);
+ d->m_widget->setCurrentWidget(d->m_noMatchesFoundDisplay);
}
bool SearchResultWindow::isEmpty() const
{
- return (m_searchResultTreeView->model()->rowCount() < 1);
+ return (d->m_searchResultTreeView->model()->rowCount() < 1);
}
int SearchResultWindow::numberOfResults() const
{
- return m_items.count();
+ return d->m_items.count();
}
bool SearchResultWindow::hasFocus()
{
- return m_searchResultTreeView->hasFocus() || (m_isShowingReplaceUI && m_replaceTextEdit->hasFocus());
+ return d->m_searchResultTreeView->hasFocus() || (d->m_isShowingReplaceUI && d->m_replaceTextEdit->hasFocus());
}
bool SearchResultWindow::canFocus()
{
- return !m_items.isEmpty();
+ return !d->m_items.isEmpty();
}
void SearchResultWindow::setFocus()
{
- if (!m_items.isEmpty()) {
- if (!m_isShowingReplaceUI) {
- m_searchResultTreeView->setFocus();
+ if (!d->m_items.isEmpty()) {
+ if (!d->m_isShowingReplaceUI) {
+ d->m_searchResultTreeView->setFocus();
} else {
- if (!m_widget->focusWidget()
- || m_widget->focusWidget() == m_replaceTextEdit
- || m_focusReplaceEdit) {
- m_replaceTextEdit->setFocus();
- m_replaceTextEdit->selectAll();
+ if (!d->m_widget->focusWidget()
+ || d->m_widget->focusWidget() == d->m_replaceTextEdit
+ || d->m_focusReplaceEdit) {
+ d->m_replaceTextEdit->setFocus();
+ d->m_replaceTextEdit->selectAll();
} else {
- m_searchResultTreeView->setFocus();
+ d->m_searchResultTreeView->setFocus();
}
}
}
@@ -242,21 +263,21 @@ void SearchResultWindow::setFocus()
void SearchResultWindow::setTextEditorFont(const QFont &font)
{
- m_searchResultTreeView->setTextEditorFont(font);
+ d->m_searchResultTreeView->setTextEditorFont(font);
}
void SearchResultWindow::handleJumpToSearchResult(int index, bool /* checked */)
{
- QTC_ASSERT(m_currentSearch, return);
- m_currentSearch->activated(m_items.at(index));
+ QTC_ASSERT(d->m_currentSearch, return);
+ d->m_currentSearch->activated(d->m_items.at(index));
}
void SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText,
int searchTermStart, int searchTermLength, const QVariant &userData)
{
//qDebug()<<"###"<<fileName;
- m_widget->setCurrentWidget(m_searchResultTreeView);
- int index = m_items.size();
+ d->m_widget->setCurrentWidget(d->m_searchResultTreeView);
+ int index = d->m_items.size();
SearchResultItem item;
item.fileName = fileName;
item.lineNumber = lineNumber;
@@ -265,34 +286,34 @@ void SearchResultWindow::addResult(const QString &fileName, int lineNumber, cons
item.searchTermLength = searchTermLength;
item.userData = userData;
item.index = index;
- m_items.append(item);
- m_searchResultTreeView->appendResultLine(index, fileName, lineNumber, rowText, searchTermStart, searchTermLength);
+ d->m_items.append(item);
+ d->m_searchResultTreeView->appendResultLine(index, fileName, lineNumber, rowText, searchTermStart, searchTermLength);
if (index == 0) {
- m_replaceTextEdit->setEnabled(true);
+ d->m_replaceTextEdit->setEnabled(true);
// We didn't have an item before, set the focus to the search widget
- m_focusReplaceEdit = true;
+ d->m_focusReplaceEdit = true;
setFocus();
- m_focusReplaceEdit = false;
- m_searchResultTreeView->selectionModel()->select(m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select);
+ d->m_focusReplaceEdit = false;
+ d->m_searchResultTreeView->selectionModel()->select(d->m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select);
emit navigateStateChanged();
}
}
void SearchResultWindow::handleExpandCollapseToolButton(bool checked)
{
- m_searchResultTreeView->setAutoExpandResults(checked);
+ d->m_searchResultTreeView->setAutoExpandResults(checked);
if (checked)
- m_searchResultTreeView->expandAll();
+ d->m_searchResultTreeView->expandAll();
else
- m_searchResultTreeView->collapseAll();
+ d->m_searchResultTreeView->collapseAll();
}
void SearchResultWindow::readSettings()
{
QSettings *s = Core::ICore::instance()->settings();
if (s) {
- s->beginGroup(SETTINGSKEYSECTIONNAME);
- m_expandCollapseToolButton->setChecked(s->value(SETTINGSKEYEXPANDRESULTS, m_initiallyExpand).toBool());
+ s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME));
+ d->m_expandCollapseToolButton->setChecked(s->value(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_initiallyExpand).toBool());
s->endGroup();
}
}
@@ -301,8 +322,8 @@ void SearchResultWindow::writeSettings()
{
QSettings *s = Core::ICore::instance()->settings();
if (s) {
- s->beginGroup(SETTINGSKEYSECTIONNAME);
- s->setValue(SETTINGSKEYEXPANDRESULTS, m_expandCollapseToolButton->isChecked());
+ s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME));
+ s->setValue(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_expandCollapseToolButton->isChecked());
s->endGroup();
}
}
@@ -314,32 +335,32 @@ int SearchResultWindow::priorityInStatusBar() const
bool SearchResultWindow::canNext()
{
- return m_items.count() > 0;
+ return d->m_items.count() > 0;
}
bool SearchResultWindow::canPrevious()
{
- return m_items.count() > 0;
+ return d->m_items.count() > 0;
}
void SearchResultWindow::goToNext()
{
- if (m_items.count() == 0)
+ if (d->m_items.count() == 0)
return;
- QModelIndex idx = m_searchResultTreeView->model()->next(m_searchResultTreeView->currentIndex());
+ QModelIndex idx = d->m_searchResultTreeView->model()->next(d->m_searchResultTreeView->currentIndex());
if (idx.isValid()) {
- m_searchResultTreeView->setCurrentIndex(idx);
- m_searchResultTreeView->emitJumpToSearchResult(idx);
+ d->m_searchResultTreeView->setCurrentIndex(idx);
+ d->m_searchResultTreeView->emitJumpToSearchResult(idx);
}
}
void SearchResultWindow::goToPrev()
{
- if (!m_searchResultTreeView->model()->rowCount())
+ if (!d->m_searchResultTreeView->model()->rowCount())
return;
- QModelIndex idx = m_searchResultTreeView->model()->prev(m_searchResultTreeView->currentIndex());
+ QModelIndex idx = d->m_searchResultTreeView->model()->prev(d->m_searchResultTreeView->currentIndex());
if (idx.isValid()) {
- m_searchResultTreeView->setCurrentIndex(idx);
- m_searchResultTreeView->emitJumpToSearchResult(idx);
+ d->m_searchResultTreeView->setCurrentIndex(idx);
+ d->m_searchResultTreeView->emitJumpToSearchResult(idx);
}
}
@@ -347,3 +368,6 @@ bool SearchResultWindow::canNavigate()
{
return true;
}
+
+} // namespace Find
+
diff --git a/src/plugins/find/searchresultwindow.h b/src/plugins/find/searchresultwindow.h
index 39713fa853..c8f38285bc 100644
--- a/src/plugins/find/searchresultwindow.h
+++ b/src/plugins/find/searchresultwindow.h
@@ -31,20 +31,19 @@
#define SEARCHRESULTWINDOW_H
#include "find_global.h"
-#include "searchresulttreeview.h"
-#include <coreplugin/ioutputpane.h>
+#include <QtCore/QVariant>
+#include <coreplugin/ioutputpane.h>
QT_BEGIN_NAMESPACE
-class QStackedWidget;
-class QListWidget;
-class QToolButton;
-class QLabel;
+class QFont;
QT_END_NAMESPACE
namespace Find {
-
+namespace Internal {
+ class SearchResultTreeView;
+}
class SearchResultWindow;
struct FIND_EXPORT SearchResultItem
@@ -70,6 +69,7 @@ signals:
friend class SearchResultWindow;
};
+struct SearchResultWindowPrivate;
class FIND_EXPORT SearchResultWindow : public Core::IOutputPane
{
Q_OBJECT
@@ -81,7 +81,7 @@ public:
};
SearchResultWindow();
- ~SearchResultWindow();
+ virtual ~SearchResultWindow();
QWidget *outputWidget(QWidget *);
QList<QWidget*> toolBarWidgets() const;
@@ -127,18 +127,7 @@ private:
void writeSettings();
QList<SearchResultItem> checkedItems() const;
- Internal::SearchResultTreeView *m_searchResultTreeView;
- QListWidget *m_noMatchesFoundDisplay;
- QToolButton *m_expandCollapseToolButton;
- QLabel *m_replaceLabel;
- QLineEdit *m_replaceTextEdit;
- QToolButton *m_replaceButton;
- static const bool m_initiallyExpand = false;
- QStackedWidget *m_widget;
- SearchResult *m_currentSearch;
- QList<SearchResultItem> m_items;
- bool m_isShowingReplaceUI;
- bool m_focusReplaceEdit;
+ SearchResultWindowPrivate *d;
};
} // namespace Find
diff --git a/src/plugins/locator/basefilefilter.h b/src/plugins/locator/basefilefilter.h
index 328814ff87..ee94269446 100644
--- a/src/plugins/locator/basefilefilter.h
+++ b/src/plugins/locator/basefilefilter.h
@@ -33,8 +33,7 @@
#include "locator_global.h"
#include "ilocatorfilter.h"
-#include <QtCore/QString>
-#include <QtCore/QList>
+#include <QtCore/QStringList>
namespace Locator {
@@ -51,6 +50,10 @@ protected:
virtual void updateFiles();
void generateFileNames();
+ inline QStringList &files() { return m_files; }
+ inline const QStringList &files() const { return m_files; }
+
+private:
QStringList m_files;
QStringList m_fileNames;
QStringList m_previousResultPaths;
diff --git a/src/plugins/locator/directoryfilter.cpp b/src/plugins/locator/directoryfilter.cpp
index b20d54d822..aa2dc8afc3 100644
--- a/src/plugins/locator/directoryfilter.cpp
+++ b/src/plugins/locator/directoryfilter.cpp
@@ -58,7 +58,7 @@ QByteArray DirectoryFilter::saveState() const
out << m_filters;
out << shortcutString();
out << isIncludedByDefault();
- out << m_files;
+ out << files();
return value;
}
@@ -76,7 +76,7 @@ bool DirectoryFilter::restoreState(const QByteArray &state)
in >> m_filters;
in >> shortcut;
in >> defaultFilter;
- in >> m_files;
+ in >> files();
setShortcutString(shortcut);
setIncludedByDefault(defaultFilter);
@@ -184,14 +184,14 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
future.setProgressRange(0, MAX);
if (m_directories.count() < 1) {
QMutexLocker locker(&m_lock);
- m_files.clear();
+ files().clear();
generateFileNames();
future.setProgressValueAndText(MAX, tr("%1 filter update: 0 files").arg(m_name));
return;
}
int progress = 0;
int MAX_PER = MAX;
- QStringList files;
+ QStringList filesFound;
QStack<QDir> dirs;
QStack<int> progressValues;
QStack<bool> processedValues;
@@ -209,7 +209,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
while (!dirs.isEmpty() && !future.isCanceled()) {
if (future.isProgressUpdateNeeded()) {
future.setProgressValueAndText(progress,
- tr("%1 filter update: %n files", 0, files.size()).arg(m_name));
+ tr("%1 filter update: %n files", 0, filesFound.size()).arg(m_name));
}
QDir dir = dirs.pop();
int dirProgressMax = progressValues.pop();
@@ -225,7 +225,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
QDir::Files|QDir::Hidden,
QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
foreach (const QString &file, fileEntries)
- files.append(dir.path()+ QLatin1Char('/') +file);
+ filesFound.append(dir.path()+ QLatin1Char('/') +file);
progress += dirProgressMax;
} else {
int subProgress = dirProgressMax/(subDirs.size()+1);
@@ -246,7 +246,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
if (!future.isCanceled()) {
QMutexLocker locker(&m_lock);
- m_files = files;
+ files() = filesFound;
generateFileNames();
future.setProgressValue(MAX);
} else {
diff --git a/src/plugins/locator/directoryfilter.h b/src/plugins/locator/directoryfilter.h
index 3b00cae690..24c86f84b9 100644
--- a/src/plugins/locator/directoryfilter.h
+++ b/src/plugins/locator/directoryfilter.h
@@ -38,8 +38,6 @@
#include <QtCore/QByteArray>
#include <QtCore/QFutureInterface>
#include <QtCore/QMutex>
-#include <QtGui/QWidget>
-#include <QtGui/QDialog>
namespace Locator {
namespace Internal {
diff --git a/src/plugins/locator/filesystemfilter.cpp b/src/plugins/locator/filesystemfilter.cpp
index d632147569..021717bd18 100644
--- a/src/plugins/locator/filesystemfilter.cpp
+++ b/src/plugins/locator/filesystemfilter.cpp
@@ -30,6 +30,7 @@
#include "filesystemfilter.h"
#include "locatorwidget.h"
#include <coreplugin/editormanager/ieditor.h>
+#include <coreplugin/editormanager/editormanager.h>
#include <QtCore/QDir>
diff --git a/src/plugins/locator/filesystemfilter.h b/src/plugins/locator/filesystemfilter.h
index 51f474ca88..07ab3414a5 100644
--- a/src/plugins/locator/filesystemfilter.h
+++ b/src/plugins/locator/filesystemfilter.h
@@ -33,13 +33,15 @@
#include "ilocatorfilter.h"
#include "ui_filesystemfilter.h"
-#include <coreplugin/editormanager/editormanager.h>
-
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QByteArray>
#include <QtCore/QFutureInterface>
+namespace Core {
+ class EditorManager;
+}
+
namespace Locator {
namespace Internal {
diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp
index 8f3458b3a5..1096a573ba 100644
--- a/src/plugins/locator/locatorwidget.cpp
+++ b/src/plugins/locator/locatorwidget.cpp
@@ -53,6 +53,7 @@ QT_END_NAMESPACE
#include <QtCore/QFile>
#include <QtCore/QTimer>
#include <QtCore/QSettings>
+#include <QtCore/QEvent>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QContextMenuEvent>
diff --git a/src/plugins/locator/locatorwidget.h b/src/plugins/locator/locatorwidget.h
index 4e68c3825e..60d4330a3e 100644
--- a/src/plugins/locator/locatorwidget.h
+++ b/src/plugins/locator/locatorwidget.h
@@ -32,7 +32,6 @@
#include "locatorplugin.h"
-#include <QtCore/QEvent>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
@@ -59,7 +58,7 @@ class LocatorWidget
Q_OBJECT
public:
- LocatorWidget(LocatorPlugin *qop);
+ explicit LocatorWidget(LocatorPlugin *qop);
void updateFilterList();
diff --git a/src/plugins/locator/opendocumentsfilter.cpp b/src/plugins/locator/opendocumentsfilter.cpp
index 506af445c0..fdf0fcf769 100644
--- a/src/plugins/locator/opendocumentsfilter.cpp
+++ b/src/plugins/locator/opendocumentsfilter.cpp
@@ -29,6 +29,9 @@
#include "opendocumentsfilter.h"
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/editormanager/ieditor.h>
+
Q_DECLARE_METATYPE(Core::IEditor*);
using namespace Core;
diff --git a/src/plugins/locator/opendocumentsfilter.h b/src/plugins/locator/opendocumentsfilter.h
index edf0276bc4..3b419b980b 100644
--- a/src/plugins/locator/opendocumentsfilter.h
+++ b/src/plugins/locator/opendocumentsfilter.h
@@ -32,15 +32,16 @@
#include "ilocatorfilter.h"
+#include <coreplugin/editormanager/openeditorsmodel.h>
+
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QByteArray>
#include <QtCore/QFutureInterface>
-#include <QtGui/QWidget>
-#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/editormanager/openeditorsmodel.h>
-#include <coreplugin/editormanager/ieditor.h>
+namespace Core {
+ class EditorManager;
+}
namespace Locator {
namespace Internal {
@@ -50,7 +51,7 @@ class OpenDocumentsFilter : public Locator::ILocatorFilter
Q_OBJECT
public:
- OpenDocumentsFilter(Core::EditorManager *editorManager);
+ explicit OpenDocumentsFilter(Core::EditorManager *editorManager);
QString displayName() const { return tr("Open documents"); }
QString id() const { return "Open documents"; }
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Medium; }
diff --git a/src/plugins/projectexplorer/allprojectsfilter.cpp b/src/plugins/projectexplorer/allprojectsfilter.cpp
index f1df6d89c7..3d6c46f9b4 100644
--- a/src/plugins/projectexplorer/allprojectsfilter.cpp
+++ b/src/plugins/projectexplorer/allprojectsfilter.cpp
@@ -58,13 +58,13 @@ void AllProjectsFilter::updateFiles()
if (m_filesUpToDate)
return;
m_filesUpToDate = true;
- m_files.clear();
+ files().clear();
SessionManager *session = m_projectExplorer->session();
if (!session)
return;
foreach (Project *project, session->projects())
- m_files += project->files(Project::AllFiles);
- qSort(m_files);
+ files().append(project->files(Project::AllFiles));
+ qSort(files());
generateFileNames();
}
diff --git a/src/plugins/projectexplorer/currentprojectfilter.cpp b/src/plugins/projectexplorer/currentprojectfilter.cpp
index 78ba8c26de..1712fa9371 100644
--- a/src/plugins/projectexplorer/currentprojectfilter.cpp
+++ b/src/plugins/projectexplorer/currentprojectfilter.cpp
@@ -63,11 +63,11 @@ void CurrentProjectFilter::updateFiles()
if (m_filesUpToDate)
return;
m_filesUpToDate = true;
- m_files.clear();
+ files().clear();
if (!m_project)
return;
- m_files = m_project->files(Project::AllFiles);
- qSort(m_files);
+ files() = m_project->files(Project::AllFiles);
+ qSort(files());
generateFileNames();
}
diff --git a/src/plugins/resourceeditor/resourceeditorw.h b/src/plugins/resourceeditor/resourceeditorw.h
index e0a2e5f7b2..bdcba53949 100644
--- a/src/plugins/resourceeditor/resourceeditorw.h
+++ b/src/plugins/resourceeditor/resourceeditorw.h
@@ -33,7 +33,6 @@
#include <coreplugin/ifile.h>
#include <coreplugin/editormanager/ieditor.h>
-#include <QtGui/QWidget>
#include <QtCore/QPointer>
namespace SharedTools {
diff --git a/src/plugins/welcome/communitywelcomepagewidget.cpp b/src/plugins/welcome/communitywelcomepagewidget.cpp
index a8548d29fd..396ca338c5 100644
--- a/src/plugins/welcome/communitywelcomepagewidget.cpp
+++ b/src/plugins/welcome/communitywelcomepagewidget.cpp
@@ -33,6 +33,7 @@
#include "rssfetcher.h"
#include <QtCore/QMap>
+#include <QtCore/QUrl>
#include <QtGui/QDesktopServices>
#include <QtGui/QTreeWidgetItem>
diff --git a/src/plugins/welcome/communitywelcomepagewidget.h b/src/plugins/welcome/communitywelcomepagewidget.h
index d818e3074f..228ff5ccc2 100644
--- a/src/plugins/welcome/communitywelcomepagewidget.h
+++ b/src/plugins/welcome/communitywelcomepagewidget.h
@@ -30,7 +30,7 @@
#ifndef COMMUNITYWELCOMEPAGEWIDGET_H
#define COMMUNITYWELCOMEPAGEWIDGET_H
-#include <QWidget>
+#include <QtGui/QWidget>
namespace Welcome {
namespace Internal {
@@ -46,7 +46,7 @@ class CommunityWelcomePageWidget : public QWidget
Q_OBJECT
public:
- CommunityWelcomePageWidget(QWidget *parent = 0);
+ explicit CommunityWelcomePageWidget(QWidget *parent = 0);
~CommunityWelcomePageWidget();
private slots:
diff --git a/src/plugins/welcome/rssfetcher.h b/src/plugins/welcome/rssfetcher.h
index e5fc508e44..e046eead0b 100644
--- a/src/plugins/welcome/rssfetcher.h
+++ b/src/plugins/welcome/rssfetcher.h
@@ -30,12 +30,12 @@
#ifndef RSSFETCHER_H
#define RSSFETCHER_H
-#include <QtCore/QUrl>
#include <QtCore/QXmlStreamReader>
#include <QtNetwork/QNetworkAccessManager>
QT_BEGIN_NAMESPACE
class QNetworkReply;
+class QUrl;
QT_END_NAMESPACE
namespace Welcome {
@@ -45,7 +45,7 @@ class RSSFetcher : public QObject
{
Q_OBJECT
public:
- RSSFetcher(int maxItems, QObject *parent = 0);
+ explicit RSSFetcher(int maxItems, QObject *parent = 0);
signals:
void newsItemReady(const QString& title, const QString& desciption, const QString& url);