Merge remote-tracking branch 'origin/4.7' into 4.8

Change-Id: Ic90a78fb7be7b8eb23f250f04eb074813f2a004a
This commit is contained in:
Eike Ziller
2018-10-12 09:39:54 +02:00
3 changed files with 75 additions and 51 deletions

View File

@@ -1757,6 +1757,10 @@ Install an SDK of at least API version %1.</source>
<source>Alt+Shift+T,Alt+A</source> <source>Alt+Shift+T,Alt+A</source>
<translation>Alt+Shift+T,Alt+A</translation> <translation>Alt+Shift+T,Alt+A</translation>
</message> </message>
<message>
<source>Ctrl+Meta+T, Ctrl+Meta+A</source>
<translation>Ctrl+Meta+T, Ctrl+Meta+A</translation>
</message>
<message> <message>
<source>&amp;Run Selected Tests</source> <source>&amp;Run Selected Tests</source>
<translation>&amp;Запустить выбранные</translation> <translation>&amp;Запустить выбранные</translation>
@@ -1769,6 +1773,10 @@ Install an SDK of at least API version %1.</source>
<source>Alt+Shift+T,Alt+R</source> <source>Alt+Shift+T,Alt+R</source>
<translation>Alt+Shift+T,Alt+R</translation> <translation>Alt+Shift+T,Alt+R</translation>
</message> </message>
<message>
<source>Ctrl+Meta+T, Ctrl+Meta+R</source>
<translation>Ctrl+Meta+T, Ctrl+Meta+R</translation>
</message>
<message> <message>
<source>Run Tests for Current &amp;File</source> <source>Run Tests for Current &amp;File</source>
<translation>Запустить тесты для текущего &amp;файла</translation> <translation>Запустить тесты для текущего &amp;файла</translation>
@@ -1781,6 +1789,10 @@ Install an SDK of at least API version %1.</source>
<source>Alt+Shift+T,Alt+F</source> <source>Alt+Shift+T,Alt+F</source>
<translation>Alt+Shift+T,Alt+F</translation> <translation>Alt+Shift+T,Alt+F</translation>
</message> </message>
<message>
<source>Ctrl+Meta+T, Ctrl+Meta+F</source>
<translation>Ctrl+Meta+T, Ctrl+Meta+F</translation>
</message>
<message> <message>
<source>Re&amp;scan Tests</source> <source>Re&amp;scan Tests</source>
<translation>&amp;Пересканировать</translation> <translation>&amp;Пересканировать</translation>
@@ -1789,6 +1801,10 @@ Install an SDK of at least API version %1.</source>
<source>Alt+Shift+T,Alt+S</source> <source>Alt+Shift+T,Alt+S</source>
<translation>Alt+Shift+T,Alt+S</translation> <translation>Alt+Shift+T,Alt+S</translation>
</message> </message>
<message>
<source>Ctrl+Meta+T, Ctrl+Meta+S</source>
<translation>Ctrl+Meta+T, Ctrl+Meta+S</translation>
</message>
<message> <message>
<source>&amp;Run Test Under Cursor</source> <source>&amp;Run Test Under Cursor</source>
<translation>&amp;Запустить тест под курсором</translation> <translation>&amp;Запустить тест под курсором</translation>
@@ -11195,7 +11211,7 @@ Flags: %3</source>
<name>CppTools::TidyChecksTreeModel</name> <name>CppTools::TidyChecksTreeModel</name>
<message> <message>
<source>Web Page</source> <source>Web Page</source>
<translation>Вэб-страница</translation> <translation>Веб-страница</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -13312,7 +13328,7 @@ Affected are breakpoints %1</source>
</message> </message>
<message> <message>
<source>Start Debugging Without Deployment</source> <source>Start Debugging Without Deployment</source>
<translation>Начать отладку с установкой</translation> <translation>Начать отладку без установки</translation>
</message> </message>
<message> <message>
<source>Start and Debug External Application...</source> <source>Start and Debug External Application...</source>
@@ -26820,6 +26836,10 @@ to project &quot;%2&quot;.</source>
<source>Alt+Shift+L</source> <source>Alt+Shift+L</source>
<translation>Alt+Shift+L</translation> <translation>Alt+Shift+L</translation>
</message> </message>
<message>
<source>Meta+Shift+L</source>
<translation>Meta+Shift+L</translation>
</message>
<message> <message>
<source>Hide Empty Directories</source> <source>Hide Empty Directories</source>
<translation>Скрывать пустые каталоги</translation> <translation>Скрывать пустые каталоги</translation>
@@ -36383,7 +36403,7 @@ For more details, see /etc/sysctl.d/10-ptrace.conf
</message> </message>
<message> <message>
<source>Classes for displaying and editing Web content</source> <source>Classes for displaying and editing Web content</source>
<translation>Классы для отображения и правки вэб-страниц</translation> <translation>Классы для отображения и правки веб-страниц</translation>
</message> </message>
<message> <message>
<source>WebKit1 and QWidget-based classes from Qt 4 (Qt 5)</source> <source>WebKit1 and QWidget-based classes from Qt 4 (Qt 5)</source>
@@ -45318,6 +45338,10 @@ should a repository require SSH-authentication (see documentation on SSH and the
<source>No executable to deploy found in %1.</source> <source>No executable to deploy found in %1.</source>
<translation>В %1 не обнаружен исполняемый файл для установки.</translation> <translation>В %1 не обнаружен исполняемый файл для установки.</translation>
</message> </message>
<message>
<source>Cannot find windeployqt.exe in &quot;%1&quot;.</source>
<translation>Не удалось найти windeployqt.exe в «%1».</translation>
</message>
<message> <message>
<source>Cannot parse manifest file %1.</source> <source>Cannot parse manifest file %1.</source>
<translation>Не удалось разобрать файл манифеста %1.</translation> <translation>Не удалось разобрать файл манифеста %1.</translation>

View File

@@ -108,7 +108,7 @@ static inline int msvcStdVectorSize(const SymbolGroupValue &v)
const std::vector<std::string> innerTypes = v.innerTypes(); const std::vector<std::string> innerTypes = v.innerTypes();
if (innerTypes.empty()) if (innerTypes.empty())
return -1; return -1;
const std::string innerType = fixInnerType(SymbolGroupValue::stripPointerType(innerTypes[0]), v); const std::string innerType = fixInnerType(innerTypes[0], v);
const size_t size = SymbolGroupValue::sizeOf(innerType.c_str()); const size_t size = SymbolGroupValue::sizeOf(innerType.c_str());
if (size == 0) if (size == 0)
return -1; return -1;

View File

@@ -46,14 +46,14 @@ class DocumentContentCompletionProcessor : public IAssistProcessor
{ {
public: public:
DocumentContentCompletionProcessor(const QString &snippetGroupId); DocumentContentCompletionProcessor(const QString &snippetGroupId);
~DocumentContentCompletionProcessor() override;
IAssistProposal *perform(const AssistInterface *interface) override; IAssistProposal *perform(const AssistInterface *interface) override;
bool running() final { return m_running; } bool running() final { return m_watcher.isRunning(); }
private: private:
TextEditor::SnippetAssistCollector m_snippetCollector; QString m_snippetGroup;
IAssistProposal *createProposal(const AssistInterface *interface); QFutureWatcher<QStringList> m_watcher;
bool m_running = false;
}; };
DocumentContentCompletionProvider::DocumentContentCompletionProvider(const QString &snippetGroup) DocumentContentCompletionProvider::DocumentContentCompletionProvider(const QString &snippetGroup)
@@ -71,45 +71,39 @@ IAssistProcessor *DocumentContentCompletionProvider::createProcessor() const
} }
DocumentContentCompletionProcessor::DocumentContentCompletionProcessor(const QString &snippetGroupId) DocumentContentCompletionProcessor::DocumentContentCompletionProcessor(const QString &snippetGroupId)
: m_snippetCollector(snippetGroupId, QIcon(":/texteditor/images/snippet.png")) : m_snippetGroup(snippetGroupId)
{ } { }
DocumentContentCompletionProcessor::~DocumentContentCompletionProcessor()
{
if (m_watcher.isRunning())
m_watcher.cancel();
}
static void createProposal(QFutureInterface<QStringList> &future, const QString text)
{
const QRegularExpression wordRE("([a-zA-Z_][a-zA-Z0-9_]{2,})");
QSet<QString> words;
QRegularExpressionMatchIterator it = wordRE.globalMatch(text);
while (it.hasNext()) {
if (future.isCanceled())
return;
QRegularExpressionMatch match = it.next();
const QString &word = match.captured();
if (!words.contains(word))
words.insert(word);
}
future.reportResult(words.toList());
}
IAssistProposal *DocumentContentCompletionProcessor::perform(const AssistInterface *interface) IAssistProposal *DocumentContentCompletionProcessor::perform(const AssistInterface *interface)
{
Utils::onResultReady(Utils::runAsync(
&DocumentContentCompletionProcessor::createProposal, this, interface),
[this](IAssistProposal *proposal){
m_running = false;
setAsyncProposalAvailable(proposal);
});
m_running = true;
return nullptr;
}
static void generateProposalItems(const QString &text, QSet<QString> &words,
QList<AssistProposalItemInterface *> &items)
{
static const QRegularExpression wordRE("([a-zA-Z_][a-zA-Z0-9_]{2,})");
QRegularExpressionMatch match;
int index = text.indexOf(wordRE, 0, &match);
while (index >= 0) {
const QString &word = match.captured();
if (!words.contains(word)) {
auto item = new AssistProposalItem();
item->setText(word);
items.append(item);
words.insert(word);
}
index += word.size();
index = text.indexOf(wordRE, index, &match);
}
}
IAssistProposal *DocumentContentCompletionProcessor::createProposal(
const AssistInterface *interface)
{ {
QScopedPointer<const AssistInterface> assistInterface(interface); QScopedPointer<const AssistInterface> assistInterface(interface);
if (running())
return nullptr;
int pos = interface->position(); int pos = interface->position();
QChar chr; QChar chr;
@@ -126,14 +120,20 @@ IAssistProposal *DocumentContentCompletionProcessor::createProposal(
return nullptr; return nullptr;
} }
QSet<QString> words; const QString text = interface->textDocument()->toPlainText();
QList<AssistProposalItemInterface *> items = m_snippetCollector.collect();
QTextBlock block = interface->textDocument()->firstBlock();
while (block.isValid()) { m_watcher.setFuture(Utils::runAsync(&createProposal, text));
generateProposalItems(block.text(), words, items); QObject::connect(&m_watcher, &QFutureWatcher<QStringList>::resultReadyAt,
block = block.next(); &m_watcher, [this, pos](int index){
} const TextEditor::SnippetAssistCollector snippetCollector(
m_snippetGroup, QIcon(":/texteditor/images/snippet.png"));
return new GenericProposal(pos, items); QList<AssistProposalItemInterface *> items = snippetCollector.collect();
for (const QString &word : m_watcher.resultAt(index)) {
auto item = new AssistProposalItem();
item->setText(word);
items.append(item);
}
setAsyncProposalAvailable(new GenericProposal(pos, items));
});
return nullptr;
} }