forked from qt-creator/qt-creator
Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance
Amends: b2a766a79a
Round #2: This time done with Qt Creator's Analyzer, which
found other occurences than run-clang-tidy.py
Change-Id: I479e280c7abcf2d24baccbb0af69ae4bda05198e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -47,7 +47,7 @@ QString Theme::name() const
|
|||||||
|
|
||||||
QString Theme::translatedName() const
|
QString Theme::translatedName() const
|
||||||
{
|
{
|
||||||
return m_data ? QCoreApplication::instance()->translate("Theme", m_data->name().toUtf8().constData()) : QString();
|
return m_data ? QCoreApplication::translate("Theme", m_data->name().toUtf8().constData()) : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Theme::isReadOnly() const
|
bool Theme::isReadOnly() const
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ bool ConnectionClient::waitForConnected()
|
|||||||
return isConnected;
|
return isConnected;
|
||||||
else {
|
else {
|
||||||
QThread::msleep(30);
|
QThread::msleep(30);
|
||||||
QCoreApplication::instance()->processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ void TestCodeParser::syncTestFrameworks(const QList<ITestFramework *> &framework
|
|||||||
// there's a running parse
|
// there's a running parse
|
||||||
m_fullUpdatePostponed = m_partialUpdatePostponed = false;
|
m_fullUpdatePostponed = m_partialUpdatePostponed = false;
|
||||||
m_postponedFiles.clear();
|
m_postponedFiles.clear();
|
||||||
Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE);
|
Core::ProgressManager::cancelTasks(Constants::TASK_PARSE);
|
||||||
}
|
}
|
||||||
m_testCodeParsers.clear();
|
m_testCodeParsers.clear();
|
||||||
qCDebug(LOG) << "Setting" << frameworks << "as current parsers";
|
qCDebug(LOG) << "Setting" << frameworks << "as current parsers";
|
||||||
@@ -206,7 +206,7 @@ void TestCodeParser::onStartupProjectChanged(Project *project)
|
|||||||
{
|
{
|
||||||
if (m_parserState == FullParse || m_parserState == PartialParse) {
|
if (m_parserState == FullParse || m_parserState == PartialParse) {
|
||||||
qCDebug(LOG) << "Canceling scanForTest (startup project changed)";
|
qCDebug(LOG) << "Canceling scanForTest (startup project changed)";
|
||||||
Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE);
|
Core::ProgressManager::cancelTasks(Constants::TASK_PARSE);
|
||||||
}
|
}
|
||||||
emit aboutToPerformFullParse();
|
emit aboutToPerformFullParse();
|
||||||
if (project)
|
if (project)
|
||||||
@@ -271,7 +271,7 @@ bool TestCodeParser::postponed(const QStringList &fileList)
|
|||||||
m_postponedFiles.clear();
|
m_postponedFiles.clear();
|
||||||
m_fullUpdatePostponed = true;
|
m_fullUpdatePostponed = true;
|
||||||
qCDebug(LOG) << "Canceling scanForTest (full parse triggered while running a scan)";
|
qCDebug(LOG) << "Canceling scanForTest (full parse triggered while running a scan)";
|
||||||
Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE);
|
Core::ProgressManager::cancelTasks(Constants::TASK_PARSE);
|
||||||
} else {
|
} else {
|
||||||
// partial parse triggered, but full parse is postponed already, ignoring this
|
// partial parse triggered, but full parse is postponed already, ignoring this
|
||||||
if (m_fullUpdatePostponed)
|
if (m_fullUpdatePostponed)
|
||||||
@@ -393,7 +393,7 @@ void TestCodeParser::onTaskStarted(Utils::Id type)
|
|||||||
m_partialUpdatePostponed = !m_fullUpdatePostponed;
|
m_partialUpdatePostponed = !m_fullUpdatePostponed;
|
||||||
qCDebug(LOG) << "Canceling scan for test (CppModelParsing started)";
|
qCDebug(LOG) << "Canceling scan for test (CppModelParsing started)";
|
||||||
parsingHasFailed = true;
|
parsingHasFailed = true;
|
||||||
Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE);
|
Core::ProgressManager::cancelTasks(Constants::TASK_PARSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent) :
|
|||||||
this, &ConfigurationDialog::updateDocumentation);
|
this, &ConfigurationDialog::updateDocumentation);
|
||||||
|
|
||||||
// Set palette and font according to settings
|
// Set palette and font according to settings
|
||||||
const TextEditor::FontSettings fs = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings fs = TextEditor::TextEditorSettings::fontSettings();
|
||||||
const QTextCharFormat tf = fs.toTextCharFormat(TextEditor::C_TEXT);
|
const QTextCharFormat tf = fs.toTextCharFormat(TextEditor::C_TEXT);
|
||||||
const QTextCharFormat selectionFormat = fs.toTextCharFormat(TextEditor::C_SELECTION);
|
const QTextCharFormat selectionFormat = fs.toTextCharFormat(TextEditor::C_SELECTION);
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Internal {
|
|||||||
ConfigurationSyntaxHighlighter::ConfigurationSyntaxHighlighter(QTextDocument *parent) :
|
ConfigurationSyntaxHighlighter::ConfigurationSyntaxHighlighter(QTextDocument *parent) :
|
||||||
QSyntaxHighlighter(parent)
|
QSyntaxHighlighter(parent)
|
||||||
{
|
{
|
||||||
const TextEditor::FontSettings fs = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings fs = TextEditor::TextEditorSettings::fontSettings();
|
||||||
m_formatKeyword = fs.toTextCharFormat(TextEditor::C_FIELD);
|
m_formatKeyword = fs.toTextCharFormat(TextEditor::C_FIELD);
|
||||||
m_formatComment = fs.toTextCharFormat(TextEditor::C_COMMENT);
|
m_formatComment = fs.toTextCharFormat(TextEditor::C_COMMENT);
|
||||||
|
|
||||||
|
|||||||
@@ -1469,7 +1469,7 @@ void BinEditorWidget::zoomF(float delta)
|
|||||||
else if (step < 0 && step > -1)
|
else if (step < 0 && step > -1)
|
||||||
step = -1;
|
step = -1;
|
||||||
|
|
||||||
const int newZoom = TextEditor::TextEditorSettings::instance()->increaseFontZoom(int(step));
|
const int newZoom = TextEditor::TextEditorSettings::increaseFontZoom(int(step));
|
||||||
showZoomIndicator(this, newZoom);
|
showZoomIndicator(this, newZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void ClangAssistProposalItem::apply(TextDocumentManipulatorInterface &manipulato
|
|||||||
textToBeInserted.chop(2);
|
textToBeInserted.chop(2);
|
||||||
} else if (!ccr.text.isEmpty()) {
|
} else if (!ccr.text.isEmpty()) {
|
||||||
const CompletionSettings &completionSettings =
|
const CompletionSettings &completionSettings =
|
||||||
TextEditorSettings::instance()->completionSettings();
|
TextEditorSettings::completionSettings();
|
||||||
const bool autoInsertBrackets = completionSettings.m_autoInsertBrackets;
|
const bool autoInsertBrackets = completionSettings.m_autoInsertBrackets;
|
||||||
|
|
||||||
if (autoInsertBrackets &&
|
if (autoInsertBrackets &&
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ void addWarningSelections(const QVector<ClangBackEnd::DiagnosticContainer> &diag
|
|||||||
QTextDocument *textDocument,
|
QTextDocument *textDocument,
|
||||||
QList<QTextEdit::ExtraSelection> &extraSelections)
|
QList<QTextEdit::ExtraSelection> &extraSelections)
|
||||||
{
|
{
|
||||||
const auto fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const auto fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
|
|
||||||
QTextCharFormat warningFormat = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
QTextCharFormat warningFormat = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ void addErrorSelections(const QVector<ClangBackEnd::DiagnosticContainer> &diagno
|
|||||||
QTextDocument *textDocument,
|
QTextDocument *textDocument,
|
||||||
QList<QTextEdit::ExtraSelection> &extraSelections)
|
QList<QTextEdit::ExtraSelection> &extraSelections)
|
||||||
{
|
{
|
||||||
const auto fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const auto fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
|
|
||||||
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
||||||
QTextCharFormat errorContextFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR_CONTEXT);
|
QTextCharFormat errorContextFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR_CONTEXT);
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
|
|||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
|
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
|
||||||
rect = style()->visualRect(layoutDirection(), geometry(), rect);
|
rect = QStyle::visualRect(layoutDirection(), geometry(), rect);
|
||||||
const QRectF boderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
|
const QRectF boderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
|
||||||
|
|
||||||
if (creatorTheme()->flag(Theme::FlatToolBars)) {
|
if (creatorTheme()->flag(Theme::FlatToolBars)) {
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace Core {
|
|||||||
*/
|
*/
|
||||||
IMode::IMode(QObject *parent) : IContext(parent)
|
IMode::IMode(QObject *parent) : IContext(parent)
|
||||||
{
|
{
|
||||||
ModeManager::instance()->addMode(this);
|
ModeManager::addMode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -130,7 +130,7 @@ IMode::IMode(QObject *parent) : IContext(parent)
|
|||||||
*/
|
*/
|
||||||
IMode::~IMode()
|
IMode::~IMode()
|
||||||
{
|
{
|
||||||
ModeManager::instance()->removeMode(this);
|
ModeManager::removeMode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMode::setEnabled(bool enabled)
|
void IMode::setEnabled(bool enabled)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ QString AbstractEditorSupport::licenseTemplate(const QString &file, const QStrin
|
|||||||
|
|
||||||
bool AbstractEditorSupport::usePragmaOnce()
|
bool AbstractEditorSupport::usePragmaOnce()
|
||||||
{
|
{
|
||||||
return Internal::CppToolsPlugin::instance()->usePragmaOnce();
|
return Internal::CppToolsPlugin::usePragmaOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppTools
|
} // namespace CppTools
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ QList<QTextEdit::ExtraSelection> toTextEditorSelections(
|
|||||||
const QList<CPlusPlus::Document::DiagnosticMessage> &diagnostics,
|
const QList<CPlusPlus::Document::DiagnosticMessage> &diagnostics,
|
||||||
QTextDocument *textDocument)
|
QTextDocument *textDocument)
|
||||||
{
|
{
|
||||||
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
|
|
||||||
QTextCharFormat warningFormat = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
QTextCharFormat warningFormat = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
||||||
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ QStringList highlightExceptionCode(int lineNumber, const QString &filePath, cons
|
|||||||
const QList<IEditor *> editors = DocumentModel::editorsForFilePath(
|
const QList<IEditor *> editors = DocumentModel::editorsForFilePath(
|
||||||
Utils::FilePath::fromString(filePath));
|
Utils::FilePath::fromString(filePath));
|
||||||
|
|
||||||
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
||||||
|
|
||||||
for (IEditor *editor : editors) {
|
for (IEditor *editor : editors) {
|
||||||
|
|||||||
@@ -106,10 +106,8 @@ bool LogChangeWidget::init(const QString &repository, const QString &commit, Log
|
|||||||
return false;
|
return false;
|
||||||
if (m_model->rowCount() > 0)
|
if (m_model->rowCount() > 0)
|
||||||
return true;
|
return true;
|
||||||
if (!(flags & Silent)) {
|
if (!(flags & Silent))
|
||||||
VcsOutputWindow::appendError(
|
VcsOutputWindow::appendError(GitClient::msgNoCommits(flags & IncludeRemotes));
|
||||||
GitClient::instance()->msgNoCommits(flags & IncludeRemotes));
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ void GlslEditorWidget::updateDocumentNow()
|
|||||||
CreateRanges createRanges(document(), doc);
|
CreateRanges createRanges(document(), doc);
|
||||||
createRanges(ast);
|
createRanges(ast);
|
||||||
|
|
||||||
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
|
|
||||||
QTextCharFormat warningFormat = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
QTextCharFormat warningFormat = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
||||||
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ void SimulatorControlPrivate::startSimulator(QFutureInterface<SimulatorControl::
|
|||||||
auto start = chrono::high_resolution_clock::now();
|
auto start = chrono::high_resolution_clock::now();
|
||||||
while (simInfo.isShuttingDown() && !checkForTimeout(start, simulatorStartTimeout)) {
|
while (simInfo.isShuttingDown() && !checkForTimeout(start, simulatorStartTimeout)) {
|
||||||
// Wait till the simulator shuts down, if doing so.
|
// Wait till the simulator shuts down, if doing so.
|
||||||
QThread::currentThread()->msleep(100);
|
QThread::msleep(100);
|
||||||
simInfo = deviceInfo(simUdid);
|
simInfo = deviceInfo(simUdid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ static QTextEdit::ExtraSelection toDiagnosticsSelections(const Diagnostic &diagn
|
|||||||
cursor.setPosition(diagnostic.range().end().toPositionInDocument(textDocument),
|
cursor.setPosition(diagnostic.range().end().toPositionInDocument(textDocument),
|
||||||
QTextCursor::KeepAnchor);
|
QTextCursor::KeepAnchor);
|
||||||
|
|
||||||
const FontSettings &fontSettings = TextEditorSettings::instance()->fontSettings();
|
const FontSettings &fontSettings = TextEditorSettings::fontSettings();
|
||||||
const DiagnosticSeverity severity = diagnostic.severity().value_or(DiagnosticSeverity::Warning);
|
const DiagnosticSeverity severity = diagnostic.severity().value_or(DiagnosticSeverity::Warning);
|
||||||
const TextStyle style = severity == DiagnosticSeverity::Error ? C_ERROR : C_WARNING;
|
const TextStyle style = severity == DiagnosticSeverity::Error ? C_ERROR : C_WARNING;
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ bool TextEditorMacroHandler::executeEvent(const MacroEvent ¯oEvent)
|
|||||||
macroEvent.value(TEXT).toString(),
|
macroEvent.value(TEXT).toString(),
|
||||||
macroEvent.value(AUTOREP).toBool(),
|
macroEvent.value(AUTOREP).toBool(),
|
||||||
macroEvent.value(COUNT).toInt());
|
macroEvent.value(COUNT).toInt());
|
||||||
QApplication::instance()->sendEvent(m_currentEditor->widget(), &keyEvent);
|
QCoreApplication::sendEvent(m_currentEditor->widget(), &keyEvent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ void ExtraCompilerPrivate::updateIssues()
|
|||||||
cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
||||||
selection.cursor = cursor;
|
selection.cursor = cursor;
|
||||||
|
|
||||||
const auto fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const auto fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
selection.format = fontSettings.toTextCharFormat(issue.type == Task::Warning ?
|
selection.format = fontSettings.toTextCharFormat(issue.type == Task::Warning ?
|
||||||
TextEditor::C_WARNING : TextEditor::C_ERROR);
|
TextEditor::C_WARNING : TextEditor::C_ERROR);
|
||||||
selection.format.setToolTip(issue.description());
|
selection.format.setToolTip(issue.description());
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ void FolderNavigationWidget::openProjectsInDirectory(const QModelIndex &index)
|
|||||||
{
|
{
|
||||||
const QStringList projectFiles = projectsInDirectory(index);
|
const QStringList projectFiles = projectsInDirectory(index);
|
||||||
if (!projectFiles.isEmpty())
|
if (!projectFiles.isEmpty())
|
||||||
Core::ICore::instance()->openFiles(projectFiles);
|
Core::ICore::openFiles(projectFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderNavigationWidget::createNewFolder(const QModelIndex &parent)
|
void FolderNavigationWidget::createNewFolder(const QModelIndex &parent)
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ void JsonWizard::openFiles(const JsonWizard::GeneratorFiles &files)
|
|||||||
}
|
}
|
||||||
if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) {
|
if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) {
|
||||||
ProjectExplorerPlugin::OpenProjectResult result
|
ProjectExplorerPlugin::OpenProjectResult result
|
||||||
= ProjectExplorerPlugin::instance()->openProject(file.path());
|
= ProjectExplorerPlugin::openProject(file.path());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
errorMessage = result.errorMessage();
|
errorMessage = result.errorMessage();
|
||||||
if (errorMessage.isEmpty()) {
|
if (errorMessage.isEmpty()) {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ bool JsonWizardGenerator::formatFile(const JsonWizard *wizard, GeneratedFile *fi
|
|||||||
if (TextEditorSettings::storageSettings().m_cleanWhitespace) {
|
if (TextEditorSettings::storageSettings().m_cleanWhitespace) {
|
||||||
QTextBlock block = doc.firstBlock();
|
QTextBlock block = doc.firstBlock();
|
||||||
while (block.isValid()) {
|
while (block.isValid()) {
|
||||||
codeStylePrefs->currentTabSettings().removeTrailingWhitespace(cursor, block);
|
TabSettings::removeTrailingWhitespace(cursor, block);
|
||||||
block = block.next();
|
block = block.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ void ProjectFileWizardExtension::applyCodeStyle(GeneratedFile *file) const
|
|||||||
if (TextEditorSettings::storageSettings().m_cleanWhitespace) {
|
if (TextEditorSettings::storageSettings().m_cleanWhitespace) {
|
||||||
QTextBlock block = doc.firstBlock();
|
QTextBlock block = doc.firstBlock();
|
||||||
while (block.isValid()) {
|
while (block.isValid()) {
|
||||||
codeStylePrefs->currentTabSettings().removeTrailingWhitespace(cursor, block);
|
TabSettings::removeTrailingWhitespace(cursor, block);
|
||||||
block = block.next();
|
block = block.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -693,8 +693,8 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
|
|||||||
// Files are copied into the same directory as the current qml document
|
// Files are copied into the same directory as the current qml document
|
||||||
for (const auto ©File : copyFiles) {
|
for (const auto ©File : copyFiles) {
|
||||||
QFileInfo fi(copyFile);
|
QFileInfo fi(copyFile);
|
||||||
const QString targetFile = QmlDesignerPlugin::instance()->documentManager()
|
const QString targetFile = DocumentManager::currentFilePath().toFileInfo().dir()
|
||||||
.currentFilePath().toFileInfo().dir().absoluteFilePath(fi.fileName());
|
.absoluteFilePath(fi.fileName());
|
||||||
// We don't want to overwrite existing default files
|
// We don't want to overwrite existing default files
|
||||||
if (!QFileInfo::exists(targetFile)) {
|
if (!QFileInfo::exists(targetFile)) {
|
||||||
if (!QFile::copy(copyFile, targetFile))
|
if (!QFile::copy(copyFile, targetFile))
|
||||||
@@ -717,7 +717,7 @@ void NavigatorTreeModel::handleItemLibraryImageDrop(const QMimeData *mimeData, i
|
|||||||
ModelNode targetNode(modelNodeForIndex(rowModelIndex));
|
ModelNode targetNode(modelNodeForIndex(rowModelIndex));
|
||||||
|
|
||||||
const QString imageSource = QString::fromUtf8(mimeData->data("application/vnd.bauhaus.libraryresource")); // absolute path
|
const QString imageSource = QString::fromUtf8(mimeData->data("application/vnd.bauhaus.libraryresource")); // absolute path
|
||||||
const QString imagePath = QmlDesignerPlugin::instance()->documentManager().currentFilePath().toFileInfo().dir().relativeFilePath(imageSource); // relative to .ui.qml file
|
const QString imagePath = DocumentManager::currentFilePath().toFileInfo().dir().relativeFilePath(imageSource); // relative to .ui.qml file
|
||||||
|
|
||||||
ModelNode newModelNode;
|
ModelNode newModelNode;
|
||||||
|
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ void TextEditorView::reformatFile()
|
|||||||
QByteArray editorState = m_widget->textEditor()->saveState();
|
QByteArray editorState = m_widget->textEditor()->saveState();
|
||||||
|
|
||||||
auto document =
|
auto document =
|
||||||
qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(Core::EditorManager::instance()->currentDocument());
|
qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(Core::EditorManager::currentDocument());
|
||||||
|
|
||||||
/* Reformat document if we have a .ui.qml file */
|
/* Reformat document if we have a .ui.qml file */
|
||||||
if (document
|
if (document
|
||||||
|
|||||||
@@ -992,7 +992,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
|
|||||||
m_rewriterView->model()->clearMetaInfoCache();
|
m_rewriterView->model()->clearMetaInfoCache();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Snapshot snapshot = m_rewriterView->textModifier()->qmljsSnapshot();
|
Snapshot snapshot = TextModifier::qmljsSnapshot();
|
||||||
|
|
||||||
QList<DocumentMessage> errors;
|
QList<DocumentMessage> errors;
|
||||||
QList<DocumentMessage> warnings;
|
QList<DocumentMessage> warnings;
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ static void appendExtraSelectionsForMessages(
|
|||||||
sel.cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d.loc.length);
|
sel.cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d.loc.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const auto fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
|
|
||||||
if (d.isWarning())
|
if (d.isWarning())
|
||||||
sel.format = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
sel.format = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ protected:
|
|||||||
length = end-begin;
|
length = end-begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
|
|
||||||
QTextCharFormat format;
|
QTextCharFormat format;
|
||||||
if (d.isWarning())
|
if (d.isWarning())
|
||||||
@@ -441,7 +441,7 @@ protected:
|
|||||||
length = end-begin;
|
length = end-begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
||||||
|
|
||||||
QTextCharFormat format;
|
QTextCharFormat format;
|
||||||
if (d.severity == Severity::Warning
|
if (d.severity == Severity::Warning
|
||||||
|
|||||||
@@ -255,10 +255,10 @@ void PixmapCacheModelTest::testConsistency()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filename = details[model.tr("File")].toString();
|
QString filename = details[PixmapCacheModel::tr("File")].toString();
|
||||||
QVERIFY(filename == QString("dings.png") || filename == QString("blah.png"));
|
QVERIFY(filename == QString("dings.png") || filename == QString("blah.png"));
|
||||||
QVERIFY(details.contains(model.tr("Width")));
|
QVERIFY(details.contains(PixmapCacheModel::tr("Width")));
|
||||||
QVERIFY(details.contains(model.tr("Height")));
|
QVERIFY(details.contains(PixmapCacheModel::tr("Height")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ void QmlProfilerAttachDialogTest::testAccessors()
|
|||||||
|
|
||||||
ProjectExplorer::KitManager *kitManager = ProjectExplorer::KitManager::instance();
|
ProjectExplorer::KitManager *kitManager = ProjectExplorer::KitManager::instance();
|
||||||
QVERIFY(kitManager);
|
QVERIFY(kitManager);
|
||||||
ProjectExplorer::Kit * const newKit = kitManager->registerKit({}, "dings");
|
ProjectExplorer::Kit * const newKit = ProjectExplorer::KitManager::registerKit({}, "dings");
|
||||||
QVERIFY(newKit);
|
QVERIFY(newKit);
|
||||||
|
|
||||||
dialog.setKitId("dings");
|
dialog.setKitId("dings");
|
||||||
QCOMPARE(dialog.kit(), newKit);
|
QCOMPARE(dialog.kit(), newKit);
|
||||||
|
|
||||||
kitManager->deregisterKit(newKit);
|
ProjectExplorer::KitManager::deregisterKit(newKit);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
|||||||
{
|
{
|
||||||
ProjectExplorer::KitManager *kitManager = ProjectExplorer::KitManager::instance();
|
ProjectExplorer::KitManager *kitManager = ProjectExplorer::KitManager::instance();
|
||||||
QVERIFY(kitManager);
|
QVERIFY(kitManager);
|
||||||
ProjectExplorer::Kit * const newKit = kitManager->registerKit({}, "fookit");
|
ProjectExplorer::Kit * const newKit = ProjectExplorer::KitManager::registerKit({}, "fookit");
|
||||||
QVERIFY(newKit);
|
QVERIFY(newKit);
|
||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
QVERIFY(settings);
|
QVERIFY(settings);
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ Kit *TestQtProjectImporter::createKit(void *directoryData) const
|
|||||||
const DirectoryData *dd = static_cast<const DirectoryData *>(directoryData);
|
const DirectoryData *dd = static_cast<const DirectoryData *>(directoryData);
|
||||||
assert(dd->importPath == m_path);
|
assert(dd->importPath == m_path);
|
||||||
|
|
||||||
if (KitManager::instance()->kit(dd->kit->id())) // known kit
|
if (KitManager::kit(dd->kit->id())) // known kit
|
||||||
return dd->kit;
|
return dd->kit;
|
||||||
|
|
||||||
// New temporary kit:
|
// New temporary kit:
|
||||||
|
|||||||
@@ -6220,13 +6220,13 @@ void TextEditorWidget::zoomF(float delta)
|
|||||||
else if (step < 0 && step > -1)
|
else if (step < 0 && step > -1)
|
||||||
step = -1;
|
step = -1;
|
||||||
|
|
||||||
const int newZoom = TextEditorSettings::instance()->increaseFontZoom(int(step));
|
const int newZoom = TextEditorSettings::increaseFontZoom(int(step));
|
||||||
showZoomIndicator(this, newZoom);
|
showZoomIndicator(this, newZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorWidget::zoomReset()
|
void TextEditorWidget::zoomReset()
|
||||||
{
|
{
|
||||||
TextEditorSettings::instance()->resetFontZoom();
|
TextEditorSettings::resetFontZoom();
|
||||||
showZoomIndicator(this, 100);
|
showZoomIndicator(this, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -415,8 +415,7 @@ void tst_Differ::merge()
|
|||||||
QFETCH(QList<Diff>, input);
|
QFETCH(QList<Diff>, input);
|
||||||
QFETCH(QList<Diff>, expected);
|
QFETCH(QList<Diff>, expected);
|
||||||
|
|
||||||
Differ differ;
|
QList<Diff> result = Differ::merge(input);
|
||||||
QList<Diff> result = differ.merge(input);
|
|
||||||
QCOMPARE(result, expected);
|
QCOMPARE(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,8 +650,7 @@ void tst_Differ::cleanupSemantics()
|
|||||||
QFETCH(QList<Diff>, input);
|
QFETCH(QList<Diff>, input);
|
||||||
QFETCH(QList<Diff>, expected);
|
QFETCH(QList<Diff>, expected);
|
||||||
|
|
||||||
Differ differ;
|
QList<Diff> result = Differ::cleanupSemantics(input);
|
||||||
QList<Diff> result = differ.cleanupSemantics(input);
|
|
||||||
QCOMPARE(result, expected);
|
QCOMPARE(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -793,8 +791,7 @@ void tst_Differ::cleanupSemanticsLossless()
|
|||||||
QFETCH(QList<Diff>, input);
|
QFETCH(QList<Diff>, input);
|
||||||
QFETCH(QList<Diff>, expected);
|
QFETCH(QList<Diff>, expected);
|
||||||
|
|
||||||
Differ differ;
|
QList<Diff> result = Differ::cleanupSemanticsLossless(input);
|
||||||
QList<Diff> result = differ.cleanupSemanticsLossless(input);
|
|
||||||
QCOMPARE(result, expected);
|
QCOMPARE(result, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -574,14 +574,15 @@ void tst_LanguageServerProtocol::jsonObject()
|
|||||||
ErrorHierarchy errorHierarchy;
|
ErrorHierarchy errorHierarchy;
|
||||||
QVERIFY(!obj.check<int>(&errorHierarchy, "doesNotExist"));
|
QVERIFY(!obj.check<int>(&errorHierarchy, "doesNotExist"));
|
||||||
ErrorHierarchy errorDoesNotExists;
|
ErrorHierarchy errorDoesNotExists;
|
||||||
errorDoesNotExists.setError(obj.errorString(QJsonValue::Double, QJsonValue::Undefined));
|
errorDoesNotExists.setError(
|
||||||
|
JsonTestObject::errorString(QJsonValue::Double, QJsonValue::Undefined));
|
||||||
errorDoesNotExists.prependMember("doesNotExist");
|
errorDoesNotExists.prependMember("doesNotExist");
|
||||||
QCOMPARE(errorHierarchy, errorDoesNotExists);
|
QCOMPARE(errorHierarchy, errorDoesNotExists);
|
||||||
errorHierarchy.clear();
|
errorHierarchy.clear();
|
||||||
|
|
||||||
QVERIFY(!obj.check<int>(&errorHierarchy, "bool"));
|
QVERIFY(!obj.check<int>(&errorHierarchy, "bool"));
|
||||||
ErrorHierarchy errorWrongType;
|
ErrorHierarchy errorWrongType;
|
||||||
errorWrongType.setError(obj.errorString(QJsonValue::Double, QJsonValue::Bool));
|
errorWrongType.setError(JsonTestObject::errorString(QJsonValue::Double, QJsonValue::Bool));
|
||||||
errorWrongType.prependMember("bool");
|
errorWrongType.prependMember("bool");
|
||||||
QCOMPARE(errorHierarchy, errorWrongType);
|
QCOMPARE(errorHierarchy, errorWrongType);
|
||||||
errorHierarchy.clear();
|
errorHierarchy.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user