From 3286b6a36de6c37c8812e4bf2102099b1269b8a0 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Tue, 7 Aug 2018 10:05:31 +0200 Subject: [PATCH 01/14] Clang: Reuse full type qualification from tooltips Backported from master. Use qualification helper function from clangtooltipinfocollector.h instead of Unified Symbol Resolution (USR) not to deal with special symbols used in USR. Exception: handle anonymous namespaces via USR because they don't have displayName. Affects current document filter and symbol outline. Task-number: QTCREATORBUG-20917 Change-Id: I97f8fbc8a9f380d220d85837568f56a1a217f035 Reviewed-by: Marco Bubke --- .../source/clangtooltipinfocollector.cpp | 28 +++++++++---------- .../source/clangtooltipinfocollector.h | 3 ++ .../clangbackend/source/fulltokeninfo.cpp | 27 +++++++++--------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/tools/clangbackend/source/clangtooltipinfocollector.cpp b/src/tools/clangbackend/source/clangtooltipinfocollector.cpp index ba0ce0ffd18..201f6fc3401 100644 --- a/src/tools/clangbackend/source/clangtooltipinfocollector.cpp +++ b/src/tools/clangbackend/source/clangtooltipinfocollector.cpp @@ -44,6 +44,20 @@ namespace ClangBackEnd { +Utf8String qualificationPrefix(const Cursor &cursor) +{ + // TODO: Implement with qualificationPrefixAsVector() + Utf8String qualifiedName; + + for (Cursor parent = cursor.semanticParent(); + parent.isValid() && (parent.kind() == CXCursor_Namespace); + parent = parent.semanticParent()) { + qualifiedName = parent.spelling() + Utf8StringLiteral("::") + qualifiedName; + } + + return qualifiedName; +} + namespace { Utf8StringVector qualificationPrefixAsVector(const Cursor &cursor) @@ -59,20 +73,6 @@ Utf8StringVector qualificationPrefixAsVector(const Cursor &cursor) return result; } -Utf8String qualificationPrefix(const Cursor &cursor) -{ - // TODO: Implement with qualificationPrefixAsVector() - Utf8String qualifiedName; - - for (Cursor parent = cursor.semanticParent(); - parent.isValid() && (parent.kind() == CXCursor_Namespace); - parent = parent.semanticParent()) { - qualifiedName = parent.spelling() + Utf8StringLiteral("::") + qualifiedName; - } - - return qualifiedName; -} - Utf8String displayName(const Cursor &cursor) { if (cursor.kind() == CXCursor_ClassTemplate) { diff --git a/src/tools/clangbackend/source/clangtooltipinfocollector.h b/src/tools/clangbackend/source/clangtooltipinfocollector.h index 8009aa8bf4a..ae1609c2765 100644 --- a/src/tools/clangbackend/source/clangtooltipinfocollector.h +++ b/src/tools/clangbackend/source/clangtooltipinfocollector.h @@ -33,6 +33,7 @@ namespace ClangBackEnd { +class Cursor; class UnsavedFiles; ToolTipInfo collectToolTipInfo(UnsavedFiles &unsavedFiles, @@ -42,4 +43,6 @@ ToolTipInfo collectToolTipInfo(UnsavedFiles &unsavedFiles, uint line, uint column); +Utf8String qualificationPrefix(const Cursor &cursor); + } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/source/fulltokeninfo.cpp b/src/tools/clangbackend/source/fulltokeninfo.cpp index 283798d0be4..e850e0495ca 100644 --- a/src/tools/clangbackend/source/fulltokeninfo.cpp +++ b/src/tools/clangbackend/source/fulltokeninfo.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "clangstring.h" +#include "clangtooltipinfocollector.h" #include "cursor.h" #include "fulltokeninfo.h" #include "sourcerange.h" @@ -46,29 +47,27 @@ FullTokenInfo::operator TokenInfoContainer() const return TokenInfoContainer(line(), column(), length(), m_types, m_extraInfo); } -static Utf8String fullyQualifiedType(const Cursor &cursor) -{ - Utf8String typeSpelling = cursor.type().canonical().utf8Spelling(); - if (typeSpelling.isEmpty()) { - // Only if it's the namespaces level. - typeSpelling = cursor.unifiedSymbolResolution(); - typeSpelling.replace(Utf8StringLiteral("c:@N@"), Utf8StringLiteral("")); - typeSpelling.replace(Utf8StringLiteral("@N@"), Utf8StringLiteral("::")); - typeSpelling.replace(Utf8StringLiteral("c:@aN"), Utf8StringLiteral("(anonymous)")); +static Utf8String fullyQualifiedType(const Cursor &cursor) { + Utf8String prefix; + if (cursor.kind() == CXCursor_ClassTemplate || cursor.kind() == CXCursor_Namespace) { + if (cursor.unifiedSymbolResolution() == "c:@aN") + return Utf8String::fromUtf8("(anonymous)"); + return qualificationPrefix(cursor) + cursor.displayName(); } - return typeSpelling; + return cursor.type().canonical().spelling(); } void FullTokenInfo::updateTypeSpelling(const Cursor &cursor, bool functionLike) { - m_extraInfo.typeSpelling = fullyQualifiedType(cursor); m_extraInfo.semanticParentTypeSpelling = fullyQualifiedType(cursor.semanticParent()); - if (!functionLike) + if (!functionLike) { + m_extraInfo.typeSpelling = fullyQualifiedType(cursor); return; - Type type = cursor.type().canonical(); + } + m_extraInfo.token = cursor.displayName(); // On the client side full type is typeSpelling + token. - m_extraInfo.typeSpelling = type.resultType().utf8Spelling(); + m_extraInfo.typeSpelling = cursor.type().resultType().utf8Spelling(); } static Utf8String propertyParentSpelling(CXTranslationUnit cxTranslationUnit, From ee9745e3daa8daa6e9f38cf38bc2991fd7f75467 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 15 Aug 2018 13:58:17 +0200 Subject: [PATCH 02/14] Doc: Update info about Git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move all information about Git to the Git-specific topic - Add missing information Change-Id: I54bc19fd05ac100e8fbb03b3103754e8eb04fa01 Reviewed-by: Orgad Shaneh Reviewed-by: André Hartmann --- doc/src/vcs/creator-vcs-git.qdoc | 218 +++++++++++++++++------- doc/src/vcs/creator-vcs-options.qdocinc | 104 +++++++++++ doc/src/vcs/creator-vcs.qdoc | 135 ++------------- 3 files changed, 271 insertions(+), 186 deletions(-) create mode 100644 doc/src/vcs/creator-vcs-options.qdocinc diff --git a/doc/src/vcs/creator-vcs-git.qdoc b/doc/src/vcs/creator-vcs-git.qdoc index 1909b1ae43e..fc1edbca7bc 100644 --- a/doc/src/vcs/creator-vcs-git.qdoc +++ b/doc/src/vcs/creator-vcs-git.qdoc @@ -42,12 +42,16 @@ \title Using Git - Git is a fast decentralized version control system. Git is available - for Windows, Linux, and \macos. + \l{http://git-scm.com/}{Git} is a fast decentralized version control system. + Git is available for Windows, Linux, and \macos. You can use the \l{http://code.google.com/p/gerrit/}{Gerrit} code review tool for projects that use Git. + \if defined(qtdesignstudio) + \include creator-vcs-options.qdocinc vcs options + \endif + \section1 Using Git for Windows If you configure Git for use with \c {git bash}, only, and use SSH @@ -65,85 +69,158 @@ set to \c %HOMEDRIVE%%HOMEPATH% when the Git executable is run and authorization works as it would with \c {git bash}. - \section1 Reverting Changes Using Git - - The Git version control system has an index that is used to stage - changes. The index is committed on the next commit. Git allows you to revert - back to the state of the last commit as well as to the state staged in the - index. - - \list - - \li \uicontrol Git > \uicontrol {Current File} > - \uicontrol{Undo Unstaged Changes} reverts all changes and resets the - current file to the state of the index. - - \li \uicontrol Git > \uicontrol {Current File} > - \uicontrol {Undo Uncommitted Changes} reverts all changes, - discarding the index. This returns the current file to the state it - was in right after the last commit. - - \li \uicontrol Git > \uicontrol {Local Repository} > \uicontrol Reset - opens a dialog where you can select the SHA-1 to reset the working - directory to. This is useful after applying patches for review, for - example. You can choose between a \uicontrol Soft reset that does - not touch the index file nor the working tree at all, a - \uicontrol Hard reset that discards all changes to tracked files in - working tree, and a \uicontrol Mixed reset that resets HEAD and the - index (nothing remains staged) without touching the working - directory. - - \endlist - \section1 Working with the Current File - In addition to the standard version control system functions, you can - select \uicontrol Tools > \uicontrol Git > \uicontrol {Current File} > - \uicontrol {Stage File for Commit} to mark a new or modified file for - committing to the repository. + To work with the current file, select the commands in \uicontrol Tools > + \uicontrol Git > \uicontrol {Current File}. Some of the commands are also + available for the project or local repository that contains the file. - To undo this function, select \uicontrol {Unstage File from Commit}. + \section2 Viewing Git Diff + + You can \e{diff} the current file or project to compare it with the latest + version stored in the repository and to display the differences. To display + the diff in a read-only editor, select \uicontrol {Diff of}. If the file is + accessible, you can double-click on a selected diff chunk and \QC opens an + editor displaying the file, scrolled to the line in question. + + \image qtcreator-vcs-diff.png + + The diff is displayed side-by-side in a \l{Comparing Files}{diff editor} + by default. To use the unified diff view instead, select the + \uicontrol {Switch to Unified Diff Editor} (1) option from the toolbar. + In both views, you can use context menu commands to apply, revert, stage, + and unstage hunks, as well as send them to a code pasting service. + + \section2 Viewing Git Log + + To display the versioning history of a file, select \uicontrol{Log of}. + The log output contains the date, the commit message, and a commit + identifier. Click on the commit identifier to display a description + of the change including the diff in the \uicontrol {Git Show} view. + + \image qtcreator-vcs-show.png + + Right-clicking on a commit identifier brings up a context menu that lets + you apply actions on the commit, such as view annotations or cherry-pick + or revert a commit. + + Select \inlineimage reload_gray.png + (\uicontrol Reload) to rescan the files. + + \section2 Viewing Annotations + + To view annotations, select \uicontrol{Blame}. The view displays the lines + of the file prepended by the commit identifier they originate from. Clicking + on the commit identifier shows a detailed description of the change. + + To show the annotation of a previous version, right-click on the commit + identifier and select \uicontrol {Blame Parent Revision}. This allows you + to navigate through the history of the file and obtain previous versions + of it. + + The other actions in the context-menu enable you to apply actions to the + commit, such as cherry-pick, checkout, or revert it. + + To rescan the files, click \inlineimage reload_gray.png + (\uicontrol Reload). + + \section2 Staging Changes + + To mark a new or modified file for committing it to the repository, + select \uicontrol {Stage File for Commit}. To undo this function, + select \uicontrol {Unstage File from Commit}. + + \section2 Resetting Changes + + Git has an index that is used to stage changes. The index is committed on + the next commit. Git allows you to revert back to the state of the last + commit as well as to the state staged in the index. + + To revert all changes and reset the current file to the state of the index, + select \uicontrol{Undo Unstaged Changes}. + + To return the current file to the state it was in right after the last + commit, select \uicontrol {Undo Uncommitted Changes}. This reverts all + changes, discarding the index. \section1 Working with the Current Project - In addition to the standard version control system functions, you can - select \uicontrol Tools > \uicontrol Git > \uicontrol {Current Project} > - \uicontrol {Clean Project} - to clean the working directory. All files that are not under version control - are displayed in the \uicontrol {Clean Repository} dialog. Ignored files are + To work with the current project, select the commands in \uicontrol Tools > + \uicontrol Git > \uicontrol {Current Project}. The \uicontrol {Diff Project} + and \uicontrol {Log Project} commands, which are also available for the + current file, are described above. + + \section2 Cleaning Projects + + To clean the working directory, select \uicontrol {Clean Project}. + All files that are not under version control are displayed in + the \uicontrol {Clean Repository} dialog. Ignored files are deselected by default. Select the files to delete and click \uicontrol Delete. \section1 Working with Local Repositories - In addition to the standard version control system functions, you can - select \uicontrol Tools > \uicontrol Git > \uicontrol {Local Repository} > - \uicontrol Clean to clean the repository. + To work with the local repository, select the commands in \uicontrol Tools > + \uicontrol Git > \uicontrol {Local Repository}. The commands that are also + available for the current file or project are described above. - To apply latest changes to the last commit, select \uicontrol Tools > - \uicontrol Git > \uicontrol {Local Repository} > + \section2 Viewing Reference Log + + Reference logs record when the tips of branches and other references were + updated in the local repository. To view the reference log, select + \uicontrol Reflog. + + \section2 Viewing Git Status + + To view the status of the repository in the \uicontrol {Version Control} + output view, select \uicontrol Status. + + \section2 Committing Changes to Git + + To submit your changes to Git, select \uicontrol Commit. \QC displays a + commit page containing a text editor where you can enter your commit + message and a checkable list of modified files to be included. + + \image qtcreator-vcs-commit.png + + When you have finished filling out the commit page information, click on + \uicontrol Commit to start committing. + + The \uicontrol {Diff Selected Files} button brings up a diff view of the + files selected in the file list. Since the commit page is just another + editor, you can go back to it by closing the diff view. You can also switch + to an open diff view by selecting it in the \uicontrol {Open Documents} pane + in the sidebar. + + \section2 Amending Commits + + To apply latest changes to the last commit, select \uicontrol {Amend Last Commit}. You can also edit the commit message. To amend an earlier comment in a series of related commits, select - \uicontrol Tools > \uicontrol Git > \uicontrol {Local Repository} > \uicontrol {Fixup Previous Commit}. This operation is done using interactive rebase. In case of conflicts, a merge tool is suggested. - To recover removed files, select \uicontrol Tools > \uicontrol Git > - \uicontrol {Recover Deleted Files}. + \section2 Resetting Local Repository + + To reset changes, select \uicontrol Reset. This opens a dialog where you + can select the commit to reset the working directory to. This is useful + after applying patches for review, for example. You can choose between a + \uicontrol Soft reset that does not touch the index file nor the working + tree at all, a \uicontrol Hard reset that discards all changes to tracked + files in the working tree, and a \uicontrol Mixed reset that resets HEAD + and the index (nothing remains staged) without touching the working + directory. + + To recover removed files, select \uicontrol {Recover Deleted Files}. To change a series of commits in the local repository, select - \uicontrol Tools > \uicontrol Git > \uicontrol {Local Repository} > \uicontrol {Interactive Rebase}. You can reorder or discard commits, squash them into a single commit, or edit the commit messages. - The following sections describe how to manage local and remote branches, - apply patches, and use stashes. - \section2 Working with Branches - To work with Git branches, select \uicontrol Tools > \uicontrol Git > - \uicontrol {Local Repository} > \uicontrol {Branches}. The checked out + To work with Git branches, select \uicontrol {Branches}. The checked out branch is shown in bold and underlined in the list of branches. Double-click branch names to edit them. @@ -204,8 +281,7 @@ \section2 Applying Patches Patches are rewriting instructions that can be applied to a set of files. - To apply a patch file that is open in \QC, select \uicontrol Tools > - \uicontrol Git > \uicontrol {Local Repository} > \uicontrol Patch > + To apply a patch file that is open in \QC, select \uicontrol Patch > \uicontrol {Apply from Editor}. To select the patch file to apply from the file system, select @@ -218,8 +294,7 @@ changes to work on higher priority tasks or to pull in new chages from another repository. - To stash all local changes, select \uicontrol Tools > \uicontrol Git > - \uicontrol {Local Repository} > \uicontrol Stash > \uicontrol Stash. The + To stash all local changes, select \uicontrol Stash > \uicontrol Stash. The working copy is reset to the state it had after the last commit. To save the current state of your unstaged files and reset the repository to its staged state, select \uicontrol {Stash Unstaged Files}. @@ -244,16 +319,31 @@ \image creator-git-commit-actions.png "Select a Git Commit dialog" + \section1 Initializing Git Repositories + + To start controlling a project directory that is currently not under + version control, select \uicontrol Tools > \uicontrol Git > + \uicontrol {Create Repository}. \QC creates a new subdirectory named .git + that contains all the necessary repository files. However, nothing in the + project is tracked yet, so you will need to create an initial commit to + start tracking the project files. + \section1 Working with Remote Repositories - In addition to the standard version control system functions, you can - select \uicontrol Tools > \uicontrol Git > \uicontrol {Remote Repository} > - \uicontrol Pull topull changes from the remote repository. If there are - locally modified files, you are prompted to stash the changes. Select + To work with remote repositories, select the commands in \uicontrol Tools > + \uicontrol Git > \uicontrol {Remote Repository}. + + To fetch all the branches and change information from a remote repository, + select \uicontrol Fetch. + + To pull changes from the remote repository, select \uicontrol Pull. If there + are locally modified files, you are prompted to stash the changes. Select \uicontrol Tools > \uicontrol Options > \uicontrol {Version Control} > \uicontrol Git and then select the \uicontrol {Pull with rebase} check box to perform a rebase operation while pulling. + To push committed changes to the remote repository, select \uicontrol Push. + \section2 Managing Remote Repositories To manage remote repositories available in Git, select \uicontrol Tools > diff --git a/doc/src/vcs/creator-vcs-options.qdocinc b/doc/src/vcs/creator-vcs-options.qdocinc new file mode 100644 index 00000000000..47727d22e4b --- /dev/null +++ b/doc/src/vcs/creator-vcs-options.qdocinc @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Creator documentation. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** +****************************************************************************/ + +/*! + +//! [vcs options] + + \section1 Setting Up Version Control Systems + + \QC uses the version control system's command line clients to access your + repositories. To allow access, make sure that the command line clients can + be located using the \c{PATH} environment variable. Alternatively, specify + the path to the command line client executable in the \uicontrol Command + field in the version control system specific tab in \uicontrol Tools > + \uicontrol Options > \uicontrol {Version Control}. + + If authentication is required to access the repository, enter the user + credentials in the \uicontrol Username and \uicontrol Password fields. + + Enter a timeout for version control operations in the \uicontrol Timeout + field. + + For some version control systems, you can specify the maximum number of + lines the log can contain in the \uicontrol {Log count} field. + + After you set up the version control system, use the command line to check + that everything works (for example, use the status command). If no issues + arise, you should be ready to use the system also from \QC. + + For more information on using Git for Windows, see + \l {Using Git for Windows}. + + \section1 Setting Up General Options + + Select \uicontrol{Tools} > \uicontrol{Options} > \uicontrol{Version Control} + > \uicontrol{General} + to specify settings for submit messages: + + \list + \li \uicontrol{Wrap submit messages at} limits the line length of a + submit message to the specified number of characters. + \li \uicontrol{Submit message check script} is a script or program that + can be used to perform checks on the submit message before + submitting. The submit message is passed in as the script's first + parameter. If there is an error, the script should output a + message on standard error and return a non-zero exit code. + \li \uicontrol{User/alias configuration file} is a text file that lists + author names in mailmap format. For each author, you must specify a + real name and email address and optionally an alias and a second + email address. For example: + \code + Jon Doe jdoe + Hans Mustermann hm + \endcode + After you specify a file in this field, you can select authors + as values of the submit message fields in the \uicontrol Nicknames dialog. + \li \uicontrol{User fields configuration file} is a simple text file + consisting of lines specifying submit message fields that take + authors as values, for example: + \code + Acked-by: + Initial-patch-by: + Reported-by: + Rubber-stamped-by: + Signed-off-by: + Tested-by: + \endcode + After you specify a file in this field, you can add authors as + values of the submit message fields when submitting changes. If + you also specified a \uicontrol{User/alias configuration file}, you can + select authors in the \uicontrol Nicknames dialog. + \li \uicontrol{SSH prompt command} specifies an ssh-askpass command that you + can use (on Linux) to prompt the user for a password when using SSH. + For example, \c ssh-askpass or \c x11-ssh-askpass, depending on the + ssh-askpass implementation that you use. + \li \uicontrol {Reset VCS Cache} resets the version control system + configuration to a state known to \QC after it has been changed + from the command line, for example. + \endlist + +//! [vcs options] +*/ diff --git a/doc/src/vcs/creator-vcs.qdoc b/doc/src/vcs/creator-vcs.qdoc index fb868945a30..9a87e53f89a 100644 --- a/doc/src/vcs/creator-vcs.qdoc +++ b/doc/src/vcs/creator-vcs.qdoc @@ -78,89 +78,7 @@ \li Subversion version 1.7.0 and later \endtable - \section1 Setting Up Version Control Systems - - \QC uses the version control system's command line clients to access your - repositories. To allow access, make sure that the command line clients can - be located using the \c{PATH} environment variable. Alternatively, specify - the path to the command line client executable in the \uicontrol Command - field in the version control system specific tab in \uicontrol Tools > - \uicontrol Options > \uicontrol {Version Control}. - - If authentication is required to access the repository, enter the user - credentials in the \uicontrol Username and \uicontrol Password fields. - - Enter a timeout for version control operations in the \uicontrol Timeout - field. - - For some version control systems, you can specify the maximum number of - lines the log can contain in the \uicontrol {Log count} field. - - After you set up the version control system, use the command line to check - that everything works (for example, use the status command). If no issues - arise, you should be ready to use the system also from \QC. - - For more information on using Git for Windows, see - \l {Using Git for Windows}. - - \section1 Setting Up General Options - - Select \uicontrol{Tools} > \uicontrol{Options} > \uicontrol{Version Control} - > \uicontrol{General} - to specify settings for submit messages: - - \list - - \li \uicontrol{Wrap submit messages at} limits the line length of a - submit message to the specified number of characters. - - \li \uicontrol{Submit message check script} is a script or program that - can be used to perform checks on the submit message before - submitting. The submit message is passed in as the script's first - parameter. If there is an error, the script should output a - message on standard error and return a non-zero exit code. - - \li \uicontrol{User/alias configuration file} is a text file that lists - author names in mailmap format. For each author, you must specify a - real name and email address and optionally an alias and a second - email address. For example: - - \code - Jon Doe jdoe - Hans Mustermann hm - \endcode - - After you specify a file in this field, you can select authors - as values of the submit message fields in the \uicontrol Nicknames dialog. - - \li \uicontrol{User fields configuration file} is a simple text file - consisting of lines specifying submit message fields that take - authors as values, for example: - - \code - Acked-by: - Initial-patch-by: - Reported-by: - Rubber-stamped-by: - Signed-off-by: - Tested-by: - \endcode - - After you specify a file in this field, you can add authors as - values of the submit message fields when submitting changes. If - you also specified a \uicontrol{User/alias configuration file}, you can - select authors in the \uicontrol Nicknames dialog. - - \li \uicontrol{SSH prompt command} specifies an ssh-askpass command that you - can use (on Linux) to prompt the user for a password when using SSH. - For example, \c ssh-askpass or \c x11-ssh-askpass, depending on the - ssh-askpass implementation that you use. - - \li \uicontrol {Reset VCS Cache} resets the version control system - configuration to a state known to \QC after it has been changed - from the command line, for example. - - \endlist + \include creator-vcs-options.qdocinc vcs options \section1 Creating VCS Repositories for New Projects @@ -183,7 +101,17 @@ control system. This section describes using the functions that are available for all the supported version control systems. For more information about the additional functions and options available for a - particular version control system, see the topic dedicated to it. + particular version control system, see: + + \list + \li \l{Using Bazaar} + \li \l{Using ClearCase} + \li \l{Using CVS} + \li \l{Using Git} + \li \l{Using Mercurial} + \li \l{Using Perforce} + \li \l{Using Subversion} + \endlist The \uicontrol{Version Control} output pane displays the commands that are executed, a timestamp, and the relevant output. Select \uicontrol {Window > Output @@ -200,9 +128,6 @@ for example, Perforce and Subversion. Alternatively, you can add files later by using the version control tool menus. - With Git, there is no concept of adding files. Instead, all modified - files must be staged for a commit. - \section2 Viewing Diff Output All version control systems provide menu options to \e{diff} the current @@ -224,18 +149,7 @@ Display the versioning history of a file by selecting \uicontrol{Log} or \uicontrol{Filelog}. Typically, the log output contains the date, the commit - message, and a change or revision identifier. Click on the identifier to - display a description of the change including the diff in the - \uicontrol {Git Show} view. - - \image qtcreator-vcs-show.png - - Right-clicking on an identifier brings up a context menu that lets you - show annotation views of previous versions (see \l{Annotating Files}). - With Git you can also choose to cherry-pick or revert a change. - - With Git, you can click \inlineimage reload_gray.png - (\uicontrol Reload) to rescan the files. + message, and a change or revision identifier. \section2 Annotating Files @@ -253,9 +167,6 @@ The same context menu is available when right-clicking on a version identifier in the file log view of a single file. - With Git, you can click \inlineimage reload_gray.png - (\uicontrol Reload) to rescan the files. - \section2 Committing Changes Once you have finished making changes, submit them to the version control @@ -263,17 +174,6 @@ commit page containing a text editor where you can enter your commit message and a checkable list of modified files to be included. - \image qtcreator-vcs-commit.png - - When you have finished filling out the commit page information, click on - \uicontrol{Commit} to start committing. - - The \uicontrol{Diff Selected Files} button brings up a diff view of the - files selected in the file list. Since the commit page is just another - editor, you can go back to it by closing the diff view. You can also switch - to an open diff view by selecting it in the \uicontrol{Open Documents} pane in the - sidebar. - \section2 Reverting Changes All supported version control systems support reverting your project to @@ -284,9 +184,6 @@ A version control system can replace the \uicontrol Revert menu option with other options. - For more information about reverting changes using Git, see - \l {Reverting Changes Using Git}. - \section2 Viewing Status You can select \uicontrol{Status} to view the status of the project or @@ -298,13 +195,7 @@ changes from the branch. Some version control systems allow you to choose between updating the current project and updating all projects. - With Git, you stash your changes and then pull the changes from the - repository. - \section2 Deleting Files You can select \uicontrol Delete to delete obsolete files from the repository. - - With Git, you delete the files from the working tree and then stage the - deleted files for a commit. */ From 7b6ea357f65012b3d5d405a2e3bd55173558d265 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 20 Aug 2018 12:44:52 +0200 Subject: [PATCH 03/14] Avoid shortcuts with "Alt" on macOS On macOS shortcuts with "Alt" are used for entering special characters, where "special" depends on keyboard layout and can mean e.g. '|' or '~'. Task-number: QTCREATORBUG-20873 Change-Id: Ifa70b95381ef48d2ba3b15a528a5dcfe43d53bfd Reviewed-by: Tobias Hunger --- src/plugins/autotest/autotestplugin.cpp | 14 +++++++++----- src/plugins/projectexplorer/projecttreewidget.cpp | 8 +++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index 61148f75579..a4ae1ffa452 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -110,7 +110,8 @@ void AutotestPlugin::initializeMenuEntries() action->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR.icon()); action->setToolTip(tr("Run All Tests")); Command *command = ActionManager::registerAction(action, Constants::ACTION_RUN_ALL_ID); - command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+A"))); + command->setDefaultKeySequence( + QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+A") : tr("Alt+Shift+T,Alt+A"))); connect(action, &QAction::triggered, this, &AutotestPlugin::onRunAllTriggered); action->setEnabled(false); menu->addAction(command); @@ -122,7 +123,8 @@ void AutotestPlugin::initializeMenuEntries() action->setIcon(runSelectedIcon.icon()); action->setToolTip(tr("Run Selected Tests")); command = ActionManager::registerAction(action, Constants::ACTION_RUN_SELECTED_ID); - command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+R"))); + command->setDefaultKeySequence( + QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+R") : tr("Alt+Shift+T,Alt+R"))); connect(action, &QAction::triggered, this, &AutotestPlugin::onRunSelectedTriggered); action->setEnabled(false); menu->addAction(command); @@ -134,15 +136,17 @@ void AutotestPlugin::initializeMenuEntries() action->setIcon(runFileIcon.icon()); action->setToolTip(tr("Run Tests for Current File")); command = ActionManager::registerAction(action, Constants::ACTION_RUN_FILE_ID); - command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+F"))); + command->setDefaultKeySequence( + QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+F") : tr("Alt+Shift+T,Alt+F"))); connect(action, &QAction::triggered, this, &AutotestPlugin::onRunFileTriggered); action->setEnabled(false); menu->addAction(command); action = new QAction(tr("Re&scan Tests"), this); command = ActionManager::registerAction(action, Constants::ACTION_SCAN_ID); - command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+S"))); - connect(action, &QAction::triggered, this, [] () { + command->setDefaultKeySequence( + QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+S") : tr("Alt+Shift+T,Alt+S"))); + connect(action, &QAction::triggered, this, []() { TestTreeModel::instance()->parser()->updateTestTree(); }); menu->addAction(command); diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 688c7b245c2..7f8bc423a15 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -259,9 +259,11 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent) if (!ActionManager::command(focusActionId)) { auto focusDocumentInProjectTree = new QAction(tr("Focus Document in Project Tree"), this); Command *cmd = ActionManager::registerAction(focusDocumentInProjectTree, focusActionId); - cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+L"))); - connect(focusDocumentInProjectTree, &QAction::triggered, - this, [this]() { syncFromDocumentManager(); }); + cmd->setDefaultKeySequence( + QKeySequence(useMacShortcuts ? tr("Meta+Shift+L") : tr("Alt+Shift+L"))); + connect(focusDocumentInProjectTree, &QAction::triggered, this, [this]() { + syncFromDocumentManager(); + }); } m_trimEmptyDirectoriesAction = new QAction(tr("Hide Empty Directories"), this); From 2486e6106870d64e486c600c0fb96594ae771e12 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 20 Aug 2018 14:26:51 +0200 Subject: [PATCH 04/14] Fix handling of read-only editors when applying refactorings If e.g. a ".ui" file is open, there is a read-only text editor widget for the file, even though the file itself is writable. The application of refactorings or global text-based replace should not change the content of this read-only editor widget, but instead operate directly on the file as if it wasn't open in Qt Creator at all. It should also silently reload these files after modification on disk. Task-number: QTCREATORBUG-19958 Change-Id: I409d5d03059be4c3520a1031ff0fbfa9feb675bb Reviewed-by: David Schulz --- src/plugins/texteditor/refactoringchanges.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index 5905fb5f681..9370a5f0c19 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -178,8 +179,11 @@ RefactoringFile::RefactoringFile(const QString &fileName, const QSharedPointer editors = DocumentModel::editorsForFilePath(fileName); - if (!editors.isEmpty()) - m_editor = qobject_cast(editors.first()->widget()); + if (!editors.isEmpty()) { + auto editorWidget = qobject_cast(editors.first()->widget()); + if (editorWidget && !editorWidget->isReadOnly()) + m_editor = editorWidget; + } } RefactoringFile::~RefactoringFile() @@ -378,6 +382,8 @@ bool RefactoringFile::apply() if (!m_editor && m_textFileFormat.codec) { QTC_ASSERT(!m_fileName.isEmpty(), return false); QString error; + // suppress "file has changed" warnings if the file is open in a read-only editor + Core::FileChangeBlocker block(m_fileName); if (!m_textFileFormat.writeFile(m_fileName, doc->toPlainText(), &error)) { qWarning() << "Could not apply changes to" << m_fileName << ". Error: " << error; result = false; From 18833bed2403e80d5b97bacd6ffc3cb0f4adb852 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 21 Aug 2018 13:42:41 +0200 Subject: [PATCH 05/14] Fix reload behavior of binary editor It should silenty reload internally triggered changes and permission changes. Broke in 4e475fb5e6dd48b9b23357846f9e25c9bef50690 Change-Id: I900adac72f51ea5e070c9c4efb59c09296526c42 Reviewed-by: David Schulz --- src/plugins/bineditor/bineditorplugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index d8ca404f87a..dbc96f4d602 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -228,8 +228,7 @@ public: ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override { - Q_UNUSED(state) - return type == TypeRemoved ? BehaviorSilent : BehaviorAsk; + return type == TypeRemoved ? BehaviorSilent : IDocument::reloadBehavior(state, type); } bool save(QString *errorString, const QString &fn, bool autoSave) override From fe8c8619c9352a07200bdc41dfab7ab688622e43 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 22 Aug 2018 14:01:58 +0300 Subject: [PATCH 06/14] Squish: Update URLs to sources of Qt 4.8.7 Change-Id: I9dfc2df788be128ee82561d1974920c5924566e9 Reviewed-by: Christian Stenger --- tests/system/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/README b/tests/system/README index 31712b6179e..a80491ad11c 100644 --- a/tests/system/README +++ b/tests/system/README @@ -6,8 +6,8 @@ First - and most important - you have to own a valid Squish license. At least Sq Second - some of the test suites/test cases expect a build of Qt 4.8.7 to be available: 1. Download the source code from: - * Windows: http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.zip - * Other: http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz + * Windows: https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.zip + * Other: https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz 2. Extract the contents of the archive's directory qt-everywhere-opensource-src-4.8.7 to: * Windows: C:\Qt\Qt4.8.7 * Other: $HOME/Qt4.8.7 From bba35ceff46bc0c6b4338d9a2e33389c783329f9 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 22 Aug 2018 15:12:25 +0300 Subject: [PATCH 07/14] Squish: Remove remaining mentions of Squish hooking Change-Id: If4fde6d47433b1c8e46c68c5b225004446214797 Reviewed-by: Christian Stenger --- tests/system/README | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/system/README b/tests/system/README index a80491ad11c..ff17e5190e0 100644 --- a/tests/system/README +++ b/tests/system/README @@ -49,14 +49,13 @@ Qt 5.4.1 (gcc) Qt 5.6.1-1 (MSVC2013, 32 bit) Qt 5.10.1 (MSVC2015, 32 bit) -Fourth - you'll have to provide some additional repositories (and for the hooking into subprocesses even some more Squish bundles, see below). +Fourth - you'll have to provide some additional repositories. These additional repositories are located inside ~/squish-data or C:\Users\\squish-data (depending on the OS you're on). You can also just provide them inside a different folder and specify the folder with the environment variable SYSTEST_SRCPATH. This folder must contain the following: * a QtCreator repository (or source copy) of tag v4.7.0 named 'creator' including the submodule src/shared/qbs * a subfolder called 'creator-test-data' * a speedcrunch 0.11 repository (or source copy) inside 'creator-test-data' named 'speedcrunch' - * additional Squish versions for hooking into subprocesses inside different folders inside 'creator-test-data' following the information below Fifth - you'll have to make sure that some needed tools are available (no matter on which OS you're on). * cmake From 601eebd832e8f8a39d661031a44d5ee3c53bf718 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 23 Aug 2018 11:32:12 +0200 Subject: [PATCH 08/14] Fix painting of current line in generic and python editors The generic highlighter and the python editor explicitly map some tokens to the format C_TEXT. Unfortunately this format is special, because it's foreground and background colors are handled by setting the editor's palette, and should not be used for setting the format on characters. If the format is explicitly set on characters, their background will be oblique and overpaint e.g. the highlight for the current line, which looks pretty ugly. Handle this directly in SyntaxHighlighter::formatForCategory for all syntax highlighters, by returning an empty QTextCharFormat for C_TEXT. Change-Id: Ifaeb556754ca8106ad6e55d7062b13b45457a809 Reviewed-by: David Schulz --- .../texteditor/generichighlighter/highlighter.cpp | 12 +++++++----- src/plugins/texteditor/syntaxhighlighter.cpp | 8 ++++++-- .../highlighterengine/highlighterengine.pro | 2 +- .../highlighterengine/highlighterengine.qbs | 1 + 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp index e7e5e713ab4..8ece3f462ed 100644 --- a/src/plugins/texteditor/generichighlighter/highlighter.cpp +++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp @@ -23,17 +23,19 @@ ** ****************************************************************************/ -#include "highlighter.h" -#include "highlightdefinition.h" #include "context.h" -#include "rule.h" -#include "itemdata.h" +#include "highlightdefinition.h" +#include "highlighter.h" #include "highlighterexception.h" +#include "itemdata.h" #include "progressdata.h" #include "reuse.h" +#include "rule.h" #include "tabsettings.h" #include +#include +#include #include #include @@ -567,7 +569,7 @@ void Highlighter::applyFormat(int offset, // think this approach would fit better. If there are other ideas... QBrush bg = format.background(); if (bg.style() == Qt::NoBrush) - bg = formatForCategory(C_TEXT).background(); + bg = TextEditorSettings::fontSettings().toTextCharFormat(C_TEXT).background(); if (itemData->color().isValid() && isReadableOn(bg.color(), itemData->color())) format.setForeground(itemData->color()); if (itemData->isItalicSpecified()) diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp index f72b563ca55..621df4f236d 100644 --- a/src/plugins/texteditor/syntaxhighlighter.cpp +++ b/src/plugins/texteditor/syntaxhighlighter.cpp @@ -836,8 +836,12 @@ void SyntaxHighlighter::highlightBlock(const QString &text) void SyntaxHighlighterPrivate::updateFormats(const FontSettings &fontSettings) { - for (const auto &pair : qAsConst(formatCategories)) - formats[pair.first] = fontSettings.toTextCharFormat(pair.second); + // C_TEXT is handled by text editor's foreground and background color, + // so use empty format for that + for (const auto &pair : qAsConst(formatCategories)) { + formats[pair.first] = pair.second == C_TEXT ? QTextCharFormat() + : fontSettings.toTextCharFormat(pair.second); + } whitespaceFormat = fontSettings.toTextCharFormat(C_VISUAL_WHITESPACE); } diff --git a/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro b/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro index 3270181891e..d78de7871eb 100644 --- a/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro +++ b/tests/auto/generichighlighter/highlighterengine/highlighterengine.pro @@ -1,4 +1,4 @@ -QTC_PLUGIN_DEPENDS += coreplugin +QTC_PLUGIN_DEPENDS += coreplugin texteditor include(../../qttest.pri) QT += gui PLUGINSDIR = $$IDE_SOURCE_TREE/src/plugins diff --git a/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs b/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs index 3ea2c0da683..b0abba77760 100644 --- a/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs +++ b/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs @@ -4,6 +4,7 @@ QtcAutotest { name: "Highlighter engine autotest" Depends { name: "Core" } Depends { name: "Utils" } + Depends { name: "TextEditor" } Depends { name: "Qt.widgets" } Group { name: "Sources from TextEditor plugin" From d2146644a69c1d130b42d611c2591c8dbdbc8abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Hunold?= Date: Mon, 20 Aug 2018 13:51:46 +0200 Subject: [PATCH 09/14] Botan: forward QMAKE_CXX_FLAGS from mkspec to configure Change-Id: Ibc3922a1aa6f09cca0fd7b4360cf283363cda87d Reviewed-by: Christian Kandeler --- src/libs/botan/botan.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/botan/botan.pro b/src/libs/botan/botan.pro index 2f238e5d039..0c939b2a308 100644 --- a/src/libs/botan/botan.pro +++ b/src/libs/botan/botan.pro @@ -27,7 +27,7 @@ mingw { BOTAN_OS_SWITCH = "--os=mingw" OTHER_FLAGS += --without-stack-protector } -BOTAN_CXX_FLAGS = +BOTAN_CXX_FLAGS = $$QMAKE_CXXFLAGS msvc: BOTAN_CXX_FLAGS += /wd4127 /wd4244 /wd4250 /wd4267 /wd4334 /wd4702 /wd4996 \ /D_ENABLE_EXTENDED_ALIGNED_STORAGE else: BOTAN_CXX_FLAGS += -Wno-unused-parameter From 93a6dd0c6705c23ebe81753c7774bfdab61f9824 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 23 Aug 2018 08:59:36 +0200 Subject: [PATCH 10/14] Fix editing of custom executable path When editing the path for a custom executable run configuration, the text cursor would jump to the end every time anything is typed. This makes changing a part inside the text very cumbersome. This happens because the executable aspect registers a "display filter" that transforms the input to native separators. Solve that issue generically for the path chooser by resetting its text cursor position after the path has been set, if the input field has focus. Change-Id: Ic0a178e942da8df1e53b5d90c78a5bf1675865c2 Reviewed-by: Tobias Hunger --- src/libs/utils/pathchooser.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 7fde56993e4..142d061682a 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -26,6 +26,7 @@ #include "pathchooser.h" #include "environment.h" +#include "optional.h" #include "qtcassert.h" #include "synchronousprocess.h" @@ -340,14 +341,22 @@ QString PathChooser::expandedDirectory(const QString &input, const Environment & return path; } +void setTextKeepingActiveCursor(QLineEdit *edit, const QString &text) +{ + optional cursor = edit->hasFocus() ? make_optional(edit->cursorPosition()) : nullopt; + edit->setText(text); + if (cursor) + edit->setCursorPosition(*cursor); +} + void PathChooser::setPath(const QString &path) { - d->m_lineEdit->setText(QDir::toNativeSeparators(path)); + setTextKeepingActiveCursor(d->m_lineEdit, QDir::toNativeSeparators(path)); } void PathChooser::setFileName(const FileName &fn) { - d->m_lineEdit->setText(fn.toUserOutput()); + setTextKeepingActiveCursor(d->m_lineEdit, fn.toUserOutput()); } void PathChooser::setErrorColor(const QColor &errorColor) From 3008255bb54819f1549066667cbbe3265af1bc15 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 28 Aug 2018 09:25:07 +0200 Subject: [PATCH 11/14] Tracing: Make notes in TimelineModelAggregator mutable When the notes model is deleted, it becomes null. The notes model belongs to TimelineTraceManager, not to TimelineModelAggregator. Change-Id: I0ef9312620e08c06d31bc65976a887af0ca90c33 Reviewed-by: Christian Kandeler --- src/libs/tracing/timelinemodelaggregator.cpp | 26 ++++++++++++++++--- src/libs/tracing/timelinemodelaggregator.h | 7 +++-- .../qmlprofiler/qmlprofilertraceview.cpp | 3 ++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/libs/tracing/timelinemodelaggregator.cpp b/src/libs/tracing/timelinemodelaggregator.cpp index 30636356aec..5b8c34855bc 100644 --- a/src/libs/tracing/timelinemodelaggregator.cpp +++ b/src/libs/tracing/timelinemodelaggregator.cpp @@ -30,6 +30,7 @@ #include +#include #include #include @@ -38,15 +39,13 @@ namespace Timeline { class TimelineModelAggregator::TimelineModelAggregatorPrivate { public: QList modelList; - TimelineNotesModel *notesModel; + QPointer notesModel; int currentModelId = 0; }; -TimelineModelAggregator::TimelineModelAggregator(TimelineNotesModel *notes, QObject *parent) +TimelineModelAggregator::TimelineModelAggregator(QObject *parent) : QObject(parent), d_ptr(new TimelineModelAggregatorPrivate) { - Q_D(TimelineModelAggregator); - d->notesModel = notes; } TimelineModelAggregator::~TimelineModelAggregator() @@ -129,6 +128,25 @@ TimelineNotesModel *TimelineModelAggregator::notes() const return d->notesModel; } +void TimelineModelAggregator::setNotes(TimelineNotesModel *notes) +{ + Q_D(TimelineModelAggregator); + if (d->notesModel == notes) + return; + + if (d->notesModel) { + disconnect(d->notesModel, &QObject::destroyed, + this, &TimelineModelAggregator::notesChanged); + } + + d->notesModel = notes; + + if (d->notesModel) + connect(d->notesModel, &QObject::destroyed, this, &TimelineModelAggregator::notesChanged); + + emit notesChanged(); +} + void TimelineModelAggregator::clear() { Q_D(TimelineModelAggregator); diff --git a/src/libs/tracing/timelinemodelaggregator.h b/src/libs/tracing/timelinemodelaggregator.h index af8250467c9..8a04a0ed48a 100644 --- a/src/libs/tracing/timelinemodelaggregator.h +++ b/src/libs/tracing/timelinemodelaggregator.h @@ -35,9 +35,9 @@ class TRACING_EXPORT TimelineModelAggregator : public QObject Q_OBJECT Q_PROPERTY(int height READ height NOTIFY heightChanged) Q_PROPERTY(QVariantList models READ models WRITE setModels NOTIFY modelsChanged) - Q_PROPERTY(Timeline::TimelineNotesModel *notes READ notes CONSTANT) + Q_PROPERTY(Timeline::TimelineNotesModel *notes READ notes WRITE setNotes NOTIFY notesChanged) public: - TimelineModelAggregator(TimelineNotesModel *notes = nullptr, QObject *parent = nullptr); + TimelineModelAggregator(QObject *parent = nullptr); ~TimelineModelAggregator() override; int height() const; @@ -50,6 +50,8 @@ public: void setModels(const QVariantList &models); TimelineNotesModel *notes() const; + void setNotes(TimelineNotesModel *notes); + void clear(); int modelCount() const; int modelIndexById(int modelId) const; @@ -62,6 +64,7 @@ public: signals: void modelsChanged(); void heightChanged(); + void notesChanged(); void updateCursorPosition(); private: diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 7e7d77bfb93..50f6030d0f2 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -145,7 +145,8 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag setLayout(groupLayout); d->m_viewContainer = container; - d->m_modelProxy = new Timeline::TimelineModelAggregator(modelManager->notesModel(), this); + d->m_modelProxy = new Timeline::TimelineModelAggregator(this); + d->m_modelProxy->setNotes(modelManager->notesModel()); d->m_modelManager = modelManager; QVariantList models; From 75db89d92e8dbba8114b1b905242e3638ddcdce9 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 27 Aug 2018 15:34:15 +0200 Subject: [PATCH 12/14] Tracing: Wrap pointers we don't own in QPointer The notes model might get deleted before the renderer. Change-Id: Ic7b0ee73bd96e63b19e05b1a374baaf28c6f47fc Reviewed-by: Christian Kandeler --- src/libs/tracing/timelineabstractrenderer_p.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/tracing/timelineabstractrenderer_p.h b/src/libs/tracing/timelineabstractrenderer_p.h index 0626710cd86..98d97004a30 100644 --- a/src/libs/tracing/timelineabstractrenderer_p.h +++ b/src/libs/tracing/timelineabstractrenderer_p.h @@ -27,6 +27,8 @@ #include "timelineabstractrenderer.h" +#include + namespace Timeline { class TRACING_EXPORT TimelineAbstractRenderer::TimelineAbstractRendererPrivate { @@ -36,9 +38,9 @@ public: int selectedItem; bool selectionLocked; - TimelineModel *model; - TimelineNotesModel *notes; - TimelineZoomControl *zoomer; + QPointer model; + QPointer notes; + QPointer zoomer; bool modelDirty; bool rowHeightsDirty; From faccb8fd7195af5bcbbf5d9d226919bffe4b1865 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 28 Aug 2018 14:54:00 +0200 Subject: [PATCH 13/14] qbs build: Fix highlighter engine autotest We link against the TextEditor plugin as of 601eebd832, so don't pretend anymore that we are the plugin. Change-Id: I8afdce57ceffdcbf965e16e7a24c0a9ab6d7d234 Reviewed-by: Christian Stenger --- .../generichighlighter/highlighterengine/highlighterengine.qbs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs b/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs index b0abba77760..8e12d56d153 100644 --- a/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs +++ b/tests/auto/generichighlighter/highlighterengine/highlighterengine.qbs @@ -38,7 +38,6 @@ QtcAutotest { ] } - cpp.defines: base.concat(["TEXTEDITOR_LIBRARY"]) // For Windows cpp.includePaths: base.concat([ path, project.genericHighlighterDir + "/../..", From 8ef4964168ccca6153cd9dbfc631043d8293e370 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 13 Jul 2018 16:34:49 +0200 Subject: [PATCH 14/14] QmlProfiler: Don't scan the whole file system in rewriter test QLibraryInfo::location() returns one string. Iterating over that gives us the individual characters, beginning with '/'. Running that through FileName::fromString(), gives us "/", and feeding this to ModelManagerInterface::importScan() is not funny. This has to be backported as the sheer volume of files to be scanned makes the tests time out. (cherry-picked from commit af8bd1238724e3d578b9a16e4ffa88a6a046dca6) Change-Id: Ib4293437ab83da8ed10a696fba2c30f5c51c8124 Reviewed-by: Eike Ziller --- .../qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp index 830f1a1e613..e70b11f21e4 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp @@ -213,8 +213,9 @@ void QmlProfilerDetailsRewriterTest::seedRewriter() QFutureInterface result; QmlJS::PathsAndLanguages lPaths; - for (auto p : QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)) - lPaths.maybeInsert(Utils::FileName::fromString(p), QmlJS::Dialect::Qml); + lPaths.maybeInsert( + Utils::FileName::fromString(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)), + QmlJS::Dialect::Qml); QmlJS::ModelManagerInterface::importScan(result, QmlJS::ModelManagerInterface::workingCopy(), lPaths, m_modelManager, false);