forked from qt-creator/qt-creator
Header cleaning mainly in find/cpaster.
This commit is contained in:
@@ -38,6 +38,9 @@
|
|||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/messageoutputwindow.h>
|
#include <coreplugin/messageoutputwindow.h>
|
||||||
|
|
||||||
|
#include <QtGui/QListWidget>
|
||||||
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
using namespace CodePaster;
|
using namespace CodePaster;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,13 @@
|
|||||||
|
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
#include <QtGui/QListWidget>
|
|
||||||
#include <QtNetwork/QHttp>
|
#include <QtNetwork/QHttp>
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
#include <QtNetwork/QNetworkReply>
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QListWidget;
|
||||||
|
class QNetworkReply;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <QtGui/QGroupBox>
|
#include <QtGui/QGroupBox>
|
||||||
#include <QtGui/QFormLayout>
|
#include <QtGui/QFormLayout>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
|
#include <QtGui/QLabel>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,8 @@
|
|||||||
#ifndef CODEPASTERSETTINGSPAGE_H
|
#ifndef CODEPASTERSETTINGSPAGE_H
|
||||||
#define CODEPASTERSETTINGSPAGE_H
|
#define CODEPASTERSETTINGSPAGE_H
|
||||||
|
|
||||||
#include "ui_settingspage.h"
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtCore/QUrl>
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QSettings;
|
class QSettings;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -36,16 +36,15 @@
|
|||||||
#include "codepasterprotocol.h"
|
#include "codepasterprotocol.h"
|
||||||
#include "pastebindotcomprotocol.h"
|
#include "pastebindotcomprotocol.h"
|
||||||
#include "pastebindotcaprotocol.h"
|
#include "pastebindotcaprotocol.h"
|
||||||
|
#include "settingspage.h"
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/filemanager.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/messageoutputwindow.h>
|
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
|
|
||||||
@@ -55,9 +54,7 @@
|
|||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QClipboard>
|
#include <QtGui/QClipboard>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QMessageBox>
|
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QListWidget>
|
|
||||||
|
|
||||||
using namespace CodePaster;
|
using namespace CodePaster;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|||||||
@@ -30,22 +30,18 @@
|
|||||||
#ifndef CODEPASTERPLUGIN_H
|
#ifndef CODEPASTERPLUGIN_H
|
||||||
#define 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 <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QListWidget;
|
class QAction;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace CodePaster {
|
class Protocol;
|
||||||
|
|
||||||
|
namespace CodePaster {
|
||||||
|
class SettingsPage;
|
||||||
class CustomFetcher;
|
class CustomFetcher;
|
||||||
class CustomPoster;
|
class CustomPoster;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
#include "pastebindotcaprotocol.h"
|
#include "pastebindotcaprotocol.h"
|
||||||
#include "cgi.h"
|
#include "cgi.h"
|
||||||
|
|
||||||
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
PasteBinDotCaProtocol::PasteBinDotCaProtocol()
|
PasteBinDotCaProtocol::PasteBinDotCaProtocol()
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
#include <QtNetwork/QNetworkReply>
|
|
||||||
#include <QtNetwork/QHttp>
|
#include <QtNetwork/QHttp>
|
||||||
|
|
||||||
class PasteBinDotCaProtocol : public Protocol
|
class PasteBinDotCaProtocol : public Protocol
|
||||||
|
|||||||
@@ -29,16 +29,10 @@
|
|||||||
|
|
||||||
#include "pastebindotcomprotocol.h"
|
#include "pastebindotcomprotocol.h"
|
||||||
#include "pastebindotcomsettings.h"
|
#include "pastebindotcomsettings.h"
|
||||||
#include <coreplugin/coreconstants.h>
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
|
||||||
#include <coreplugin/messageoutputwindow.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtNetwork/QHttp>
|
#include <QtNetwork/QNetworkReply>
|
||||||
#include <QtGui/QApplication>
|
|
||||||
#include <QtGui/QClipboard>
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
#include <QtNetwork/QNetworkReply>
|
|
||||||
#include <QtNetwork/QHttp>
|
#include <QtNetwork/QHttp>
|
||||||
|
|
||||||
class PasteBinDotComSettings;
|
class PasteBinDotComSettings;
|
||||||
|
|||||||
@@ -29,11 +29,12 @@
|
|||||||
|
|
||||||
#include "pasteview.h"
|
#include "pasteview.h"
|
||||||
|
|
||||||
#include <QFontMetrics>
|
#include <QtGui/QFontMetrics>
|
||||||
#include <QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QScrollBar>
|
#include <QtGui/QScrollBar>
|
||||||
#include <QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
#include <QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
|
||||||
class ColumnIndicatorTextEdit : public QTextEdit
|
class ColumnIndicatorTextEdit : public QTextEdit
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,17 +30,16 @@
|
|||||||
#ifndef PASTEVIEW_H
|
#ifndef PASTEVIEW_H
|
||||||
#define PASTEVIEW_H
|
#define PASTEVIEW_H
|
||||||
|
|
||||||
#include "splitter.h"
|
|
||||||
#include "ui_pasteview.h"
|
#include "ui_pasteview.h"
|
||||||
|
#include "splitter.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QtGui/QDialog>
|
||||||
#include <QByteArray>
|
|
||||||
|
|
||||||
class PasteView : public QDialog
|
class PasteView : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PasteView(QWidget *parent);
|
explicit PasteView(QWidget *parent);
|
||||||
~PasteView();
|
~PasteView();
|
||||||
|
|
||||||
int show(const QString &user, const QString &description, const QString &comment,
|
int show(const QString &user, const QString &description, const QString &comment,
|
||||||
|
|||||||
@@ -30,13 +30,8 @@
|
|||||||
#ifndef PROTOCOL_H
|
#ifndef PROTOCOL_H
|
||||||
#define PROTOCOL_H
|
#define PROTOCOL_H
|
||||||
|
|
||||||
#include "settingspage.h"
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QString>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -35,8 +35,6 @@
|
|||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QUrl>
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|||||||
@@ -739,11 +739,11 @@ void FakeVimPluginPrivate::windowCommand(int key)
|
|||||||
|
|
||||||
void FakeVimPluginPrivate::find(bool reverse)
|
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->setUseFakeVim(true);
|
||||||
plugin->openFindToolBar(reverse
|
plugin->openFindToolBar(reverse
|
||||||
? Find::Internal::FindPlugin::FindBackward
|
? Find::FindPlugin::FindBackward
|
||||||
: Find::Internal::FindPlugin::FindForward);
|
: Find::FindPlugin::FindForward);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -847,8 +847,8 @@ void FakeVimPluginPrivate::setUseFakeVim(const QVariant &value)
|
|||||||
{
|
{
|
||||||
//qDebug() << "SET USE FAKEVIM" << value;
|
//qDebug() << "SET USE FAKEVIM" << value;
|
||||||
bool on = value.toBool();
|
bool on = value.toBool();
|
||||||
if (Find::Internal::FindPlugin::instance())
|
if (Find::FindPlugin::instance())
|
||||||
Find::Internal::FindPlugin::instance()->setUseFakeVim(on);
|
Find::FindPlugin::instance()->setUseFakeVim(on);
|
||||||
if (on) {
|
if (on) {
|
||||||
Core::EditorManager::instance()->showEditorStatusBar(
|
Core::EditorManager::instance()->showEditorStatusBar(
|
||||||
QLatin1String(Constants::MINI_BUFFER),
|
QLatin1String(Constants::MINI_BUFFER),
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Find;
|
using namespace Find;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "ifindsupport.h"
|
#include "ifindsupport.h"
|
||||||
|
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "findtoolbar.h"
|
#include "findtoolbar.h"
|
||||||
#include "findtoolwindow.h"
|
#include "findtoolwindow.h"
|
||||||
#include "searchresultwindow.h"
|
#include "searchresultwindow.h"
|
||||||
|
#include "ifindfilter.h"
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
@@ -46,6 +47,8 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
|
#include <QtGui/QStringListModel>
|
||||||
|
#include <QtGui/QAction>
|
||||||
|
|
||||||
#include <QtCore/QtPlugin>
|
#include <QtCore/QtPlugin>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
@@ -70,43 +73,64 @@ namespace {
|
|||||||
const int MAX_COMPLETIONS = 50;
|
const int MAX_COMPLETIONS = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace Find;
|
namespace Find {
|
||||||
using namespace Find::Internal;
|
|
||||||
|
|
||||||
FindPlugin *FindPlugin::m_instance = 0;
|
struct FindPluginPrivate {
|
||||||
|
explicit FindPluginPrivate(FindPlugin *q);
|
||||||
|
|
||||||
FindPlugin::FindPlugin()
|
//variables
|
||||||
: m_currentDocumentFind(0),
|
static FindPlugin *m_instance;
|
||||||
m_findToolBar(0),
|
|
||||||
m_findDialog(0),
|
QHash<IFindFilter *, QAction *> m_filterActions;
|
||||||
m_findCompletionModel(new QStringListModel(this)),
|
|
||||||
m_replaceCompletionModel(new QStringListModel(this))
|
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))
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_instance, return);
|
}
|
||||||
m_instance = this;
|
|
||||||
|
FindPlugin *FindPluginPrivate::m_instance = 0;
|
||||||
|
|
||||||
|
FindPlugin::FindPlugin() : d(new FindPluginPrivate(this))
|
||||||
|
{
|
||||||
|
QTC_ASSERT(!FindPluginPrivate::m_instance, return);
|
||||||
|
FindPluginPrivate::m_instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FindPlugin::~FindPlugin()
|
FindPlugin::~FindPlugin()
|
||||||
{
|
{
|
||||||
m_instance = 0;
|
FindPluginPrivate::m_instance = 0;
|
||||||
delete m_currentDocumentFind;
|
delete d->m_currentDocumentFind;
|
||||||
delete m_findToolBar;
|
delete d->m_findToolBar;
|
||||||
delete m_findDialog;
|
delete d->m_findDialog;
|
||||||
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
FindPlugin *FindPlugin::instance()
|
FindPlugin *FindPlugin::instance()
|
||||||
{
|
{
|
||||||
return m_instance;
|
return FindPluginPrivate::m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindPlugin::initialize(const QStringList &, QString *)
|
bool FindPlugin::initialize(const QStringList &, QString *)
|
||||||
{
|
{
|
||||||
setupMenu();
|
setupMenu();
|
||||||
|
|
||||||
m_currentDocumentFind = new CurrentDocumentFind;
|
d->m_currentDocumentFind = new Internal::CurrentDocumentFind;
|
||||||
|
|
||||||
m_findToolBar = new FindToolBar(this, m_currentDocumentFind);
|
d->m_findToolBar = new Internal::FindToolBar(this, d->m_currentDocumentFind);
|
||||||
m_findDialog = new FindToolWindow(this);
|
d->m_findDialog = new Internal::FindToolWindow(this);
|
||||||
SearchResultWindow *searchResultWindow = new SearchResultWindow;
|
SearchResultWindow *searchResultWindow = new SearchResultWindow;
|
||||||
addAutoReleasedObject(searchResultWindow);
|
addAutoReleasedObject(searchResultWindow);
|
||||||
return true;
|
return true;
|
||||||
@@ -120,27 +144,27 @@ void FindPlugin::extensionsInitialized()
|
|||||||
|
|
||||||
void FindPlugin::shutdown()
|
void FindPlugin::shutdown()
|
||||||
{
|
{
|
||||||
m_findToolBar->setVisible(false);
|
d->m_findToolBar->setVisible(false);
|
||||||
m_findToolBar->setParent(0);
|
d->m_findToolBar->setParent(0);
|
||||||
m_currentDocumentFind->removeConnections();
|
d->m_currentDocumentFind->removeConnections();
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::filterChanged()
|
void FindPlugin::filterChanged()
|
||||||
{
|
{
|
||||||
IFindFilter *changedFilter = qobject_cast<IFindFilter *>(sender());
|
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(changedFilter, return);
|
||||||
QTC_ASSERT(action, return);
|
QTC_ASSERT(action, return);
|
||||||
action->setEnabled(changedFilter->isEnabled());
|
action->setEnabled(changedFilter->isEnabled());
|
||||||
bool haveEnabledFilters = false;
|
bool haveEnabledFilters = false;
|
||||||
foreach (IFindFilter *filter, m_filterActions.keys()) {
|
foreach (IFindFilter *filter, d->m_filterActions.keys()) {
|
||||||
if (filter->isEnabled()) {
|
if (filter->isEnabled()) {
|
||||||
haveEnabledFilters = true;
|
haveEnabledFilters = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_openFindDialog->setEnabled(haveEnabledFilters);
|
d->m_openFindDialog->setEnabled(haveEnabledFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::openFindFilter()
|
void FindPlugin::openFindFilter()
|
||||||
@@ -148,12 +172,12 @@ void FindPlugin::openFindFilter()
|
|||||||
QAction *action = qobject_cast<QAction*>(sender());
|
QAction *action = qobject_cast<QAction*>(sender());
|
||||||
QTC_ASSERT(action, return);
|
QTC_ASSERT(action, return);
|
||||||
IFindFilter *filter = action->data().value<IFindFilter *>();
|
IFindFilter *filter = action->data().value<IFindFilter *>();
|
||||||
if (m_currentDocumentFind->candidateIsEnabled())
|
if (d->m_currentDocumentFind->candidateIsEnabled())
|
||||||
m_currentDocumentFind->acceptCandidate();
|
d->m_currentDocumentFind->acceptCandidate();
|
||||||
QString currentFindString = (m_currentDocumentFind->isEnabled() ? m_currentDocumentFind->currentFindString() : "");
|
QString currentFindString = (d->m_currentDocumentFind->isEnabled() ? d->m_currentDocumentFind->currentFindString() : "");
|
||||||
if (!currentFindString.isEmpty())
|
if (!currentFindString.isEmpty())
|
||||||
m_findDialog->setFindText(currentFindString);
|
d->m_findDialog->setFindText(currentFindString);
|
||||||
m_findDialog->open(filter);
|
d->m_findDialog->open(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setupMenu()
|
void FindPlugin::setupMenu()
|
||||||
@@ -182,11 +206,11 @@ void FindPlugin::setupMenu()
|
|||||||
Core::ActionContainer *mfindadvanced = am->createMenu(Constants::M_FIND_ADVANCED);
|
Core::ActionContainer *mfindadvanced = am->createMenu(Constants::M_FIND_ADVANCED);
|
||||||
mfindadvanced->menu()->setTitle(tr("Advanced Find"));
|
mfindadvanced->menu()->setTitle(tr("Advanced Find"));
|
||||||
mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS);
|
mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS);
|
||||||
m_openFindDialog = new QAction(tr("Open Advanced Find..."), this);
|
d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this);
|
||||||
cmd = am->registerAction(m_openFindDialog, QLatin1String("Find.Dialog"), globalcontext);
|
cmd = am->registerAction(d->m_openFindDialog, QLatin1String("Find.Dialog"), globalcontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F")));
|
||||||
mfindadvanced->addAction(cmd);
|
mfindadvanced->addAction(cmd);
|
||||||
connect(m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter()));
|
connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setupFilterMenuItems()
|
void FindPlugin::setupFilterMenuItems()
|
||||||
@@ -198,10 +222,10 @@ void FindPlugin::setupFilterMenuItems()
|
|||||||
QList<int> globalcontext = QList<int>() << Core::Constants::C_GLOBAL_ID;
|
QList<int> globalcontext = QList<int>() << Core::Constants::C_GLOBAL_ID;
|
||||||
|
|
||||||
Core::ActionContainer *mfindadvanced = am->actionContainer(Constants::M_FIND_ADVANCED);
|
Core::ActionContainer *mfindadvanced = am->actionContainer(Constants::M_FIND_ADVANCED);
|
||||||
m_filterActions.clear();
|
d->m_filterActions.clear();
|
||||||
bool haveEnabledFilters = false;
|
bool haveEnabledFilters = false;
|
||||||
foreach (IFindFilter *filter, findInterfaces) {
|
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();
|
bool isEnabled = filter->isEnabled();
|
||||||
if (isEnabled)
|
if (isEnabled)
|
||||||
haveEnabledFilters = true;
|
haveEnabledFilters = true;
|
||||||
@@ -210,17 +234,17 @@ void FindPlugin::setupFilterMenuItems()
|
|||||||
cmd = am->registerAction(action, QLatin1String("FindFilter.")+filter->id(), globalcontext);
|
cmd = am->registerAction(action, QLatin1String("FindFilter.")+filter->id(), globalcontext);
|
||||||
cmd->setDefaultKeySequence(filter->defaultShortcut());
|
cmd->setDefaultKeySequence(filter->defaultShortcut());
|
||||||
mfindadvanced->addAction(cmd);
|
mfindadvanced->addAction(cmd);
|
||||||
m_filterActions.insert(filter, action);
|
d->m_filterActions.insert(filter, action);
|
||||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter()));
|
connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter()));
|
||||||
connect(filter, SIGNAL(changed()), this, SLOT(filterChanged()));
|
connect(filter, SIGNAL(changed()), this, SLOT(filterChanged()));
|
||||||
}
|
}
|
||||||
m_findDialog->setFindFilters(findInterfaces);
|
d->m_findDialog->setFindFilters(findInterfaces);
|
||||||
m_openFindDialog->setEnabled(haveEnabledFilters);
|
d->m_openFindDialog->setEnabled(haveEnabledFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextDocument::FindFlags FindPlugin::findFlags() const
|
QTextDocument::FindFlags FindPlugin::findFlags() const
|
||||||
{
|
{
|
||||||
return m_findFlags;
|
return d->m_findFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::setCaseSensitive(bool sensitive)
|
void FindPlugin::setCaseSensitive(bool sensitive)
|
||||||
@@ -244,30 +268,30 @@ void FindPlugin::setFindFlag(QTextDocument::FindFlag flag, bool enabled)
|
|||||||
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
if ((hasFlag && enabled) || (!hasFlag && !enabled))
|
||||||
return;
|
return;
|
||||||
if (enabled)
|
if (enabled)
|
||||||
m_findFlags |= flag;
|
d->m_findFlags |= flag;
|
||||||
else
|
else
|
||||||
m_findFlags &= ~flag;
|
d->m_findFlags &= ~flag;
|
||||||
if (flag != QTextDocument::FindBackward)
|
if (flag != QTextDocument::FindBackward)
|
||||||
emit findFlagsChanged();
|
emit findFlagsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindPlugin::hasFindFlag(QTextDocument::FindFlag flag)
|
bool FindPlugin::hasFindFlag(QTextDocument::FindFlag flag)
|
||||||
{
|
{
|
||||||
return m_findFlags & flag;
|
return d->m_findFlags & flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::writeSettings()
|
void FindPlugin::writeSettings()
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup("Find");
|
settings->beginGroup("Find");
|
||||||
settings->setValue("Backward", QVariant((m_findFlags & QTextDocument::FindBackward) != 0));
|
settings->setValue("Backward", QVariant((d->m_findFlags & QTextDocument::FindBackward) != 0));
|
||||||
settings->setValue("CaseSensitively", QVariant((m_findFlags & QTextDocument::FindCaseSensitively) != 0));
|
settings->setValue("CaseSensitively", QVariant((d->m_findFlags & QTextDocument::FindCaseSensitively) != 0));
|
||||||
settings->setValue("WholeWords", QVariant((m_findFlags & QTextDocument::FindWholeWords) != 0));
|
settings->setValue("WholeWords", QVariant((d->m_findFlags & QTextDocument::FindWholeWords) != 0));
|
||||||
settings->setValue("FindStrings", m_findCompletions);
|
settings->setValue("FindStrings", d->m_findCompletions);
|
||||||
settings->setValue("ReplaceStrings", m_replaceCompletions);
|
settings->setValue("ReplaceStrings", d->m_replaceCompletions);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
m_findToolBar->writeSettings();
|
d->m_findToolBar->writeSettings();
|
||||||
m_findDialog->writeSettings();
|
d->m_findDialog->writeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::readSettings()
|
void FindPlugin::readSettings()
|
||||||
@@ -279,24 +303,24 @@ void FindPlugin::readSettings()
|
|||||||
setCaseSensitive(settings->value("CaseSensitively", false).toBool());
|
setCaseSensitive(settings->value("CaseSensitively", false).toBool());
|
||||||
setWholeWord(settings->value("WholeWords", false).toBool());
|
setWholeWord(settings->value("WholeWords", false).toBool());
|
||||||
blockSignals(block);
|
blockSignals(block);
|
||||||
m_findCompletions = settings->value("FindStrings").toStringList();
|
d->m_findCompletions = settings->value("FindStrings").toStringList();
|
||||||
m_replaceCompletions = settings->value("ReplaceStrings").toStringList();
|
d->m_replaceCompletions = settings->value("ReplaceStrings").toStringList();
|
||||||
m_findCompletionModel->setStringList(m_findCompletions);
|
d->m_findCompletionModel->setStringList(d->m_findCompletions);
|
||||||
m_replaceCompletionModel->setStringList(m_replaceCompletions);
|
d->m_replaceCompletionModel->setStringList(d->m_replaceCompletions);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
m_findToolBar->readSettings();
|
d->m_findToolBar->readSettings();
|
||||||
m_findDialog->readSettings();
|
d->m_findDialog->readSettings();
|
||||||
emit findFlagsChanged(); // would have been done in the setXXX methods above
|
emit findFlagsChanged(); // would have been done in the setXXX methods above
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::updateFindCompletion(const QString &text)
|
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)
|
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)
|
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)
|
void FindPlugin::setUseFakeVim(bool on)
|
||||||
{
|
{
|
||||||
if (m_findToolBar)
|
if (d->m_findToolBar)
|
||||||
m_findToolBar->setUseFakeVim(on);
|
d->m_findToolBar->setUseFakeVim(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPlugin::openFindToolBar(FindDirection direction)
|
void FindPlugin::openFindToolBar(FindDirection direction)
|
||||||
{
|
{
|
||||||
if (m_findToolBar) {
|
if (d->m_findToolBar) {
|
||||||
m_findToolBar->setBackward(direction == FindBackward);
|
d->m_findToolBar->setBackward(direction == FindBackward);
|
||||||
m_findToolBar->openFindToolBar();
|
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)
|
||||||
|
|||||||
@@ -30,22 +30,25 @@
|
|||||||
#ifndef FINDPLUGIN_H
|
#ifndef FINDPLUGIN_H
|
||||||
#define FINDPLUGIN_H
|
#define FINDPLUGIN_H
|
||||||
|
|
||||||
#include "ifindfilter.h"
|
#include "find_global.h"
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <QtCore/QHash>
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtGui/QAction>
|
|
||||||
#include <QtGui/QTextDocument>
|
#include <QtGui/QTextDocument>
|
||||||
#include <QtGui/QStringListModel>
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QStringListModel;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
namespace Internal {
|
class IFindFilter;
|
||||||
|
struct FindPluginPrivate;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
class FindToolBar;
|
class FindToolBar;
|
||||||
class FindToolWindow;
|
class FindToolWindow;
|
||||||
class CurrentDocumentFind;
|
class CurrentDocumentFind;
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
class FIND_EXPORT FindPlugin : public ExtensionSystem::IPlugin
|
class FIND_EXPORT FindPlugin : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
@@ -69,8 +72,8 @@ public:
|
|||||||
QTextDocument::FindFlags findFlags() const;
|
QTextDocument::FindFlags findFlags() const;
|
||||||
void updateFindCompletion(const QString &text);
|
void updateFindCompletion(const QString &text);
|
||||||
void updateReplaceCompletion(const QString &text);
|
void updateReplaceCompletion(const QString &text);
|
||||||
QStringListModel *findCompletionModel() { return m_findCompletionModel; }
|
QStringListModel *findCompletionModel() const;
|
||||||
QStringListModel *replaceCompletionModel() { return m_replaceCompletionModel; }
|
QStringListModel *replaceCompletionModel() const;
|
||||||
void setUseFakeVim(bool on);
|
void setUseFakeVim(bool on);
|
||||||
void openFindToolBar(FindDirection direction);
|
void openFindToolBar(FindDirection direction);
|
||||||
|
|
||||||
@@ -96,22 +99,9 @@ private:
|
|||||||
void readSettings();
|
void readSettings();
|
||||||
|
|
||||||
//variables
|
//variables
|
||||||
static FindPlugin *m_instance;
|
FindPluginPrivate *d;
|
||||||
|
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|
||||||
#endif // FINDPLUGIN_H
|
#endif // FINDPLUGIN_H
|
||||||
|
|||||||
@@ -36,7 +36,10 @@
|
|||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
|
#include <coreplugin/findplaceholder.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -51,6 +54,7 @@
|
|||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QPixmapCache>
|
#include <QtGui/QPixmapCache>
|
||||||
|
#include <QtGui/QStringListModel>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QStringList)
|
Q_DECLARE_METATYPE(QStringList)
|
||||||
Q_DECLARE_METATYPE(Find::IFindFilter*)
|
Q_DECLARE_METATYPE(Find::IFindFilter*)
|
||||||
|
|||||||
@@ -31,29 +31,27 @@
|
|||||||
#define FINDTOOLBAR_H
|
#define FINDTOOLBAR_H
|
||||||
|
|
||||||
#include "ui_findwidget.h"
|
#include "ui_findwidget.h"
|
||||||
#include "ifindfilter.h"
|
|
||||||
#include "currentdocumentfind.h"
|
#include "currentdocumentfind.h"
|
||||||
|
|
||||||
#include <coreplugin/findplaceholder.h>
|
|
||||||
#include <utils/styledbar.h>
|
#include <utils/styledbar.h>
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
#include <QtGui/QStringListModel>
|
namespace Core {
|
||||||
#include <QtGui/QWidget>
|
class FindToolBarPlaceHolder;
|
||||||
#include <QtGui/QLabel>
|
}
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class FindPlugin;
|
class FindPlugin;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
class FindToolBar : public Utils::StyledBar
|
class FindToolBar : public Utils::StyledBar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind);
|
explicit FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind);
|
||||||
~FindToolBar();
|
~FindToolBar();
|
||||||
|
|
||||||
void readSettings();
|
void readSettings();
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
|
#include <QtGui/QStringListModel>
|
||||||
|
#include <QtGui/QCompleter>
|
||||||
|
|
||||||
using namespace Find;
|
using namespace Find;
|
||||||
using namespace Find::Internal;
|
using namespace Find::Internal;
|
||||||
|
|||||||
@@ -34,20 +34,20 @@
|
|||||||
#include "ifindfilter.h"
|
#include "ifindfilter.h"
|
||||||
|
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtGui/QCompleter>
|
|
||||||
#include <QtGui/QWidget>
|
QT_FORWARD_DECLARE_CLASS(QCompleter)
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class FindPlugin;
|
class FindPlugin;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
class FindToolWindow : public QDialog
|
class FindToolWindow : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindToolWindow(FindPlugin *plugin);
|
explicit FindToolWindow(FindPlugin *plugin);
|
||||||
~FindToolWindow();
|
~FindToolWindow();
|
||||||
|
|
||||||
void setFindFilters(const QList<IFindFilter *> &filters);
|
void setFindFilters(const QList<IFindFilter *> &filters);
|
||||||
@@ -70,7 +70,7 @@ private:
|
|||||||
FindPlugin *m_plugin;
|
FindPlugin *m_plugin;
|
||||||
QList<IFindFilter *> m_filters;
|
QList<IFindFilter *> m_filters;
|
||||||
QCompleter *m_findCompleter;
|
QCompleter *m_findCompleter;
|
||||||
QList<QWidget *> m_configWidgets;
|
QWidgetList m_configWidgets;
|
||||||
IFindFilter *m_currentFilter;
|
IFindFilter *m_currentFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
#ifndef SEARCHRESULTTREEITEMS_H
|
#ifndef SEARCHRESULTTREEITEMS_H
|
||||||
#define SEARCHRESULTTREEITEMS_H
|
#define SEARCHRESULTTREEITEMS_H
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/qnamespace.h>
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "searchresulttreeitemdelegate.h"
|
#include "searchresulttreeitemdelegate.h"
|
||||||
|
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
|
#include <QtGui/QKeyEvent>
|
||||||
|
|
||||||
using namespace Find::Internal;
|
using namespace Find::Internal;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#define SEARCHRESULTTREEVIEW_H
|
#define SEARCHRESULTTREEVIEW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include <QtGui/QTreeView>
|
||||||
#include <QtGui/QKeyEvent>
|
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -43,7 +42,7 @@ class SearchResultTreeView : public QTreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SearchResultTreeView(QWidget *parent = 0);
|
explicit SearchResultTreeView(QWidget *parent = 0);
|
||||||
|
|
||||||
void setAutoExpandResults(bool expand);
|
void setAutoExpandResults(bool expand);
|
||||||
void setTextEditorFont(const QFont &font);
|
void setTextEditorFont(const QFont &font);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "searchresultwindow.h"
|
#include "searchresultwindow.h"
|
||||||
#include "searchresulttreemodel.h"
|
#include "searchresulttreemodel.h"
|
||||||
#include "searchresulttreeitems.h"
|
#include "searchresulttreeitems.h"
|
||||||
|
#include "searchresulttreeview.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -43,53 +44,72 @@
|
|||||||
#include <QtGui/QLineEdit>
|
#include <QtGui/QLineEdit>
|
||||||
#include <QtGui/QStackedWidget>
|
#include <QtGui/QStackedWidget>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QFont>
|
||||||
|
|
||||||
using namespace Find;
|
static const char SETTINGSKEYSECTIONNAME[] = "SearchResults";
|
||||||
using namespace Find::Internal;
|
static const char SETTINGSKEYEXPANDRESULTS[] = "ExpandResults";
|
||||||
|
|
||||||
static const QString SETTINGSKEYSECTIONNAME("SearchResults");
|
|
||||||
static const QString SETTINGSKEYEXPANDRESULTS("ExpandResults");
|
|
||||||
|
|
||||||
|
|
||||||
SearchResultWindow::SearchResultWindow()
|
namespace Find {
|
||||||
: m_currentSearch(0),
|
|
||||||
m_isShowingReplaceUI(false),
|
struct SearchResultWindowPrivate {
|
||||||
m_focusReplaceEdit(false)
|
SearchResultWindowPrivate();
|
||||||
|
|
||||||
|
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::SearchResultWindowPrivate()
|
||||||
|
: m_currentSearch(0), m_isShowingReplaceUI(false), m_focusReplaceEdit(false)
|
||||||
{
|
{
|
||||||
m_widget = new QStackedWidget;
|
}
|
||||||
m_widget->setWindowTitle(name());
|
|
||||||
|
|
||||||
m_searchResultTreeView = new SearchResultTreeView(m_widget);
|
SearchResultWindow::SearchResultWindow() : d(new SearchResultWindowPrivate)
|
||||||
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
|
{
|
||||||
m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
d->m_widget = new QStackedWidget;
|
||||||
m_widget->addWidget(m_searchResultTreeView);
|
d->m_widget->setWindowTitle(name());
|
||||||
|
|
||||||
m_noMatchesFoundDisplay = new QListWidget(m_widget);
|
d->m_searchResultTreeView = new Internal::SearchResultTreeView(d->m_widget);
|
||||||
m_noMatchesFoundDisplay->addItem(tr("No matches found!"));
|
d->m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
|
||||||
m_noMatchesFoundDisplay->setFrameStyle(QFrame::NoFrame);
|
d->m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
m_widget->addWidget(m_noMatchesFoundDisplay);
|
d->m_widget->addWidget(d->m_searchResultTreeView);
|
||||||
|
|
||||||
m_expandCollapseToolButton = new QToolButton(m_widget);
|
d->m_noMatchesFoundDisplay = new QListWidget(d->m_widget);
|
||||||
m_expandCollapseToolButton->setAutoRaise(true);
|
d->m_noMatchesFoundDisplay->addItem(tr("No matches found!"));
|
||||||
m_expandCollapseToolButton->setCheckable(true);
|
d->m_noMatchesFoundDisplay->setFrameStyle(QFrame::NoFrame);
|
||||||
m_expandCollapseToolButton->setIcon(QIcon(":/find/images/expand.png"));
|
d->m_widget->addWidget(d->m_noMatchesFoundDisplay);
|
||||||
m_expandCollapseToolButton->setToolTip(tr("Expand All"));
|
|
||||||
|
|
||||||
m_replaceLabel = new QLabel(tr("Replace with:"), m_widget);
|
d->m_expandCollapseToolButton = new QToolButton(d->m_widget);
|
||||||
m_replaceLabel->setContentsMargins(12, 0, 5, 0);
|
d->m_expandCollapseToolButton->setAutoRaise(true);
|
||||||
m_replaceTextEdit = new QLineEdit(m_widget);
|
d->m_expandCollapseToolButton->setCheckable(true);
|
||||||
m_replaceButton = new QToolButton(m_widget);
|
d->m_expandCollapseToolButton->setIcon(QIcon(":/find/images/expand.png"));
|
||||||
m_replaceButton->setToolTip(tr("Replace all occurrences"));
|
d->m_expandCollapseToolButton->setToolTip(tr("Expand All"));
|
||||||
m_replaceButton->setText(tr("Replace"));
|
|
||||||
m_replaceButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
|
||||||
m_replaceButton->setAutoRaise(true);
|
|
||||||
m_replaceTextEdit->setTabOrder(m_replaceTextEdit, m_searchResultTreeView);
|
|
||||||
|
|
||||||
connect(m_searchResultTreeView, SIGNAL(jumpToSearchResult(int,bool)),
|
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)));
|
this, SLOT(handleJumpToSearchResult(int,bool)));
|
||||||
connect(m_expandCollapseToolButton, SIGNAL(toggled(bool)), this, SLOT(handleExpandCollapseToolButton(bool)));
|
connect(d->m_expandCollapseToolButton, SIGNAL(toggled(bool)), this, SLOT(handleExpandCollapseToolButton(bool)));
|
||||||
connect(m_replaceTextEdit, SIGNAL(returnPressed()), this, SLOT(handleReplaceButton()));
|
connect(d->m_replaceTextEdit, SIGNAL(returnPressed()), this, SLOT(handleReplaceButton()));
|
||||||
connect(m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton()));
|
connect(d->m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton()));
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
setShowReplaceUI(false);
|
setShowReplaceUI(false);
|
||||||
@@ -98,55 +118,56 @@ SearchResultWindow::SearchResultWindow()
|
|||||||
SearchResultWindow::~SearchResultWindow()
|
SearchResultWindow::~SearchResultWindow()
|
||||||
{
|
{
|
||||||
writeSettings();
|
writeSettings();
|
||||||
delete m_currentSearch;
|
delete d->m_currentSearch;
|
||||||
m_currentSearch = 0;
|
d->m_currentSearch = 0;
|
||||||
delete m_widget;
|
delete d->m_widget;
|
||||||
m_widget = 0;
|
d->m_widget = 0;
|
||||||
m_items.clear();
|
d->m_items.clear();
|
||||||
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::setTextToReplace(const QString &textToReplace)
|
void SearchResultWindow::setTextToReplace(const QString &textToReplace)
|
||||||
{
|
{
|
||||||
m_replaceTextEdit->setText(textToReplace);
|
d->m_replaceTextEdit->setText(textToReplace);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SearchResultWindow::textToReplace() const
|
QString SearchResultWindow::textToReplace() const
|
||||||
{
|
{
|
||||||
return m_replaceTextEdit->text();
|
return d->m_replaceTextEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::setShowReplaceUI(bool show)
|
void SearchResultWindow::setShowReplaceUI(bool show)
|
||||||
{
|
{
|
||||||
m_searchResultTreeView->model()->setShowReplaceUI(show);
|
d->m_searchResultTreeView->model()->setShowReplaceUI(show);
|
||||||
m_replaceLabel->setVisible(show);
|
d->m_replaceLabel->setVisible(show);
|
||||||
m_replaceTextEdit->setVisible(show);
|
d->m_replaceTextEdit->setVisible(show);
|
||||||
m_replaceButton->setVisible(show);
|
d->m_replaceButton->setVisible(show);
|
||||||
m_isShowingReplaceUI = show;
|
d->m_isShowingReplaceUI = show;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::handleReplaceButton()
|
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
|
// check if button is actually enabled, because this is also triggered
|
||||||
// by pressing return in replace line edit
|
// by pressing return in replace line edit
|
||||||
if (m_replaceButton->isEnabled())
|
if (d->m_replaceButton->isEnabled())
|
||||||
m_currentSearch->replaceButtonClicked(m_replaceTextEdit->text(), checkedItems());
|
d->m_currentSearch->replaceButtonClicked(d->m_replaceTextEdit->text(), checkedItems());
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<SearchResultItem> SearchResultWindow::checkedItems() const
|
QList<SearchResultItem> SearchResultWindow::checkedItems() const
|
||||||
{
|
{
|
||||||
QList<SearchResultItem> result;
|
QList<SearchResultItem> result;
|
||||||
SearchResultTreeModel *model = m_searchResultTreeView->model();
|
Internal::SearchResultTreeModel *model = d->m_searchResultTreeView->model();
|
||||||
const int fileCount = model->rowCount(QModelIndex());
|
const int fileCount = model->rowCount(QModelIndex());
|
||||||
for (int i = 0; i < fileCount; ++i) {
|
for (int i = 0; i < fileCount; ++i) {
|
||||||
QModelIndex fileIndex = model->index(i, 0, QModelIndex());
|
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);
|
Q_ASSERT(fileItem != 0);
|
||||||
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
|
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
|
||||||
QModelIndex textIndex = model->index(rowIndex, 0, fileIndex);
|
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())
|
if (rowItem->checkState())
|
||||||
result << m_items.at(rowItem->index());
|
result << d->m_items.at(rowItem->index());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -158,27 +179,27 @@ void SearchResultWindow::visibilityChanged(bool /*visible*/)
|
|||||||
|
|
||||||
QWidget *SearchResultWindow::outputWidget(QWidget *)
|
QWidget *SearchResultWindow::outputWidget(QWidget *)
|
||||||
{
|
{
|
||||||
return m_widget;
|
return d->m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QWidget*> SearchResultWindow::toolBarWidgets() const
|
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)
|
SearchResult *SearchResultWindow::startNewSearch(SearchMode searchOrSearchAndReplace)
|
||||||
{
|
{
|
||||||
clearContents();
|
clearContents();
|
||||||
setShowReplaceUI(searchOrSearchAndReplace != SearchOnly);
|
setShowReplaceUI(searchOrSearchAndReplace != SearchOnly);
|
||||||
delete m_currentSearch;
|
delete d->m_currentSearch;
|
||||||
m_currentSearch = new SearchResult;
|
d->m_currentSearch = new SearchResult;
|
||||||
return m_currentSearch;
|
return d->m_currentSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::finishSearch()
|
void SearchResultWindow::finishSearch()
|
||||||
{
|
{
|
||||||
if (m_items.count()) {
|
if (d->m_items.count()) {
|
||||||
m_replaceButton->setEnabled(true);
|
d->m_replaceButton->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
showNoMatchesFound();
|
showNoMatchesFound();
|
||||||
}
|
}
|
||||||
@@ -186,55 +207,55 @@ void SearchResultWindow::finishSearch()
|
|||||||
|
|
||||||
void SearchResultWindow::clearContents()
|
void SearchResultWindow::clearContents()
|
||||||
{
|
{
|
||||||
m_replaceTextEdit->setEnabled(false);
|
d->m_replaceTextEdit->setEnabled(false);
|
||||||
m_replaceButton->setEnabled(false);
|
d->m_replaceButton->setEnabled(false);
|
||||||
m_replaceTextEdit->clear();
|
d->m_replaceTextEdit->clear();
|
||||||
m_searchResultTreeView->clear();
|
d->m_searchResultTreeView->clear();
|
||||||
m_items.clear();
|
d->m_items.clear();
|
||||||
m_widget->setCurrentWidget(m_searchResultTreeView);
|
d->m_widget->setCurrentWidget(d->m_searchResultTreeView);
|
||||||
navigateStateChanged();
|
navigateStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::showNoMatchesFound()
|
void SearchResultWindow::showNoMatchesFound()
|
||||||
{
|
{
|
||||||
m_replaceTextEdit->setEnabled(false);
|
d->m_replaceTextEdit->setEnabled(false);
|
||||||
m_replaceButton->setEnabled(false);
|
d->m_replaceButton->setEnabled(false);
|
||||||
m_widget->setCurrentWidget(m_noMatchesFoundDisplay);
|
d->m_widget->setCurrentWidget(d->m_noMatchesFoundDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SearchResultWindow::isEmpty() const
|
bool SearchResultWindow::isEmpty() const
|
||||||
{
|
{
|
||||||
return (m_searchResultTreeView->model()->rowCount() < 1);
|
return (d->m_searchResultTreeView->model()->rowCount() < 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SearchResultWindow::numberOfResults() const
|
int SearchResultWindow::numberOfResults() const
|
||||||
{
|
{
|
||||||
return m_items.count();
|
return d->m_items.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SearchResultWindow::hasFocus()
|
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()
|
bool SearchResultWindow::canFocus()
|
||||||
{
|
{
|
||||||
return !m_items.isEmpty();
|
return !d->m_items.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::setFocus()
|
void SearchResultWindow::setFocus()
|
||||||
{
|
{
|
||||||
if (!m_items.isEmpty()) {
|
if (!d->m_items.isEmpty()) {
|
||||||
if (!m_isShowingReplaceUI) {
|
if (!d->m_isShowingReplaceUI) {
|
||||||
m_searchResultTreeView->setFocus();
|
d->m_searchResultTreeView->setFocus();
|
||||||
} else {
|
} else {
|
||||||
if (!m_widget->focusWidget()
|
if (!d->m_widget->focusWidget()
|
||||||
|| m_widget->focusWidget() == m_replaceTextEdit
|
|| d->m_widget->focusWidget() == d->m_replaceTextEdit
|
||||||
|| m_focusReplaceEdit) {
|
|| d->m_focusReplaceEdit) {
|
||||||
m_replaceTextEdit->setFocus();
|
d->m_replaceTextEdit->setFocus();
|
||||||
m_replaceTextEdit->selectAll();
|
d->m_replaceTextEdit->selectAll();
|
||||||
} else {
|
} else {
|
||||||
m_searchResultTreeView->setFocus();
|
d->m_searchResultTreeView->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,21 +263,21 @@ void SearchResultWindow::setFocus()
|
|||||||
|
|
||||||
void SearchResultWindow::setTextEditorFont(const QFont &font)
|
void SearchResultWindow::setTextEditorFont(const QFont &font)
|
||||||
{
|
{
|
||||||
m_searchResultTreeView->setTextEditorFont(font);
|
d->m_searchResultTreeView->setTextEditorFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::handleJumpToSearchResult(int index, bool /* checked */)
|
void SearchResultWindow::handleJumpToSearchResult(int index, bool /* checked */)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_currentSearch, return);
|
QTC_ASSERT(d->m_currentSearch, return);
|
||||||
m_currentSearch->activated(m_items.at(index));
|
d->m_currentSearch->activated(d->m_items.at(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText,
|
void SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText,
|
||||||
int searchTermStart, int searchTermLength, const QVariant &userData)
|
int searchTermStart, int searchTermLength, const QVariant &userData)
|
||||||
{
|
{
|
||||||
//qDebug()<<"###"<<fileName;
|
//qDebug()<<"###"<<fileName;
|
||||||
m_widget->setCurrentWidget(m_searchResultTreeView);
|
d->m_widget->setCurrentWidget(d->m_searchResultTreeView);
|
||||||
int index = m_items.size();
|
int index = d->m_items.size();
|
||||||
SearchResultItem item;
|
SearchResultItem item;
|
||||||
item.fileName = fileName;
|
item.fileName = fileName;
|
||||||
item.lineNumber = lineNumber;
|
item.lineNumber = lineNumber;
|
||||||
@@ -265,34 +286,34 @@ void SearchResultWindow::addResult(const QString &fileName, int lineNumber, cons
|
|||||||
item.searchTermLength = searchTermLength;
|
item.searchTermLength = searchTermLength;
|
||||||
item.userData = userData;
|
item.userData = userData;
|
||||||
item.index = index;
|
item.index = index;
|
||||||
m_items.append(item);
|
d->m_items.append(item);
|
||||||
m_searchResultTreeView->appendResultLine(index, fileName, lineNumber, rowText, searchTermStart, searchTermLength);
|
d->m_searchResultTreeView->appendResultLine(index, fileName, lineNumber, rowText, searchTermStart, searchTermLength);
|
||||||
if (index == 0) {
|
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
|
// We didn't have an item before, set the focus to the search widget
|
||||||
m_focusReplaceEdit = true;
|
d->m_focusReplaceEdit = true;
|
||||||
setFocus();
|
setFocus();
|
||||||
m_focusReplaceEdit = false;
|
d->m_focusReplaceEdit = false;
|
||||||
m_searchResultTreeView->selectionModel()->select(m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select);
|
d->m_searchResultTreeView->selectionModel()->select(d->m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select);
|
||||||
emit navigateStateChanged();
|
emit navigateStateChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::handleExpandCollapseToolButton(bool checked)
|
void SearchResultWindow::handleExpandCollapseToolButton(bool checked)
|
||||||
{
|
{
|
||||||
m_searchResultTreeView->setAutoExpandResults(checked);
|
d->m_searchResultTreeView->setAutoExpandResults(checked);
|
||||||
if (checked)
|
if (checked)
|
||||||
m_searchResultTreeView->expandAll();
|
d->m_searchResultTreeView->expandAll();
|
||||||
else
|
else
|
||||||
m_searchResultTreeView->collapseAll();
|
d->m_searchResultTreeView->collapseAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::readSettings()
|
void SearchResultWindow::readSettings()
|
||||||
{
|
{
|
||||||
QSettings *s = Core::ICore::instance()->settings();
|
QSettings *s = Core::ICore::instance()->settings();
|
||||||
if (s) {
|
if (s) {
|
||||||
s->beginGroup(SETTINGSKEYSECTIONNAME);
|
s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME));
|
||||||
m_expandCollapseToolButton->setChecked(s->value(SETTINGSKEYEXPANDRESULTS, m_initiallyExpand).toBool());
|
d->m_expandCollapseToolButton->setChecked(s->value(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_initiallyExpand).toBool());
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,8 +322,8 @@ void SearchResultWindow::writeSettings()
|
|||||||
{
|
{
|
||||||
QSettings *s = Core::ICore::instance()->settings();
|
QSettings *s = Core::ICore::instance()->settings();
|
||||||
if (s) {
|
if (s) {
|
||||||
s->beginGroup(SETTINGSKEYSECTIONNAME);
|
s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME));
|
||||||
s->setValue(SETTINGSKEYEXPANDRESULTS, m_expandCollapseToolButton->isChecked());
|
s->setValue(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_expandCollapseToolButton->isChecked());
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -314,32 +335,32 @@ int SearchResultWindow::priorityInStatusBar() const
|
|||||||
|
|
||||||
bool SearchResultWindow::canNext()
|
bool SearchResultWindow::canNext()
|
||||||
{
|
{
|
||||||
return m_items.count() > 0;
|
return d->m_items.count() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SearchResultWindow::canPrevious()
|
bool SearchResultWindow::canPrevious()
|
||||||
{
|
{
|
||||||
return m_items.count() > 0;
|
return d->m_items.count() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWindow::goToNext()
|
void SearchResultWindow::goToNext()
|
||||||
{
|
{
|
||||||
if (m_items.count() == 0)
|
if (d->m_items.count() == 0)
|
||||||
return;
|
return;
|
||||||
QModelIndex idx = m_searchResultTreeView->model()->next(m_searchResultTreeView->currentIndex());
|
QModelIndex idx = d->m_searchResultTreeView->model()->next(d->m_searchResultTreeView->currentIndex());
|
||||||
if (idx.isValid()) {
|
if (idx.isValid()) {
|
||||||
m_searchResultTreeView->setCurrentIndex(idx);
|
d->m_searchResultTreeView->setCurrentIndex(idx);
|
||||||
m_searchResultTreeView->emitJumpToSearchResult(idx);
|
d->m_searchResultTreeView->emitJumpToSearchResult(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SearchResultWindow::goToPrev()
|
void SearchResultWindow::goToPrev()
|
||||||
{
|
{
|
||||||
if (!m_searchResultTreeView->model()->rowCount())
|
if (!d->m_searchResultTreeView->model()->rowCount())
|
||||||
return;
|
return;
|
||||||
QModelIndex idx = m_searchResultTreeView->model()->prev(m_searchResultTreeView->currentIndex());
|
QModelIndex idx = d->m_searchResultTreeView->model()->prev(d->m_searchResultTreeView->currentIndex());
|
||||||
if (idx.isValid()) {
|
if (idx.isValid()) {
|
||||||
m_searchResultTreeView->setCurrentIndex(idx);
|
d->m_searchResultTreeView->setCurrentIndex(idx);
|
||||||
m_searchResultTreeView->emitJumpToSearchResult(idx);
|
d->m_searchResultTreeView->emitJumpToSearchResult(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,3 +368,6 @@ bool SearchResultWindow::canNavigate()
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Find
|
||||||
|
|
||||||
|
|||||||
@@ -31,20 +31,19 @@
|
|||||||
#define SEARCHRESULTWINDOW_H
|
#define SEARCHRESULTWINDOW_H
|
||||||
|
|
||||||
#include "find_global.h"
|
#include "find_global.h"
|
||||||
#include "searchresulttreeview.h"
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
#include <coreplugin/ioutputpane.h>
|
#include <coreplugin/ioutputpane.h>
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QStackedWidget;
|
class QFont;
|
||||||
class QListWidget;
|
|
||||||
class QToolButton;
|
|
||||||
class QLabel;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
|
namespace Internal {
|
||||||
|
class SearchResultTreeView;
|
||||||
|
}
|
||||||
class SearchResultWindow;
|
class SearchResultWindow;
|
||||||
|
|
||||||
struct FIND_EXPORT SearchResultItem
|
struct FIND_EXPORT SearchResultItem
|
||||||
@@ -70,6 +69,7 @@ signals:
|
|||||||
friend class SearchResultWindow;
|
friend class SearchResultWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SearchResultWindowPrivate;
|
||||||
class FIND_EXPORT SearchResultWindow : public Core::IOutputPane
|
class FIND_EXPORT SearchResultWindow : public Core::IOutputPane
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
SearchResultWindow();
|
SearchResultWindow();
|
||||||
~SearchResultWindow();
|
virtual ~SearchResultWindow();
|
||||||
|
|
||||||
QWidget *outputWidget(QWidget *);
|
QWidget *outputWidget(QWidget *);
|
||||||
QList<QWidget*> toolBarWidgets() const;
|
QList<QWidget*> toolBarWidgets() const;
|
||||||
@@ -127,18 +127,7 @@ private:
|
|||||||
void writeSettings();
|
void writeSettings();
|
||||||
QList<SearchResultItem> checkedItems() const;
|
QList<SearchResultItem> checkedItems() const;
|
||||||
|
|
||||||
Internal::SearchResultTreeView *m_searchResultTreeView;
|
SearchResultWindowPrivate *d;
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|||||||
@@ -33,8 +33,7 @@
|
|||||||
#include "locator_global.h"
|
#include "locator_global.h"
|
||||||
#include "ilocatorfilter.h"
|
#include "ilocatorfilter.h"
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QList>
|
|
||||||
|
|
||||||
namespace Locator {
|
namespace Locator {
|
||||||
|
|
||||||
@@ -51,6 +50,10 @@ protected:
|
|||||||
virtual void updateFiles();
|
virtual void updateFiles();
|
||||||
void generateFileNames();
|
void generateFileNames();
|
||||||
|
|
||||||
|
inline QStringList &files() { return m_files; }
|
||||||
|
inline const QStringList &files() const { return m_files; }
|
||||||
|
|
||||||
|
private:
|
||||||
QStringList m_files;
|
QStringList m_files;
|
||||||
QStringList m_fileNames;
|
QStringList m_fileNames;
|
||||||
QStringList m_previousResultPaths;
|
QStringList m_previousResultPaths;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ QByteArray DirectoryFilter::saveState() const
|
|||||||
out << m_filters;
|
out << m_filters;
|
||||||
out << shortcutString();
|
out << shortcutString();
|
||||||
out << isIncludedByDefault();
|
out << isIncludedByDefault();
|
||||||
out << m_files;
|
out << files();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ bool DirectoryFilter::restoreState(const QByteArray &state)
|
|||||||
in >> m_filters;
|
in >> m_filters;
|
||||||
in >> shortcut;
|
in >> shortcut;
|
||||||
in >> defaultFilter;
|
in >> defaultFilter;
|
||||||
in >> m_files;
|
in >> files();
|
||||||
|
|
||||||
setShortcutString(shortcut);
|
setShortcutString(shortcut);
|
||||||
setIncludedByDefault(defaultFilter);
|
setIncludedByDefault(defaultFilter);
|
||||||
@@ -184,14 +184,14 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
|
|||||||
future.setProgressRange(0, MAX);
|
future.setProgressRange(0, MAX);
|
||||||
if (m_directories.count() < 1) {
|
if (m_directories.count() < 1) {
|
||||||
QMutexLocker locker(&m_lock);
|
QMutexLocker locker(&m_lock);
|
||||||
m_files.clear();
|
files().clear();
|
||||||
generateFileNames();
|
generateFileNames();
|
||||||
future.setProgressValueAndText(MAX, tr("%1 filter update: 0 files").arg(m_name));
|
future.setProgressValueAndText(MAX, tr("%1 filter update: 0 files").arg(m_name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
int MAX_PER = MAX;
|
int MAX_PER = MAX;
|
||||||
QStringList files;
|
QStringList filesFound;
|
||||||
QStack<QDir> dirs;
|
QStack<QDir> dirs;
|
||||||
QStack<int> progressValues;
|
QStack<int> progressValues;
|
||||||
QStack<bool> processedValues;
|
QStack<bool> processedValues;
|
||||||
@@ -209,7 +209,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
|
|||||||
while (!dirs.isEmpty() && !future.isCanceled()) {
|
while (!dirs.isEmpty() && !future.isCanceled()) {
|
||||||
if (future.isProgressUpdateNeeded()) {
|
if (future.isProgressUpdateNeeded()) {
|
||||||
future.setProgressValueAndText(progress,
|
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();
|
QDir dir = dirs.pop();
|
||||||
int dirProgressMax = progressValues.pop();
|
int dirProgressMax = progressValues.pop();
|
||||||
@@ -225,7 +225,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
|
|||||||
QDir::Files|QDir::Hidden,
|
QDir::Files|QDir::Hidden,
|
||||||
QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
||||||
foreach (const QString &file, fileEntries)
|
foreach (const QString &file, fileEntries)
|
||||||
files.append(dir.path()+ QLatin1Char('/') +file);
|
filesFound.append(dir.path()+ QLatin1Char('/') +file);
|
||||||
progress += dirProgressMax;
|
progress += dirProgressMax;
|
||||||
} else {
|
} else {
|
||||||
int subProgress = dirProgressMax/(subDirs.size()+1);
|
int subProgress = dirProgressMax/(subDirs.size()+1);
|
||||||
@@ -246,7 +246,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
|
|||||||
|
|
||||||
if (!future.isCanceled()) {
|
if (!future.isCanceled()) {
|
||||||
QMutexLocker locker(&m_lock);
|
QMutexLocker locker(&m_lock);
|
||||||
m_files = files;
|
files() = filesFound;
|
||||||
generateFileNames();
|
generateFileNames();
|
||||||
future.setProgressValue(MAX);
|
future.setProgressValue(MAX);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -38,8 +38,6 @@
|
|||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QFutureInterface>
|
#include <QtCore/QFutureInterface>
|
||||||
#include <QtCore/QMutex>
|
#include <QtCore/QMutex>
|
||||||
#include <QtGui/QWidget>
|
|
||||||
#include <QtGui/QDialog>
|
|
||||||
|
|
||||||
namespace Locator {
|
namespace Locator {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "filesystemfilter.h"
|
#include "filesystemfilter.h"
|
||||||
#include "locatorwidget.h"
|
#include "locatorwidget.h"
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
|
||||||
|
|||||||
@@ -33,13 +33,15 @@
|
|||||||
#include "ilocatorfilter.h"
|
#include "ilocatorfilter.h"
|
||||||
#include "ui_filesystemfilter.h"
|
#include "ui_filesystemfilter.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QFutureInterface>
|
#include <QtCore/QFutureInterface>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class EditorManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Locator {
|
namespace Locator {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ QT_END_NAMESPACE
|
|||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtCore/QEvent>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QContextMenuEvent>
|
#include <QtGui/QContextMenuEvent>
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "locatorplugin.h"
|
#include "locatorplugin.h"
|
||||||
|
|
||||||
#include <QtCore/QEvent>
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -59,7 +58,7 @@ class LocatorWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LocatorWidget(LocatorPlugin *qop);
|
explicit LocatorWidget(LocatorPlugin *qop);
|
||||||
|
|
||||||
void updateFilterList();
|
void updateFilterList();
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@
|
|||||||
|
|
||||||
#include "opendocumentsfilter.h"
|
#include "opendocumentsfilter.h"
|
||||||
|
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Core::IEditor*);
|
Q_DECLARE_METATYPE(Core::IEditor*);
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|||||||
@@ -32,15 +32,16 @@
|
|||||||
|
|
||||||
#include "ilocatorfilter.h"
|
#include "ilocatorfilter.h"
|
||||||
|
|
||||||
|
#include <coreplugin/editormanager/openeditorsmodel.h>
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QFutureInterface>
|
#include <QtCore/QFutureInterface>
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
namespace Core {
|
||||||
#include <coreplugin/editormanager/openeditorsmodel.h>
|
class EditorManager;
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
}
|
||||||
|
|
||||||
namespace Locator {
|
namespace Locator {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -50,7 +51,7 @@ class OpenDocumentsFilter : public Locator::ILocatorFilter
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OpenDocumentsFilter(Core::EditorManager *editorManager);
|
explicit OpenDocumentsFilter(Core::EditorManager *editorManager);
|
||||||
QString displayName() const { return tr("Open documents"); }
|
QString displayName() const { return tr("Open documents"); }
|
||||||
QString id() const { return "Open documents"; }
|
QString id() const { return "Open documents"; }
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Medium; }
|
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Medium; }
|
||||||
|
|||||||
@@ -58,13 +58,13 @@ void AllProjectsFilter::updateFiles()
|
|||||||
if (m_filesUpToDate)
|
if (m_filesUpToDate)
|
||||||
return;
|
return;
|
||||||
m_filesUpToDate = true;
|
m_filesUpToDate = true;
|
||||||
m_files.clear();
|
files().clear();
|
||||||
SessionManager *session = m_projectExplorer->session();
|
SessionManager *session = m_projectExplorer->session();
|
||||||
if (!session)
|
if (!session)
|
||||||
return;
|
return;
|
||||||
foreach (Project *project, session->projects())
|
foreach (Project *project, session->projects())
|
||||||
m_files += project->files(Project::AllFiles);
|
files().append(project->files(Project::AllFiles));
|
||||||
qSort(m_files);
|
qSort(files());
|
||||||
generateFileNames();
|
generateFileNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ void CurrentProjectFilter::updateFiles()
|
|||||||
if (m_filesUpToDate)
|
if (m_filesUpToDate)
|
||||||
return;
|
return;
|
||||||
m_filesUpToDate = true;
|
m_filesUpToDate = true;
|
||||||
m_files.clear();
|
files().clear();
|
||||||
if (!m_project)
|
if (!m_project)
|
||||||
return;
|
return;
|
||||||
m_files = m_project->files(Project::AllFiles);
|
files() = m_project->files(Project::AllFiles);
|
||||||
qSort(m_files);
|
qSort(files());
|
||||||
generateFileNames();
|
generateFileNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
namespace SharedTools {
|
namespace SharedTools {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "rssfetcher.h"
|
#include "rssfetcher.h"
|
||||||
|
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QUrl>
|
||||||
#include <QtGui/QDesktopServices>
|
#include <QtGui/QDesktopServices>
|
||||||
#include <QtGui/QTreeWidgetItem>
|
#include <QtGui/QTreeWidgetItem>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#ifndef COMMUNITYWELCOMEPAGEWIDGET_H
|
#ifndef COMMUNITYWELCOMEPAGEWIDGET_H
|
||||||
#define COMMUNITYWELCOMEPAGEWIDGET_H
|
#define COMMUNITYWELCOMEPAGEWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
namespace Welcome {
|
namespace Welcome {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -46,7 +46,7 @@ class CommunityWelcomePageWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CommunityWelcomePageWidget(QWidget *parent = 0);
|
explicit CommunityWelcomePageWidget(QWidget *parent = 0);
|
||||||
~CommunityWelcomePageWidget();
|
~CommunityWelcomePageWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
#ifndef RSSFETCHER_H
|
#ifndef RSSFETCHER_H
|
||||||
#define RSSFETCHER_H
|
#define RSSFETCHER_H
|
||||||
|
|
||||||
#include <QtCore/QUrl>
|
|
||||||
#include <QtCore/QXmlStreamReader>
|
#include <QtCore/QXmlStreamReader>
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
|
class QUrl;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Welcome {
|
namespace Welcome {
|
||||||
@@ -45,7 +45,7 @@ class RSSFetcher : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
RSSFetcher(int maxItems, QObject *parent = 0);
|
explicit RSSFetcher(int maxItems, QObject *parent = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newsItemReady(const QString& title, const QString& desciption, const QString& url);
|
void newsItemReady(const QString& title, const QString& desciption, const QString& url);
|
||||||
|
|||||||
Reference in New Issue
Block a user