\row
\o Add a new filter to Locator.
\o For a text typed in by the user you provide a list of things to show in the popup. When the user selects an entry you are requested to do whatever you want.
- \o \l{QuickOpen::IQuickOpenFilter}, \l{QuickOpen::FilterEntry}, \l{QuickOpen::BaseFileFilter}
+ \o \l{QuickOpen::ILocatorFilter}, \l{QuickOpen::FilterEntry}, \l{QuickOpen::BaseFileFilter}
\row
\o
#define CPPCURRENTDOCUMENTFILTER_H
#include "searchsymbols.h"
-#include <quickopen/iquickopenfilter.h>
+#include <quickopen/ilocatorfilter.h>
namespace Core {
class EditorManager;
class CppModelManager;
-class CppCurrentDocumentFilter : public QuickOpen::IQuickOpenFilter
+class CppCurrentDocumentFilter : public QuickOpen::ILocatorFilter
{
Q_OBJECT
#include "searchsymbols.h"
-#include <quickopen/iquickopenfilter.h>
+#include <quickopen/ilocatorfilter.h>
namespace Core {
class EditorManager;
class CppModelManager;
-class CppQuickOpenFilter : public QuickOpen::IQuickOpenFilter
+class CppQuickOpenFilter : public QuickOpen::ILocatorFilter
{
Q_OBJECT
public:
using namespace Help;
using namespace Help::Internal;
-Q_DECLARE_METATYPE(IQuickOpenFilter*);
+Q_DECLARE_METATYPE(ILocatorFilter*);
HelpIndexFilter::HelpIndexFilter(HelpPlugin *plugin, QHelpEngine *helpEngine):
m_plugin(plugin),
return QLatin1String("HelpIndexFilter");
}
-IQuickOpenFilter::Priority HelpIndexFilter::priority() const
+ILocatorFilter::Priority HelpIndexFilter::priority() const
{
return Medium;
}
#ifndef HELPINDEXFILTER_H
#define HELPINDEXFILTER_H
-#include <quickopen/iquickopenfilter.h>
+#include <quickopen/ilocatorfilter.h>
#include <QtGui/QIcon>
class HelpPlugin;
-class HelpIndexFilter : public QuickOpen::IQuickOpenFilter
+class HelpIndexFilter : public QuickOpen::ILocatorFilter
{
Q_OBJECT
public:
HelpIndexFilter(HelpPlugin *plugin, QHelpEngine *helpEngine);
- // IQuickOpenFilter
+ // ILocatorFilter
QString trName() const;
QString name() const;
Priority priority() const;
explicit AllProjectsFilter(ProjectExplorerPlugin *pe);
QString trName() const { return tr("Files in any project"); }
QString name() const { return "Files in any project"; }
- QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
+ QuickOpen::ILocatorFilter::Priority priority() const { return QuickOpen::ILocatorFilter::Low; }
void refresh(QFutureInterface<void> &future);
protected:
CurrentProjectFilter(ProjectExplorerPlugin *pe);
QString trName() const { return tr("Files in current project"); }
QString name() const { return "Files in current project"; }
- QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
+ QuickOpen::ILocatorFilter::Priority priority() const { return QuickOpen::ILocatorFilter::Low; }
void refresh(QFutureInterface<void> &future);
protected:
#define BASEFILEFILTER_H
#include "quickopen_global.h"
-#include "iquickopenfilter.h"
+#include "ilocatorfilter.h"
#include <QtCore/QString>
#include <QtCore/QList>
namespace QuickOpen {
-class QUICKOPEN_EXPORT BaseFileFilter : public QuickOpen::IQuickOpenFilter
+class QUICKOPEN_EXPORT BaseFileFilter : public QuickOpen::ILocatorFilter
{
Q_OBJECT
DirectoryFilter();
QString trName() const { return m_name; }
QString name() const { return m_name; }
- QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }
+ QuickOpen::ILocatorFilter::Priority priority() const { return QuickOpen::ILocatorFilter::Medium; }
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
bool openConfigDialog(QWidget *parent, bool &needsRefresh);
**************************************************************************/
#include "filesystemfilter.h"
-#include "quickopentoolwindow.h"
+#include "locatorwidget.h"
#include <coreplugin/editormanager/ieditor.h>
#include <QtCore/QDir>
using namespace QuickOpen;
using namespace QuickOpen::Internal;
-FileSystemFilter::FileSystemFilter(EditorManager *editorManager, QuickOpenToolWindow *toolWindow)
- : m_editorManager(editorManager), m_toolWindow(toolWindow), m_includeHidden(true)
+FileSystemFilter::FileSystemFilter(EditorManager *editorManager, LocatorWidget *locatorWidget)
+ : m_editorManager(editorManager), m_locatorWidget(locatorWidget), m_includeHidden(true)
{
setShortcutString("f");
setIncludedByDefault(false);
QFileInfo info(selection.internalData.toString());
if (info.isDir()) {
QString value = shortcutString() + " " + QDir::toNativeSeparators(info.absoluteFilePath()+"/");
- m_toolWindow->show(value, value.length());
+ m_locatorWidget->show(value, value.length());
return;
}
m_editorManager->openEditor(selection.internalData.toString());
#ifndef FILESYSTEMFILTER_H
#define FILESYSTEMFILTER_H
-#include "iquickopenfilter.h"
+#include "ilocatorfilter.h"
#include "ui_filesystemfilter.h"
#include <coreplugin/editormanager/editormanager.h>
namespace QuickOpen {
namespace Internal {
-class QuickOpenToolWindow;
+class LocatorWidget;
-class FileSystemFilter : public QuickOpen::IQuickOpenFilter
+class FileSystemFilter : public QuickOpen::ILocatorFilter
{
Q_OBJECT
public:
- FileSystemFilter(Core::EditorManager *editorManager, QuickOpenToolWindow *toolWindow);
+ FileSystemFilter(Core::EditorManager *editorManager, LocatorWidget *locatorWidget);
QString trName() const { return tr("Files in file system"); }
QString name() const { return "Files in file system"; }
- QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }
+ QuickOpen::ILocatorFilter::Priority priority() const { return QuickOpen::ILocatorFilter::Medium; }
QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
void accept(QuickOpen::FilterEntry selection) const;
QByteArray saveState() const;
private:
Core::EditorManager *m_editorManager;
- QuickOpenToolWindow *m_toolWindow;
+ LocatorWidget *m_locatorWidget;
bool m_includeHidden;
};
**
**************************************************************************/
-#include "iquickopenfilter.h"
+#include "ilocatorfilter.h"
#include <QtGui/QBoxLayout>
#include <QtGui/QCheckBox>
using namespace QuickOpen;
-IQuickOpenFilter::IQuickOpenFilter(QObject *parent):
+ILocatorFilter::ILocatorFilter(QObject *parent):
QObject(parent),
m_includedByDefault(false),
m_hidden(false)
{
}
-QString IQuickOpenFilter::shortcutString() const
+QString ILocatorFilter::shortcutString() const
{
return m_shortcut;
}
-void IQuickOpenFilter::setShortcutString(const QString &shortcut)
+void ILocatorFilter::setShortcutString(const QString &shortcut)
{
m_shortcut = shortcut;
}
-QByteArray IQuickOpenFilter::saveState() const
+QByteArray ILocatorFilter::saveState() const
{
QByteArray value;
QDataStream out(&value, QIODevice::WriteOnly);
return value;
}
-bool IQuickOpenFilter::restoreState(const QByteArray &state)
+bool ILocatorFilter::restoreState(const QByteArray &state)
{
QString shortcut;
bool defaultFilter;
return true;
}
-bool IQuickOpenFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
+bool ILocatorFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
{
Q_UNUSED(needsRefresh)
return false;
}
-bool IQuickOpenFilter::isConfigurable() const
+bool ILocatorFilter::isConfigurable() const
{
return true;
}
-bool IQuickOpenFilter::isIncludedByDefault() const
+bool ILocatorFilter::isIncludedByDefault() const
{
return m_includedByDefault;
}
-void IQuickOpenFilter::setIncludedByDefault(bool includedByDefault)
+void ILocatorFilter::setIncludedByDefault(bool includedByDefault)
{
m_includedByDefault = includedByDefault;
}
-bool IQuickOpenFilter::isHidden() const
+bool ILocatorFilter::isHidden() const
{
return m_hidden;
}
-void IQuickOpenFilter::setHidden(bool hidden)
+void ILocatorFilter::setHidden(bool hidden)
{
m_hidden = hidden;
}
**
**************************************************************************/
-#ifndef IQUICKOPENFILTER_H
-#define IQUICKOPENFILTER_H
+#ifndef ILOCATORFILTER_H
+#define ILOCATORFILTER_H
#include "quickopen_global.h"
namespace QuickOpen {
-class IQuickOpenFilter;
+class ILocatorFilter;
struct FilterEntry
{
FilterEntry() {}
- FilterEntry(IQuickOpenFilter *fromFilter, const QString &name, const QVariant &data,
+ FilterEntry(ILocatorFilter *fromFilter, const QString &name, const QVariant &data,
const QIcon &icon = QIcon())
: filter(fromFilter)
, displayName(name)
}
/* backpointer to creating filter */
- IQuickOpenFilter *filter;
+ ILocatorFilter *filter;
/* displayed string */
QString displayName;
/* extra information displayed in light-gray in a second column (optional) */
bool resolveFileIcon;
};
-class QUICKOPEN_EXPORT IQuickOpenFilter : public QObject
+class QUICKOPEN_EXPORT ILocatorFilter : public QObject
{
Q_OBJECT
public:
enum Priority {High = 0, Medium = 1, Low = 2};
- IQuickOpenFilter(QObject *parent = 0);
- virtual ~IQuickOpenFilter() {}
+ ILocatorFilter(QObject *parent = 0);
+ virtual ~ILocatorFilter() {}
/* Visible name. */
virtual QString trName() const = 0;
} // namespace QuickOpen
-#endif // IQUICKOPENFILTER_H
+#endif // ILOCATORFILTER_H
unsigned int qHash(const QuickOpen::FilterEntry &entry);
QT_END_NAMESPACE
-#include "quickopentoolwindow.h"
+#include "locatorwidget.h"
#include "quickopenplugin.h"
#include "quickopenconstants.h"
#include <QtGui/QScrollBar>
#include <QtGui/QTreeView>
-Q_DECLARE_METATYPE(QuickOpen::IQuickOpenFilter*);
+Q_DECLARE_METATYPE(QuickOpen::ILocatorFilter*);
Q_DECLARE_METATYPE(QuickOpen::FilterEntry);
namespace QuickOpen {
}
-// =========== QuickOpenToolWindow ===========
+// =========== LocatorWidget ===========
-QuickOpenToolWindow::QuickOpenToolWindow(QuickOpenPlugin *qop) :
+LocatorWidget::LocatorWidget(QuickOpenPlugin *qop) :
m_quickOpenPlugin(qop),
m_quickOpenModel(new QuickOpenModel(this)),
m_completionList(new CompletionList(this)),
this, SLOT(acceptCurrentEntry()));
}
-bool QuickOpenToolWindow::isShowingTypeHereMessage() const
+bool LocatorWidget::isShowingTypeHereMessage() const
{
return m_fileLineEdit->isShowingHintText();
}
-void QuickOpenToolWindow::updateFilterList()
+void LocatorWidget::updateFilterList()
{
m_filterMenu->clear();
- foreach (IQuickOpenFilter *filter, m_quickOpenPlugin->filters()) {
+ foreach (ILocatorFilter *filter, m_quickOpenPlugin->filters()) {
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
QAction *action = m_filterMenu->addAction(filter->trName(), this, SLOT(filterSelected()));
action->setData(qVariantFromValue(filter));
m_filterMenu->addAction(m_configureAction);
}
-bool QuickOpenToolWindow::eventFilter(QObject *obj, QEvent *event)
+bool LocatorWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_fileLineEdit && event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
return QWidget::eventFilter(obj, event);
}
-void QuickOpenToolWindow::showCompletionList()
+void LocatorWidget::showCompletionList()
{
const int border = m_completionList->frameWidth();
const QSize size = m_completionList->preferredSize();
m_completionList->show();
}
-void QuickOpenToolWindow::showPopup()
+void LocatorWidget::showPopup()
{
updateCompletionList(m_fileLineEdit->typedText());
showCompletionList();
}
-QList<IQuickOpenFilter*> QuickOpenToolWindow::filtersFor(const QString &text, QString &searchText)
+QList<ILocatorFilter*> LocatorWidget::filtersFor(const QString &text, QString &searchText)
{
- QList<IQuickOpenFilter*> filters = m_quickOpenPlugin->filters();
+ QList<ILocatorFilter*> filters = m_quickOpenPlugin->filters();
int whiteSpace = text.indexOf(" ");
QString prefix;
if (whiteSpace >= 0)
prefix = text.left(whiteSpace);
if (!prefix.isEmpty()) {
prefix = prefix.toLower();
- foreach (IQuickOpenFilter *filter, filters) {
+ foreach (ILocatorFilter *filter, filters) {
if (prefix == filter->shortcutString()) {
searchText = text.mid(whiteSpace+1);
- return QList<IQuickOpenFilter*>() << filter;
+ return QList<ILocatorFilter*>() << filter;
}
}
}
searchText = text;
- QList<IQuickOpenFilter*> activeFilters;
- foreach (IQuickOpenFilter *filter, filters)
+ QList<ILocatorFilter*> activeFilters;
+ foreach (ILocatorFilter *filter, filters)
if (filter->isIncludedByDefault())
activeFilters << filter;
return activeFilters;
}
-void QuickOpenToolWindow::updateCompletionList(const QString &text)
+void LocatorWidget::updateCompletionList(const QString &text)
{
QString searchText;
- const QList<IQuickOpenFilter*> filters = filtersFor(text, searchText);
+ const QList<ILocatorFilter*> filters = filtersFor(text, searchText);
QSet<FilterEntry> alreadyAdded;
const bool checkDuplicates = (filters.size() > 1);
QList<FilterEntry> entries;
- foreach (IQuickOpenFilter *filter, filters) {
+ foreach (ILocatorFilter *filter, filters) {
foreach (const FilterEntry &entry, filter->matchesFor(searchText)) {
if (checkDuplicates && alreadyAdded.contains(entry))
continue;
#endif
}
-void QuickOpenToolWindow::acceptCurrentEntry()
+void LocatorWidget::acceptCurrentEntry()
{
if (!m_completionList->isVisible())
return;
entry.filter->accept(entry);
}
-void QuickOpenToolWindow::show(const QString &text, int selectionStart, int selectionLength)
+void LocatorWidget::show(const QString &text, int selectionStart, int selectionLength)
{
m_fileLineEdit->hideHintText();
if (!text.isEmpty())
}
}
-void QuickOpenToolWindow::filterSelected()
+void LocatorWidget::filterSelected()
{
QString searchText = tr("<type here>");
QAction *action = qobject_cast<QAction*>(sender());
QTC_ASSERT(action, return);
- IQuickOpenFilter *filter = action->data().value<IQuickOpenFilter*>();
+ ILocatorFilter *filter = action->data().value<ILocatorFilter*>();
QTC_ASSERT(filter, return);
QString currentText = m_fileLineEdit->text().trimmed();
// add shortcut string at front or replace existing shortcut string
if (!currentText.isEmpty()) {
searchText = currentText;
- foreach (IQuickOpenFilter *otherfilter, m_quickOpenPlugin->filters()) {
+ foreach (ILocatorFilter *otherfilter, m_quickOpenPlugin->filters()) {
if (currentText.startsWith(otherfilter->shortcutString() + " ")) {
searchText = currentText.mid(otherfilter->shortcutString().length()+1);
break;
m_fileLineEdit->setFocus();
}
-void QuickOpenToolWindow::showEvent(QShowEvent *event)
+void LocatorWidget::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);
}
-void QuickOpenToolWindow::showConfigureDialog()
+void LocatorWidget::showConfigureDialog()
{
Core::ICore::instance()->showOptionsDialog(Constants::QUICKOPEN_CATEGORY,
Constants::FILTER_OPTIONS_PAGE);
**
**************************************************************************/
-#ifndef QUICKOPENTOOLWINDOW_H
-#define QUICKOPENTOOLWINDOW_H
+#ifndef LOCATORWIDGET_H
+#define LOCATORWIDGET_H
#include "quickopenplugin.h"
class QuickOpenModel;
class CompletionList;
-class QuickOpenToolWindow
+class LocatorWidget
: public QWidget
{
Q_OBJECT
public:
- QuickOpenToolWindow(QuickOpenPlugin *qop);
+ LocatorWidget(QuickOpenPlugin *qop);
void updateFilterList();
bool isShowingTypeHereMessage() const;
void showCompletionList();
void updateCompletionList(const QString &text);
- QList<IQuickOpenFilter*> filtersFor(const QString &text, QString &searchText);
+ QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText);
QuickOpenPlugin *m_quickOpenPlugin;
QuickOpenModel *m_quickOpenModel;
} // namespace Internal
} // namespace QuickOpen
-#endif // QUICKOPENTOOLWINDOW_H
+#endif // LOCATORWIDGET_H
#ifndef OPENDOCUMENTSFILTER_H
#define OPENDOCUMENTSFILTER_H
-#include "iquickopenfilter.h"
+#include "ilocatorfilter.h"
#include <QtCore/QString>
#include <QtCore/QList>
namespace QuickOpen {
namespace Internal {
-class OpenDocumentsFilter : public QuickOpen::IQuickOpenFilter
+class OpenDocumentsFilter : public QuickOpen::ILocatorFilter
{
Q_OBJECT
OpenDocumentsFilter(Core::EditorManager *editorManager);
QString trName() const { return tr("Open documents"); }
QString name() const { return "Open documents"; }
- QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }
+ QuickOpen::ILocatorFilter::Priority priority() const { return QuickOpen::ILocatorFilter::Medium; }
QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
void accept(QuickOpen::FilterEntry selection) const;
void refresh(QFutureInterface<void> &future);
include(../../qtcreatorplugin.pri)
include(quickopen_dependencies.pri)
HEADERS += quickopenplugin.h \
- quickopentoolwindow.h \
+ locatorwidget.h \
quickopenfiltersfilter.h \
settingspage.h \
- iquickopenfilter.h \
+ ilocatorfilter.h \
opendocumentsfilter.h \
filesystemfilter.h \
quickopenconstants.h \
basefilefilter.h \
quickopen_global.h
SOURCES += quickopenplugin.cpp \
- quickopentoolwindow.cpp \
+ locatorwidget.cpp \
quickopenfiltersfilter.cpp \
opendocumentsfilter.cpp \
filesystemfilter.cpp \
directoryfilter.cpp \
quickopenmanager.cpp \
basefilefilter.cpp \
- iquickopenfilter.cpp
+ ilocatorfilter.cpp
FORMS += settingspage.ui \
filesystemfilter.ui \
directoryfilter.ui
#include "quickopenfiltersfilter.h"
#include "quickopenplugin.h"
-#include "quickopentoolwindow.h"
+#include "locatorwidget.h"
#include <coreplugin/coreconstants.h>
using namespace QuickOpen;
using namespace QuickOpen::Internal;
-Q_DECLARE_METATYPE(IQuickOpenFilter*);
+Q_DECLARE_METATYPE(ILocatorFilter*);
QuickOpenFiltersFilter::QuickOpenFiltersFilter(QuickOpenPlugin *plugin,
- QuickOpenToolWindow *toolWindow):
+ LocatorWidget *locatorWidget):
m_plugin(plugin),
- m_toolWindow(toolWindow),
+ m_locatorWidget(locatorWidget),
m_icon(QIcon(Core::Constants::ICON_NEXT))
{
setIncludedByDefault(true);
return QLatin1String("FiltersFilter");
}
-IQuickOpenFilter::Priority QuickOpenFiltersFilter::priority() const
+ILocatorFilter::Priority QuickOpenFiltersFilter::priority() const
{
return High;
}
{
QList<FilterEntry> entries;
if (entry.isEmpty()) {
- foreach (IQuickOpenFilter *filter, m_plugin->filters()) {
+ foreach (ILocatorFilter *filter, m_plugin->filters()) {
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
FilterEntry entry(this,
filter->shortcutString(),
void QuickOpenFiltersFilter::accept(FilterEntry selection) const
{
- IQuickOpenFilter *filter = selection.internalData.value<IQuickOpenFilter*>();
+ ILocatorFilter *filter = selection.internalData.value<ILocatorFilter*>();
if (filter)
- m_toolWindow->show(filter->shortcutString() + " ",
+ m_locatorWidget->show(filter->shortcutString() + " ",
filter->shortcutString().length() + 1);
}
#ifndef QUICKOPENFILTERSFILTER_H
#define QUICKOPENFILTERSFILTER_H
-#include "iquickopenfilter.h"
+#include "ilocatorfilter.h"
#include <QtGui/QIcon>
namespace Internal {
class QuickOpenPlugin;
-class QuickOpenToolWindow;
+class LocatorWidget;
/*!
This filter provides the user with the list of available QuickOpen filters.
The list is only shown when nothing has been typed yet.
*/
-class QuickOpenFiltersFilter : public IQuickOpenFilter
+class QuickOpenFiltersFilter : public ILocatorFilter
{
Q_OBJECT
public:
QuickOpenFiltersFilter(QuickOpenPlugin *plugin,
- QuickOpenToolWindow *toolWindow);
+ LocatorWidget *locatorWidget);
- // IQuickOpenFilter
+ // ILocatorFilter
QString trName() const;
QString name() const;
Priority priority() const;
private:
QuickOpenPlugin *m_plugin;
- QuickOpenToolWindow *m_toolWindow;
+ LocatorWidget *m_locatorWidget;
QIcon m_icon;
};
**************************************************************************/
#include "quickopenmanager.h"
-#include "quickopentoolwindow.h"
+#include "locatorwidget.h"
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
QuickOpenManager *QuickOpenManager::m_instance = 0;
-QuickOpenManager::QuickOpenManager(QuickOpenToolWindow *toolWindow)
- : QObject(toolWindow),
- m_toolWindow(toolWindow)
+QuickOpenManager::QuickOpenManager(LocatorWidget *locatorWidget)
+ : QObject(locatorWidget),
+ m_locatorWidget(locatorWidget)
{
m_instance = this;
}
void QuickOpenManager::show(const QString &text,
int selectionStart, int selectionLength)
{
- QTC_ASSERT(m_toolWindow, return);
- m_toolWindow->show(text, selectionStart, selectionLength);
+ QTC_ASSERT(m_locatorWidget, return);
+ m_locatorWidget->show(text, selectionStart, selectionLength);
}
namespace QuickOpen {
namespace Internal {
-class QuickOpenToolWindow;
+class LocatorWidget;
}
class QUICKOPEN_EXPORT QuickOpenManager : public QObject
Q_OBJECT
public:
- QuickOpenManager(Internal::QuickOpenToolWindow *toolWindow);
+ QuickOpenManager(Internal::LocatorWidget *locatorWidget);
~QuickOpenManager();
static QuickOpenManager* instance() { return m_instance; }
void show(const QString &text, int selectionStart = -1, int selectionLength = 0);
private:
- Internal::QuickOpenToolWindow *m_toolWindow;
+ Internal::LocatorWidget *m_locatorWidget;
static QuickOpenManager *m_instance;
};
#include "quickopenconstants.h"
#include "quickopenfiltersfilter.h"
#include "quickopenmanager.h"
-#include "quickopentoolwindow.h"
+#include "locatorwidget.h"
#include "opendocumentsfilter.h"
#include "filesystemfilter.h"
#include "settingspage.h"
using namespace QuickOpen::Internal;
namespace {
- static bool filterLessThan(const IQuickOpenFilter *first, const IQuickOpenFilter *second)
+ static bool filterLessThan(const ILocatorFilter *first, const ILocatorFilter *second)
{
return first->priority() < second->priority();
}
m_settingsPage = new SettingsPage(this);
addObject(m_settingsPage);
- m_quickOpenToolWindow = new QuickOpenToolWindow(this);
- m_quickOpenToolWindow->setEnabled(false);
+ m_locatorWidget = new LocatorWidget(this);
+ m_locatorWidget->setEnabled(false);
Core::BaseView *view = new Core::BaseView;
view->setUniqueViewName("QuickOpen");
- view->setWidget(m_quickOpenToolWindow);
+ view->setWidget(m_locatorWidget);
view->setContext(QList<int>() << core->uniqueIDManager()
- ->uniqueIdentifier(QLatin1String("QuickOpenToolWindow")));
+ ->uniqueIdentifier(QLatin1String("LocatorWidget")));
view->setDefaultPosition(Core::IView::First);
addAutoReleasedObject(view);
const QString actionId = QLatin1String("QtCreator.Locate");
- QAction *action = new QAction(m_quickOpenToolWindow->windowIcon(), m_quickOpenToolWindow->windowTitle(), this);
+ QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this);
Core::Command *cmd = core->actionManager()->registerAction(action, actionId, QList<int>() << Core::Constants::C_GLOBAL_ID);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+K"));
connect(action, SIGNAL(triggered()), this, SLOT(openQuickOpen()));
Core::ActionContainer *mtools = core->actionManager()->actionContainer(Core::Constants::M_TOOLS);
mtools->addAction(cmd);
- addObject(new QuickOpenManager(m_quickOpenToolWindow));
+ addObject(new QuickOpenManager(m_locatorWidget));
m_openDocumentsFilter = new OpenDocumentsFilter(core->editorManager());
addObject(m_openDocumentsFilter);
- m_fileSystemFilter = new FileSystemFilter(core->editorManager(), m_quickOpenToolWindow);
+ m_fileSystemFilter = new FileSystemFilter(core->editorManager(), m_locatorWidget);
addObject(m_fileSystemFilter);
- addAutoReleasedObject(new QuickOpenFiltersFilter(this, m_quickOpenToolWindow));
+ addAutoReleasedObject(new QuickOpenFiltersFilter(this, m_locatorWidget));
connect(core, SIGNAL(coreOpened()), this, SLOT(startSettingsLoad()));
return true;
void QuickOpenPlugin::openQuickOpen()
{
- m_quickOpenToolWindow->show("");
+ m_locatorWidget->show("");
}
void QuickOpenPlugin::extensionsInitialized()
{
- m_filters = ExtensionSystem::PluginManager::instance()->getObjects<IQuickOpenFilter>();
+ m_filters = ExtensionSystem::PluginManager::instance()->getObjects<ILocatorFilter>();
qSort(m_filters.begin(), m_filters.end(), filterLessThan);
}
void QuickOpenPlugin::settingsLoaded()
{
- m_quickOpenToolWindow->updateFilterList();
- m_quickOpenToolWindow->setEnabled(true);
+ m_locatorWidget->updateFilterList();
+ m_locatorWidget->setEnabled(true);
if (m_refreshTimer.interval() > 0)
m_refreshTimer.start();
}
s->beginGroup("QuickOpen");
s->remove("");
s->setValue("RefreshInterval", refreshInterval());
- foreach (IQuickOpenFilter *filter, m_filters) {
+ foreach (ILocatorFilter *filter, m_filters) {
if (!m_customFilters.contains(filter))
s->setValue(filter->name(), filter->saveState());
}
s->beginGroup("CustomFilters");
int i = 0;
- foreach (IQuickOpenFilter *filter, m_customFilters) {
+ foreach (ILocatorFilter *filter, m_customFilters) {
s->setValue(QString("directory%1").arg(i), filter->saveState());
++i;
}
}
/*!
- \fn QList<IQuickOpenFilter*> QuickOpenPlugin::filter()
+ \fn QList<ILocatorFilter*> QuickOpenPlugin::filter()
Return all filters, including the ones created by the user.
*/
-QList<IQuickOpenFilter*> QuickOpenPlugin::filters()
+QList<ILocatorFilter*> QuickOpenPlugin::filters()
{
return m_filters;
}
/*!
- \fn QList<IQuickOpenFilter*> QuickOpenPlugin::customFilter()
+ \fn QList<ILocatorFilter*> QuickOpenPlugin::customFilter()
This returns a subset of all the filters, that contains only the filters that
have been created by the user at some point (maybe in a previous session).
*/
-QList<IQuickOpenFilter*> QuickOpenPlugin::customFilters()
+QList<ILocatorFilter*> QuickOpenPlugin::customFilters()
{
return m_customFilters;
}
-void QuickOpenPlugin::setFilters(QList<IQuickOpenFilter*> f)
+void QuickOpenPlugin::setFilters(QList<ILocatorFilter*> f)
{
m_filters = f;
- m_quickOpenToolWindow->updateFilterList();
+ m_locatorWidget->updateFilterList();
}
-void QuickOpenPlugin::setCustomFilters(QList<IQuickOpenFilter *> filters)
+void QuickOpenPlugin::setCustomFilters(QList<ILocatorFilter *> filters)
{
m_customFilters = filters;
}
m_refreshTimer.start();
}
-void QuickOpenPlugin::refresh(QList<IQuickOpenFilter*> filters)
+void QuickOpenPlugin::refresh(QList<ILocatorFilter*> filters)
{
if (filters.isEmpty())
filters = m_filters;
- QFuture<void> task = QtConcurrent::run(&IQuickOpenFilter::refresh, filters);
+ QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters);
Core::FutureProgress *progress = Core::ICore::instance()
->progressManager()->addTask(task, tr("Indexing"),
QuickOpen::Constants::TASK_INDEX,
#ifndef QUICKOPENPLUGIN_H
#define QUICKOPENPLUGIN_H
-#include "iquickopenfilter.h"
+#include "ilocatorfilter.h"
#include "directoryfilter.h"
#include <extensionsystem/iplugin.h>
namespace QuickOpen {
namespace Internal {
-class QuickOpenToolWindow;
+class LocatorWidget;
class OpenDocumentsFilter;
class FileSystemFilter;
class SettingsPage;
bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized();
- QList<IQuickOpenFilter*> filters();
- QList<IQuickOpenFilter*> customFilters();
- void setFilters(QList<IQuickOpenFilter*> f);
- void setCustomFilters(QList<IQuickOpenFilter*> f);
+ QList<ILocatorFilter*> filters();
+ QList<ILocatorFilter*> customFilters();
+ void setFilters(QList<ILocatorFilter*> f);
+ void setCustomFilters(QList<ILocatorFilter*> f);
int refreshInterval();
void setRefreshInterval(int interval);
public slots:
- void refresh(QList<IQuickOpenFilter*> filters = QList<IQuickOpenFilter*>());
+ void refresh(QList<ILocatorFilter*> filters = QList<ILocatorFilter*>());
void saveSettings();
void openQuickOpen();
template <typename S>
void loadSettingsHelper(S *settings);
- QuickOpenToolWindow *m_quickOpenToolWindow;
+ LocatorWidget *m_locatorWidget;
SettingsPage *m_settingsPage;
- QList<IQuickOpenFilter*> m_filters;
- QList<IQuickOpenFilter*> m_customFilters;
+ QList<ILocatorFilter*> m_filters;
+ QList<ILocatorFilter*> m_customFilters;
int m_refreshInterval;
QTimer m_refreshTimer;
OpenDocumentsFilter *m_openDocumentsFilter;
settings->beginGroup("QuickOpen");
m_refreshTimer.setInterval(settings->value("RefreshInterval", 60).toInt() * 60000);
- foreach (IQuickOpenFilter *filter, m_filters) {
+ foreach (ILocatorFilter *filter, m_filters) {
if (settings->contains(filter->name())) {
const QByteArray state = settings->value(filter->name()).toByteArray();
if (!state.isEmpty())
}
}
settings->beginGroup("CustomFilters");
- QList<IQuickOpenFilter *> customFilters;
+ QList<ILocatorFilter *> customFilters;
const QStringList keys = settings->childKeys();
foreach (const QString &key, keys) {
- IQuickOpenFilter *filter = new DirectoryFilter;
+ ILocatorFilter *filter = new DirectoryFilter;
filter->restoreState(settings->value(key).toByteArray());
m_filters.append(filter);
customFilters.append(filter);
#include "quickopenconstants.h"
#include "quickopenplugin.h"
-#include "iquickopenfilter.h"
+#include "ilocatorfilter.h"
#include "directoryfilter.h"
#include <qtconcurrent/QtConcurrentTools>
#include <QtCore/QCoreApplication>
-Q_DECLARE_METATYPE(QuickOpen::IQuickOpenFilter*)
+Q_DECLARE_METATYPE(QuickOpen::ILocatorFilter*)
using namespace QuickOpen;
using namespace QuickOpen::Internal;
void SettingsPage::saveFilterStates()
{
m_filterStates.clear();
- foreach (IQuickOpenFilter *filter, m_filters)
+ foreach (ILocatorFilter *filter, m_filters)
m_filterStates.insert(filter, filter->saveState());
}
void SettingsPage::restoreFilterStates()
{
- foreach (IQuickOpenFilter *filter, m_filterStates.keys())
+ foreach (ILocatorFilter *filter, m_filterStates.keys())
filter->restoreState(m_filterStates.value(filter));
}
void SettingsPage::updateFilterList()
{
m_ui.filterList->clear();
- foreach (IQuickOpenFilter *filter, m_filters) {
+ foreach (ILocatorFilter *filter, m_filters) {
if (filter->isHidden())
continue;
void SettingsPage::updateButtonStates()
{
QListWidgetItem *item = m_ui.filterList->currentItem();
- IQuickOpenFilter *filter = (item ? item->data(Qt::UserRole).value<IQuickOpenFilter *>() : 0);
+ ILocatorFilter *filter = (item ? item->data(Qt::UserRole).value<ILocatorFilter *>() : 0);
m_ui.editButton->setEnabled(filter && filter->isConfigurable());
m_ui.removeButton->setEnabled(filter && m_customFilters.contains(filter));
}
if (!item)
item = m_ui.filterList->currentItem();
QTC_ASSERT(item, return);
- IQuickOpenFilter *filter = item->data(Qt::UserRole).value<IQuickOpenFilter *>();
+ ILocatorFilter *filter = item->data(Qt::UserRole).value<ILocatorFilter *>();
QTC_ASSERT(filter, return);
if (!filter->isConfigurable())
void SettingsPage::addCustomFilter()
{
- IQuickOpenFilter *filter = new DirectoryFilter;
+ ILocatorFilter *filter = new DirectoryFilter;
bool needsRefresh = false;
if (filter->openConfigDialog(m_page, needsRefresh)) {
m_filters.append(filter);
{
QListWidgetItem *item = m_ui.filterList->currentItem();
QTC_ASSERT(item, return);
- IQuickOpenFilter *filter = item->data(Qt::UserRole).value<IQuickOpenFilter *>();
+ ILocatorFilter *filter = item->data(Qt::UserRole).value<ILocatorFilter *>();
QTC_ASSERT(m_customFilters.contains(filter), return);
m_filters.removeAll(filter);
m_customFilters.removeAll(filter);
namespace QuickOpen {
-class IQuickOpenFilter;
+class ILocatorFilter;
namespace Internal {
Ui::SettingsWidget m_ui;
QuickOpenPlugin *m_plugin;
QWidget* m_page;
- QList<IQuickOpenFilter *> m_filters;
- QList<IQuickOpenFilter *> m_addedFilters;
- QList<IQuickOpenFilter *> m_removedFilters;
- QList<IQuickOpenFilter *> m_customFilters;
- QList<IQuickOpenFilter *> m_refreshFilters;
- QHash<IQuickOpenFilter *, QByteArray> m_filterStates;
+ QList<ILocatorFilter *> m_filters;
+ QList<ILocatorFilter *> m_addedFilters;
+ QList<ILocatorFilter *> m_removedFilters;
+ QList<ILocatorFilter *> m_customFilters;
+ QList<ILocatorFilter *> m_refreshFilters;
+ QHash<ILocatorFilter *, QByteArray> m_filterStates;
};
} // namespace Internal
using namespace TextEditor::Internal;
LineNumberFilter::LineNumberFilter(QObject *parent)
- : IQuickOpenFilter(parent)
+ : ILocatorFilter(parent)
{
setShortcutString("l");
setIncludedByDefault(true);
#ifndef LINENUMBERFILTER_H
#define LINENUMBERFILTER_H
-#include <quickopen/iquickopenfilter.h>
+#include <quickopen/ilocatorfilter.h>
#include <QtCore/QString>
#include <QtCore/QList>
namespace Internal {
-class LineNumberFilter : public QuickOpen::IQuickOpenFilter
+class LineNumberFilter : public QuickOpen::ILocatorFilter
{
Q_OBJECT
QString trName() const { return tr("Line in current document"); }
QString name() const { return "Line in current document"; }
- QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::High; }
+ QuickOpen::ILocatorFilter::Priority priority() const { return QuickOpen::ILocatorFilter::High; }
QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
void accept(QuickOpen::FilterEntry selection) const;
void refresh(QFutureInterface<void> &) {}