forked from qt-creator/qt-creator
Core: simplify ILocator interface
Use data members instead of virtual functions for id, displayName and priority, use Core::Id, not QStrings for id, de-pimpl CommandLocator. Change-Id: Id8b41f184cb995138b2d76c923d6d3ae02b7e3f5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -45,6 +45,8 @@ using namespace Utils;
|
|||||||
|
|
||||||
CMakeLocatorFilter::CMakeLocatorFilter()
|
CMakeLocatorFilter::CMakeLocatorFilter()
|
||||||
{
|
{
|
||||||
|
setId("Build CMake target");
|
||||||
|
setDisplayName(tr("Build CMake target"));
|
||||||
setShortcutString(QLatin1String("cm"));
|
setShortcutString(QLatin1String("cm"));
|
||||||
|
|
||||||
ProjectExplorer::SessionManager *sm = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
ProjectExplorer::SessionManager *sm = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
|
@@ -45,10 +45,6 @@ public:
|
|||||||
CMakeLocatorFilter();
|
CMakeLocatorFilter();
|
||||||
~CMakeLocatorFilter();
|
~CMakeLocatorFilter();
|
||||||
|
|
||||||
QString displayName() const { return tr("Build CMake target"); }
|
|
||||||
QString id() const { return QLatin1String("Build CMake target"); }
|
|
||||||
Priority priority() const { return Medium; }
|
|
||||||
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -270,9 +270,9 @@ public:
|
|||||||
// Helpers to sort by category. id
|
// Helpers to sort by category. id
|
||||||
bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
|
bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
|
||||||
{
|
{
|
||||||
if (const int cc = p1->category().toString().compare(p2->category().toString()))
|
if (p1->category() != p2->category())
|
||||||
return cc < 0;
|
return p1->category().alphabeticallyBefore(p2->category());
|
||||||
return p1->id().toString().compare(p2->id().toString()) < 0;
|
return p1->id().alphabeticallyBefore(p2->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QList<Core::IOptionsPage*> sortedOptionsPages()
|
static inline QList<Core::IOptionsPage*> sortedOptionsPages()
|
||||||
|
@@ -323,4 +323,9 @@ CORE_EXPORT const char *nameForId(int id)
|
|||||||
return stringFromId.value(id).str;
|
return stringFromId.value(id).str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Id::alphabeticallyBefore(Id other) const
|
||||||
|
{
|
||||||
|
return toString().compare(other.toString(), Qt::CaseInsensitive) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@@ -64,6 +64,7 @@ public:
|
|||||||
bool operator!=(const char *name) const { return !operator==(name); }
|
bool operator!=(const char *name) const { return !operator==(name); }
|
||||||
bool operator<(Id id) const { return m_id < id.m_id; }
|
bool operator<(Id id) const { return m_id < id.m_id; }
|
||||||
bool operator>(Id id) const { return m_id > id.m_id; }
|
bool operator>(Id id) const { return m_id > id.m_id; }
|
||||||
|
bool alphabeticallyBefore(Id other) const;
|
||||||
int uniqueIdentifier() const { return m_id; }
|
int uniqueIdentifier() const { return m_id; }
|
||||||
static Id fromUniqueIdentifier(int uid) { return Id(uid); }
|
static Id fromUniqueIdentifier(int uid) { return Id(uid); }
|
||||||
static Id fromString(const QString &str); // FIXME: avoid.
|
static Id fromString(const QString &str); // FIXME: avoid.
|
||||||
|
@@ -35,8 +35,10 @@ using namespace CppTools::Internal;
|
|||||||
CppClassesFilter::CppClassesFilter(CppModelManager *manager)
|
CppClassesFilter::CppClassesFilter(CppModelManager *manager)
|
||||||
: CppLocatorFilter(manager)
|
: CppLocatorFilter(manager)
|
||||||
{
|
{
|
||||||
|
setId("Classes");
|
||||||
setShortcutString(QLatin1String("c"));
|
setShortcutString(QLatin1String("c"));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
|
setDisplayName(tr("C++ Classes"));
|
||||||
|
|
||||||
search.setSymbolsToSearchFor(SymbolSearcher::Classes);
|
search.setSymbolsToSearchFor(SymbolSearcher::Classes);
|
||||||
search.setSeparateScope(true);
|
search.setSeparateScope(true);
|
||||||
|
@@ -42,10 +42,6 @@ class CPPTOOLS_EXPORT CppClassesFilter : public Internal::CppLocatorFilter
|
|||||||
public:
|
public:
|
||||||
CppClassesFilter(Internal::CppModelManager *manager);
|
CppClassesFilter(Internal::CppModelManager *manager);
|
||||||
~CppClassesFilter();
|
~CppClassesFilter();
|
||||||
|
|
||||||
QString displayName() const { return tr("C++ Classes"); }
|
|
||||||
QString id() const { return QLatin1String("Classes"); }
|
|
||||||
Priority priority() const { return Medium; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppTools
|
} // namespace CppTools
|
||||||
|
@@ -40,6 +40,8 @@ using namespace CPlusPlus;
|
|||||||
CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager)
|
CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager)
|
||||||
: m_modelManager(manager)
|
: m_modelManager(manager)
|
||||||
{
|
{
|
||||||
|
setId("Methods in current Document");
|
||||||
|
setDisplayName(tr("C++ Methods in Current Document"));
|
||||||
setShortcutString(QString(QLatin1Char('.')));
|
setShortcutString(QString(QLatin1Char('.')));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
|
|
||||||
|
@@ -50,9 +50,6 @@ public:
|
|||||||
CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||||
~CppCurrentDocumentFilter() {}
|
~CppCurrentDocumentFilter() {}
|
||||||
|
|
||||||
QString displayName() const { return tr("C++ Methods in Current Document"); }
|
|
||||||
QString id() const { return QLatin1String("Methods in current Document"); }
|
|
||||||
Priority priority() const { return Medium; }
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -34,6 +34,8 @@ using namespace CppTools::Internal;
|
|||||||
CppFunctionsFilter::CppFunctionsFilter(CppModelManager *manager)
|
CppFunctionsFilter::CppFunctionsFilter(CppModelManager *manager)
|
||||||
: CppLocatorFilter(manager)
|
: CppLocatorFilter(manager)
|
||||||
{
|
{
|
||||||
|
setId("Methods");
|
||||||
|
setDisplayName(tr("C++ Methods and Functions"));
|
||||||
setShortcutString(QString(QLatin1Char('m')));
|
setShortcutString(QString(QLatin1Char('m')));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
|
|
||||||
|
@@ -42,10 +42,6 @@ class CppFunctionsFilter : public CppLocatorFilter
|
|||||||
public:
|
public:
|
||||||
CppFunctionsFilter(CppModelManager *manager);
|
CppFunctionsFilter(CppModelManager *manager);
|
||||||
~CppFunctionsFilter();
|
~CppFunctionsFilter();
|
||||||
|
|
||||||
QString displayName() const { return tr("C++ Methods and Functions"); }
|
|
||||||
QString id() const { return QLatin1String("Methods"); }
|
|
||||||
Priority priority() const { return Medium; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -43,6 +43,8 @@ CppLocatorFilter::CppLocatorFilter(CppModelManager *manager)
|
|||||||
: m_manager(manager),
|
: m_manager(manager),
|
||||||
m_forceNewSearchList(true)
|
m_forceNewSearchList(true)
|
||||||
{
|
{
|
||||||
|
setId("Classes and Methods");
|
||||||
|
setDisplayName(tr("C++ Classes and Methods"));
|
||||||
setShortcutString(QString(QLatin1Char(':')));
|
setShortcutString(QString(QLatin1Char(':')));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
|
|
||||||
|
@@ -41,13 +41,11 @@ class CppModelManager;
|
|||||||
class CppLocatorFilter : public Locator::ILocatorFilter
|
class CppLocatorFilter : public Locator::ILocatorFilter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CppLocatorFilter(CppModelManager *manager);
|
CppLocatorFilter(CppModelManager *manager);
|
||||||
~CppLocatorFilter();
|
~CppLocatorFilter();
|
||||||
|
|
||||||
QString displayName() const { return tr("C++ Classes and Methods"); }
|
|
||||||
QString id() const { return QLatin1String("Classes and Methods"); }
|
|
||||||
Priority priority() const { return Medium; }
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -46,8 +46,11 @@ Q_DECLARE_METATYPE(ILocatorFilter*)
|
|||||||
|
|
||||||
HelpIndexFilter::HelpIndexFilter()
|
HelpIndexFilter::HelpIndexFilter()
|
||||||
{
|
{
|
||||||
|
setId("HelpIndexFilter");
|
||||||
|
setDisplayName(tr("Help Index"));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
setShortcutString(QString(QLatin1Char('?')));
|
setShortcutString(QString(QLatin1Char('?')));
|
||||||
|
|
||||||
m_icon = QIcon(QLatin1String(":/help/images/bookmark.png"));
|
m_icon = QIcon(QLatin1String(":/help/images/bookmark.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,21 +58,6 @@ HelpIndexFilter::~HelpIndexFilter()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HelpIndexFilter::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Help Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString HelpIndexFilter::id() const
|
|
||||||
{
|
|
||||||
return QLatin1String("HelpIndexFilter");
|
|
||||||
}
|
|
||||||
|
|
||||||
ILocatorFilter::Priority HelpIndexFilter::priority() const
|
|
||||||
{
|
|
||||||
return Medium;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<FilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
|
QList<FilterEntry> HelpIndexFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
|
||||||
{
|
{
|
||||||
QStringList keywords;
|
QStringList keywords;
|
||||||
|
@@ -46,9 +46,6 @@ public:
|
|||||||
~HelpIndexFilter();
|
~HelpIndexFilter();
|
||||||
|
|
||||||
// ILocatorFilter
|
// ILocatorFilter
|
||||||
QString displayName() const;
|
|
||||||
QString id() const;
|
|
||||||
Priority priority() const;
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -80,8 +80,11 @@ void RemoteFilterOptions::updateRemoveButton()
|
|||||||
|
|
||||||
RemoteHelpFilter::RemoteHelpFilter()
|
RemoteHelpFilter::RemoteHelpFilter()
|
||||||
{
|
{
|
||||||
|
setId("RemoteHelpFilter");
|
||||||
|
setDisplayName(tr("Web Search"));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
setShortcutString(QLatin1String("r"));
|
setShortcutString(QLatin1String("r"));
|
||||||
|
|
||||||
m_remoteUrls.append(QLatin1String("http://www.bing.com/search?q=%1"));
|
m_remoteUrls.append(QLatin1String("http://www.bing.com/search?q=%1"));
|
||||||
m_remoteUrls.append(QLatin1String("http://www.google.com/search?q=%1"));
|
m_remoteUrls.append(QLatin1String("http://www.google.com/search?q=%1"));
|
||||||
m_remoteUrls.append(QLatin1String("http://search.yahoo.com/search?p=%1"));
|
m_remoteUrls.append(QLatin1String("http://search.yahoo.com/search?p=%1"));
|
||||||
@@ -93,21 +96,6 @@ RemoteHelpFilter::~RemoteHelpFilter()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteHelpFilter::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Web Search");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString RemoteHelpFilter::id() const
|
|
||||||
{
|
|
||||||
return QLatin1String("RemoteHelpFilter");
|
|
||||||
}
|
|
||||||
|
|
||||||
Locator::ILocatorFilter::Priority RemoteHelpFilter::priority() const
|
|
||||||
{
|
|
||||||
return Medium;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Locator::FilterEntry> RemoteHelpFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &pattern)
|
QList<Locator::FilterEntry> RemoteHelpFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &pattern)
|
||||||
{
|
{
|
||||||
QList<Locator::FilterEntry> entries;
|
QList<Locator::FilterEntry> entries;
|
||||||
|
@@ -47,9 +47,6 @@ public:
|
|||||||
~RemoteHelpFilter();
|
~RemoteHelpFilter();
|
||||||
|
|
||||||
// ILocatorFilter
|
// ILocatorFilter
|
||||||
QString displayName() const;
|
|
||||||
QString id() const;
|
|
||||||
Priority priority() const;
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -38,14 +39,8 @@
|
|||||||
|
|
||||||
namespace Locator {
|
namespace Locator {
|
||||||
|
|
||||||
struct CommandLocatorPrivate {
|
struct CommandLocatorPrivate
|
||||||
CommandLocatorPrivate(const QString &prefix,
|
{
|
||||||
const QString &displayName) :
|
|
||||||
m_prefix(prefix), m_displayName(displayName) {}
|
|
||||||
|
|
||||||
const QString m_prefix;
|
|
||||||
const QString m_displayName;
|
|
||||||
|
|
||||||
QList<Core::Command *> commands;
|
QList<Core::Command *> commands;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,8 +49,10 @@ CommandLocator::CommandLocator(const QString &prefix,
|
|||||||
const QString &shortCutString,
|
const QString &shortCutString,
|
||||||
QObject *parent) :
|
QObject *parent) :
|
||||||
Locator::ILocatorFilter(parent),
|
Locator::ILocatorFilter(parent),
|
||||||
d(new CommandLocatorPrivate(prefix, displayName))
|
d(new CommandLocatorPrivate)
|
||||||
{
|
{
|
||||||
|
setId(Core::Id::fromString(prefix));
|
||||||
|
setDisplayName(displayName);
|
||||||
setShortcutString(shortCutString);
|
setShortcutString(shortCutString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,21 +66,6 @@ void CommandLocator::appendCommand(Core::Command *cmd)
|
|||||||
d->commands.push_back(cmd);
|
d->commands.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CommandLocator::displayName() const
|
|
||||||
{
|
|
||||||
return d->m_displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CommandLocator::id() const
|
|
||||||
{
|
|
||||||
return d->m_prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILocatorFilter::Priority CommandLocator::priority() const
|
|
||||||
{
|
|
||||||
return Medium;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Locator::FilterEntry> CommandLocator::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
|
QList<Locator::FilterEntry> CommandLocator::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
|
||||||
{
|
{
|
||||||
QList<FilterEntry> filters;
|
QList<FilterEntry> filters;
|
||||||
|
@@ -32,15 +32,8 @@
|
|||||||
|
|
||||||
#include "locator_global.h"
|
#include "locator_global.h"
|
||||||
#include "ilocatorfilter.h"
|
#include "ilocatorfilter.h"
|
||||||
#include <QList>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
namespace Core { class Command; }
|
||||||
class QAction;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class Command;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Locator {
|
namespace Locator {
|
||||||
/* Command locators: Provides completion for a set of
|
/* Command locators: Provides completion for a set of
|
||||||
@@ -57,27 +50,18 @@ public:
|
|||||||
const QString &displayName,
|
const QString &displayName,
|
||||||
const QString &shortCutString,
|
const QString &shortCutString,
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
virtual ~CommandLocator();
|
~CommandLocator();
|
||||||
|
|
||||||
void appendCommand(Core::Command *cmd);
|
void appendCommand(Core::Command *cmd);
|
||||||
|
|
||||||
virtual QString displayName() const;
|
QList<FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
virtual QString id() const;
|
void accept(FilterEntry selection) const;
|
||||||
virtual Priority priority() const;
|
void refresh(QFutureInterface<void> &future);
|
||||||
virtual QList<FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
|
||||||
virtual void accept(FilterEntry selection) const;
|
|
||||||
virtual void refresh(QFutureInterface<void> &future);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CommandLocatorPrivate *d;
|
CommandLocatorPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline CommandLocator &operator<<(CommandLocator &locator, Core::Command *cmd)
|
|
||||||
{
|
|
||||||
locator.appendCommand(cmd);
|
|
||||||
return locator;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Locator
|
} // namespace Locator
|
||||||
|
|
||||||
#endif // COMMANDLOCATOR_H
|
#endif // COMMANDLOCATOR_H
|
||||||
|
@@ -43,11 +43,16 @@ using namespace Locator::Internal;
|
|||||||
|
|
||||||
DirectoryFilter::DirectoryFilter()
|
DirectoryFilter::DirectoryFilter()
|
||||||
: m_name(tr("Generic Directory Filter")),
|
: m_name(tr("Generic Directory Filter")),
|
||||||
m_filters(QStringList() << QLatin1String("*.h") << QLatin1String("*.cpp")
|
|
||||||
<< QLatin1String("*.ui") << QLatin1String("*.qrc")),
|
|
||||||
m_dialog(0)
|
m_dialog(0)
|
||||||
{
|
{
|
||||||
|
setId(Core::Id::fromString(m_name));
|
||||||
setIncludedByDefault(true);
|
setIncludedByDefault(true);
|
||||||
|
setDisplayName(m_name);
|
||||||
|
|
||||||
|
m_filters.append(QLatin1String("*.h"));
|
||||||
|
m_filters.append(QLatin1String("*.cpp"));
|
||||||
|
m_filters.append(QLatin1String("*.ui"));
|
||||||
|
m_filters.append(QLatin1String("*.qrc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DirectoryFilter::saveState() const
|
QByteArray DirectoryFilter::saveState() const
|
||||||
|
@@ -48,9 +48,6 @@ class DirectoryFilter : public BaseFileFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DirectoryFilter();
|
DirectoryFilter();
|
||||||
QString displayName() const { return m_name; }
|
|
||||||
QString id() const { return m_name; }
|
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Medium; }
|
|
||||||
QByteArray saveState() const;
|
QByteArray saveState() const;
|
||||||
bool restoreState(const QByteArray &state);
|
bool restoreState(const QByteArray &state);
|
||||||
bool openConfigDialog(QWidget *parent, bool &needsRefresh);
|
bool openConfigDialog(QWidget *parent, bool &needsRefresh);
|
||||||
|
@@ -41,6 +41,8 @@ using namespace Locator::Internal;
|
|||||||
|
|
||||||
ExecuteFilter::ExecuteFilter()
|
ExecuteFilter::ExecuteFilter()
|
||||||
{
|
{
|
||||||
|
setId("Execute custom commands");
|
||||||
|
setDisplayName(tr("Execute Custom Commands"));
|
||||||
setShortcutString(QString(QLatin1Char('!')));
|
setShortcutString(QString(QLatin1Char('!')));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
|
|
||||||
|
@@ -53,9 +53,6 @@ class ExecuteFilter : public Locator::ILocatorFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ExecuteFilter();
|
ExecuteFilter();
|
||||||
QString displayName() const { return tr("Execute Custom Commands"); }
|
|
||||||
QString id() const { return QLatin1String("Execute custom commands"); }
|
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Medium; }
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future,
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future,
|
||||||
const QString &entry);
|
const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
|
@@ -41,6 +41,8 @@ using namespace Locator::Internal;
|
|||||||
FileSystemFilter::FileSystemFilter(EditorManager *editorManager, LocatorWidget *locatorWidget)
|
FileSystemFilter::FileSystemFilter(EditorManager *editorManager, LocatorWidget *locatorWidget)
|
||||||
: m_editorManager(editorManager), m_locatorWidget(locatorWidget), m_includeHidden(true)
|
: m_editorManager(editorManager), m_locatorWidget(locatorWidget), m_includeHidden(true)
|
||||||
{
|
{
|
||||||
|
setId("Files in file system");
|
||||||
|
setDisplayName(tr("Files in File System"));
|
||||||
setShortcutString(QString(QLatin1Char('f')));
|
setShortcutString(QString(QLatin1Char('f')));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
}
|
}
|
||||||
|
@@ -38,9 +38,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core { class EditorManager; }
|
||||||
class EditorManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Locator {
|
namespace Locator {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -53,9 +51,6 @@ class FileSystemFilter : public Locator::ILocatorFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FileSystemFilter(Core::EditorManager *editorManager, LocatorWidget *locatorWidget);
|
FileSystemFilter(Core::EditorManager *editorManager, LocatorWidget *locatorWidget);
|
||||||
QString displayName() const { return tr("Files in File System"); }
|
|
||||||
QString id() const { return QLatin1String("Files in file system"); }
|
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Medium; }
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
QByteArray saveState() const;
|
QByteArray saveState() const;
|
||||||
|
@@ -40,9 +40,11 @@ using namespace Locator;
|
|||||||
|
|
||||||
ILocatorFilter::ILocatorFilter(QObject *parent):
|
ILocatorFilter::ILocatorFilter(QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
|
m_priority(Medium),
|
||||||
m_includedByDefault(false),
|
m_includedByDefault(false),
|
||||||
m_hidden(false),
|
m_hidden(false),
|
||||||
m_enabled(true)
|
m_enabled(true),
|
||||||
|
m_isConfigurable(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +116,25 @@ bool ILocatorFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ILocatorFilter::trimWildcards(const QString &str)
|
||||||
|
{
|
||||||
|
if (str.isEmpty())
|
||||||
|
return str;
|
||||||
|
int first = 0, last = str.size()-1;
|
||||||
|
const QChar asterisk = QLatin1Char('*');
|
||||||
|
const QChar question = QLatin1Char('?');
|
||||||
|
while (first < str.size() && (str.at(first) == asterisk || str.at(first) == question))
|
||||||
|
++first;
|
||||||
|
while (last >= 0 && (str.at(last) == asterisk || str.at(last) == question))
|
||||||
|
--last;
|
||||||
|
if (first > last)
|
||||||
|
return QString();
|
||||||
|
return str.mid(first, last-first+1);
|
||||||
|
}
|
||||||
|
|
||||||
bool ILocatorFilter::isConfigurable() const
|
bool ILocatorFilter::isConfigurable() const
|
||||||
{
|
{
|
||||||
return true;
|
return m_isConfigurable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ILocatorFilter::isIncludedByDefault() const
|
bool ILocatorFilter::isIncludedByDefault() const
|
||||||
@@ -144,7 +162,42 @@ bool ILocatorFilter::isEnabled() const
|
|||||||
return m_enabled;
|
return m_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core::Id ILocatorFilter::id() const
|
||||||
|
{
|
||||||
|
return m_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ILocatorFilter::displayName() const
|
||||||
|
{
|
||||||
|
return m_displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
ILocatorFilter::Priority ILocatorFilter::priority() const
|
||||||
|
{
|
||||||
|
return m_priority;
|
||||||
|
}
|
||||||
|
|
||||||
void ILocatorFilter::setEnabled(bool enabled)
|
void ILocatorFilter::setEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
m_enabled = enabled;
|
m_enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ILocatorFilter::setId(Core::Id id)
|
||||||
|
{
|
||||||
|
m_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ILocatorFilter::setPriority(Priority priority)
|
||||||
|
{
|
||||||
|
m_priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ILocatorFilter::setDisplayName(const QString &displayString)
|
||||||
|
{
|
||||||
|
m_displayName = displayString;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ILocatorFilter::setConfigurable(bool configurable)
|
||||||
|
{
|
||||||
|
m_isConfigurable = configurable;
|
||||||
|
}
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include "locator_global.h"
|
#include "locator_global.h"
|
||||||
|
|
||||||
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
@@ -88,14 +90,14 @@ public:
|
|||||||
ILocatorFilter(QObject *parent = 0);
|
ILocatorFilter(QObject *parent = 0);
|
||||||
virtual ~ILocatorFilter() {}
|
virtual ~ILocatorFilter() {}
|
||||||
|
|
||||||
/* Visible name. */
|
/* Internal Id. */
|
||||||
virtual QString displayName() const = 0;
|
Core::Id id() const;
|
||||||
|
|
||||||
/* Internal name. */
|
/* Visible name. */
|
||||||
virtual QString id() const = 0;
|
QString displayName() const;
|
||||||
|
|
||||||
/* Selection list order in case of multiple active filters (high goes on top). */
|
/* Selection list order in case of multiple active filters (high goes on top). */
|
||||||
virtual Priority priority() const = 0;
|
Priority priority() const;
|
||||||
|
|
||||||
/* String to type to use this filter exclusively. */
|
/* String to type to use this filter exclusively. */
|
||||||
QString shortcutString() const;
|
QString shortcutString() const;
|
||||||
@@ -124,7 +126,7 @@ public:
|
|||||||
|
|
||||||
/* If there is a configure dialog available for this filter. The default
|
/* If there is a configure dialog available for this filter. The default
|
||||||
* implementation returns true. */
|
* implementation returns true. */
|
||||||
virtual bool isConfigurable() const;
|
bool isConfigurable() const;
|
||||||
|
|
||||||
/* Is this filter used also when the shortcutString is not used? */
|
/* Is this filter used also when the shortcutString is not used? */
|
||||||
bool isIncludedByDefault() const;
|
bool isIncludedByDefault() const;
|
||||||
@@ -135,20 +137,7 @@ public:
|
|||||||
/* Returns whether the filter should be enabled and used in menus. */
|
/* Returns whether the filter should be enabled and used in menus. */
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
|
|
||||||
static QString trimWildcards(const QString &str) {
|
static QString trimWildcards(const QString &str);
|
||||||
if (str.isEmpty())
|
|
||||||
return str;
|
|
||||||
int first = 0, last = str.size()-1;
|
|
||||||
const QChar asterisk = QLatin1Char('*');
|
|
||||||
const QChar question = QLatin1Char('?');
|
|
||||||
while (first < str.size() && (str.at(first) == asterisk || str.at(first) == question))
|
|
||||||
++first;
|
|
||||||
while (last >= 0 && (str.at(last) == asterisk || str.at(last) == question))
|
|
||||||
--last;
|
|
||||||
if (first > last)
|
|
||||||
return QString();
|
|
||||||
return str.mid(first, last-first+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/* Enable or disable the filter. */
|
/* Enable or disable the filter. */
|
||||||
@@ -158,12 +147,20 @@ protected:
|
|||||||
void setShortcutString(const QString &shortcut);
|
void setShortcutString(const QString &shortcut);
|
||||||
void setIncludedByDefault(bool includedByDefault);
|
void setIncludedByDefault(bool includedByDefault);
|
||||||
void setHidden(bool hidden);
|
void setHidden(bool hidden);
|
||||||
|
void setId(Core::Id id);
|
||||||
|
void setPriority(Priority priority);
|
||||||
|
void setDisplayName(const QString &displayString);
|
||||||
|
void setConfigurable(bool configurable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Core::Id m_id;
|
||||||
QString m_shortcut;
|
QString m_shortcut;
|
||||||
|
Priority m_priority;
|
||||||
|
QString m_displayName;
|
||||||
bool m_includedByDefault;
|
bool m_includedByDefault;
|
||||||
bool m_hidden;
|
bool m_hidden;
|
||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
|
bool m_isConfigurable;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Locator
|
} // namespace Locator
|
||||||
|
@@ -44,23 +44,12 @@ LocatorFiltersFilter::LocatorFiltersFilter(LocatorPlugin *plugin,
|
|||||||
m_locatorWidget(locatorWidget),
|
m_locatorWidget(locatorWidget),
|
||||||
m_icon(QIcon(QLatin1String(Core::Constants::ICON_NEXT)))
|
m_icon(QIcon(QLatin1String(Core::Constants::ICON_NEXT)))
|
||||||
{
|
{
|
||||||
|
setId("FiltersFilter");
|
||||||
|
setDisplayName(tr("Available filters"));
|
||||||
setIncludedByDefault(true);
|
setIncludedByDefault(true);
|
||||||
setHidden(true);
|
setHidden(true);
|
||||||
}
|
setPriority(High);
|
||||||
|
setConfigurable(false);
|
||||||
QString LocatorFiltersFilter::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Available filters");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LocatorFiltersFilter::id() const
|
|
||||||
{
|
|
||||||
return QLatin1String("FiltersFilter");
|
|
||||||
}
|
|
||||||
|
|
||||||
ILocatorFilter::Priority LocatorFiltersFilter::priority() const
|
|
||||||
{
|
|
||||||
return High;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
|
QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry)
|
||||||
@@ -104,8 +93,3 @@ void LocatorFiltersFilter::refresh(QFutureInterface<void> &future)
|
|||||||
Q_UNUSED(future)
|
Q_UNUSED(future)
|
||||||
// Nothing to refresh
|
// Nothing to refresh
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocatorFiltersFilter::isConfigurable() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
@@ -53,13 +53,9 @@ public:
|
|||||||
LocatorWidget *locatorWidget);
|
LocatorWidget *locatorWidget);
|
||||||
|
|
||||||
// ILocatorFilter
|
// ILocatorFilter
|
||||||
QString displayName() const;
|
|
||||||
QString id() const;
|
|
||||||
Priority priority() const;
|
|
||||||
QList<FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(FilterEntry selection) const;
|
void accept(FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
bool isConfigurable() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LocatorPlugin *m_plugin;
|
LocatorPlugin *m_plugin;
|
||||||
|
@@ -74,9 +74,7 @@ namespace {
|
|||||||
return true;
|
return true;
|
||||||
if (first->priority() > second->priority())
|
if (first->priority() > second->priority())
|
||||||
return false;
|
return false;
|
||||||
if (first->id().compare(second->id(), Qt::CaseInsensitive) < 0)
|
return first->id().alphabeticallyBefore(second->id());
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +198,7 @@ void LocatorPlugin::saveSettings()
|
|||||||
s->setValue(QLatin1String("RefreshInterval"), refreshInterval());
|
s->setValue(QLatin1String("RefreshInterval"), refreshInterval());
|
||||||
foreach (ILocatorFilter *filter, m_filters) {
|
foreach (ILocatorFilter *filter, m_filters) {
|
||||||
if (!m_customFilters.contains(filter))
|
if (!m_customFilters.contains(filter))
|
||||||
s->setValue(filter->id(), filter->saveState());
|
s->setValue(filter->id().toString(), filter->saveState());
|
||||||
}
|
}
|
||||||
s->beginGroup(QLatin1String("CustomFilters"));
|
s->beginGroup(QLatin1String("CustomFilters"));
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@@ -108,8 +108,8 @@ void LocatorPlugin::loadSettingsHelper(S *settings)
|
|||||||
m_refreshTimer.setInterval(settings->value(QLatin1String("RefreshInterval"), 60).toInt() * 60000);
|
m_refreshTimer.setInterval(settings->value(QLatin1String("RefreshInterval"), 60).toInt() * 60000);
|
||||||
|
|
||||||
foreach (ILocatorFilter *filter, m_filters) {
|
foreach (ILocatorFilter *filter, m_filters) {
|
||||||
if (settings->contains(filter->id())) {
|
if (settings->contains(filter->id().toString())) {
|
||||||
const QByteArray state = settings->value(filter->id()).toByteArray();
|
const QByteArray state = settings->value(filter->id().toString()).toByteArray();
|
||||||
if (!state.isEmpty())
|
if (!state.isEmpty())
|
||||||
filter->restoreState(state);
|
filter->restoreState(state);
|
||||||
}
|
}
|
||||||
|
@@ -317,37 +317,36 @@ void LocatorWidget::updateFilterList()
|
|||||||
m_filterMenu->clear();
|
m_filterMenu->clear();
|
||||||
|
|
||||||
// update actions and menu
|
// update actions and menu
|
||||||
QMap<QString, QAction *> actionCopy = m_filterActionMap;
|
QMap<Id, QAction *> actionCopy = m_filterActionMap;
|
||||||
m_filterActionMap.clear();
|
m_filterActionMap.clear();
|
||||||
// register new actions, update existent
|
// register new actions, update existent
|
||||||
foreach (ILocatorFilter *filter, m_locatorPlugin->filters()) {
|
foreach (ILocatorFilter *filter, m_locatorPlugin->filters()) {
|
||||||
if (filter->shortcutString().isEmpty() || filter->isHidden())
|
if (filter->shortcutString().isEmpty() || filter->isHidden())
|
||||||
continue;
|
continue;
|
||||||
Core::Id locatorId = Core::Id::fromString(QLatin1String("Locator.") + filter->id());
|
Id filterId = filter->id();
|
||||||
|
Id locatorId = filterId.withPrefix("Locator.");
|
||||||
QAction *action = 0;
|
QAction *action = 0;
|
||||||
Core::Command *cmd = 0;
|
Command *cmd = 0;
|
||||||
if (!actionCopy.contains(filter->id())) {
|
if (!actionCopy.contains(filterId)) {
|
||||||
// register new action
|
// register new action
|
||||||
action = new QAction(filter->displayName(), this);
|
action = new QAction(filter->displayName(), this);
|
||||||
cmd = Core::ActionManager::registerAction(action, locatorId,
|
cmd = ActionManager::registerAction(action, locatorId,
|
||||||
Core::Context(Core::Constants::C_GLOBAL));
|
Context(Core::Constants::C_GLOBAL));
|
||||||
cmd->setAttribute(Core::Command::CA_UpdateText);
|
cmd->setAttribute(Command::CA_UpdateText);
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(filterSelected()));
|
connect(action, SIGNAL(triggered()), this, SLOT(filterSelected()));
|
||||||
action->setData(qVariantFromValue(filter));
|
action->setData(qVariantFromValue(filter));
|
||||||
} else {
|
} else {
|
||||||
action = actionCopy.take(filter->id());
|
action = actionCopy.take(filterId);
|
||||||
action->setText(filter->displayName());
|
action->setText(filterId.toString());
|
||||||
cmd = Core::ActionManager::command(locatorId);
|
cmd = ActionManager::command(locatorId);
|
||||||
}
|
}
|
||||||
m_filterActionMap.insert(filter->id(), action);
|
m_filterActionMap.insert(filterId, action);
|
||||||
m_filterMenu->addAction(cmd->action());
|
m_filterMenu->addAction(cmd->action());
|
||||||
}
|
}
|
||||||
|
|
||||||
// unregister actions that are deleted now
|
// unregister actions that are deleted now
|
||||||
foreach (const QString &id, actionCopy.keys()) {
|
foreach (const Id id, actionCopy.keys())
|
||||||
Core::ActionManager::unregisterAction(actionCopy.value(id),
|
ActionManager::unregisterAction(actionCopy.value(id), id.withPrefix("Locator."));
|
||||||
Core::Id::fromString(QLatin1String("Locator.") + id));
|
|
||||||
}
|
|
||||||
qDeleteAll(actionCopy);
|
qDeleteAll(actionCopy);
|
||||||
|
|
||||||
m_filterMenu->addSeparator();
|
m_filterMenu->addSeparator();
|
||||||
|
@@ -95,7 +95,7 @@ private:
|
|||||||
Utils::FilterLineEdit *m_fileLineEdit;
|
Utils::FilterLineEdit *m_fileLineEdit;
|
||||||
QTimer *m_showPopupTimer;
|
QTimer *m_showPopupTimer;
|
||||||
QFutureWatcher<FilterEntry> *m_entriesWatcher;
|
QFutureWatcher<FilterEntry> *m_entriesWatcher;
|
||||||
QMap<QString, QAction *> m_filterActionMap;
|
QMap<Core::Id, QAction *> m_filterActionMap;
|
||||||
bool m_updateRequested;
|
bool m_updateRequested;
|
||||||
bool m_acceptRequested;
|
bool m_acceptRequested;
|
||||||
bool m_possibleToolTipRequest;
|
bool m_possibleToolTipRequest;
|
||||||
|
@@ -44,12 +44,15 @@ using namespace Utils;
|
|||||||
OpenDocumentsFilter::OpenDocumentsFilter(EditorManager *editorManager) :
|
OpenDocumentsFilter::OpenDocumentsFilter(EditorManager *editorManager) :
|
||||||
m_editorManager(editorManager)
|
m_editorManager(editorManager)
|
||||||
{
|
{
|
||||||
|
setId("Open documents");
|
||||||
|
setDisplayName(tr("Open Documents"));
|
||||||
|
setShortcutString(QString(QLatin1Char('o')));
|
||||||
|
setIncludedByDefault(true);
|
||||||
|
|
||||||
connect(m_editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
connect(m_editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||||
this, SLOT(refreshInternally()));
|
this, SLOT(refreshInternally()));
|
||||||
connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||||
this, SLOT(refreshInternally()));
|
this, SLOT(refreshInternally()));
|
||||||
setShortcutString(QString(QLatin1Char('o')));
|
|
||||||
setIncludedByDefault(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<FilterEntry> OpenDocumentsFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry_)
|
QList<FilterEntry> OpenDocumentsFilter::matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry_)
|
||||||
|
@@ -52,9 +52,6 @@ class OpenDocumentsFilter : public Locator::ILocatorFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OpenDocumentsFilter(Core::EditorManager *editorManager);
|
explicit OpenDocumentsFilter(Core::EditorManager *editorManager);
|
||||||
QString displayName() const { return tr("Open Documents"); }
|
|
||||||
QString id() const { return QLatin1String("Open documents"); }
|
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Medium; }
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -43,6 +43,8 @@ using namespace Macros::Internal;
|
|||||||
MacroLocatorFilter::MacroLocatorFilter():
|
MacroLocatorFilter::MacroLocatorFilter():
|
||||||
m_icon(QPixmap(QLatin1String(":/macros/images/macro.png")))
|
m_icon(QPixmap(QLatin1String(":/macros/images/macro.png")))
|
||||||
{
|
{
|
||||||
|
setId("Macros");
|
||||||
|
setDisplayName(tr("Macros"));
|
||||||
setShortcutString(QLatin1String("rm"));
|
setShortcutString(QLatin1String("rm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,10 +48,6 @@ public:
|
|||||||
MacroLocatorFilter();
|
MacroLocatorFilter();
|
||||||
~MacroLocatorFilter();
|
~MacroLocatorFilter();
|
||||||
|
|
||||||
QString displayName() const { return tr("Macros"); }
|
|
||||||
QString id() const { return QLatin1String("Macros"); }
|
|
||||||
Priority priority() const { return Medium; }
|
|
||||||
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -42,10 +42,14 @@ using namespace ProjectExplorer::Internal;
|
|||||||
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
|
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
|
||||||
: m_projectExplorer(pe), m_filesUpToDate(false)
|
: m_projectExplorer(pe), m_filesUpToDate(false)
|
||||||
{
|
{
|
||||||
|
setId("Files in any project");
|
||||||
|
setDisplayName(tr("Files in Any Project"));
|
||||||
|
setShortcutString(QString(QLatin1Char('a')));
|
||||||
|
setPriority(Low);
|
||||||
|
setIncludedByDefault(true);
|
||||||
|
|
||||||
connect(m_projectExplorer, SIGNAL(fileListChanged()),
|
connect(m_projectExplorer, SIGNAL(fileListChanged()),
|
||||||
this, SLOT(markFilesAsOutOfDate()));
|
this, SLOT(markFilesAsOutOfDate()));
|
||||||
setShortcutString(QString(QLatin1Char('a')));
|
|
||||||
setIncludedByDefault(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllProjectsFilter::markFilesAsOutOfDate()
|
void AllProjectsFilter::markFilesAsOutOfDate()
|
||||||
|
@@ -47,9 +47,6 @@ class AllProjectsFilter : public Locator::BaseFileFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AllProjectsFilter(ProjectExplorerPlugin *pe);
|
explicit AllProjectsFilter(ProjectExplorerPlugin *pe);
|
||||||
QString displayName() const { return tr("Files in Any Project"); }
|
|
||||||
QString id() const { return QLatin1String("Files in any project"); }
|
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Low; }
|
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -41,12 +41,14 @@ using namespace ProjectExplorer::Internal;
|
|||||||
CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe)
|
CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe)
|
||||||
: BaseFileFilter(), m_projectExplorer(pe), m_project(0), m_filesUpToDate(false)
|
: BaseFileFilter(), m_projectExplorer(pe), m_project(0), m_filesUpToDate(false)
|
||||||
{
|
{
|
||||||
m_projectExplorer = pe;
|
setId("Files in current project");
|
||||||
|
setDisplayName(tr("Files in Current Project"));
|
||||||
|
setPriority(Low);
|
||||||
|
setShortcutString(QString(QLatin1Char('p')));
|
||||||
|
setIncludedByDefault(false);
|
||||||
|
|
||||||
connect(m_projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
connect(m_projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(currentProjectChanged(ProjectExplorer::Project*)));
|
this, SLOT(currentProjectChanged(ProjectExplorer::Project*)));
|
||||||
setShortcutString(QString(QLatin1Char('p')));
|
|
||||||
setIncludedByDefault(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentProjectFilter::markFilesAsOutOfDate()
|
void CurrentProjectFilter::markFilesAsOutOfDate()
|
||||||
|
@@ -47,9 +47,6 @@ class CurrentProjectFilter : public Locator::BaseFileFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CurrentProjectFilter(ProjectExplorerPlugin *pe);
|
CurrentProjectFilter(ProjectExplorerPlugin *pe);
|
||||||
QString displayName() const { return tr("Files in Current Project"); }
|
|
||||||
QString id() const { return QLatin1String("Files in current project"); }
|
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::Low; }
|
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -60,7 +57,6 @@ private slots:
|
|||||||
void markFilesAsOutOfDate();
|
void markFilesAsOutOfDate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ProjectExplorerPlugin *m_projectExplorer;
|
ProjectExplorerPlugin *m_projectExplorer;
|
||||||
Project *m_project;
|
Project *m_project;
|
||||||
bool m_filesUpToDate;
|
bool m_filesUpToDate;
|
||||||
|
@@ -43,6 +43,8 @@ FunctionFilter::FunctionFilter(LocatorData *data, QObject *parent)
|
|||||||
: Locator::ILocatorFilter(parent)
|
: Locator::ILocatorFilter(parent)
|
||||||
, m_data(data)
|
, m_data(data)
|
||||||
{
|
{
|
||||||
|
setId("Functions");
|
||||||
|
setDisplayName(tr("QML Methods and Functions"));
|
||||||
setShortcutString(QString(QLatin1Char('m')));
|
setShortcutString(QString(QLatin1Char('m')));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
}
|
}
|
||||||
|
@@ -40,13 +40,11 @@ class LocatorData;
|
|||||||
class FunctionFilter : public Locator::ILocatorFilter
|
class FunctionFilter : public Locator::ILocatorFilter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FunctionFilter(LocatorData *data, QObject *parent = 0);
|
explicit FunctionFilter(LocatorData *data, QObject *parent = 0);
|
||||||
~FunctionFilter();
|
~FunctionFilter();
|
||||||
|
|
||||||
QString displayName() const { return tr("QML Methods and Functions"); }
|
|
||||||
QString id() const { return QLatin1String("Functions"); }
|
|
||||||
Priority priority() const { return Medium; }
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
@@ -44,6 +44,9 @@ using namespace TextEditor::Internal;
|
|||||||
LineNumberFilter::LineNumberFilter(QObject *parent)
|
LineNumberFilter::LineNumberFilter(QObject *parent)
|
||||||
: ILocatorFilter(parent)
|
: ILocatorFilter(parent)
|
||||||
{
|
{
|
||||||
|
setId("Line in current document");
|
||||||
|
setDisplayName(tr("Line in Current Document"));
|
||||||
|
setPriority(High);
|
||||||
setShortcutString(QString(QLatin1Char('l')));
|
setShortcutString(QString(QLatin1Char('l')));
|
||||||
setIncludedByDefault(true);
|
setIncludedByDefault(true);
|
||||||
}
|
}
|
||||||
|
@@ -49,9 +49,6 @@ class LineNumberFilter : public Locator::ILocatorFilter
|
|||||||
public:
|
public:
|
||||||
explicit LineNumberFilter(QObject *parent = 0);
|
explicit LineNumberFilter(QObject *parent = 0);
|
||||||
|
|
||||||
QString displayName() const { return tr("Line in Current Document"); }
|
|
||||||
QString id() const { return QLatin1String("Line in current document"); }
|
|
||||||
Locator::ILocatorFilter::Priority priority() const { return Locator::ILocatorFilter::High; }
|
|
||||||
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
void refresh(QFutureInterface<void> &) {}
|
void refresh(QFutureInterface<void> &) {}
|
||||||
|
Reference in New Issue
Block a user