forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.7' into 4.8
Change-Id: Ic90a78fb7be7b8eb23f250f04eb074813f2a004a
This commit is contained in:
@@ -1757,6 +1757,10 @@ Install an SDK of at least API version %1.</source>
|
||||
<source>Alt+Shift+T,Alt+A</source>
|
||||
<translation>Alt+Shift+T,Alt+A</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Meta+T, Ctrl+Meta+A</source>
|
||||
<translation>Ctrl+Meta+T, Ctrl+Meta+A</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Run Selected Tests</source>
|
||||
<translation>&Запустить выбранные</translation>
|
||||
@@ -1769,6 +1773,10 @@ Install an SDK of at least API version %1.</source>
|
||||
<source>Alt+Shift+T,Alt+R</source>
|
||||
<translation>Alt+Shift+T,Alt+R</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Meta+T, Ctrl+Meta+R</source>
|
||||
<translation>Ctrl+Meta+T, Ctrl+Meta+R</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Run Tests for Current &File</source>
|
||||
<translation>Запустить тесты для текущего &файла</translation>
|
||||
@@ -1781,6 +1789,10 @@ Install an SDK of at least API version %1.</source>
|
||||
<source>Alt+Shift+T,Alt+F</source>
|
||||
<translation>Alt+Shift+T,Alt+F</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Meta+T, Ctrl+Meta+F</source>
|
||||
<translation>Ctrl+Meta+T, Ctrl+Meta+F</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Re&scan Tests</source>
|
||||
<translation>&Пересканировать</translation>
|
||||
@@ -1789,6 +1801,10 @@ Install an SDK of at least API version %1.</source>
|
||||
<source>Alt+Shift+T,Alt+S</source>
|
||||
<translation>Alt+Shift+T,Alt+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Meta+T, Ctrl+Meta+S</source>
|
||||
<translation>Ctrl+Meta+T, Ctrl+Meta+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Run Test Under Cursor</source>
|
||||
<translation>&Запустить тест под курсором</translation>
|
||||
@@ -11195,7 +11211,7 @@ Flags: %3</source>
|
||||
<name>CppTools::TidyChecksTreeModel</name>
|
||||
<message>
|
||||
<source>Web Page</source>
|
||||
<translation>Вэб-страница</translation>
|
||||
<translation>Веб-страница</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -13312,7 +13328,7 @@ Affected are breakpoints %1</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start Debugging Without Deployment</source>
|
||||
<translation>Начать отладку с установкой</translation>
|
||||
<translation>Начать отладку без установки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Start and Debug External Application...</source>
|
||||
@@ -26820,6 +26836,10 @@ to project "%2".</source>
|
||||
<source>Alt+Shift+L</source>
|
||||
<translation>Alt+Shift+L</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Meta+Shift+L</source>
|
||||
<translation>Meta+Shift+L</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hide Empty Directories</source>
|
||||
<translation>Скрывать пустые каталоги</translation>
|
||||
@@ -36383,7 +36403,7 @@ For more details, see /etc/sysctl.d/10-ptrace.conf
|
||||
</message>
|
||||
<message>
|
||||
<source>Classes for displaying and editing Web content</source>
|
||||
<translation>Классы для отображения и правки вэб-страниц</translation>
|
||||
<translation>Классы для отображения и правки веб-страниц</translation>
|
||||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<translation>В %1 не обнаружен исполняемый файл для установки.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cannot find windeployqt.exe in "%1".</source>
|
||||
<translation>Не удалось найти windeployqt.exe в «%1».</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cannot parse manifest file %1.</source>
|
||||
<translation>Не удалось разобрать файл манифеста %1.</translation>
|
||||
|
@@ -108,7 +108,7 @@ static inline int msvcStdVectorSize(const SymbolGroupValue &v)
|
||||
const std::vector<std::string> innerTypes = v.innerTypes();
|
||||
if (innerTypes.empty())
|
||||
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());
|
||||
if (size == 0)
|
||||
return -1;
|
||||
|
@@ -46,14 +46,14 @@ class DocumentContentCompletionProcessor : public IAssistProcessor
|
||||
{
|
||||
public:
|
||||
DocumentContentCompletionProcessor(const QString &snippetGroupId);
|
||||
~DocumentContentCompletionProcessor() override;
|
||||
|
||||
IAssistProposal *perform(const AssistInterface *interface) override;
|
||||
bool running() final { return m_running; }
|
||||
bool running() final { return m_watcher.isRunning(); }
|
||||
|
||||
private:
|
||||
TextEditor::SnippetAssistCollector m_snippetCollector;
|
||||
IAssistProposal *createProposal(const AssistInterface *interface);
|
||||
bool m_running = false;
|
||||
QString m_snippetGroup;
|
||||
QFutureWatcher<QStringList> m_watcher;
|
||||
};
|
||||
|
||||
DocumentContentCompletionProvider::DocumentContentCompletionProvider(const QString &snippetGroup)
|
||||
@@ -71,45 +71,39 @@ IAssistProcessor *DocumentContentCompletionProvider::createProcessor() const
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
if (running())
|
||||
return nullptr;
|
||||
|
||||
int pos = interface->position();
|
||||
|
||||
QChar chr;
|
||||
@@ -126,14 +120,20 @@ IAssistProposal *DocumentContentCompletionProcessor::createProposal(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QSet<QString> words;
|
||||
QList<AssistProposalItemInterface *> items = m_snippetCollector.collect();
|
||||
QTextBlock block = interface->textDocument()->firstBlock();
|
||||
const QString text = interface->textDocument()->toPlainText();
|
||||
|
||||
while (block.isValid()) {
|
||||
generateProposalItems(block.text(), words, items);
|
||||
block = block.next();
|
||||
}
|
||||
|
||||
return new GenericProposal(pos, items);
|
||||
m_watcher.setFuture(Utils::runAsync(&createProposal, text));
|
||||
QObject::connect(&m_watcher, &QFutureWatcher<QStringList>::resultReadyAt,
|
||||
&m_watcher, [this, pos](int index){
|
||||
const TextEditor::SnippetAssistCollector snippetCollector(
|
||||
m_snippetGroup, QIcon(":/texteditor/images/snippet.png"));
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user