forked from qt-creator/qt-creator
QuickOpenPlugin --> LocatorPlugin
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "quickopenplugin.h"
|
||||
#include "locatorplugin.h"
|
||||
#include "quickopenconstants.h"
|
||||
#include "quickopenfiltersfilter.h"
|
||||
#include "locatormanager.h"
|
||||
@@ -70,13 +70,13 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
QuickOpenPlugin::QuickOpenPlugin()
|
||||
LocatorPlugin::LocatorPlugin()
|
||||
{
|
||||
m_refreshTimer.setSingleShot(false);
|
||||
connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
|
||||
}
|
||||
|
||||
QuickOpenPlugin::~QuickOpenPlugin()
|
||||
LocatorPlugin::~LocatorPlugin()
|
||||
{
|
||||
removeObject(m_openDocumentsFilter);
|
||||
removeObject(m_fileSystemFilter);
|
||||
@@ -87,7 +87,7 @@ QuickOpenPlugin::~QuickOpenPlugin()
|
||||
qDeleteAll(m_customFilters);
|
||||
}
|
||||
|
||||
bool QuickOpenPlugin::initialize(const QStringList &, QString *)
|
||||
bool LocatorPlugin::initialize(const QStringList &, QString *)
|
||||
{
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
m_settingsPage = new SettingsPage(this);
|
||||
@@ -126,24 +126,24 @@ bool QuickOpenPlugin::initialize(const QStringList &, QString *)
|
||||
return true;
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::openQuickOpen()
|
||||
void LocatorPlugin::openQuickOpen()
|
||||
{
|
||||
m_locatorWidget->show("");
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::extensionsInitialized()
|
||||
void LocatorPlugin::extensionsInitialized()
|
||||
{
|
||||
m_filters = ExtensionSystem::PluginManager::instance()->getObjects<ILocatorFilter>();
|
||||
qSort(m_filters.begin(), m_filters.end(), filterLessThan);
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::startSettingsLoad()
|
||||
void LocatorPlugin::startSettingsLoad()
|
||||
{
|
||||
m_loadWatcher.setFuture(QtConcurrent::run(this, &QuickOpenPlugin::loadSettings));
|
||||
m_loadWatcher.setFuture(QtConcurrent::run(this, &LocatorPlugin::loadSettings));
|
||||
connect(&m_loadWatcher, SIGNAL(finished()), this, SLOT(settingsLoaded()));
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::loadSettings()
|
||||
void LocatorPlugin::loadSettings()
|
||||
{
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
QSettings *qs = core->settings();
|
||||
@@ -159,7 +159,7 @@ void QuickOpenPlugin::loadSettings()
|
||||
qs->remove("QuickOpen");
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::settingsLoaded()
|
||||
void LocatorPlugin::settingsLoaded()
|
||||
{
|
||||
m_locatorWidget->updateFilterList();
|
||||
m_locatorWidget->setEnabled(true);
|
||||
@@ -167,7 +167,7 @@ void QuickOpenPlugin::settingsLoaded()
|
||||
m_refreshTimer.start();
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::saveSettings()
|
||||
void LocatorPlugin::saveSettings()
|
||||
{
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
if (core && core->settingsDatabase()) {
|
||||
@@ -191,43 +191,43 @@ void QuickOpenPlugin::saveSettings()
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QList<ILocatorFilter*> QuickOpenPlugin::filter()
|
||||
\fn QList<ILocatorFilter*> LocatorPlugin::filter()
|
||||
|
||||
Return all filters, including the ones created by the user.
|
||||
*/
|
||||
QList<ILocatorFilter*> QuickOpenPlugin::filters()
|
||||
QList<ILocatorFilter*> LocatorPlugin::filters()
|
||||
{
|
||||
return m_filters;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QList<ILocatorFilter*> QuickOpenPlugin::customFilter()
|
||||
\fn QList<ILocatorFilter*> LocatorPlugin::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<ILocatorFilter*> QuickOpenPlugin::customFilters()
|
||||
QList<ILocatorFilter*> LocatorPlugin::customFilters()
|
||||
{
|
||||
return m_customFilters;
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::setFilters(QList<ILocatorFilter*> f)
|
||||
void LocatorPlugin::setFilters(QList<ILocatorFilter*> f)
|
||||
{
|
||||
m_filters = f;
|
||||
m_locatorWidget->updateFilterList();
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::setCustomFilters(QList<ILocatorFilter *> filters)
|
||||
void LocatorPlugin::setCustomFilters(QList<ILocatorFilter *> filters)
|
||||
{
|
||||
m_customFilters = filters;
|
||||
}
|
||||
|
||||
int QuickOpenPlugin::refreshInterval()
|
||||
int LocatorPlugin::refreshInterval()
|
||||
{
|
||||
return m_refreshTimer.interval() / 60000;
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::setRefreshInterval(int interval)
|
||||
void LocatorPlugin::setRefreshInterval(int interval)
|
||||
{
|
||||
if (interval < 1) {
|
||||
m_refreshTimer.stop();
|
||||
@@ -238,7 +238,7 @@ void QuickOpenPlugin::setRefreshInterval(int interval)
|
||||
m_refreshTimer.start();
|
||||
}
|
||||
|
||||
void QuickOpenPlugin::refresh(QList<ILocatorFilter*> filters)
|
||||
void LocatorPlugin::refresh(QList<ILocatorFilter*> filters)
|
||||
{
|
||||
if (filters.isEmpty())
|
||||
filters = m_filters;
|
||||
@@ -250,4 +250,4 @@ void QuickOpenPlugin::refresh(QList<ILocatorFilter*> filters)
|
||||
connect(progress, SIGNAL(finished()), this, SLOT(saveSettings()));
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(QuickOpenPlugin)
|
||||
Q_EXPORT_PLUGIN(LocatorPlugin)
|
||||
@@ -27,8 +27,8 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QUICKOPENPLUGIN_H
|
||||
#define QUICKOPENPLUGIN_H
|
||||
#ifndef LOCATORPLUGIN_H
|
||||
#define LOCATORPLUGIN_H
|
||||
|
||||
#include "ilocatorfilter.h"
|
||||
#include "directoryfilter.h"
|
||||
@@ -46,15 +46,15 @@ class LocatorWidget;
|
||||
class OpenDocumentsFilter;
|
||||
class FileSystemFilter;
|
||||
class SettingsPage;
|
||||
class QuickOpenPlugin;
|
||||
class LocatorPlugin;
|
||||
|
||||
class QuickOpenPlugin : public ExtensionSystem::IPlugin
|
||||
class LocatorPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QuickOpenPlugin();
|
||||
~QuickOpenPlugin();
|
||||
LocatorPlugin();
|
||||
~LocatorPlugin();
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *error_message);
|
||||
void extensionsInitialized();
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
void QuickOpenPlugin::loadSettingsHelper(S *settings)
|
||||
void LocatorPlugin::loadSettingsHelper(S *settings)
|
||||
{
|
||||
settings->beginGroup("QuickOpen");
|
||||
m_refreshTimer.setInterval(settings->value("RefreshInterval", 60).toInt() * 60000);
|
||||
@@ -123,4 +123,4 @@ void QuickOpenPlugin::loadSettingsHelper(S *settings)
|
||||
} // namespace Internal
|
||||
} // namespace QuickOpen
|
||||
|
||||
#endif // QUICKOPENPLUGIN_H
|
||||
#endif // LOCATORPLUGIN_H
|
||||
@@ -38,7 +38,7 @@ unsigned int qHash(const QuickOpen::FilterEntry &entry);
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "locatorwidget.h"
|
||||
#include "quickopenplugin.h"
|
||||
#include "locatorplugin.h"
|
||||
#include "quickopenconstants.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -246,8 +246,8 @@ void CompletionList::updatePreferredSize()
|
||||
|
||||
// =========== LocatorWidget ===========
|
||||
|
||||
LocatorWidget::LocatorWidget(QuickOpenPlugin *qop) :
|
||||
m_quickOpenPlugin(qop),
|
||||
LocatorWidget::LocatorWidget(LocatorPlugin *qop) :
|
||||
m_locatorPlugin(qop),
|
||||
m_quickOpenModel(new QuickOpenModel(this)),
|
||||
m_completionList(new CompletionList(this)),
|
||||
m_filterMenu(new QMenu(this)),
|
||||
@@ -293,7 +293,7 @@ LocatorWidget::LocatorWidget(QuickOpenPlugin *qop) :
|
||||
|
||||
m_fileLineEdit->setMenu( m_filterMenu);
|
||||
|
||||
connect(m_refreshAction, SIGNAL(triggered()), m_quickOpenPlugin, SLOT(refresh()));
|
||||
connect(m_refreshAction, SIGNAL(triggered()), m_locatorPlugin, SLOT(refresh()));
|
||||
connect(m_configureAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog()));
|
||||
connect(m_fileLineEdit, SIGNAL(textEdited(const QString&)),
|
||||
this, SLOT(showPopup()));
|
||||
@@ -309,7 +309,7 @@ bool LocatorWidget::isShowingTypeHereMessage() const
|
||||
void LocatorWidget::updateFilterList()
|
||||
{
|
||||
m_filterMenu->clear();
|
||||
foreach (ILocatorFilter *filter, m_quickOpenPlugin->filters()) {
|
||||
foreach (ILocatorFilter *filter, m_locatorPlugin->filters()) {
|
||||
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
|
||||
QAction *action = m_filterMenu->addAction(filter->trName(), this, SLOT(filterSelected()));
|
||||
action->setData(qVariantFromValue(filter));
|
||||
@@ -374,7 +374,7 @@ void LocatorWidget::showPopup()
|
||||
|
||||
QList<ILocatorFilter*> LocatorWidget::filtersFor(const QString &text, QString &searchText)
|
||||
{
|
||||
QList<ILocatorFilter*> filters = m_quickOpenPlugin->filters();
|
||||
QList<ILocatorFilter*> filters = m_locatorPlugin->filters();
|
||||
int whiteSpace = text.indexOf(" ");
|
||||
QString prefix;
|
||||
if (whiteSpace >= 0)
|
||||
@@ -463,7 +463,7 @@ void LocatorWidget::filterSelected()
|
||||
// add shortcut string at front or replace existing shortcut string
|
||||
if (!currentText.isEmpty()) {
|
||||
searchText = currentText;
|
||||
foreach (ILocatorFilter *otherfilter, m_quickOpenPlugin->filters()) {
|
||||
foreach (ILocatorFilter *otherfilter, m_locatorPlugin->filters()) {
|
||||
if (currentText.startsWith(otherfilter->shortcutString() + " ")) {
|
||||
searchText = currentText.mid(otherfilter->shortcutString().length()+1);
|
||||
break;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef LOCATORWIDGET_H
|
||||
#define LOCATORWIDGET_H
|
||||
|
||||
#include "quickopenplugin.h"
|
||||
#include "locatorplugin.h"
|
||||
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtGui/QWidget>
|
||||
@@ -59,7 +59,7 @@ class LocatorWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LocatorWidget(QuickOpenPlugin *qop);
|
||||
LocatorWidget(LocatorPlugin *qop);
|
||||
|
||||
void updateFilterList();
|
||||
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
void updateCompletionList(const QString &text);
|
||||
QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText);
|
||||
|
||||
QuickOpenPlugin *m_quickOpenPlugin;
|
||||
LocatorPlugin *m_locatorPlugin;
|
||||
QuickOpenModel *m_quickOpenModel;
|
||||
|
||||
CompletionList *m_completionList;
|
||||
|
||||
@@ -3,7 +3,7 @@ TARGET = QuickOpen
|
||||
DEFINES += QUICKOPEN_LIBRARY
|
||||
include(../../qtcreatorplugin.pri)
|
||||
include(quickopen_dependencies.pri)
|
||||
HEADERS += quickopenplugin.h \
|
||||
HEADERS += locatorplugin.h \
|
||||
locatorwidget.h \
|
||||
quickopenfiltersfilter.h \
|
||||
settingspage.h \
|
||||
@@ -15,7 +15,7 @@ HEADERS += quickopenplugin.h \
|
||||
locatormanager.h \
|
||||
basefilefilter.h \
|
||||
quickopen_global.h
|
||||
SOURCES += quickopenplugin.cpp \
|
||||
SOURCES += locatorplugin.cpp \
|
||||
locatorwidget.cpp \
|
||||
quickopenfiltersfilter.cpp \
|
||||
opendocumentsfilter.cpp \
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "quickopenfiltersfilter.h"
|
||||
#include "quickopenplugin.h"
|
||||
#include "locatorplugin.h"
|
||||
#include "locatorwidget.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -38,7 +38,7 @@ using namespace QuickOpen::Internal;
|
||||
|
||||
Q_DECLARE_METATYPE(ILocatorFilter*);
|
||||
|
||||
QuickOpenFiltersFilter::QuickOpenFiltersFilter(QuickOpenPlugin *plugin,
|
||||
QuickOpenFiltersFilter::QuickOpenFiltersFilter(LocatorPlugin *plugin,
|
||||
LocatorWidget *locatorWidget):
|
||||
m_plugin(plugin),
|
||||
m_locatorWidget(locatorWidget),
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
namespace QuickOpen {
|
||||
namespace Internal {
|
||||
|
||||
class QuickOpenPlugin;
|
||||
class LocatorPlugin;
|
||||
class LocatorWidget;
|
||||
|
||||
/*!
|
||||
@@ -49,7 +49,7 @@ class QuickOpenFiltersFilter : public ILocatorFilter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QuickOpenFiltersFilter(QuickOpenPlugin *plugin,
|
||||
QuickOpenFiltersFilter(LocatorPlugin *plugin,
|
||||
LocatorWidget *locatorWidget);
|
||||
|
||||
// ILocatorFilter
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
bool isConfigurable() const;
|
||||
|
||||
private:
|
||||
QuickOpenPlugin *m_plugin;
|
||||
LocatorPlugin *m_plugin;
|
||||
LocatorWidget *m_locatorWidget;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "settingspage.h"
|
||||
#include "quickopenconstants.h"
|
||||
|
||||
#include "quickopenplugin.h"
|
||||
#include "locatorplugin.h"
|
||||
#include "ilocatorfilter.h"
|
||||
#include "directoryfilter.h"
|
||||
|
||||
@@ -44,7 +44,7 @@ Q_DECLARE_METATYPE(QuickOpen::ILocatorFilter*)
|
||||
using namespace QuickOpen;
|
||||
using namespace QuickOpen::Internal;
|
||||
|
||||
SettingsPage::SettingsPage(QuickOpenPlugin *plugin)
|
||||
SettingsPage::SettingsPage(LocatorPlugin *plugin)
|
||||
: m_plugin(plugin), m_page(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ class ILocatorFilter;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QuickOpenPlugin;
|
||||
class LocatorPlugin;
|
||||
|
||||
class SettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsPage(QuickOpenPlugin *plugin);
|
||||
explicit SettingsPage(LocatorPlugin *plugin);
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString category() const;
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
void requestRefresh();
|
||||
|
||||
Ui::SettingsWidget m_ui;
|
||||
QuickOpenPlugin *m_plugin;
|
||||
LocatorPlugin *m_plugin;
|
||||
QWidget* m_page;
|
||||
QList<ILocatorFilter *> m_filters;
|
||||
QList<ILocatorFilter *> m_addedFilters;
|
||||
|
||||
Reference in New Issue
Block a user