forked from qt-creator/qt-creator
Locator: Whitespace fixes.
Change-Id: I8ae3c7b28586d8248a677c9f1f365cacf0709240 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
committed by
André Hartmann
parent
d87f10a920
commit
a31b1ef562
@@ -65,7 +65,7 @@ QList<FilterEntry> ExecuteFilter::matchesFor(QFutureInterface<Locator::FilterEnt
|
|||||||
value.append(FilterEntry(this, entry, QVariant()));
|
value.append(FilterEntry(this, entry, QVariant()));
|
||||||
QList<FilterEntry> others;
|
QList<FilterEntry> others;
|
||||||
const Qt::CaseSensitivity caseSensitivityForPrefix = caseSensitivity(entry);
|
const Qt::CaseSensitivity caseSensitivityForPrefix = caseSensitivity(entry);
|
||||||
foreach (const QString& i, m_commandHistory) {
|
foreach (const QString &i, m_commandHistory) {
|
||||||
if (future.isCanceled())
|
if (future.isCanceled())
|
||||||
break;
|
break;
|
||||||
if (i == entry) // avoid repeated entry
|
if (i == entry) // avoid repeated entry
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ QString ILocatorFilter::trimWildcards(const QString &str)
|
|||||||
{
|
{
|
||||||
if (str.isEmpty())
|
if (str.isEmpty())
|
||||||
return str;
|
return str;
|
||||||
int first = 0, last = str.size()-1;
|
int first = 0, last = str.size() - 1;
|
||||||
const QChar asterisk = QLatin1Char('*');
|
const QChar asterisk = QLatin1Char('*');
|
||||||
const QChar question = QLatin1Char('?');
|
const QChar question = QLatin1Char('?');
|
||||||
while (first < str.size() && (str.at(first) == asterisk || str.at(first) == question))
|
while (first < str.size() && (str.at(first) == asterisk || str.at(first) == question))
|
||||||
@@ -129,7 +129,7 @@ QString ILocatorFilter::trimWildcards(const QString &str)
|
|||||||
--last;
|
--last;
|
||||||
if (first > last)
|
if (first > last)
|
||||||
return QString();
|
return QString();
|
||||||
return str.mid(first, last-first+1);
|
return str.mid(first, last - first + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::CaseSensitivity ILocatorFilter::caseSensitivity(const QString &str)
|
Qt::CaseSensitivity ILocatorFilter::caseSensitivity(const QString &str)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::Fi
|
|||||||
if (!entry.isEmpty())
|
if (!entry.isEmpty())
|
||||||
return entries;
|
return entries;
|
||||||
|
|
||||||
QMap<QString, ILocatorFilter*> uniqueFilters;
|
QMap<QString, ILocatorFilter *> uniqueFilters;
|
||||||
foreach (ILocatorFilter *filter, m_plugin->filters()) {
|
foreach (ILocatorFilter *filter, m_plugin->filters()) {
|
||||||
const QString filterId = filter->shortcutString() + QLatin1Char(',') + filter->displayName();
|
const QString filterId = filter->shortcutString() + QLatin1Char(',') + filter->displayName();
|
||||||
uniqueFilters.insert(filterId, filter);
|
uniqueFilters.insert(filterId, filter);
|
||||||
@@ -82,7 +82,7 @@ QList<FilterEntry> LocatorFiltersFilter::matchesFor(QFutureInterface<Locator::Fi
|
|||||||
|
|
||||||
void LocatorFiltersFilter::accept(FilterEntry selection) const
|
void LocatorFiltersFilter::accept(FilterEntry selection) const
|
||||||
{
|
{
|
||||||
ILocatorFilter *filter = selection.internalData.value<ILocatorFilter*>();
|
ILocatorFilter *filter = selection.internalData.value<ILocatorFilter *>();
|
||||||
if (filter)
|
if (filter)
|
||||||
m_locatorWidget->show(filter->shortcutString() + QLatin1Char(' '),
|
m_locatorWidget->show(filter->shortcutString() + QLatin1Char(' '),
|
||||||
filter->shortcutString().length() + 1);
|
filter->shortcutString().length() + 1);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
LocatorManager(Internal::LocatorWidget *locatorWidget);
|
LocatorManager(Internal::LocatorWidget *locatorWidget);
|
||||||
~LocatorManager();
|
~LocatorManager();
|
||||||
|
|
||||||
static LocatorManager* instance() { return m_instance; }
|
static LocatorManager *instance() { return m_instance; }
|
||||||
|
|
||||||
void show(const QString &text, int selectionStart = -1, int selectionLength = 0);
|
void show(const QString &text, int selectionStart = -1, int selectionLength = 0);
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ void LocatorPlugin::saveSettings()
|
|||||||
/*!
|
/*!
|
||||||
Return all filters, including the ones created by the user.
|
Return all filters, including the ones created by the user.
|
||||||
*/
|
*/
|
||||||
QList<ILocatorFilter*> LocatorPlugin::filters()
|
QList<ILocatorFilter *> LocatorPlugin::filters()
|
||||||
{
|
{
|
||||||
return m_filters;
|
return m_filters;
|
||||||
}
|
}
|
||||||
@@ -222,12 +222,12 @@ QList<ILocatorFilter*> LocatorPlugin::filters()
|
|||||||
This returns a subset of all the filters, that contains only the filters that
|
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).
|
have been created by the user at some point (maybe in a previous session).
|
||||||
*/
|
*/
|
||||||
QList<ILocatorFilter*> LocatorPlugin::customFilters()
|
QList<ILocatorFilter *> LocatorPlugin::customFilters()
|
||||||
{
|
{
|
||||||
return m_customFilters;
|
return m_customFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocatorPlugin::setFilters(QList<ILocatorFilter*> f)
|
void LocatorPlugin::setFilters(QList<ILocatorFilter *> f)
|
||||||
{
|
{
|
||||||
m_filters = f;
|
m_filters = f;
|
||||||
m_locatorWidget->updateFilterList();
|
m_locatorWidget->updateFilterList();
|
||||||
@@ -254,7 +254,7 @@ void LocatorPlugin::setRefreshInterval(int interval)
|
|||||||
m_refreshTimer.start();
|
m_refreshTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocatorPlugin::refresh(QList<ILocatorFilter*> filters)
|
void LocatorPlugin::refresh(QList<ILocatorFilter *> filters)
|
||||||
{
|
{
|
||||||
if (filters.isEmpty())
|
if (filters.isEmpty())
|
||||||
filters = m_filters;
|
filters = m_filters;
|
||||||
|
|||||||
@@ -66,15 +66,15 @@ public:
|
|||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
bool delayedInitialize();
|
bool delayedInitialize();
|
||||||
|
|
||||||
QList<ILocatorFilter*> filters();
|
QList<ILocatorFilter *> filters();
|
||||||
QList<ILocatorFilter*> customFilters();
|
QList<ILocatorFilter *> customFilters();
|
||||||
void setFilters(QList<ILocatorFilter*> f);
|
void setFilters(QList<ILocatorFilter *> f);
|
||||||
void setCustomFilters(QList<ILocatorFilter*> f);
|
void setCustomFilters(QList<ILocatorFilter *> f);
|
||||||
int refreshInterval();
|
int refreshInterval();
|
||||||
void setRefreshInterval(int interval);
|
void setRefreshInterval(int interval);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refresh(QList<ILocatorFilter*> filters = QList<ILocatorFilter*>());
|
void refresh(QList<ILocatorFilter *> filters = QList<ILocatorFilter *>());
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void openLocator();
|
void openLocator();
|
||||||
|
|
||||||
@@ -91,8 +91,8 @@ private:
|
|||||||
SettingsPage *m_settingsPage;
|
SettingsPage *m_settingsPage;
|
||||||
|
|
||||||
bool m_settingsInitialized;
|
bool m_settingsInitialized;
|
||||||
QList<ILocatorFilter*> m_filters;
|
QList<ILocatorFilter *> m_filters;
|
||||||
QList<ILocatorFilter*> m_customFilters;
|
QList<ILocatorFilter *> m_customFilters;
|
||||||
int m_refreshInterval;
|
int m_refreshInterval;
|
||||||
QTimer m_refreshTimer;
|
QTimer m_refreshTimer;
|
||||||
OpenDocumentsFilter *m_openDocumentsFilter;
|
OpenDocumentsFilter *m_openDocumentsFilter;
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
void updatePreferredSize();
|
void updatePreferredSize();
|
||||||
QSize preferredSize() const { return m_preferredSize; }
|
QSize preferredSize() const { return m_preferredSize; }
|
||||||
|
|
||||||
void focusOutEvent (QFocusEvent * event) {
|
void focusOutEvent (QFocusEvent *event) {
|
||||||
if (event->reason() == Qt::ActiveWindowFocusReason)
|
if (event->reason() == Qt::ActiveWindowFocusReason)
|
||||||
hide();
|
hide();
|
||||||
QTreeView::focusOutEvent(event);
|
QTreeView::focusOutEvent(event);
|
||||||
@@ -397,7 +397,7 @@ bool LocatorWidget::eventFilter(QObject *obj, QEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) {
|
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) {
|
||||||
QFocusEvent *fev = static_cast<QFocusEvent*>(event);
|
QFocusEvent *fev = static_cast<QFocusEvent *>(event);
|
||||||
if (fev->reason() != Qt::ActiveWindowFocusReason
|
if (fev->reason() != Qt::ActiveWindowFocusReason
|
||||||
|| (fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow())) {
|
|| (fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow())) {
|
||||||
m_completionList->hide();
|
m_completionList->hide();
|
||||||
@@ -454,9 +454,9 @@ void LocatorWidget::showPopupNow()
|
|||||||
showCompletionList();
|
showCompletionList();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ILocatorFilter*> LocatorWidget::filtersFor(const QString &text, QString &searchText)
|
QList<ILocatorFilter *> LocatorWidget::filtersFor(const QString &text, QString &searchText)
|
||||||
{
|
{
|
||||||
QList<ILocatorFilter*> filters = m_locatorPlugin->filters();
|
QList<ILocatorFilter *> filters = m_locatorPlugin->filters();
|
||||||
const int whiteSpace = text.indexOf(QLatin1Char(' '));
|
const int whiteSpace = text.indexOf(QLatin1Char(' '));
|
||||||
QString prefix;
|
QString prefix;
|
||||||
if (whiteSpace >= 0)
|
if (whiteSpace >= 0)
|
||||||
@@ -474,7 +474,7 @@ QList<ILocatorFilter*> LocatorWidget::filtersFor(const QString &text, QString &s
|
|||||||
return prefixFilters;
|
return prefixFilters;
|
||||||
}
|
}
|
||||||
searchText = text;
|
searchText = text;
|
||||||
QList<ILocatorFilter*> activeFilters;
|
QList<ILocatorFilter *> activeFilters;
|
||||||
foreach (ILocatorFilter *filter, filters)
|
foreach (ILocatorFilter *filter, filters)
|
||||||
if (filter->isIncludedByDefault())
|
if (filter->isIncludedByDefault())
|
||||||
activeFilters << filter;
|
activeFilters << filter;
|
||||||
@@ -485,7 +485,7 @@ void LocatorWidget::updateCompletionList(const QString &text)
|
|||||||
{
|
{
|
||||||
m_updateRequested = true;
|
m_updateRequested = true;
|
||||||
QString searchText;
|
QString searchText;
|
||||||
const QList<ILocatorFilter*> filters = filtersFor(text, searchText);
|
const QList<ILocatorFilter *> filters = filtersFor(text, searchText);
|
||||||
|
|
||||||
// cancel the old future
|
// cancel the old future
|
||||||
m_entriesWatcher->future().cancel();
|
m_entriesWatcher->future().cancel();
|
||||||
@@ -562,9 +562,9 @@ void LocatorWidget::show(const QString &text, int selectionStart, int selectionL
|
|||||||
void LocatorWidget::filterSelected()
|
void LocatorWidget::filterSelected()
|
||||||
{
|
{
|
||||||
QString searchText = tr("<type here>");
|
QString searchText = tr("<type here>");
|
||||||
QAction *action = qobject_cast<QAction*>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
QTC_ASSERT(action, return);
|
QTC_ASSERT(action, return);
|
||||||
ILocatorFilter *filter = action->data().value<ILocatorFilter*>();
|
ILocatorFilter *filter = action->data().value<ILocatorFilter *>();
|
||||||
QTC_ASSERT(filter, return);
|
QTC_ASSERT(filter, return);
|
||||||
QString currentText = m_fileLineEdit->text().trimmed();
|
QString currentText = m_fileLineEdit->text().trimmed();
|
||||||
// add shortcut string at front or replace existing shortcut string
|
// add shortcut string at front or replace existing shortcut string
|
||||||
@@ -572,7 +572,7 @@ void LocatorWidget::filterSelected()
|
|||||||
searchText = currentText;
|
searchText = currentText;
|
||||||
foreach (ILocatorFilter *otherfilter, m_locatorPlugin->filters()) {
|
foreach (ILocatorFilter *otherfilter, m_locatorPlugin->filters()) {
|
||||||
if (currentText.startsWith(otherfilter->shortcutString() + QLatin1Char(' '))) {
|
if (currentText.startsWith(otherfilter->shortcutString() + QLatin1Char(' '))) {
|
||||||
searchText = currentText.mid(otherfilter->shortcutString().length()+1);
|
searchText = currentText.mid(otherfilter->shortcutString().length() + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ private:
|
|||||||
|
|
||||||
Ui::SettingsWidget m_ui;
|
Ui::SettingsWidget m_ui;
|
||||||
LocatorPlugin *m_plugin;
|
LocatorPlugin *m_plugin;
|
||||||
QWidget* m_page;
|
QWidget *m_page;
|
||||||
QList<ILocatorFilter *> m_filters;
|
QList<ILocatorFilter *> m_filters;
|
||||||
QList<ILocatorFilter *> m_addedFilters;
|
QList<ILocatorFilter *> m_addedFilters;
|
||||||
QList<ILocatorFilter *> m_removedFilters;
|
QList<ILocatorFilter *> m_removedFilters;
|
||||||
|
|||||||
Reference in New Issue
Block a user