summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--dist/changes-4.1.0.md30
-rw-r--r--doc/src/qtquick/qtquick-buttons.qdoc4
-rw-r--r--doc/src/qtquick/qtquick-connection-editor.qdoc2
-rw-r--r--share/qtcreator/debugger/dumper.py476
-rw-r--r--share/qtcreator/debugger/gdbbridge.py27
-rw-r--r--share/qtcreator/debugger/lldbbridge.py14
-rw-r--r--share/qtcreator/debugger/qttypes.py2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml24
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/DoubleSpinBox.qml (renamed from share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/SliderSpinBox.qml)6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/GradientLine.qml50
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/checkers.pngbin0 -> 80 bytes
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir2
-rw-r--r--share/qtcreator/styles/creator-dark.xml63
-rw-r--r--share/qtcreator/themes/dark.creatortheme30
-rw-r--r--share/qtcreator/themes/default.creatortheme1
-rw-r--r--share/qtcreator/themes/flat-dark.creatortheme32
-rw-r--r--share/qtcreator/themes/flat-light.creatortheme22
-rw-r--r--share/qtcreator/themes/flat.creatortheme1
-rw-r--r--src/app/main.cpp12
-rw-r--r--src/libs/qmljs/parser/qmljslexer.cpp58
-rw-r--r--src/libs/qmljs/parser/qmljsparser.cpp12
-rw-r--r--src/libs/qmljs/qmljsfindexportedcpptypes.cpp18
-rw-r--r--src/libs/qmljs/qmljsfindexportedcpptypes.h2
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp82
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.h1
-rw-r--r--src/libs/utils/buildablehelperlibrary.cpp2
-rw-r--r--src/libs/utils/shellcommand.cpp226
-rw-r--r--src/libs/utils/shellcommand.h18
-rw-r--r--src/libs/utils/stylehelper.cpp15
-rw-r--r--src/libs/utils/stylehelper.h1
-rw-r--r--src/libs/utils/synchronousprocess.cpp165
-rw-r--r--src/libs/utils/synchronousprocess.h33
-rw-r--r--src/libs/utils/theme/theme.cpp82
-rw-r--r--src/libs/utils/theme/theme.h47
-rw-r--r--src/plugins/android/androidbuildapkstep.cpp2
-rw-r--r--src/plugins/bazaar/bazaarclient.cpp20
-rw-r--r--src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp6
-rw-r--r--src/plugins/beautifier/beautifierplugin.cpp2
-rw-r--r--src/plugins/beautifier/generaloptionspage.ui2
-rw-r--r--src/plugins/bookmarks/bookmark.cpp4
-rw-r--r--src/plugins/bookmarks/bookmark.h12
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp18
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.h6
-rw-r--r--src/plugins/bookmarks/bookmarksplugin.cpp7
-rw-r--r--src/plugins/clangcodemodel/clangdiagnosticmanager.cpp35
-rw-r--r--src/plugins/clangcodemodel/clangdiagnosticmanager.h4
-rw-r--r--src/plugins/clangcodemodel/clangtextmark.cpp5
-rw-r--r--src/plugins/clangcodemodel/clangtextmark.h5
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp37
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h5
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui11
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp22
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp50
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h35
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp4
-rw-r--r--src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp12
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketool.cpp10
-rw-r--r--src/plugins/coreplugin/dialogs/settingsdialog.cpp2
-rw-r--r--src/plugins/coreplugin/fancytabwidget.cpp25
-rw-r--r--src/plugins/coreplugin/manhattanstyle.cpp21
-rw-r--r--src/plugins/coreplugin/outputpanemanager.cpp39
-rw-r--r--src/plugins/cppeditor/cppeditorplugin.h1
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp17
-rw-r--r--src/plugins/cpptools/cppcodemodelsettingspage.cpp3
-rw-r--r--src/plugins/cpptools/cppcodemodelsettingspage.ui11
-rw-r--r--src/plugins/cvs/cvsplugin.cpp4
-rw-r--r--src/plugins/debugger/console/consoleitemdelegate.cpp1
-rw-r--r--src/plugins/debugger/console/consoleview.cpp4
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp22
-rw-r--r--src/plugins/debugger/debuggerprotocol.cpp2
-rw-r--r--src/plugins/debugger/gdb/coregdbadapter.cpp2
-rw-r--r--src/plugins/debugger/gdb/gdbplainengine.cpp5
-rw-r--r--src/plugins/debugger/logwindow.cpp10
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp6
-rw-r--r--src/plugins/git/annotationhighlighter.cpp5
-rw-r--r--src/plugins/git/annotationhighlighter.h2
-rw-r--r--src/plugins/git/branchadddialog.cpp40
-rw-r--r--src/plugins/git/branchdialog.cpp16
-rw-r--r--src/plugins/git/branchmodel.cpp81
-rw-r--r--src/plugins/git/changeselectiondialog.cpp14
-rw-r--r--src/plugins/git/commitdata.cpp16
-rw-r--r--src/plugins/git/gerrit/branchcombobox.cpp12
-rw-r--r--src/plugins/git/gerrit/gerritdialog.cpp4
-rw-r--r--src/plugins/git/gerrit/gerritmodel.cpp78
-rw-r--r--src/plugins/git/gerrit/gerritoptionspage.cpp4
-rw-r--r--src/plugins/git/gerrit/gerritparameters.cpp54
-rw-r--r--src/plugins/git/gerrit/gerritplugin.cpp49
-rw-r--r--src/plugins/git/gerrit/gerritpushdialog.cpp54
-rw-r--r--src/plugins/git/gitclient.cpp570
-rw-r--r--src/plugins/git/gitclient.h5
-rw-r--r--src/plugins/git/giteditor.cpp33
-rw-r--r--src/plugins/git/gitgrep.cpp33
-rw-r--r--src/plugins/git/githighlighters.cpp20
-rw-r--r--src/plugins/git/gitplugin.cpp42
-rw-r--r--src/plugins/git/gitsettings.cpp4
-rw-r--r--src/plugins/git/gitsubmiteditor.cpp4
-rw-r--r--src/plugins/git/gitsubmiteditorwidget.cpp8
-rw-r--r--src/plugins/git/gitutils.cpp4
-rw-r--r--src/plugins/git/gitversioncontrol.cpp9
-rw-r--r--src/plugins/git/logchangedialog.cpp18
-rw-r--r--src/plugins/git/mergetool.cpp4
-rw-r--r--src/plugins/git/remotedialog.cpp3
-rw-r--r--src/plugins/git/remotemodel.cpp20
-rw-r--r--src/plugins/git/settingspage.cpp2
-rw-r--r--src/plugins/git/stashdialog.cpp18
-rw-r--r--src/plugins/help/docsettingspage.cpp15
-rw-r--r--src/plugins/help/filtersettingspage.cpp4
-rw-r--r--src/plugins/help/generalsettingspage.cpp85
-rw-r--r--src/plugins/help/generalsettingspage.h7
-rw-r--r--src/plugins/help/helpmode.cpp2
-rw-r--r--src/plugins/help/helpplugin.cpp42
-rw-r--r--src/plugins/help/helpviewer.cpp8
-rw-r--r--src/plugins/help/helpwidget.cpp34
-rw-r--r--src/plugins/help/localhelpmanager.cpp115
-rw-r--r--src/plugins/help/openpagesmodel.cpp2
-rw-r--r--src/plugins/help/qtwebkithelpviewer.cpp8
-rw-r--r--src/plugins/help/remotehelpfilter.cpp12
-rw-r--r--src/plugins/help/searchwidget.cpp16
-rw-r--r--src/plugins/help/textbrowserhelpviewer.cpp2
-rw-r--r--src/plugins/help/xbelsupport.cpp44
-rw-r--r--src/plugins/ios/iosprobe.cpp2
-rw-r--r--src/plugins/mercurial/mercurialclient.cpp52
-rw-r--r--src/plugins/perforce/perforceplugin.cpp4
-rw-r--r--src/plugins/projectexplorer/abstractmsvctoolchain.cpp2
-rw-r--r--src/plugins/projectexplorer/buildprogress.cpp3
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp8
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp11
-rw-r--r--src/plugins/projectexplorer/kitoptionspage.cpp21
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.cpp6
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.cpp21
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp17
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.h3
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectparser.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp7
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp2
-rw-r--r--src/plugins/qmldesigner/components/componentcore/theming.cpp1
-rw-r--r--src/plugins/qmldesigner/components/formeditor/movetool.cpp1
-rw-r--r--src/plugins/qmldesigner/components/importmanager/importmanager.css6
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp29
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp5
-rw-r--r--src/plugins/qmldesigner/components/resources/stylesheet.css15
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h13
-rw-r--r--src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp9
-rw-r--r--src/plugins/qmldesigner/designmodewidget.cpp7
-rw-r--r--src/plugins/qmldesigner/documentwarningwidget.cpp4
-rw-r--r--src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.h2
-rw-r--r--src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.cpp2
-rw-r--r--src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp4
-rw-r--r--src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp9
-rw-r--r--src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.h3
-rw-r--r--src/plugins/qmldesigner/qmldesignerextension/connectioneditor/stylesheet.css192
-rw-r--r--src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp24
-rw-r--r--src/plugins/qnx/qnxattachdebugsupport.cpp5
-rw-r--r--src/plugins/qnx/qnxplugin.cpp4
-rw-r--r--src/plugins/subversion/subversionclient.cpp7
-rw-r--r--src/plugins/subversion/subversionplugin.cpp14
-rw-r--r--src/plugins/texteditor/basefilefind.cpp1
-rw-r--r--src/plugins/texteditor/generichighlighter/highlighter.cpp4
-rw-r--r--src/plugins/texteditor/generichighlighter/highlighter.h3
-rw-r--r--src/plugins/texteditor/generichighlighter/highlightersettings.cpp2
-rw-r--r--src/plugins/texteditor/texteditor.cpp14
-rw-r--r--src/plugins/texteditor/texteditor.h2
-rw-r--r--src/plugins/texteditor/textmark.cpp23
-rw-r--r--src/plugins/texteditor/textmark.h6
-rw-r--r--src/plugins/todo/todoplugin.cpp6
-rw-r--r--src/plugins/vcsbase/vcsbaseclient.cpp54
-rw-r--r--src/plugins/vcsbase/vcsbaseclient.h21
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.h9
-rw-r--r--src/plugins/vcsbase/vcscommand.cpp48
-rw-r--r--src/plugins/vcsbase/vcscommand.h3
-rw-r--r--src/share/3rdparty/data.pro3
-rw-r--r--src/share/3rdparty/fonts/SourceCodePro-Bold.ttfbin0 -> 197004 bytes
-rw-r--r--src/share/3rdparty/fonts/SourceCodePro-It.ttfbin0 -> 163624 bytes
-rw-r--r--src/share/3rdparty/fonts/SourceCodePro-Regular.ttfbin0 -> 197644 bytes
-rw-r--r--src/share/3rdparty/fonts/SourceCodePro.txt93
-rw-r--r--src/share/3rdparty/generic-highlighter/cmake.xml22
-rw-r--r--src/share/3rdparty/generic-highlighter/doxygen.xml8
m---------src/shared/qbs0
-rw-r--r--src/tools/iostool/iosdevicemanager.cpp2
-rw-r--r--src/tools/iostool/iosdevicemanager.h3
-rw-r--r--src/tools/iostool/main.cpp49
-rw-r--r--src/tools/screenshotcropper/cropimageview.h1
-rw-r--r--src/tools/screenshotcropper/screenshotcropper.pro9
-rw-r--r--src/tools/screenshotcropper/screenshotcropperwindow.cpp8
-rw-r--r--src/tools/screenshotcropper/screenshotcropperwindow.h4
-rw-r--r--tests/auto/algorithm/tst_algorithm.cpp4
-rw-r--r--tests/auto/qml/codemodel/dependencies/dependencies.qbs1
-rw-r--r--tests/manual/process/mainwindow.cpp4
-rw-r--r--tests/system/shared/classes.py9
-rwxr-xr-xtests/system/suite_CCOM/tst_CCOM01/test.py18
-rwxr-xr-xtests/system/suite_CCOM/tst_CCOM02/test.py12
-rw-r--r--tests/system/suite_CSUP/tst_CSUP01/test.py27
-rw-r--r--tests/system/suite_QMLS/tst_QMLS03/test.py16
-rw-r--r--tests/system/suite_debugger/tst_simple_debug/test.py3
-rw-r--r--tests/system/suite_general/tst_default_settings/testdata/win_compiler_paths.tsv2
-rw-r--r--tests/system/suite_general/tst_session_handling/test.py20
-rw-r--r--tests/system/suite_qtquick/tst_qml_outline/test.py13
-rw-r--r--tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod1_outline.tsv45
-rw-r--r--tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod2_outline.tsv45
-rw-r--r--tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv45
-rw-r--r--tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_outline.tsv45
-rw-r--r--tests/unit/unittest/clangcodecompleteresultstest.cpp18
203 files changed, 2766 insertions, 2159 deletions
diff --git a/README.md b/README.md
index 649620b74b..08d253afc8 100644
--- a/README.md
+++ b/README.md
@@ -333,3 +333,15 @@ SQLite (https://www.sqlite.org) is in the Public Domain.
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+
+### Source Code Pro font
+
+ Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
+ with Reserved Font Name 'Source'. All Rights Reserved. Source is a
+ trademark of Adobe Systems Incorporated in the United States
+ and/or other countries.
+
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
+
+ The font and license files can be found in QtCreator/src/libs/3rdparty/fonts.
+
diff --git a/dist/changes-4.1.0.md b/dist/changes-4.1.0.md
index f9160eb7b4..044ba33cdd 100644
--- a/dist/changes-4.1.0.md
+++ b/dist/changes-4.1.0.md
@@ -10,23 +10,23 @@ you can check out from the public Git repository. For example:
General
* Added `Flat Dark` and `Flat Light` themes
-* Added `Ctrl+N` and `Ctrl+P` shortcuts for navigating in Locator
-* Added experimental support for the `Nim` programming language
+* Added `Ctrl+N` and `Ctrl+P` shortcuts for navigating in locator
+* Added experimental support for `Nim` programming language
Editing
* Added automatic release of resources for unmodified documents that have
- not been visible a long time (QTCREATORBUG-10016)
+ not been visible recently (QTCREATORBUG-10016)
* Added separate options for automatically inserted characters
* Added highlighting of automatically inserted characters
* Added option for skipping automatically inserted character, and changed
- it to do this only as long as the cursor stays before it
-* Fixed that replacing could change the selection (QTCREATORBUG-15623)
+ it to be done only if the cursor stays before the character
+* Fixed that replacing could change selection (QTCREATORBUG-15623)
All Projects
-* Improved feedback when build results in errors and there
- are issues with the kit (QTCREATORBUG-16079)
+* Improved feedback when building results in errors, because of issues with
+ kits (QTCREATORBUG-16079)
* Fixed issue with building in paths with non-ASCII characters
(QTCREATORBUG-15855)
* Fixed that `%{buildDir}` and `%{sourceDir}` stopped working in
@@ -44,12 +44,12 @@ CMake Projects
* Improved parsing of errors
* Added workaround for CMake issue that include paths are in random order
(QTCREATORBUG-16432)
-* Added option for disabling automatic running of CMake to Build & Run > CMake
- (QTCREATORBUG-15934)
-* Fixed that CMake was automatically run even if the Qt Creator application
- is not in the foreground (QTCREATORBUG-16354)
+* Added option for disabling automatic running of CMake to `Build & Run` >
+ `CMake` (QTCREATORBUG-15934)
+* Fixed that CMake was automatically run even if Qt Creator application
+ is not in foreground (QTCREATORBUG-16354)
* QML_IMPORT_PATH can now be set in CMakeLists.txt files. This information
- will be passed on to the QmlJS code model (QTCREATORBUG-11328)
+ will be passed on to QmlJS code model (QTCREATORBUG-11328)
Example CMakeLists.txt code:
`set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/qml ${CMAKE_BINARY_DIR}/imports CACHE string "" FORCE)`
@@ -69,7 +69,7 @@ C++ Support
QML Support
-* Added formal parameters of JavaScript functions to outline and Locator
+* Added formal parameters of JavaScript functions to outline and locator
Debugging
@@ -89,7 +89,7 @@ Qt Quick Designer
* Added support for Qt Quick Controls 2 styles
* Added `Move to Component` action
-* Added `Add new Signal Handler` action
+* Added `Add New Signal Handler` action
* Improved performance
* Improved error dialog (QTCREATORBUG-15772)
* Fixed crumble bar for component navigation
@@ -144,9 +144,9 @@ Remote Linux
iOS
+* Added human readable error messages (QTCREATORBUG-16328)
* Fixed that deployment could fail if device and host are in same WiFi network
(QTCREATORBUG-16061)
-* Fixed missing human readable error messages (QTCREATORBUG-16328)
Credits for these changes go to:
Albert Astals Cid
diff --git a/doc/src/qtquick/qtquick-buttons.qdoc b/doc/src/qtquick/qtquick-buttons.qdoc
index f468ca3c0a..71c3cb2f3d 100644
--- a/doc/src/qtquick/qtquick-buttons.qdoc
+++ b/doc/src/qtquick/qtquick-buttons.qdoc
@@ -159,10 +159,10 @@
width (\uicontrol W) and height (\uicontrol H) of the button in the
\uicontrol Properties pane.
- \li Select \uicontrol Connections > \uicontrol {Dynamic Properties} >
+ \li Select \uicontrol Connections > \uicontrol {Properties} >
\uicontrol Add to add properties for the item:
- \image qmldesigner-borderimage-properties.png "Dynamic properties"
+ \image qmldesigner-borderimage-properties.png "Properties"
\list a
diff --git a/doc/src/qtquick/qtquick-connection-editor.qdoc b/doc/src/qtquick/qtquick-connection-editor.qdoc
index 6e3f2c26bf..236d3f9bbc 100644
--- a/doc/src/qtquick/qtquick-connection-editor.qdoc
+++ b/doc/src/qtquick/qtquick-connection-editor.qdoc
@@ -80,7 +80,7 @@
\list 1
- \li Select the \uicontrol {Dynamic Properties} tab.
+ \li Select the \uicontrol {Properties} tab.
\li Select \uicontrol Item to select the object to specify the property for.
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py
index 99db06848c..959c81ab5e 100644
--- a/share/qtcreator/debugger/dumper.py
+++ b/share/qtcreator/debugger/dumper.py
@@ -344,6 +344,7 @@ class DumperBase:
self.displayStringLimit = 100
self.resetCaches()
+ self.resetStats()
self.childrenPrefix = 'children=['
self.childrenSuffix = '],'
@@ -376,6 +377,35 @@ class DumperBase:
# to not be QObject derived, it contains a 0 value.
self.knownStaticMetaObjects = {}
+ self.counts = {}
+ self.pretimings = {}
+ self.timings = []
+
+ def resetStats(self):
+ # Timing collection
+ self.pretimings = {}
+ self.timings = []
+ pass
+
+ def dumpStats(self):
+ msg = [self.counts, self.timings]
+ self.resetStats()
+ return msg
+
+ def bump(self, key):
+ if key in self.counts:
+ self.counts[key] += 1
+ else:
+ self.counts[key] = 1
+
+ def preping(self, key):
+ import time
+ self.pretimings[key] = time.time()
+
+ def ping(self, key):
+ import time
+ elapsed = int(1000000 * (time.time() - self.pretimings[key]))
+ self.timings.append([key, elapsed])
def putNewline(self):
pass
@@ -1260,67 +1290,171 @@ class DumperBase:
pass
- def extractStaticMetaObjectHelper(self, typeobj):
- """
- Checks whether type has a Q_OBJECT macro.
- Returns the staticMetaObject, or 0.
- """
+ def extractMetaObjectPtr(self, objectPtr, typeobj):
+ """ objectPtr - address of *potential* instance of QObject derived class
+ typeobj - type of *objectPtr if known, None otherwise. """
- if self.isSimpleType(typeobj):
- return 0
+ def canBePointer(p):
+ if ptrSize == 4:
+ return p > 100000 and (p & 0x3 == 0)
+ else:
+ return p > 100000 and (p & 0x7 == 0) and (p < 0x7fffffffffff)
- typeName = str(typeobj)
- isQObjectProper = typeName == self.qtNamespace() + "QObject"
+ def couldBeQObject():
+ (vtablePtr, dd) \
+ = self.extractStruct('PP', objectPtr, 2 * ptrSize)
+ if not canBePointer(vtablePtr):
+ self.bump("vtable")
+ return False
+ if not canBePointer(dd):
+ self.bump("d_d_ptr")
+ return False
- if not isQObjectProper:
- if self.directBaseClass(typeobj, 0) is None:
- return 0
+ (dvtablePtr, qptr, parentPtr, childrenDPtr, flags) \
+ = self.extractStruct('PPPPI', dd, 4 * ptrSize + 4)
+ #warn("STRUCT DD: %s %s" % (self.currentIName, x))
+ if not canBePointer(dvtablePtr):
+ self.bump("dvtable")
+ #warn("DVT: 0x%x" % dvtablePtr)
+ return False
+ # Check d_ptr.d.q_ptr == objectPtr
+ if qptr != objectPtr:
+ #warn("QPTR: 0x%x 0x%x" % (qptr, objectPtr))
+ self.bump("q_ptr")
+ return False
+ if parentPtr and not canBePointer(parentPtr):
+ #warn("PAREN")
+ self.bump("parent")
+ return False
+ if not canBePointer(childrenDPtr):
+ #warn("CHILD")
+ self.bump("children")
+ return False
+ #if flags >= 0x80: # Only 7 flags are defined
+ # warn("FLAGS: 0x%x %s" % (flags, self.currentIName))
+ # self.bump("flags")
+ # return False
+ #warn("OK")
+ #if dynMetaObjectPtr and not canBePointer(dynMetaObjectPtr):
+ # self.bump("dynmo")
+ # return False
+
+ self.bump("couldBeQObject")
+ return True
+
+ def extractMetaObjectPtrFromAddress():
+ # Try vtable, metaObject() is the first entry.
+ vtablePtr = self.extractPointer(objectPtr)
+ metaObjectFunc = self.extractPointer(vtablePtr)
+ cmd = "((void*(*)(void *))0x%x)(0x%x)" % (metaObjectFunc, objectPtr)
+ try:
+ #warn("MO CMD: %s" % cmd)
+ res = self.parseAndEvaluate(cmd)
+ #warn("MO RES: %s" % res)
+ self.bump("successfulMetaObjectCall")
+ return toInteger(res)
+ except:
+ self.bump("failedMetaObjectCall")
+ #warn("COULD NOT EXECUTE: %s" % cmd)
+ return 0
- # No templates for now.
- if typeName.find('<') >= 0:
+ def extractStaticMetaObjectFromTypeHelper(typeobj):
+ if self.isSimpleType(typeobj):
return 0
- result = self.findStaticMetaObject(typeName)
+ typeName = str(typeobj)
+ isQObjectProper = typeName == self.qtNamespace() + "QObject"
+
+ if not isQObjectProper:
+ if self.directBaseClass(typeobj, 0) is None:
+ return 0
+
+ # No templates for now.
+ if typeName.find('<') >= 0:
+ return 0
+
+ result = self.findStaticMetaObject(typeName)
+
+ # We need to distinguish Q_OBJECT from Q_GADGET:
+ # a Q_OBJECT SMO has a non-null superdata (unless it's QObject itself),
+ # a Q_GADGET SMO has a null superdata (hopefully)
+ if result and not isQObjectProper:
+ superdata = self.extractPointer(result)
+ if superdata == 0:
+ # This looks like a Q_GADGET
+ return 0
- # We need to distinguish Q_OBJECT from Q_GADGET:
- # a Q_OBJECT SMO has a non-null superdata (unless it's QObject itself),
- # a Q_GADGET SMO has a null superdata (hopefully)
- if result and not isQObjectProper:
- superdata = self.extractPointer(result)
- if toInteger(superdata) == 0:
- # This looks like a Q_GADGET
+ return result
+
+ def extractStaticMetaObjectPtrFromType(someTypeObj):
+ if someTypeObj is None:
return 0
+ someTypeName = str(someTypeObj)
+ self.bump('metaObjectFromType')
+ known = self.knownStaticMetaObjects.get(someTypeName, None)
+ if known is not None: # Is 0 or the static metaobject.
+ return known
+
+ result = 0
+ #try:
+ result = extractStaticMetaObjectFromTypeHelper(someTypeObj)
+ #except RuntimeError as error:
+ # warn("METAOBJECT EXTRACTION FAILED: %s" % error)
+ #except:
+ # warn("METAOBJECT EXTRACTION FAILED FOR UNKNOWN REASON")
+
+ if not result:
+ base = self.directBaseClass(typeobj, 0)
+ if base != someTypeObj: # sanity check
+ result = extractStaticMetaObjectPtrFromType(base)
+
+ self.knownStaticMetaObjects[someTypeName] = result
+ return result
- return result
- def extractStaticMetaObject(self, typeobj):
- """
- Checks recursively whether a type derives from QObject.
- """
if not self.useFancy:
return 0
+ ptrSize = self.ptrSize()
+
typeName = str(typeobj)
result = self.knownStaticMetaObjects.get(typeName, None)
if result is not None: # Is 0 or the static metaobject.
+ self.bump("typecached")
+ #warn("CACHED RESULT: %s %s 0x%x" % (self.currentIName, typeName, result))
return result
- try:
- result = self.extractStaticMetaObjectHelper(typeobj)
- except RuntimeError as error:
- warn("METAOBJECT EXTRACTION FAILED: %s" % error)
- result = 0
- except:
- warn("METAOBJECT EXTRACTION FAILED FOR UNKNOWN REASON")
- result = 0
+ if not couldBeQObject():
+ self.bump('cannotBeQObject')
+ #warn("DOES NOT LOOK LIKE A QOBJECT: %s" % self.currentIName)
+ return 0
- if not result:
- base = self.directBaseClass(typeobj, 0)
- if base:
- result = self.extractStaticMetaObject(base)
-
- self.knownStaticMetaObjects[typeName] = result
- return result
+ metaObjectPtr = 0
+ if not metaObjectPtr:
+ # measured: 3 ms (example had one level of inheritance)
+ self.preping("metaObjectType-" + self.currentIName)
+ metaObjectPtr = extractStaticMetaObjectPtrFromType(typeobj)
+ self.ping("metaObjectType-" + self.currentIName)
+
+ if not metaObjectPtr:
+ # measured: 200 ms (example had one level of inheritance)
+ self.preping("metaObjectCall-" + self.currentIName)
+ metaObjectPtr = extractMetaObjectPtrFromAddress()
+ self.ping("metaObjectCall-" + self.currentIName)
+
+ #if metaObjectPtr:
+ # self.bump('foundMetaObject')
+ # self.knownStaticMetaObjects[typeName] = metaObjectPtr
+
+ return metaObjectPtr
+
+ def extractStruct(self, pattern, base, size):
+ #warn("PATTERN: '%s'" % pattern)
+ pointerReplacement = 'Q' if self.ptrSize() == 8 else 'I'
+ pattern = pattern.replace('P', pointerReplacement)
+ mem = self.readRawMemory(base, size)
+ #warn("OUT: '%s'" % str(struct.unpack_from(pattern, mem)))
+ return struct.unpack_from(pattern, mem)
def extractCString(self, addr):
result = bytearray()
@@ -1361,88 +1495,74 @@ class DumperBase:
def putStructGuts(self, value):
self.putEmptyValue()
+ #metaObjectPtr = self.extractMetaObjectPtr(self.addressOf(value), value.type)
if self.showQObjectNames:
- staticMetaObject = self.extractStaticMetaObject(value.type)
- if staticMetaObject:
+ self.preping(self.currentIName)
+ metaObjectPtr = self.extractMetaObjectPtr(self.addressOf(value), value.type)
+ self.ping(self.currentIName)
+ if metaObjectPtr:
self.context = value
self.putQObjectNameValue(value)
+ #warn("STRUCT GUTS: %s MO: 0x%x " % (self.currentIName, metaObjectPtr))
if self.isExpanded():
self.put('sortable="1"')
with Children(self, 1, childType=None):
self.putFields(value)
if not self.showQObjectNames:
- staticMetaObject = self.extractStaticMetaObject(value.type)
- if staticMetaObject:
- self.putQObjectGuts(value, staticMetaObject)
+ metaObjectPtr = self.extractMetaObjectPtr(self.addressOf(value), value.type)
+ if metaObjectPtr:
+ self.putQObjectGuts(value, metaObjectPtr)
# This is called is when a QObject derived class is expanded
- def putQObjectGuts(self, qobject, smo):
- ptrSize = self.ptrSize()
- dd = self.extractPointer(qobject, offset=ptrSize)
-
- # Parent and children.
- try:
- if qobject:
- d_ptr = qobject["d_ptr"]["d"]
- with SubItem(self, "[parent]"):
- self.putItem(d_ptr["parent"])
- self.put('sortgroup="9"')
- with SubItem(self, "[children]"):
- self.putItem(d_ptr["children"])
- self.put('sortgroup="1"')
- except:
- pass
+ def putQObjectGuts(self, qobject, metaObjectPtr):
+ self.putQObjectGutsHelper(qobject, self.addressOf(qobject), -1, metaObjectPtr, "QObject")
- # dd = value["d_ptr"]["d"] is just behind the vtable.
- isQt5 = self.qtVersion() >= 0x50000
- extraDataOffset = 5 * ptrSize + 8 if isQt5 else 6 * ptrSize + 8
- extraData = self.extractPointer(dd + extraDataOffset)
- self.putQObjectGutsHelper(qobject, extraData, -1, smo, "QObject")
-
- def metaString(self, metaObject, index, revision = 7):
- sd = self.extractPointer(metaObject["d"]["stringdata"])
+ def metaString(self, metaObjectPtr, index, revision = 7):
+ #stringData = self.extractPointer(metaObjectPtr["d"]["stringdata"])
+ ptrSize = self.ptrSize()
+ stringdata = self.extractPointer(toInteger(metaObjectPtr) + ptrSize)
if revision >= 7: # Qt 5.
- byteArrayDataType = self.lookupQtType("QByteArrayData")
- byteArrayDataSize = byteArrayDataType.sizeof
- literal = toInteger(sd) + toInteger(index) * byteArrayDataSize
+ #byteArrayDataType = self.lookupQtType("QByteArrayData")
+ #byteArrayDataSize = byteArrayDataType.sizeof
+ byteArrayDataSize = 24 if ptrSize == 8 else 16
+ literal = stringdata + toInteger(index) * byteArrayDataSize
ldata, lsize, lalloc = self.byteArrayDataHelper(literal)
try:
return self.extractBlob(ldata, lsize).toString()
except:
- return "<unavailable>"
+ return "<not available>"
else: # Qt 4.
- ldata = sd + index
+ ldata = stringdata + index
return self.extractCString(ldata).decode("utf8")
def putQMetaStuff(self, value, origType):
- metaObject = value["mobj"]
- if not metaObject:
- self.putEmptyValue()
+ metaObjectPtr = value["mobj"]
+ if toInteger(metaObjectPtr):
+ handle = toInteger(value["handle"])
+ index = toInteger(metaObjectPtr["d"]["data"][handle])
+ name = self.metaString(metaObjectPtr, index)
+ self.putValue(name)
+ self.putNumChild(1)
if self.isExpanded():
with Children(self):
self.putFields(value)
+ self.putQObjectGutsHelper(0, 0, handle, toInteger(metaObjectPtr), origType)
else:
- handle = toInteger(value["handle"])
- index = toInteger(metaObject["d"]["data"][handle])
- name = self.metaString(metaObject.dereference(), index)
- self.putValue(name)
- self.putNumChild(1)
+ self.putEmptyValue()
if self.isExpanded():
with Children(self):
self.putFields(value)
- self.putQObjectGutsHelper(0, 0, handle, metaObject, origType)
- def putQObjectGutsHelper(self, qobject, extraData, handle, metaObject, origType):
+ # basically all meta things go through this here.
+ # qobject and qobjectPtr are non-null if coming from a real structure display
+ # qobject == 0, qobjectPtr != 0 is possible for builds without QObject debug info
+ # if qobject == 0, properties and d-ptr cannot be shown.
+ # handle is what's store in QMetaMethod etc, pass -1 for QObject/QMetaObject itself
+ # metaObjectPtr needs to point to a valid QMetaObject.
+ def putQObjectGutsHelper(self, qobject, qobjectPtr, handle, metaObjectPtr, origType):
intSize = self.intSize()
ptrSize = self.ptrSize()
- data = metaObject["d"]["data"]
-
- def walker(base):
- ptr = toInteger(base)
- while True:
- yield self.extractInt(ptr)
- ptr += intSize
def putt(name, value, typeName = ' '):
with SubItem(self, name):
@@ -1450,63 +1570,103 @@ class DumperBase:
self.putType(typeName)
self.putNumChild(0)
- def superData(mo):
- return mo['d']['superdata']
+ def extractSuperDataPtr(someMetaObjectPtr):
+ #return someMetaObjectPtr['d']['superdata']
+ return self.extractPointer(someMetaObjectPtr)
+
+ def extractDataPtr(someMetaObjectPtr):
+ # dataPtr = metaObjectPtr["d"]["data"]
+ return self.extractPointer(someMetaObjectPtr + 2 * ptrSize)
isQMetaObject = origType == "QMetaObject"
isQObject = origType == "QObject"
- p = walker(data)
- revision = p.next()
- classname = p.next()
- classinfo = p.next()
- classinfo2 = p.next()
- methodCount = p.next()
- methods = p.next()
- propertyCount = p.next()
- properties = p.next()
- enumCount = p.next()
- enums = p.next()
- constructorCount = p.next()
- constructors = p.next()
- flags = p.next()
- signalCount = p.next()
-
- globalOffset = 0
- superdata = superData(metaObject)
- while toInteger(superdata):
- sdata = superdata["d"]["data"]
- p = walker(sdata)
- revision = p.next()
- classname = p.next()
- classinfo = p.next()
- classinfo2 = p.next()
- methodCount = p.next()
- globalOffset += methodCount
- superdata = superData(superdata)
+ #warn("OBJECT GUTS: %s 0x%x " % (self.currentIName, metaObjectPtr))
+ dataPtr = extractDataPtr(metaObjectPtr)
+ #warn("DATA PTRS: %s 0x%x " % (self.currentIName, dataPtr))
+ (revision, classname,
+ classinfo, classinfo2,
+ methodCount, methods,
+ propertyCount, properties,
+ enumCount, enums,
+ constructorCount, constructors,
+ flags, signalCount) = self.extractStruct('IIIIIIIIIIIIII', dataPtr, 56)
largestStringIndex = -1
for i in range(methodCount):
- t = (p.next(), p.next(), p.next(), p.next(), p.next())
+ t = self.extractStruct('IIIII', dataPtr + 56 + i * 20, 20)
if largestStringIndex < t[0]:
largestStringIndex = t[0]
- if isQMetaObject:
- with SubItem(self, "[strings]"):
- self.put('sortgroup="2"')
- self.putSpecialValue("minimumitemcount", largestStringIndex + 1)
- self.putNumChild(1)
+ extraData = 0
+ if qobjectPtr:
+ isQt5 = self.qtVersion() >= 0x50000
+ extraDataOffset = 5 * ptrSize + 8 if isQt5 else 6 * ptrSize + 8
+ # dd = value["d_ptr"]["d"] is just behind the vtable.
+ dd = self.extractPointer(qobjectPtr + ptrSize)
+ extraData = self.extractPointer(dd + extraDataOffset)
+
+ if qobjectPtr:
+ qobjectType = self.lookupQtType("QObject")
+ badType = qobjectType is None
+ with SubItem(self, "[parent]"):
+ self.put('sortgroup="9"')
+ parentPtrType = self.voidPtrType() if badType else qobjectType.pointer()
+ self.putItem(self.createValue(dd + 2 * ptrSize, parentPtrType))
+ with SubItem(self, "[children]"):
+ self.put('sortgroup="8"')
+ base = self.extractPointer(dd + 3 * ptrSize) # It's a QList<QObject *>
+ begin = self.extractInt(base + 8)
+ end = self.extractInt(base + 12)
+ array = base + 16
+ if self.qtVersion() < 0x50000:
+ array += ptrSize
+ self.check(begin >= 0 and end >= 0 and end <= 1000 * 1000 * 1000)
+ size = end - begin
+ self.check(size >= 0)
+ self.putItemCount(size)
if self.isExpanded():
- with Children(self, largestStringIndex + 1):
+ addrBase = array + begin * ptrSize
+ with Children(self, size):
for i in self.childRange():
with SubItem(self, i):
- self.putValue(self.hexencode(self.metaString(metaObject, i)), "latin1")
- self.putNumChild(0)
+ childPtr = self.extractPointer(addrBase + i * ptrSize)
+ if badType:
+ # release build
+ childMetaObjectPtr = self.extractMetaObjectPtr(childPtr, None)
+ if childMetaObjectPtr:
+ # release build + live process
+ self.putNumChild(1)
+ self.putAddress(childPtr)
+ if self.isExpanded():
+ with Children(self):
+ self.putQObjectGutsHelper(0, childPtr, -1, childMetaObjectPtr, "QObject")
+ else:
+ # release build + core dump
+ self.putItem(self.createValue(addrBase + i * ptrSize, self.voidPtrType()))
+ else:
+ # debug info
+ self.putItem(self.createValue(childPtr, qobjectType))
+
+ if isQMetaObject:
+ with SubItem(self, "[strings]"):
+ self.put('sortgroup="2"')
+ if largestStringIndex > 0:
+ self.putSpecialValue("minimumitemcount", largestStringIndex)
+ self.putNumChild(1)
+ if self.isExpanded():
+ with Children(self, largestStringIndex + 1):
+ for i in self.childRange():
+ with SubItem(self, i):
+ self.putValue(self.hexencode(self.metaString(metaObjectPtr, i)), "latin1")
+ self.putNumChild(0)
+ else:
+ self.putValue(" ")
+ self.putNumChild(0)
if isQMetaObject:
with SubItem(self, "[raw]"):
self.put('sortgroup="1"')
- p = walker(data)
self.putEmptyValue()
self.putNumChild(1)
if self.isExpanded():
@@ -1520,9 +1680,8 @@ class DumperBase:
putt("constructors", "%d %d" % (constructorCount, constructors))
putt("flags", flags)
putt("signalCount", signalCount)
- p = walker(toInteger(data) + 14 * 4)
for i in range(methodCount):
- t = (p.next(), p.next(), p.next(), p.next(), p.next())
+ t = self.extractStruct('IIIII', dataPtr + 56 + i * 20, 20)
putt("method %d" % i, "%s %s %s %s %s" % t)
putt("[extraData]", "0x%x" % toInteger(extraData), "void *")
@@ -1535,10 +1694,9 @@ class DumperBase:
usesVector = self.qtVersion() >= 0x50700
with Children(self):
# Static properties.
- p = walker(toInteger(data) + properties * 4)
for i in range(propertyCount):
- t = (p.next(), p.next(), p.next())
- name = self.metaString(metaObject, t[0])
+ t = self.extractStruct("III", dataPtr + properties * 4 + 12 * i, 12)
+ name = self.metaString(metaObjectPtr, t[0])
if qobject:
self.putCallItem(name, qobject, "property", '"' + name + '"')
else:
@@ -1563,8 +1721,17 @@ class DumperBase:
# We need a handle to [x] for the user to expand the item
# before we know whether there are actual children. Counting
# them is too expensive.
- self.putNumChild(1)
self.putSpecialValue("minimumitemcount", propertyCount)
+ self.putNumChild(1)
+
+ superDataPtr = extractSuperDataPtr(metaObjectPtr)
+
+ globalOffset = 0
+ superDataIterator = superDataPtr
+ while superDataIterator:
+ sdata = extractDataPtr(superDataIterator)
+ globalOffset += self.extractInt(sdata + 16) # methodCount member
+ superDataIterator = extractSuperDataPtr(superDataIterator)
if isQMetaObject or isQObject:
with SubItem(self, "[methods]"):
@@ -1572,10 +1739,9 @@ class DumperBase:
self.putItemCount(methodCount)
if self.isExpanded():
with Children(self):
- p = walker(toInteger(data) + 14 * 4)
for i in range(methodCount):
- t = (p.next(), p.next(), p.next(), p.next(), p.next())
- name = self.metaString(metaObject, t[0])
+ t = self.extractStruct("IIIII", dataPtr + 56 + 20 * i, 20)
+ name = self.metaString(metaObjectPtr, t[0])
with SubItem(self, i):
self.putValue(name)
self.putType(" ")
@@ -1602,29 +1768,39 @@ class DumperBase:
putt("[globalindex]", str(globalOffset + i))
if isQObject:
- self.putSubItem("[metaObject]", metaObject)
+ with SubItem(self, "[metaObject]"):
+ self.putAddress(metaObjectPtr)
+ self.putNumChild(1)
+ if self.isExpanded():
+ with Children(self):
+ self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, "QMetaObject")
if isQObject:
with SubItem(self, "d"):
self.put('sortgroup="15"')
- self.putItem(qobject["d_ptr"]["d"])
+ try:
+ self.putItem(qobject["d_ptr"]["d"])
+ except:
+ self.putNumChild(0)
+ self.putSpecialValue("notaccessible")
if isQMetaObject:
with SubItem(self, "[superdata]"):
self.put('sortgroup="12"')
- superdata = superData(metaObject)
- self.putValue("0x%x" % superdata)
- if toInteger(superdata):
+ if superDataPtr:
+ self.putType(self.qtNamespace() + "QMetaObject")
+ self.putAddress(superDataPtr)
self.putNumChild(1)
if self.isExpanded():
with Children(self):
- self.putSubItem('*', superdata)
+ self.putQObjectGutsHelper(0, 0, -1, superDataPtr, "QMetaObject")
else:
+ self.putType(self.qtNamespace() + "QMetaObject *")
+ self.putValue("0x0")
self.putNumChild(0)
- self.putType(superdata.type)
if handle >= 0:
- localIndex = (handle - methods) / 5
+ localIndex = int((handle - methods) / 5)
with SubItem(self, "[localindex]"):
self.put('sortgroup="12"')
self.putValue(localIndex)
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py
index 24abf794d0..3e6c6f15aa 100644
--- a/share/qtcreator/debugger/gdbbridge.py
+++ b/share/qtcreator/debugger/gdbbridge.py
@@ -383,13 +383,9 @@ class Dumper(DumperBase):
def canCallLocale(self):
return False if self.is32bit() else True
- def reportTime(self, hint):
- #from datetime import datetime
- #warn("%s: %s" % (hint, datetime.now().time().isoformat()))
- pass
-
def fetchVariables(self, args):
- self.reportTime("begin fetch")
+ self.resetStats()
+ self.preping("locals")
self.prepare(args)
partialVariable = args.get("partialvar", "")
isPartial = len(partialVariable) > 0
@@ -425,7 +421,7 @@ class Dumper(DumperBase):
else:
locals = self.listOfLocals()
- self.reportTime("locals")
+ self.ping("locals")
# Take care of the return value of the last function call.
if len(self.resultVarName) > 0:
@@ -449,12 +445,16 @@ class Dumper(DumperBase):
else:
# A "normal" local variable or parameter.
with TopLevelItem(self, item.iname):
+ self.preping("all-" + item.iname)
self.put('iname="%s",' % item.iname)
self.put('name="%s",' % item.name)
self.putItem(value)
+ self.ping("all-" + item.iname)
+ self.preping("watches")
with OutputSafer(self):
self.handleWatches(args)
+ self.ping("watches")
self.output.append('],typeinfo=[')
for name in self.typesToReport.keys():
@@ -475,9 +475,10 @@ class Dumper(DumperBase):
self.output.append(',partial="%d"' % isPartial)
- self.reportTime("before print: %s" % len(self.output))
+ self.preping('safePrint')
safePrint(''.join(self.output))
- self.reportTime("after print")
+ self.ping('safePrint')
+ safePrint('"%s"' % str(self.dumpStats()))
def enterSubItem(self, item):
if not item.iname:
@@ -800,10 +801,12 @@ class Dumper(DumperBase):
return struct.unpack("b", self.readRawMemory(address, 1))[0]
def findStaticMetaObject(self, typename):
- return self.findSymbol(typename + "::staticMetaObject")
+ symbol = gdb.lookup_global_symbol(typename + "::staticMetaObject")
+ return toInteger(symbol.value().address) if symbol else 0
def findSymbol(self, symbolName):
try:
+ self.bump('findSymbol1')
result = gdb.lookup_global_symbol(symbolName)
return result.value() if result else 0
except:
@@ -812,9 +815,11 @@ class Dumper(DumperBase):
try:
address = gdb.parse_and_eval("&'%s'" % symbolName)
typeobj = gdb.lookup_type(self.qtNamespace() + "QMetaObject")
+ self.bump('findSymbol2')
return self.createPointerValue(address, typeobj)
except:
- return 0
+ self.bump('findSymbol3')
+ return 0
def put(self, value):
self.output.append(value)
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py
index 5402db229f..8e4cb83ef1 100644
--- a/share/qtcreator/debugger/lldbbridge.py
+++ b/share/qtcreator/debugger/lldbbridge.py
@@ -900,6 +900,10 @@ class Dumper(DumperBase):
# logview pane feature.
self.report('token(\"%s\")' % args["token"])
+ def readRawMemory(self, address, size):
+ error = lldb.SBError()
+ return self.process.ReadMemory(address, size, error)
+
def extractBlob(self, base, size):
if size == 0:
return Blob("")
@@ -923,7 +927,8 @@ class Dumper(DumperBase):
def findStaticMetaObject(self, typeName):
symbolName = self.mangleName(typeName + '::staticMetaObject')
- return self.target.FindFirstGlobalVariable(symbolName)
+ symbol = self.target.FindFirstGlobalVariable(symbolName)
+ return int(symbol.AddressOf()) if symbol.IsValid() else 0
def findSymbol(self, symbolName):
return self.target.FindFirstGlobalVariable(symbolName)
@@ -1205,6 +1210,13 @@ class Dumper(DumperBase):
else:
shadowed[name] = 1
+ if not value.IsInScope():
+ with SubItem(self, name):
+ self.put('iname="%s",' % self.currentIName)
+ self.putSpecialValue('outofscope')
+ self.putNumChild(0)
+ continue
+
if name == "argv" and value.GetType().GetName() == "char **":
self.putSpecialArgv(value)
else:
diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py
index 095f30a8ff..f0bc8ccc37 100644
--- a/share/qtcreator/debugger/qttypes.py
+++ b/share/qtcreator/debugger/qttypes.py
@@ -1106,7 +1106,7 @@ def qdump__QMetaObject(d, value):
d.putNumChild(1)
if d.isExpanded():
with Children(d):
- d.putQObjectGutsHelper(0, 0, -1, value, "QMetaObject")
+ d.putQObjectGutsHelper(0, 0, -1, d.addressOf(value), "QMetaObject")
d.putMembersItem(value)
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml
index a606fc97f7..80272e25c3 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml
@@ -298,13 +298,9 @@ Item {
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
}
- SliderSpinBox {
+ DoubleSpinBox {
id: hueSlider2
//value: colorButton.hue
- decimals: 2
- stepSize: 0.1
- minimumValue: 0
- maximumValue: 1
onValueChanged: {
if (colorButton.hue !== value && !colorButton.block) {
colorButton.hue = value
@@ -325,13 +321,9 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
- SliderSpinBox {
+ DoubleSpinBox {
id: saturationSlider
//value: colorButton.saturation
- decimals: 2
- stepSize: 0.1
- minimumValue: 0
- maximumValue: 1
onValueChanged: {
if (colorButton.saturation !== value && !colorButton.block) {
colorButton.saturation = value
@@ -351,13 +343,9 @@ Item {
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
}
- SliderSpinBox {
+ DoubleSpinBox {
id: lightnessSlider
//value: colorButton.lightness
- decimals: 2
- stepSize: 0.1
- minimumValue: 0
- maximumValue: 1
onValueChanged: {
if (colorButton.lightness !== value && !colorButton.block) {
colorButton.lightness = value
@@ -378,13 +366,9 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
- SliderSpinBox {
+ DoubleSpinBox {
id: alphaSlider
- decimals: 2
- stepSize: 0.1
//value: colorButton.alpha
- minimumValue: 0
- maximumValue: 1
onValueChanged: {
if (colorButton.alpha !== value && !colorButton.block) {
colorButton.alpha = value
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/SliderSpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/DoubleSpinBox.qml
index 9bd286769e..c80054b14f 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/SliderSpinBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/DoubleSpinBox.qml
@@ -29,8 +29,12 @@ import QtQuick.Controls 1.0
SpinBox {
id: spinBox
width: 76
+ decimals: 2
+ stepSize: 0.1
+ minimumValue: 0
+ maximumValue: 1
- property color textColor: colorLogic.textColor
+ property color textColor: creatorTheme.PanelTextColorLight
style: CustomSpinBoxStyle {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/GradientLine.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/GradientLine.qml
index 2bd1f6d631..dd00c9d0a1 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/GradientLine.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/GradientLine.qml
@@ -25,6 +25,7 @@
import QtQuick 2.1
import HelperWidgets 2.0
+import QtQuick.Controls.Private 1.0 // showing a ToolTip
Item {
width: 300
@@ -100,7 +101,9 @@ Item {
var gradientObject = Qt.createQmlObject(gradientString, gradientRectangle, "test");
for (i = 0; i < gradientModel.count; i++) {
- repeater.itemAt(i).item.y = 20 //fixes corner case for dragging overlapped items
+ if (repeater.itemAt(i) !== null)
+ repeater.itemAt(i).item.y = 20 //fixes corner case for dragging overlapped items
+
gradientObject.stops[i].color = gradientModel.getColor(i)
gradientObject.stops[i].position = gradientModel.getPosition(i)
}
@@ -199,6 +202,7 @@ Item {
Component {
id: component
Item {
+ id: gradientStopHandle
y: 20
width: 10
height: 20
@@ -206,6 +210,26 @@ Item {
property alias color: rectangle.color
property alias highlighted: canvas.highlighted
+ property bool toolTipVisible: false
+
+ function refreshToolTip(showToolTip) {
+ toolTipVisible = showToolTip;
+ if (showToolTip) {
+ var currentPoint = Qt.point(gradientStopHandleMouseArea.mouseX, gradientStopHandleMouseArea.mouseY);
+ var fixedGradiantStopPosition = currentGradiantStopPosition();
+ Tooltip.showText(gradientStopHandleMouseArea, currentPoint, fixedGradiantStopPosition.toFixed(3));
+ } else {
+ Tooltip.hideText()
+ }
+ }
+ function currentGradiantStopPosition() {
+ return x / colorLine.effectiveWidth;
+ }
+
+ onXChanged: {
+ refreshToolTip(toolTipVisible)
+ }
+
Rectangle {
id: rectangle
width: 10
@@ -272,21 +296,41 @@ Item {
duration: 100
}
}
-
MouseArea {
+ id: gradientStopHandleMouseArea
anchors.fill: parent
drag.target: parent
drag.minimumX: 0
drag.maximumX: colorLine.effectiveWidth
drag.minimumY: !readOnly ? 0 : 20
drag.maximumY: 20
+
+ // using pressed property instead of drag.active which was not working
+ onExited: {
+ gradientStopHandle.refreshToolTip(pressed);
+ }
+ onCanceled: {
+ gradientStopHandle.refreshToolTip(pressed);
+ }
+ hoverEnabled: true
+
+ Timer {
+ interval: 1000
+ running: gradientStopHandleMouseArea.containsMouse
+ onTriggered: {
+ gradientStopHandle.refreshToolTip(true);
+ }
+ }
+
onPressed: {
colorLine.select(index);
+ gradientStopHandle.refreshToolTip(true);
}
onReleased: {
if (drag.active) {
- gradientModel.setPosition(colorLine.selectedIndex, parent.x / colorLine.effectiveWidth)
+ gradientModel.setPosition(colorLine.selectedIndex, gradientStopHandle.currentGradiantStopPosition())
+ gradientStopHandle.refreshToolTip(false);
if (parent.y < 10) {
if (!readOnly) {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/checkers.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/checkers.png
new file mode 100644
index 0000000000..72cb9f0350
--- /dev/null
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/checkers.png
Binary files differ
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir
index 5aa64e7d68..b4ee6dda7f 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/qmldir
@@ -31,7 +31,7 @@ ScrollView 2.0 ScrollView.qml
SecondColumnLayout 2.0 SecondColumnLayout.qml
Section 2.0 Section.qml
SectionLayout 2.0 SectionLayout.qml
-SliderSpinBox 2.0 SliderSpinBox.qml
+DoubleSpinBox 2.0 DoubleSpinBox.qml
SpinBox 2.0 SpinBox.qml
StandardTextSection 2.0 StandardTextSection.qml
Tab 2.0 Tab.qml
diff --git a/share/qtcreator/styles/creator-dark.xml b/share/qtcreator/styles/creator-dark.xml
new file mode 100644
index 0000000000..2b9a333b38
--- /dev/null
+++ b/share/qtcreator/styles/creator-dark.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<style-scheme version="1.0" name="Qt Creator Dark">
+ <style name="Text" foreground="#d6cf9a" background="#2e2f30"/>
+ <style name="Link" foreground="#d6c540"/>
+ <style name="Selection" background="#1d545c"/>
+ <style name="LineNumber" foreground="#bec0c2" background="#404244"/>
+ <style name="SearchResult" background="#8a7f2c"/>
+ <style name="SearchScope" background="#8a602c"/>
+ <style name="Parentheses" foreground="#bec0c2" background="#1d545c"/>
+ <style name="ParenthesesMismatch" background="#d64564"/>
+ <style name="AutoComplete" foreground="#2c408a" background="#9aa7d6"/>
+ <style name="CurrentLine" background="#373737"/>
+ <style name="CurrentLineNumber" foreground="#d6c540" bold="true"/>
+ <style name="Occurrences" background="#8a402c"/>
+ <style name="Occurrences.Unused" foreground="#8a7f2c"/>
+ <style name="Occurrences.Rename" foreground="#ffaaaa" background="#553636"/>
+ <style name="Number" foreground="#8a602c"/>
+ <style name="String" foreground="#d69545"/>
+ <style name="Type" foreground="#ff8080"/>
+ <style name="Local" foreground="#d6bb9a"/>
+ <style name="Global" foreground="#9aa7d6"/>
+ <style name="Field"/>
+ <style name="Static" foreground="#66a334" italic="true"/>
+ <style name="VirtualMethod" italic="true"/>
+ <style name="Function"/>
+ <style name="Keyword" foreground="#45c6d6" italic="true"/>
+ <style name="PrimitiveType" foreground="#d69aa7"/>
+ <style name="Operator" foreground="#d6bb9a"/>
+ <style name="Preprocessor" foreground="#d64564"/>
+ <style name="Label" foreground="#d6c540"/>
+ <style name="Comment" foreground="#a8abb0" italic="true"/>
+ <style name="Doxygen.Comment" foreground="#65676a" bold="true" italic="true"/>
+ <style name="Doxygen.Tag" foreground="#66a334"/>
+ <style name="VisualWhitespace" foreground="#bec0c2"/>
+ <style name="QmlLocalId" foreground="#9acfd6" italic="true"/>
+ <style name="QmlExternalId" foreground="#9aa7d6" italic="true"/>
+ <style name="QmlTypeId" foreground="#66a334"/>
+ <style name="QmlRootObjectProperty" italic="true"/>
+ <style name="QmlScopeObjectProperty" italic="true"/>
+ <style name="QmlExternalObjectProperty" foreground="#9aa7d6" italic="true"/>
+ <style name="JsScopeVar" foreground="#9acfd6" italic="true"/>
+ <style name="JsImportVar" foreground="#4564d6" italic="true"/>
+ <style name="JsGlobalVar" foreground="#4564d6" italic="true"/>
+ <style name="QmlStateName" foreground="#45c6d6" italic="true"/>
+ <style name="Binding" foreground="#d64564"/>
+ <style name="DisabledCode" foreground="#969696" background="#474747"/>
+ <style name="AddedLine" foreground="#45c6d6"/>
+ <style name="RemovedLine" foreground="#d65645"/>
+ <style name="DiffFile" foreground="#66a334"/>
+ <style name="DiffLocation" foreground="#d6c540"/>
+ <style name="DiffFileLine" foreground="#2e2f30" background="#d6c540"/>
+ <style name="DiffContextLine" foreground="#2e2f30" background="#65676a"/>
+ <style name="DiffSourceLine" background="#8a2c40"/>
+ <style name="DiffSourceChar" foreground="#2e2f30" background="#c34141"/>
+ <style name="DiffDestLine" background="#588a2c"/>
+ <style name="DiffDestChar" foreground="#2e2f30" background="#7cc33e"/>
+ <style name="LogChangeLine" foreground="#d65645"/>
+ <style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/>
+ <style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/>
+ <style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/>
+ <style name="ErrorContext" underlineColor="#d65645" underlineStyle="DotLine"/>
+ <style name="Declaration"/>
+</style-scheme>
diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme
index cfb41b608b..1a92bb54fb 100644
--- a/share/qtcreator/themes/dark.creatortheme
+++ b/share/qtcreator/themes/dark.creatortheme
@@ -12,13 +12,16 @@ selectedBackground=46ffffff
normalBackground=ff333333
alternateBackground=ff515151
error=ffff0000
+textColorLink=ff007af4
+textColorLinkVisited=ffa57aff
+backgroundColorDisabled=ff444444
[Colors]
BackgroundColorAlternate=alternateBackground
BackgroundColorDark=shadowBackground
BackgroundColorHover=hoverBackground
BackgroundColorNormal=normalBackground
-BackgroundColorDisabled=ff444444
+BackgroundColorDisabled=backgroundColorDisabled
BackgroundColorSelected=selectedBackground
BadgeLabelBackgroundColorChecked=normalBackground
BadgeLabelBackgroundColorUnchecked=selectedBackground
@@ -112,8 +115,8 @@ SplitterColor=ff313131
TextColorDisabled=textDisabled
TextColorError=ffff4040
TextColorHighlight=ffff0000
-TextColorLink=ff007af4
-TextColorLinkVisited=ffa57aff
+TextColorLink=textColorLink
+TextColorLinkVisited=textColorLinkVisited
TextColorNormal=text
TodoItemTextColor=ff000000
ToggleButtonBackgroundColor=shadowBackground
@@ -177,6 +180,26 @@ ProjectExplorer_TaskWarn_TextMarkColor=ffffff40
ClangCodeModel_Error_TextMarkColor=ffff882f
ClangCodeModel_Warning_TextMarkColor=ffceff40
+PaletteWindow=normalBackground
+PaletteWindowText=text
+PaletteBase=normalBackground
+PaletteAlternateBase=alternateBackground
+PaletteButton=shadowBackground
+PaletteBrightText=ffff0000
+PaletteText=text
+PaletteButtonText=text
+PaletteToolTipBase=selectedBackground
+PaletteHighlight=selectedBackground
+PaletteDark=shadowBackground
+PaletteHighlightedText=ffffffff
+PaletteToolTipText=text
+PaletteLink=textColorLink
+PaletteLinkVisited=textColorLinkVisited
+PaletteWindowDisabled=backgroundColorDisabled
+PaletteWindowTextDisabled=textDisabled
+PaletteBaseDisabled=backgroundColorDisabled
+PaletteTextDisabled=textDisabled
+
[Flags]
ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=true
@@ -184,6 +207,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=true
+DrawToolBarBorders=false
ApplyThemePaletteGlobally=true
FlatToolBars=true
FlatSideBarIcons=true
diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme
index ede12f035d..712a968555 100644
--- a/share/qtcreator/themes/default.creatortheme
+++ b/share/qtcreator/themes/default.creatortheme
@@ -178,6 +178,7 @@ DrawIndicatorBranch=false
DrawSearchResultWidgetFrame=true
DrawTargetSelectorBottom=true
DrawToolBarHighlights=true
+DrawToolBarBorders=false
ApplyThemePaletteGlobally=false
FlatToolBars=false
FlatSideBarIcons=false
diff --git a/share/qtcreator/themes/flat-dark.creatortheme b/share/qtcreator/themes/flat-dark.creatortheme
index 1e3e170b4c..bf2b98e834 100644
--- a/share/qtcreator/themes/flat-dark.creatortheme
+++ b/share/qtcreator/themes/flat-dark.creatortheme
@@ -1,7 +1,7 @@
[General]
ThemeName=Flat Dark
PreferredStyles=Fusion
-DefaultTextEditorColorScheme=inkpot.xml
+DefaultTextEditorColorScheme=creator-dark.xml
[Palette]
shadowBackground=ff404244
@@ -17,13 +17,16 @@ normalBackground=ff2E2F30
alternateBackground=ff353637
error=ffe41e25
splitter=ff06080A
+textColorLink=ff007af4
+textColorLinkVisited=ffa57aff
+backgroundColorDisabled=ff444444
[Colors]
BackgroundColorAlternate=alternateBackground
BackgroundColorDark=shadowBackground
BackgroundColorHover=hoverBackground
BackgroundColorNormal=normalBackground
-BackgroundColorDisabled=ff444444
+BackgroundColorDisabled=backgroundColorDisabled
BackgroundColorSelected=selectedBackground
BadgeLabelBackgroundColorChecked=ffe0e0e0
BadgeLabelBackgroundColorUnchecked=ff808080
@@ -117,8 +120,8 @@ SplitterColor=splitter
TextColorDisabled=textDisabled
TextColorError=ffff4040
TextColorHighlight=ffff0000
-TextColorLink=ff007af4
-TextColorLinkVisited=ffa57aff
+TextColorLink=textColorLink
+TextColorLinkVisited=textColorLinkVisited
TextColorNormal=text
TodoItemTextColor=text
ToggleButtonBackgroundColor=shadowBackground
@@ -182,6 +185,26 @@ ProjectExplorer_TaskWarn_TextMarkColor=ffffff40
ClangCodeModel_Error_TextMarkColor=ffff882f
ClangCodeModel_Warning_TextMarkColor=ffceff40
+PaletteWindow=normalBackground
+PaletteWindowText=text
+PaletteBase=normalBackground
+PaletteAlternateBase=alternateBackground
+PaletteButton=shadowBackground
+PaletteBrightText=ffff0000
+PaletteText=text
+PaletteButtonText=text
+PaletteToolTipBase=selectedBackground
+PaletteHighlight=selectedBackground
+PaletteDark=shadowBackground
+PaletteHighlightedText=ffffffff
+PaletteToolTipText=text
+PaletteLink=textColorLink
+PaletteLinkVisited=textColorLinkVisited
+PaletteWindowDisabled=backgroundColorDisabled
+PaletteWindowTextDisabled=textDisabled
+PaletteBaseDisabled=backgroundColorDisabled
+PaletteTextDisabled=textDisabled
+
[Flags]
ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=true
@@ -189,6 +212,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=false
+DrawToolBarBorders=false
ApplyThemePaletteGlobally=true
FlatToolBars=true
FlatSideBarIcons=true
diff --git a/share/qtcreator/themes/flat-light.creatortheme b/share/qtcreator/themes/flat-light.creatortheme
index 983f909bce..24e47e1999 100644
--- a/share/qtcreator/themes/flat-light.creatortheme
+++ b/share/qtcreator/themes/flat-light.creatortheme
@@ -14,7 +14,8 @@ hoverBackground=1a000000
selectedBackground=a8ffffff
normalBackground=ffffffff
alternateBackground=ff515151
-error=ffe41e25
+stop_error=ffec7373
+run_success=ff52c23b
splitter=ffbdbebf
[Colors]
@@ -61,14 +62,14 @@ IconsWarningColor=ffecbc1c
IconsWarningToolBarColor=ffecbc1c
IconsErrorColor=ffdf4f4f
IconsErrorToolBarColor=ffdf4f4f
-IconsRunColor=ff52c23b
-IconsRunToolBarColor=ff52c23b
-IconsStopColor=ffec7373
-IconsStopToolBarColor=ffec7373
+IconsRunColor=run_success
+IconsRunToolBarColor=run_success
+IconsStopColor=stop_error
+IconsStopToolBarColor=stop_error
IconsInterruptColor=ff587ff7
IconsInterruptToolBarColor=ff6a7bc3
IconsDebugColor=toolBarItem
-IconsNavigationArrowsColor=ffd5aa00
+IconsNavigationArrowsColor=ff3dabe6
IconsBuildHammerHandleColor=ffc26b14
IconsBuildHammerHeadColor=ff868687
IconsModeWelcomeActiveColor=ff5caa15
@@ -107,11 +108,11 @@ PanelsWidgetSeparatorLineColor=0
PanelTextColorDark=text
PanelTextColorMid=ff666666
PanelTextColorLight=fancyBarsNormalTextColor
-ProgressBarColorError=ffdb6f71
-ProgressBarColorFinished=dda4d576
-ProgressBarColorNormal=ff999999
+ProgressBarColorError=stop_error
+ProgressBarColorFinished=run_success
+ProgressBarColorNormal=ff888888
ProgressBarTitleColor=fancyBarsBoldTextColor
-ProgressBarBackgroundColor=a0606060
+ProgressBarBackgroundColor=28000000
SplitterColor=splitter
TextColorDisabled=textDisabled
TextColorError=ffff4040
@@ -188,6 +189,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=false
+DrawToolBarBorders=true
ApplyThemePaletteGlobally=false
FlatToolBars=true
FlatSideBarIcons=true
diff --git a/share/qtcreator/themes/flat.creatortheme b/share/qtcreator/themes/flat.creatortheme
index b9bf2c898a..84850bed9c 100644
--- a/share/qtcreator/themes/flat.creatortheme
+++ b/share/qtcreator/themes/flat.creatortheme
@@ -188,6 +188,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=false
+DrawToolBarBorders=false
ApplyThemePaletteGlobally=false
FlatToolBars=true
FlatSideBarIcons=true
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 425b015c8a..13c178ec1a 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -36,6 +36,7 @@
#include <QDebug>
#include <QDir>
+#include <QFontDatabase>
#include <QFileInfo>
#include <QLibraryInfo>
#include <QLoggingCategory>
@@ -295,6 +296,15 @@ static inline QSettings *userSettings()
static const char *SHARE_PATH =
Utils::HostOsInfo::isMacHost() ? "/../Resources" : "/../share/qtcreator";
+void loadFonts()
+{
+ const QDir dir(QCoreApplication::applicationDirPath() + QLatin1String(SHARE_PATH)
+ + QLatin1String("/fonts/"));
+
+ foreach (const QFileInfo &fileInfo, dir.entryInfoList(QStringList("*.ttf"), QDir::Files))
+ QFontDatabase::addApplicationFont(fileInfo.absoluteFilePath());
+}
+
int main(int argc, char **argv)
{
const char *highDpiEnvironmentVariable = setHighDpiEnvironmentVariable();
@@ -311,6 +321,8 @@ int main(int argc, char **argv)
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
+ loadFonts();
+
if (highDpiEnvironmentVariable)
qunsetenv(highDpiEnvironmentVariable);
diff --git a/src/libs/qmljs/parser/qmljslexer.cpp b/src/libs/qmljs/parser/qmljslexer.cpp
index 62e40d9493..8ab06dc7ec 100644
--- a/src/libs/qmljs/parser/qmljslexer.cpp
+++ b/src/libs/qmljs/parser/qmljslexer.cpp
@@ -581,7 +581,7 @@ again:
if (end - begin != chars.size() - 1) {
_errorCode = IllegalExponentIndicator;
- _errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number.");
return T_ERROR;
}
@@ -674,7 +674,7 @@ again:
if (qmlMode())
break;
_errorCode = IllegalCharacter;
- _errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal.");
return T_ERROR;
} else if (_char == QLatin1Char('\\')) {
break;
@@ -720,7 +720,7 @@ again:
u = decodeUnicodeEscapeCharacter(&ok);
if (! ok) {
_errorCode = IllegalUnicodeEscapeSequence;
- _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence.");
return T_ERROR;
}
} break;
@@ -731,7 +731,7 @@ again:
u = decodeHexEscapeCharacter(&ok);
if (!ok) {
_errorCode = IllegalHexadecimalEscapeSequence;
- _errorMessage = QCoreApplication::translate("QmlParser", "Illegal hexadecimal escape sequence");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Illegal hexadecimal escape sequence.");
return T_ERROR;
}
} break;
@@ -764,7 +764,7 @@ again:
case '8':
case '9':
_errorCode = IllegalEscapeSequence;
- _errorMessage = QCoreApplication::translate("QmlParser", "Octal escape sequences are not allowed");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Octal escape sequences are not allowed.");
return T_ERROR;
case '\r':
@@ -788,7 +788,7 @@ again:
}
_errorCode = UnclosedStringLiteral;
- _errorMessage = QCoreApplication::translate("QmlParser", "Unclosed string at end of line");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Unclosed string at end of line.");
return T_ERROR;
}
case '0':
@@ -812,7 +812,7 @@ again:
c = decodeUnicodeEscapeCharacter(&ok);
if (! ok) {
_errorCode = IllegalUnicodeEscapeSequence;
- _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence.");
return T_ERROR;
}
}
@@ -837,7 +837,7 @@ again:
c = decodeUnicodeEscapeCharacter(&ok);
if (! ok) {
_errorCode = IllegalUnicodeEscapeSequence;
- _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence.");
return T_ERROR;
}
if (isIdentifierPart(c))
@@ -900,7 +900,7 @@ int Lexer::scanNumber(QChar ch)
}
} else if (_char.isDigit() && !qmlMode()) {
_errorCode = IllegalCharacter;
- _errorMessage = QCoreApplication::translate("QmlParser", "Decimal numbers can't start with '0'");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Decimal numbers cannot start with \"0\".");
return T_ERROR;
}
@@ -921,7 +921,7 @@ int Lexer::scanNumber(QChar ch)
if (chars.size() < 3) {
_errorCode = IllegalHexNumber;
- _errorMessage = QCoreApplication::translate("QmlParser", "At least one hexadecimal digit is required after '0%1'").arg(ch);
+ _errorMessage = QCoreApplication::translate("QmlParser", "At least one hexadecimal digit is required after \"0%1\".").arg(ch);
return T_ERROR;
}
@@ -997,7 +997,7 @@ int Lexer::scanNumber(QChar ch)
if (end - begin != chars.size() - 1) {
_errorCode = IllegalExponentIndicator;
- _errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number.");
return T_ERROR;
}
@@ -1023,7 +1023,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (isIdentLetter(_char)) {
int flag = regExpFlagFromChar(_char);
if (flag == 0 || _patternFlags & flag) {
- _errorMessage = QCoreApplication::translate("QmlParser", "Invalid regular expression flag '%0'")
+ _errorMessage = QCoreApplication::translate("QmlParser", "Invalid regular expression flag \"%0\".")
.arg(QChar(_char));
return false;
}
@@ -1040,7 +1040,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
scanChar();
if (_codePtr > _endPtr || isLineTerminator()) {
- _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence.");
return false;
}
@@ -1062,7 +1062,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
scanChar();
if (_codePtr > _endPtr || isLineTerminator()) {
- _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence.");
return false;
}
@@ -1075,7 +1075,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
}
if (_char != QLatin1Char(']')) {
- _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression class");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression class.");
return false;
}
@@ -1085,7 +1085,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
default:
if (_codePtr > _endPtr || isLineTerminator()) {
- _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal");
+ _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal.");
return false;
} else {
_tokenText += _char;
@@ -1289,7 +1289,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
if (! (directiveName == QLatin1String("pragma") ||
directiveName == QLatin1String("import"))) {
- error->message = QCoreApplication::translate("QmlParser", "Syntax error");
+ error->message = QCoreApplication::translate("QmlParser", "Syntax error.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // not a valid directive name
@@ -1299,7 +1299,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
if (directiveName == QLatin1String("pragma")) {
// .pragma library
if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("library"))) {
- error->message = QCoreApplication::translate("QmlParser", "Syntax error");
+ error->message = QCoreApplication::translate("QmlParser", "Syntax error.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // expected `library
@@ -1323,7 +1323,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
pathOrUri = tokenText();
if (!pathOrUri.endsWith(QLatin1String("js"))) {
- error->message = QCoreApplication::translate("QmlParser","Imported file must be a script");
+ error->message = QCoreApplication::translate("QmlParser","Imported file must be a script.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1334,7 +1334,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
while (true) {
if (!isUriToken(_tokenKind)) {
- error->message = QCoreApplication::translate("QmlParser","Invalid module URI");
+ error->message = QCoreApplication::translate("QmlParser","Invalid module URI.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1344,7 +1344,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
lex();
if (tokenStartLine() != lineNumber) {
- error->message = QCoreApplication::translate("QmlParser","Invalid module URI");
+ error->message = QCoreApplication::translate("QmlParser","Invalid module URI.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1356,7 +1356,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
lex();
if (tokenStartLine() != lineNumber) {
- error->message = QCoreApplication::translate("QmlParser","Invalid module URI");
+ error->message = QCoreApplication::translate("QmlParser","Invalid module URI.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1364,7 +1364,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
}
if (_tokenKind != T_NUMERIC_LITERAL) {
- error->message = QCoreApplication::translate("QmlParser","Module import requires a version");
+ error->message = QCoreApplication::translate("QmlParser","Module import requires a version.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // expected the module version number
@@ -1378,9 +1378,9 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
//
if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as") && tokenStartLine() == lineNumber)) {
if (fileImport)
- error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier");
+ error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier.");
else
- error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier");
+ error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier.");
if (tokenStartLine() != lineNumber) {
error->loc.startLine = lineNumber;
error->loc.startColumn = column;
@@ -1393,9 +1393,9 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
if (lex() != T_IDENTIFIER || tokenStartLine() != lineNumber) {
if (fileImport)
- error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier");
+ error->message = QCoreApplication::translate("QmlParser", "File import requires a qualifier.");
else
- error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier");
+ error->message = QCoreApplication::translate("QmlParser", "Module import requires a qualifier.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // expected module name
@@ -1403,7 +1403,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
const QString module = tokenText();
if (!module.at(0).isUpper()) {
- error->message = QCoreApplication::translate("QmlParser","Invalid import qualifier");
+ error->message = QCoreApplication::translate("QmlParser","Invalid import qualifier.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false;
@@ -1416,7 +1416,7 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
}
if (tokenStartLine() != lineNumber) {
- error->message = QCoreApplication::translate("QmlParser", "Syntax error");
+ error->message = QCoreApplication::translate("QmlParser", "Syntax error.");
error->loc.startLine = tokenStartLine();
error->loc.startColumn = tokenStartColumn();
return false; // the directives cannot span over multiple lines
diff --git a/src/libs/qmljs/parser/qmljsparser.cpp b/src/libs/qmljs/parser/qmljsparser.cpp
index 4d92c51cd4..bddfe95d27 100644
--- a/src/libs/qmljs/parser/qmljsparser.cpp
+++ b/src/libs/qmljs/parser/qmljsparser.cpp
@@ -1799,7 +1799,7 @@ case 355: {
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = QCoreApplication::translate("QmlParser", "Missing `;'");
+ //const QString msg = QCoreApplication::translate("QmlParser", "Missing \";\".");
//diagnostic_messages.append(DiagnosticMessage(Severity::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -1829,9 +1829,9 @@ case 355: {
QString msg;
int token = token_buffer[0].token;
if (token < 0 || token >= TERMINAL_COUNT)
- msg = QCoreApplication::translate("QmlParser", "Syntax error");
+ msg = QCoreApplication::translate("QmlParser", "Syntax error.");
else
- msg = QCoreApplication::translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
+ msg = QCoreApplication::translate("QmlParser", "Unexpected token \"%1\".").arg(QLatin1String(spell[token]));
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -1859,7 +1859,7 @@ case 355: {
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = QCoreApplication::translate("QmlParser", "Expected token \"%1\".").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -1883,7 +1883,7 @@ case 355: {
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = QCoreApplication::translate("QmlParser", "Expected token \"%1\".").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -1896,7 +1896,7 @@ case 355: {
}
}
- const QString msg = QCoreApplication::translate("QmlParser", "Syntax error");
+ const QString msg = QCoreApplication::translate("QmlParser", "Syntax error.");
diagnostic_messages.append(DiagnosticMessage(Severity::Error, token_buffer[0].loc, msg));
}
diff --git a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp
index e03bf7d527..ff82a56cd5 100644
--- a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp
+++ b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp
@@ -817,16 +817,17 @@ FindExportedCppTypes::FindExportedCppTypes(const CPlusPlus::Snapshot &snapshot)
{
}
-void FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document)
+QStringList FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document)
{
m_contextProperties.clear();
m_exportedTypes.clear();
+ QStringList fileNames;
// this check only guards against some input errors, if document's source and AST has not
// been guarded properly the source and AST may still become empty/null while this function is running
if (document->utf8Source().isEmpty()
|| !document->translationUnit()->ast())
- return;
+ return fileNames;
FindExportsVisitor finder(document);
finder();
@@ -838,7 +839,7 @@ void FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document)
const QList<ContextProperty> contextPropertyDescriptions = finder.contextProperties();
const QList<ExportedQmlType> exports = finder.exportedTypes();
if (exports.isEmpty() && contextPropertyDescriptions.isEmpty())
- return;
+ return fileNames;
// context properties need lookup inside function scope, and thus require a full check
CPlusPlus::Document::Ptr localDoc = document;
@@ -863,14 +864,19 @@ void FindExportedCppTypes::operator()(const CPlusPlus::Document::Ptr &document)
// convert to list of FakeMetaObject::ConstPtr
m_exportedTypes.reserve(fakeMetaObjects.size() + extraFakeMetaObjects.size());
- foreach (const LanguageUtils::FakeMetaObject::Ptr &fmo, fakeMetaObjects) {
- fmo->updateFingerprint();
- m_exportedTypes += fmo;
+ fileNames.reserve(fakeMetaObjects.size());
+ for (auto it = fakeMetaObjects.constBegin(), end = fakeMetaObjects.constEnd(); it != end;
+ ++it) {
+ it.value()->updateFingerprint();
+ m_exportedTypes += it.value();
+ fileNames += QLatin1String(it.key()->fileName());
}
foreach (const LanguageUtils::FakeMetaObject::Ptr &fmo, extraFakeMetaObjects) {
fmo->updateFingerprint();
m_exportedTypes += fmo;
}
+
+ return fileNames;
}
QList<LanguageUtils::FakeMetaObject::ConstPtr> FindExportedCppTypes::exportedTypes() const
diff --git a/src/libs/qmljs/qmljsfindexportedcpptypes.h b/src/libs/qmljs/qmljsfindexportedcpptypes.h
index fbc9126880..f626130c74 100644
--- a/src/libs/qmljs/qmljsfindexportedcpptypes.h
+++ b/src/libs/qmljs/qmljsfindexportedcpptypes.h
@@ -41,7 +41,7 @@ public:
FindExportedCppTypes(const CPlusPlus::Snapshot &snapshot);
// document must have a valid source and ast for the duration of the call
- void operator()(const CPlusPlus::Document::Ptr &document);
+ QStringList operator()(const CPlusPlus::Document::Ptr &document);
QList<LanguageUtils::FakeMetaObject::ConstPtr> exportedTypes() const;
QHash<QString, QString> contextProperties() const;
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index f739668f9f..a919087fea 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -1259,6 +1259,37 @@ void ModelManagerInterface::asyncReset()
m_asyncResetTimer->start();
}
+bool rescanExports(const QString &fileName, FindExportedCppTypes &finder,
+ ModelManagerInterface::CppDataHash &newData)
+{
+ bool hasNewInfo = false;
+
+ QList<LanguageUtils::FakeMetaObject::ConstPtr> exported = finder.exportedTypes();
+ QHash<QString, QString> contextProperties = finder.contextProperties();
+ if (exported.isEmpty() && contextProperties.isEmpty()) {
+ hasNewInfo = hasNewInfo || newData.remove(fileName) > 0;
+ } else {
+ ModelManagerInterface::CppData &data = newData[fileName];
+ if (!hasNewInfo && (data.exportedTypes.size() != exported.size()
+ || data.contextProperties != contextProperties))
+ hasNewInfo = true;
+ if (!hasNewInfo) {
+ QHash<QString, QByteArray> newFingerprints;
+ foreach (LanguageUtils::FakeMetaObject::ConstPtr newType, exported)
+ newFingerprints[newType->className()]=newType->fingerprint();
+ foreach (LanguageUtils::FakeMetaObject::ConstPtr oldType, data.exportedTypes) {
+ if (newFingerprints.value(oldType->className()) != oldType->fingerprint()) {
+ hasNewInfo = true;
+ break;
+ }
+ }
+ }
+ data.exportedTypes = exported;
+ data.contextProperties = contextProperties;
+ }
+ return hasNewInfo;
+}
+
void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
ModelManagerInterface *qmlModelManager,
CPlusPlus::Snapshot snapshot,
@@ -1266,7 +1297,14 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
{
interface.setProgressRange(0, documents.size());
interface.setProgressValue(0);
- CppDataHash newData = qmlModelManager->cppData();
+
+ CppDataHash newData;
+ QHash<QString, QStringList> newDeclarations;
+ {
+ QMutexLocker locker(&qmlModelManager->m_cppDataMutex);
+ newData = qmlModelManager->m_cppDataHash;
+ newDeclarations = qmlModelManager->m_cppDeclarationFiles;
+ }
FindExportedCppTypes finder(snapshot);
@@ -1281,41 +1319,37 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
const bool scan = pair.second;
const QString fileName = doc->fileName();
if (!scan) {
- hasNewInfo = hasNewInfo || newData.remove(fileName) > 0;
+ hasNewInfo = newData.remove(fileName) > 0 || hasNewInfo;
+ foreach (const QString &file, newDeclarations[fileName]) {
+ finder(snapshot.document(file));
+ hasNewInfo = rescanExports(file, finder, newData) || hasNewInfo;
+ }
continue;
}
- finder(doc);
-
- QList<LanguageUtils::FakeMetaObject::ConstPtr> exported = finder.exportedTypes();
- QHash<QString, QString> contextProperties = finder.contextProperties();
- if (exported.isEmpty() && contextProperties.isEmpty()) {
- hasNewInfo = hasNewInfo || newData.remove(fileName) > 0;
- } else {
- CppData &data = newData[fileName];
- if (!hasNewInfo && (data.exportedTypes.size() != exported.size()
- || data.contextProperties != contextProperties))
- hasNewInfo = true;
- if (!hasNewInfo) {
- QHash<QString, QByteArray> newFingerprints;
- foreach (LanguageUtils::FakeMetaObject::ConstPtr newType, exported)
- newFingerprints[newType->className()]=newType->fingerprint();
- foreach (LanguageUtils::FakeMetaObject::ConstPtr oldType, data.exportedTypes) {
- if (newFingerprints.value(oldType->className()) != oldType->fingerprint()) {
- hasNewInfo = true;
- break;
- }
+ for (auto it = newDeclarations.begin(), end = newDeclarations.end(); it != end;) {
+ if (it->removeOne(fileName)) {
+ doc->releaseSourceAndAST();
+ if (it->isEmpty()) {
+ it = newDeclarations.erase(it);
+ continue;
}
}
- data.exportedTypes = exported;
- data.contextProperties = contextProperties;
+ ++it;
+ }
+
+ foreach (const QString &declarationFile, finder(doc)) {
+ newDeclarations[declarationFile].append(fileName);
+ doc->keepSourceAndAST(); // keep for later reparsing when dependent doc changes
}
+ hasNewInfo = rescanExports(doc->fileName(), finder, newData) || hasNewInfo;
doc->releaseSourceAndAST();
}
QMutexLocker locker(&qmlModelManager->m_cppDataMutex);
qmlModelManager->m_cppDataHash = newData;
+ qmlModelManager->m_cppDeclarationFiles = newDeclarations;
if (hasNewInfo)
// one could get away with re-linking the cpp types...
QMetaObject::invokeMethod(qmlModelManager, "asyncReset");
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h
index 568fb63593..3f640c6ca7 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.h
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h
@@ -275,6 +275,7 @@ private:
QrcCache m_qrcCache;
CppDataHash m_cppDataHash;
+ QHash<QString, QStringList> m_cppDeclarationFiles;
mutable QMutex m_cppDataMutex;
// project integration
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp
index 357bc2fea2..6e56ef9788 100644
--- a/src/libs/utils/buildablehelperlibrary.cpp
+++ b/src/libs/utils/buildablehelperlibrary.cpp
@@ -46,7 +46,7 @@ QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path)
SynchronousProcessResponse response = proc.runBlocking(path, QStringList(QLatin1String("-print-env")));
if (response.result != SynchronousProcessResponse::Finished)
return QString();
- const QString output = response.stdOut;
+ const QString output = response.stdOut();
int pos = output.indexOf(toolDir);
if (pos == -1)
return QString();
diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp
index 335142c0ef..59c7f97fd0 100644
--- a/src/libs/utils/shellcommand.cpp
+++ b/src/libs/utils/shellcommand.cpp
@@ -39,6 +39,7 @@
#include <QSharedPointer>
#include <QStringList>
#include <QTextCodec>
+#include <QThread>
#include <QVariant>
/*!
@@ -277,8 +278,8 @@ void ShellCommand::run(QFutureInterface<void> &future)
Utils::SynchronousProcessResponse resp
= runCommand(job.binary, job.arguments, job.timeoutS, job.workingDirectory,
job.exitCodeInterpreter);
- stdOut += resp.stdOut;
- stdErr += resp.stdErr;
+ stdOut += resp.stdOut();
+ stdErr += resp.stdErr();
d->m_lastExecExitCode = resp.exitCode;
d->m_lastExecSuccess = resp.result == Utils::SynchronousProcessResponse::Finished;
if (!d->m_lastExecSuccess)
@@ -326,59 +327,10 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName
if (!(d->m_flags & SuppressCommandLogging))
proxy->appendCommand(dir, binary, arguments);
- if (d->m_flags & FullySynchronously) {
- response = runSynchronous(binary, arguments, timeoutS, dir, interpreter);
- } else {
- Utils::SynchronousProcess process;
- process.setExitCodeInterpreter(interpreter);
- connect(this, &ShellCommand::terminate, &process, &Utils::SynchronousProcess::terminate);
- process.setWorkingDirectory(dir);
-
- process.setProcessEnvironment(processEnvironment());
- process.setTimeoutS(timeoutS);
- if (d->m_codec)
- process.setCodec(d->m_codec);
-
- process.setFlags(processFlags());
-
- // connect stderr to the output window if desired
- if (d->m_flags & MergeOutputChannels) {
- process.setProcessChannelMode(QProcess::MergedChannels);
- } else if (d->m_progressiveOutput
- || !(d->m_flags & SuppressStdErr)) {
- process.setStdErrBufferedSignalsEnabled(true);
- connect(&process, &Utils::SynchronousProcess::stdErrBuffered,
- this, [this, proxy](const QString &text)
- {
- if (!(d->m_flags & SuppressStdErr))
- proxy->appendError(text);
- if (d->m_progressiveOutput)
- emit stdErrText(text);
- });
- }
-
- // connect stdout to the output window if desired
- if (d->m_progressParser || d->m_progressiveOutput || (d->m_flags & ShowStdOut)) {
- process.setStdOutBufferedSignalsEnabled(true);
- connect(&process, &Utils::SynchronousProcess::stdOutBuffered,
- this, [this, proxy](const QString &text)
- {
- if (d->m_progressParser)
- d->m_progressParser->parseProgress(text);
- if (d->m_flags & ShowStdOut)
- proxy->append(text);
- if (d->m_progressiveOutput) {
- emit stdOutText(text);
- d->m_hadOutput = true;
- }
- });
- }
-
- process.setTimeOutMessageBoxEnabled(true);
-
- // Run!
- response = process.runBlocking(binary.toString(), arguments);
- }
+ if (d->m_flags & FullySynchronously || QThread::currentThread() == QCoreApplication::instance()->thread())
+ response = runFullySynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
+ else
+ response = runSynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
if (!d->m_aborted) {
// Success/Fail message in appropriate window?
@@ -393,104 +345,106 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName
return response;
}
-Utils::SynchronousProcessResponse ShellCommand::runSynchronous(const Utils::FileName &binary,
- const QStringList &arguments,
- int timeoutS,
- const QString &workingDirectory,
- const ExitCodeInterpreter &interpreter)
+Utils::SynchronousProcessResponse ShellCommand::runFullySynchronous(const Utils::FileName &binary,
+ const QStringList &arguments,
+ QSharedPointer<OutputProxy> proxy,
+ int timeoutS,
+ const QString &workingDirectory,
+ const ExitCodeInterpreter &interpreter)
{
- Utils::SynchronousProcessResponse response;
-
- QScopedPointer<OutputProxy> proxy(d->m_proxyFactory());
-
// Set up process
- QSharedPointer<QProcess> process = Utils::SynchronousProcess::createProcess(processFlags());
- if (!d->m_defaultWorkingDirectory.isEmpty())
- process->setWorkingDirectory(workDirectory(workingDirectory));
- process->setProcessEnvironment(processEnvironment());
+ Utils::SynchronousProcess process;
+ process.setFlags(processFlags());
+ const QString dir = workDirectory(workingDirectory);
+ if (!dir.isEmpty())
+ process.setWorkingDirectory(dir);
+ process.setProcessEnvironment(processEnvironment());
if (d->m_flags & MergeOutputChannels)
- process->setProcessChannelMode(QProcess::MergedChannels);
-
- // Start
- process->start(binary.toString(), arguments, QIODevice::ReadOnly);
- process->closeWriteChannel();
- if (!process->waitForStarted()) {
- response.result = Utils::SynchronousProcessResponse::StartFailed;
- return response;
- }
+ process.setProcessChannelMode(QProcess::MergedChannels);
+ if (d->m_codec)
+ process.setCodec(d->m_codec);
+ process.setTimeoutS(timeoutS);
+ process.setExitCodeInterpreter(interpreter);
- // process output
- QByteArray stdOut;
- QByteArray stdErr;
- const bool timedOut =
- !Utils::SynchronousProcess::readDataFromProcess(*process.data(), timeoutS,
- &stdOut, &stdErr, true);
+ SynchronousProcessResponse resp = process.runBlocking(binary.toString(), arguments);
if (!d->m_aborted) {
- if (!stdErr.isEmpty()) {
- response.stdErr = Utils::SynchronousProcess::normalizeNewlines(
- d->m_codec ? d->m_codec->toUnicode(stdErr) : QString::fromLocal8Bit(stdErr));
- if (!(d->m_flags & SuppressStdErr))
- proxy->append(response.stdErr);
- }
-
- if (!stdOut.isEmpty()) {
- response.stdOut = Utils::SynchronousProcess::normalizeNewlines(
- d->m_codec ? d->m_codec->toUnicode(stdOut) : QString::fromLocal8Bit(stdOut));
- if (d->m_flags & ShowStdOut) {
- if (d->m_flags & SilentOutput)
- proxy->appendSilently(response.stdOut);
- else
- proxy->append(response.stdOut);
- }
+ const QString stdErr = resp.stdErr();
+ if (!stdErr.isEmpty() && !(d->m_flags & SuppressStdErr))
+ proxy->append(stdErr);
+
+ const QString stdOut = resp.stdOut();
+ if (!stdOut.isEmpty() && d->m_flags & ShowStdOut) {
+ if (d->m_flags & SilentOutput)
+ proxy->appendSilently(stdOut);
+ else
+ proxy->append(stdOut);
}
}
- // Result
- if (timedOut)
- response.result = Utils::SynchronousProcessResponse::Hang;
- else if (process->exitStatus() != QProcess::NormalExit)
- response.result = Utils::SynchronousProcessResponse::TerminatedAbnormally;
- else
- response.result = interpreter(process->exitCode());
- return response;
+ return resp;
}
-bool ShellCommand::runFullySynchronous(const Utils::FileName &binary, const QStringList &arguments,
- int timeoutS, QByteArray *outputData, QByteArray *errorData,
- const QString &workingDirectory)
+SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary,
+ const QStringList &arguments,
+ QSharedPointer<OutputProxy> proxy,
+ int timeoutS,
+ const QString &workingDirectory,
+ const ExitCodeInterpreter &interpreter)
{
- QTC_ASSERT(!binary.isEmpty(), return false);
-
- QScopedPointer<OutputProxy> proxy(d->m_proxyFactory());
+ Utils::SynchronousProcess process;
+ process.setExitCodeInterpreter(interpreter);
+ connect(this, &ShellCommand::terminate, &process, &Utils::SynchronousProcess::terminate);
+ process.setProcessEnvironment(processEnvironment());
+ process.setTimeoutS(timeoutS);
+ if (d->m_codec)
+ process.setCodec(d->m_codec);
+ process.setFlags(processFlags());
const QString dir = workDirectory(workingDirectory);
-
- if (!(d->m_flags & SuppressCommandLogging))
- proxy->appendCommand(dir, binary, arguments);
-
- QProcess process;
- process.setWorkingDirectory(dir);
- process.setProcessEnvironment(d->m_environment);
-
- process.start(binary.toString(), arguments);
- process.closeWriteChannel();
- if (!process.waitForStarted()) {
- if (errorData) {
- const QString msg = QString::fromLatin1("Unable to execute \"%1\": %2:")
- .arg(binary.toUserOutput(), process.errorString());
- *errorData = msg.toLocal8Bit();
- }
- return false;
+ if (!dir.isEmpty())
+ process.setWorkingDirectory(dir);
+ process.setProcessEnvironment(processEnvironment());
+ // connect stderr to the output window if desired
+ if (d->m_flags & MergeOutputChannels) {
+ process.setProcessChannelMode(QProcess::MergedChannels);
+ } else if (d->m_progressiveOutput
+ || !(d->m_flags & SuppressStdErr)) {
+ process.setStdErrBufferedSignalsEnabled(true);
+ connect(&process, &Utils::SynchronousProcess::stdErrBuffered,
+ this, [this, proxy](const QString &text)
+ {
+ if (!(d->m_flags & SuppressStdErr))
+ proxy->appendError(text);
+ if (d->m_progressiveOutput)
+ emit stdErrText(text);
+ });
}
- if (!Utils::SynchronousProcess::readDataFromProcess(process, timeoutS, outputData, errorData, true)) {
- if (errorData)
- errorData->append(tr("Error: Executable timed out after %1 s.").arg(timeoutS).toLocal8Bit());
- Utils::SynchronousProcess::stopProcess(process);
- return false;
+ // connect stdout to the output window if desired
+ if (d->m_progressParser || d->m_progressiveOutput || (d->m_flags & ShowStdOut)) {
+ process.setStdOutBufferedSignalsEnabled(true);
+ connect(&process, &Utils::SynchronousProcess::stdOutBuffered,
+ this, [this, proxy](const QString &text)
+ {
+ if (d->m_progressParser)
+ d->m_progressParser->parseProgress(text);
+ if (d->m_flags & ShowStdOut)
+ proxy->append(text);
+ if (d->m_progressiveOutput) {
+ emit stdOutText(text);
+ d->m_hadOutput = true;
+ }
+ });
}
- return process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0;
+ process.setTimeOutMessageBoxEnabled(true);
+
+ if (d->m_codec)
+ process.setCodec(d->m_codec);
+ process.setTimeoutS(timeoutS);
+ process.setExitCodeInterpreter(interpreter);
+
+ return process.run(binary.toString(), arguments);
}
const QVariant &ShellCommand::cookie() const
diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h
index 62949b8c63..ce5957c40a 100644
--- a/src/libs/utils/shellcommand.h
+++ b/src/libs/utils/shellcommand.h
@@ -115,7 +115,7 @@ public:
const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
void addJob(const FileName &binary, const QStringList &arguments, int timeoutS,
const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
- void execute();
+ void execute(); // Execute tasks asynchronously!
void abort();
bool lastExecutionSuccess() const;
int lastExecutionExitCode() const;
@@ -140,16 +140,14 @@ public:
void setOutputProxyFactory(const std::function<OutputProxy *()> &factory);
+ // This is called once per job in a thread.
+ // When called from the UI thread it will execute fully synchronously, so no signals will
+ // be triggered!
virtual SynchronousProcessResponse runCommand(const FileName &binary, const QStringList &arguments,
int timeoutS,
const QString &workingDirectory = QString(),
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
- // Make sure to not pass through the event loop at all:
- virtual bool runFullySynchronous(const FileName &binary, const QStringList &arguments,
- int timeoutS, QByteArray *outputData, QByteArray *errorData,
- const QString &workingDirectory = QString());
-public slots:
void cancel();
signals:
@@ -167,7 +165,15 @@ protected:
private:
void run(QFutureInterface<void> &future);
+
+ // Run without a event loop in fully blocking mode. No signals will be delivered.
+ SynchronousProcessResponse runFullySynchronous(const FileName &binary, const QStringList &arguments,
+ QSharedPointer<OutputProxy> proxy,
+ int timeoutS, const QString &workingDirectory,
+ const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
+ // Run with an event loop. Signals will be delivered.
SynchronousProcessResponse runSynchronous(const FileName &binary, const QStringList &arguments,
+ QSharedPointer<OutputProxy> proxy,
int timeoutS, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp
index 8991fd2da7..1dfe1d89dd 100644
--- a/src/libs/utils/stylehelper.cpp
+++ b/src/libs/utils/stylehelper.cpp
@@ -93,10 +93,9 @@ QColor StyleHelper::notTooBrightHighlightColor()
QPalette StyleHelper::sidebarFontPalette(const QPalette &original)
{
QPalette palette = original;
- palette.setColor(QPalette::Active, QPalette::Text, panelTextColor());
- palette.setColor(QPalette::Active, QPalette::WindowText, panelTextColor());
- palette.setColor(QPalette::Inactive, QPalette::Text, panelTextColor().darker());
- palette.setColor(QPalette::Inactive, QPalette::WindowText, panelTextColor().darker());
+ const QColor textColor = creatorTheme()->color(Theme::ProgressBarTitleColor);
+ palette.setColor(QPalette::WindowText, textColor);
+ palette.setColor(QPalette::Text, textColor);
return palette;
}
@@ -153,6 +152,14 @@ QColor StyleHelper::borderColor(bool lightColored)
return result;
}
+QColor StyleHelper::toolBarBorderColor()
+{
+ const QColor base = baseColor();
+ return QColor::fromHsv(base.hue(),
+ base.saturation() ,
+ clamp(base.value() * 0.80f));
+}
+
// We try to ensure that the actual color used are within
// reasonalbe bounds while generating the actual baseColor
// from the users request.
diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h
index 9a95be8ae8..6c9a1c5f5d 100644
--- a/src/libs/utils/stylehelper.h
+++ b/src/libs/utils/stylehelper.h
@@ -59,6 +59,7 @@ public:
static QColor highlightColor(bool lightColored = false);
static QColor shadowColor(bool lightColored = false);
static QColor borderColor(bool lightColored = false);
+ static QColor toolBarBorderColor();
static QColor buttonTextColor() { return QColor(0x4c4c4c); }
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50);
static QColor alphaBlendedColors(const QColor &colorA, const QColor &colorB);
diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp
index 9f6210869d..7852cc88da 100644
--- a/src/libs/utils/synchronousprocess.cpp
+++ b/src/libs/utils/synchronousprocess.cpp
@@ -37,6 +37,7 @@
#include <QApplication>
#include <limits.h>
+#include <memory>
#ifdef Q_OS_UNIX
# include <unistd.h>
@@ -105,18 +106,12 @@ void TerminalControllingProcess::setupChildProcess()
}
// ----------- SynchronousProcessResponse
-SynchronousProcessResponse::SynchronousProcessResponse() :
- result(StartFailed),
- exitCode(-1)
-{
-}
-
void SynchronousProcessResponse::clear()
{
result = StartFailed;
exitCode = -1;
- stdOut.clear();
- stdErr.clear();
+ rawStdOut.clear();
+ rawStdErr.clear();
}
QString SynchronousProcessResponse::exitMessage(const QString &binary, int timeoutS) const
@@ -137,22 +132,48 @@ QString SynchronousProcessResponse::exitMessage(const QString &binary, int timeo
return QString();
}
+QByteArray SynchronousProcessResponse::allRawOutput() const
+{
+ if (!rawStdOut.isEmpty() && !rawStdErr.isEmpty()) {
+ QByteArray result = rawStdOut;
+ if (!result.endsWith('\n'))
+ result += '\n';
+ result += rawStdErr;
+ return result;
+ }
+ return !rawStdOut.isEmpty() ? rawStdOut : rawStdErr;
+}
+
QString SynchronousProcessResponse::allOutput() const
{
- if (!stdOut.isEmpty() && !stdErr.isEmpty()) {
- if (stdOut.endsWith(QLatin1Char('\n')))
- return stdOut + stdErr;
- else
- return stdOut + QLatin1Char('\n') + stdErr;
+ const QString out = stdOut();
+ const QString err = stdErr();
+
+ if (!out.isEmpty() && !err.isEmpty()) {
+ QString result = out;
+ if (!result.endsWith('\n'))
+ result += '\n';
+ result += err;
+ return result;
}
- return !stdOut.isEmpty() ? stdOut : stdErr;
+ return !out.isEmpty() ? out : err;
+}
+
+QString SynchronousProcessResponse::stdOut() const
+{
+ return SynchronousProcess::normalizeNewlines(codec->toUnicode(rawStdOut));
+}
+
+QString SynchronousProcessResponse::stdErr() const
+{
+ return SynchronousProcess::normalizeNewlines(codec->toUnicode(rawStdErr));
}
QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug str, const SynchronousProcessResponse& r)
{
QDebug nsp = str.nospace();
nsp << "SynchronousProcessResponse: result=" << r.result << " ex=" << r.exitCode << '\n'
- << r.stdOut.size() << " bytes stdout, stderr=" << r.stdErr << '\n';
+ << r.rawStdOut.size() << " bytes stdout, stderr=" << r.rawStdErr << '\n';
return str;
}
@@ -169,52 +190,62 @@ class ChannelBuffer : public QObject
public:
void clearForRun();
+
QString linesRead();
- void append(const QString &text, bool emitSignals);
+ void append(const QByteArray &text, bool emitSignals);
- QString data;
- int bufferPos = 0;
- bool firstData = true;
+ QByteArray rawData;
+ QString incompleteLineBuffer; // lines not yet signaled
+ QTextCodec *codec = nullptr; // Not owner
+ std::unique_ptr<QTextCodec::ConverterState> codecState;
+ int rawDataPos = 0;
bool bufferedSignalsEnabled = false;
bool firstBuffer = true;
signals:
- void output(const QString &text, bool firstTime);
void outputBuffered(const QString &text, bool firstTime);
};
void ChannelBuffer::clearForRun()
{
- firstData = true;
firstBuffer = true;
- bufferPos = 0;
+ rawDataPos = 0;
+ rawData.clear();
+ codecState.reset(new QTextCodec::ConverterState);
+ incompleteLineBuffer.clear();
}
/* Check for complete lines read from the device and return them, moving the
* buffer position. */
QString ChannelBuffer::linesRead()
{
- // Any new lines?
- const int lastLineIndex = qMax(data.lastIndexOf(QLatin1Char('\n')),
- data.lastIndexOf(QLatin1Char('\r')));
- if (lastLineIndex == -1 || lastLineIndex <= bufferPos)
+ // Convert and append the new input to the buffer of incomplete lines
+ const char *start = rawData.constData() + rawDataPos;
+ const int len = rawData.size() - rawDataPos;
+ incompleteLineBuffer.append(codec->toUnicode(start, len, codecState.get()));
+ rawDataPos = rawData.size();
+
+ // Any completed lines in the incompleteLineBuffer?
+ const int lastLineIndex = qMax(incompleteLineBuffer.lastIndexOf('\n'),
+ incompleteLineBuffer.lastIndexOf('\r'));
+ if (lastLineIndex == -1)
return QString();
- const int nextBufferPos = lastLineIndex + 1;
- const QString lines = data.mid(bufferPos, nextBufferPos - bufferPos);
- bufferPos = nextBufferPos;
+
+ // Get completed lines and remove them from the incompleteLinesBuffer:
+ const QString lines = SynchronousProcess::normalizeNewlines(incompleteLineBuffer.left(lastLineIndex + 1));
+ incompleteLineBuffer = incompleteLineBuffer.mid(lastLineIndex + 1);
+
return lines;
}
-void ChannelBuffer::append(const QString &text, bool emitSignals)
+void ChannelBuffer::append(const QByteArray &text, bool emitSignals)
{
if (text.isEmpty())
return;
- data += text;
+ rawData += text;
if (!emitSignals)
return;
- // Emit binary signals
- emit output(text, firstData);
- firstData = false;
+
// Buffered. Emit complete lines?
if (bufferedSignalsEnabled) {
const QString lines = linesRead();
@@ -226,13 +257,11 @@ void ChannelBuffer::append(const QString &text, bool emitSignals)
}
// ----------- SynchronousProcessPrivate
-struct SynchronousProcessPrivate {
- SynchronousProcessPrivate();
+class SynchronousProcessPrivate {
+public:
void clearForRun();
- QTextCodec *m_codec;
- QTextCodec::ConverterState m_stdOutState;
- QTextCodec::ConverterState m_stdErrState;
+ QTextCodec *m_codec = QTextCodec::codecForLocale();
TerminalControllingProcess m_process;
QTimer m_timer;
QEventLoop m_eventLoop;
@@ -249,17 +278,15 @@ struct SynchronousProcessPrivate {
bool m_waitingForUser = false;
};
-SynchronousProcessPrivate::SynchronousProcessPrivate() :
- m_codec(QTextCodec::codecForLocale())
-{
-}
-
void SynchronousProcessPrivate::clearForRun()
{
m_hangTimerCount = 0;
m_stdOut.clearForRun();
+ m_stdOut.codec = m_codec;
m_stdErr.clearForRun();
+ m_stdErr.codec = m_codec;
m_result.clear();
+ m_result.codec = m_codec;
m_startFailure = false;
m_binary.clear();
}
@@ -276,12 +303,16 @@ SynchronousProcess::SynchronousProcess() :
connect(&d->m_process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
this, &SynchronousProcess::error);
connect(&d->m_process, &QProcess::readyReadStandardOutput,
- this, &SynchronousProcess::stdOutReady);
+ this, [this]() {
+ d->m_hangTimerCount = 0;
+ processStdOut(true);
+ });
connect(&d->m_process, &QProcess::readyReadStandardError,
- this, &SynchronousProcess::stdErrReady);
- connect(&d->m_stdOut, &ChannelBuffer::output, this, &SynchronousProcess::stdOut);
+ this, [this]() {
+ d->m_hangTimerCount = 0;
+ processStdErr(true);
+ });
connect(&d->m_stdOut, &ChannelBuffer::outputBuffered, this, &SynchronousProcess::stdOutBuffered);
- connect(&d->m_stdErr, &ChannelBuffer::output, this, &SynchronousProcess::stdErr);
connect(&d->m_stdErr, &ChannelBuffer::outputBuffered, this, &SynchronousProcess::stdErrBuffered);
}
@@ -436,8 +467,8 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary,
processStdErr(false);
}
- d->m_result.stdOut = d->m_stdOut.data;
- d->m_result.stdErr = d->m_stdErr.data;
+ d->m_result.rawStdOut = d->m_stdOut.rawData;
+ d->m_result.rawStdErr = d->m_stdErr.rawData;
d->m_timer.stop();
if (isGuiThread())
@@ -485,8 +516,8 @@ SynchronousProcessResponse SynchronousProcess::runBlocking(const QString &binary
processStdOut(false);
processStdErr(false);
- d->m_result.stdOut = d->m_stdOut.data;
- d->m_result.stdErr = d->m_stdErr.data;
+ d->m_result.rawStdOut = d->m_stdOut.rawData;
+ d->m_result.rawStdErr = d->m_stdErr.rawData;
return d->m_result;
}
@@ -569,42 +600,16 @@ void SynchronousProcess::error(QProcess::ProcessError e)
d->m_eventLoop.quit();
}
-void SynchronousProcess::stdOutReady()
-{
- d->m_hangTimerCount = 0;
- processStdOut(true);
-}
-
-void SynchronousProcess::stdErrReady()
-{
- d->m_hangTimerCount = 0;
- processStdErr(true);
-}
-
-QString SynchronousProcess::convertOutput(const QByteArray &ba,
- QTextCodec::ConverterState *state) const
-{
- return normalizeNewlines(d->m_codec->toUnicode(ba, ba.size(), state));
-}
-
void SynchronousProcess::processStdOut(bool emitSignals)
{
// Handle binary data
- const QString stdOutput = convertOutput(d->m_process.readAllStandardOutput(),
- &d->m_stdOutState);
- if (debug > 1)
- qDebug() << Q_FUNC_INFO << emitSignals << stdOutput;
- d->m_stdOut.append(stdOutput, emitSignals);
+ d->m_stdOut.append(d->m_process.readAllStandardOutput(), emitSignals);
}
void SynchronousProcess::processStdErr(bool emitSignals)
{
// Handle binary data
- const QString stdError = convertOutput(d->m_process.readAllStandardError(),
- &d->m_stdErrState);
- if (debug > 1)
- qDebug() << Q_FUNC_INFO << emitSignals << stdError;
- d->m_stdErr.append(stdError, emitSignals);
+ d->m_stdErr.append(d->m_process.readAllStandardError(), emitSignals);
}
QSharedPointer<QProcess> SynchronousProcess::createProcess(unsigned flags)
diff --git a/src/libs/utils/synchronousprocess.h b/src/libs/utils/synchronousprocess.h
index 5c4f8bc760..aa03561615 100644
--- a/src/libs/utils/synchronousprocess.h
+++ b/src/libs/utils/synchronousprocess.h
@@ -37,11 +37,12 @@ QT_FORWARD_DECLARE_CLASS(QDebug)
namespace Utils {
-struct SynchronousProcessPrivate;
+class SynchronousProcessPrivate;
/* Result of SynchronousProcess execution */
-struct QTCREATOR_UTILS_EXPORT SynchronousProcessResponse
+class QTCREATOR_UTILS_EXPORT SynchronousProcessResponse
{
+public:
enum Result {
// Finished with return code 0
Finished,
@@ -54,17 +55,23 @@ struct QTCREATOR_UTILS_EXPORT SynchronousProcessResponse
// Hang, no output after time out
Hang };
- SynchronousProcessResponse();
void clear();
// Helper to format an exit message.
QString exitMessage(const QString &binary, int timeoutS) const;
+
+ QByteArray allRawOutput() const;
QString allOutput() const;
- Result result;
- int exitCode;
- QString stdOut;
- QString stdErr;
+ QString stdOut() const;
+ QString stdErr() const;
+
+ Result result = StartFailed;
+ int exitCode = -1;
+
+ QByteArray rawStdOut;
+ QByteArray rawStdErr;
+ QTextCodec *codec = QTextCodec::codecForLocale();
};
QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug str, const SynchronousProcessResponse &);
@@ -132,7 +139,7 @@ public:
// occurs on stderr/stdout as opposed to waitForFinished()). Returns false if a timeout
// occurs. Checking of the process' exit state/code still has to be done.
static bool readDataFromProcess(QProcess &p, int timeoutS,
- QByteArray *stdOut = 0, QByteArray *stdErr = 0,
+ QByteArray *rawStdOut = 0, QByteArray *rawStdErr = 0,
bool timeOutMessageBox = false);
// Stop a process by first calling terminate() (allowing for signal handling) and
// then kill().
@@ -146,11 +153,8 @@ public:
static QString normalizeNewlines(const QString &text);
signals:
- void stdOut(const QString &text, bool firstTime);
- void stdErr(const QString &text, bool firstTime);
-
- void stdOutBuffered(const QString &data, bool firstTime);
- void stdErrBuffered(const QString &data, bool firstTime);
+ void stdOutBuffered(const QString &lines, bool firstTime);
+ void stdErrBuffered(const QString &lines, bool firstTime);
public slots:
bool terminate();
@@ -159,11 +163,8 @@ private:
void slotTimeout();
void finished(int exitCode, QProcess::ExitStatus e);
void error(QProcess::ProcessError);
- void stdOutReady();
- void stdErrReady();
void processStdOut(bool emitSignals);
void processStdErr(bool emitSignals);
- QString convertOutput(const QByteArray &, QTextCodec::ConverterState *state) const;
SynchronousProcessPrivate *d;
};
diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp
index 7195cab29d..90037dee7c 100644
--- a/src/libs/utils/theme/theme.cpp
+++ b/src/libs/utils/theme/theme.cpp
@@ -192,8 +192,9 @@ void Theme::readSettings(QSettings &settings)
for (int i = 0, total = e.keyCount(); i < total; ++i) {
const QString key = QLatin1String(e.key(i));
if (!settings.contains(key)) {
- qWarning("Theme \"%s\" misses color setting for key \"%s\".",
- qPrintable(d->fileName), qPrintable(key));
+ if (i < PaletteWindow || i > PaletteShadowDisabled)
+ qWarning("Theme \"%s\" misses color setting for key \"%s\".",
+ qPrintable(d->fileName), qPrintable(key));
continue;
}
d->colors[i] = readNamedColor(settings.value(key).toString());
@@ -253,27 +254,64 @@ QPalette Theme::palette() const
if (!flag(DerivePaletteFromTheme))
return pal;
- // FIXME: introduce some more color roles for this
+ const static struct {
+ Color themeColor;
+ QPalette::ColorRole paletteColorRole;
+ QPalette::ColorGroup paletteColorGroup;
+ bool setColorRoleAsBrush;
+ } mapping[] = {
+ { PaletteWindow, QPalette::Window, QPalette::All, false},
+ { PaletteWindowDisabled, QPalette::Window, QPalette::Disabled, false},
+ { PaletteWindowText, QPalette::WindowText, QPalette::All, true},
+ { PaletteWindowTextDisabled, QPalette::WindowText, QPalette::Disabled, true},
+ { PaletteBase, QPalette::Base, QPalette::All, false},
+ { PaletteBaseDisabled, QPalette::Base, QPalette::Disabled, false},
+ { PaletteAlternateBase, QPalette::AlternateBase, QPalette::All, false},
+ { PaletteAlternateBaseDisabled, QPalette::AlternateBase, QPalette::Disabled, false},
+ { PaletteToolTipBase, QPalette::ToolTipBase, QPalette::All, true},
+ { PaletteToolTipBaseDisabled, QPalette::ToolTipBase, QPalette::Disabled, true},
+ { PaletteToolTipText, QPalette::ToolTipText, QPalette::All, false},
+ { PaletteToolTipTextDisabled, QPalette::ToolTipText, QPalette::Disabled, false},
+ { PaletteText, QPalette::Text, QPalette::All, true},
+ { PaletteTextDisabled, QPalette::Text, QPalette::Disabled, true},
+ { PaletteButton, QPalette::Button, QPalette::All, false},
+ { PaletteButtonDisabled, QPalette::Button, QPalette::Disabled, false},
+ { PaletteButtonText, QPalette::ButtonText, QPalette::All, true},
+ { PaletteButtonTextDisabled, QPalette::ButtonText, QPalette::Disabled, true},
+ { PaletteBrightText, QPalette::BrightText, QPalette::All, false},
+ { PaletteBrightTextDisabled, QPalette::BrightText, QPalette::Disabled, false},
+ { PaletteHighlight, QPalette::Highlight, QPalette::All, true},
+ { PaletteHighlightDisabled, QPalette::Highlight, QPalette::Disabled, true},
+ { PaletteHighlightedText, QPalette::HighlightedText, QPalette::All, true},
+ { PaletteHighlightedTextDisabled, QPalette::HighlightedText, QPalette::Disabled, true},
+ { PaletteLink, QPalette::Link, QPalette::All, false},
+ { PaletteLinkDisabled, QPalette::Link, QPalette::Disabled, false},
+ { PaletteLinkVisited, QPalette::LinkVisited, QPalette::All, false},
+ { PaletteLinkVisitedDisabled, QPalette::LinkVisited, QPalette::Disabled, false},
+ { PaletteLight, QPalette::Light, QPalette::All, false},
+ { PaletteLightDisabled, QPalette::Light, QPalette::Disabled, false},
+ { PaletteMidlight, QPalette::Midlight, QPalette::All, false},
+ { PaletteMidlightDisabled, QPalette::Midlight, QPalette::Disabled, false},
+ { PaletteDark, QPalette::Dark, QPalette::All, false},
+ { PaletteDarkDisabled, QPalette::Dark, QPalette::Disabled, false},
+ { PaletteMid, QPalette::Mid, QPalette::All, false},
+ { PaletteMidDisabled, QPalette::Mid, QPalette::Disabled, false},
+ { PaletteShadow, QPalette::Shadow, QPalette::All, false},
+ { PaletteShadowDisabled, QPalette::Shadow, QPalette::Disabled, false}
+ };
+
+ for (auto entry: mapping) {
+ const QColor themeColor = color(entry.themeColor);
+ // Use original color if color is not defined in theme.
+ if (themeColor.isValid()) {
+ if (entry.setColorRoleAsBrush)
+ // TODO: Find out why sometimes setBrush is used
+ pal.setBrush(entry.paletteColorGroup, entry.paletteColorRole, themeColor);
+ else
+ pal.setColor(entry.paletteColorGroup, entry.paletteColorRole, themeColor);
+ }
+ }
- pal.setColor(QPalette::Window, color(Theme::BackgroundColorNormal));
- pal.setBrush(QPalette::WindowText, color(Theme::TextColorNormal));
- pal.setColor(QPalette::Base, color(Theme::BackgroundColorNormal));
- pal.setColor(QPalette::AlternateBase, color(Theme::BackgroundColorAlternate));
- pal.setColor(QPalette::Button, color(Theme::BackgroundColorDark));
- pal.setColor(QPalette::BrightText, Qt::red);
- pal.setBrush(QPalette::Text, color(Theme::TextColorNormal));
- pal.setBrush(QPalette::ButtonText, color(Theme::TextColorNormal));
- pal.setBrush(QPalette::ToolTipBase, color(Theme::BackgroundColorSelected));
- pal.setColor(QPalette::Highlight, color(Theme::BackgroundColorSelected));
- pal.setColor(QPalette::Dark, color(Theme::BackgroundColorDark));
- pal.setColor(QPalette::HighlightedText, Qt::white);
- pal.setColor(QPalette::ToolTipText, color(Theme::TextColorNormal));
- pal.setColor(QPalette::Link, color(Theme::TextColorLink));
- pal.setColor(QPalette::LinkVisited, color(Theme::TextColorLinkVisited));
- pal.setColor(QPalette::Disabled, QPalette::Window, color(Theme::BackgroundColorDisabled));
- pal.setBrush(QPalette::Disabled, QPalette::WindowText, color(Theme::TextColorDisabled));
- pal.setColor(QPalette::Disabled, QPalette::Base, color(Theme::BackgroundColorDisabled));
- pal.setBrush(QPalette::Disabled, QPalette::Text, color(Theme::TextColorDisabled));
return pal;
}
diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h
index e4a5362048..9358f11d28 100644
--- a/src/libs/utils/theme/theme.h
+++ b/src/libs/utils/theme/theme.h
@@ -125,6 +125,52 @@ public:
TreeViewArrowColorNormal,
TreeViewArrowColorSelected,
+ /* Palette for QPalette */
+
+ PaletteWindow,
+ PaletteWindowText,
+ PaletteBase,
+ PaletteAlternateBase,
+ PaletteToolTipBase,
+ PaletteToolTipText,
+ PaletteText,
+ PaletteButton,
+ PaletteButtonText,
+ PaletteBrightText,
+ PaletteHighlight,
+ PaletteHighlightedText,
+ PaletteLink,
+ PaletteLinkVisited,
+
+ PaletteLight,
+ PaletteMidlight,
+ PaletteDark,
+ PaletteMid,
+ PaletteShadow,
+
+ PaletteWindowDisabled,
+ PaletteBackgroundDisabled,
+ PaletteWindowTextDisabled,
+ PaletteForegroundDisabled,
+ PaletteBaseDisabled,
+ PaletteAlternateBaseDisabled,
+ PaletteToolTipBaseDisabled,
+ PaletteToolTipTextDisabled,
+ PaletteTextDisabled,
+ PaletteButtonDisabled,
+ PaletteButtonTextDisabled,
+ PaletteBrightTextDisabled,
+ PaletteHighlightDisabled,
+ PaletteHighlightedTextDisabled,
+ PaletteLinkDisabled,
+ PaletteLinkVisitedDisabled,
+
+ PaletteLightDisabled,
+ PaletteMidlightDisabled,
+ PaletteDarkDisabled,
+ PaletteMidDisabled,
+ PaletteShadowDisabled,
+
/* Icons */
IconsBaseColor,
@@ -269,6 +315,7 @@ public:
DrawSearchResultWidgetFrame,
DrawIndicatorBranch,
DrawToolBarHighlights,
+ DrawToolBarBorders,
ComboBoxDrawTextShadow,
DerivePaletteFromTheme,
ApplyThemePaletteGlobally,
diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp
index 069500d55b..0b697fead2 100644
--- a/src/plugins/android/androidbuildapkstep.cpp
+++ b/src/plugins/android/androidbuildapkstep.cpp
@@ -308,7 +308,7 @@ QAbstractItemModel *AndroidBuildApkStep::keystoreCertificates()
QMessageBox::critical(0, tr("Error"), tr("Invalid password."));
m_keystorePasswd.clear();
}
- rawCerts = response.stdOut;
+ rawCerts = response.stdOut();
}
return new CertificatesModel(rawCerts, this);
}
diff --git a/src/plugins/bazaar/bazaarclient.cpp b/src/plugins/bazaar/bazaarclient.cpp
index 3fc8293e17..991f994741 100644
--- a/src/plugins/bazaar/bazaarclient.cpp
+++ b/src/plugins/bazaar/bazaarclient.cpp
@@ -110,8 +110,8 @@ bool BazaarClient::synchronousSetUserId()
args << QLatin1String("whoami")
<< (settings().stringValue(BazaarSettings::userNameKey) + QLatin1String(" <")
+ settings().stringValue(BazaarSettings::userEmailKey) + QLatin1Char('>'));
- QByteArray stdOut;
- return vcsFullySynchronousExec(QDir::currentPath(), args, &stdOut);
+ return vcsFullySynchronousExec(QDir::currentPath(), args).result
+ == SynchronousProcessResponse::Finished;
}
BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) const
@@ -150,11 +150,10 @@ bool BazaarClient::synchronousUncommit(const QString &workingDir,
<< QLatin1String("--verbose") // Will print out what is being removed
<< revisionSpec(revision)
<< extraOptions;
- QByteArray stdOut;
- const bool success = vcsFullySynchronousExec(workingDir, args, &stdOut);
- if (!stdOut.isEmpty())
- VcsOutputWindow::append(QString::fromUtf8(stdOut));
- return success;
+
+ const SynchronousProcessResponse result = vcsFullySynchronousExec(workingDir, args);
+ VcsOutputWindow::append(result.stdOut());
+ return result.result == SynchronousProcessResponse::Finished;
}
void BazaarClient::commit(const QString &repositoryRoot, const QStringList &files,
@@ -187,10 +186,11 @@ bool BazaarClient::managesFile(const QString &workingDirectory, const QString &f
{
QStringList args(QLatin1String("status"));
args << fileName;
- QByteArray stdOut;
- if (!vcsFullySynchronousExec(workingDirectory, args, &stdOut))
+
+ const SynchronousProcessResponse result = vcsFullySynchronousExec(workingDirectory, args);
+ if (result.result != SynchronousProcessResponse::Finished)
return false;
- return !stdOut.startsWith("unknown");
+ return result.rawStdOut.startsWith("unknown");
}
void BazaarClient::view(const QString &source, const QString &id, const QStringList &extraOptions)
diff --git a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp
index 52a546860c..b001403679 100644
--- a/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp
+++ b/src/plugins/beautifier/artisticstyle/artisticstylesettings.cpp
@@ -85,10 +85,10 @@ static int updateVersionHelper(const QString &command)
return 0;
// Astyle prints the version on stdout or stderr, depending on platform
- const int version = parseVersion(response.stdOut.trimmed());
+ const int version = parseVersion(response.stdOut().trimmed());
if (version != 0)
return version;
- return parseVersion(response.stdErr.trimmed());
+ return parseVersion(response.stdErr().trimmed());
}
void ArtisticStyleSettings::updateVersion()
@@ -176,7 +176,7 @@ void ArtisticStyleSettings::createDocumentationFile() const
stream.writeStartElement(Constants::DOCUMENTATION_XMLROOT);
// astyle writes its output to 'error'...
- const QStringList lines = response.stdErr.split(QLatin1Char('\n'));
+ const QStringList lines = response.stdErr().split(QLatin1Char('\n'));
QStringList keys;
QStringList docu;
for (QString line : lines) {
diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp
index ee9bbf650f..043881b219 100644
--- a/src/plugins/beautifier/beautifierplugin.cpp
+++ b/src/plugins/beautifier/beautifierplugin.cpp
@@ -104,7 +104,7 @@ FormatTask format(FormatTask task)
task.error = BeautifierPlugin::tr("Failed to format: %1.").arg(response.exitMessage(executable, 5));
return task;
}
- const QString output = response.stdErr;
+ const QString output = response.stdErr();
if (!output.isEmpty())
task.error = executable + QLatin1String(": ") + output;
diff --git a/src/plugins/beautifier/generaloptionspage.ui b/src/plugins/beautifier/generaloptionspage.ui
index 2e6dd0e5e0..94aab94e12 100644
--- a/src/plugins/beautifier/generaloptionspage.ui
+++ b/src/plugins/beautifier/generaloptionspage.ui
@@ -20,7 +20,7 @@
<bool>true</bool>
</property>
<property name="title">
- <string>Automatic formatting on file save</string>
+ <string>Automatic Formatting on File Save</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
diff --git a/src/plugins/bookmarks/bookmark.cpp b/src/plugins/bookmarks/bookmark.cpp
index c4c29741d7..f7575ef39f 100644
--- a/src/plugins/bookmarks/bookmark.cpp
+++ b/src/plugins/bookmarks/bookmark.cpp
@@ -78,7 +78,7 @@ void Bookmark::updateFileName(const QString &fileName)
void Bookmark::setNote(const QString &note)
{
- m_note = note;
+ setToolTip(note);
}
void Bookmark::updateNote(const QString &note)
@@ -94,5 +94,5 @@ QString Bookmark::lineText() const
QString Bookmark::note() const
{
- return m_note;
+ return toolTip();
}
diff --git a/src/plugins/bookmarks/bookmark.h b/src/plugins/bookmarks/bookmark.h
index af9c219b9c..6d818946ff 100644
--- a/src/plugins/bookmarks/bookmark.h
+++ b/src/plugins/bookmarks/bookmark.h
@@ -37,13 +37,14 @@ class Bookmark : public TextEditor::TextMark
public:
Bookmark(int lineNumber, BookmarkManager *manager);
- void updateLineNumber(int lineNumber);
- void move(int line);
- void updateBlock(const QTextBlock &block);
- void updateFileName(const QString &fileName);
+ void updateLineNumber(int lineNumber) override;
+ void move(int line) override;
+ void updateBlock(const QTextBlock &block) override;
+ void updateFileName(const QString &fileName) override;
+ void removedFromEditor() override;
+
void setNote(const QString &note);
void updateNote(const QString &note);
- void removedFromEditor();
QString lineText() const;
QString note() const;
@@ -51,7 +52,6 @@ public:
private:
BookmarkManager *m_manager;
QString m_lineText;
- QString m_note;
};
} // namespace Internal
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index 0083466fef..3fc051c539 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -38,7 +38,6 @@
#include <projectexplorer/session.h>
#include <texteditor/texteditor.h>
#include <utils/icon.h>
-#include <utils/tooltip/tooltip.h>
#include <utils/qtcassert.h>
#include <utils/checkablemessagebox.h>
#include <utils/theme/theme.h>
@@ -845,17 +844,6 @@ void BookmarkManager::saveBookmarks()
SessionManager::setValue(QLatin1String("Bookmarks"), list);
}
-void BookmarkManager::operateTooltip(QWidget *widget, const QPoint &pos, Bookmark *mark)
-{
- if (!mark)
- return;
-
- if (mark->note().isEmpty())
- ToolTip::hide();
- else
- ToolTip::show(pos, mark->note(), widget);
-}
-
/* Loads the bookmarks from the session settings. */
void BookmarkManager::loadBookmarks()
{
@@ -867,12 +855,6 @@ void BookmarkManager::loadBookmarks()
updateActionStatus();
}
-void BookmarkManager::handleBookmarkTooltipRequest(IEditor *editor, const QPoint &pos, int line)
-{
- Bookmark *mark = findBookmark(editor->document()->filePath().toString(), line);
- operateTooltip(editor->widget(), pos, mark);
-}
-
// BookmarkViewFactory
BookmarkViewFactory::BookmarkViewFactory(BookmarkManager *bm)
diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h
index 0bc81ad135..1a35f28400 100644
--- a/src/plugins/bookmarks/bookmarkmanager.h
+++ b/src/plugins/bookmarks/bookmarkmanager.h
@@ -26,7 +26,6 @@
#pragma once
#include <utils/itemviews.h>
-#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/inavigationwidgetfactory.h>
#include <QAbstractItemModel>
@@ -36,6 +35,8 @@
#include <QPixmap>
#include <QStyledItemDelegate>
+namespace Core { class IContext; }
+
namespace Bookmarks {
namespace Internal {
@@ -87,8 +88,6 @@ public:
Note = Qt::UserRole + 4
};
- void handleBookmarkTooltipRequest(Core::IEditor *editor, const QPoint &pos, int line);
-
void toggleBookmark(const QString &fileName, int lineNumber);
void nextInDocument();
void prevInDocument();
@@ -117,7 +116,6 @@ private:
bool removeBookmarkFromMap(Bookmark *bookmark, const QString &fileName = QString());
static QString bookmarkToString(const Bookmark *b);
void saveBookmarks();
- void operateTooltip(QWidget *widget, const QPoint &pos, Bookmark *mark);
typedef QMultiMap<QString, Bookmark *> FileNameBookmarksMap;
typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap;
diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp
index 89119bb830..e1a59296af 100644
--- a/src/plugins/bookmarks/bookmarksplugin.cpp
+++ b/src/plugins/bookmarks/bookmarksplugin.cpp
@@ -170,13 +170,6 @@ void BookmarksPlugin::editorOpened(IEditor *editor)
m_bookmarkManager->toggleBookmark(editor->document()->filePath().toString(), line);
});
-
- connect(widget, &TextEditorWidget::markTooltipRequested, m_bookmarkManager,
- [this, editor](TextEditorWidget *, const QPoint &pos, int line) {
- if (editor->document())
- m_bookmarkManager->handleBookmarkTooltipRequest(editor, pos, line);
- });
-
connect(widget, &TextEditorWidget::markContextMenuRequested,
this, &BookmarksPlugin::requestContextMenu);
}
diff --git a/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp b/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp
index 71afe79bf1..b57b1e7328 100644
--- a/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp
+++ b/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp
@@ -243,11 +243,23 @@ ClangDiagnosticManager::ClangDiagnosticManager(TextEditor::TextDocument *textDoc
{
}
-void ClangDiagnosticManager::generateTextMarks()
+ClangDiagnosticManager::~ClangDiagnosticManager()
+{
+ cleanMarks();
+}
+
+void ClangDiagnosticManager::cleanMarks()
{
+ for (ClangTextMark *textMark : m_clangTextMarks) {
+ m_textDocument->removeMark(textMark);
+ delete textMark;
+ }
m_clangTextMarks.clear();
+}
+void ClangDiagnosticManager::generateTextMarks()
+{
+ cleanMarks();
m_clangTextMarks.reserve(m_warningDiagnostics.size() + m_errorDiagnostics.size());
-
addClangTextMarks(m_warningDiagnostics);
addClangTextMarks(m_errorDiagnostics);
}
@@ -332,18 +344,13 @@ ClangDiagnosticManager::diagnosticsWithFixIts() const
void ClangDiagnosticManager::addClangTextMarks(
const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics)
{
- QTC_ASSERT(m_clangTextMarks.size() + diagnostics.size() <= m_clangTextMarks.capacity(), return);
-
- for (auto &&diagnostic : diagnostics) {
- m_clangTextMarks.emplace_back(filePath(),
- diagnostic.location().line(),
- diagnostic.severity());
-
- ClangTextMark &textMark = m_clangTextMarks.back();
-
- textMark.setBaseTextDocument(m_textDocument);
-
- m_textDocument->addMark(&textMark);
+ for (const ClangBackEnd::DiagnosticContainer &diagnostic : diagnostics) {
+ auto textMark = new ClangTextMark(filePath(),
+ diagnostic.location().line(),
+ diagnostic.severity());
+ textMark->setToolTip(diagnostic.text());
+ m_clangTextMarks.push_back(textMark);
+ m_textDocument->addMark(textMark);
}
}
diff --git a/src/plugins/clangcodemodel/clangdiagnosticmanager.h b/src/plugins/clangcodemodel/clangdiagnosticmanager.h
index 45def83d3a..1da92c8605 100644
--- a/src/plugins/clangcodemodel/clangdiagnosticmanager.h
+++ b/src/plugins/clangcodemodel/clangdiagnosticmanager.h
@@ -47,6 +47,7 @@ class ClangDiagnosticManager
{
public:
ClangDiagnosticManager(TextEditor::TextDocument *textDocument);
+ ~ClangDiagnosticManager();
void processNewDiagnostics(const QVector<ClangBackEnd::DiagnosticContainer> &allDiagnostics);
@@ -60,6 +61,7 @@ public:
void clearDiagnosticsWithFixIts();
private:
+ void cleanMarks();
QString filePath() const;
void filterDiagnostics(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics);
void generateEditorSelections();
@@ -77,7 +79,7 @@ private:
QVector<ClangBackEnd::DiagnosticContainer> m_fixItdiagnostics;
QList<QTextEdit::ExtraSelection> m_extraSelections;
TextEditor::RefactorMarkers m_fixItAvailableMarkers;
- std::vector<ClangTextMark> m_clangTextMarks;
+ std::vector<ClangTextMark *> m_clangTextMarks;
};
} // namespace Internal
diff --git a/src/plugins/clangcodemodel/clangtextmark.cpp b/src/plugins/clangcodemodel/clangtextmark.cpp
index 240b2645ab..cf5abfb5b6 100644
--- a/src/plugins/clangcodemodel/clangtextmark.cpp
+++ b/src/plugins/clangcodemodel/clangtextmark.cpp
@@ -79,10 +79,5 @@ void ClangTextMark::setIcon(ClangBackEnd::DiagnosticSeverity severity)
TextMark::setIcon(errorIcon);
}
-ClangTextMark::ClangTextMark(ClangTextMark &&other) Q_DECL_NOEXCEPT
- : TextMark(std::move(other))
-{
-}
-
} // namespace ClangCodeModel
diff --git a/src/plugins/clangcodemodel/clangtextmark.h b/src/plugins/clangcodemodel/clangtextmark.h
index b669a86d16..017cec02eb 100644
--- a/src/plugins/clangcodemodel/clangtextmark.h
+++ b/src/plugins/clangcodemodel/clangtextmark.h
@@ -36,11 +36,6 @@ class ClangTextMark : public TextEditor::TextMark
public:
ClangTextMark(const QString &fileName, int lineNumber, ClangBackEnd::DiagnosticSeverity severity);
- ClangTextMark(ClangTextMark &&other) Q_DECL_NOEXCEPT;
-
- ClangTextMark(ClangTextMark &other) = delete;
- ClangTextMark &operator=(ClangTextMark &other) = delete;
-
private:
void setIcon(ClangBackEnd::DiagnosticSeverity severity);
};
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp
index f65a8a6931..dd3e59d2c4 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp
@@ -47,7 +47,7 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget(
chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History"));
chooser->setPromptDialogTitle(tr("Clang Command"));
- const auto validator = [chooser](Utils::FancyLineEdit *edit, QString *errorMessage) {
+ const auto validator = [chooser, this](Utils::FancyLineEdit *edit, QString *errorMessage) {
const QString currentFilePath = chooser->fileName().toString();
Utils::PathChooser pc;
Utils::PathChooser *helperPathChooser;
@@ -58,8 +58,17 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget(
} else {
helperPathChooser = chooser;
}
- return chooser->defaultValidationFunction()(helperPathChooser->lineEdit(), errorMessage)
+
+ const bool isExecutableValid =
+ chooser->defaultValidationFunction()(helperPathChooser->lineEdit(), errorMessage)
&& isClangExecutableUsable(helperPathChooser->fileName().toString(), errorMessage);
+
+ const ClangExecutableVersion detectedVersion = isExecutableValid
+ ? clangExecutableVersion(helperPathChooser->fileName().toString())
+ : ClangExecutableVersion();
+ updateDetectedVersionLabel(isExecutableValid, detectedVersion);
+
+ return isExecutableValid;
};
chooser->setValidationFunction(validator);
bool clangExeIsSet;
@@ -90,5 +99,29 @@ ClangStaticAnalyzerConfigWidget::~ClangStaticAnalyzerConfigWidget()
delete m_ui;
}
+void ClangStaticAnalyzerConfigWidget::updateDetectedVersionLabel(
+ bool isExecutableValid,
+ const ClangExecutableVersion &providedVersion)
+{
+ QLabel &label = *m_ui->detectedVersionLabel;
+
+ if (isExecutableValid) {
+ if (providedVersion.isValid()) {
+ if (providedVersion.isSupportedVersion()) {
+ label.setText(tr("Version: %1, supported.")
+ .arg(providedVersion.toString()));
+ } else {
+ label.setText(tr("Version: %1, unsupported (supported version is %2).")
+ .arg(providedVersion.toString())
+ .arg(ClangExecutableVersion::supportedVersionAsString()));
+ }
+ } else {
+ label.setText(tr("Version: Could not determine version."));
+ }
+ } else {
+ label.setText(tr("Version: Set valid executable first."));
+ }
+}
+
} // namespace Internal
} // namespace ClangStaticAnalyzer
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h
index f410670e50..6cc4e39eaf 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h
@@ -34,6 +34,8 @@ namespace Internal {
namespace Ui { class ClangStaticAnalyzerConfigWidget; }
+class ClangExecutableVersion;
+
class ClangStaticAnalyzerConfigWidget : public QWidget
{
Q_OBJECT
@@ -43,6 +45,9 @@ public:
QWidget *parent = 0);
~ClangStaticAnalyzerConfigWidget();
+ void updateDetectedVersionLabel(bool executableIsValid,
+ const ClangExecutableVersion &providedVersion);
+
private:
Ui::ClangStaticAnalyzerConfigWidget *m_ui;
ClangStaticAnalyzerSettings *m_settings;
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui
index 800733a331..3f4d3762ec 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui
@@ -34,14 +34,21 @@
</item>
</layout>
</item>
- <item row="1" column="0">
+ <item row="1" column="1">
+ <widget class="QLabel" name="detectedVersionLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Simultaneous processes:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSpinBox" name="simultaneousProccessesSpinBox">
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp
index 1fa42fa11b..f140907a66 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp
@@ -469,6 +469,28 @@ void ClangStaticAnalyzerRunControl::start()
emit finished();
return;
}
+
+ // Check clang version
+ const ClangExecutableVersion version = clangExecutableVersion(executable);
+ if (!version.isValid()) {
+ const QString warningMessage
+ = tr("Clang Static Analyzer: Running with possibly unsupported version, "
+ "could not determine version from executable \"%1\".")
+ .arg(executable);
+ appendMessage(warningMessage + QLatin1Char('\n'), Utils::StdErrFormat);
+ TaskHub::addTask(Task::Warning, warningMessage, Debugger::Constants::ANALYZERTASK_ID);
+ TaskHub::requestPopup();
+ } else if (!version.isSupportedVersion()) {
+ const QString warningMessage
+ = tr("Clang Static Analyzer: Running with unsupported version %1, "
+ "supported version is %2.")
+ .arg(version.toString())
+ .arg(ClangExecutableVersion::supportedVersionAsString());
+ appendMessage(warningMessage + QLatin1Char('\n'), Utils::StdErrFormat);
+ TaskHub::addTask(Task::Warning, warningMessage, Debugger::Constants::ANALYZERTASK_ID);
+ TaskHub::requestPopup();
+ }
+
m_clangExecutable = executable;
// Create log dir
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp
index 0b7bc0f230..a1a1bee67a 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp
@@ -32,9 +32,11 @@
#include <utils/hostosinfo.h>
#include <utils/environment.h>
+#include <utils/synchronousprocess.h>
#include <QCoreApplication>
#include <QFileInfo>
+#include <QRegularExpression>
static bool isFileExecutable(const QString &executablePath)
{
@@ -108,5 +110,53 @@ bool isClangExecutableUsable(const QString &filePath, QString *errorMessage)
return true;
}
+ClangExecutableVersion clangExecutableVersion(const QString &executable)
+{
+ const ClangExecutableVersion invalidVersion;
+
+ // Sanity checks
+ const QFileInfo fileInfo(executable);
+ const bool isExecutableFile = fileInfo.isFile() && fileInfo.isExecutable();
+ if (!isExecutableFile)
+ return invalidVersion;
+
+ // Get version output
+ Utils::Environment environment = Utils::Environment::systemEnvironment();
+ Utils::Environment::setupEnglishOutput(&environment);
+ Utils::SynchronousProcess runner;
+ runner.setEnvironment(environment.toStringList());
+ runner.setTimeoutS(10);
+ // We would prefer "-dumpversion", but that one returns some old version number.
+ const QStringList arguments(QLatin1String(("--version")));
+ const Utils::SynchronousProcessResponse response = runner.runBlocking(executable, arguments);
+ if (response.result != Utils::SynchronousProcessResponse::Finished)
+ return invalidVersion;
+ const QString output = response.stdOut();
+
+ // Parse version output
+ const QRegularExpression re(QLatin1String("clang version (\\d+)\\.(\\d+)\\.(\\d+)"));
+ const QRegularExpressionMatch reMatch = re.match(output);
+ if (re.captureCount() != 3)
+ return invalidVersion;
+
+ const QString majorString = reMatch.captured(1);
+ bool convertedSuccessfully = false;
+ const int major = majorString.toInt(&convertedSuccessfully);
+ if (!convertedSuccessfully)
+ return invalidVersion;
+
+ const QString minorString = reMatch.captured(2);
+ const int minor = minorString.toInt(&convertedSuccessfully);
+ if (!convertedSuccessfully)
+ return invalidVersion;
+
+ const QString patchString = reMatch.captured(3);
+ const int patch = patchString.toInt(&convertedSuccessfully);
+ if (!convertedSuccessfully)
+ return invalidVersion;
+
+ return ClangExecutableVersion(major, minor, patch);
+}
+
} // namespace Internal
} // namespace ClangStaticAnalyzer
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h
index 6b0880fc67..fb86bc1f94 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h
@@ -44,5 +44,40 @@ QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid);
QString createFullLocationString(const Debugger::DiagnosticLocation &location);
+// TODO: Use QVersionNumber once we can use >= Qt 5.6.0
+class ClangExecutableVersion {
+public:
+ ClangExecutableVersion() : majorNumber(-1) , minorNumber(-1) , patchNumber(-1) {}
+ ClangExecutableVersion(int major, int minor, int patch)
+ : majorNumber(major) , minorNumber(minor) , patchNumber(patch) {}
+
+ bool isValid() const
+ {
+ return majorNumber >= 0 && minorNumber >= 0 && patchNumber >= 0;
+ }
+
+ bool isSupportedVersion() const
+ {
+ return majorNumber == 3 && minorNumber == 8;
+ }
+
+ static QString supportedVersionAsString()
+ {
+ return QLatin1String("3.8");
+ }
+
+ QString toString() const
+ {
+ return QString::fromLatin1("%1.%2.%3").arg(majorNumber).arg(minorNumber).arg(patchNumber);
+ }
+
+public:
+ int majorNumber;
+ int minorNumber;
+ int patchNumber;
+};
+
+ClangExecutableVersion clangExecutableVersion(const QString &absolutePath);
+
} // namespace Internal
} // namespace ClangStaticAnalyzer
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index 8071365aa8..2351e6bbb2 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -1480,8 +1480,8 @@ ClearCasePlugin::runCleartool(const QString &workingDir,
response.error = sp_resp.result != SynchronousProcessResponse::Finished;
if (response.error)
response.message = sp_resp.exitMessage(executable, timeOutS);
- response.stdErr = sp_resp.stdErr;
- response.stdOut = sp_resp.stdOut;
+ response.stdErr = sp_resp.stdErr();
+ response.stdOut = sp_resp.stdOut();
return response;
}
diff --git a/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp b/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp
index 39e0689be6..19fcded220 100644
--- a/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakekitconfigwidget.cpp
@@ -35,6 +35,7 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/algorithm.h>
+#include <utils/elidinglabel.h>
#include <utils/qtcassert.h>
#include <QBoxLayout>
@@ -278,7 +279,7 @@ QString CMakeGeneratorKitConfigWidget::toolTip() const
CMakeConfigurationKitConfigWidget::CMakeConfigurationKitConfigWidget(Kit *kit,
const KitInformation *ki) :
KitConfigWidget(kit, ki),
- m_summaryLabel(new QLabel),
+ m_summaryLabel(new Utils::ElidingLabel),
m_manageButton(new QPushButton)
{
refresh();
@@ -303,13 +304,9 @@ void CMakeConfigurationKitConfigWidget::refresh()
{
const QStringList current = CMakeConfigurationKitInformation::toStringList(kit());
- QString shortSummary = current.join(QLatin1String("; "));
- QFontMetrics fm(m_summaryLabel->font());
- shortSummary = fm.elidedText(shortSummary, Qt::ElideRight, m_summaryLabel->width());
- m_summaryLabel->setText(current.isEmpty() ? tr("<No Changes to Apply>") : shortSummary);
-
+ m_summaryLabel->setText(current.join("; "));
if (m_editor)
- m_editor->setPlainText(current.join(QLatin1Char('\n')));
+ m_editor->setPlainText(current.join('\n'));
}
QWidget *CMakeConfigurationKitConfigWidget::mainWidget() const
@@ -344,6 +341,7 @@ void CMakeConfigurationKitConfigWidget::editConfigurationChanges()
m_editor->setToolTip(tr("Enter one variable per line with the variable name "
"separated from the variable value by \"=\".<br>"
"You may provide a type hint by adding \":TYPE\" before the \"=\"."));
+ m_editor->setMinimumSize(800, 200);
auto chooser = new Core::VariableChooser(m_dialog);
chooser->addSupportedWidget(m_editor);
diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp
index 55685b0889..5f140ac84f 100644
--- a/src/plugins/cmakeprojectmanager/cmaketool.cpp
+++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp
@@ -153,7 +153,7 @@ QStringList CMakeTool::supportedGenerators() const
Utils::SynchronousProcessResponse response = run(QLatin1String("--help"));
if (response.result == Utils::SynchronousProcessResponse::Finished) {
bool inGeneratorSection = false;
- const QStringList lines = response.stdOut.split(QLatin1Char('\n'));
+ const QStringList lines = response.stdOut().split(QLatin1Char('\n'));
foreach (const QString &line, lines) {
if (line.isEmpty())
continue;
@@ -188,19 +188,19 @@ TextEditor::Keywords CMakeTool::keywords()
Utils::SynchronousProcessResponse response;
response = run(QLatin1String("--help-command-list"));
if (response.result == Utils::SynchronousProcessResponse::Finished)
- m_functions = response.stdOut.split(QLatin1Char('\n'));
+ m_functions = response.stdOut().split(QLatin1Char('\n'));
response = run(QLatin1String("--help-commands"));
if (response.result == Utils::SynchronousProcessResponse::Finished)
- parseFunctionDetailsOutput(response.stdOut);
+ parseFunctionDetailsOutput(response.stdOut());
response = run(QLatin1String("--help-property-list"));
if (response.result == Utils::SynchronousProcessResponse::Finished)
- m_variables = parseVariableOutput(response.stdOut);
+ m_variables = parseVariableOutput(response.stdOut());
response = run(QLatin1String("--help-variable-list"));
if (response.result == Utils::SynchronousProcessResponse::Finished) {
- m_variables.append(parseVariableOutput(response.stdOut));
+ m_variables.append(parseVariableOutput(response.stdOut()));
m_variables = Utils::filteredUnique(m_variables);
Utils::sort(m_variables);
}
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index 43a688ca55..fd23a004dd 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -337,6 +337,7 @@ public:
{
setFrameStyle(QFrame::NoFrame | QFrame::Plain);
viewport()->setAutoFillBackground(false);
+ setWidgetResizable(true);
}
private:
void resizeEvent(QResizeEvent *event) override
@@ -385,7 +386,6 @@ private:
return 0;
return list.first()->sizeHint().width();
}
-
};
diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp
index 3c8d4219c8..1f0a56b1d2 100644
--- a/src/plugins/coreplugin/fancytabwidget.cpp
+++ b/src/plugins/coreplugin/fancytabwidget.cpp
@@ -413,11 +413,12 @@ public:
{
QWidget::paintEvent(event);
- // Some Themes do not want highlights and shadows in the toolbars.
+ // Some Themes do not want highlights, shadows and borders in the toolbars.
// But we definitely want a separator between FancyColorButton and FancyTabBar
- if (!creatorTheme()->flag(Theme::DrawToolBarHighlights)) {
+ if (!creatorTheme()->flag(Theme::DrawToolBarHighlights)
+ && !creatorTheme()->flag(Theme::DrawToolBarBorders)) {
QPainter p(this);
- p.setPen(StyleHelper::borderColor());
+ p.setPen(StyleHelper::toolBarBorderColor());
const QRectF innerRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5);
p.drawLine(innerRect.bottomLeft(), innerRect.bottomRight());
}
@@ -527,13 +528,19 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
rect = style()->visualRect(layoutDirection(), geometry(), rect);
const QRectF boderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
- StyleHelper::verticalGradient(&painter, rect, rect);
- painter.setPen(StyleHelper::borderColor());
- painter.drawLine(boderRect.topRight(), boderRect.bottomRight());
- QColor light = StyleHelper::sidebarHighlight();
- painter.setPen(light);
- painter.drawLine(boderRect.bottomLeft(), boderRect.bottomRight());
+ if (creatorTheme()->flag(Theme::FlatToolBars)) {
+ painter.setPen(StyleHelper::toolBarBorderColor());
+ painter.drawLine(boderRect.topRight(), boderRect.bottomRight());
+ } else {
+ StyleHelper::verticalGradient(&painter, rect, rect);
+ painter.setPen(StyleHelper::borderColor());
+ painter.drawLine(boderRect.topRight(), boderRect.bottomRight());
+
+ QColor light = StyleHelper::sidebarHighlight();
+ painter.setPen(light);
+ painter.drawLine(boderRect.bottomLeft(), boderRect.bottomRight());
+ }
}
}
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp
index af9c1dc9c3..861962204d 100644
--- a/src/plugins/coreplugin/manhattanstyle.cpp
+++ b/src/plugins/coreplugin/manhattanstyle.cpp
@@ -527,20 +527,24 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
case PE_PanelStatusBar:
{
+ const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
+ painter->save();
if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter->fillRect(rect, StyleHelper::baseColor());
} else {
- painter->save();
QLinearGradient grad = StyleHelper::statusBarGradient(rect);
painter->fillRect(rect, grad);
- const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->setPen(QColor(255, 255, 255, 60));
painter->drawLine(borderRect.topLeft() + QPointF(0, 1),
borderRect.topRight()+ QPointF(0, 1));
painter->setPen(StyleHelper::borderColor().darker(110)); //TODO: make themable
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
- painter->restore();
}
+ if (creatorTheme()->flag(Theme::DrawToolBarBorders)) {
+ painter->setPen(StyleHelper::toolBarBorderColor());
+ painter->drawLine(borderRect.topLeft(), borderRect.topRight());
+ }
+ painter->restore();
}
break;
@@ -796,7 +800,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
StyleHelper::menuGradient(painter, option->rect, option->rect);
painter->save();
- painter->setPen(StyleHelper::borderColor());
+ painter->setPen(StyleHelper::toolBarBorderColor());
painter->drawLine(option->rect.bottomLeft() + QPointF(0.5, 0.5),
option->rect.bottomRight() + QPointF(0.5, 0.5));
painter->restore();
@@ -828,7 +832,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
if (creatorTheme()->flag(Theme::DrawToolBarHighlights)) {
if (!drawLightColored)
- painter->setPen(StyleHelper::borderColor());
+ painter->setPen(StyleHelper::toolBarBorderColor());
else
painter->setPen(QColor(0x888888));
@@ -855,6 +859,13 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
}
}
+ if (creatorTheme()->flag(Theme::DrawToolBarBorders)) {
+ painter->setPen(StyleHelper::toolBarBorderColor());
+ if (widget && widget->property("topBorder").toBool())
+ painter->drawLine(borderRect.topLeft(), borderRect.topRight());
+ else
+ painter->drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
+ }
}
break;
diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp
index 25ae127710..289f01279d 100644
--- a/src/plugins/coreplugin/outputpanemanager.cpp
+++ b/src/plugins/coreplugin/outputpanemanager.cpp
@@ -670,12 +670,6 @@ QSize OutputPaneToggleButton::sizeHint() const
void OutputPaneToggleButton::paintEvent(QPaintEvent*)
{
- static const QImage panelButton(StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/panel_button.png")));
- static const QImage panelButtonHover(StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/panel_button_hover.png")));
- static const QImage panelButtonPressed(StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/panel_button_pressed.png")));
- static const QImage panelButtonChecked(StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/panel_button_checked.png")));
- static const QImage panelButtonCheckedHover(StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/panel_button_checked_hover.png")));
-
const QFontMetrics fm = fontMetrics();
const int baseLine = (height() - fm.height() + 1) / 2 + fm.ascent();
const int numberWidth = fm.width(m_number);
@@ -686,7 +680,6 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*)
styleOption.initFrom(this);
const bool hovered = !HostOsInfo::isMacHost() && (styleOption.state & QStyle::State_MouseOver);
- const QImage *image = 0;
if (creatorTheme()->flag(Theme::FlatToolBars)) {
Theme::Color c = Theme::BackgroundColorDark;
@@ -698,12 +691,32 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*)
if (c != Theme::BackgroundColorDark)
p.fillRect(rect(), creatorTheme()->color(c));
} else {
- if (isDown())
- image = &panelButtonPressed;
- else if (isChecked())
- image = hovered ? &panelButtonCheckedHover : &panelButtonChecked;
- else
- image = hovered ? &panelButtonHover : &panelButton;
+ const QImage *image = 0;
+ if (isDown()) {
+ static const QImage pressed(
+ StyleHelper::dpiSpecificImageFile(":/core/images/panel_button_pressed.png"));
+ image = &pressed;
+ } else if (isChecked()) {
+ if (hovered) {
+ static const QImage checkedHover(
+ StyleHelper::dpiSpecificImageFile(":/core/images/panel_button_checked_hover.png"));
+ image = &checkedHover;
+ } else {
+ static const QImage checked(
+ StyleHelper::dpiSpecificImageFile(":/core/images/panel_button_checked.png"));
+ image = &checked;
+ }
+ } else {
+ if (hovered) {
+ static const QImage hover(
+ StyleHelper::dpiSpecificImageFile(":/core/images/panel_button_hover.png"));
+ image = &hover;
+ } else {
+ static const QImage button(
+ StyleHelper::dpiSpecificImageFile(":/core/images/panel_button.png"));
+ image = &button;
+ }
+ }
if (image)
StyleHelper::drawCornerImage(*image, &p, rect(), numberAreaWidth(), buttonBorderWidth, buttonBorderWidth, buttonBorderWidth);
}
diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h
index 35c7fca23e..ea2d138d10 100644
--- a/src/plugins/cppeditor/cppeditorplugin.h
+++ b/src/plugins/cppeditor/cppeditorplugin.h
@@ -167,6 +167,7 @@ private slots:
void test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames1();
void test_quickfix_MoveFuncDefOutside_respectWsInOperatorNames2();
void test_quickfix_MoveFuncDefOutside_macroUses();
+ void test_quickfix_MoveFuncDefOutside_template();
void test_quickfix_MoveAllFuncDefOutside_MemberFuncToCpp();
void test_quickfix_MoveAllFuncDefOutside_MemberFuncOutside();
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index 742106252a..02b70565f1 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -4018,6 +4018,23 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_macroUses()
ProjectPartHeaderPaths(), 0, "QTCREATORBUG-12314");
}
+void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_template()
+{
+ QByteArray original =
+ "template<class T>\n"
+ "class Foo { void fu@nc() {} };\n";
+ QByteArray expected =
+ "template<class T>\n"
+ "class Foo { void fu@nc(); };\n"
+ "\n"
+ "template<class T>\n"
+ "void Foo<T>::func() {}\n";
+ ;
+
+ MoveFuncDefOutside factory;
+ QuickFixOperationTest(singleDocument(original, expected), &factory, {}, 0, "QTCREATORBUG-16649");
+}
+
/// Check: revert test_quickfix_MoveFuncDefOutside_MemberFuncToCpp()
void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFunc()
{
diff --git a/src/plugins/cpptools/cppcodemodelsettingspage.cpp b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
index b86bdadb86..8fb52b72cc 100644
--- a/src/plugins/cpptools/cppcodemodelsettingspage.cpp
+++ b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
@@ -75,7 +75,8 @@ void CppCodeModelSettingsWidget::setupClangCodeModelWidgets()
{
const bool isClangActive = CppModelManager::instance()->isClangCodeModelActive();
- m_ui->activateClangCodeModelPluginHint->setVisible(!isClangActive);
+ m_ui->clangCodeModelIsDisabledHint->setVisible(!isClangActive);
+ m_ui->clangCodeModelIsEnabledHint->setVisible(isClangActive);
m_ui->clangSettingsGroupBox->setEnabled(isClangActive);
ClangDiagnosticConfigsModel diagnosticConfigsModel(m_settings->clangCustomDiagnosticConfigs());
diff --git a/src/plugins/cpptools/cppcodemodelsettingspage.ui b/src/plugins/cpptools/cppcodemodelsettingspage.ui
index 974f0f6b6e..23ee9e764e 100644
--- a/src/plugins/cpptools/cppcodemodelsettingspage.ui
+++ b/src/plugins/cpptools/cppcodemodelsettingspage.ui
@@ -15,9 +15,16 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QLabel" name="activateClangCodeModelPluginHint">
+ <widget class="QLabel" name="clangCodeModelIsEnabledHint">
<property name="text">
- <string>&lt;i&gt;Activate the Clang Code Model plugin to enable the options here.&lt;/i&gt;</string>
+ <string>&lt;i&gt;The Clang Code Model is enabled because the corresponding plugin is loaded.&lt;/i&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="clangCodeModelIsDisabledHint">
+ <property name="text">
+ <string>&lt;i&gt;The Clang Code Model is disabled because the corresponding plugin is not loaded.&lt;/i&gt;</string>
</property>
</widget>
</item>
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 9f4097ebb1..336a45f6a8 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -1140,8 +1140,8 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
timeOutS, flags, outputCodec);
response.result = CvsResponse::OtherError;
- response.stdErr = sp_resp.stdErr;
- response.stdOut = sp_resp.stdOut;
+ response.stdErr = sp_resp.stdErr();
+ response.stdOut = sp_resp.stdOut();
switch (sp_resp.result) {
case SynchronousProcessResponse::Finished:
response.result = CvsResponse::Ok;
diff --git a/src/plugins/debugger/console/consoleitemdelegate.cpp b/src/plugins/debugger/console/consoleitemdelegate.cpp
index b2a2f188b7..18860fbeda 100644
--- a/src/plugins/debugger/console/consoleitemdelegate.cpp
+++ b/src/plugins/debugger/console/consoleitemdelegate.cpp
@@ -312,6 +312,7 @@ QWidget *ConsoleItemDelegate::createEditor(QWidget *parent,
editor->setStyleSheet(QLatin1String("QTextEdit {"
"margin-left: 24px;"
"margin-top: 4px;"
+ "color: black;"
"background-color: white;"
"background-image: url(:/qmljstools/images/prompt.png);"
"background-position: baseline left;"
diff --git a/src/plugins/debugger/console/consoleview.cpp b/src/plugins/debugger/console/consoleview.cpp
index ddc842a10c..4c5d7f1df1 100644
--- a/src/plugins/debugger/console/consoleview.cpp
+++ b/src/plugins/debugger/console/consoleview.cpp
@@ -98,7 +98,9 @@ ConsoleView::ConsoleView(ConsoleItemModel *model, QWidget *parent) :
"QTreeView::branch:open:has-children:!has-siblings,"
"QTreeView::branch:open:has-children:has-siblings {"
"border-image: none;"
- "image: none; }"));
+ "image: none; }"
+ "QTreeView {"
+ "background-color: white; }"));
QString baseName = QApplication::style()->objectName();
if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index e4b4c42481..73100c637b 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -719,6 +719,10 @@ public:
}
}
+ void reloadSourceFiles() { if (m_currentEngine) m_currentEngine->reloadSourceFiles(); }
+ void reloadRegisters() { if (m_currentEngine) m_currentEngine->reloadRegisters(); }
+ void reloadModules() { if (m_currentEngine) m_currentEngine->reloadModules(); }
+
void editorOpened(IEditor *editor);
void updateBreakMenuItem(IEditor *editor);
void setBusyCursor(bool busy);
@@ -1340,17 +1344,17 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
m_modulesView = new BaseTreeView;
m_modulesView->setSortingEnabled(true);
m_modulesView->setSettings(settings, "Debugger.ModulesView");
- connect(m_modulesView, &BaseTreeView::aboutToShow, this, [this] {
- m_currentEngine->reloadModules();
- }, Qt::QueuedConnection);
+ connect(m_modulesView, &BaseTreeView::aboutToShow,
+ this, &DebuggerPluginPrivate::reloadModules,
+ Qt::QueuedConnection);
m_modulesWindow = addSearch(m_modulesView, tr("Modules"), DOCKWIDGET_MODULES);
m_registerView = new BaseTreeView;
m_registerView->setRootIsDecorated(true);
m_registerView->setSettings(settings, "Debugger.RegisterView");
- connect(m_registerView, &BaseTreeView::aboutToShow, this, [this] {
- m_currentEngine->reloadRegisters();
- }, Qt::QueuedConnection);
+ connect(m_registerView, &BaseTreeView::aboutToShow,
+ this, &DebuggerPluginPrivate::reloadRegisters,
+ Qt::QueuedConnection);
m_registerWindow = addSearch(m_registerView, tr("Registers"), DOCKWIDGET_REGISTER);
m_stackView = new StackTreeView;
@@ -1360,9 +1364,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
m_sourceFilesView = new BaseTreeView;
m_sourceFilesView->setSortingEnabled(true);
m_sourceFilesView->setSettings(settings, "Debugger.SourceFilesView");
- connect(m_sourceFilesView, &BaseTreeView::aboutToShow, this, [this] {
- m_currentEngine->reloadSourceFiles();
- }, Qt::QueuedConnection);
+ connect(m_sourceFilesView, &BaseTreeView::aboutToShow,
+ this, &DebuggerPluginPrivate::reloadSourceFiles,
+ Qt::QueuedConnection);
m_sourceFilesWindow = addSearch(m_sourceFilesView, tr("Source Files"), DOCKWIDGET_SOURCE_FILES);
m_threadsView = new BaseTreeView;
diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp
index f513193cd4..c4f2a2ed0d 100644
--- a/src/plugins/debugger/debuggerprotocol.cpp
+++ b/src/plugins/debugger/debuggerprotocol.cpp
@@ -583,6 +583,8 @@ QString decodeData(const QString &ba, const QString &encoding)
return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<invalid>");
if (encoding == "notcallable")
return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<not callable>");
+ if (encoding == "outofscope")
+ return QCoreApplication::translate("Debugger::Internal::WatchHandler", "<out of scope>");
DebuggerEncoding enc(encoding);
QString result;
diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp
index b7a5428571..4534c295a5 100644
--- a/src/plugins/debugger/gdb/coregdbadapter.cpp
+++ b/src/plugins/debugger/gdb/coregdbadapter.cpp
@@ -142,7 +142,7 @@ GdbCoreEngine::readExecutableNameFromCore(const QString &debuggerCommand, const
SynchronousProcessResponse response = proc.runBlocking(debuggerCommand, args);
if (response.result == SynchronousProcessResponse::Finished) {
- QString output = response.stdOut;
+ QString output = response.stdOut();
// Core was generated by `/data/dev/creator-2.6/bin/qtcreator'.
// Program terminated with signal 11, Segmentation fault.
int pos1 = output.indexOf("Core was generated by");
diff --git a/src/plugins/debugger/gdb/gdbplainengine.cpp b/src/plugins/debugger/gdb/gdbplainengine.cpp
index 13709f7cec..1c827bdb57 100644
--- a/src/plugins/debugger/gdb/gdbplainengine.cpp
+++ b/src/plugins/debugger/gdb/gdbplainengine.cpp
@@ -121,8 +121,9 @@ void GdbPlainEngine::setupEngine()
}
gdbArgs.append("--tty=" + m_outputCollector.serverName());
- if (!runParameters().inferior.workingDirectory.isEmpty())
- m_gdbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
+ QString workingDirectory = runParameters().inferior.workingDirectory;
+ if (!workingDirectory.isEmpty() && QFileInfo::exists(workingDirectory))
+ m_gdbProc.setWorkingDirectory(workingDirectory);
startGdb(gdbArgs);
}
diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp
index 9bbd5033ac..b421ee1cc5 100644
--- a/src/plugins/debugger/logwindow.cpp
+++ b/src/plugins/debugger/logwindow.cpp
@@ -428,6 +428,16 @@ LogWindow::LogWindow(QWidget *parent)
this, &LogWindow::doOutput);
setMinimumHeight(60);
+
+ showOutput(LogWarning,
+ tr("NOTE: This log contains possibly confidential information about your machine, "
+ "environment variables, in-memory data of the processes you are debugging, and more. "
+ "It is never transferred over the internet by Qt Creator, and only stored "
+ "to disk if you manually use the respective option from the context menu, or through "
+ "mechanisms that are not under Qt Creator's control, for instance in swap files.\n"
+ "You may be asked to share the contents of this log when reporting bugs related "
+ "to debugger operation. In this case, make sure your submission does not "
+ "contain data you do not want to or you are not allowed to share.\n\n"));
}
void LogWindow::executeLine()
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index 473474a218..387e127745 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -663,6 +663,12 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
propertiesWatch->appendChild(propertyWatch);
}
+ if (boolSetting(SortStructMembers)) {
+ propertiesWatch->sortChildren([](const WatchItem *item1, const WatchItem *item2) {
+ return item1->name < item2->name;
+ });
+ }
+
m_qmlEngine->watchHandler()->insertItem(propertiesWatch);
}
diff --git a/src/plugins/git/annotationhighlighter.cpp b/src/plugins/git/annotationhighlighter.cpp
index a737d3f331..9e3d73c4f0 100644
--- a/src/plugins/git/annotationhighlighter.cpp
+++ b/src/plugins/git/annotationhighlighter.cpp
@@ -25,15 +25,12 @@
#include "annotationhighlighter.h"
-#include <QDebug>
-
namespace Git {
namespace Internal {
GitAnnotationHighlighter::GitAnnotationHighlighter(const ChangeNumbers &changeNumbers,
QTextDocument *document) :
- VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
- m_blank(QLatin1Char(' '))
+ VcsBase::BaseAnnotationHighlighter(changeNumbers, document)
{
}
diff --git a/src/plugins/git/annotationhighlighter.h b/src/plugins/git/annotationhighlighter.h
index b137945984..7f28ad26da 100644
--- a/src/plugins/git/annotationhighlighter.h
+++ b/src/plugins/git/annotationhighlighter.h
@@ -41,7 +41,7 @@ public:
private:
QString changeNumber(const QString &block) const override;
- const QChar m_blank;
+ const QChar m_blank = ' ';
};
} // namespace Internal
diff --git a/src/plugins/git/branchadddialog.cpp b/src/plugins/git/branchadddialog.cpp
index 77e28634f6..10854069bd 100644
--- a/src/plugins/git/branchadddialog.cpp
+++ b/src/plugins/git/branchadddialog.cpp
@@ -46,20 +46,20 @@ class BranchNameValidator : public QValidator
public:
BranchNameValidator(const QStringList &localBranches, QObject *parent = 0) :
QValidator(parent),
- m_invalidChars(QLatin1String(
- "\\s" // no whitespace
- "|~" // no "~"
- "|\\^" // no "^"
- "|\\[" // no "["
- "|\\.\\." // no ".."
- "|/\\." // no slashdot
- "|:" // no ":"
- "|@\\{" // no "@{" sequence
- "|\\\\" // no backslash
- "|//" // no double slash
- "|^[/-]" // no leading slash or dash
- "|\"" // no quotes
- )),
+ m_invalidChars(
+ "\\s" // no whitespace
+ "|~" // no "~"
+ "|\\^" // no "^"
+ "|\\[" // no "["
+ "|\\.\\." // no ".."
+ "|/\\." // no slashdot
+ "|:" // no ":"
+ "|@\\{" // no "@{" sequence
+ "|\\\\" // no backslash
+ "|//" // no double slash
+ "|^[/-]" // no leading slash or dash
+ "|\"" // no quotes
+ ),
m_localBranches(localBranches)
{
}
@@ -68,21 +68,17 @@ public:
{
Q_UNUSED(pos)
- // NoGos
-
- if (input.contains(m_invalidChars))
- return Invalid;
-
+ input.replace(m_invalidChars, "_");
// "Intermediate" patterns, may change to Acceptable when user edits further:
- if (input.endsWith(QLatin1String(".lock"))) //..may not end with ".lock"
+ if (input.endsWith(".lock")) //..may not end with ".lock"
return Intermediate;
- if (input.endsWith(QLatin1Char('.'))) // no dot at the end (but allowed in the middle)
+ if (input.endsWith('.')) // no dot at the end (but allowed in the middle)
return Intermediate;
- if (input.endsWith(QLatin1Char('/'))) // no slash at the end (but allowed in the middle)
+ if (input.endsWith('/')) // no slash at the end (but allowed in the middle)
return Intermediate;
if (m_localBranches.contains(input, Utils::HostOsInfo::isWindowsHost()
diff --git a/src/plugins/git/branchdialog.cpp b/src/plugins/git/branchdialog.cpp
index 502d3afc4e..a91ac27e39 100644
--- a/src/plugins/git/branchdialog.cpp
+++ b/src/plugins/git/branchdialog.cpp
@@ -172,7 +172,7 @@ void BranchDialog::add()
QString suggestedName;
if (!isTag) {
QString suggestedNameBase;
- suggestedNameBase = trackedBranch.mid(trackedBranch.lastIndexOf(QLatin1Char('/')) + 1);
+ suggestedNameBase = trackedBranch.mid(trackedBranch.lastIndexOf('/') + 1);
suggestedName = suggestedNameBase;
int i = 2;
while (localNames.contains(suggestedName)) {
@@ -208,7 +208,7 @@ void BranchDialog::checkout()
const QString currentBranch = m_model->fullName(m_model->currentBranch());
const QString nextBranch = m_model->fullName(idx);
const QString popMessageStart = QCoreApplication::applicationName() +
- QLatin1Char(' ') + nextBranch + QLatin1String("-AutoStash ");
+ ' ' + nextBranch + "-AutoStash ";
BranchCheckoutDialog branchCheckoutDialog(this, currentBranch, nextBranch);
GitClient *client = GitPlugin::client();
@@ -232,12 +232,10 @@ void BranchDialog::checkout()
} else if (branchCheckoutDialog.exec() == QDialog::Accepted) {
if (branchCheckoutDialog.makeStashOfCurrentBranch()) {
- if (client->synchronousStash(m_repository,
- currentBranch + QLatin1String("-AutoStash")).isEmpty()) {
+ if (client->synchronousStash(m_repository, currentBranch + "-AutoStash").isEmpty())
return;
- }
} else if (branchCheckoutDialog.moveLocalChangesToNextBranch()) {
- if (!client->beginStashScope(m_repository, QLatin1String("Checkout"), NoPrompt))
+ if (!client->beginStashScope(m_repository, "Checkout", NoPrompt))
return;
} else if (branchCheckoutDialog.discardLocalChanges()) {
if (!client->synchronousReset(m_repository))
@@ -351,7 +349,7 @@ void BranchDialog::reset()
if (QMessageBox::question(this, tr("Git Reset"), tr("Hard reset branch \"%1\" to \"%2\"?")
.arg(currentName).arg(branchName),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
- GitPlugin::client()->reset(m_repository, QLatin1String("--hard"), branchName);
+ GitPlugin::client()->reset(m_repository, "--hard", branchName);
}
}
@@ -374,7 +372,7 @@ void BranchDialog::merge()
return;
allowFastForward = (chosen == fastForward);
}
- if (client->beginStashScope(m_repository, QLatin1String("merge"), AllowUnstashed))
+ if (client->beginStashScope(m_repository, "merge", AllowUnstashed))
client->synchronousMerge(m_repository, branch, allowFastForward);
}
@@ -387,7 +385,7 @@ void BranchDialog::rebase()
const QString baseBranch = m_model->fullName(idx, true);
GitClient *client = GitPlugin::client();
- if (client->beginStashScope(m_repository, QLatin1String("rebase")))
+ if (client->beginStashScope(m_repository, "rebase"))
client->rebase(m_repository, baseBranch);
}
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp
index e1e41d5043..c265443d67 100644
--- a/src/plugins/git/branchmodel.cpp
+++ b/src/plugins/git/branchmodel.cpp
@@ -54,7 +54,7 @@ class BranchNode
public:
BranchNode() :
parent(0),
- name(QLatin1String("<ROOT>"))
+ name("<ROOT>")
{ }
BranchNode(const QString &n, const QString &s = QString(), const QString &t = QString(),
@@ -172,7 +172,7 @@ public:
}
return names;
}
- return QStringList(fullName().join(QLatin1Char('/')));
+ return QStringList(fullName().join('/'));
}
int rowOf(BranchNode *node)
@@ -202,8 +202,8 @@ BranchModel::BranchModel(GitClient *client, QObject *parent) :
QTC_CHECK(m_client);
// Abuse the sha field for ref prefix
- m_rootNode->append(new BranchNode(tr("Local Branches"), QLatin1String("refs/heads")));
- m_rootNode->append(new BranchNode(tr("Remote Branches"), QLatin1String("refs/remotes")));
+ m_rootNode->append(new BranchNode(tr("Local Branches"), "refs/heads"));
+ m_rootNode->append(new BranchNode(tr("Remote Branches"), "refs/remotes"));
}
BranchModel::~BranchModel()
@@ -260,7 +260,7 @@ QVariant BranchModel::data(const QModelIndex &index, int role) const
case 0: {
res = node->name;
if (!node->tracking.isEmpty())
- res += QLatin1String(" [") + node->tracking + QLatin1Char(']');
+ res += " [" + node->tracking + ']';
break;
}
case 1:
@@ -316,9 +316,7 @@ bool BranchModel::setData(const QModelIndex &index, const QVariant &value, int r
QString output;
QString errorMessage;
if (!m_client->synchronousBranchCmd(m_workingDirectory,
- QStringList() << QLatin1String("-m")
- << oldFullName.last()
- << newFullName.last(),
+ { "-m", oldFullName.last(), newFullName.last() },
&output, &errorMessage)) {
node->name = oldFullName.last();
VcsOutputWindow::appendError(errorMessage);
@@ -362,15 +360,14 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage
}
m_currentSha = m_client->synchronousTopRevision(workingDirectory);
- QStringList args;
- args << QLatin1String("--format=%(objectname)\t%(refname)\t%(upstream:short)\t"
- "%(*objectname)\t%(committerdate:raw)\t%(*committerdate:raw)");
+ const QStringList args = { "--format=%(objectname)\t%(refname)\t%(upstream:short)\t"
+ "%(*objectname)\t%(committerdate:raw)\t%(*committerdate:raw)" };
QString output;
if (!m_client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage))
VcsOutputWindow::appendError(*errorMessage);
m_workingDirectory = workingDirectory;
- const QStringList lines = output.split(QLatin1Char('\n'));
+ const QStringList lines = output.split('\n');
foreach (const QString &l, lines)
parseOutputLine(l);
@@ -403,8 +400,7 @@ void BranchModel::renameBranch(const QString &oldName, const QString &newName)
{
QString errorMessage;
QString output;
- if (!m_client->synchronousBranchCmd(m_workingDirectory,
- QStringList() << QLatin1String("-m") << oldName << newName,
+ if (!m_client->synchronousBranchCmd(m_workingDirectory, { "-m", oldName, newName },
&output, &errorMessage))
VcsOutputWindow::appendError(errorMessage);
else
@@ -415,11 +411,10 @@ void BranchModel::renameTag(const QString &oldName, const QString &newName)
{
QString errorMessage;
QString output;
- if (!m_client->synchronousTagCmd(m_workingDirectory, QStringList() << newName << oldName,
+ if (!m_client->synchronousTagCmd(m_workingDirectory, { newName, oldName },
&output, &errorMessage)
- || !m_client->synchronousTagCmd(m_workingDirectory,
- QStringList() << QLatin1String("-d") << oldName,
- &output, &errorMessage)) {
+ || !m_client->synchronousTagCmd(m_workingDirectory, { "-d", oldName },
+ &output, &errorMessage)) {
VcsOutputWindow::appendError(errorMessage);
} else {
refresh(m_workingDirectory, &errorMessage);
@@ -451,7 +446,7 @@ QString BranchModel::fullName(const QModelIndex &idx, bool includePrefix) const
if (!node || !node->isLeaf())
return QString();
QStringList path = node->fullName(includePrefix);
- return path.join(QLatin1Char('/'));
+ return path.join('/');
}
QStringList BranchModel::localBranchNames() const
@@ -514,10 +509,8 @@ void BranchModel::removeBranch(const QModelIndex &idx)
QString errorMessage;
QString output;
- QStringList args;
- args << QLatin1String("-D") << branch;
- if (!m_client->synchronousBranchCmd(m_workingDirectory, args, &output, &errorMessage)) {
+ if (!m_client->synchronousBranchCmd(m_workingDirectory, { "-D", branch }, &output, &errorMessage)) {
VcsOutputWindow::appendError(errorMessage);
return;
}
@@ -532,10 +525,8 @@ void BranchModel::removeTag(const QModelIndex &idx)
QString errorMessage;
QString output;
- QStringList args;
- args << QLatin1String("-d") << tag;
- if (!m_client->synchronousTagCmd(m_workingDirectory, args, &output, &errorMessage)) {
+ if (!m_client->synchronousTagCmd(m_workingDirectory, { "-d", tag }, &output, &errorMessage)) {
VcsOutputWindow::appendError(errorMessage);
return;
}
@@ -561,13 +552,13 @@ bool BranchModel::branchIsMerged(const QModelIndex &idx)
QString errorMessage;
QString output;
- QStringList args;
- args << QLatin1String("-a") << QLatin1String("--contains") << sha(idx);
- if (!m_client->synchronousBranchCmd(m_workingDirectory, args, &output, &errorMessage))
+ if (!m_client->synchronousBranchCmd(m_workingDirectory, { "-a", "--contains", sha(idx) },
+ &output, &errorMessage)) {
VcsOutputWindow::appendError(errorMessage);
+ }
- QStringList lines = output.split(QLatin1Char('\n'), QString::SkipEmptyParts);
+ QStringList lines = output.split('\n', QString::SkipEmptyParts);
foreach (const QString &l, lines) {
QString currentBranch = l.mid(2); // remove first letters (those are either
// " " or "* " depending on whether it is
@@ -600,9 +591,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel
QString errorMessage;
QDateTime branchDateTime;
- QStringList args;
- args << (track ? QLatin1String("--track") : QLatin1String("--no-track"));
- args << name;
+ QStringList args = { QLatin1String(track ? "--track" : "--no-track"), name };
if (!fullTrackedBranch.isEmpty()) {
args << fullTrackedBranch;
startSha = sha(startPoint);
@@ -625,7 +614,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel
}
BranchNode *local = m_rootNode->children.at(LocalBranches);
- const int slash = name.indexOf(QLatin1Char('/'));
+ const int slash = name.indexOf('/');
const QString leafName = slash == -1 ? name : name.mid(slash + 1);
bool added = false;
if (slash != -1) {
@@ -675,7 +664,7 @@ void BranchModel::parseOutputLine(const QString &line)
return;
// objectname, refname, upstream:short, *objectname, committerdate:raw, *committerdate:raw
- QStringList lineParts = line.split(QLatin1Char('\t'));
+ QStringList lineParts = line.split('\t');
const QString shaDeref = lineParts.at(3);
const QString sha = shaDeref.isEmpty() ? lineParts.at(0) : shaDeref;
const QString fullName = lineParts.at(1);
@@ -686,29 +675,33 @@ void BranchModel::parseOutputLine(const QString &line)
if (strDateTime.isEmpty())
strDateTime = lineParts.at(4);
if (!strDateTime.isEmpty()) {
- const uint timeT = strDateTime.leftRef(strDateTime.indexOf(QLatin1Char(' '))).toUInt();
+ const uint timeT = strDateTime.leftRef(strDateTime.indexOf(' ')).toUInt();
dateTime = QDateTime::fromTime_t(timeT);
}
if (!m_oldBranchesIncluded && !current && dateTime.isValid()) {
- const int age = dateTime.daysTo(QDateTime::currentDateTime());
- if (age > Constants::OBSOLETE_COMMIT_AGE_IN_DAYS)
+ const qint64 age = dateTime.daysTo(QDateTime::currentDateTime());
+ if (age > Constants::OBSOLETE_COMMIT_AGE_IN_DAYS) {
+ const QString heads = "refs/heads/";
+ if (fullName.startsWith(heads))
+ m_obsoleteLocalBranches.append(fullName.mid(heads.size()));
return;
+ }
}
bool showTags = m_client->settings().boolValue(GitSettings::showTagsKey);
// insert node into tree:
- QStringList nameParts = fullName.split(QLatin1Char('/'));
+ QStringList nameParts = fullName.split('/');
nameParts.removeFirst(); // remove refs...
BranchNode *root = 0;
- if (nameParts.first() == QLatin1String("heads")) {
+ if (nameParts.first() == "heads") {
root = m_rootNode->children.at(LocalBranches);
- } else if (nameParts.first() == QLatin1String("remotes")) {
+ } else if (nameParts.first() == "remotes") {
root = m_rootNode->children.at(RemoteBranches);
- } else if (showTags && nameParts.first() == QLatin1String("tags")) {
+ } else if (showTags && nameParts.first() == "tags") {
if (!hasTags()) // Tags is missing, add it
- m_rootNode->append(new BranchNode(tr("Tags"), QLatin1String("refs/tags")));
+ m_rootNode->append(new BranchNode(tr("Tags"), "refs/tags"));
root = m_rootNode->children.at(Tags);
} else {
return;
@@ -719,7 +712,7 @@ void BranchModel::parseOutputLine(const QString &line)
// limit depth of list. Git basically only ever wants one / and considers the rest as part of
// the name.
while (nameParts.count() > 3) {
- nameParts[2] = nameParts.at(2) + QLatin1Char('/') + nameParts.at(3);
+ nameParts[2] = nameParts.at(2) + '/' + nameParts.at(3);
nameParts.removeAt(3);
}
@@ -770,7 +763,7 @@ QString BranchModel::toolTip(const QString &sha) const
// Show the sha description excluding diff as toolTip
QString output;
QString errorMessage;
- QStringList arguments(QLatin1String("-n1"));
+ QStringList arguments("-n1");
arguments << sha;
if (!m_client->synchronousLog(m_workingDirectory, arguments, &output, &errorMessage,
VcsCommand::SuppressCommandLogging)) {
diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp
index bb429c9aa4..a90fc281df 100644
--- a/src/plugins/git/changeselectiondialog.cpp
+++ b/src/plugins/git/changeselectiondialog.cpp
@@ -119,7 +119,7 @@ void ChangeSelectionDialog::selectCommitFromRecentHistory()
return;
QString commit = change();
- int tilde = commit.indexOf(QLatin1Char('~'));
+ int tilde = commit.indexOf('~');
if (tilde != -1)
commit.truncate(tilde);
LogChangeDialog dialog(false, this);
@@ -219,12 +219,11 @@ void ChangeSelectionDialog::recalculateCompletion()
return;
GitClient *client = GitPlugin::client();
- QStringList args;
- args << QLatin1String("--format=%(refname:short)");
- VcsBase::VcsCommand *command = client->asyncForEachRefCmd(workingDir, args);
+ VcsBase::VcsCommand *command = client->asyncForEachRefCmd(
+ workingDir, { "--format=%(refname:short)" });
connect(this, &QObject::destroyed, command, &VcsBase::VcsCommand::abort);
connect(command, &VcsBase::VcsCommand::stdOutText, [this](const QString &output) {
- m_changeModel->setStringList(output.split(QLatin1Char('\n')));
+ m_changeModel->setStringList(output.split('\n'));
});
}
@@ -245,9 +244,6 @@ void ChangeSelectionDialog::recalculateDetails()
return;
}
- QStringList args;
- args << QLatin1String("show") << QLatin1String("--stat=80") << ref;
-
m_process = new QProcess(this);
m_process->setWorkingDirectory(workingDir);
m_process->setProcessEnvironment(m_gitEnvironment);
@@ -255,7 +251,7 @@ void ChangeSelectionDialog::recalculateDetails()
connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
this, &ChangeSelectionDialog::setDetails);
- m_process->start(m_gitExecutable.toString(), args);
+ m_process->start(m_gitExecutable.toString(), { "show", "--stat=80", ref });
m_process->closeWriteChannel();
if (!m_process->waitForStarted())
m_ui->detailsText->setPlainText(tr("Error: Could not start Git."));
diff --git a/src/plugins/git/commitdata.cpp b/src/plugins/git/commitdata.cpp
index 8cb0cbee68..3ba792ae50 100644
--- a/src/plugins/git/commitdata.cpp
+++ b/src/plugins/git/commitdata.cpp
@@ -54,9 +54,9 @@ QString GitSubmitEditorPanelData::authorString() const
if (email.isEmpty())
return rc;
- rc += QLatin1String(" <");
+ rc += " <";
rc += email;
- rc += QLatin1Char('>');
+ rc += '>';
return rc;
}
@@ -114,7 +114,7 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
{
QTC_ASSERT(stateInfo.count() == 2, return false);
- if (stateInfo == QLatin1String("??")) {
+ if (stateInfo == "??") {
files.append(qMakePair(FileStates(UntrackedFile), file));
return true;
}
@@ -143,7 +143,7 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
if (yState != EmptyFileState) {
QString newFile = file;
if (xState & (RenamedFile | CopiedFile))
- newFile = file.mid(file.indexOf(QLatin1String(" -> ")) + 4);
+ newFile = file.mid(file.indexOf(" -> ") + 4);
files.append(qMakePair(yState, newFile));
}
@@ -159,20 +159,20 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
\endcode */
bool CommitData::parseFilesFromStatus(const QString &output)
{
- const QStringList lines = output.split(QLatin1Char('\n'));
+ const QStringList lines = output.split('\n');
foreach (const QString &line, lines) {
if (line.isEmpty())
continue;
- if (line.startsWith(QLatin1String("## "))) {
+ if (line.startsWith("## ")) {
// Branch indication:
panelInfo.branch = line.mid(3);
continue;
}
- QTC_ASSERT(line.at(2) == QLatin1Char(' '), continue);
+ QTC_ASSERT(line.at(2) == ' ', continue);
QString file = line.mid(3);
- if (file.startsWith(QLatin1Char('"')))
+ if (file.startsWith('"'))
file.remove(0, 1).chop(1);
if (!checkLine(line.mid(0, 2), file))
return false;
diff --git a/src/plugins/git/gerrit/branchcombobox.cpp b/src/plugins/git/gerrit/branchcombobox.cpp
index 6e270961b7..6863f0e803 100644
--- a/src/plugins/git/gerrit/branchcombobox.cpp
+++ b/src/plugins/git/gerrit/branchcombobox.cpp
@@ -39,16 +39,16 @@ void BranchComboBox::init(const QString &repository)
QString currentBranch = GitPlugin::client()->synchronousCurrentLocalBranch(repository);
if (currentBranch.isEmpty()) {
m_detached = true;
- currentBranch = QLatin1String("HEAD");
+ currentBranch = "HEAD";
addItem(currentBranch);
}
QString output;
- const QString branchPrefix(QLatin1String("refs/heads/"));
- QStringList args;
- args << QLatin1String("--format=%(refname)") << branchPrefix;
- if (!GitPlugin::client()->synchronousForEachRefCmd(m_repository, args, &output))
+ const QString branchPrefix("refs/heads/");
+ if (!GitPlugin::client()->synchronousForEachRefCmd(
+ m_repository, { "--format=%(refname)", branchPrefix }, &output)) {
return;
- QStringList branches = output.trimmed().split(QLatin1Char('\n'));
+ }
+ QStringList branches = output.trimmed().split('\n');
foreach (const QString &ref, branches) {
const QString branch = ref.mid(branchPrefix.size());
addItem(branch);
diff --git a/src/plugins/git/gerrit/gerritdialog.cpp b/src/plugins/git/gerrit/gerritdialog.cpp
index 8b03644c12..a0db0c837b 100644
--- a/src/plugins/git/gerrit/gerritdialog.cpp
+++ b/src/plugins/git/gerrit/gerritdialog.cpp
@@ -69,7 +69,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
, m_filterLineEdit(new Utils::FancyLineEdit)
, m_repositoryChooser(new Utils::PathChooser)
, m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Close))
- , m_repositoryChooserLabel(new QLabel(tr("Apply in:") + QLatin1Char(' '), this))
+ , m_repositoryChooserLabel(new QLabel(tr("Apply in:") + ' ', this))
, m_fetchRunning(false)
{
setWindowTitle(tr("Gerrit %1@%2").arg(p->user, p->host));
@@ -144,7 +144,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
detailsLayout->addWidget(m_detailsBrowser);
m_repositoryChooser->setExpectedKind(Utils::PathChooser::Directory);
- m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History"));
+ m_repositoryChooser->setHistoryCompleter("Git.RepoDir.History");
QHBoxLayout *repoPathLayout = new QHBoxLayout;
repoPathLayout->addWidget(m_repositoryChooserLabel);
repoPathLayout->addWidget(m_repositoryChooser);
diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp
index f4dea2796a..42da70807c 100644
--- a/src/plugins/git/gerrit/gerritmodel.cpp
+++ b/src/plugins/git/gerrit/gerritmodel.cpp
@@ -86,9 +86,9 @@ QDebug operator<<(QDebug d, const GerritChange &c)
// Format default Url for a change
static inline QString defaultUrl(const QSharedPointer<GerritParameters> &p, int gerritNumber)
{
- QString result = p->https ? QLatin1String("https://") : QLatin1String("http://");
+ QString result = QLatin1String(p->https ? "https://" : "http://");
result += p->host;
- result += QLatin1Char('/');
+ result += '/';
result += QString::number(gerritNumber);
return result;
}
@@ -146,7 +146,7 @@ QString GerritPatchSet::approvalsColumn() const
TypeReviewMap reviews; // Sort approvals into a map by type character
foreach (const GerritApproval &a, approvals) {
- if (a.type != QLatin1String("STGN")) { // Qt-Project specific: Ignore "STGN" (Staged)
+ if (a.type != "STGN") { // Qt-Project specific: Ignore "STGN" (Staged)
const QChar typeChar = a.type.at(0);
TypeReviewMapIterator it = reviews.find(typeChar);
if (it == reviews.end())
@@ -183,7 +183,7 @@ int GerritPatchSet::approvalLevel() const
QString GerritChange::filterString() const
{
- const QChar blank = QLatin1Char(' ');
+ const QChar blank = ' ';
QString result = QString::number(number) + blank + title + blank
+ owner + blank + project + blank
+ branch + blank + status;
@@ -197,10 +197,10 @@ QString GerritChange::filterString() const
QStringList GerritChange::gitFetchArguments(const QSharedPointer<GerritParameters> &p) const
{
QStringList arguments;
- const QString url = QLatin1String("ssh://") + p->sshHostArgument()
- + QLatin1Char(':') + QString::number(p->port) + QLatin1Char('/')
+ const QString url = "ssh://" + p->sshHostArgument()
+ + ':' + QString::number(p->port) + '/'
+ project;
- arguments << QLatin1String("fetch") << url << currentPatchSet.ref;
+ arguments << "fetch" << url << currentPatchSet.ref;
return arguments;
}
@@ -276,9 +276,9 @@ QueryContext::QueryContext(const QStringList &queries,
m_progress.setProgressRange(0, m_queries.size());
// Determine binary and common command line arguments.
- m_baseArguments << QLatin1String("query") << QLatin1String("--dependencies")
- << QLatin1String("--current-patch-set")
- << QLatin1String("--format=JSON");
+ m_baseArguments << "query" << "--dependencies"
+ << "--current-patch-set"
+ << "--format=JSON";
m_binary = m_baseArguments.front();
m_baseArguments.pop_front();
@@ -404,7 +404,7 @@ GerritModel::GerritModel(const QSharedPointer<GerritParameters> &p, QObject *par
, m_parameters(p)
{
QStringList headers; // Keep in sync with GerritChange::toHtml()
- headers << QLatin1String("#") << tr("Subject") << tr("Owner")
+ headers << "#" << tr("Subject") << tr("Owner")
<< tr("Updated") << tr("Project")
<< tr("Approvals") << tr("Status");
setHorizontalHeaderLabels(headers);
@@ -463,7 +463,7 @@ QString GerritModel::toHtml(const QModelIndex& index) const
if (!index.isValid())
return QString();
const GerritChangePtr c = change(index);
- const QString serverPrefix = c->url.left(c->url.lastIndexOf(QLatin1Char('/')) + 1);
+ const QString serverPrefix = c->url.left(c->url.lastIndexOf('/') + 1);
QString result;
QTextStream str(&result);
str << "<html><head/><body><table>"
@@ -522,14 +522,14 @@ void GerritModel::refresh(const QString &query)
queries.push_back(query);
else
{
- const QString statusOpenQuery = QLatin1String("status:open");
+ const QString statusOpenQuery = "status:open";
if (m_parameters->user.isEmpty()) {
queries.push_back(statusOpenQuery);
} else {
// Owned by:
- queries.push_back(statusOpenQuery + QLatin1String(" owner:") + m_parameters->user);
+ queries.push_back(statusOpenQuery + " owner:" + m_parameters->user);
// For Review by:
- queries.push_back(statusOpenQuery + QLatin1String(" reviewer:") + m_parameters->user);
+ queries.push_back(statusOpenQuery + " reviewer:" + m_parameters->user);
}
}
@@ -578,27 +578,27 @@ static bool parseOutput(const QSharedPointer<GerritParameters> &parameters,
QList<GerritChangePtr> &result)
{
// The output consists of separate lines containing a document each
- const QString typeKey = QLatin1String("type");
- const QString dependsOnKey = QLatin1String("dependsOn");
- const QString neededByKey = QLatin1String("neededBy");
- const QString branchKey = QLatin1String("branch");
- const QString numberKey = QLatin1String("number");
- const QString ownerKey = QLatin1String("owner");
- const QString ownerNameKey = QLatin1String("name");
- const QString ownerEmailKey = QLatin1String("email");
- const QString statusKey = QLatin1String("status");
- const QString projectKey = QLatin1String("project");
- const QString titleKey = QLatin1String("subject");
- const QString urlKey = QLatin1String("url");
- const QString patchSetKey = QLatin1String("currentPatchSet");
- const QString refKey = QLatin1String("ref");
- const QString approvalsKey = QLatin1String("approvals");
- const QString approvalsValueKey = QLatin1String("value");
- const QString approvalsByKey = QLatin1String("by");
- const QString lastUpdatedKey = QLatin1String("lastUpdated");
+ const QString typeKey = "type";
+ const QString dependsOnKey = "dependsOn";
+ const QString neededByKey = "neededBy";
+ const QString branchKey = "branch";
+ const QString numberKey = "number";
+ const QString ownerKey = "owner";
+ const QString ownerNameKey = "name";
+ const QString ownerEmailKey = "email";
+ const QString statusKey = "status";
+ const QString projectKey = "project";
+ const QString titleKey = "subject";
+ const QString urlKey = "url";
+ const QString patchSetKey = "currentPatchSet";
+ const QString refKey = "ref";
+ const QString approvalsKey = "approvals";
+ const QString approvalsValueKey = "value";
+ const QString approvalsByKey = "by";
+ const QString lastUpdatedKey = "lastUpdated";
const QList<QByteArray> lines = output.split('\n');
- const QString approvalsTypeKey = QLatin1String("type");
- const QString approvalsDescriptionKey = QLatin1String("description");
+ const QString approvalsTypeKey = "type";
+ const QString approvalsDescriptionKey = "description";
bool res = true;
result.clear();
@@ -712,8 +712,8 @@ QList<QStandardItem *> GerritModel::changeToRow(const GerritChangePtr &c) const
row[DateColumn]->setData(c->lastUpdated, SortRole);
QString project = c->project;
- if (c->branch != QLatin1String("master"))
- project += QLatin1String(" (") + c->branch + QLatin1Char(')');
+ if (c->branch != "master")
+ project += " (" + c->branch + ')';
row[ProjectColumn]->setText(project);
row[StatusColumn]->setText(c->status);
row[ApprovalsColumn]->setText(c->currentPatchSet.approvalsColumn());
@@ -759,7 +759,7 @@ void GerritModel::queryFinished(const QByteArray &output)
changes.at(i)->depth = 0;
} else {
const int dependsOnIndex = numberIndexHash.value(changes.at(i)->dependsOnNumber, -1);
- if (dependsOnIndex < 0 || changes.at(dependsOnIndex)->status != QLatin1String("NEW"))
+ if (dependsOnIndex < 0 || changes.at(dependsOnIndex)->status != "NEW")
changes.at(i)->depth = 0;
}
}
@@ -798,7 +798,7 @@ void GerritModel::queryFinished(const QByteArray &output)
for (; changeFromItem(parent)->depth >= 1; parent = parent->parent()) {}
parent->appendRow(newRow);
QString parentFilterString = parent->data(FilterRole).toString();
- parentFilterString += QLatin1Char(' ');
+ parentFilterString += ' ';
parentFilterString += newRow.first()->data(FilterRole).toString();
parent->setData(QVariant(parentFilterString), FilterRole);
} else {
diff --git a/src/plugins/git/gerrit/gerritoptionspage.cpp b/src/plugins/git/gerrit/gerritoptionspage.cpp
index 3745b8f422..68481fcc58 100644
--- a/src/plugins/git/gerrit/gerritoptionspage.cpp
+++ b/src/plugins/git/gerrit/gerritoptionspage.cpp
@@ -93,8 +93,8 @@ GerritOptionsWidget::GerritOptionsWidget(QWidget *parent)
formLayout->addRow(tr("&Host:"), m_hostLineEdit);
formLayout->addRow(tr("&User:"), m_userLineEdit);
m_sshChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
- m_sshChooser->setCommandVersionArguments(QStringList(QLatin1String("-V")));
- m_sshChooser->setHistoryCompleter(QLatin1String("Git.SshCommand.History"));
+ m_sshChooser->setCommandVersionArguments(QStringList("-V"));
+ m_sshChooser->setHistoryCompleter("Git.SshCommand.History");
formLayout->addRow(tr("&ssh:"), m_sshChooser);
m_portSpinBox->setMinimum(1);
m_portSpinBox->setMaximum(65535);
diff --git a/src/plugins/git/gerrit/gerritparameters.cpp b/src/plugins/git/gerrit/gerritparameters.cpp
index 64058ae668..e541afcda5 100644
--- a/src/plugins/git/gerrit/gerritparameters.cpp
+++ b/src/plugins/git/gerrit/gerritparameters.cpp
@@ -57,13 +57,13 @@ static inline QString detectSsh()
const QByteArray gitSsh = qgetenv("GIT_SSH");
if (!gitSsh.isEmpty())
return QString::fromLocal8Bit(gitSsh);
- QString ssh = QStandardPaths::findExecutable(QLatin1String(defaultSshC));
+ QString ssh = QStandardPaths::findExecutable(defaultSshC);
if (!ssh.isEmpty())
return ssh;
if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
Utils::FileName path = GerritPlugin::gitBinDirectory();
if (!path.isEmpty())
- ssh = path.appendPath(QLatin1String(defaultSshC)).toString();
+ ssh = path.appendPath(defaultSshC).toString();
}
return ssh;
}
@@ -72,17 +72,17 @@ void GerritParameters::setPortFlagBySshType()
{
bool isPlink = false;
if (!ssh.isEmpty()) {
- const QString version = Utils::PathChooser::toolVersion(ssh, QStringList(QLatin1String("-V")));
- isPlink = version.contains(QLatin1String("plink"), Qt::CaseInsensitive);
+ const QString version = Utils::PathChooser::toolVersion(ssh, QStringList("-V"));
+ isPlink = version.contains("plink", Qt::CaseInsensitive);
}
- portFlag = isPlink ? QLatin1String("-P") : QLatin1String(defaultPortFlag);
+ portFlag = isPlink ? "-P" : defaultPortFlag;
}
GerritParameters::GerritParameters()
- : host(QLatin1String(defaultHostC))
+ : host(defaultHostC)
, port(defaultPort)
, https(true)
- , portFlag(QLatin1String(defaultPortFlag))
+ , portFlag(defaultPortFlag)
{
}
@@ -90,13 +90,13 @@ QStringList GerritParameters::baseCommandArguments() const
{
QStringList result;
result << ssh << portFlag << QString::number(port)
- << sshHostArgument() << QLatin1String("gerrit");
+ << sshHostArgument() << "gerrit";
return result;
}
QString GerritParameters::sshHostArgument() const
{
- return user.isEmpty() ? host : (user + QLatin1Char('@') + host);
+ return user.isEmpty() ? host : (user + '@' + host);
}
bool GerritParameters::equals(const GerritParameters &rhs) const
@@ -107,34 +107,34 @@ bool GerritParameters::equals(const GerritParameters &rhs) const
void GerritParameters::toSettings(QSettings *s) const
{
- s->beginGroup(QLatin1String(settingsGroupC));
- s->setValue(QLatin1String(hostKeyC), host);
- s->setValue(QLatin1String(userKeyC), user);
- s->setValue(QLatin1String(portKeyC), port);
- s->setValue(QLatin1String(portFlagKeyC), portFlag);
- s->setValue(QLatin1String(sshKeyC), ssh);
- s->setValue(QLatin1String(httpsKeyC), https);
+ s->beginGroup(settingsGroupC);
+ s->setValue(hostKeyC, host);
+ s->setValue(userKeyC, user);
+ s->setValue(portKeyC, port);
+ s->setValue(portFlagKeyC, portFlag);
+ s->setValue(sshKeyC, ssh);
+ s->setValue(httpsKeyC, https);
s->endGroup();
}
void GerritParameters::saveQueries(QSettings *s) const
{
- s->beginGroup(QLatin1String(settingsGroupC));
- s->setValue(QLatin1String(savedQueriesKeyC), savedQueries.join(QLatin1Char(',')));
+ s->beginGroup(settingsGroupC);
+ s->setValue(savedQueriesKeyC, savedQueries.join(','));
s->endGroup();
}
void GerritParameters::fromSettings(const QSettings *s)
{
- const QString rootKey = QLatin1String(settingsGroupC) + QLatin1Char('/');
- host = s->value(rootKey + QLatin1String(hostKeyC), QLatin1String(defaultHostC)).toString();
- user = s->value(rootKey + QLatin1String(userKeyC), QString()).toString();
- ssh = s->value(rootKey + QLatin1String(sshKeyC), QString()).toString();
- port = s->value(rootKey + QLatin1String(portKeyC), QVariant(int(defaultPort))).toInt();
- portFlag = s->value(rootKey + QLatin1String(portFlagKeyC), QLatin1String(defaultPortFlag)).toString();
- savedQueries = s->value(rootKey + QLatin1String(savedQueriesKeyC), QString()).toString()
- .split(QLatin1Char(','));
- https = s->value(rootKey + QLatin1String(httpsKeyC), QVariant(true)).toBool();
+ const QString rootKey = QLatin1String(settingsGroupC) + '/';
+ host = s->value(rootKey + hostKeyC, defaultHostC).toString();
+ user = s->value(rootKey + userKeyC, QString()).toString();
+ ssh = s->value(rootKey + sshKeyC, QString()).toString();
+ port = s->value(rootKey + portKeyC, QVariant(int(defaultPort))).toInt();
+ portFlag = s->value(rootKey + portFlagKeyC, defaultPortFlag).toString();
+ savedQueries = s->value(rootKey + savedQueriesKeyC, QString()).toString()
+ .split(',');
+ https = s->value(rootKey + httpsKeyC, QVariant(true)).toBool();
if (ssh.isEmpty())
ssh = detectSsh();
}
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp
index c273562a38..5f6ac4517a 100644
--- a/src/plugins/git/gerrit/gerritplugin.cpp
+++ b/src/plugins/git/gerrit/gerritplugin.cpp
@@ -243,9 +243,9 @@ void FetchContext::processError(QProcess::ProcessError e)
void FetchContext::show()
{
- const QString title = QString::number(m_change->number) + QLatin1Char('/')
+ const QString title = QString::number(m_change->number) + '/'
+ QString::number(m_change->currentPatchSet.patchSetNumber);
- GitPlugin::client()->show(m_repository, QLatin1String("FETCH_HEAD"), title);
+ GitPlugin::client()->show(m_repository, "FETCH_HEAD", title);
}
void FetchContext::cherryPick()
@@ -253,12 +253,12 @@ void FetchContext::cherryPick()
// Point user to errors.
VcsBase::VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch
| IOutputPane::WithFocus);
- GitPlugin::client()->synchronousCherryPick(m_repository, QLatin1String("FETCH_HEAD"));
+ GitPlugin::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
}
void FetchContext::checkout()
{
- GitPlugin::client()->stashAndCheckout(m_repository, QLatin1String("FETCH_HEAD"));
+ GitPlugin::client()->stashAndCheckout(m_repository, "FETCH_HEAD");
}
void FetchContext::terminate()
@@ -326,31 +326,26 @@ void GerritPlugin::push(const QString &topLevel)
if (dialog.exec() == QDialog::Rejected)
return;
- QStringList args;
-
m_reviewers = dialog.reviewers();
- args << dialog.selectedRemoteName();
QString target = dialog.selectedCommit();
if (target.isEmpty())
- target = QLatin1String("HEAD");
- target += QLatin1String(":refs/") + dialog.selectedPushType() +
- QLatin1Char('/') + dialog.selectedRemoteBranchName();
+ target = "HEAD";
+ target += ":refs/" + dialog.selectedPushType() +
+ '/' + dialog.selectedRemoteBranchName();
const QString topic = dialog.selectedTopic();
if (!topic.isEmpty())
- target += QLatin1Char('/') + topic;
+ target += '/' + topic;
QStringList options;
- const QStringList reviewers = m_reviewers.split(QLatin1Char(','), QString::SkipEmptyParts);
+ const QStringList reviewers = m_reviewers.split(',', QString::SkipEmptyParts);
foreach (const QString &reviewer, reviewers)
- options << QLatin1String("r=") + reviewer;
+ options << "r=" + reviewer;
if (!options.isEmpty())
- target += QLatin1Char('%') + options.join(QLatin1Char(','));
-
- args << target;
+ target += '%' + options.join(',');
- GitPlugin::client()->push(topLevel, args);
+ GitPlugin::client()->push(topLevel, { dialog.selectedRemoteName(), target });
}
// Open or raise the Gerrit dialog window.
@@ -432,7 +427,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
if (!remotesList.isEmpty()) {
QStringList remotes = remotesList.values();
foreach (QString remote, remotes) {
- if (remote.endsWith(QLatin1String(".git")))
+ if (remote.endsWith(".git"))
remote.chop(4);
if (remote.contains(m_parameters->host) && remote.endsWith(change->project)) {
verifiedRepository = true;
@@ -444,11 +439,11 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
SubmoduleDataMap submodules = GitPlugin::client()->submoduleList(repository);
foreach (const SubmoduleData &submoduleData, submodules) {
QString remote = submoduleData.url;
- if (remote.endsWith(QLatin1String(".git")))
+ if (remote.endsWith(".git"))
remote.chop(4);
if (remote.contains(m_parameters->host) && remote.endsWith(change->project)
- && QFile::exists(repository + QLatin1Char('/') + submoduleData.dir)) {
- repository = QDir::cleanPath(repository + QLatin1Char('/')
+ && QFile::exists(repository + '/' + submoduleData.dir)) {
+ repository = QDir::cleanPath(repository + '/'
+ submoduleData.dir);
verifiedRepository = true;
break;
@@ -504,18 +499,18 @@ QString GerritPlugin::findLocalRepository(QString project, const QString &branch
{
const QStringList gitRepositories = VcsManager::repositories(GitPlugin::instance()->gitVersionControl());
// Determine key (file name) to look for (qt/qtbase->'qtbase').
- const int slashPos = project.lastIndexOf(QLatin1Char('/'));
+ const int slashPos = project.lastIndexOf('/');
if (slashPos != -1)
project.remove(0, slashPos + 1);
// When looking at branch 1.7, try to check folders
// "qtbase_17", 'qtbase1.7' with a semi-smart regular expression.
QScopedPointer<QRegExp> branchRegexp;
- if (!branch.isEmpty() && branch != QLatin1String("master")) {
+ if (!branch.isEmpty() && branch != "master") {
QString branchPattern = branch;
- branchPattern.replace(QLatin1Char('.'), QLatin1String("[\\.-_]?"));
- const QString pattern = QLatin1Char('^') + project
- + QLatin1String("[-_]?")
- + branchPattern + QLatin1Char('$');
+ branchPattern.replace('.', "[\\.-_]?");
+ const QString pattern = '^' + project
+ + "[-_]?"
+ + branchPattern + '$';
branchRegexp.reset(new QRegExp(pattern));
if (!branchRegexp->isValid())
branchRegexp.reset(); // Oops.
diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp
index c33bf231b7..1c42c67b88 100644
--- a/src/plugins/git/gerrit/gerritpushdialog.cpp
+++ b/src/plugins/git/gerrit/gerritpushdialog.cpp
@@ -45,7 +45,7 @@ class PushItemDelegate : public IconItemDelegate
{
public:
PushItemDelegate(LogChangeWidget *widget)
- : IconItemDelegate(widget, QLatin1String(":/git/images/arrowup.png"))
+ : IconItemDelegate(widget, ":/git/images/arrowup.png")
{
}
@@ -62,17 +62,16 @@ QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
QString output;
QString error;
- QStringList args;
- args << QLatin1String("-r") << QLatin1String("--contains")
- << earliestCommit + QLatin1Char('^');
- if (!GitPlugin::client()->synchronousBranchCmd(m_workingDir, args, &output, &error))
+ if (!GitPlugin::client()->synchronousBranchCmd(
+ m_workingDir, { "-r", "--contains", earliestCommit + '^' }, &output, &error)) {
return QString();
- const QString head = QLatin1String("/HEAD");
- QStringList refs = output.split(QLatin1Char('\n'));
+ }
+ const QString head = "/HEAD";
+ QStringList refs = output.split('\n');
QString remoteTrackingBranch;
- if (localBranch != QLatin1String("HEAD"))
+ if (localBranch != "HEAD")
remoteTrackingBranch = GitPlugin::client()->synchronousTrackingBranch(m_workingDir, localBranch);
QString remoteBranch;
@@ -94,31 +93,30 @@ QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
void GerritPushDialog::initRemoteBranches()
{
QString output;
- QStringList args;
- const QString head = QLatin1String("/HEAD");
+ const QString head = "/HEAD";
- QString remotesPrefix(QLatin1String("refs/remotes/"));
- args << QLatin1String("--format=%(refname)\t%(committerdate:raw)")
- << remotesPrefix;
- if (!GitPlugin::client()->synchronousForEachRefCmd(m_workingDir, args, &output))
+ QString remotesPrefix("refs/remotes/");
+ if (!GitPlugin::client()->synchronousForEachRefCmd(
+ m_workingDir, { "--format=%(refname)\t%(committerdate:raw)", remotesPrefix }, &output)) {
return;
+ }
- const QStringList refs = output.split(QLatin1String("\n"));
+ const QStringList refs = output.split("\n");
foreach (const QString &reference, refs) {
- QStringList entries = reference.split(QLatin1Char('\t'));
+ QStringList entries = reference.split('\t');
if (entries.count() < 2 || entries.first().endsWith(head))
continue;
const QString ref = entries.at(0).mid(remotesPrefix.size());
- int refBranchIndex = ref.indexOf(QLatin1Char('/'));
- int timeT = entries.at(1).leftRef(entries.at(1).indexOf(QLatin1Char(' '))).toInt();
+ int refBranchIndex = ref.indexOf('/');
+ int timeT = entries.at(1).leftRef(entries.at(1).indexOf(' ')).toInt();
BranchDate bd(ref.mid(refBranchIndex + 1), QDateTime::fromTime_t(timeT).date());
m_remoteBranches.insertMulti(ref.left(refBranchIndex), bd);
}
QStringList remotes = GitPlugin::client()->synchronousRemotesList(m_workingDir).keys();
remotes.removeDuplicates();
{
- const QString origin = QLatin1String("origin");
- const QString gerrit = QLatin1String("gerrit");
+ const QString origin = "origin";
+ const QString gerrit = "gerrit";
if (remotes.removeOne(origin))
remotes.prepend(origin);
if (remotes.removeOne(gerrit))
@@ -155,7 +153,7 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
updateCommits(m_ui->localBranchComboBox->currentIndex());
setRemoteBranches();
- QRegExpValidator *noSpaceValidator = new QRegExpValidator(QRegExp(QLatin1String("^\\S+$")), this);
+ QRegExpValidator *noSpaceValidator = new QRegExpValidator(QRegExp("^\\S+$"), this);
m_ui->reviewersLineEdit->setText(reviewerList);
m_ui->reviewersLineEdit->setValidator(noSpaceValidator);
m_ui->topicLineEdit->setValidator(noSpaceValidator);
@@ -179,16 +177,14 @@ QString GerritPushDialog::selectedCommit() const
QString GerritPushDialog::calculateChangeRange(const QString &branch)
{
QString remote = selectedRemoteName();
- remote += QLatin1Char('/');
+ remote += '/';
remote += selectedRemoteBranchName();
- QStringList args(remote + QLatin1String("..") + branch);
- args << QLatin1String("--count");
-
QString number;
QString error;
- GitPlugin::client()->synchronousRevListCmd(m_workingDir, args, &number, &error);
+ GitPlugin::client()->synchronousRevListCmd(m_workingDir, { remote + ".." + branch, "--count" },
+ &number, &error);
number.chop(1);
return number;
@@ -210,7 +206,7 @@ void GerritPushDialog::setChangeRange()
return;
}
m_ui->infoLabel->show();
- const QString remote = selectedRemoteName() + QLatin1Char('/') + remoteBranchName;
+ const QString remote = selectedRemoteName() + '/' + remoteBranchName;
m_ui->infoLabel->setText(
tr("Number of commits between %1 and %2: %3").arg(branch, remote, range));
}
@@ -259,7 +255,7 @@ void GerritPushDialog::updateCommits(int index)
const QString remoteBranch = determineRemoteBranch(branch);
if (!remoteBranch.isEmpty()) {
- const int slash = remoteBranch.indexOf(QLatin1Char('/'));
+ const int slash = remoteBranch.indexOf('/');
m_suggestedRemoteBranch = remoteBranch.mid(slash + 1);
const QString remote = remoteBranch.left(slash);
@@ -285,7 +281,7 @@ QString GerritPushDialog::selectedRemoteBranchName() const
QString GerritPushDialog::selectedPushType() const
{
- return m_ui->draftCheckBox->isChecked() ? QLatin1String("drafts") : QLatin1String("for");
+ return QLatin1String(m_ui->draftCheckBox->isChecked() ? "drafts" : "for");
}
QString GerritPushDialog::selectedTopic() const
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index e903a58d07..91d58e775d 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -44,6 +44,7 @@
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
+#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
@@ -79,6 +80,7 @@ const char GIT_DIRECTORY[] = ".git";
const char graphLogFormatC[] = "%h %d %an %s %ci";
const char HEAD[] = "HEAD";
const char CHERRY_PICK_HEAD[] = "CHERRY_PICK_HEAD";
+const char stashNamePrefix[] = "stash@{";
const char noColorOption[] = "--no-color";
const char decorateOption[] = "--decorate";
const char showFormatC[] =
@@ -103,7 +105,8 @@ static unsigned diffExecutionFlags()
}
const unsigned silentFlags = unsigned(VcsCommand::SuppressCommandLogging
- | VcsCommand::SuppressStdErr);
+ | VcsCommand::SuppressStdErr
+ | VcsCommand::SuppressFailMessage);
/////////////////////////////////////
@@ -198,14 +201,13 @@ void BaseController::processOutput(const QString &output)
QStringList BaseController::addHeadWhenCommandInProgress() const
{
- QStringList args;
// This is workaround for lack of support for merge commits and resolving conflicts,
// we compare the current state of working tree to the HEAD of current branch
// instead of showing unsupported combined diff format.
GitClient::CommandInProgress commandInProgress = GitPlugin::client()->checkCommandInProgress(m_directory);
if (commandInProgress != GitClient::NoCommand)
- args << HEAD;
- return args;
+ return { HEAD };
+ return QStringList();
}
class RepositoryDiffController : public BaseController
@@ -444,7 +446,7 @@ public:
m_ignoreWSButton->setVisible(diffButton->isChecked());
const QStringList graphArguments = {
"--graph", "--oneline", "--topo-order",
- (QLatin1String("--pretty=format:") + graphLogFormatC)
+ QLatin1String("--pretty=format:") + graphLogFormatC
};
QToolButton *graphButton = addToggleButton(graphArguments, tr("Graph"),
tr("Show textual graph log."));
@@ -473,8 +475,8 @@ public:
// No conflicts => do nothing
if (response.result == SynchronousProcessResponse::Finished)
return;
- handler.readStdOut(response.stdOut);
- handler.readStdErr(response.stdErr);
+ handler.readStdOut(response.stdOut());
+ handler.readStdErr(response.stdErr());
}
private:
@@ -567,20 +569,18 @@ static inline void msgCannotRun(const QString &message, QString *errorMessage)
}
static inline void msgCannotRun(const QStringList &args, const QString &workingDirectory,
- const QByteArray &error, QString *errorMessage)
+ const QString &error, QString *errorMessage)
{
const QString message = GitClient::tr("Cannot run \"%1\" in \"%2\": %3")
.arg("git " + args.join(' '),
QDir::toNativeSeparators(workingDirectory),
- GitClient::commandOutputFromLocal8Bit(error));
+ error);
msgCannotRun(message, errorMessage);
}
// ---------------- GitClient
-const char *GitClient::stashNamePrefix = "stash@{";
-
GitClient::GitClient() : VcsBase::VcsBaseClientImpl(new GitSettings),
m_cachedGitVersion(0),
m_disableEditor(false)
@@ -625,9 +625,8 @@ QString GitClient::findGitDirForRepository(const QString &repositoryDir) const
bool GitClient::managesFile(const QString &workingDirectory, const QString &fileName) const
{
- QByteArray output;
- const QStringList arguments = { "ls-files", "--error-unmatch", fileName };
- return vcsFullySynchronousExec(workingDirectory, arguments, &output, 0, silentFlags);
+ return vcsFullySynchronousExec(workingDirectory, { "ls-files", "--error-unmatch", fileName }).result
+ == SynchronousProcessResponse::Finished;
}
QTextCodec *GitClient::codecFor(GitClient::CodecType codecType, const QString &source) const
@@ -740,7 +739,7 @@ void GitClient::diffFiles(const QString &workingDirectory,
const QStringList &unstagedFileNames,
const QStringList &stagedFileNames) const
{
- requestReload(QLatin1String("Files:") + workingDirectory,
+ requestReload("Files:" + workingDirectory,
workingDirectory, tr("Git Diff Files"),
[this, workingDirectory, stagedFileNames, unstagedFileNames]
(IDocument *doc) -> DiffEditorController* {
@@ -751,7 +750,7 @@ void GitClient::diffFiles(const QString &workingDirectory,
void GitClient::diffProject(const QString &workingDirectory, const QString &projectDirectory) const
{
- requestReload(QLatin1String("Project:") + workingDirectory,
+ requestReload("Project:" + workingDirectory,
workingDirectory, tr("Git Diff Project"),
[this, workingDirectory, projectDirectory]
(IDocument *doc) -> DiffEditorController* {
@@ -762,7 +761,7 @@ void GitClient::diffProject(const QString &workingDirectory, const QString &proj
void GitClient::diffRepository(const QString &workingDirectory)
{
- requestReload(QLatin1String("Repository:") + workingDirectory,
+ requestReload("Repository:" + workingDirectory,
workingDirectory, tr("Git Diff Repository"),
[this, workingDirectory](IDocument *doc) -> DiffEditorController* {
return new RepositoryDiffController(doc, workingDirectory);
@@ -773,7 +772,7 @@ void GitClient::diffFile(const QString &workingDirectory, const QString &fileNam
{
const QString title = tr("Git Diff \"%1\"").arg(fileName);
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, fileName);
- const QString documentId = QLatin1String("File:") + sourceFile;
+ const QString documentId = "File:" + sourceFile;
requestReload(documentId, sourceFile, title,
[this, workingDirectory, fileName]
(IDocument *doc) -> DiffEditorController* {
@@ -785,7 +784,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
const QString &branchName) const
{
const QString title = tr("Git Diff Branch \"%1\"").arg(branchName);
- const QString documentId = QLatin1String("Branch:") + branchName;
+ const QString documentId = "Branch:" + branchName;
requestReload(documentId, workingDirectory, title,
[this, workingDirectory, branchName]
(IDocument *doc) -> DiffEditorController* {
@@ -893,7 +892,7 @@ void GitClient::show(const QString &source, const QString &id, const QString &na
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
if (!repoDirectory.isEmpty())
workingDirectory = repoDirectory;
- const QString documentId = QLatin1String("Show:") + id;
+ const QString documentId = "Show:" + id;
requestReload(documentId, source, title,
[this, workingDirectory, id]
(IDocument *doc) -> DiffEditorController* {
@@ -938,17 +937,17 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
const QString &ref,
QString *errorMessage)
{
- QByteArray outputText;
- QByteArray errorText;
QStringList arguments = setupCheckoutArguments(workingDirectory, ref);
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, 0,
- VcsCommand::ExpectRepoChanges);
- VcsOutputWindow::append(commandOutputFromLocal8Bit(outputText));
- if (rc)
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, VcsCommand::ExpectRepoChanges);
+ VcsOutputWindow::append(resp.stdOut());
+ if (resp.result == SynchronousProcessResponse::Finished) {
updateSubmodulesIfNeeded(workingDirectory, true);
- else
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
- return rc;
+ return true;
+ } else {
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
+ }
}
/* method used to setup arguments for checkout, in case user wants to create local branch */
@@ -1044,76 +1043,72 @@ void GitClient::addFile(const QString &workingDirectory, const QString &fileName
bool GitClient::synchronousLog(const QString &workingDirectory, const QStringList &arguments,
QString *output, QString *errorMessageIn, unsigned flags)
{
- QByteArray outputData;
- QByteArray errorData;
QStringList allArguments = { "log", noColorOption };
allArguments.append(arguments);
- const bool rc = vcsFullySynchronousExec(workingDirectory, allArguments, &outputData, &errorData, flags);
- if (rc) {
- if (QTextCodec *codec = encoding(workingDirectory, "i18n.logOutputEncoding"))
- *output = codec->toUnicode(outputData);
- else
- *output = commandOutputFromLocal8Bit(outputData);
+
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, allArguments, flags, vcsTimeoutS(),
+ encoding(workingDirectory, "i18n.logOutputEncoding"));
+ if (resp.result == SynchronousProcessResponse::Finished) {
+ *output = resp.stdOut();
+ return true;
} else {
msgCannotRun(tr("Cannot obtain log of \"%1\": %2")
- .arg(QDir::toNativeSeparators(workingDirectory),
- commandOutputFromLocal8Bit(errorData)), errorMessageIn);
-
+ .arg(QDir::toNativeSeparators(workingDirectory), resp.stdErr()), errorMessageIn);
+ return false;
}
- return rc;
}
bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files)
{
- QByteArray outputText;
- return vcsFullySynchronousExec(workingDirectory, QStringList({ "add" }) + files, &outputText);
+ return vcsFullySynchronousExec(workingDirectory, QStringList({ "add" }) + files).result
+ == SynchronousProcessResponse::Finished;
}
bool GitClient::synchronousDelete(const QString &workingDirectory,
bool force,
const QStringList &files)
{
- QByteArray outputText;
QStringList arguments = { "rm" };
if (force)
arguments << "--force";
arguments.append(files);
- return vcsFullySynchronousExec(workingDirectory, arguments, &outputText);
+ return vcsFullySynchronousExec(workingDirectory, arguments).result
+ == SynchronousProcessResponse::Finished;
}
bool GitClient::synchronousMove(const QString &workingDirectory,
const QString &from,
const QString &to)
{
- QByteArray outputText;
- return vcsFullySynchronousExec(workingDirectory, { "mv", from, to }, &outputText);
+ return vcsFullySynchronousExec(workingDirectory, { "mv", from, to }).result
+ == SynchronousProcessResponse::Finished;
}
bool GitClient::synchronousReset(const QString &workingDirectory,
const QStringList &files,
QString *errorMessage)
{
- QByteArray outputText;
- QByteArray errorText;
QStringList arguments = { "reset" };
if (files.isEmpty())
arguments << "--hard";
else
arguments << HEAD << "--" << files;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText);
- const QString output = commandOutputFromLocal8Bit(outputText);
- VcsOutputWindow::append(output);
+
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
+ const QString stdOut = resp.stdOut();
+ VcsOutputWindow::append(stdOut);
// Note that git exits with 1 even if the operation is successful
// Assume real failure if the output does not contain "foo.cpp modified"
// or "Unstaged changes after reset" (git 1.7.0).
- if (!rc && (!output.contains("modified") && !output.contains("Unstaged changes after reset"))) {
+ if (resp.result == SynchronousProcessResponse::Finished
+ && (!stdOut.contains("modified") && !stdOut.contains("Unstaged changes after reset"))) {
if (files.isEmpty()) {
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
} else {
msgCannotRun(tr("Cannot reset %n file(s) in \"%1\": %2", 0, files.size())
- .arg(QDir::toNativeSeparators(workingDirectory),
- commandOutputFromLocal8Bit(errorText)),
+ .arg(QDir::toNativeSeparators(workingDirectory), resp.stdErr()),
errorMessage);
}
return false;
@@ -1124,13 +1119,15 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
// Initialize repository
bool GitClient::synchronousInit(const QString &workingDirectory)
{
- QByteArray outputText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, { "init" }, &outputText);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, { "init" });
// '[Re]Initialized...'
- VcsOutputWindow::append(commandOutputFromLocal8Bit(outputText));
- if (rc)
+ VcsOutputWindow::append(resp.stdOut());
+ if (resp.result == SynchronousProcessResponse::Finished) {
resetCachedVcsInfo(workingDirectory);
- return rc;
+ return true;
+ } else {
+ return false;
+ }
}
/* Checkout, supports:
@@ -1145,21 +1142,18 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory, QStrin
revision = HEAD;
if (files.isEmpty())
files = QStringList(".");
- QByteArray outputText;
- QByteArray errorText;
QStringList arguments = { "checkout" };
if (revertStaging)
arguments << revision;
arguments << "--" << files;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText,
- VcsCommand::ExpectRepoChanges);
- if (!rc) {
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, VcsCommand::ExpectRepoChanges);
+ if (resp.result != SynchronousProcessResponse::Finished) {
const QString fileArg = files.join(", ");
//: Meaning of the arguments: %1: revision, %2: files, %3: repository,
//: %4: Error message
msgCannotRun(tr("Cannot checkout \"%1\" of %2 in \"%3\": %4")
- .arg(revision, fileArg, workingDirectory,
- commandOutputFromLocal8Bit(errorText)),
+ .arg(revision, fileArg, workingDirectory, resp.stdErr()),
errorMessage);
return false;
}
@@ -1212,16 +1206,14 @@ static inline bool splitCommitParents(const QString &line,
bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QStringList &extraArguments,
QString *output, QString *errorMessage) const
{
- QByteArray outputTextData;
- QByteArray errorText;
const QStringList arguments = QStringList({ "rev-list", noColorOption }) + extraArguments;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputTextData,
- &errorText, silentFlags);
- if (!rc) {
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, silentFlags);
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
return false;
}
- *output = commandOutputFromLocal8Bit(outputTextData);
+ *output = resp.stdOut();
return true;
}
@@ -1273,11 +1265,11 @@ QString GitClient::synchronousShortDescription(const QString &workingDirectory,
QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory) const
{
- QByteArray outputTextData;
QString branch;
- if (vcsFullySynchronousExec(workingDirectory, { "symbolic-ref", HEAD }, &outputTextData, 0,
- silentFlags)) {
- branch = commandOutputFromLocal8Bit(outputTextData.trimmed());
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, { "symbolic-ref", HEAD }, silentFlags);
+ if (resp.result == SynchronousProcessResponse::Finished) {
+ branch = resp.stdOut().trimmed();
} else {
const QString gitDir = findGitDirForRepository(workingDirectory);
const QString rebaseHead = gitDir + "/rebase-merge/head-name";
@@ -1299,28 +1291,20 @@ bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList
QString *errorMessage) const
{
const QStringList arguments = { "show-ref", "--head", "--abbrev=10", "--dereference" };
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText,
- silentFlags);
- if (!rc) {
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, silentFlags);
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
return false;
}
- QByteArray headSha = outputText.left(10);
- QByteArray newLine("\n");
+ const QString stdOut = resp.stdOut();
+ const QString headSha = stdOut.left(10);
+ QString rest = stdOut.mid(15);
- int currentIndex = 15;
-
- while (true) {
- currentIndex = outputText.indexOf(headSha, currentIndex);
- if (currentIndex < 0)
- break;
- currentIndex += 11;
- output->append(QString::fromLocal8Bit(outputText.mid(currentIndex,
- outputText.indexOf(newLine, currentIndex) - currentIndex)));
- }
+ const QStringList headShaLines = Utils::filtered(
+ rest.split('\n'), [&headSha](const QString &s) { return s.startsWith(headSha); });
+ *output = Utils::transform(headShaLines, [](const QString &s) { return s.mid(11); }); // sha + space
return true;
}
@@ -1356,11 +1340,12 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const
return remoteBranch;
// No tag or remote branch - try git describe
- QByteArray output;
- if (vcsFullySynchronousExec(workingDirectory, { "describe" }, &output, 0, VcsCommand::NoOutput)) {
- const QString describeOutput = commandOutputFromLocal8Bit(output.trimmed());
- if (!describeOutput.isEmpty())
- return describeOutput;
+ const SynchronousProcessResponse resp =
+ vcsFullySynchronousExec(workingDirectory, { "describe" }, VcsCommand::NoOutput);
+ if (resp.result == SynchronousProcessResponse::Finished) {
+ const QString stdOut = resp.stdOut().trimmed();
+ if (!stdOut.isEmpty())
+ return stdOut;
}
return tr("Detached HEAD");
}
@@ -1369,15 +1354,15 @@ bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QS
QString *output, QString *errorMessage) const
{
const QStringList arguments = { "rev-parse", ref };
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText,
- silentFlags);
- *output = commandOutputFromLocal8Bit(outputText.trimmed());
- if (!rc)
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, silentFlags);
+ *output = resp.stdOut().trimmed();
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
+ }
- return rc;
+ return true;
}
// Retrieve head revision
@@ -1393,28 +1378,27 @@ QString GitClient::synchronousTopRevision(const QString &workingDirectory, QStri
void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QString &precedes, QString &follows) const
{
- QByteArray pr;
- vcsFullySynchronousExec(workingDirectory, { "describe", "--contains", revision },
- &pr, 0, silentFlags);
- int tilde = pr.indexOf('~');
+ const SynchronousProcessResponse resp1 = vcsFullySynchronousExec(
+ workingDirectory, { "describe", "--contains", revision }, silentFlags);
+ precedes = resp1.stdOut();
+ int tilde = precedes.indexOf('~');
if (tilde != -1)
- pr.truncate(tilde);
+ precedes.truncate(tilde);
else
- pr = pr.trimmed();
- precedes = QString::fromLocal8Bit(pr);
+ precedes = precedes.trimmed();
QStringList parents;
QString errorMessage;
synchronousParentRevisions(workingDirectory, revision, &parents, &errorMessage);
foreach (const QString &p, parents) {
- QByteArray pf;
- vcsFullySynchronousExec(workingDirectory, { "describe", "--tags", "--abbrev=0", p },
- &pf, 0, silentFlags);
+ const SynchronousProcessResponse resp2 = vcsFullySynchronousExec(
+ workingDirectory, { "describe", "--tags", "--abbrev=0", p }, silentFlags);
+ QString pf = resp2.stdOut();
pf.truncate(pf.lastIndexOf('\n'));
if (!pf.isEmpty()) {
if (!follows.isEmpty())
follows += ", ";
- follows += QString::fromLocal8Bit(pf);
+ follows += pf;
}
}
}
@@ -1432,41 +1416,31 @@ void GitClient::branchesForCommit(const QString &revision)
bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &commit)
{
- QByteArray outputText;
- vcsFullySynchronousExec(workingDirectory, { "branch", "-r", "--contains", commit },
- &outputText, 0, silentFlags);
- return !outputText.isEmpty();
+ return !vcsFullySynchronousExec(
+ workingDirectory, { "branch", "-r", "--contains", commit }, silentFlags).rawStdOut.isEmpty();
}
bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch)
{
- QByteArray outputText;
- vcsFullySynchronousExec(workingDirectory, { "merge-base", HEAD, branch },
- &outputText, 0, silentFlags);
- return commandOutputFromLocal8Bit(outputText).trimmed()
- == synchronousTopRevision(workingDirectory);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, { "merge-base", HEAD, branch }, silentFlags);
+ return resp.stdOut().trimmed() == synchronousTopRevision(workingDirectory);
}
// Format an entry in a one-liner for selection list using git log.
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision,
const QString &format) const
{
- QString description;
- QByteArray outputTextData;
- QByteArray errorText;
const QStringList arguments = { "log", noColorOption, ("--pretty=format:" + format),
"--max-count=1", revision };
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputTextData, &errorText,
- silentFlags);
- if (!rc) {
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, silentFlags);
+ if (resp.result != SynchronousProcessResponse::Finished) {
VcsOutputWindow::appendSilently(tr("Cannot describe revision \"%1\" in \"%2\": %3")
- .arg(revision, workingDirectory, commandOutputFromLocal8Bit(errorText)));
+ .arg(revision, workingDirectory, resp.stdErr()));
return revision;
}
- description = commandOutputFromLocal8Bit(outputTextData);
- if (description.endsWith('\n'))
- description.truncate(description.size() - 1);
- return description;
+ return stripLastNewline(resp.stdOut());
}
// Create a default message to be used for describing stashes
@@ -1540,12 +1514,13 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
const unsigned flags = VcsCommand::ShowStdOut
| VcsCommand::ExpectRepoChanges
| VcsCommand::ShowSuccessMessage;
- const SynchronousProcessResponse response = vcsSynchronousExec(workingDirectory, arguments, flags);
- const bool rc = response.result == SynchronousProcessResponse::Finished;
- if (!rc)
- msgCannotRun(arguments, workingDirectory, response.stdErr.toLocal8Bit(), errorMessage);
+ const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags);
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
+ }
- return rc;
+ return true;
}
// Resolve a stash name from message
@@ -1554,7 +1529,7 @@ bool GitClient::stashNameFromMessage(const QString &workingDirectory,
QString *errorMessage) const
{
// All happy
- if (message.startsWith(QLatin1String(stashNamePrefix))) {
+ if (message.startsWith(stashNamePrefix)) {
*name = message;
return true;
}
@@ -1578,43 +1553,40 @@ bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringLis
QString *output, QString *errorMessage) const
{
branchArgs.push_front("branch");
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, branchArgs, &outputText, &errorText);
- *output = commandOutputFromLocal8Bit(outputText);
- if (!rc)
- msgCannotRun(branchArgs, workingDirectory, errorText, errorMessage);
-
- return rc;
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, branchArgs);
+ *output = resp.stdOut();
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(branchArgs, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
+ }
+ return true;
}
bool GitClient::synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs,
QString *output, QString *errorMessage) const
{
tagArgs.push_front("tag");
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, tagArgs, &outputText, &errorText);
- *output = commandOutputFromLocal8Bit(outputText);
- if (!rc)
- msgCannotRun(tagArgs, workingDirectory, errorText, errorMessage);
-
- return rc;
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, tagArgs);
+ *output = resp.stdOut();
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(tagArgs, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
+ }
+ return true;
}
bool GitClient::synchronousForEachRefCmd(const QString &workingDirectory, QStringList args,
QString *output, QString *errorMessage) const
{
args.push_front("for-each-ref");
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, args, &outputText, &errorText,
- silentFlags);
- *output = SynchronousProcess::normalizeNewlines(QString::fromUtf8(outputText));
- if (!rc)
- msgCannotRun(args, workingDirectory, errorText, errorMessage);
-
- return rc;
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, args,
+ silentFlags);
+ *output = resp.stdOut();
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(args, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
+ }
+ return true;
}
VcsCommand *GitClient::asyncForEachRefCmd(const QString &workingDirectory, QStringList args) const
@@ -1627,15 +1599,17 @@ bool GitClient::synchronousRemoteCmd(const QString &workingDirectory, QStringLis
QString *output, QString *errorMessage, bool silent) const
{
remoteArgs.push_front("remote");
- QByteArray outputText;
- QByteArray errorText;
- if (!vcsFullySynchronousExec(workingDirectory, remoteArgs, &outputText, &errorText,
- silent ? silentFlags : 0)) {
- msgCannotRun(remoteArgs, workingDirectory, errorText, errorMessage);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, remoteArgs,
+ silent ? silentFlags : 0);
+
+ const QString stdErr = resp.stdErr();
+ *errorMessage = stdErr;
+ *output = resp.stdOut();
+
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(remoteArgs, workingDirectory, stdErr, errorMessage);
return false;
}
- if (output)
- *output = commandOutputFromLocal8Bit(outputText);
return true;
}
@@ -1643,6 +1617,7 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi
QString *errorMessage) const
{
QMap<QString,QString> result;
+
QString output;
QString error;
if (!synchronousRemoteCmd(workingDirectory, { "-v" }, &output, &error, true)) {
@@ -1658,7 +1633,7 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi
const int tabIndex = remote.indexOf('\t');
if (tabIndex == -1)
continue;
- QString url = remote.mid(tabIndex + 1, remote.length() - tabIndex - 8);
+ const QString url = remote.mid(tabIndex + 1, remote.length() - tabIndex - 8);
result.insert(remote.left(tabIndex), url);
}
return result;
@@ -1667,17 +1642,16 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi
QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirectory,
QString *errorMessage) const
{
- QByteArray outputTextData;
- QByteArray errorText;
// get submodule status
- if (!vcsFullySynchronousExec(workingDirectory, { "submodule", "status" },
- &outputTextData, &errorText, silentFlags)) {
+ const SynchronousProcessResponse resp =
+ vcsFullySynchronousExec(workingDirectory, { "submodule", "status" }, silentFlags);
+
+ if (resp.result != SynchronousProcessResponse::Finished) {
msgCannotRun(tr("Cannot retrieve submodule status of \"%1\": %2")
- .arg(QDir::toNativeSeparators(workingDirectory),
- commandOutputFromLocal8Bit(errorText)), errorMessage);
+ .arg(QDir::toNativeSeparators(workingDirectory), resp.stdErr()), errorMessage);
return QStringList();
}
- return commandOutputLinesFromLocal8Bit(outputTextData);
+ return splitLines(resp.stdOut());
}
SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) const
@@ -1750,11 +1724,13 @@ bool GitClient::synchronousShow(const QString &workingDirectory, const QString &
return false;
}
const QStringList arguments = { "show", decorateOption, noColorOption, id };
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, output, &errorText);
- if (!rc)
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
- return rc;
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
+ }
+ *output = resp.rawStdOut;
+ return true;
}
// Retrieve list of files to be cleaned
@@ -1763,20 +1739,23 @@ bool GitClient::cleanList(const QString &workingDirectory, const QString &module
{
const QString directory = workingDirectory + '/' + modulePath;
const QStringList arguments = { "clean", "--dry-run", flag };
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(directory, arguments, &outputText, &errorText);
- if (!rc) {
- msgCannotRun(arguments, directory, errorText, errorMessage);
+
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(directory, arguments);
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(arguments, directory, resp.stdErr(), errorMessage);
return false;
}
+
// Filter files that git would remove
const QString relativeBase = modulePath.isEmpty() ? QString() : modulePath + '/';
const QString prefix = "Would remove ";
- foreach (const QString &line, commandOutputLinesFromLocal8Bit(outputText)) {
- if (line.startsWith(prefix))
- files->push_back(relativeBase + line.mid(prefix.size()));
- }
+ const QStringList removeLines = Utils::filtered(
+ splitLines(resp.stdOut()), [&prefix](const QString &s) {
+ return s.startsWith("Would remove ");
+ });
+ *files = Utils::transform(removeLines, [&relativeBase, &prefix](const QString &s) -> QString {
+ return relativeBase + s.mid(prefix.size());
+ });
return true;
}
@@ -1806,19 +1785,19 @@ bool GitClient::synchronousApplyPatch(const QString &workingDirectory,
{
QStringList arguments = { "apply", "--whitespace=fix" };
arguments << extraArguments << file;
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText);
- if (rc) {
- if (!errorText.isEmpty())
+
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
+ const QString stdErr = resp.stdErr();
+ if (resp.result == SynchronousProcessResponse::Finished) {
+ if (!stdErr.isEmpty())
*errorMessage = tr("There were warnings while applying \"%1\" to \"%2\":\n%3")
- .arg(file, workingDirectory, commandOutputFromLocal8Bit(errorText));
+ .arg(file, workingDirectory, stdErr);
+ return true;
} else {
*errorMessage = tr("Cannot apply patch \"%1\" to \"%2\": %3")
- .arg(file, workingDirectory, commandOutputFromLocal8Bit(errorText));
+ .arg(QDir::toNativeSeparators(file), workingDirectory, stdErr);
return false;
}
- return true;
}
QProcessEnvironment GitClient::processEnvironment() const
@@ -1932,8 +1911,6 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St
QString *output, QString *errorMessage) const
{
// Run 'status'. Note that git returns exitcode 1 if there are no added files.
- QByteArray outputText;
- QByteArray errorText;
QStringList arguments = { "status" };
if (mode & NoUntracked)
arguments << "--untracked-files=no";
@@ -1943,28 +1920,27 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St
arguments << "--ignore-submodules=all";
arguments << "--porcelain" << "-b";
- const bool statusRc = vcsFullySynchronousExec(workingDirectory, arguments,
- &outputText, &errorText, silentFlags);
- if (output)
- *output = commandOutputFromLocal8Bit(outputText);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, silentFlags);
+ const QString stdOut = resp.stdOut();
- static const char * NO_BRANCH = "## HEAD (no branch)\n";
+ if (output)
+ *output = stdOut;
- const bool branchKnown = !outputText.startsWith(NO_BRANCH);
+ const bool statusRc = resp.result == SynchronousProcessResponse::Finished;
+ const bool branchKnown = !stdOut.startsWith("## HEAD (no branch)\n");
// Is it something really fatal?
if (!statusRc && !branchKnown) {
if (errorMessage) {
- const QString error = commandOutputFromLocal8Bit(errorText);
- *errorMessage = tr("Cannot obtain status: %1").arg(error);
+ *errorMessage = tr("Cannot obtain status: %1").arg(resp.stdErr());
}
return StatusFailed;
}
// Unchanged (output text depending on whether -u was passed)
- QList<QByteArray> lines = outputText.split('\n');
- foreach (const QByteArray &line, lines)
- if (!line.isEmpty() && !line.startsWith('#'))
- return StatusChanged;
- return StatusUnchanged;
+ const bool hasChanges = Utils::contains(stdOut.split('\n'), [](const QString &s) {
+ return !s.isEmpty() && !s.startsWith('#');
+ });
+ return hasChanges ? StatusChanged : StatusUnchanged;
}
QString GitClient::commandInProgressDescription(const QString &workingDirectory) const
@@ -2119,7 +2095,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
QString headSha;
// split "82bfad2f51d34e98b18982211c82220b8db049b<tab>refs/heads/master"
bool headFound = false;
- foreach (const QString &line, resp.stdOut.split('\n')) {
+ foreach (const QString &line, resp.stdOut().split('\n')) {
if (line.endsWith("\tHEAD")) {
QTC_CHECK(headSha.isNull());
headSha = line.left(line.indexOf('\t'));
@@ -2266,9 +2242,9 @@ FileName GitClient::vcsBinary() const
return binary;
}
-QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArray &configVar) const
+QTextCodec *GitClient::encoding(const QString &workingDirectory, const QString &configVar) const
{
- QString codecName = readConfigValue(workingDirectory, QLatin1String(configVar)).trimmed();
+ QString codecName = readConfigValue(workingDirectory, configVar).trimmed();
// Set default commit encoding to 'UTF-8', when it's not set,
// to solve displaying error of commit log with non-latin characters.
if (codecName.isEmpty())
@@ -2291,20 +2267,25 @@ bool GitClient::readDataFromCommit(const QString &repoDirectory, const QString &
{
// Get commit data as "SHA1<lf>author<lf>email<lf>message".
const QStringList arguments = { "log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit };
- QByteArray outputText;
- if (!vcsFullySynchronousExec(repoDirectory, arguments, &outputText, 0, silentFlags)) {
- if (errorMessage)
- *errorMessage = tr("Cannot retrieve last commit data of repository \"%1\".").arg(repoDirectory);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(repoDirectory, arguments, silentFlags);
+
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ if (errorMessage) {
+ *errorMessage = tr("Cannot retrieve last commit data of repository \"%1\".")
+ .arg(QDir::toNativeSeparators(repoDirectory));
+ }
return false;
}
+
QTextCodec *authorCodec = HostOsInfo::isWindowsHost()
? QTextCodec::codecForName("UTF-8")
: commitData.commitEncoding;
- commitData.amendSHA1 = QLatin1String(shiftLogLine(outputText));
- commitData.panelData.author = authorCodec->toUnicode(shiftLogLine(outputText));
- commitData.panelData.email = authorCodec->toUnicode(shiftLogLine(outputText));
+ QByteArray stdOut = resp.rawStdOut;
+ commitData.amendSHA1 = QLatin1String(shiftLogLine(stdOut));
+ commitData.panelData.author = authorCodec->toUnicode(shiftLogLine(stdOut));
+ commitData.panelData.email = authorCodec->toUnicode(shiftLogLine(stdOut));
if (commitTemplate)
- *commitTemplate = commitData.commitEncoding->toUnicode(outputText);
+ *commitTemplate = commitData.commitEncoding->toUnicode(stdOut);
return true;
}
@@ -2539,19 +2520,16 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
arguments << "--no-verify";
}
- QByteArray outputText;
- QByteArray errorText;
-
- const bool rc = vcsFullySynchronousExec(repositoryDirectory, arguments, &outputText, &errorText);
- const QString stdErr = commandOutputFromLocal8Bit(errorText);
- if (rc) {
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(repositoryDirectory, arguments);
+ const QString stdErr = resp.stdErr();
+ if (resp.result == SynchronousProcessResponse::Finished) {
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
VcsOutputWindow::appendError(stdErr);
+ return true;
} else {
VcsOutputWindow::appendError(tr("Cannot commit %n file(s): %1\n", 0, commitCount).arg(stdErr));
+ return false;
}
-
- return rc;
}
/* Revert: This function can be called with a file list (to revert single
@@ -2665,7 +2643,7 @@ void GitClient::revert(const QStringList &files, bool revertStaging)
void GitClient::fetch(const QString &workingDirectory, const QString &remote)
{
- QStringList const arguments = { "fetch", (remote.isEmpty() ? QLatin1String("--all") : remote) };
+ QStringList const arguments = { "fetch", (remote.isEmpty() ? "--all" : remote) };
VcsCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
VcsCommand::ShowSuccessMessage);
connect(command, &VcsCommand::success,
@@ -2715,10 +2693,10 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString
QStringList(), QString(), nullptr, false);
return;
}
- QByteArray stdOut;
- vcsFullySynchronousExec(workingDir, { abortCommand, "--abort" }, &stdOut, nullptr,
- VcsCommand::ExpectRepoChanges);
- VcsOutputWindow::append(commandOutputFromLocal8Bit(stdOut));
+
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDir, { abortCommand, "--abort" }, VcsCommand::ExpectRepoChanges);
+ VcsOutputWindow::append(resp.stdOut());
}
QString GitClient::synchronousTrackingBranch(const QString &workingDirectory, const QString &branch)
@@ -2741,9 +2719,9 @@ QString GitClient::synchronousTrackingBranch(const QString &workingDirectory, co
bool GitClient::synchronousSetTrackingBranch(const QString &workingDirectory,
const QString &branch, const QString &tracking)
{
- QByteArray outputText;
return vcsFullySynchronousExec(
- workingDirectory, { "branch", "--set-upstream-to=" + tracking, branch }, &outputText);
+ workingDirectory, { "branch", "--set-upstream-to=" + tracking, branch }).result
+ == SynchronousProcessResponse::Finished;
}
void GitClient::handleMergeConflicts(const QString &workingDir, const QString &commit,
@@ -2962,35 +2940,35 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory, const QS
arguments << "clear";
else
arguments << "drop" << stash;
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText);
- if (rc) {
- const QString output = commandOutputFromLocal8Bit(outputText);
+
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
+ if (resp.result == SynchronousProcessResponse::Finished) {
+ const QString output = resp.stdOut();
if (!output.isEmpty())
VcsOutputWindow::append(output);
+ return true;
} else {
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
+ return false;
}
- return rc;
}
bool GitClient::synchronousStashList(const QString &workingDirectory, QList<Stash> *stashes,
QString *errorMessage) const
{
stashes->clear();
- QByteArray outputText;
- QByteArray errorText;
+
const QStringList arguments = { "stash", "list", noColorOption };
- const bool rc = vcsFullySynchronousExec(workingDirectory, arguments, &outputText, &errorText);
- if (!rc) {
- msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
return false;
}
Stash stash;
- foreach (const QString &line, commandOutputLinesFromLocal8Bit(outputText))
+ foreach (const QString &line, splitLines(resp.stdOut())) {
if (stash.parseStashLine(line))
stashes->push_back(stash);
+ }
return true;
}
@@ -3013,54 +2991,11 @@ QString GitClient::readOneLine(const QString &workingDirectory, const QStringLis
? QTextCodec::codecForName("UTF-8")
: QTextCodec::codecForLocale();
- QByteArray outputText;
- if (!vcsFullySynchronousExec(workingDirectory, arguments, &outputText, 0, silentFlags))
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory, arguments, silentFlags, vcsTimeoutS(), codec);
+ if (resp.result != SynchronousProcessResponse::Finished)
return QString();
- if (HostOsInfo::isWindowsHost())
- outputText.replace("\r\n", "\n");
-
- return SynchronousProcess::normalizeNewlines(codec->toUnicode(outputText.trimmed()));
-}
-
-bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
-{
- QDir workingDirectory(directory);
- const unsigned flags = VcsCommand::SshPasswordPrompt
- | VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage;
-
- if (workingDirectory.exists()) {
- if (!synchronousInit(workingDirectory.path()))
- return false;
-
- if (!vcsFullySynchronousExec(workingDirectory.path(),
- { "remote", "add", "origin", QString::fromUtf8(url) }, nullptr)) {
- return false;
- }
-
- const SynchronousProcessResponse resp
- = vcsSynchronousExec(workingDirectory.path(), { "fetch" }, flags);
- if (resp.result != SynchronousProcessResponse::Finished)
- return false;
-
- if (!vcsFullySynchronousExec(workingDirectory.path(),
- { "config", "branch.master.remote", "origin" }, nullptr)) {
- return false;
- }
-
- if (!vcsFullySynchronousExec(workingDirectory.path(),
- { "config", "branch.master.merge", "refs/heads/master" }, nullptr)) {
- return false;
- }
-
- return true;
- } else {
- workingDirectory.cdUp();
- const SynchronousProcessResponse resp = vcsSynchronousExec(
- workingDirectory.path(),
- { "clone", QString::fromUtf8(url), workingDirectory.dirName() }, flags);
- resetCachedVcsInfo(workingDirectory.absolutePath());
- return (resp.result == SynchronousProcessResponse::Finished);
- }
+ return resp.stdOut().trimmed();
}
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
@@ -3083,19 +3018,16 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
return 0;
// run git --version
- QByteArray outputText;
- QByteArray errorText;
- const bool rc = vcsFullySynchronousExec(QString(), { "--version" },
- &outputText, &errorText, silentFlags);
- if (!rc) {
- msgCannotRun(tr("Cannot determine Git version: %1")
- .arg(commandOutputFromLocal8Bit(errorText)),
- errorMessage);
+ const SynchronousProcessResponse resp = vcsSynchronousExec(
+ QString(), { "--version" }, silentFlags);
+ if (resp.result != SynchronousProcessResponse::Finished) {
+ msgCannotRun(tr("Cannot determine Git version: %1").arg(resp.stdErr()), errorMessage);
return 0;
}
+
// cut 'git version 1.6.5.1.sha'
// another form: 'git version 1.9.rc1'
- const QString output = commandOutputFromLocal8Bit(outputText);
+ const QString output = resp.stdOut();
QRegExp versionPattern("^[^\\d]+(\\d+)\\.(\\d+)\\.(\\d+|rc\\d).*$");
QTC_ASSERT(versionPattern.isValid(), return 0);
QTC_ASSERT(versionPattern.exactMatch(output), return 0);
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 250ce4c220..869ed36622 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -121,8 +121,6 @@ public:
PushAction m_pushAction = NoPush;
};
- static const char *stashNamePrefix;
-
explicit GitClient();
Utils::FileName vcsBinary() const override;
@@ -242,7 +240,6 @@ public:
bool isRemoteCommit(const QString &workingDirectory, const QString &commit);
bool isFastForwardMerge(const QString &workingDirectory, const QString &branch);
- bool cloneRepository(const QString &directory, const QByteArray &url);
void fetch(const QString &workingDirectory, const QString &remote);
bool synchronousPull(const QString &workingDirectory, bool rebase);
void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList());
@@ -278,7 +275,7 @@ public:
QString readGitVar(const QString &workingDirectory, const QString &configVar) const;
QString readConfigValue(const QString &workingDirectory, const QString &configVar) const;
- QTextCodec *encoding(const QString &workingDirectory, const QByteArray &configVar) const;
+ QTextCodec *encoding(const QString &workingDirectory, const QString &configVar) const;
bool readDataFromCommit(const QString &repoDirectory, const QString &commit,
CommitData &commitData, QString *errorMessage = nullptr,
QString *commitTemplate = nullptr);
diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp
index 9c8dd78676..b69b8d0f89 100644
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
@@ -59,7 +59,7 @@ namespace Git {
namespace Internal {
GitEditorWidget::GitEditorWidget() :
- m_changeNumberPattern(QLatin1String(CHANGE_PATTERN))
+ m_changeNumberPattern(CHANGE_PATTERN)
{
QTC_ASSERT(m_changeNumberPattern.isValid(), return);
/* Diff format:
@@ -68,8 +68,8 @@ GitEditorWidget::GitEditorWidget() :
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
*/
- setDiffFilePattern(QRegExp(QLatin1String("^(?:diff --git a/|index |[+-]{3} (?:/dev/null|[ab]/(.+$)))")));
- setLogEntryPattern(QRegExp(QLatin1String("^commit ([0-9a-f]{8})[0-9a-f]{32}")));
+ setDiffFilePattern(QRegExp("^(?:diff --git a/|index |[+-]{3} (?:/dev/null|[ab]/(.+$)))"));
+ setLogEntryPattern(QRegExp("^commit ([0-9a-f]{8})[0-9a-f]{32}"));
setAnnotateRevisionTextFormat(tr("&Blame %1"));
setAnnotatePreviousRevisionTextFormat(tr("Blame &Parent Revision %1"));
}
@@ -81,11 +81,11 @@ QSet<QString> GitEditorWidget::annotationChanges() const
if (txt.isEmpty())
return changes;
// Hunt for first change number in annotation: "<change>:"
- QRegExp r(QLatin1String("^(" CHANGE_PATTERN ") "));
+ QRegExp r("^(" CHANGE_PATTERN ") ");
QTC_ASSERT(r.isValid(), return changes);
if (r.indexIn(txt) != -1) {
changes.insert(r.cap(1));
- r.setPattern(QLatin1String("\n(" CHANGE_PATTERN ") "));
+ r.setPattern("\n(" CHANGE_PATTERN ") ");
QTC_ASSERT(r.isValid(), return changes);
int pos = 0;
while ((pos = r.indexIn(txt, pos)) != -1) {
@@ -126,8 +126,8 @@ static QString sanitizeBlameOutput(const QString &b)
const bool omitDate = GitPlugin::client()->settings().boolValue(
GitSettings::omitAnnotationDateKey);
- const QChar space(QLatin1Char(' '));
- const int parenPos = b.indexOf(QLatin1Char(')'));
+ const QChar space(' ');
+ const int parenPos = b.indexOf(')');
if (parenPos == -1)
return b;
@@ -154,7 +154,7 @@ static QString sanitizeBlameOutput(const QString &b)
// Copy over the parts that have not changed into a new byte array
QString result;
int prevPos = 0;
- int pos = b.indexOf(QLatin1Char('\n'), 0) + 1;
+ int pos = b.indexOf('\n', 0) + 1;
forever {
QTC_CHECK(prevPos < pos);
int afterParen = prevPos + parenPos;
@@ -165,7 +165,7 @@ static QString sanitizeBlameOutput(const QString &b)
if (pos == b.size())
break;
- pos = b.indexOf(QLatin1Char('\n'), pos) + 1;
+ pos = b.indexOf('\n', pos) + 1;
if (pos == 0) // indexOf returned -1
pos = b.size();
}
@@ -190,8 +190,7 @@ void GitEditorWidget::setPlainText(const QString &text)
void GitEditorWidget::checkoutChange()
{
- GitPlugin::client()->stashAndCheckout(
- sourceWorkingDirectory(), m_currentChange);
+ GitPlugin::client()->stashAndCheckout(sourceWorkingDirectory(), m_currentChange);
}
void GitEditorWidget::resetChange(const QByteArray &resetType)
@@ -202,14 +201,12 @@ void GitEditorWidget::resetChange(const QByteArray &resetType)
void GitEditorWidget::cherryPickChange()
{
- GitPlugin::client()->synchronousCherryPick(
- sourceWorkingDirectory(), m_currentChange);
+ GitPlugin::client()->synchronousCherryPick(sourceWorkingDirectory(), m_currentChange);
}
void GitEditorWidget::revertChange()
{
- GitPlugin::client()->synchronousRevert(
- sourceWorkingDirectory(), m_currentChange);
+ GitPlugin::client()->synchronousRevert(sourceWorkingDirectory(), m_currentChange);
}
void GitEditorWidget::logChange()
@@ -229,9 +226,9 @@ void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, bool revert)
patchFile.write(chunk.chunk);
patchFile.close();
- QStringList args = QStringList() << QLatin1String("--cached");
+ QStringList args = { "--cached" };
if (revert)
- args << QLatin1String("--reverse");
+ args << "--reverse";
QString errorMessage;
if (GitPlugin::client()->synchronousApplyPatch(baseDir, patchFile.fileName(), &errorMessage, args)) {
if (errorMessage.isEmpty())
@@ -362,7 +359,7 @@ QString GitEditorWidget::fileNameForLine(int line) const
// 7971b6e7 share/qtcreator/dumper/dumper.py (hjk
QTextBlock block = document()->findBlockByLineNumber(line - 1);
QTC_ASSERT(block.isValid(), return source());
- static QRegExp renameExp(QLatin1String("^" CHANGE_PATTERN "\\s+([^(]+)"));
+ static QRegExp renameExp("^" CHANGE_PATTERN "\\s+([^(]+)");
if (renameExp.indexIn(block.text()) != -1) {
const QString fileName = renameExp.cap(1).trimmed();
if (!fileName.isEmpty())
diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp
index 5299a5bec4..496e6c3490 100644
--- a/src/plugins/git/gitgrep.cpp
+++ b/src/plugins/git/gitgrep.cpp
@@ -94,7 +94,7 @@ public:
QString filePath = line.left(lineSeparator);
if (!m_ref.isEmpty() && filePath.startsWith(m_ref))
filePath.remove(0, m_ref.length());
- single.fileName = m_directory + QLatin1Char('/') + filePath;
+ single.fileName = m_directory + '/' + filePath;
const int textSeparator = line.indexOf(QChar::Null, lineSeparator + 1);
single.lineNumber = line.mid(lineSeparator + 1, textSeparator - lineSeparator - 1).toInt();
QString text = line.mid(textSeparator + 1);
@@ -133,24 +133,25 @@ public:
void exec()
{
QStringList arguments;
- arguments << QLatin1String("-c") << QLatin1String("color.grep.match=bold red")
- << QLatin1String("grep") << QLatin1String("-zn")
- << QLatin1String("--color=always");
+ arguments << "-c" << "color.grep.match=bold red"
+ << "grep" << "-zn"
+ << "--no-full-name"
+ << "--color=always";
if (!(m_parameters.flags & FindCaseSensitively))
- arguments << QLatin1String("-i");
+ arguments << "-i";
if (m_parameters.flags & FindWholeWords)
- arguments << QLatin1String("-w");
+ arguments << "-w";
if (m_parameters.flags & FindRegularExpression)
- arguments << QLatin1String("-P");
+ arguments << "-P";
else
- arguments << QLatin1String("-F");
+ arguments << "-F";
arguments << m_parameters.text;
GitGrepParameters params = m_parameters.extensionParameters.value<GitGrepParameters>();
if (!params.ref.isEmpty()) {
arguments << params.ref;
- m_ref = params.ref + QLatin1Char(':');
+ m_ref = params.ref + ':';
}
- arguments << QLatin1String("--") << m_parameters.nameFilters;
+ arguments << "--" << m_parameters.nameFilters;
QScopedPointer<VcsCommand> command(GitPlugin::client()->createCommand(m_directory));
command->addFlags(VcsCommand::SilentOutput | VcsCommand::SuppressFailMessage);
command->setProgressiveOutput(true);
@@ -211,7 +212,7 @@ GitGrep::GitGrep()
m_treeLineEdit->setPlaceholderText(tr("Tree (optional)"));
m_treeLineEdit->setToolTip(tr("Can be HEAD, tag, local or remote branch, or a commit hash.\n"
"Leave empty to search through the file system."));
- const QRegularExpression refExpression(QLatin1String("[\\S]*"));
+ const QRegularExpression refExpression("[\\S]*");
m_treeLineEdit->setValidator(new QRegularExpressionValidator(refExpression, this));
layout->addWidget(m_treeLineEdit);
TextEditor::FindInFiles *findInFiles = TextEditor::FindInFiles::instance();
@@ -266,14 +267,14 @@ QVariant GitGrep::parameters() const
void GitGrep::readSettings(QSettings *settings)
{
- m_enabledCheckBox->setChecked(settings->value(QLatin1String(EnableGitGrep), false).toBool());
- m_treeLineEdit->setText(settings->value(QLatin1String(GitGrepRef)).toString());
+ m_enabledCheckBox->setChecked(settings->value(EnableGitGrep, false).toBool());
+ m_treeLineEdit->setText(settings->value(GitGrepRef).toString());
}
void GitGrep::writeSettings(QSettings *settings) const
{
- settings->setValue(QLatin1String(EnableGitGrep), m_enabledCheckBox->isChecked());
- settings->setValue(QLatin1String(GitGrepRef), m_treeLineEdit->text());
+ settings->setValue(EnableGitGrep, m_enabledCheckBox->isChecked());
+ settings->setValue(GitGrepRef, m_treeLineEdit->text());
}
QFuture<FileSearchResultList> GitGrep::executeSearch(
@@ -292,7 +293,7 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
QByteArray content;
const QString topLevel = parameters.additionalParameters.toString();
const QString relativePath = QDir(topLevel).relativeFilePath(path);
- if (!GitPlugin::client()->synchronousShow(topLevel, params.ref + QLatin1String(":./") + relativePath,
+ if (!GitPlugin::client()->synchronousShow(topLevel, params.ref + ":./" + relativePath,
&content, nullptr)) {
return nullptr;
}
diff --git a/src/plugins/git/githighlighters.cpp b/src/plugins/git/githighlighters.cpp
index cae1618b5f..b86efdc6e4 100644
--- a/src/plugins/git/githighlighters.cpp
+++ b/src/plugins/git/githighlighters.cpp
@@ -42,8 +42,8 @@ GitSubmitHighlighter::GitSubmitHighlighter(QTextEdit * parent) :
categories << TextEditor::C_COMMENT;
setTextFormatCategories(categories);
- m_keywordPattern.setPattern(QLatin1String("^[\\w-]+:"));
- m_hashChar = QLatin1Char('#');
+ m_keywordPattern.setPattern("^[\\w-]+:");
+ m_hashChar = '#';
QTC_CHECK(m_keywordPattern.isValid());
}
@@ -95,8 +95,8 @@ GitRebaseHighlighter::RebaseAction::RebaseAction(const QString &regexp,
GitRebaseHighlighter::GitRebaseHighlighter(QTextDocument *parent) :
TextEditor::SyntaxHighlighter(parent),
- m_hashChar(QLatin1Char('#')),
- m_changeNumberPattern(QLatin1String(CHANGE_PATTERN))
+ m_hashChar('#'),
+ m_changeNumberPattern(CHANGE_PATTERN)
{
static QVector<TextEditor::TextStyle> categories;
if (categories.isEmpty()) {
@@ -112,12 +112,12 @@ GitRebaseHighlighter::GitRebaseHighlighter(QTextDocument *parent) :
}
setTextFormatCategories(categories);
- m_actions << RebaseAction(QLatin1String("^(p|pick)\\b"), Format_Pick);
- m_actions << RebaseAction(QLatin1String("^(r|reword)\\b"), Format_Reword);
- m_actions << RebaseAction(QLatin1String("^(e|edit)\\b"), Format_Edit);
- m_actions << RebaseAction(QLatin1String("^(s|squash)\\b"), Format_Squash);
- m_actions << RebaseAction(QLatin1String("^(f|fixup)\\b"), Format_Fixup);
- m_actions << RebaseAction(QLatin1String("^(x|exec)\\b"), Format_Exec);
+ m_actions << RebaseAction("^(p|pick)\\b", Format_Pick);
+ m_actions << RebaseAction("^(r|reword)\\b", Format_Reword);
+ m_actions << RebaseAction("^(e|edit)\\b", Format_Edit);
+ m_actions << RebaseAction("^(s|squash)\\b", Format_Squash);
+ m_actions << RebaseAction("^(f|fixup)\\b", Format_Fixup);
+ m_actions << RebaseAction("^(x|exec)\\b", Format_Exec);
}
void GitRebaseHighlighter::highlightBlock(const QString &text)
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index fde78bcdd6..7dcb555cb5 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -294,7 +294,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitParameters,
[]() { return new GitSubmitEditor(&submitParameters); }));
- const QString prefix = QLatin1String("git");
+ const QString prefix = "git";
m_commandLocator = new CommandLocator("Git", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
@@ -623,7 +623,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
this, &GitPlugin::updateBranches, Qt::QueuedConnection);
- Utils::MimeDatabase::addMimeTypes(QLatin1String(RC_GIT_MIME_XML));
+ Utils::MimeDatabase::addMimeTypes(RC_GIT_MIME_XML);
/* "Gerrit" */
m_gerritPlugin = new Gerrit::Internal::GerritPlugin(this);
@@ -718,7 +718,7 @@ void GitPlugin::logRepository()
void GitPlugin::undoFileChanges(bool revertStaging)
{
if (IDocument *document = EditorManager::currentDocument()) {
- if (!DocumentManager::saveModifiedDocument(document))
+ if (!DocumentManager::saveModifiedDocumentSilently(document))
return;
}
const VcsBasePluginState state = currentState();
@@ -783,7 +783,7 @@ void GitPlugin::startRebase()
dialog.setWindowTitle(tr("Interactive Rebase"));
if (!dialog.runDialog(topLevel))
return;
- if (m_gitClient->beginStashScope(topLevel, QLatin1String("Rebase-i")))
+ if (m_gitClient->beginStashScope(topLevel, "Rebase-i"))
m_gitClient->interactiveRebase(topLevel, dialog.commit(), false);
}
@@ -857,7 +857,7 @@ void GitPlugin::gitkForCurrentFolder()
/*
* entire lower part of the code can be easily replaced with one line:
*
- * m_gitClient->launchGitK(dir.currentFileDirectory(), QLatin1String("."));
+ * m_gitClient->launchGitK(dir.currentFileDirectory(), ".");
*
* However, there is a bug in gitk in version 1.7.9.5, and if you run above
* command, there will be no documents listed in lower right section.
@@ -869,7 +869,7 @@ void GitPlugin::gitkForCurrentFolder()
*
*/
QDir dir(state.currentFileDirectory());
- if (QFileInfo(dir,QLatin1String(".git")).exists() || dir.cd(QLatin1String(".git"))) {
+ if (QFileInfo(dir,".git").exists() || dir.cd(".git")) {
m_gitClient->launchGitK(state.currentFileDirectory());
} else {
QString folderName = dir.absolutePath();
@@ -1044,7 +1044,7 @@ bool GitPlugin::submitEditorAboutToClose()
return false;
cleanCommitMessageFile();
if (commitType == FixupCommit) {
- if (!m_gitClient->beginStashScope(m_submitRepository, QLatin1String("Rebase-fixup"),
+ if (!m_gitClient->beginStashScope(m_submitRepository, "Rebase-fixup",
NoPrompt, editor->panelData().pushAction)) {
return false;
}
@@ -1077,13 +1077,13 @@ void GitPlugin::pull()
if (!rebase) {
QString currentBranch = m_gitClient->synchronousCurrentLocalBranch(topLevel);
if (!currentBranch.isEmpty()) {
- currentBranch.prepend(QLatin1String("branch."));
- currentBranch.append(QLatin1String(".rebase"));
- rebase = (m_gitClient->readConfigValue(topLevel, currentBranch) == QLatin1String("true"));
+ currentBranch.prepend("branch.");
+ currentBranch.append(".rebase");
+ rebase = (m_gitClient->readConfigValue(topLevel, currentBranch) == "true");
}
}
- if (!m_gitClient->beginStashScope(topLevel, QLatin1String("Pull"), rebase ? Default : AllowUnstashed))
+ if (!m_gitClient->beginStashScope(topLevel, "Pull", rebase ? Default : AllowUnstashed))
return;
m_gitClient->synchronousPull(topLevel, rebase);
}
@@ -1111,19 +1111,19 @@ void GitPlugin::continueOrAbortCommand()
QObject *action = QObject::sender();
if (action == m_abortMergeAction)
- m_gitClient->synchronousMerge(state.topLevel(), QLatin1String("--abort"));
+ m_gitClient->synchronousMerge(state.topLevel(), "--abort");
else if (action == m_abortRebaseAction)
- m_gitClient->rebase(state.topLevel(), QLatin1String("--abort"));
+ m_gitClient->rebase(state.topLevel(), "--abort");
else if (action == m_abortCherryPickAction)
- m_gitClient->synchronousCherryPick(state.topLevel(), QLatin1String("--abort"));
+ m_gitClient->synchronousCherryPick(state.topLevel(), "--abort");
else if (action == m_abortRevertAction)
- m_gitClient->synchronousRevert(state.topLevel(), QLatin1String("--abort"));
+ m_gitClient->synchronousRevert(state.topLevel(), "--abort");
else if (action == m_continueRebaseAction)
- m_gitClient->rebase(state.topLevel(), QLatin1String("--continue"));
+ m_gitClient->rebase(state.topLevel(), "--continue");
else if (action == m_continueCherryPickAction)
- m_gitClient->cherryPick(state.topLevel(), QLatin1String("--continue"));
+ m_gitClient->cherryPick(state.topLevel(), "--continue");
else if (action == m_continueRevertAction)
- m_gitClient->revert(state.topLevel(), QLatin1String("--continue"));
+ m_gitClient->revert(state.topLevel(), "--continue");
updateContinueAndAbortCommands();
}
@@ -1201,7 +1201,7 @@ void GitPlugin::promptApplyPatch()
void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
{
// Ensure user has been notified about pending changes
- if (!m_gitClient->beginStashScope(workingDirectory, QLatin1String("Apply-Patch"), AllowUnstashed))
+ if (!m_gitClient->beginStashScope(workingDirectory, "Apply-Patch", AllowUnstashed))
return;
// Prompt for file
if (file.isEmpty()) {
@@ -1427,8 +1427,8 @@ void GitPlugin::testStatusParsing()
CommitData data;
QFETCH(FileStates, first);
QFETCH(FileStates, second);
- QString output = QLatin1String("## master...origin/master [ahead 1]\n");
- output += QString::fromLatin1(QTest::currentDataTag()) + QLatin1String(" main.cpp\n");
+ QString output = "## master...origin/master [ahead 1]\n";
+ output += QString::fromLatin1(QTest::currentDataTag()) + " main.cpp\n";
data.parseFilesFromStatus(output);
QCOMPARE(data.files.at(0).first, first);
if (second == UnknownFileState)
diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp
index 5d682ca845..337db12627 100644
--- a/src/plugins/git/gitsettings.cpp
+++ b/src/plugins/git/gitsettings.cpp
@@ -48,9 +48,9 @@ const QLatin1String GitSettings::lastResetIndexKey("LastResetIndex");
GitSettings::GitSettings()
{
- setSettingsGroup(QLatin1String("Git"));
+ setSettingsGroup("Git");
- declareKey(binaryPathKey, QLatin1String("git"));
+ declareKey(binaryPathKey, "git");
declareKey(timeoutKey, Utils::HostOsInfo::isWindowsHost() ? 60 : 30);
declareKey(pullRebaseKey, false);
declareKey(showTagsKey, false);
diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp
index 7dfafa9ba0..c43065e24b 100644
--- a/src/plugins/git/gitsubmiteditor.cpp
+++ b/src/plugins/git/gitsubmiteditor.cpp
@@ -189,7 +189,7 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
unmergedFiles.push_back(fileName);
} else if (state & StagedFile) {
if (state & (RenamedFile | CopiedFile)) {
- const int arrow = fileName.indexOf(QLatin1String(" -> "));
+ const int arrow = fileName.indexOf(" -> ");
if (arrow != -1) {
stagedFiles.push_back(fileName.left(arrow));
stagedFiles.push_back(fileName.mid(arrow + 4));
@@ -198,7 +198,7 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
}
stagedFiles.push_back(fileName);
} else if (state == UntrackedFile) {
- Core::EditorManager::openEditor(m_workingDirectory + QLatin1Char('/') + fileName);
+ Core::EditorManager::openEditor(m_workingDirectory + '/' + fileName);
} else {
unstagedFiles.push_back(fileName);
}
diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp
index 6a7fab23be..196903e342 100644
--- a/src/plugins/git/gitsubmiteditorwidget.cpp
+++ b/src/plugins/git/gitsubmiteditorwidget.cpp
@@ -51,7 +51,7 @@ GitSubmitEditorWidget::GitSubmitEditorWidget() :
m_gitSubmitPanelUi.setupUi(m_gitSubmitPanel);
new GitSubmitHighlighter(descriptionEdit());
- m_emailValidator = new QRegExpValidator(QRegExp(QLatin1String("[^@ ]+@[^@ ]+\\.[a-zA-Z]+")), this);
+ m_emailValidator = new QRegExpValidator(QRegExp("[^@ ]+@[^@ ]+\\.[a-zA-Z]+"), this);
const QPixmap error = Core::Icons::ERROR.pixmap();
m_gitSubmitPanelUi.invalidAuthorLabel->setPixmap(error);
m_gitSubmitPanelUi.invalidEmailLabel->setToolTip(tr("Provide a valid email to commit."));
@@ -66,7 +66,7 @@ GitSubmitEditorWidget::GitSubmitEditorWidget() :
void GitSubmitEditorWidget::setPanelInfo(const GitSubmitEditorPanelInfo &info)
{
m_gitSubmitPanelUi.repositoryLabel->setText(QDir::toNativeSeparators(info.repository));
- if (info.branch.contains(QLatin1String("(no branch)")))
+ if (info.branch.contains("(no branch)"))
m_gitSubmitPanelUi.branchLabel->setText(QString::fromLatin1("<span style=\"color:red\">%1</span>")
.arg(tr("Detached HEAD")));
else
@@ -163,8 +163,8 @@ QString GitSubmitEditorWidget::cleanupDescription(const QString &input) const
{
// We need to manually purge out comment lines starting with
// hash '#' since git does not do that when using -F.
- const QChar newLine = QLatin1Char('\n');
- const QChar hash = QLatin1Char('#');
+ const QChar newLine = '\n';
+ const QChar hash = '#';
QString message = input;
for (int pos = 0; pos < message.size(); ) {
const int newLinePos = message.indexOf(newLine, pos);
diff --git a/src/plugins/git/gitutils.cpp b/src/plugins/git/gitutils.cpp
index 8ddfc0072f..371a00885e 100644
--- a/src/plugins/git/gitutils.cpp
+++ b/src/plugins/git/gitutils.cpp
@@ -47,7 +47,7 @@ stash@{2}: On <branch>: <message>
bool Stash::parseStashLine(const QString &l)
{
- const QChar colon = QLatin1Char(':');
+ const QChar colon = ':';
const int branchPos = l.indexOf(colon);
if (branchPos < 0)
return false;
@@ -55,7 +55,7 @@ bool Stash::parseStashLine(const QString &l)
if (messagePos < 0)
return false;
// Branch spec
- const int onIndex = l.indexOf(QLatin1String("on "), branchPos + 2, Qt::CaseInsensitive);
+ const int onIndex = l.indexOf("on ", branchPos + 2, Qt::CaseInsensitive);
if (onIndex == -1 || onIndex >= messagePos)
return false;
// Happy!
diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp
index f3b6289417..8575145bb6 100644
--- a/src/plugins/git/gitversioncontrol.cpp
+++ b/src/plugins/git/gitversioncontrol.cpp
@@ -47,7 +47,7 @@ protected:
QString trackFile(const QString &repository) override
{
const QString gitDir = m_client->findGitDirForRepository(repository);
- return gitDir.isEmpty() ? QString() : (gitDir + QLatin1String("/HEAD"));
+ return gitDir.isEmpty() ? QString() : (gitDir + "/HEAD");
}
QString refreshTopic(const QString &repository) override
@@ -131,7 +131,7 @@ QString GitVersionControl::vcsTopic(const QString &directory)
QString topic = Core::IVersionControl::vcsTopic(directory);
const QString commandInProgress = m_client->commandInProgressDescription(directory);
if (!commandInProgress.isEmpty())
- topic += QLatin1String(" (") + commandInProgress + QLatin1Char(')');
+ topic += " (" + commandInProgress + ')';
return topic;
}
@@ -140,10 +140,11 @@ Core::ShellCommand *GitVersionControl::createInitialCheckoutCommand(const QStrin
const QString &localName,
const QStringList &extraArgs)
{
- QStringList args;
- args << QLatin1String("clone") << QLatin1String("--progress") << extraArgs << url << localName;
+ QStringList args = { "clone", "--progress" };
+ args << extraArgs << url << localName;
auto command = new VcsBase::VcsCommand(baseDirectory.toString(), m_client->processEnvironment());
+ command->addFlags(VcsBase::VcsCommand::SuppressStdErr);
command->addJob(m_client->vcsBinary(), args, -1);
return command;
}
diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp
index 24541cfe98..4b5a7b14e1 100644
--- a/src/plugins/git/logchangedialog.cpp
+++ b/src/plugins/git/logchangedialog.cpp
@@ -153,21 +153,21 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
// Retrieve log using a custom format "Sha1:Subject [(refs)]"
QStringList arguments;
- arguments << QLatin1String("--max-count=1000") << QLatin1String("--format=%h:%s %d");
- arguments << (commit.isEmpty() ? QLatin1String("HEAD") : commit);
+ arguments << "--max-count=1000" << "--format=%h:%s %d";
+ arguments << (commit.isEmpty() ? "HEAD" : commit);
if (!(flags & IncludeRemotes))
- arguments << QLatin1String("--not") << QLatin1String("--remotes");
+ arguments << "--not" << "--remotes";
QString output;
if (!GitPlugin::client()->synchronousLog(repository, arguments, &output, 0, VcsCommand::NoOutput))
return false;
- foreach (const QString &line, output.split(QLatin1Char('\n'))) {
- const int colonPos = line.indexOf(QLatin1Char(':'));
+ foreach (const QString &line, output.split('\n')) {
+ const int colonPos = line.indexOf(':');
if (colonPos != -1) {
QList<QStandardItem *> row;
for (int c = 0; c < ColumnCount; ++c) {
auto item = new QStandardItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
- if (line.endsWith(QLatin1Char(')'))) {
+ if (line.endsWith(')')) {
QFont font = item->font();
font.setBold(true);
item->setFont(font);
@@ -207,9 +207,9 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
if (isReset) {
popUpLayout->addWidget(new QLabel(tr("Reset type:"), this));
m_resetTypeComboBox = new QComboBox(this);
- m_resetTypeComboBox->addItem(tr("Hard"), QLatin1String("--hard"));
- m_resetTypeComboBox->addItem(tr("Mixed"), QLatin1String("--mixed"));
- m_resetTypeComboBox->addItem(tr("Soft"), QLatin1String("--soft"));
+ m_resetTypeComboBox->addItem(tr("Hard"), "--hard");
+ m_resetTypeComboBox->addItem(tr("Mixed"), "--mixed");
+ m_resetTypeComboBox->addItem(tr("Soft"), "--soft");
m_resetTypeComboBox->setCurrentIndex(GitPlugin::client()->settings().intValue(
GitSettings::lastResetIndexKey));
popUpLayout->addWidget(m_resetTypeComboBox);
diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp
index d62aabfd92..c5f5117487 100644
--- a/src/plugins/git/mergetool.cpp
+++ b/src/plugins/git/mergetool.cpp
@@ -76,7 +76,7 @@ MergeTool::~MergeTool()
bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
{
QStringList arguments;
- arguments << QLatin1String("mergetool") << QLatin1String("-y") << files;
+ arguments << "mergetool" << "-y" << files;
m_process = new MergeToolProcess(this);
m_process->setWorkingDirectory(workingDirectory);
const Utils::FileName binary = GitPlugin::client()->vcsBinary();
@@ -206,7 +206,7 @@ void MergeTool::chooseAction()
key = button->property("key");
// either the message box was closed without clicking anything, or abort was clicked
if (!key.isValid())
- key = QVariant(QLatin1Char('a')); // abort
+ key = QVariant('a'); // abort
ba.append(key.toChar().toLatin1());
ba.append('\n');
m_process->write(ba);
diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp
index d15cc250e3..4ed3e5df9b 100644
--- a/src/plugins/git/remotedialog.cpp
+++ b/src/plugins/git/remotedialog.cpp
@@ -165,8 +165,7 @@ void RemoteDialog::pushToRemote()
const int row = indexList.at(0).row();
const QString remoteName = m_remoteModel->remoteName(row);
- GitPlugin::client()->push(m_remoteModel->workingDirectory(),
- QStringList() << remoteName);
+ GitPlugin::client()->push(m_remoteModel->workingDirectory(), { remoteName });
}
void RemoteDialog::fetchFromRemote()
diff --git a/src/plugins/git/remotemodel.cpp b/src/plugins/git/remotemodel.cpp
index 5983e64dc2..b1bcb3559d 100644
--- a/src/plugins/git/remotemodel.cpp
+++ b/src/plugins/git/remotemodel.cpp
@@ -48,9 +48,8 @@ bool RemoteModel::removeRemote(int row)
{
QString output;
QString error;
- bool success = GitPlugin::client()->synchronousRemoteCmd(m_workingDirectory,
- QStringList() << QLatin1String("rm") << remoteName(row),
- &output, &error);
+ bool success = GitPlugin::client()->synchronousRemoteCmd(
+ m_workingDirectory, { "rm", remoteName(row) }, &output, &error);
if (success)
success = refresh(m_workingDirectory, &error);
return success;
@@ -63,9 +62,8 @@ bool RemoteModel::addRemote(const QString &name, const QString &url)
if (name.isEmpty() || url.isEmpty())
return false;
- bool success = GitPlugin::client()->synchronousRemoteCmd(m_workingDirectory,
- QStringList() << QLatin1String("add") << name << url,
- &output, &error);
+ bool success = GitPlugin::client()->synchronousRemoteCmd(
+ m_workingDirectory, { "add", name, url }, &output, &error);
if (success)
success = refresh(m_workingDirectory, &error);
return success;
@@ -75,9 +73,8 @@ bool RemoteModel::renameRemote(const QString &oldName, const QString &newName)
{
QString output;
QString error;
- bool success = GitPlugin::client()->synchronousRemoteCmd(m_workingDirectory,
- QStringList() << QLatin1String("rename") << oldName << newName,
- &output, &error);
+ bool success = GitPlugin::client()->synchronousRemoteCmd(
+ m_workingDirectory, { "rename", oldName, newName }, &output, &error);
if (success)
success = refresh(m_workingDirectory, &error);
return success;
@@ -87,9 +84,8 @@ bool RemoteModel::updateUrl(const QString &name, const QString &newUrl)
{
QString output;
QString error;
- bool success = GitPlugin::client()->synchronousRemoteCmd(m_workingDirectory,
- QStringList() << QLatin1String("set-url") << name << newUrl,
- &output, &error);
+ bool success = GitPlugin::client()->synchronousRemoteCmd(
+ m_workingDirectory, { "set-url", name, newUrl }, &output, &error);
if (success)
success = refresh(m_workingDirectory, &error);
return success;
diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp
index ccc56dd05a..e5a1997f28 100644
--- a/src/plugins/git/settingspage.cpp
+++ b/src/plugins/git/settingspage.cpp
@@ -59,7 +59,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) : VcsClientOptionsPageWi
m_ui.winHomeCheckBox->setVisible(false);
}
m_ui.repBrowserCommandPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
- m_ui.repBrowserCommandPathChooser->setHistoryCompleter(QLatin1String("Git.RepoCommand.History"));
+ m_ui.repBrowserCommandPathChooser->setHistoryCompleter("Git.RepoCommand.History");
m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command"));
}
diff --git a/src/plugins/git/stashdialog.cpp b/src/plugins/git/stashdialog.cpp
index 00ee6f56ef..d6b4960eb9 100644
--- a/src/plugins/git/stashdialog.cpp
+++ b/src/plugins/git/stashdialog.cpp
@@ -206,7 +206,7 @@ void StashDialog::deleteSelection()
errors.push_back(errorMessage);
refresh(m_repository, true);
if (!errors.isEmpty())
- warning(title, errors.join(QLatin1Char('\n')));
+ warning(title, errors.join('\n'));
}
void StashDialog::showCurrent()
@@ -219,21 +219,21 @@ void StashDialog::showCurrent()
// Suggest Branch name to restore 'stash@{0}' -> 'stash0-date'
static inline QString stashRestoreDefaultBranch(QString stash)
{
- stash.remove(QLatin1Char('{'));
- stash.remove(QLatin1Char('}'));
- stash.remove(QLatin1Char('@'));
- stash += QLatin1Char('-');
- stash += QDateTime::currentDateTime().toString(QLatin1String("yyMMddhhmmss"));
+ stash.remove('{');
+ stash.remove('}');
+ stash.remove('@');
+ stash += '-';
+ stash += QDateTime::currentDateTime().toString("yyMMddhhmmss");
return stash;
}
// Return next stash id 'stash@{0}' -> 'stash@{1}'
static inline QString nextStash(const QString &stash)
{
- const int openingBracePos = stash.indexOf(QLatin1Char('{'));
+ const int openingBracePos = stash.indexOf('{');
if (openingBracePos == -1)
return QString();
- const int closingBracePos = stash.indexOf(QLatin1Char('}'), openingBracePos + 2);
+ const int closingBracePos = stash.indexOf('}', openingBracePos + 2);
if (closingBracePos == -1)
return QString();
bool ok;
@@ -242,7 +242,7 @@ static inline QString nextStash(const QString &stash)
return QString();
QString rc = stash.left(openingBracePos + 1);
rc += QString::number(n + 1);
- rc += QLatin1Char('}');
+ rc += '}';
return rc;
}
diff --git a/src/plugins/help/docsettingspage.cpp b/src/plugins/help/docsettingspage.cpp
index 7e004f1dd5..fcfe96ac4b 100644
--- a/src/plugins/help/docsettingspage.cpp
+++ b/src/plugins/help/docsettingspage.cpp
@@ -134,7 +134,7 @@ DocSettingsPage::DocSettingsPage()
setDisplayName(tr("Documentation"));
setCategory(Help::Constants::HELP_CATEGORY);
setDisplayCategory(QCoreApplication::translate("Help", Help::Constants::HELP_TR_CATEGORY));
- setCategoryIcon(QLatin1String(Help::Constants::HELP_CATEGORY_ICON));
+ setCategoryIcon(Help::Constants::HELP_CATEGORY_ICON);
}
QWidget *DocSettingsPage::widget()
@@ -189,8 +189,7 @@ void DocSettingsPage::addDocumentation()
const QString filePath = QDir::cleanPath(file);
const QString &nameSpace = HelpManager::namespaceFromFile(filePath);
if (nameSpace.isEmpty()) {
- docsUnableToRegister.insertMulti(QLatin1String("UnknownNamespace"),
- QDir::toNativeSeparators(filePath));
+ docsUnableToRegister.insertMulti("UnknownNamespace", QDir::toNativeSeparators(filePath));
continue;
}
@@ -222,12 +221,12 @@ void DocSettingsPage::addDocumentation()
}
QString formatedFail;
- if (docsUnableToRegister.contains(QLatin1String("UnknownNamespace"))) {
+ if (docsUnableToRegister.contains("UnknownNamespace")) {
formatedFail += QString::fromLatin1("<ul><li><b>%1</b>").arg(tr("Invalid documentation file:"));
- foreach (const QString &value, docsUnableToRegister.values(QLatin1String("UnknownNamespace")))
+ foreach (const QString &value, docsUnableToRegister.values("UnknownNamespace"))
formatedFail += QString::fromLatin1("<ul><li>%2</li></ul>").arg(value);
- formatedFail += QLatin1String("</li></ul>");
- docsUnableToRegister.remove(QLatin1String("UnknownNamespace"));
+ formatedFail += "</li></ul>";
+ docsUnableToRegister.remove("UnknownNamespace");
}
if (!docsUnableToRegister.isEmpty()) {
@@ -236,7 +235,7 @@ void DocSettingsPage::addDocumentation()
for (NameSpaceToPathHash::ConstIterator it = docsUnableToRegister.constBegin(); it != cend; ++it) {
formatedFail += QString::fromLatin1("<ul><li>%1 - %2</li></ul>").arg(it.key(), it.value());
}
- formatedFail += QLatin1String("</li></ul>");
+ formatedFail += "</li></ul>";
}
if (!formatedFail.isEmpty()) {
diff --git a/src/plugins/help/filtersettingspage.cpp b/src/plugins/help/filtersettingspage.cpp
index 75f2c45968..2c74ee78a2 100644
--- a/src/plugins/help/filtersettingspage.cpp
+++ b/src/plugins/help/filtersettingspage.cpp
@@ -44,7 +44,7 @@ FilterSettingsPage::FilterSettingsPage()
setDisplayName(tr("Filters"));
setCategory(Help::Constants::HELP_CATEGORY);
setDisplayCategory(QCoreApplication::translate("Help", Help::Constants::HELP_TR_CATEGORY));
- setCategoryIcon(QLatin1String(Help::Constants::HELP_CATEGORY_ICON));
+ setCategoryIcon(Help::Constants::HELP_CATEGORY_ICON);
}
QWidget *FilterSettingsPage::widget()
@@ -243,7 +243,7 @@ QString FilterSettingsPage::msgFilterLabel(const QString &filter) const
return tr("The filter \"%1\" will only show documentation files that"
" have the attributes %2 specified.").
- arg(filter, checkedList.join(QLatin1String(", ")));
+ arg(filter, checkedList.join(", "));
}
void FilterSettingsPage::updateFilterDescription(const QString &filter)
diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp
index f28a6a3ca3..35ab362615 100644
--- a/src/plugins/help/generalsettingspage.cpp
+++ b/src/plugins/help/generalsettingspage.cpp
@@ -60,7 +60,7 @@ GeneralSettingsPage::GeneralSettingsPage()
setDisplayName(tr("General"));
setCategory(Help::Constants::HELP_CATEGORY);
setDisplayCategory(QCoreApplication::translate("Help", Help::Constants::HELP_TR_CATEGORY));
- setCategoryIcon(QLatin1String(Help::Constants::HELP_CATEGORY_ICON));
+ setCategoryIcon(Help::Constants::HELP_CATEGORY_ICON);
}
QWidget *GeneralSettingsPage::widget()
@@ -74,9 +74,26 @@ QWidget *GeneralSettingsPage::widget()
m_font = LocalHelpManager::fallbackFont();
- updateFontSize();
- updateFontStyle();
- updateFontFamily();
+ updateFontSizeSelector();
+ updateFontStyleSelector();
+ updateFontFamilySelector();
+
+ connect(m_ui->familyComboBox, &QFontComboBox::currentFontChanged, this, [this]() {
+ updateFont();
+ updateFontStyleSelector();
+ updateFontSizeSelector();
+ updateFont(); // changes that might have happened when updating the selectors
+ });
+
+ connect(m_ui->styleComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
+ this, [this]() {
+ updateFont();
+ updateFontSizeSelector();
+ updateFont(); // changes that might have happened when updating the selectors
+ });
+
+ connect(m_ui->sizeComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
+ this, &GeneralSettingsPage::updateFont);
m_homePage = LocalHelpManager::homePage();
m_ui->homePageLineEdit->setText(m_homePage);
@@ -114,35 +131,9 @@ void GeneralSettingsPage::apply()
{
if (!m_ui) // page was never shown
return;
- QFont newFont;
- const QString &family = m_ui->familyComboBox->currentFont().family();
- newFont.setFamily(family);
-
- int fontSize = 14;
- int currentIndex = m_ui->sizeComboBox->currentIndex();
- if (currentIndex != -1)
- fontSize = m_ui->sizeComboBox->itemData(currentIndex).toInt();
- newFont.setPointSize(fontSize);
- QString fontStyle = QLatin1String("Normal");
- currentIndex = m_ui->styleComboBox->currentIndex();
- if (currentIndex != -1)
- fontStyle = m_ui->styleComboBox->itemText(currentIndex);
- newFont.setBold(m_fontDatabase.bold(family, fontStyle));
- if (fontStyle.contains(QLatin1String("Italic")))
- newFont.setStyle(QFont::StyleItalic);
- else if (fontStyle.contains(QLatin1String("Oblique")))
- newFont.setStyle(QFont::StyleOblique);
- else
- newFont.setStyle(QFont::StyleNormal);
-
- const int weight = m_fontDatabase.weight(family, fontStyle);
- if (weight >= 0) // Weight < 0 asserts...
- newFont.setWeight(weight);
-
- if (newFont != m_font) {
- m_font = newFont;
- LocalHelpManager::setFallbackFont(newFont);
+ if (m_font != LocalHelpManager::fallbackFont()) {
+ LocalHelpManager::setFallbackFont(m_font);
emit fontChanged();
}
@@ -218,7 +209,7 @@ void GeneralSettingsPage::exportBookmarks()
m_ui->errorLabel->setVisible(false);
QString fileName = QFileDialog::getSaveFileName(ICore::dialogParent(),
- tr("Save File"), QLatin1String("untitled.xbel"), tr("Files (*.xbel)"));
+ tr("Save File"), "untitled.xbel", tr("Files (*.xbel)"));
QLatin1String suffix(".xbel");
if (!fileName.endsWith(suffix))
@@ -236,7 +227,7 @@ void GeneralSettingsPage::exportBookmarks()
}
}
-void GeneralSettingsPage::updateFontSize()
+void GeneralSettingsPage::updateFontSizeSelector()
{
const QString &family = m_font.family();
const QString &fontStyle = m_fontDatabase.styleString(m_font);
@@ -245,6 +236,7 @@ void GeneralSettingsPage::updateFontSize()
if (pointSizes.empty())
pointSizes = QFontDatabase::standardSizes();
+ bool blocked = m_ui->sizeComboBox->blockSignals(true);
m_ui->sizeComboBox->clear();
m_ui->sizeComboBox->setCurrentIndex(-1);
m_ui->sizeComboBox->setEnabled(!pointSizes.empty());
@@ -258,20 +250,22 @@ void GeneralSettingsPage::updateFontSize()
if (closestIndex != -1)
m_ui->sizeComboBox->setCurrentIndex(closestIndex);
}
+ m_ui->sizeComboBox->blockSignals(blocked);
}
-void GeneralSettingsPage::updateFontStyle()
+void GeneralSettingsPage::updateFontStyleSelector()
{
const QString &fontStyle = m_fontDatabase.styleString(m_font);
const QStringList &styles = m_fontDatabase.styles(m_font.family());
+ bool blocked = m_ui->styleComboBox->blockSignals(true);
m_ui->styleComboBox->clear();
m_ui->styleComboBox->setCurrentIndex(-1);
m_ui->styleComboBox->setEnabled(!styles.empty());
if (!styles.empty()) {
int normalIndex = -1;
- const QString normalStyle = QLatin1String("Normal");
+ const QString normalStyle = "Normal";
foreach (const QString &style, styles) {
// try to maintain selection or select 'normal' preferably
const int newIndex = m_ui->styleComboBox->count();
@@ -286,13 +280,30 @@ void GeneralSettingsPage::updateFontStyle()
if (m_ui->styleComboBox->currentIndex() == -1 && normalIndex != -1)
m_ui->styleComboBox->setCurrentIndex(normalIndex);
}
+ m_ui->styleComboBox->blockSignals(blocked);
}
-void GeneralSettingsPage::updateFontFamily()
+void GeneralSettingsPage::updateFontFamilySelector()
{
m_ui->familyComboBox->setCurrentFont(m_font);
}
+void GeneralSettingsPage::updateFont()
+{
+ const QString &family = m_ui->familyComboBox->currentFont().family();
+ m_font.setFamily(family);
+
+ int fontSize = 14;
+ int currentIndex = m_ui->sizeComboBox->currentIndex();
+ if (currentIndex != -1)
+ fontSize = m_ui->sizeComboBox->itemData(currentIndex).toInt();
+ m_font.setPointSize(fontSize);
+
+ currentIndex = m_ui->styleComboBox->currentIndex();
+ if (currentIndex != -1)
+ m_font.setStyleName(m_ui->styleComboBox->itemText(currentIndex));
+}
+
int GeneralSettingsPage::closestPointSizeIndex(int desiredPointSize) const
{
// try to maintain selection or select closest.
diff --git a/src/plugins/help/generalsettingspage.h b/src/plugins/help/generalsettingspage.h
index 4c5aa1b2c2..0bfca8fdc6 100644
--- a/src/plugins/help/generalsettingspage.h
+++ b/src/plugins/help/generalsettingspage.h
@@ -56,9 +56,10 @@ private:
void importBookmarks();
void exportBookmarks();
- void updateFontSize();
- void updateFontStyle();
- void updateFontFamily();
+ void updateFontSizeSelector();
+ void updateFontStyleSelector();
+ void updateFontFamilySelector();
+ void updateFont();
int closestPointSizeIndex(int desiredPointSize) const;
QFont m_font;
diff --git a/src/plugins/help/helpmode.cpp b/src/plugins/help/helpmode.cpp
index bf019a2e9e..3d5e20304a 100644
--- a/src/plugins/help/helpmode.cpp
+++ b/src/plugins/help/helpmode.cpp
@@ -35,7 +35,7 @@ using namespace Help::Internal;
HelpMode::HelpMode(QObject *parent)
: Core::IMode(parent)
{
- setObjectName(QLatin1String("HelpMode"));
+ setObjectName("HelpMode");
setContext(Core::Context(Constants::C_MODE_HELP));
setIcon(Utils::Icon::modeIcon(Icons::MODE_HELP_CLASSIC,
Icons::MODE_HELP_FLAT, Icons::MODE_HELP_FLAT_ACTIVE));
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index b4ec58dca1..fc1603a9cf 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -132,8 +132,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
if (!locale.isEmpty()) {
QTranslator *qtr = new QTranslator(this);
QTranslator *qhelptr = new QTranslator(this);
- const QString &creatorTrPath = ICore::resourcePath()
- + QLatin1String("/translations");
+ const QString &creatorTrPath = ICore::resourcePath() + "/translations";
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &trFile = QLatin1String("assistant_") + locale;
const QString &helpTrFile = QLatin1String("qt_help_") + locale;
@@ -181,7 +180,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
QAction *action;
// Add Contents, Index, and Context menu items
- action = new QAction(QIcon::fromTheme(QLatin1String("help-contents")),
+ action = new QAction(QIcon::fromTheme("help-contents"),
tr(Constants::SB_CONTENTS), this);
cmd = ActionManager::registerAction(action, "Help.ContentsMenu");
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
@@ -240,7 +239,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
connect(remoteHelpFilter, &RemoteHelpFilter::linkActivated, this,
&HelpPlugin::showLinkInHelpMode);
- QDesktopServices::setUrlHandler(QLatin1String("qthelp"), HelpManager::instance(), "handleHelpRequest");
+ QDesktopServices::setUrlHandler("qthelp", HelpManager::instance(), "handleHelpRequest");
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &HelpPlugin::modeChanged);
@@ -255,7 +254,7 @@ void HelpPlugin::extensionsInitialized()
{
QStringList filesToRegister;
// we might need to register creators inbuild help
- filesToRegister.append(ICore::documentationPath() + QLatin1String("/qtcreator.qch"));
+ filesToRegister.append(ICore::documentationPath() + "/qtcreator.qch");
HelpManager::registerDocumentation(filesToRegister);
}
@@ -274,7 +273,7 @@ void HelpPlugin::resetFilter()
{
const QString &filterInternal = QString::fromLatin1("Qt Creator %1.%2.%3")
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE);
- QRegExp filterRegExp(QLatin1String("Qt Creator \\d*\\.\\d*\\.\\d*"));
+ QRegExp filterRegExp("Qt Creator \\d*\\.\\d*\\.\\d*");
QHelpEngineCore *engine = &LocalHelpManager::helpEngine();
const QStringList &filters = engine->customFilters();
@@ -310,8 +309,7 @@ void HelpPlugin::saveExternalWindowSettings()
return;
m_externalWindowState = m_externalWindow->geometry();
QSettings *settings = ICore::settings();
- settings->setValue(QLatin1String(kExternalWindowStateKey),
- qVariantFromValue(m_externalWindowState));
+ settings->setValue(kExternalWindowStateKey, qVariantFromValue(m_externalWindowState));
}
HelpWidget *HelpPlugin::createHelpWidget(const Context &context, HelpWidget::WidgetStyle style)
@@ -351,7 +349,7 @@ HelpViewer *HelpPlugin::externalHelpViewer()
HelpWidget::ExternalWindow);
if (m_externalWindowState.isNull()) {
QSettings *settings = ICore::settings();
- m_externalWindowState = settings->value(QLatin1String(kExternalWindowStateKey)).toRect();
+ m_externalWindowState = settings->value(kExternalWindowStateKey).toRect();
}
if (m_externalWindowState.isNull())
m_externalWindow->resize(650, 700);
@@ -533,11 +531,11 @@ static QUrl findBestLink(const QMap<QString, QUrl> &links, QString *highlightId)
QUrl source = links.constBegin().value();
// workaround to show the latest Qt version
int version = 0;
- QRegExp exp(QLatin1String("(\\d+)"));
+ QRegExp exp("(\\d+)");
foreach (const QUrl &link, links) {
const QString &authority = link.authority();
- if (authority.startsWith(QLatin1String("com.trolltech."))
- || authority.startsWith(QLatin1String("org.qt-project."))) {
+ if (authority.startsWith("com.trolltech.")
+ || authority.startsWith("org.qt-project.")) {
if (exp.indexIn(authority) >= 0) {
const int tmpVersion = exp.cap(1).toInt();
if (tmpVersion > version) {
@@ -593,13 +591,13 @@ void HelpPlugin::showContextHelp()
void HelpPlugin::activateIndex()
{
activateHelpMode();
- m_centralWidget->activateSideBarItem(QLatin1String(Constants::HELP_INDEX));
+ m_centralWidget->activateSideBarItem(Constants::HELP_INDEX);
}
void HelpPlugin::activateContents()
{
activateHelpMode();
- m_centralWidget->activateSideBarItem(QLatin1String(Constants::HELP_CONTENTS));
+ m_centralWidget->activateSideBarItem(Constants::HELP_CONTENTS);
}
void HelpPlugin::highlightSearchTermsInContextHelp()
@@ -619,15 +617,15 @@ void HelpPlugin::handleHelpRequest(const QUrl &url, HelpManager::HelpViewerLocat
QString address = url.toString();
if (!HelpManager::findFile(url).isValid()) {
- if (address.startsWith(QLatin1String("qthelp://org.qt-project."))
- || address.startsWith(QLatin1String("qthelp://com.nokia."))
- || address.startsWith(QLatin1String("qthelp://com.trolltech."))) {
+ if (address.startsWith("qthelp://org.qt-project.")
+ || address.startsWith("qthelp://com.nokia.")
+ || address.startsWith("qthelp://com.trolltech.")) {
// local help not installed, resort to external web help
- QString urlPrefix = QLatin1String("http://doc.qt.io/");
- if (url.authority() == QLatin1String("org.qt-project.qtcreator"))
+ QString urlPrefix = "http://doc.qt.io/";
+ if (url.authority() == "org.qt-project.qtcreator")
urlPrefix.append(QString::fromLatin1("qtcreator"));
else
- urlPrefix.append(QLatin1String("latest"));
+ urlPrefix.append("latest");
address = urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/')));
}
}
@@ -641,12 +639,12 @@ void HelpPlugin::handleHelpRequest(const QUrl &url, HelpManager::HelpViewerLocat
void HelpPlugin::slotOpenSupportPage()
{
- showLinkInHelpMode(QUrl(QLatin1String("qthelp://org.qt-project.qtcreator/doc/technical-support.html")));
+ showLinkInHelpMode(QUrl("qthelp://org.qt-project.qtcreator/doc/technical-support.html"));
}
void HelpPlugin::slotReportBug()
{
- QDesktopServices::openUrl(QUrl(QLatin1String("https://bugreports.qt.io")));
+ QDesktopServices::openUrl(QUrl("https://bugreports.qt.io"));
}
void HelpPlugin::doSetupIfNeeded()
diff --git a/src/plugins/help/helpviewer.cpp b/src/plugins/help/helpviewer.cpp
index 101769070b..ba640fee5d 100644
--- a/src/plugins/help/helpviewer.cpp
+++ b/src/plugins/help/helpviewer.cpp
@@ -88,8 +88,8 @@ HelpViewer::HelpViewer(QWidget *parent)
bool HelpViewer::isLocalUrl(const QUrl &url)
{
- return url.scheme() == QLatin1String("about") // "No documenation available"
- || url.scheme() == QLatin1String("qthelp");
+ return url.scheme() == "about" // "No documenation available"
+ || url.scheme() == "qthelp";
}
bool HelpViewer::canOpenPage(const QString &url)
@@ -109,7 +109,7 @@ QString HelpViewer::mimeFromUrl(const QUrl &url)
return QLatin1String(e->mimeType);
++e;
}
- return QLatin1String("");
+ return QString();
}
bool HelpViewer::launchWithExternalApp(const QUrl &url)
@@ -123,7 +123,7 @@ bool HelpViewer::launchWithExternalApp(const QUrl &url)
const QString& path = resolvedUrl.path();
if (!canOpenPage(path)) {
Utils::TempFileSaver saver(QDir::tempPath()
- + QLatin1String("/qtchelp_XXXXXX.") + QFileInfo(path).completeSuffix());
+ + "/qtchelp_XXXXXX." + QFileInfo(path).completeSuffix());
saver.setAutoRemove(false);
if (!saver.hasError())
saver.write(helpEngine.fileData(resolvedUrl));
diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp
index a0a89a5345..b79c9bfe64 100644
--- a/src/plugins/help/helpwidget.cpp
+++ b/src/plugins/help/helpwidget.cpp
@@ -296,7 +296,7 @@ void HelpWidget::addSideBar()
bool supportsNewPages = (m_style == ModeWidget);
auto contentWindow = new ContentWindow;
- auto contentItem = new Core::SideBarItem(contentWindow, QLatin1String(Constants::HELP_CONTENTS));
+ auto contentItem = new Core::SideBarItem(contentWindow, Constants::HELP_CONTENTS);
contentWindow->setOpenInNewPageActionVisible(supportsNewPages);
contentWindow->setWindowTitle(HelpPlugin::tr(Constants::SB_CONTENTS));
connect(contentWindow, &ContentWindow::linkActivated,
@@ -305,10 +305,10 @@ void HelpWidget::addSideBar()
cmd = Core::ActionManager::registerAction(m_contentsAction, Constants::HELP_CONTENTS, m_context->context());
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+C")
: tr("Ctrl+Shift+C")));
- shortcutMap.insert(QLatin1String(Constants::HELP_CONTENTS), cmd);
+ shortcutMap.insert(Constants::HELP_CONTENTS, cmd);
auto indexWindow = new IndexWindow();
- auto indexItem = new Core::SideBarItem(indexWindow, QLatin1String(Constants::HELP_INDEX));
+ auto indexItem = new Core::SideBarItem(indexWindow, Constants::HELP_INDEX);
indexWindow->setOpenInNewPageActionVisible(supportsNewPages);
indexWindow->setWindowTitle(HelpPlugin::tr(Constants::SB_INDEX));
connect(indexWindow, &IndexWindow::linkActivated,
@@ -319,20 +319,19 @@ void HelpWidget::addSideBar()
cmd = Core::ActionManager::registerAction(m_indexAction, Constants::HELP_INDEX, m_context->context());
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I")
: tr("Ctrl+Shift+I")));
- shortcutMap.insert(QLatin1String(Constants::HELP_INDEX), cmd);
+ shortcutMap.insert(Constants::HELP_INDEX, cmd);
auto bookmarkWidget = new BookmarkWidget(&LocalHelpManager::bookmarkManager());
bookmarkWidget->setWindowTitle(HelpPlugin::tr(Constants::SB_BOOKMARKS));
bookmarkWidget->setOpenInNewPageActionVisible(supportsNewPages);
- auto bookmarkItem = new Core::SideBarItem(bookmarkWidget,
- QLatin1String(Constants::HELP_BOOKMARKS));
+ auto bookmarkItem = new Core::SideBarItem(bookmarkWidget, Constants::HELP_BOOKMARKS);
connect(bookmarkWidget, &BookmarkWidget::linkActivated, this, &HelpWidget::setSource);
m_bookmarkAction = new QAction(tr("Activate Help Bookmarks View"), this);
cmd = Core::ActionManager::registerAction(m_bookmarkAction, Constants::HELP_BOOKMARKS,
m_context->context());
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Alt+Meta+M")
: tr("Ctrl+Shift+B")));
- shortcutMap.insert(QLatin1String(Constants::HELP_BOOKMARKS), cmd);
+ shortcutMap.insert(Constants::HELP_BOOKMARKS, cmd);
auto searchItem = new SearchSideBarItem;
connect(searchItem, &SearchSideBarItem::linkActivated, this, &HelpWidget::openFromSearch);
@@ -341,20 +340,19 @@ void HelpWidget::addSideBar()
m_context->context());
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+/")
: tr("Ctrl+Shift+/")));
- shortcutMap.insert(QLatin1String(Constants::HELP_SEARCH), cmd);
+ shortcutMap.insert(Constants::HELP_SEARCH, cmd);
Core::SideBarItem *openPagesItem = 0;
if (m_style == ModeWidget) {
QWidget *openPagesWidget = OpenPagesManager::instance().openPagesWidget();
openPagesWidget->setWindowTitle(HelpPlugin::tr(Constants::SB_OPENPAGES));
- openPagesItem = new Core::SideBarItem(openPagesWidget,
- QLatin1String(Constants::HELP_OPENPAGES));
+ openPagesItem = new Core::SideBarItem(openPagesWidget, Constants::HELP_OPENPAGES);
m_openPagesAction = new QAction(tr("Activate Open Help Pages View"), this);
cmd = Core::ActionManager::registerAction(m_openPagesAction, Constants::HELP_OPENPAGES,
m_context->context());
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+O")
: tr("Ctrl+Shift+O")));
- shortcutMap.insert(QLatin1String(Constants::HELP_OPENPAGES), cmd);
+ shortcutMap.insert(Constants::HELP_OPENPAGES, cmd);
}
QList<Core::SideBarItem *> itemList;
@@ -376,20 +374,20 @@ void HelpWidget::addSideBar()
m_sideBarSplitter->setSizes(QList<int>() << m_sideBar->size().width() << 300);
connect(m_contentsAction, &QAction::triggered, m_sideBar, [this]() {
- m_sideBar->activateItem(QLatin1String(Constants::HELP_CONTENTS));
+ m_sideBar->activateItem(Constants::HELP_CONTENTS);
});
connect(m_indexAction, &QAction::triggered, m_sideBar, [this]() {
- m_sideBar->activateItem(QLatin1String(Constants::HELP_INDEX));
+ m_sideBar->activateItem(Constants::HELP_INDEX);
});
connect(m_bookmarkAction, &QAction::triggered, m_sideBar, [this]() {
- m_sideBar->activateItem(QLatin1String(Constants::HELP_BOOKMARKS));
+ m_sideBar->activateItem(Constants::HELP_BOOKMARKS);
});
connect(m_searchAction, &QAction::triggered, m_sideBar, [this]() {
- m_sideBar->activateItem(QLatin1String(Constants::HELP_SEARCH));
+ m_sideBar->activateItem(Constants::HELP_SEARCH);
});
if (m_openPagesAction) {
connect(m_openPagesAction, &QAction::triggered, m_sideBar, [this]() {
- m_sideBar->activateItem(QLatin1String(Constants::HELP_OPENPAGES));
+ m_sideBar->activateItem(Constants::HELP_OPENPAGES);
});
}
}
@@ -398,9 +396,9 @@ QString HelpWidget::sideBarSettingsKey() const
{
switch (m_style) {
case ModeWidget:
- return QLatin1String(kModeSideBarSettingsKey);
+ return QString(kModeSideBarSettingsKey);
case ExternalWindow:
- return QLatin1String(kWindowSideBarSettingsKey);
+ return QString(kWindowSideBarSettingsKey);
case SideBarWidget:
QTC_CHECK(false);
break;
diff --git a/src/plugins/help/localhelpmanager.cpp b/src/plugins/help/localhelpmanager.cpp
index 2c4eb9f08b..929286687d 100644
--- a/src/plugins/help/localhelpmanager.cpp
+++ b/src/plugins/help/localhelpmanager.cpp
@@ -35,6 +35,7 @@
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
+#include <QFontDatabase>
#include <QMutexLocker>
#include <QHelpEngine>
@@ -58,8 +59,7 @@ int LocalHelpManager::m_currentFilterIndex = -1;
static const char kHelpHomePageKey[] = "Help/HomePage";
static const char kFontFamilyKey[] = "Help/FallbackFontFamily";
-static const char kFontStyleKey[] = "Help/FallbackFontStyle";
-static const char kFontWeightKey[] = "Help/FallbackFontWeight";
+static const char kFontStyleNameKey[] = "Help/FallbackFontStyleName";
static const char kFontSizeKey[] = "Help/FallbackFontSize";
static const char kStartOptionKey[] = "Help/StartOption";
static const char kContextHelpOptionKey[] = "Help/ContextHelpOption";
@@ -68,17 +68,28 @@ static const char kLastShownPagesKey[] = "Help/LastShownPages";
static const char kLastShownPagesZoomKey[] = "Help/LastShownPagesZoom";
static const char kLastSelectedTabKey[] = "Help/LastSelectedTab";
+// TODO remove some time after 4.1
+static const char kFontStyleKey[] = "Help/FallbackFontStyle";
+static const char kFontWeightKey[] = "Help/FallbackFontWeight";
static const QFont::Style kDefaultFallbackFontStyle = QFont::StyleNormal;
static const int kDefaultFallbackFontWeight = QFont::Normal;
+
static const int kDefaultFallbackFontSize = 14;
static QString defaultFallbackFontFamily()
{
if (Utils::HostOsInfo::isMacHost())
- return QLatin1String("Helvetica");
+ return QString("Helvetica");
if (Utils::HostOsInfo::isAnyUnixHost())
- return QLatin1String("sans-serif");
- return QLatin1String("Arial");
+ return QString("sans-serif");
+ return QString("Arial");
+}
+
+static QString defaultFallbackFontStyleName(const QString &fontFamily)
+{
+ const QStringList styles = QFontDatabase().styles(fontFamily);
+ QTC_ASSERT(!styles.isEmpty(), return QString("Regular"));
+ return styles.first();
}
template <typename T>
@@ -91,19 +102,6 @@ static void setOrRemoveSetting(const char *key, const T &value, const T &default
settings->setValue(QLatin1String(key), value);
}
-// TODO remove some time after Qt Creator 3.5
-static QVariant getSettingWithFallback(const QString &settingsKey,
- const QString &fallbackSettingsKey,
- const QVariant &fallbackSettingsValue)
-{
- QSettings *settings = Core::ICore::settings();
- if (settings->contains(settingsKey))
- return settings->value(settingsKey);
- // read from help engine for old settings
- // TODO remove some time after Qt Creator 3.5
- return LocalHelpManager::helpEngine().customValue(fallbackSettingsKey, fallbackSettingsValue);
-}
-
LocalHelpManager::LocalHelpManager(QObject *parent)
: QObject(parent)
{
@@ -139,40 +137,51 @@ QString LocalHelpManager::defaultHomePage()
QString LocalHelpManager::homePage()
{
- return Core::ICore::settings()->value(QLatin1String(kHelpHomePageKey),
- defaultHomePage()).toString();
+ return Core::ICore::settings()->value(kHelpHomePageKey, defaultHomePage()).toString();
}
void LocalHelpManager::setHomePage(const QString &page)
{
- Core::ICore::settings()->setValue(QLatin1String(kHelpHomePageKey), page);
+ Core::ICore::settings()->setValue(kHelpHomePageKey, page);
}
QFont LocalHelpManager::fallbackFont()
{
QSettings *settings = Core::ICore::settings();
- const QString family = settings->value(QLatin1String(kFontFamilyKey), defaultFallbackFontFamily()).toString();
- const QFont::Style style = QFont::Style(settings->value(QLatin1String(kFontStyleKey), kDefaultFallbackFontStyle).toInt());
- const int weight = settings->value(QLatin1String(kFontWeightKey), kDefaultFallbackFontWeight).toInt();
- const int size = settings->value(QLatin1String(kFontSizeKey), kDefaultFallbackFontSize).toInt();
- QFont font(family, size, weight);
- font.setStyle(style);
+ const QString family = settings->value(kFontFamilyKey, defaultFallbackFontFamily()).toString();
+ const int size = settings->value(kFontSizeKey, kDefaultFallbackFontSize).toInt();
+ QFont font(family, size);
+ // TODO remove reading of old settings some time after 4.1
+ if (settings->contains(kFontStyleKey) && settings->contains(kFontWeightKey)) {
+ const QFont::Style style = QFont::Style(settings->value(kFontStyleKey, kDefaultFallbackFontStyle).toInt());
+ const int weight = settings->value(kFontWeightKey, kDefaultFallbackFontWeight).toInt();
+ font.setStyle(style);
+ font.setWeight(weight);
+ } else {
+ const QString styleName = settings->value(kFontStyleNameKey,
+ defaultFallbackFontStyleName(font.family())).toString();
+ font.setStyleName(styleName);
+ }
return font;
}
void LocalHelpManager::setFallbackFont(const QFont &font)
{
+ {
+ // TODO remove removal of old settings some time after 4.1
+ QSettings *settings = Core::ICore::settings();
+ settings->remove(kFontStyleKey);
+ settings->remove(kFontWeightKey);
+ }
setOrRemoveSetting(kFontFamilyKey, font.family(), defaultFallbackFontFamily());
- setOrRemoveSetting(kFontStyleKey, font.style(), kDefaultFallbackFontStyle);
- setOrRemoveSetting(kFontWeightKey, font.weight(), kDefaultFallbackFontWeight);
+ setOrRemoveSetting(kFontStyleNameKey, font.styleName(), defaultFallbackFontStyleName(font.family()));
setOrRemoveSetting(kFontSizeKey, font.pointSize(), kDefaultFallbackFontSize);
emit m_instance->fallbackFontChanged(font);
}
LocalHelpManager::StartOption LocalHelpManager::startOption()
{
- const QVariant value = getSettingWithFallback(QLatin1String(kStartOptionKey),
- QLatin1String("StartOption"), ShowLastPages);
+ const QVariant value = Core::ICore::settings()->value(kStartOptionKey, ShowLastPages);
bool ok;
int optionValue = value.toInt(&ok);
if (!ok)
@@ -192,14 +201,13 @@ LocalHelpManager::StartOption LocalHelpManager::startOption()
void LocalHelpManager::setStartOption(LocalHelpManager::StartOption option)
{
- Core::ICore::settings()->setValue(QLatin1String(kStartOptionKey), option);
+ Core::ICore::settings()->setValue(kStartOptionKey, option);
}
Core::HelpManager::HelpViewerLocation LocalHelpManager::contextHelpOption()
{
- const QVariant value = getSettingWithFallback(QLatin1String(kContextHelpOptionKey),
- QLatin1String("ContextHelpOption"),
- Core::HelpManager::SideBySideIfPossible);
+ const QVariant value = Core::ICore::settings()->value(kContextHelpOptionKey,
+ Core::HelpManager::SideBySideIfPossible);
bool ok;
int optionValue = value.toInt(&ok);
if (!ok)
@@ -221,39 +229,35 @@ Core::HelpManager::HelpViewerLocation LocalHelpManager::contextHelpOption()
void LocalHelpManager::setContextHelpOption(Core::HelpManager::HelpViewerLocation location)
{
- Core::ICore::settings()->setValue(QLatin1String(kContextHelpOptionKey), location);
+ Core::ICore::settings()->setValue(kContextHelpOptionKey, location);
}
bool LocalHelpManager::returnOnClose()
{
- const QVariant value = getSettingWithFallback(QLatin1String(kReturnOnCloseKey),
- QLatin1String("ReturnOnClose"), false);
+ const QVariant value = Core::ICore::settings()->value(kReturnOnCloseKey, false);
return value.toBool();
}
void LocalHelpManager::setReturnOnClose(bool returnOnClose)
{
- Core::ICore::settings()->setValue(QLatin1String(kReturnOnCloseKey), returnOnClose);
+ Core::ICore::settings()->setValue(kReturnOnCloseKey, returnOnClose);
emit m_instance->returnOnCloseChanged();
}
QStringList LocalHelpManager::lastShownPages()
{
- const QVariant value = getSettingWithFallback(QLatin1String(kLastShownPagesKey),
- QLatin1String("LastShownPages"), QVariant());
+ const QVariant value = Core::ICore::settings()->value(kLastShownPagesKey, QVariant());
return value.toString().split(Constants::ListSeparator, QString::SkipEmptyParts);
}
void LocalHelpManager::setLastShownPages(const QStringList &pages)
{
- Core::ICore::settings()->setValue(QLatin1String(kLastShownPagesKey),
- pages.join(Constants::ListSeparator));
+ Core::ICore::settings()->setValue(kLastShownPagesKey, pages.join(Constants::ListSeparator));
}
QList<float> LocalHelpManager::lastShownPagesZoom()
{
- const QVariant value = getSettingWithFallback(QLatin1String(kLastShownPagesZoomKey),
- QLatin1String("LastShownPagesZoom"), QVariant());
+ const QVariant value = Core::ICore::settings()->value(kLastShownPagesZoomKey, QVariant());
const QStringList stringValues = value.toString().split(Constants::ListSeparator,
QString::SkipEmptyParts);
return Utils::transform(stringValues, [](const QString &str) { return str.toFloat(); });
@@ -263,20 +267,19 @@ void LocalHelpManager::setLastShownPagesZoom(const QList<float> &zoom)
{
const QStringList stringValues = Utils::transform(zoom,
[](float z) { return QString::number(z); });
- Core::ICore::settings()->setValue(QLatin1String(kLastShownPagesZoomKey),
+ Core::ICore::settings()->setValue(kLastShownPagesZoomKey,
stringValues.join(Constants::ListSeparator));
}
int LocalHelpManager::lastSelectedTab()
{
- const QVariant value = getSettingWithFallback(QLatin1String(kLastSelectedTabKey),
- QLatin1String("LastTabPage"), 0);
+ const QVariant value = Core::ICore::settings()->value(kLastSelectedTabKey, 0);
return value.toInt();
}
void LocalHelpManager::setLastSelectedTab(int index)
{
- Core::ICore::settings()->setValue(QLatin1String(kLastSelectedTabKey), index);
+ Core::ICore::settings()->setValue(kLastSelectedTabKey, index);
}
void LocalHelpManager::setupGuiHelpEngine()
@@ -330,11 +333,11 @@ bool LocalHelpManager::isValidUrl(const QString &link)
if (!url.isValid())
return false;
const QString scheme = url.scheme();
- return (scheme == QLatin1String("qthelp")
- || scheme == QLatin1String("about")
- || scheme == QLatin1String("file")
- || scheme == QLatin1String("http")
- || scheme == QLatin1String("https"));
+ return (scheme == "qthelp"
+ || scheme == "about"
+ || scheme == "file"
+ || scheme == "http"
+ || scheme == "https");
}
QByteArray LocalHelpManager::loadErrorMessage(const QUrl &url, const QString &errorString)
@@ -411,11 +414,11 @@ LocalHelpManager::HelpData LocalHelpManager::helpData(const QUrl &url)
data.data = engine.fileData(data.resolvedUrl);
data.mimeType = HelpViewer::mimeFromUrl(data.resolvedUrl);
if (data.mimeType.isEmpty())
- data.mimeType = QLatin1String("application/octet-stream");
+ data.mimeType = "application/octet-stream";
} else {
data.data = loadErrorMessage(url, QCoreApplication::translate(
"Help", "The page could not be found"));
- data.mimeType = QLatin1String("text/html");
+ data.mimeType = "text/html";
}
return data;
}
diff --git a/src/plugins/help/openpagesmodel.cpp b/src/plugins/help/openpagesmodel.cpp
index d03bfa6b3b..3ae610824e 100644
--- a/src/plugins/help/openpagesmodel.cpp
+++ b/src/plugins/help/openpagesmodel.cpp
@@ -57,7 +57,7 @@ QVariant OpenPagesModel::data(const QModelIndex &index, int role) const
return m_pages.at(index.row())->source().toString();
case Qt::DisplayRole: {
QString title = m_pages.at(index.row())->title();
- title.replace(QLatin1Char('&'), QLatin1String("&&"));
+ title.replace('&', "&&");
return title.isEmpty() ? tr("(Untitled)") : title;
}
default:
diff --git a/src/plugins/help/qtwebkithelpviewer.cpp b/src/plugins/help/qtwebkithelpviewer.cpp
index 70b8e1a226..e1f43832ee 100644
--- a/src/plugins/help/qtwebkithelpviewer.cpp
+++ b/src/plugins/help/qtwebkithelpviewer.cpp
@@ -476,11 +476,11 @@ void QtWebKitHelpViewer::highlightId(const QString &id)
if (m_oldHighlightId == id)
return;
const QWebElement &document = m_webView->page()->mainFrame()->documentElement();
- const QWebElementCollection &collection = document.findAll(QLatin1String("h3.fn a"));
+ const QWebElementCollection &collection = document.findAll("h3.fn a");
const QLatin1String property("background-color");
foreach (const QWebElement &element, collection) {
- const QString &name = element.attribute(QLatin1String("name"));
+ const QString &name = element.attribute("name");
if (name.isEmpty())
continue;
@@ -495,7 +495,7 @@ void QtWebKitHelpViewer::highlightId(const QString &id)
QWebElement parent = element.parent();
m_oldHighlightStyle = parent.styleProperty(property,
QWebElement::ComputedStyle);
- parent.setStyleProperty(property, QLatin1String("yellow"));
+ parent.setStyleProperty(property, "yellow");
}
}
m_oldHighlightId = id;
@@ -575,7 +575,7 @@ bool QtWebKitHelpViewer::findText(const QString &text, FindFlags flags,
*wrapped = true;
}
options = QWebPage::HighlightAllOccurrences;
- m_webView->findText(QLatin1String(""), options); // clear first
+ m_webView->findText("", options); // clear first
m_webView->findText(text, options); // force highlighting of all other matches
return found;
}
diff --git a/src/plugins/help/remotehelpfilter.cpp b/src/plugins/help/remotehelpfilter.cpp
index 49ee2687c6..74377a3bb4 100644
--- a/src/plugins/help/remotehelpfilter.cpp
+++ b/src/plugins/help/remotehelpfilter.cpp
@@ -88,13 +88,13 @@ RemoteHelpFilter::RemoteHelpFilter()
setId("RemoteHelpFilter");
setDisplayName(tr("Web Search"));
setIncludedByDefault(false);
- setShortcutString(QLatin1String("r"));
+ setShortcutString("r");
- m_remoteUrls.append(QLatin1String("https://www.bing.com/search?q=%1"));
- m_remoteUrls.append(QLatin1String("https://www.google.com/search?q=%1"));
- m_remoteUrls.append(QLatin1String("https://search.yahoo.com/search?p=%1"));
- m_remoteUrls.append(QLatin1String("https://www.cplusplus.com/reference/stl/%1"));
- m_remoteUrls.append(QLatin1String("https://en.wikipedia.org/w/index.php?search=%1"));
+ m_remoteUrls.append("https://www.bing.com/search?q=%1");
+ m_remoteUrls.append("https://www.google.com/search?q=%1");
+ m_remoteUrls.append("https://search.yahoo.com/search?p=%1");
+ m_remoteUrls.append("https://www.cplusplus.com/reference/stl/%1");
+ m_remoteUrls.append("https://en.wikipedia.org/w/index.php?search=%1");
}
RemoteHelpFilter::~RemoteHelpFilter()
diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp
index f8d7875e90..bae7241a34 100644
--- a/src/plugins/help/searchwidget.cpp
+++ b/src/plugins/help/searchwidget.cpp
@@ -159,15 +159,15 @@ void SearchWidget::search() const
{
static QStringList charsToEscapeList;
if (charsToEscapeList.isEmpty()) {
- charsToEscapeList << QLatin1String("\\") << QLatin1String("+")
- << QLatin1String("-") << QLatin1String("!") << QLatin1String("(")
- << QLatin1String(")") << QLatin1String(":") << QLatin1String("^")
- << QLatin1String("[") << QLatin1String("]") << QLatin1String("{")
- << QLatin1String("}") << QLatin1String("~");
+ charsToEscapeList << "\\" << "+"
+ << "-" << "!" << "("
+ << ")" << ":" << "^"
+ << "[" << "]" << "{"
+ << "}" << "~";
}
- static QString escapeChar(QLatin1String("\\"));
- static QRegExp regExp(QLatin1String("[\\+\\-\\!\\(\\)\\^\\[\\]\\{\\}~:]"));
+ static QString escapeChar("\\");
+ static QRegExp regExp("[\\+\\-\\!\\(\\)\\^\\[\\]\\{\\}~:]");
QList<QHelpSearchQuery> escapedQueries;
const QList<QHelpSearchQuery> queries = searchEngine->queryWidget()->query();
@@ -299,7 +299,7 @@ QStringList SearchWidget::currentSearchTerms() const
// #pragma mark -- SearchSideBarItem
SearchSideBarItem::SearchSideBarItem()
- : SideBarItem(new SearchWidget, QLatin1String(Constants::HELP_SEARCH))
+ : SideBarItem(new SearchWidget, Constants::HELP_SEARCH)
{
widget()->setWindowTitle(HelpPlugin::tr(Constants::SB_SEARCH));
connect(static_cast<SearchWidget *>(widget()), &SearchWidget::linkActivated,
diff --git a/src/plugins/help/textbrowserhelpviewer.cpp b/src/plugins/help/textbrowserhelpviewer.cpp
index 81a7a70157..97530821cf 100644
--- a/src/plugins/help/textbrowserhelpviewer.cpp
+++ b/src/plugins/help/textbrowserhelpviewer.cpp
@@ -366,7 +366,7 @@ void TextBrowserHelpWidget::scaleDown()
void TextBrowserHelpWidget::contextMenuEvent(QContextMenuEvent *event)
{
- QMenu menu(QLatin1String(""), 0);
+ QMenu menu("", 0);
QAction *copyAnchorAction = 0;
const QUrl link(linkAt(event->pos()));
diff --git a/src/plugins/help/xbelsupport.cpp b/src/plugins/help/xbelsupport.cpp
index c40617ad03..21d5a9a6c7 100644
--- a/src/plugins/help/xbelsupport.cpp
+++ b/src/plugins/help/xbelsupport.cpp
@@ -50,9 +50,9 @@ void XbelWriter::writeToFile(QIODevice *device)
setDevice(device);
writeStartDocument();
- writeDTD(QLatin1String("<!DOCTYPE xbel>"));
- writeStartElement(QLatin1String("xbel"));
- writeAttribute(QLatin1String("version"), QLatin1String("1.0"));
+ writeDTD("<!DOCTYPE xbel>");
+ writeStartElement("xbel");
+ writeAttribute("version", "1.0");
QStandardItem *root = treeModel->invisibleRootItem();
for (int i = 0; i < root->rowCount(); ++i)
@@ -67,23 +67,23 @@ void XbelWriter::writeData(QStandardItem *child)
entry.title = child->data(Qt::DisplayRole).toString();
entry.url = child->data(Qt::UserRole + 10).toString();
- if (entry.url == QLatin1String("Folder")) {
- writeStartElement(QLatin1String("folder"));
+ if (entry.url == "Folder") {
+ writeStartElement("folder");
entry.folded = !child->data(Qt::UserRole + 11).toBool();
- writeAttribute(QLatin1String("folded"),
+ writeAttribute("folded",
entry.folded ? QLatin1String("yes") : QLatin1String("no"));
- writeTextElement(QLatin1String("title"), entry.title);
+ writeTextElement("title", entry.title);
for (int i = 0; i < child->rowCount(); ++i)
writeData(child->child(i));
writeEndElement();
} else {
- writeStartElement(QLatin1String("bookmark"));
- writeAttribute(QLatin1String("href"), entry.url);
- writeTextElement(QLatin1String("title"), entry.title);
+ writeStartElement("bookmark");
+ writeAttribute("href", entry.url);
+ writeTextElement("title", entry.title);
writeEndElement();
}
}
@@ -109,9 +109,9 @@ bool XbelReader::readFromFile(QIODevice *device)
readNext();
if (isStartElement()) {
- if (name() == QLatin1String("xbel")
- && attributes().value(QLatin1String("version"))
- == QLatin1String("1.0")) {
+ if (name() == "xbel"
+ && attributes().value("version")
+ == "1.0") {
readXBEL();
} else {
raiseError(QCoreApplication::translate("Help::Internal::XbelReader", "The file is not an XBEL version 1.0 file."));
@@ -131,9 +131,9 @@ void XbelReader::readXBEL()
break;
if (isStartElement()) {
- if (name() == QLatin1String("folder"))
+ if (name() == "folder")
readFolder(0);
- else if (name() == QLatin1String("bookmark"))
+ else if (name() == "bookmark")
readBookmark(0);
else
readUnknownElement();
@@ -158,10 +158,10 @@ void XbelReader::readFolder(QStandardItem *item)
{
QStandardItem *folder = createChildItem(item);
folder->setIcon(folderIcon);
- folder->setData(QLatin1String("Folder"), Qt::UserRole + 10);
+ folder->setData("Folder", Qt::UserRole + 10);
bool expanded =
- (attributes().value(QLatin1String("folded")) != QLatin1String("no"));
+ (attributes().value("folded") != "no");
folder->setData(expanded, Qt::UserRole + 11);
while (!atEnd()) {
@@ -171,11 +171,11 @@ void XbelReader::readFolder(QStandardItem *item)
break;
if (isStartElement()) {
- if (name() == QLatin1String("title"))
+ if (name() == "title")
folder->setText(readElementText());
- else if (name() == QLatin1String("folder"))
+ else if (name() == "folder")
readFolder(folder);
- else if (name() == QLatin1String("bookmark"))
+ else if (name() == "bookmark")
readBookmark(folder);
else
readUnknownElement();
@@ -188,7 +188,7 @@ void XbelReader::readBookmark(QStandardItem *item)
QStandardItem *bookmark = createChildItem(item);
bookmark->setIcon(bookmarkIcon);
bookmark->setText(QCoreApplication::translate("Help::Internal::XbelReader", "Unknown title"));
- bookmark->setData(attributes().value(QLatin1String("href")).toString(),
+ bookmark->setData(attributes().value("href").toString(),
Qt::UserRole + 10);
while (!atEnd()) {
@@ -198,7 +198,7 @@ void XbelReader::readBookmark(QStandardItem *item)
break;
if (isStartElement()) {
- if (name() == QLatin1String("title"))
+ if (name() == "title")
bookmark->setText(readElementText());
else
readUnknownElement();
diff --git a/src/plugins/ios/iosprobe.cpp b/src/plugins/ios/iosprobe.cpp
index 47c4e2c7a7..a8be1f7b2a 100644
--- a/src/plugins/ios/iosprobe.cpp
+++ b/src/plugins/ios/iosprobe.cpp
@@ -104,7 +104,7 @@ void IosProbe::detectDeveloperPaths()
if (response.result != Utils::SynchronousProcessResponse::Finished) {
qCWarning(probeLog) << QString::fromLatin1("Could not detect selected xcode with /usr/bin/xcode-select");
} else {
- QString path = response.stdOut;
+ QString path = response.stdOut();
path.chop(1);
addDeveloperPath(path);
}
diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp
index 30af8ba98e..21149bce98 100644
--- a/src/plugins/mercurial/mercurialclient.cpp
+++ b/src/plugins/mercurial/mercurialclient.cpp
@@ -73,12 +73,12 @@ bool MercurialClient::manifestSync(const QString &repository, const QString &rel
// This only works when called from the repo and outputs paths relative to it.
const QStringList args(QLatin1String("manifest"));
- QByteArray output;
- vcsFullySynchronousExec(repository, args, &output);
+ const SynchronousProcessResponse result = vcsFullySynchronousExec(repository, args);
+
const QDir repositoryDir(repository);
const QFileInfo needle = QFileInfo(repositoryDir, relativeFilename);
- const QStringList files = QString::fromLocal8Bit(output).split(QLatin1Char('\n'));
+ const QStringList files = result.stdOut().split(QLatin1Char('\n'));
foreach (const QString &fileName, files) {
const QFileInfo managedFile(repositoryDir, fileName);
if (needle == managedFile)
@@ -96,7 +96,6 @@ bool MercurialClient::synchronousClone(const QString &workingDir,
Q_UNUSED(workingDir);
Q_UNUSED(extraOptions);
QDir workingDirectory(srcLocation);
- QByteArray output;
const unsigned flags = VcsCommand::SshPasswordPrompt |
VcsCommand::ShowStdOut |
VcsCommand::ShowSuccessMessage;
@@ -104,14 +103,16 @@ bool MercurialClient::synchronousClone(const QString &workingDir,
if (workingDirectory.exists()) {
// Let's make first init
QStringList arguments(QLatin1String("init"));
- if (!vcsFullySynchronousExec(workingDirectory.path(), arguments, &output))
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(
+ workingDirectory.path(), arguments);
+ if (resp.result != SynchronousProcessResponse::Finished)
return false;
// Then pull remote repository
arguments.clear();
arguments << QLatin1String("pull") << dstLocation;
- const SynchronousProcessResponse resp1 =
- vcsSynchronousExec(workingDirectory.path(), arguments, flags);
+ const SynchronousProcessResponse resp1 = vcsSynchronousExec(
+ workingDirectory.path(), arguments, flags);
if (resp1.result != SynchronousProcessResponse::Finished)
return false;
@@ -127,15 +128,15 @@ bool MercurialClient::synchronousClone(const QString &workingDir,
// And last update repository
arguments.clear();
arguments << QLatin1String("update");
- const SynchronousProcessResponse resp2 =
- vcsSynchronousExec(workingDirectory.path(), arguments, flags);
+ const SynchronousProcessResponse resp2 = vcsSynchronousExec(
+ workingDirectory.path(), arguments, flags);
return resp2.result == SynchronousProcessResponse::Finished;
} else {
QStringList arguments(QLatin1String("clone"));
arguments << dstLocation << workingDirectory.dirName();
workingDirectory.cdUp();
- const SynchronousProcessResponse resp =
- vcsSynchronousExec(workingDirectory.path(), arguments, flags);
+ const SynchronousProcessResponse resp = vcsSynchronousExec(
+ workingDirectory.path(), arguments, flags);
return resp.result == SynchronousProcessResponse::Finished;
}
}
@@ -157,7 +158,7 @@ bool MercurialClient::synchronousPull(const QString &workingDir, const QString &
workingDir, vcsBinary(), args, vcsTimeoutS(), flags, 0, env);
const bool ok = resp.result == SynchronousProcessResponse::Finished;
- parsePullOutput(resp.stdOut.trimmed());
+ parsePullOutput(resp.stdOut().trimmed());
return ok;
}
@@ -194,24 +195,22 @@ QStringList MercurialClient::parentRevisionsSync(const QString &workingDirectory
args << QLatin1String("parents") << QLatin1String("-r") <<revision;
if (!file.isEmpty())
args << file;
- QByteArray outputData;
- if (!vcsFullySynchronousExec(workingDirectory, args, &outputData))
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, args);
+ if (resp.result != SynchronousProcessResponse::Finished)
return QStringList();
- const QString output = SynchronousProcess::normalizeNewlines(
- QString::fromLocal8Bit(outputData));
/* Looks like: \code
changeset: 0:031a48610fba
user: ...
\endcode */
// Obtain first line and split by blank-delimited tokens
- const QStringList lines = output.split(QLatin1Char('\n'));
+ const QStringList lines = resp.stdOut().split(QLatin1Char('\n'));
if (lines.size() < 1) {
- VcsOutputWindow::appendSilently(msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(output)));
+ VcsOutputWindow::appendSilently(msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(resp.stdOut())));
return QStringList();
}
QStringList changeSets = lines.front().simplified().split(QLatin1Char(' '));
if (changeSets.size() < 2) {
- VcsOutputWindow::appendSilently(msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(output)));
+ VcsOutputWindow::appendSilently(msgParentRevisionFailed(workingDirectory, revision, msgParseParentsOutputFailed(resp.stdOut())));
return QStringList();
}
// Remove revision numbers
@@ -231,18 +230,15 @@ QString MercurialClient::shortDescriptionSync(const QString &workingDirectory,
const QString &revision,
const QString &format)
{
- QString description;
QStringList args;
args << QLatin1String("log") << QLatin1String("-r") <<revision;
if (!format.isEmpty())
args << QLatin1String("--template") << format;
- QByteArray outputData;
- if (!vcsFullySynchronousExec(workingDirectory, args, &outputData))
+
+ const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, args);
+ if (resp.result != SynchronousProcessResponse::Finished)
return revision;
- description = commandOutputFromLocal8Bit(outputData);
- if (description.endsWith(QLatin1Char('\n')))
- description.truncate(description.size() - 1);
- return description;
+ return stripLastNewline(resp.stdOut());
}
// Default format: "SHA1 (author summmary)"
@@ -258,9 +254,7 @@ bool MercurialClient::managesFile(const QString &workingDirectory, const QString
{
QStringList args;
args << QLatin1String("status") << QLatin1String("--unknown") << fileName;
- QByteArray output;
- vcsFullySynchronousExec(workingDirectory, args, &output);
- return output.isEmpty();
+ return vcsFullySynchronousExec(workingDirectory, args).stdOut().isEmpty();
}
void MercurialClient::incoming(const QString &repositoryRoot, const QString &repository)
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index 5696e55760..a351014293 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -1016,8 +1016,8 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
PerforceResponse response;
response.error = true;
response.exitCode = sp_resp.exitCode;
- response.stdErr = sp_resp.stdErr;
- response.stdOut = sp_resp.stdOut;
+ response.stdErr = sp_resp.stdErr();
+ response.stdOut = sp_resp.stdOut();
switch (sp_resp.result) {
case SynchronousProcessResponse::Finished:
response.error = false;
diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
index 302f049101..0b00f00974 100644
--- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
+++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
@@ -288,7 +288,7 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env,
}
// The SDK/MSVC scripts do not return exit codes != 0. Check on stdout.
- const QString stdOut = response.stdOut;
+ const QString stdOut = response.stdOut();
//
// Now parse the file to get the environment settings
diff --git a/src/plugins/projectexplorer/buildprogress.cpp b/src/plugins/projectexplorer/buildprogress.cpp
index f42790b7ff..256ec44d8a 100644
--- a/src/plugins/projectexplorer/buildprogress.cpp
+++ b/src/plugins/projectexplorer/buildprogress.cpp
@@ -34,6 +34,7 @@
#include <QLabel>
#include <QHBoxLayout>
#include <QPixmap>
+#include <QVariant>
#include <QVBoxLayout>
using namespace ProjectExplorer;
@@ -79,6 +80,8 @@ BuildProgress::BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation
m_warningLabel->setFont(f);
m_errorLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_errorLabel->palette()));
m_warningLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_warningLabel->palette()));
+ m_errorLabel->setProperty("_q_custom_style_disabled", QVariant(true));
+ m_warningLabel->setProperty("_q_custom_style_disabled", QVariant(true));
m_errorIcon->setAlignment(Qt::AlignRight);
m_warningIcon->setAlignment(Qt::AlignRight);
diff --git a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
index 59487384c1..25d009908b 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
@@ -116,15 +116,15 @@ static bool
if (response.result != Utils::SynchronousProcessResponse::Finished) {
*errorMessage = QString::fromLatin1("Generator script failed: %1")
.arg(response.exitMessage(binary, 30));
- if (!response.stdErr.isEmpty()) {
+ const QString stdErr = response.stdErr();
+ if (!stdErr.isEmpty()) {
errorMessage->append(QLatin1Char('\n'));
- errorMessage->append(response.stdErr);
+ errorMessage->append(stdErr);
}
return false;
}
if (stdOut) {
- *stdOut = response.stdOut;
- stdOut->remove(QLatin1Char('\r'));
+ *stdOut = response.stdOut();
if (CustomWizard::verbose())
qDebug("Output: '%s'\n", qPrintable(*stdOut));
}
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index 76382a7ae6..332e24f7b8 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -359,10 +359,6 @@ QByteArray GccToolChain::predefinedMacros(const QStringList &cxxflags) const
{
QStringList allCxxflags = m_platformCodeGenFlags + cxxflags; // add only cxxflags is empty?
- QByteArray macros = macroCache(allCxxflags);
- if (!macros.isNull())
- return macros;
-
// Using a clean environment breaks ccache/distcc/etc.
Environment env = Environment::systemEnvironment();
addToEnvironment(env);
@@ -406,10 +402,15 @@ QByteArray GccToolChain::predefinedMacros(const QStringList &cxxflags) const
|| a == QLatin1String("-fPIE") || a == QLatin1String("-fpie"))
arguments << a;
}
+
+ QByteArray macros = macroCache(arguments);
+ if (!macros.isNull())
+ return macros;
+
macros = gccPredefinedMacros(m_compilerCommand, reinterpretOptions(arguments),
env.toStringList());
- setMacroCache(allCxxflags, macros);
+ setMacroCache(arguments, macros);
return macros;
}
diff --git a/src/plugins/projectexplorer/kitoptionspage.cpp b/src/plugins/projectexplorer/kitoptionspage.cpp
index f5e56cd515..360b1cd13e 100644
--- a/src/plugins/projectexplorer/kitoptionspage.cpp
+++ b/src/plugins/projectexplorer/kitoptionspage.cpp
@@ -61,19 +61,18 @@ public:
void updateState();
public:
- QTreeView *m_kitsView;
- QPushButton *m_addButton;
- QPushButton *m_cloneButton;
- QPushButton *m_delButton;
- QPushButton *m_makeDefaultButton;
-
- KitModel *m_model;
- QItemSelectionModel *m_selectionModel;
- QWidget *m_currentWidget;
+ QTreeView *m_kitsView = nullptr;
+ QPushButton *m_addButton = nullptr;
+ QPushButton *m_cloneButton = nullptr;
+ QPushButton *m_delButton = nullptr;
+ QPushButton *m_makeDefaultButton = nullptr;
+
+ KitModel *m_model = nullptr;
+ QItemSelectionModel *m_selectionModel = nullptr;
+ QWidget *m_currentWidget = nullptr;
};
KitOptionsPageWidget::KitOptionsPageWidget()
- : m_model(0), m_selectionModel(0), m_currentWidget(0)
{
m_kitsView = new QTreeView(this);
m_kitsView->setUniformRowHeights(true);
@@ -152,8 +151,6 @@ void KitOptionsPageWidget::kitSelectionChanged()
m_kitsView->scrollTo(current);
}
- adjustSize(); // Force relayout!
-
updateState();
}
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
index 035c5eaa12..975a177172 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
@@ -863,8 +863,7 @@ void MiniProjectTargetSelector::doLayout(bool keepSize)
visibleLineCount += m_listWidgets[i]->isVisibleTo(this) ? 0 : 1;
if (visibleLineCount == LAST) {
- summaryLabelHeight = visibleLineCount * QFontMetrics(m_summaryLabel->font()).height()
- + m_summaryLabel->margin() *2;
+ summaryLabelHeight = m_summaryLabel->sizeHint().height();
onlySummary = true;
} else {
if (visibleLineCount < 3) {
@@ -872,8 +871,7 @@ void MiniProjectTargetSelector::doLayout(bool keepSize)
visibleLineCount = 3;
}
if (visibleLineCount)
- summaryLabelHeight = visibleLineCount * QFontMetrics(m_summaryLabel->font()).height()
- + m_summaryLabel->margin() *2;
+ summaryLabelHeight = m_summaryLabel->sizeHint().height();
}
if (keepSize && oldSummaryLabelHeight > summaryLabelHeight)
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp
index c7e9e00988..c7e5de5196 100644
--- a/src/plugins/projectexplorer/msvctoolchain.cpp
+++ b/src/plugins/projectexplorer/msvctoolchain.cpp
@@ -253,18 +253,17 @@ QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags,
response.exitCode != 0)
return predefinedMacros;
- const QStringList output = response.stdOut.split('\n');
+ const QStringList output = Utils::filtered(response.stdOut().split('\n'),
+ [](const QString &s) { return s.startsWith('V'); });
foreach (const QString& line, output) {
- if (line.startsWith('V')) {
- QStringList split = line.split('=');
- const QString key = split.at(0).mid(1);
- QString value = split.at(1);
- predefinedMacros += "#define ";
- predefinedMacros += key.toUtf8();
- predefinedMacros += ' ';
- predefinedMacros += value.toUtf8();
- predefinedMacros += '\n';
- }
+ QStringList split = line.split('=');
+ const QString key = split.at(0).mid(1);
+ QString value = split.at(1);
+ predefinedMacros += "#define ";
+ predefinedMacros += key.toUtf8();
+ predefinedMacros += ' ';
+ predefinedMacros += value.toUtf8();
+ predefinedMacros += '\n';
}
if (debug)
qDebug() << "msvcPredefinedMacros" << predefinedMacros;
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index 822001a4e6..10cda59ea7 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -119,6 +119,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
connect(this, &Project::activeTargetChanged, this, &QbsProject::changeActiveTarget);
connect(this, &Project::addedTarget, this, &QbsProject::targetWasAdded);
+ connect(this, &Project::removedTarget, this, &QbsProject::targetWasRemoved);
connect(this, &Project::environmentChanged, this, &QbsProject::delayParsing);
connect(&m_parsingDelay, &QTimer::timeout, this, &QbsProject::startParsing);
@@ -469,6 +470,7 @@ void QbsProject::handleQbsParsingDone(bool success)
generateErrors(m_qbsProjectParser->error());
m_qbsProject = m_qbsProjectParser->qbsProject();
+ m_qbsProjects.insert(activeTarget(), m_qbsProject);
bool dataChanged = false;
if (success) {
QTC_ASSERT(m_qbsProject.isValid(), return);
@@ -529,15 +531,26 @@ void QbsProject::handleRuleExecutionDone()
void QbsProject::targetWasAdded(Target *t)
{
+ m_qbsProjects.insert(t, qbs::Project());
connect(t, &Target::activeBuildConfigurationChanged, this, &QbsProject::delayParsing);
connect(t, &Target::buildDirectoryChanged, this, &QbsProject::delayParsing);
}
+void QbsProject::targetWasRemoved(Target *t)
+{
+ m_qbsProjects.remove(t);
+}
+
void QbsProject::changeActiveTarget(Target *t)
{
BuildConfiguration *bc = 0;
- if (t && t->kit())
- bc = t->activeBuildConfiguration();
+ if (t) {
+ m_qbsProject = m_qbsProjects.value(t);
+ if (m_qbsProject.isValid())
+ m_projectData = m_qbsProject.projectData();
+ if (t->kit())
+ bc = t->activeBuildConfiguration();
+ }
buildConfigurationChanged(bc);
}
diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h
index 7edbd73cbb..a7b6dc77bd 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.h
+++ b/src/plugins/qbsprojectmanager/qbsproject.h
@@ -41,6 +41,7 @@
#include <qbs.h>
#include <QFuture>
+#include <QHash>
#include <QTimer>
namespace Core { class IDocument; }
@@ -118,6 +119,7 @@ private:
void handleQbsParsingDone(bool success);
void targetWasAdded(ProjectExplorer::Target *t);
+ void targetWasRemoved(ProjectExplorer::Target *t);
void changeActiveTarget(ProjectExplorer::Target *t);
void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
void startParsing();
@@ -145,6 +147,7 @@ private:
const qbs::GroupData &oldGroup);
const QString m_projectName;
+ QHash<ProjectExplorer::Target *, qbs::Project> m_qbsProjects;
qbs::Project m_qbsProject;
qbs::ProjectData m_projectData;
QSet<Core::IDocument *> m_qbsDocuments;
diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp
index 6edbe16910..10953f64c6 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp
@@ -158,7 +158,7 @@ void QbsProjectParser::startRuleExecution()
options.setDryRun(m_dryRun);
options.setExecuteRulesOnly(true);
m_ruleExecutionJob = m_project.buildAllProducts(
- options, qbs::Project::ProductSelectionWithNonDefault, this);
+ options, qbs::Project::ProductSelectionWithNonDefault, nullptr);
connect(m_ruleExecutionJob, &qbs::AbstractJob::finished,
this, &QbsProjectParser::handleRuleExecutionDone);
connect(m_ruleExecutionJob, &qbs::AbstractJob::taskStarted,
diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
index 594510dd28..3a31934d05 100644
--- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
+++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
@@ -379,8 +379,11 @@ QString DesktopQmakeRunConfiguration::baseWorkingDirectory() const
bool DesktopQmakeRunConfiguration::isConsoleApplication() const
{
if (QmakeProFileNode *node = projectNode()) {
- return node->variableValue(ConfigVar).contains(QLatin1String("console"))
- && !node->variableValue(QtVar).contains(QLatin1String("testlib"));
+ const QStringList config = node->variableValue(ConfigVar);
+ if (!config.contains("console") || config.contains("testcase"))
+ return false;
+ const QStringList qt = node->variableValue(QtVar);
+ return !qt.contains("testlib") && !qt.contains("qmltest");
}
return false;
}
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
index a13c86cc7c..68518b26d5 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
@@ -687,7 +687,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
- if (usages.count() > 0 && (addAlwaysNewSlot || usages.count()< 2)) {
+ if (usages.count() > 0 && (addAlwaysNewSlot || usages.count() < 2) && (!isModelNodeRoot || addAlwaysNewSlot)) {
Core::EditorManager::openEditorAt(usages.first().path, usages.first().line, usages.first().col);
if (!signalNames.isEmpty()) {
diff --git a/src/plugins/qmldesigner/components/componentcore/theming.cpp b/src/plugins/qmldesigner/components/componentcore/theming.cpp
index a2c9f52a30..a096b9b51e 100644
--- a/src/plugins/qmldesigner/components/componentcore/theming.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/theming.cpp
@@ -60,7 +60,6 @@ void Theming::insertTheme(QQmlPropertyMap *map)
/* hack for light themes */
/* The selected tab is always supposed to be lighter */
if (tabDark.value() > tabLight.value()) {
- QColor swap = tabLight.lighter(180);
tabLight = tabDark.darker(110);
tabDark = tabDark.darker(260);
}
diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.cpp b/src/plugins/qmldesigner/components/formeditor/movetool.cpp
index 2c2cd75845..86871f5873 100644
--- a/src/plugins/qmldesigner/components/formeditor/movetool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/movetool.cpp
@@ -50,7 +50,6 @@ MoveTool::MoveTool(FormEditorView *editorView)
m_selectionIndicator.setCursor(Qt::SizeAllCursor);
}
-
MoveTool::~MoveTool()
{
diff --git a/src/plugins/qmldesigner/components/importmanager/importmanager.css b/src/plugins/qmldesigner/components/importmanager/importmanager.css
index 0abacf8deb..f1293532b3 100644
--- a/src/plugins/qmldesigner/components/importmanager/importmanager.css
+++ b/src/plugins/qmldesigner/components/importmanager/importmanager.css
@@ -1,19 +1,19 @@
QPushButton, QComboBox[editable="false"],
QComboBox[editable="true"] {
- border-image: url(:/qmldesigner/images/combobox-normal.png) 4;
+ background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate;
border-width: 3;
font-size: 11px;
}
QPushButton:hover, QComboBox[editable="false"]:hover,
QComboBox[editable="true"]:hover, QMenuBar::item:hover {
- border-image: url(:/qmldesigner/images/combobox-normal.png) 4;
+ background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate;
border-width: 3;
}
QPushButton:pressed, QComboBox[editable="false"]:on,
QComboBox[editable="true"]:on, QMenuBar::item:on {
- border-image: url(:/qmldesigner/images/combobox-pressed.png) 4;
+ background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate;
border-width: 3;
}
diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp
index 94dab63cd7..6248f7c1dc 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp
@@ -41,6 +41,7 @@
#include <QPixmapCache>
#include <QMouseEvent>
#include <QPainter>
+#include <QStyleFactory>
namespace QmlDesigner {
@@ -53,6 +54,12 @@ namespace {
class TreeViewStyle : public QProxyStyle
{
public:
+ TreeViewStyle(QObject *parent) : QProxyStyle(QStyleFactory::create("fusion"))
+ {
+ setParent(parent);
+ baseStyle()->setParent(parent);
+ }
+
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const
{
static QRect mouseOverStateSavedFrameRectangle;
@@ -162,31 +169,13 @@ private: // variables
NavigatorTreeView::NavigatorTreeView(QWidget *parent)
: QTreeView(parent)
{
- TreeViewStyle *style = new TreeViewStyle;
- setStyle(style);
- style->setParent(this);
+ setStyle(new TreeViewStyle(this));
}
void NavigatorTreeView::drawSelectionBackground(QPainter *painter, const QStyleOption &option)
{
painter->save();
- if (Utils::creatorTheme()->flag(Utils::Theme::FlatToolBars)) {
- painter->setOpacity(0.5);
- painter->fillRect(option.rect, option.palette.color(QPalette::Highlight));
- } else {
- const QColor highlightColor = Utils::StyleHelper::notTooBrightHighlightColor();
- QLinearGradient gradient;
- gradient.setColorAt(0, highlightColor.lighter(130));
- gradient.setColorAt(1, highlightColor.darker(130));
- gradient.setStart(option.rect.topLeft());
- gradient.setFinalStop(option.rect.bottomLeft());
- painter->fillRect(option.rect, gradient);
- painter->setPen(highlightColor.lighter());
- const QRectF innerRect = QRectF(option.rect).adjusted(0.5, 0.5, -0.5, -0.5);
- painter->drawLine(innerRect.topLeft(), innerRect.topRight());
- painter->setPen(highlightColor.darker());
- painter->drawLine(innerRect.bottomLeft(), innerRect.bottomRight());
- }
+ painter->fillRect(option.rect, option.palette.color(QPalette::Highlight));
painter->restore();
}
diff --git a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp
index f490ada068..426b53cf38 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp
@@ -36,8 +36,6 @@
#include <QtDebug>
#include <utils/fileutils.h>
-#include <QStyleFactory>
-
namespace QmlDesigner {
NavigatorWidget::NavigatorWidget(NavigatorView *view) :
@@ -53,9 +51,6 @@ NavigatorWidget::NavigatorWidget(NavigatorView *view) :
m_treeView->setDefaultDropAction(Qt::LinkAction);
m_treeView->setHeaderHidden(true);
- QStyle *style = QStyleFactory::create("fusion");
- m_treeView->setStyle(style);
-
QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing(0);
layout->setMargin(0);
diff --git a/src/plugins/qmldesigner/components/resources/stylesheet.css b/src/plugins/qmldesigner/components/resources/stylesheet.css
index 8270ae0315..f423f75559 100644
--- a/src/plugins/qmldesigner/components/resources/stylesheet.css
+++ b/src/plugins/qmldesigner/components/resources/stylesheet.css
@@ -65,21 +65,6 @@ QLineEdit#itemLibrarySearchInput
color: creatorTheme.PanelTextColorLight;
}
-QTreeView::branch:has-siblings:!adjoins-item {
- border-image: none;
- image:none;
- }
-
- QTreeView::branch:has-siblings:adjoins-item {
- border-image: none;
- image:none;
- }
-
- QTreeView::branch:!has-children:!has-siblings:adjoins-item {
- border-image: none;
- image:none;
- }
-
QListView {
color:creatorTheme.PanelTextColorLight;
selection-color: creatorTheme.PanelTextColorLight;
diff --git a/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h b/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h
index 964625cbc1..8362c39d44 100644
--- a/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h
+++ b/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h
@@ -30,8 +30,6 @@
// Unnecessary since core isn't a dll any more.
-#define TEST_CORESHARED_EXPORT
-
#if defined(DESIGNER_CORE_LIBRARY)
# define QMLDESIGNERCORE_EXPORT Q_DECL_EXPORT
#else
@@ -62,14 +60,3 @@ enum AnchorLineType {
AnchorLineAllMask = AnchorLineVerticalMask | AnchorLineHorizontalMask
};
}
-//#if defined(TEST_EXPORTS)
-//#if defined(CORE_LIBRARY)
-//# define TEST_CORESHARED_EXPORT Q_DECL_EXPORT
-//#else
-//# define TEST_CORESHARED_EXPORT Q_DECL_IMPORT
-//#endif
-//#else
-//# define TEST_CORESHARED_EXPORT
-//#endif
-
-#include <qglobal.h>
diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp
index a8689a6e51..54489c3019 100644
--- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp
@@ -48,6 +48,7 @@
#include <QCoreApplication>
#include <QCryptographicHash>
#include <QDateTime>
+#include <QLibraryInfo>
#include <QMessageBox>
#include <QThread>
@@ -375,9 +376,11 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
environment.set(QLatin1String("QMLDESIGNER_RC_PATHS"), m_qrcMapping);
}
- if (m_availablePuppetType != FallbackPuppet) {
- environment.appendOrSet("QML2_IMPORT_PATH", m_model->importPaths().join(pathSep), pathSep);
- }
+ QStringList importPaths = m_model->importPaths();
+ if (m_availablePuppetType == FallbackPuppet)
+ importPaths.append(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath));
+ environment.appendOrSet("QML2_IMPORT_PATH", importPaths.join(pathSep), pathSep);
+
return environment.toProcessEnvironment();
}
diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp
index 9562cc5756..4229d69776 100644
--- a/src/plugins/qmldesigner/designmodewidget.cpp
+++ b/src/plugins/qmldesigner/designmodewidget.cpp
@@ -48,6 +48,7 @@
#include <extensionsystem/pluginmanager.h>
#include <utils/fileutils.h>
+#include <utils/qtcassert.h>
#include <QSettings>
#include <QToolBar>
@@ -318,8 +319,10 @@ void DesignModeWidget::setup()
m_warningWidget->setVisible(false);
connect(m_warningWidget.data(), &DocumentWarningWidget::gotoCodeClicked, [=]
(const QString &filePath, int codeLine, int codeColumn) {
- Q_UNUSED(filePath);
- Q_ASSERT(textEditor()->textDocument()->filePath().toString() == filePath);
+ Q_UNUSED(filePath);
+ QTC_ASSERT(textEditor()->textDocument()->filePath().toString() == filePath,
+ qDebug() << Q_FUNC_INFO << textEditor()->textDocument()->filePath().toString() <<
+ filePath; );
textEditor()->gotoLine(codeLine, codeColumn);
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
}
diff --git a/src/plugins/qmldesigner/documentwarningwidget.cpp b/src/plugins/qmldesigner/documentwarningwidget.cpp
index 1567bb5c14..0c55a61835 100644
--- a/src/plugins/qmldesigner/documentwarningwidget.cpp
+++ b/src/plugins/qmldesigner/documentwarningwidget.cpp
@@ -52,10 +52,6 @@ DocumentWarningWidget::DocumentWarningWidget(QWidget *parent)
, m_ignoreWarningsCheckBox(new QCheckBox(this))
, m_continueButton(new QPushButton(this))
{
- setWindowFlags(Qt::Widget); //We only want the visual style from a ToolTip
- setForegroundRole(QPalette::ToolTipText);
- setBackgroundRole(QPalette::ToolTipBase);
-
QFont boldFont = font();
boldFont.setBold(true);
m_headerLabel->setFont(boldFont);
diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.h b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.h
index 0a474750fe..d79158c05a 100644
--- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.h
+++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.h
@@ -59,9 +59,9 @@ public:
QStringList possibleSourceProperties(const BindingProperty &bindingProperty) const;
void deleteBindindByRow(int rowNumber);
void addBindingForCurrentNode();
+ void resetModel();
protected:
- void resetModel();
void addBindingProperty(const BindingProperty &property);
void updateBindingProperty(int rowNumber);
void addModelNode(const ModelNode &modelNode);
diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.cpp b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.cpp
index dde0a9e271..c594927128 100644
--- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.cpp
+++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionview.cpp
@@ -93,6 +93,8 @@ void ConnectionView::nodeReparented(const ModelNode & /*node*/, const NodeAbstra
void ConnectionView::nodeIdChanged(const ModelNode & /*node*/, const QString & /*newId*/, const QString & /*oldId*/)
{
connectionModel()->resetModel();
+ bindingModel()->resetModel();
+ dynamicPropertiesModel()->resetModel();
}
void ConnectionView::propertiesAboutToBeRemoved(const QList<AbstractProperty> & propertyList)
diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp
index 1b3f2efcde..db572f2cf9 100644
--- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp
+++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp
@@ -38,6 +38,7 @@
#include <utils/fileutils.h>
#include <QToolButton>
+#include <QStyleFactory>
namespace QmlDesigner {
@@ -51,6 +52,9 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) :
setWindowTitle(tr("Connections", "Title of connection view"));
ui->setupUi(this);
+ QStyle *style = QStyleFactory::create("fusion");
+ setStyle(style);
+
setStyleSheet(Theming::replaceCssColors(QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/connectionview/stylesheet.css")))));
//ui->tabWidget->tabBar()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp
index 5275f354d5..74fdd455ae 100644
--- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp
+++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/delegates.cpp
@@ -57,11 +57,8 @@ QStringList prependOnForSignalHandler(const QStringList &signalNames)
PropertiesComboBox::PropertiesComboBox(QWidget *parent) : QComboBox(parent)
{
- static QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("windows")));
setEditable(true);
setValidator(new QRegularExpressionValidator(QRegularExpression(QLatin1String("[a-z|A-Z|0-9|._-]*")), this));
- if (style)
- setStyle(style.data());
}
QString PropertiesComboBox::text() const
@@ -195,12 +192,6 @@ QWidget *DynamicPropertiesDelegate::createEditor(QWidget *parent, const QStyleOp
{
QWidget *widget = QStyledItemDelegate::createEditor(parent, option, index);
- if (widget) {
- static QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("windows")));
- if (style)
- widget->setStyle(style.data());
- }
-
const DynamicPropertiesModel *model = qobject_cast<const DynamicPropertiesModel*>(index.model());
model->connectionView()->allModelNodes();
diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.h b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.h
index d30dccec05..86a94a9696 100644
--- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.h
+++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/dynamicpropertiesmodel.h
@@ -63,8 +63,9 @@ public:
void updateDisplayRoleFromVariant(int row, int columns, const QVariant &variant);
void addDynamicPropertyForCurrentNode();
-protected:
void resetModel();
+
+protected:
void addProperty(const QVariant &propertyValue,
const QString &propertyType,
const AbstractProperty &abstractProperty);
diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/stylesheet.css b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/stylesheet.css
index a8fbd85ff8..d3e884ae03 100644
--- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/stylesheet.css
+++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/stylesheet.css
@@ -1,83 +1,11 @@
QFrame
{
background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate;
+ color: creatorTheme.PanelTextColorLight;
font-size: 11px;
border-radius: 0px;
}
-QPushButton {
- padding: 0px;
- font-size: 11px;
- color: #dedede;
-}
-
-QPushButton, QComboBox[editable="false"],
-QComboBox[editable="true"] {
- border-image: url(:/qmldesigner/images/combobox-normal.png) 4;
- border-width: 3;
- font-size: 11px;
-}
-
-QPushButton:hover, QComboBox[editable="false"]:hover,
-QComboBox[editable="true"]:hover, QMenuBar::item:hover {
- border-image: url(:/qmldesigner/images/combobox-normal.png) 4;
- border-width: 3;
-}
-
-QPushButton:pressed, QComboBox[editable="false"]:on,
-QComboBox[editable="true"]:on, QMenuBar::item:on {
- border-image: url(:/qmldesigner/images/combobox-pressed.png) 4;
- border-width: 3;
-}
-
-QComboBox
-{
- font-size: 11px;
- color: white;
- min-width: 60px;
-}
-
-QComboBox[editable="true"] {
- padding-right: 10px;
-}
-
-QComboBox[editable="true"]::drop-down {
- subcontrol-origin: border;
- subcontrol-position: top right;
- width: 13px;
- position: absolute;
- top: 2px;
- bottom: 2px;
- right: 2px;
-}
-
-QComboBox[editable="true"]::drop-down,
-QComboBox[editable="true"]::drop-down:hover,
-QComboBox[editable="true"]::drop-down:on {
- border-width: 0px;
- border-left-width: 3px;
-}
-
-QComboBox[editable="true"]::down-arrow:on {
- position: relative;
- top: 1px;
- left: 1px;
-}
-
-QComboBox::disabled {
- color: gray;
-}
-
-QComboBox QAbstractItemView {
- show-decoration-selected: 1;
- background-color: #494949;
- border: 1px solid black;
- margin: 0px; /* some spacing around the menu */
- color: #cacaca;
- selection-background-color: #d2d2d2;
- selection-color: #404040;
-}
-
QTableView {
color: creatorTheme.PanelTextColorLight;
}
@@ -146,12 +74,6 @@ QTabBar::tab {
color: creatorTheme.QmlDesignerTabLight;
}
-QComboBox::menu-indicator, QComboBox::down-arrow {
-image: url(:/qmldesigner/images/down_arrow.png);
- width: 7px;
- height: 7px;
-}
-
QSpinBox
{
font-size: 11px;
@@ -183,118 +105,6 @@ QSpinBox
min-height: 22px;
}
- QSpinBox::down-button {
- subcontrol-origin: border;
- subcontrol-position: bottom right;
- border-image: url(:/qmldesigner/images/spindown.png) 1;
-
- width: 16px;
- border-width: 1px;
- border-top-width: 0;
-}
-
-QSpinBox::down-button:hover {
- border-image: url(:/qmldesigner/images/spindown_hover.png) 1;
-}
-
-QSpinBox::down-button:pressed {
- border-image: url(:/qmldesigner/images/spindown_pressed.png) 1;
-}
-
-
- QSpinBox::up-button {
- subcontrol-origin: border;
- subcontrol-position: top right; /* position at bottom right corner */
- border-image: url(:/qmldesigner/images/spinup.png) 1;
-
- width: 16px;
- border-width: 1px;
-}
-
-QSpinBox::up-button:hover {
-border-image: url(:/qmldesigner/images/spinup_hover.png) 1;
-}
-
-QSpinBox::up-button:pressed {
- border-image: url(:/qmldesigner/images/spinup_pressed.png) 1;
-}
-
-
- QDoubleSpinBox::down-button {
- subcontrol-origin: border;
- subcontrol-position: bottom right;
- border-image: url(:/qmldesigner/images/spindown.png) 1;
-
- width: 16px;
- border-width: 1px;
-}
-
-QDoubleSpinBox::down-button:hover {
- border-image: url(:/qmldesigner/images/spindown_hover.png) 1;
-}
-
-QDoubleSpinBox::down-button:pressed {
- border-image: url(:/qmldesigner/images/spindown_pressed.png) 1;
-}
-
-QDoubleSpinBox::up-button {
- subcontrol-origin: border;
- subcontrol-position: top right;
- border-image: url(:/qmldesigner/images/spinup.png) 1;
-
- width: 16px;
- border-width: 1px;
-}
-
-QDoubleSpinBox::up-button:hover {
- border-image: url(:/qmldesigner/images/spinup_hover.png) 1;
-}
-
-QDoubleSpinBox::up-button:pressed {
- border-image: url(:/qmldesigner/images/spinup_pressed.png) 1;
-}
-
-QComboBox[editable="false"]::drop-down {
- subcontrol-origin: padding;
- subcontrol-position: top right;
- width: 12px;
- border-left-style: solid;
- border-left-color: black;
- border-left-width: 0px;
-}
-
-QComboBox[editable="false"]::down-arrow {
- subcontrol-origin: content;
- subcontrol-position: center;
- position: relative;
- right: 3px;
-}
-
-QComboBox[editable="false"]::down-arrow:on {
- position: relative;
- top: 1px;
-}
-
-QSpinBox::down-arrow, QSpinBox::menu-indicator, QDoubleSpinBox::down-arrow, QDoubleSpinBox::menu-indicator , QComboBox::menu-indicator, QComboBox::down-arrow {
- image: url(:/qmldesigner/images/down_arrow.png);
- width: 7px;
- height: 7px;
-}
-
-QSpinBox::down-arrow:disabled, QSpinBox::down-arrow:off, QDoubleSpinBox::down-arrow:disabled, QDoubleSpinBox::down-arrow:off {
- image: url(:/qmldesigner/images/down_arrow_disabled.png);
-}
-
-QSpinBox::up-arrow, QDoubleSpinBox::up-arrow {
- image: url(:/qmldesigner/images/up_arrow.png);
- width: 7px;
- height: 7px;
-}
-
-QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off, QDoubleSpinBox::up-arrow:disabled, QDoubleSpinBox::up-arrow:off {
- image: url(:/qmldesigner/images/up_arrow_disabled.png);
-}
-
QLineEdit
{
color: white;
diff --git a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
index 02518658f3..830b7101e2 100644
--- a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
+++ b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
@@ -37,6 +37,17 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec
{
}
+bool checkErrors(const QStringList &errors, int number)
+{
+ if (errors.length() != number) {
+ qDebug() << "Found unexpected errors:" << errors;
+ return false;
+ } else {
+ return true;
+ }
+}
+
+
void LocalQmlProfilerRunnerTest::testRunner()
{
Debugger::AnalyzerConnection connection;
@@ -53,7 +64,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
bool running = false;
int runCount = 0;
- int errors = 0;
+ QStringList errors;
auto connectRunner = [&]() {
connect(runner, &LocalQmlProfilerRunner::started, this, [&running, &runCount](){
@@ -68,10 +79,9 @@ void LocalQmlProfilerRunnerTest::testRunner()
connect(runner, &LocalQmlProfilerRunner::appendMessage, this,
[&errors](const QString &message, Utils::OutputFormat format) {
- Q_UNUSED(message);
if (format == Utils::ErrorMessageFormat && message !=
ProjectExplorer::ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput())
- ++errors;
+ errors << message;
});
};
@@ -81,7 +91,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
QTRY_COMPARE_WITH_TIMEOUT(runCount, 1, 10000);
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
- QCOMPARE(errors, 1);
+ QVERIFY(checkErrors(errors, 1));
configuration.socket = connection.analyzerSocket = LocalQmlProfilerRunner::findFreeSocket();
configuration.debuggee.executable = qApp->applicationFilePath();
@@ -99,7 +109,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
QTRY_COMPARE_WITH_TIMEOUT(runCount, 2, 10000);
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
- QCOMPARE(errors, 1);
+ QVERIFY(checkErrors(errors, 1));
delete rc;
@@ -118,11 +128,11 @@ void LocalQmlProfilerRunnerTest::testRunner()
QTRY_COMPARE_WITH_TIMEOUT(runCount, 3, 10000);
QTest::qWait(1000);
QVERIFY(running); // verify it doesn't spontaneously stop
- QCOMPARE(errors, 1);
+ QVERIFY(checkErrors(errors, 1));
rc->stop();
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
- QCOMPARE(errors, 2); // "The program has unexpectedly finished."
+ QVERIFY(checkErrors(errors, 2)); // "The program has unexpectedly finished."
delete rc;
}
diff --git a/src/plugins/qnx/qnxattachdebugsupport.cpp b/src/plugins/qnx/qnxattachdebugsupport.cpp
index 87ded8d789..74ec041beb 100644
--- a/src/plugins/qnx/qnxattachdebugsupport.cpp
+++ b/src/plugins/qnx/qnxattachdebugsupport.cpp
@@ -141,6 +141,11 @@ void QnxAttachDebugSupport::attachToProcess()
stopPDebug();
return;
}
+ if (!runControl) {
+ handleError(tr("Attaching failed."));
+ stopPDebug();
+ return;
+ }
connect(runControl, &Debugger::DebuggerRunControl::stateChanged,
this, &QnxAttachDebugSupport::handleDebuggerStateChanged);
ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::Constants::DEBUG_RUN_MODE);
diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp
index cb457b7210..06c58ef173 100644
--- a/src/plugins/qnx/qnxplugin.cpp
+++ b/src/plugins/qnx/qnxplugin.cpp
@@ -115,6 +115,6 @@ void QnxPlugin::updateDebuggerActions()
}
}
- m_attachToQnxApplication->setVisible(hasValidQnxKit);
- m_debugSeparator->setVisible(hasValidQnxKit);
+ m_attachToQnxApplication->setVisible(false && hasValidQnxKit); // FIXME
+ m_debugSeparator->setVisible(false && hasValidQnxKit); // FIXME QTCREATORBUG-16608
}
diff --git a/src/plugins/subversion/subversionclient.cpp b/src/plugins/subversion/subversionclient.cpp
index 12fdcdf4ba..93b4dcf5f4 100644
--- a/src/plugins/subversion/subversionclient.cpp
+++ b/src/plugins/subversion/subversionclient.cpp
@@ -138,14 +138,13 @@ QString SubversionClient::synchronousTopic(const QString &repository)
QStringList args;
args << QLatin1String("info");
- QByteArray stdOut;
- if (!vcsFullySynchronousExec(repository, args, &stdOut))
+ const SynchronousProcessResponse result = vcsFullySynchronousExec(repository, args);
+ if (result.result != SynchronousProcessResponse::Finished)
return QString();
const QString revisionString = QLatin1String("Revision: ");
// stdOut is ASCII only (at least in those areas we care about).
- QString output = commandOutputFromLocal8Bit(stdOut);
- foreach (const QString &line, output.split(QLatin1Char('\n'))) {
+ foreach (const QString &line, result.stdOut().split(QLatin1Char('\n'))) {
if (line.startsWith(revisionString))
return QString::fromLatin1("r") + line.mid(revisionString.count());
}
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 96c66229eb..d52f10aa8a 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -877,23 +877,21 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
int timeOutS, unsigned flags,
QTextCodec *outputCodec) const
{
- const FileName executable = client()->vcsBinary();
SubversionResponse response;
- if (executable.isEmpty()) {
+ if (client()->vcsBinary().isEmpty()) {
response.error = true;
response.message =tr("No subversion executable specified.");
return response;
}
- const SynchronousProcessResponse sp_resp =
- VcsBasePlugin::runVcs(workingDir, executable, arguments, timeOutS,
- flags, outputCodec);
+ const SynchronousProcessResponse sp_resp
+ = client()->vcsFullySynchronousExec(workingDir, arguments, flags, timeOutS, outputCodec);
response.error = sp_resp.result != SynchronousProcessResponse::Finished;
if (response.error)
- response.message = sp_resp.exitMessage(executable.toString(), timeOutS);
- response.stdErr = sp_resp.stdErr;
- response.stdOut = sp_resp.stdOut;
+ response.message = sp_resp.exitMessage(client()->vcsBinary().toString(), timeOutS);
+ response.stdErr = sp_resp.stdErr();
+ response.stdOut = sp_resp.stdOut();
return response;
}
diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp
index 66d1e1f445..7a791d40b9 100644
--- a/src/plugins/texteditor/basefilefind.cpp
+++ b/src/plugins/texteditor/basefilefind.cpp
@@ -471,6 +471,7 @@ CountingLabel::CountingLabel()
f.setPointSizeF(StyleHelper::sidebarFontSize());
setFont(f);
setPalette(StyleHelper::sidebarFontPalette(palette()));
+ setProperty("_q_custom_style_disabled", QVariant(true));
updateCount(0);
}
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp
index dba162ace2..a7196602ca 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp
@@ -113,7 +113,8 @@ Highlighter::Highlighter(QTextDocument *parent) :
<< C_COMMENT // CommentVar
<< C_PREPROCESSOR // Import
<< C_TEXT // Others
- << C_LOCAL; // Identifier
+ << C_LOCAL // Identifier
+ << C_DOXYGEN_COMMENT; // Documentation
}
setTextFormatCategories(categories);
@@ -157,6 +158,7 @@ KateFormatMap::KateFormatMap()
m_ids.insert(QLatin1String("dsImport"), Highlighter::Import);
m_ids.insert(QLatin1String("dsOthers"), Highlighter::Others);
m_ids.insert(QLatin1String("dsIdentifier"), Highlighter::Identifier);
+ m_ids.insert(QLatin1String("dsDocumentation"), Highlighter::Documentation);
}
Q_GLOBAL_STATIC(KateFormatMap, kateFormatMap)
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.h b/src/plugins/texteditor/generichighlighter/highlighter.h
index af921cdccd..8b4e45201c 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.h
+++ b/src/plugins/texteditor/generichighlighter/highlighter.h
@@ -90,7 +90,8 @@ public:
CommentVar,
Import,
Others,
- Identifier
+ Identifier,
+ Documentation
};
void setTabSettings(const TabSettings &ts);
diff --git a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
index dcfa90593f..42e9ca3c26 100644
--- a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp
@@ -74,7 +74,7 @@ QString findFallbackDefinitionsLocation()
Utils::SynchronousProcessResponse response
= process.runBlocking(program, QStringList(QLatin1String("--prefix")));
if (response.result == Utils::SynchronousProcessResponse::Finished) {
- QString output = response.stdOut;
+ QString output = response.stdOut();
output.remove(QLatin1Char('\n'));
for (int i = 0; i < kateSyntaxCount; ++i) {
dir.setPath(output + kateSyntax[i]);
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 70e7058589..d0a4209083 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -5105,10 +5105,18 @@ void TextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
// Set whether the mouse cursor is a hand or normal arrow
if (e->type() == QEvent::MouseMove) {
if (inMarkArea) {
- //Find line by cursor position
int line = cursor.blockNumber() + 1;
- if (d->extraAreaPreviousMarkTooltipRequestedLine != line)
- emit markTooltipRequested(this, mapToGlobal(e->pos()), line);
+ if (d->extraAreaPreviousMarkTooltipRequestedLine != line) {
+ if (auto data = static_cast<TextBlockUserData *>(cursor.block().userData())) {
+ QStringList toolTips;
+ foreach (TextMark *mark, data->marks()) {
+ QString toolTip = mark->toolTip();
+ if (!toolTip.isEmpty())
+ toolTips.append(toolTip);
+ }
+ ToolTip::show(mapToGlobal(e->pos()), toolTips.join('\n'), this);
+ }
+ }
d->extraAreaPreviousMarkTooltipRequestedLine = line;
}
diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h
index 3f70117f2e..982af31662 100644
--- a/src/plugins/texteditor/texteditor.h
+++ b/src/plugins/texteditor/texteditor.h
@@ -583,8 +583,6 @@ signals:
void tooltipOverrideRequested(TextEditor::TextEditorWidget *widget,
const QPoint &globalPos, int position, bool *handled);
void tooltipRequested(const QPoint &globalPos, int position);
- void markTooltipRequested(TextEditor::TextEditorWidget *widget,
- const QPoint &globalPos, int line);
void activateEditor();
protected slots:
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp
index 77cd0a831e..5f879e8760 100644
--- a/src/plugins/texteditor/textmark.cpp
+++ b/src/plugins/texteditor/textmark.cpp
@@ -60,20 +60,6 @@ TextMark::~TextMark()
m_baseTextDocument = 0;
}
-TextMark::TextMark(TextMark &&other) Q_DECL_NOEXCEPT
- : m_baseTextDocument(std::move(other.m_baseTextDocument)),
- m_fileName(std::move(other.m_fileName)),
- m_lineNumber(std::move(other.m_lineNumber)),
- m_priority(std::move(other.m_priority)),
- m_visible(std::move(other.m_visible)),
- m_icon(std::move(other.m_icon)),
- m_color(std::move(other.m_color)),
- m_category(std::move(other.m_category)),
- m_widthFactor(std::move(other.m_widthFactor))
-{
- other.m_baseTextDocument = nullptr;
-}
-
QString TextMark::fileName() const
{
return m_fileName;
@@ -212,6 +198,15 @@ void TextMark::setBaseTextDocument(TextDocument *baseTextDocument)
m_baseTextDocument = baseTextDocument;
}
+QString TextMark::toolTip() const
+{
+ return m_toolTip;
+}
+
+void TextMark::setToolTip(const QString &toolTip)
+{
+ m_toolTip = toolTip;
+}
TextMarkRegistry::TextMarkRegistry(QObject *parent)
: QObject(parent)
diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h
index 8387de8c71..a7585e379d 100644
--- a/src/plugins/texteditor/textmark.h
+++ b/src/plugins/texteditor/textmark.h
@@ -51,8 +51,6 @@ public:
TextMark(const QString &fileName, int lineNumber, Core::Id category);
virtual ~TextMark();
- TextMark(TextMark &&other) Q_DECL_NOEXCEPT;
-
// determine order on markers on the same line.
enum Priority
{
@@ -93,6 +91,9 @@ public:
TextDocument *baseTextDocument() const;
void setBaseTextDocument(TextDocument *baseTextDocument);
+ QString toolTip() const;
+ void setToolTip(const QString &toolTip);
+
private:
Q_DISABLE_COPY(TextMark)
friend class Internal::TextMarkRegistry;
@@ -106,6 +107,7 @@ private:
QColor m_color;
Core::Id m_category;
double m_widthFactor;
+ QString m_toolTip;
};
} // namespace TextEditor
diff --git a/src/plugins/todo/todoplugin.cpp b/src/plugins/todo/todoplugin.cpp
index bbbe1a077a..6e3856039d 100644
--- a/src/plugins/todo/todoplugin.cpp
+++ b/src/plugins/todo/todoplugin.cpp
@@ -111,10 +111,8 @@ void TodoPlugin::scanningScopeChanged(ScanningScope scanningScope)
void TodoPlugin::todoItemClicked(const TodoItem &item)
{
- if (item.file.exists()) {
- Core::IEditor *editor = Core::EditorManager::openEditor(item.file.toString());
- editor->gotoLine(item.line);
- }
+ if (item.file.exists())
+ Core::EditorManager::openEditorAt(item.file.toString(), item.line);
}
void TodoPlugin::createItemsProvider()
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp
index 03b3c34b0e..aded32bdc4 100644
--- a/src/plugins/vcsbase/vcsbaseclient.cpp
+++ b/src/plugins/vcsbase/vcsbaseclient.cpp
@@ -154,8 +154,13 @@ QString VcsBaseClientImpl::commandOutputFromLocal8Bit(const QByteArray &a)
QStringList VcsBaseClientImpl::commandOutputLinesFromLocal8Bit(const QByteArray &a)
{
- QString output = commandOutputFromLocal8Bit(a);
+ return splitLines(commandOutputFromLocal8Bit(a));
+}
+
+QStringList VcsBaseClientImpl::splitLines(const QString &s)
+{
const QChar newLine = QLatin1Char('\n');
+ QString output = s;
if (output.endsWith(newLine))
output.truncate(output.size() - 1);
if (output.isEmpty())
@@ -163,6 +168,13 @@ QStringList VcsBaseClientImpl::commandOutputLinesFromLocal8Bit(const QByteArray
return output.split(newLine);
}
+QString VcsBaseClientImpl::stripLastNewline(const QString &in)
+{
+ if (in.endsWith('\n'))
+ return in.left(in.count() - 1);
+ return in;
+}
+
void VcsBaseClientImpl::resetCachedVcsInfo(const QString &workingDir)
{
Core::VcsManager::resetVersionControlForDirectory(workingDir);
@@ -181,18 +193,15 @@ void VcsBaseClientImpl::annotateRevisionRequested(const QString &workingDirector
annotate(workingDirectory, file, changeCopy, line);
}
-bool VcsBaseClientImpl::vcsFullySynchronousExec(const QString &workingDir, const QStringList &args,
- QByteArray *outputData, QByteArray *errorData,
- unsigned flags) const
+Utils::SynchronousProcessResponse
+VcsBaseClientImpl::vcsFullySynchronousExec(const QString &workingDir, const QStringList &args,
+ unsigned flags, int timeoutS, QTextCodec *codec) const
{
- QByteArray internalErrorData;
- QScopedPointer<VcsCommand> command(createCommand(workingDir));
- command->addFlags(flags);
- bool result = command->runFullySynchronous(vcsBinary(), args, vcsTimeoutS(), outputData,
- errorData ? errorData : &internalErrorData);
- if (!internalErrorData.isEmpty() && !(flags & VcsCommand::SuppressStdErr))
- VcsOutputWindow::appendError(commandOutputFromLocal8Bit(internalErrorData));
- return result;
+ VcsCommand command(workingDir, processEnvironment());
+ command.addFlags(flags);
+ if (codec)
+ command.setCodec(codec);
+ return command.runCommand(vcsBinary(), args, (timeoutS > 0) ? timeoutS : vcsTimeoutS());
}
VcsCommand *VcsBaseClientImpl::vcsExec(const QString &workingDirectory, const QStringList &arguments,
@@ -299,10 +308,10 @@ bool VcsBaseClient::synchronousCreateRepository(const QString &workingDirectory,
{
QStringList args(vcsCommandString(CreateRepositoryCommand));
args << extraOptions;
- QByteArray outputData;
- if (!vcsFullySynchronousExec(workingDirectory, args, &outputData))
+ Utils::SynchronousProcessResponse result = vcsFullySynchronousExec(workingDirectory, args);
+ if (result.result != Utils::SynchronousProcessResponse::Finished)
return false;
- VcsOutputWindow::append(commandOutputFromLocal8Bit(outputData));
+ VcsOutputWindow::append(result.stdOut());
resetCachedVcsInfo(workingDirectory);
@@ -317,10 +326,10 @@ bool VcsBaseClient::synchronousClone(const QString &workingDir,
QStringList args;
args << vcsCommandString(CloneCommand)
<< extraOptions << srcLocation << dstLocation;
- QByteArray stdOut;
- const bool cloneOk = vcsFullySynchronousExec(workingDir, args, &stdOut);
+
+ Utils::SynchronousProcessResponse result = vcsFullySynchronousExec(workingDir, args);
resetCachedVcsInfo(workingDir);
- return cloneOk;
+ return result.result == Utils::SynchronousProcessResponse::Finished;
}
bool VcsBaseClient::synchronousAdd(const QString &workingDir, const QString &filename,
@@ -328,8 +337,7 @@ bool VcsBaseClient::synchronousAdd(const QString &workingDir, const QString &fil
{
QStringList args;
args << vcsCommandString(AddCommand) << extraOptions << filename;
- QByteArray stdOut;
- return vcsFullySynchronousExec(workingDir, args, &stdOut);
+ return vcsFullySynchronousExec(workingDir, args).result == Utils::SynchronousProcessResponse::Finished;
}
bool VcsBaseClient::synchronousRemove(const QString &workingDir, const QString &filename,
@@ -337,8 +345,7 @@ bool VcsBaseClient::synchronousRemove(const QString &workingDir, const QString &
{
QStringList args;
args << vcsCommandString(RemoveCommand) << extraOptions << filename;
- QByteArray stdOut;
- return vcsFullySynchronousExec(workingDir, args, &stdOut);
+ return vcsFullySynchronousExec(workingDir, args).result == Utils::SynchronousProcessResponse::Finished;
}
bool VcsBaseClient::synchronousMove(const QString &workingDir,
@@ -347,8 +354,7 @@ bool VcsBaseClient::synchronousMove(const QString &workingDir,
{
QStringList args;
args << vcsCommandString(MoveCommand) << extraOptions << from << to;
- QByteArray stdOut;
- return vcsFullySynchronousExec(workingDir, args, &stdOut);
+ return vcsFullySynchronousExec(workingDir, args).result == Utils::SynchronousProcessResponse::Finished;
}
bool VcsBaseClient::synchronousPull(const QString &workingDir,
diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h
index 63ad0c52a5..62a7bde3a3 100644
--- a/src/plugins/vcsbase/vcsbaseclient.h
+++ b/src/plugins/vcsbase/vcsbaseclient.h
@@ -95,28 +95,31 @@ public:
static QString commandOutputFromLocal8Bit(const QByteArray &a);
// Return converted command output split into lines
static QStringList commandOutputLinesFromLocal8Bit(const QByteArray &a);
+ static QStringList splitLines(const QString &s);
-protected:
- void resetCachedVcsInfo(const QString &workingDir);
- virtual void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
- const QString &change, int line);
+ static QString stripLastNewline(const QString &in);
// Fully synchronous VCS execution (QProcess-based)
- bool vcsFullySynchronousExec(const QString &workingDir, const QStringList &args,
- QByteArray *outputData, QByteArray *errorData = 0,
- unsigned flags = 0) const;
+ Utils::SynchronousProcessResponse
+ vcsFullySynchronousExec(const QString &workingDir, const QStringList &args,
+ unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
// Simple helper to execute a single command using createCommand and enqueueJob.
VcsCommand *vcsExec(const QString &workingDirectory, const QStringList &arguments,
- VcsBaseEditorWidget *editor = 0, bool useOutputToWindow = false,
+ VcsBaseEditorWidget *editor = nullptr, bool useOutputToWindow = false,
unsigned additionalFlags = 0, const QVariant &cookie = QVariant()) const;
+protected:
+ void resetCachedVcsInfo(const QString &workingDir);
+ virtual void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
+ const QString &change, int line);
+
// Synchronous VCS execution using Utils::SynchronousProcess, with
// log windows updating (using VcsBasePlugin::runVcs with flags)
Utils::SynchronousProcessResponse vcsSynchronousExec(const QString &workingDir,
const QStringList &args,
unsigned flags = 0,
- QTextCodec *outputCodec = 0) const;
+ QTextCodec *outputCodec = nullptr) const;
private:
void saveSettings();
diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h
index 3286291589..dc719111b2 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.h
+++ b/src/plugins/vcsbase/vcsbaseplugin.h
@@ -38,18 +38,17 @@ class QAction;
class QTextCodec;
QT_END_NAMESPACE
-namespace Utils
-{
+namespace Utils {
class FileName;
-struct SynchronousProcessResponse;
-}
+class SynchronousProcessResponse;
+} // namespace Utils
namespace Core {
class Context;
class IVersionControl;
class Id;
class IDocument;
-}
+} // namespace Core
namespace VcsBase {
diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp
index 2062ab6c8d..85fef69ccc 100644
--- a/src/plugins/vcsbase/vcscommand.cpp
+++ b/src/plugins/vcsbase/vcscommand.cpp
@@ -40,27 +40,27 @@ VcsCommand::VcsCommand(const QString &workingDirectory,
m_preventRepositoryChanged(false)
{
setOutputProxyFactory([this]() -> Utils::OutputProxy * {
- auto proxy = new Utils::OutputProxy;
- VcsOutputWindow *outputWindow = VcsOutputWindow::instance();
+ auto proxy = new Utils::OutputProxy;
+ VcsOutputWindow *outputWindow = VcsOutputWindow::instance();
- connect(proxy, &Utils::OutputProxy::append,
- outputWindow, [](const QString &txt) { VcsOutputWindow::append(txt); },
- Qt::QueuedConnection);
- connect(proxy, &Utils::OutputProxy::appendSilently,
- outputWindow, &VcsOutputWindow::appendSilently,
- Qt::QueuedConnection);
- connect(proxy, &Utils::OutputProxy::appendError,
- outputWindow, &VcsOutputWindow::appendError,
- Qt::QueuedConnection);
- connect(proxy, &Utils::OutputProxy::appendCommand,
- outputWindow, &VcsOutputWindow::appendCommand,
- Qt::QueuedConnection);
- connect(proxy, &Utils::OutputProxy::appendMessage,
- outputWindow, &VcsOutputWindow::appendMessage,
- Qt::QueuedConnection);
+ connect(proxy, &Utils::OutputProxy::append,
+ outputWindow, [](const QString &txt) { VcsOutputWindow::append(txt); },
+ Qt::QueuedConnection);
+ connect(proxy, &Utils::OutputProxy::appendSilently,
+ outputWindow, &VcsOutputWindow::appendSilently,
+ Qt::QueuedConnection);
+ connect(proxy, &Utils::OutputProxy::appendError,
+ outputWindow, &VcsOutputWindow::appendError,
+ Qt::QueuedConnection);
+ connect(proxy, &Utils::OutputProxy::appendCommand,
+ outputWindow, &VcsOutputWindow::appendCommand,
+ Qt::QueuedConnection);
+ connect(proxy, &Utils::OutputProxy::appendMessage,
+ outputWindow, &VcsOutputWindow::appendMessage,
+ Qt::QueuedConnection);
- return proxy;
- });
+ return proxy;
+ });
}
const QProcessEnvironment VcsCommand::processEnvironment() const
@@ -82,16 +82,6 @@ Utils::SynchronousProcessResponse VcsCommand::runCommand(const Utils::FileName &
return response;
}
-bool VcsCommand::runFullySynchronous(const Utils::FileName &binary, const QStringList &arguments,
- int timeoutS, QByteArray *outputData, QByteArray *errorData,
- const QString &workingDirectory)
-{
- bool result = Core::ShellCommand::runFullySynchronous(binary, arguments, timeoutS,
- outputData, errorData, workingDirectory);
- emitRepositoryChanged(workingDirectory);
- return result;
-}
-
void VcsCommand::emitRepositoryChanged(const QString &workingDirectory)
{
if (m_preventRepositoryChanged || !(flags() & VcsCommand::ExpectRepoChanges))
diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h
index af9d1214d6..bc7ad022e4 100644
--- a/src/plugins/vcsbase/vcscommand.h
+++ b/src/plugins/vcsbase/vcscommand.h
@@ -50,9 +50,6 @@ public:
const QString &workDirectory = QString(),
const Utils::ExitCodeInterpreter &interpreter = Utils::defaultExitCodeInterpreter) override;
- bool runFullySynchronous(const Utils::FileName &binary, const QStringList &arguments,
- int timeoutS, QByteArray *outputData, QByteArray *errorData,
- const QString &workingDirectory = QString()) override;
private:
unsigned processFlags() const override;
void emitRepositoryChanged(const QString &workingDirectory);
diff --git a/src/share/3rdparty/data.pro b/src/share/3rdparty/data.pro
index 3f3b5d905c..17ad36c8d2 100644
--- a/src/share/3rdparty/data.pro
+++ b/src/share/3rdparty/data.pro
@@ -7,7 +7,8 @@ STATIC_OUTPUT_BASE = $$IDE_DATA_PATH
STATIC_INSTALL_BASE = $$INSTALL_DATA_PATH
DATA_DIRS = \
- generic-highlighter
+ generic-highlighter \
+ fonts
for(data_dir, DATA_DIRS) {
STATIC_FILES += $$files($$PWD/$$data_dir/*, true)
diff --git a/src/share/3rdparty/fonts/SourceCodePro-Bold.ttf b/src/share/3rdparty/fonts/SourceCodePro-Bold.ttf
new file mode 100644
index 0000000000..e0c576f1b0
--- /dev/null
+++ b/src/share/3rdparty/fonts/SourceCodePro-Bold.ttf
Binary files differ
diff --git a/src/share/3rdparty/fonts/SourceCodePro-It.ttf b/src/share/3rdparty/fonts/SourceCodePro-It.ttf
new file mode 100644
index 0000000000..e7f1541e7e
--- /dev/null
+++ b/src/share/3rdparty/fonts/SourceCodePro-It.ttf
Binary files differ
diff --git a/src/share/3rdparty/fonts/SourceCodePro-Regular.ttf b/src/share/3rdparty/fonts/SourceCodePro-Regular.ttf
new file mode 100644
index 0000000000..437f47280b
--- /dev/null
+++ b/src/share/3rdparty/fonts/SourceCodePro-Regular.ttf
Binary files differ
diff --git a/src/share/3rdparty/fonts/SourceCodePro.txt b/src/share/3rdparty/fonts/SourceCodePro.txt
new file mode 100644
index 0000000000..07542572e3
--- /dev/null
+++ b/src/share/3rdparty/fonts/SourceCodePro.txt
@@ -0,0 +1,93 @@
+Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+
+This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/src/share/3rdparty/generic-highlighter/cmake.xml b/src/share/3rdparty/generic-highlighter/cmake.xml
index de8194e642..3cd4893fe3 100644
--- a/src/share/3rdparty/generic-highlighter/cmake.xml
+++ b/src/share/3rdparty/generic-highlighter/cmake.xml
@@ -28,7 +28,7 @@
<!-- generated for "cmake version 2.8.12.1, 3.0.2, 3.1.2 and 3.3.0" -->
<language
name="CMake"
- version="1.35"
+ version="1.36"
kateversion="5.0"
section="Other"
extensions="CMakeLists.txt;*.cmake;*.cmake.in"
@@ -1103,22 +1103,22 @@
<DetectSpaces/>
<!-- handle folding for if else elseif endif blocks -->
- <RegExpr String="\bif\b" attribute="Commands" context="Command Args" beginRegion="ifthenelse" insensitive="true" />
- <RegExpr String="\belse\b" attribute="Commands" context="Command Args" endRegion="ifthenelse" beginRegion="ifthenelse" insensitive="true" />
- <RegExpr String="\belseif\b" attribute="Commands" context="Command Args" endRegion="ifthenelse" beginRegion="ifthenelse" insensitive="true" />
- <RegExpr String="\bendif\b" attribute="Commands" context="Command Args" endRegion="ifthenelse" insensitive="true" />
+ <WordDetect String="if" attribute="Commands" context="Command Args" beginRegion="ifthenelse" insensitive="true" />
+ <WordDetect String="else" attribute="Commands" context="Command Args" endRegion="ifthenelse" beginRegion="ifthenelse" insensitive="true" />
+ <WordDetect String="elseif" attribute="Commands" context="Command Args" endRegion="ifthenelse" beginRegion="ifthenelse" insensitive="true" />
+ <WordDetect String="endif" attribute="Commands" context="Command Args" endRegion="ifthenelse" insensitive="true" />
<!-- handle folding for macro endmacro blocks -->
- <RegExpr String="\bmacro\b" attribute="Commands" context="Command Args" beginRegion="macro" insensitive="true" />
- <RegExpr String="\bendmacro\b" attribute="Commands" context="Command Args" endRegion="macro" insensitive="true" />
+ <WordDetect String="macro" attribute="Commands" context="Command Args" beginRegion="macro" insensitive="true" />
+ <WordDetect String="endmacro" attribute="Commands" context="Command Args" endRegion="macro" insensitive="true" />
<!-- handle folding for foreach endforeach blocks -->
- <RegExpr String="\bforeach\b" attribute="Commands" context="Command Args" beginRegion="foreach" insensitive="true" />
- <RegExpr String="\bendforeach\b" attribute="Commands" context="Command Args" endRegion="foreach" insensitive="true" />
+ <WordDetect String="foreach" attribute="Commands" context="Command Args" beginRegion="foreach" insensitive="true" />
+ <WordDetect String="endforeach" attribute="Commands" context="Command Args" endRegion="foreach" insensitive="true" />
<!-- handle folding for while endwhile blocks -->
- <RegExpr String="\bwhile\b" attribute="Commands" context="Command Args" beginRegion="while" insensitive="true" />
- <RegExpr String="\bendwhile\b" attribute="Commands" context="Command Args" endRegion="while" insensitive="true" />
+ <WordDetect String="while" attribute="Commands" context="Command Args" beginRegion="while" insensitive="true" />
+ <WordDetect String="endwhile" attribute="Commands" context="Command Args" endRegion="while" insensitive="true" />
<keyword attribute="Commands" context="Command Args" String="commands" insensitive="true" />
<keyword attribute="Third-Party Commands" context="#stay" String="itkvtk_commands" insensitive="true" />
diff --git a/src/share/3rdparty/generic-highlighter/doxygen.xml b/src/share/3rdparty/generic-highlighter/doxygen.xml
index 5128903e91..302df7146c 100644
--- a/src/share/3rdparty/generic-highlighter/doxygen.xml
+++ b/src/share/3rdparty/generic-highlighter/doxygen.xml
@@ -29,7 +29,7 @@
-->
<language name="Doxygen"
- version="1.39"
+ version="1.41"
kateversion="5.0"
section="Markup"
extensions="*.dox;*.doxygen"
@@ -485,12 +485,12 @@
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
- <itemData name="Tags" defStyleNum="dsAnnotation" bold="1" italic="0" />
- <itemData name="Custom Tags" defStyleNum="dsNormal" color="#458C61" bold="1" italic="0" />
+ <itemData name="Tags" defStyleNum="dsAnnotation" bold="1" />
+ <itemData name="Custom Tags" defStyleNum="dsAnnotation" />
<itemData name="Word" defStyleNum="dsCommentVar" bold="1" italic="0" />
<itemData name="HTML Tag" defStyleNum="dsKeyword" color="#000000" bold="1" italic="0" />
<itemData name="Entities" defStyleNum="dsOthers" color="#4086C0" bold="1" italic="1" />
- <itemData name="Description" defStyleNum="dsString" color="#ff0000" />
+ <itemData name="Description" defStyleNum="dsDocumentation" />
<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="Region" defStyleNum="dsRegionMarker" />
<itemData name="Identifier" defStyleNum="dsOthers" />
diff --git a/src/shared/qbs b/src/shared/qbs
-Subproject 129e7a8ab1edfb583157db6050ab3f1bd426279
+Subproject 65cb4cba999b47a643e820a102b3185f861b97c
diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp
index f250d415a5..ceec6c1778 100644
--- a/src/tools/iostool/iosdevicemanager.cpp
+++ b/src/tools/iostool/iosdevicemanager.cpp
@@ -692,7 +692,7 @@ void IosDeviceManagerPrivate::deviceWithId(QString deviceId, int timeout,
pendingLookup->userData = userData;
pendingLookup->timer.setSingleShot(true);
pendingLookup->timer.setInterval(timeout);
- QObject::connect(&(pendingLookup->timer), SIGNAL(timeout()), q, SLOT(checkPendingLookups()));
+ QObject::connect(&(pendingLookup->timer), &QTimer::timeout, q, &IosDeviceManager::checkPendingLookups);
m_pendingLookups.insertMulti(deviceId, pendingLookup);
pendingLookup->timer.start();
}
diff --git a/src/tools/iostool/iosdevicemanager.h b/src/tools/iostool/iosdevicemanager.h
index 214415adc4..5d6c489b7d 100644
--- a/src/tools/iostool/iosdevicemanager.h
+++ b/src/tools/iostool/iosdevicemanager.h
@@ -85,12 +85,11 @@ signals:
void deviceInfo(const QString &deviceId, const Ios::IosDeviceManager::Dict &info);
void appOutput(const QString &output);
void errorMsg(const QString &msg);
-private slots:
- void checkPendingLookups();
private:
friend class Internal::IosDeviceManagerPrivate;
friend class Internal::DevInfoSession;
IosDeviceManager(QObject *parent = 0);
+ void checkPendingLookups();
Internal::IosDeviceManagerPrivate *d;
};
diff --git a/src/tools/iostool/main.cpp b/src/tools/iostool/main.cpp
index ae832ba073..76aa46efab 100644
--- a/src/tools/iostool/main.cpp
+++ b/src/tools/iostool/main.cpp
@@ -71,7 +71,7 @@ public:
~Relayer();
void setClientSocket(QTcpSocket *clientSocket);
bool startRelay(int serverFileDescriptor);
-public slots:
+
void handleSocketHasData(int socket);
void handleClientHasData();
void handleClientHasError(QAbstractSocket::SocketError error);
@@ -90,7 +90,6 @@ public:
static const int reconnectMsecDelay = 500;
static const int maxReconnectAttempts = 2*60*5; // 5 min
RemotePortRelayer(GenericRelayServer *parent, QTcpSocket *clientSocket);
-public slots:
void tryRemoteConnect();
signals:
void didConnect(GenericRelayServer *serv);
@@ -108,7 +107,7 @@ public:
void stopServer();
quint16 serverPort();
IosTool *iosTool();
-public slots:
+
void handleNewRelayConnection();
void removeRelayConnection(Relayer *relayer);
protected:
@@ -148,7 +147,6 @@ class GdbRunner: public QObject
public:
GdbRunner(IosTool *iosTool, int gdbFd);
void stop(int phase);
-public slots:
void run();
signals:
void finished();
@@ -171,10 +169,9 @@ public:
void writeTextInElement(const QString &output);
void stopRelayServers(int errorCode = 0);
void writeMaybeBin(const QString &extraMsg, const char *msg, quintptr len);
-public slots:
void errorMsg(const QString &msg);
void stopGdbRunner();
-private slots:
+private:
void stopGdbRunner2();
void isTransferringApp(const QString &bundlePath, const QString &deviceId, int progress,
const QString &info);
@@ -185,7 +182,6 @@ private slots:
Ios::DeviceSession *deviceSession);
void deviceInfo(const QString &deviceId, const Ios::IosDeviceManager::Dict &info);
void appOutput(const QString &output);
-private:
void readStdin();
QMutex m_xmlMutex;
@@ -229,8 +225,9 @@ void Relayer::setClientSocket(QTcpSocket *clientSocket)
QTC_CHECK(!m_clientSocket);
m_clientSocket = clientSocket;
if (m_clientSocket) {
- connect(m_clientSocket, SIGNAL(error(QAbstractSocket::SocketError)),
- SLOT(handleClientHasError(QAbstractSocket::SocketError)));
+ connect(m_clientSocket,
+ static_cast<void (QAbstractSocket::*)(QAbstractSocket::SocketError)>(&QAbstractSocket::error),
+ this, &Relayer::handleClientHasError);
connect(m_clientSocket, &QAbstractSocket::disconnected,
this, [this](){server()->removeRelayConnection(this);});
}
@@ -243,9 +240,9 @@ bool Relayer::startRelay(int serverFileDescriptor)
if (!m_clientSocket || m_serverFileDescriptor <= 0)
return false;
fcntl(serverFileDescriptor,F_SETFL, fcntl(serverFileDescriptor, F_GETFL) | O_NONBLOCK);
- connect(m_clientSocket, SIGNAL(readyRead()), SLOT(handleClientHasData()));
+ connect(m_clientSocket, &QIODevice::readyRead, this, &Relayer::handleClientHasData);
m_serverNotifier = new QSocketNotifier(m_serverFileDescriptor, QSocketNotifier::Read, this);
- connect(m_serverNotifier, SIGNAL(activated(int)), SLOT(handleSocketHasData(int)));
+ connect(m_serverNotifier, &QSocketNotifier::activated, this, &Relayer::handleSocketHasData);
// no way to check if an error did happen?
if (m_clientSocket->bytesAvailable() > 0)
handleClientHasData();
@@ -372,8 +369,7 @@ RemotePortRelayer::RemotePortRelayer(GenericRelayServer *parent, QTcpSocket *cli
{
m_remoteConnectTimer.setSingleShot(true);
m_remoteConnectTimer.setInterval(reconnectMsecDelay);
- connect(&m_remoteConnectTimer, SIGNAL(timeout()),
- SLOT(tryRemoteConnect()));
+ connect(&m_remoteConnectTimer, &QTimer::timeout, this, &RemotePortRelayer::tryRemoteConnect);
}
void RemotePortRelayer::tryRemoteConnect()
@@ -412,7 +408,7 @@ bool RelayServer::startServer(int port, bool ipv6)
{
QTC_CHECK(!m_server.isListening());
m_server.setMaxPendingConnections(1);
- connect(&m_server, SIGNAL(newConnection()), SLOT(handleNewRelayConnection()));
+ connect(&m_server, &QTcpServer::newConnection, this, &RelayServer::handleNewRelayConnection);
quint16 portValue = static_cast<quint16>(port);
if (port < 0 || port > 0xFFFF)
return false;
@@ -593,16 +589,12 @@ void IosTool::run(const QStringList &args)
return;
}
outFile.flush();
- connect(manager,SIGNAL(isTransferringApp(QString,QString,int,QString)),
- SLOT(isTransferringApp(QString,QString,int,QString)));
- connect(manager,SIGNAL(didTransferApp(QString,QString,Ios::IosDeviceManager::OpStatus)),
- SLOT(didTransferApp(QString,QString,Ios::IosDeviceManager::OpStatus)));
- connect(manager,SIGNAL(didStartApp(QString,QString,Ios::IosDeviceManager::OpStatus,int,Ios::DeviceSession*)),
- SLOT(didStartApp(QString,QString,Ios::IosDeviceManager::OpStatus,int,Ios::DeviceSession*)));
- connect(manager,SIGNAL(deviceInfo(QString,Ios::IosDeviceManager::Dict)),
- SLOT(deviceInfo(QString,Ios::IosDeviceManager::Dict)));
- connect(manager,SIGNAL(appOutput(QString)), SLOT(appOutput(QString)));
- connect(manager,SIGNAL(errorMsg(QString)), SLOT(errorMsg(QString)));
+ connect(manager,&Ios::IosDeviceManager::isTransferringApp, this, &IosTool::isTransferringApp);
+ connect(manager,&Ios::IosDeviceManager::didTransferApp, this, &IosTool::didTransferApp);
+ connect(manager,&Ios::IosDeviceManager::didStartApp, this, &IosTool::didStartApp);
+ connect(manager,&Ios::IosDeviceManager::deviceInfo, this, &IosTool::deviceInfo);
+ connect(manager,&Ios::IosDeviceManager::appOutput, this, &IosTool::appOutput);
+ connect(manager,&Ios::IosDeviceManager::errorMsg, this, &IosTool::errorMsg);
manager->watchDevices();
QRegExp qmlPortRe=QRegExp(QLatin1String("-qmljsdebugger=port:([0-9]+)"));
foreach (const QString &arg, extraArgs) {
@@ -755,9 +747,10 @@ void IosTool::didStartApp(const QString &bundlePath, const QString &deviceId,
// all output moves to the new thread (other option would be to signal it back)
QThread *gdbProcessThread = new QThread();
gdbRunner->moveToThread(gdbProcessThread);
- QObject::connect(gdbProcessThread, SIGNAL(started()), gdbRunner, SLOT(run()));
- QObject::connect(gdbRunner, SIGNAL(finished()), gdbProcessThread, SLOT(quit()));
- QObject::connect(gdbProcessThread, SIGNAL(finished()), gdbProcessThread, SLOT(deleteLater()));
+ QObject::connect(gdbProcessThread, &QThread::started, gdbRunner, &GdbRunner::run);
+ QObject::connect(gdbRunner, &GdbRunner::finished, gdbProcessThread, &QThread::quit);
+ QObject::connect(gdbProcessThread, &QThread::finished,
+ gdbProcessThread, &QObject::deleteLater);
gdbProcessThread->start();
new std::thread([this]() -> void { readStdin();});
@@ -878,7 +871,7 @@ void IosTool::stopGdbRunner()
{
if (gdbRunner) {
gdbRunner->stop(0);
- QTimer::singleShot(100, this, SLOT(stopGdbRunner2()));
+ QTimer::singleShot(100, this, &IosTool::stopGdbRunner2);
}
}
diff --git a/src/tools/screenshotcropper/cropimageview.h b/src/tools/screenshotcropper/cropimageview.h
index c95bc5bc77..c5d3ae026d 100644
--- a/src/tools/screenshotcropper/cropimageview.h
+++ b/src/tools/screenshotcropper/cropimageview.h
@@ -39,7 +39,6 @@ public:
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
-public slots:
void setImage(const QImage &image);
void setArea(const QRect &area);
diff --git a/src/tools/screenshotcropper/screenshotcropper.pro b/src/tools/screenshotcropper/screenshotcropper.pro
index 350fe3b9b4..28e26b1bff 100644
--- a/src/tools/screenshotcropper/screenshotcropper.pro
+++ b/src/tools/screenshotcropper/screenshotcropper.pro
@@ -1,3 +1,7 @@
+QTC_PLUGIN_DEPENDS += coreplugin
+QTC_LIB_DEPENDS += utils
+include(../../qtcreatortool.pri)
+
SOURCES += \
main.cpp\
screenshotcropperwindow.cpp \
@@ -10,10 +14,7 @@ HEADERS += \
../../plugins/qtsupport/screenshotcropper.h
INCLUDEPATH += \
- ../../plugins/qtsupport \
- ../../plugins
+ .
FORMS += \
screenshotcropperwindow.ui
-
-isEqual(QT_MAJOR_VERSION, 5):QT += widgets
diff --git a/src/tools/screenshotcropper/screenshotcropperwindow.cpp b/src/tools/screenshotcropper/screenshotcropperwindow.cpp
index 4dd4d80a8e..224bf3f33a 100644
--- a/src/tools/screenshotcropper/screenshotcropperwindow.cpp
+++ b/src/tools/screenshotcropper/screenshotcropperwindow.cpp
@@ -35,10 +35,10 @@ ScreenShotCropperWindow::ScreenShotCropperWindow(QWidget *parent)
, ui(new Ui::ScreenShotCropperWindow)
{
ui->setupUi(this);
- connect(ui->m_filenamesList, SIGNAL(currentRowChanged(int)), SLOT(selectImage(int)));
- connect(ui->m_cropImageView, SIGNAL(cropAreaChanged(QRect)), SLOT(setArea(QRect)));
- connect(ui->m_buttonBox, SIGNAL(accepted()), SLOT(saveData()));
- connect(ui->m_buttonBox, SIGNAL(rejected()), SLOT(close()));
+ connect(ui->m_filenamesList, &QListWidget::currentRowChanged, this, &ScreenShotCropperWindow::selectImage);
+ connect(ui->m_cropImageView, &CropImageView::cropAreaChanged, this, &ScreenShotCropperWindow::setArea);
+ connect(ui->m_buttonBox, &QDialogButtonBox::accepted, this, &ScreenShotCropperWindow::saveData);
+ connect(ui->m_buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
}
ScreenShotCropperWindow::~ScreenShotCropperWindow()
diff --git a/src/tools/screenshotcropper/screenshotcropperwindow.h b/src/tools/screenshotcropper/screenshotcropperwindow.h
index 98813a77c3..5fc5085960 100644
--- a/src/tools/screenshotcropper/screenshotcropperwindow.h
+++ b/src/tools/screenshotcropper/screenshotcropperwindow.h
@@ -25,8 +25,9 @@
#pragma once
+#include <qtsupport/screenshotcropper.h>
+
#include <QMainWindow>
-#include "screenshotcropper.h"
using namespace QtSupport::Internal;
@@ -42,7 +43,6 @@ public:
void loadData(const QString &areasXmlFile, const QString &imagesFolder);
-public slots:
void selectImage(int index);
void setArea(const QRect &area);
void saveData();
diff --git a/tests/auto/algorithm/tst_algorithm.cpp b/tests/auto/algorithm/tst_algorithm.cpp
index e591965dfc..9c2e4402dd 100644
--- a/tests/auto/algorithm/tst_algorithm.cpp
+++ b/tests/auto/algorithm/tst_algorithm.cpp
@@ -66,7 +66,7 @@ void tst_Algorithm::transform()
}
{
// QSet internally needs special inserter
- const QSet<QString> strings({"1", "3", "132"});
+ const QSet<QString> strings({QString("1"), QString("3"), QString("132")});
const QSet<int> i1 = Utils::transform(strings, [](const QString &s) { return s.toInt(); });
QCOMPARE(i1, QSet<int>({1, 3, 132}));
const QSet<int> i2 = Utils::transform(strings, stringToInt);
@@ -98,7 +98,7 @@ void tst_Algorithm::transform()
}
{
// QSet to QList
- const QSet<QString> strings({"1", "3", "132"});
+ const QSet<QString> strings({QString("1"), QString("3"), QString("132")});
QList<int> i1 = Utils::transform<QList>(strings, [](const QString &s) { return s.toInt(); });
qSort(i1);
QCOMPARE(i1, QList<int>({1, 3, 132}));
diff --git a/tests/auto/qml/codemodel/dependencies/dependencies.qbs b/tests/auto/qml/codemodel/dependencies/dependencies.qbs
index 9ac0c99b7a..02feadb3db 100644
--- a/tests/auto/qml/codemodel/dependencies/dependencies.qbs
+++ b/tests/auto/qml/codemodel/dependencies/dependencies.qbs
@@ -4,6 +4,7 @@ QtcAutotest {
name: "QML code model dependencies autotest"
Depends { name: "QmlJS" }
Depends { name: "QmlJSTools" }
+ Depends { name: "Utils" }
Depends { name: "Qt.widgets" }
files: "tst_dependencies.cpp"
diff --git a/tests/manual/process/mainwindow.cpp b/tests/manual/process/mainwindow.cpp
index bd89d935cf..7a99e8a872 100644
--- a/tests/manual/process/mainwindow.cpp
+++ b/tests/manual/process/mainwindow.cpp
@@ -54,8 +54,8 @@ void MainWindow::test()
Utils::SynchronousProcess process;
process.setTimeoutS(2);
qDebug() << "Async: " << cmd << args;
- connect(&process, &Utils::SynchronousProcess::stdOut, this, &MainWindow::append);
- connect(&process, &Utils::SynchronousProcess::stdErr, this, &MainWindow::append);
+ connect(&process, &Utils::SynchronousProcess::stdOutBuffered, this, &MainWindow::append);
+ connect(&process, &Utils::SynchronousProcess::stdErrBuffered, this, &MainWindow::append);
const Utils::SynchronousProcessResponse resp = process.run(cmd, args);
qDebug() << resp;
}
diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py
index a03be7eeb2..2e9b0bebae 100644
--- a/tests/system/shared/classes.py
+++ b/tests/system/shared/classes.py
@@ -38,6 +38,8 @@ class Targets:
DESKTOP_531_DEFAULT,
DESKTOP_541_GCC) = ALL_TARGETS
+ DESKTOP_561_DEFAULT = sum(ALL_TARGETS) + 1
+
@staticmethod
def desktopTargetClasses():
desktopTargets = (sum(Targets.ALL_TARGETS) & ~Targets.SIMULATOR & ~Targets.EMBEDDED_LINUX)
@@ -69,6 +71,8 @@ class Targets:
return "Desktop 531 default"
elif target == Targets.DESKTOP_541_GCC:
return "Desktop 541 GCC"
+ elif target == Targets.DESKTOP_561_DEFAULT:
+ return "Desktop 561 default"
else:
return None
@@ -192,7 +196,10 @@ class Qt5Path:
@staticmethod
def __preCheckAndExtractQtVersionStr__(target):
if target not in Targets.ALL_TARGETS:
- raise Exception("Unexpected target '%s'" % str(target))
+ # Ignore DESKTOP_561_DEFAULT which only delivers examples but not a kit yet.
+ # Remove the condition as soon as it is being used as a kit in tests.
+ if not target == Targets.DESKTOP_561_DEFAULT:
+ raise Exception("Unexpected target '%s'" % str(target))
matcher = re.match("^Desktop (5\\d{2}).*$", Targets.getStringForTarget(target))
if matcher is None:
diff --git a/tests/system/suite_CCOM/tst_CCOM01/test.py b/tests/system/suite_CCOM/tst_CCOM01/test.py
index 2891880c83..d5859c69b5 100755
--- a/tests/system/suite_CCOM/tst_CCOM01/test.py
+++ b/tests/system/suite_CCOM/tst_CCOM01/test.py
@@ -28,26 +28,20 @@ source("../../shared/qtcreator.py")
# entry of test
def main():
# prepare example project
- sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
- proFile = "propertyanimation.pro"
+ sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_561_DEFAULT),
+ "quick", "animation")
+ proFile = "animation.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
# copy example project to temp directory
- templateDir = prepareTemplate(sourceExample)
+ templateDir = prepareTemplate(sourceExample, "/../shared")
examplePath = os.path.join(templateDir, proFile)
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
- # open example project
- # qmlapplicationviewer of this example supports only Qt version < 5
- targets = (Targets.desktopTargetClasses() & ~Targets.DESKTOP_521_DEFAULT
- & ~Targets.DESKTOP_531_DEFAULT & ~Targets.DESKTOP_541_GCC)
+ # open example project, supports only Qt 5
+ targets = Targets.desktopTargetClasses() & ~Targets.DESKTOP_474_GCC & ~Targets.DESKTOP_480_DEFAULT
checkedTargets = openQmakeProject(examplePath, targets)
- if not replaceLine("propertyanimation.Sources.main\\.cpp",
- "#include <QtGui/QApplication>",
- "#include <QApplication>"):
- return
- invokeMenuItem("File", "Save All")
# build and wait until finished - on all build configurations
availableConfigs = iterateBuildConfigs(len(checkedTargets))
if not availableConfigs:
diff --git a/tests/system/suite_CCOM/tst_CCOM02/test.py b/tests/system/suite_CCOM/tst_CCOM02/test.py
index 8a3e38b84f..2a59212706 100755
--- a/tests/system/suite_CCOM/tst_CCOM02/test.py
+++ b/tests/system/suite_CCOM/tst_CCOM02/test.py
@@ -29,22 +29,22 @@ source("../../shared/qtcreator.py")
# entry of test
def main():
# prepare example project
- sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
- proFile = "propertyanimation.pro"
+ sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_561_DEFAULT),
+ "quick", "animation")
+ proFile = "animation.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
# copy example project to temp directory
- templateDir = prepareTemplate(sourceExample)
+ templateDir = prepareTemplate(sourceExample, "/../shared")
examplePath = os.path.join(templateDir, proFile)
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
# open example project
- targets = (Targets.desktopTargetClasses() & ~Targets.DESKTOP_521_DEFAULT
- & ~Targets.DESKTOP_531_DEFAULT & ~Targets.DESKTOP_541_GCC)
+ targets = Targets.desktopTargetClasses()
openQmakeProject(examplePath, targets)
# create syntax error
- openDocument("propertyanimation.QML.qml.property-animation\\.qml")
+ openDocument("animation.Resources.animation\\.qrc./animation.basics.property-animation\\.qml")
if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Image {", "SyntaxError"):
invokeMenuItem("File", "Exit")
return
diff --git a/tests/system/suite_CSUP/tst_CSUP01/test.py b/tests/system/suite_CSUP/tst_CSUP01/test.py
index 5971d186f9..624a68fd12 100644
--- a/tests/system/suite_CSUP/tst_CSUP01/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP01/test.py
@@ -73,24 +73,35 @@ def main():
"possible to select one of the suggestions.")
# Step 4: Insert text "voi" to new line and press Tab.
resetLine(editorWidget)
+ if useClang and JIRA.isBugStillOpen(15639):
+ snooze(2)
type(editorWidget, "voi")
- waitForObjectItem(":popupFrame_Proposal_QListView", "void")
- type(waitForObject(":popupFrame_Proposal_QListView"), "<Tab>")
- test.compare(str(lineUnderCursor(editorWidget)).strip(), "void",
- "Step 4: Verifying if: Word 'void' is completed because only one option is available.")
+ try:
+ waitForObjectItem(":popupFrame_Proposal_QListView", "void")
+ type(waitForObject(":popupFrame_Proposal_QListView"), "<Tab>")
+ test.compare(str(lineUnderCursor(editorWidget)).strip(), "void",
+ "Step 4: Verifying if: Word 'void' is completed because only one option is available.")
+ except:
+ test.fail("The expected completion popup was not shown.")
# Step 4.5: Insert text "2." to new line and verify that code completion is not triggered (QTCREATORBUG-16188)
resetLine(editorWidget)
lineWithFloat = "float fl = 2."
type(editorWidget, lineWithFloat)
try:
waitForObject(":popupFrame_Proposal_QListView", 5000)
- if useClang and JIRA.isBugStillOpen(16188):
- test.xfail("Typing a float value triggered code completion")
- else:
- test.fail("Typing a float value triggered code completion")
+ test.fail("Typing a float value triggered code completion")
except:
test.compare(str(lineUnderCursor(editorWidget)), " " + lineWithFloat,
"Typing a float value does not trigger code completion")
+ triggerCompletion(editorWidget)
+ try:
+ waitForObject(":popupFrame_Proposal_QListView", 5000)
+ if useClang and JIRA.isBugStillOpen(16607):
+ test.xfail("User can trigger code completion manually in a float value")
+ else:
+ test.fail("User can trigger code completion manually in a float value")
+ except:
+ test.passes("User can't trigger code completion manually in a float value")
# Step 5: From "Tools -> Options -> Text Editor -> Completion" select Activate completion Manually,
# uncheck Autocomplete common prefix and press Apply and then Ok . Return to Edit mode.
test.log("Step 5: Change Code Completion settings")
diff --git a/tests/system/suite_QMLS/tst_QMLS03/test.py b/tests/system/suite_QMLS/tst_QMLS03/test.py
index 40293cd4ed..9c07a844bc 100644
--- a/tests/system/suite_QMLS/tst_QMLS03/test.py
+++ b/tests/system/suite_QMLS/tst_QMLS03/test.py
@@ -67,20 +67,22 @@ def checkUsages(resultsView, expectedResults, directory):
def main():
# prepare example project
- sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
- proFile = "propertyanimation.pro"
+ sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_561_DEFAULT),
+ "quick", "animation")
+ proFile = "animation.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = os.path.join(templateDir, proFile)
+ templateDir = os.path.join(templateDir, "basics") # only check subproject
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
# open example project
- openQmakeProject(examplePath, Targets.DESKTOP_480_DEFAULT)
+ openQmakeProject(examplePath, Targets.DESKTOP_531_DEFAULT)
# open qml file
- openDocument("propertyanimation.QML.qml.color-animation\\.qml")
+ openDocument("animation.Resources.animation\\.qrc./animation.basics.color-animation\\.qml")
# get editor
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# 1. check usages using context menu
@@ -93,7 +95,7 @@ def main():
invokeContextMenuItem(editorArea, "Find Usages")
# check if usage was properly found
expectedResults = [ExpectedResult("color-animation.qml", 49, "Rectangle {"),
- ExpectedResult("color-animation.qml", 96, "Rectangle {"),
+ ExpectedResult("color-animation.qml", 109, "Rectangle {"),
ExpectedResult("property-animation.qml", 48, "Rectangle {"),
ExpectedResult("property-animation.qml", 57, "Rectangle {")]
resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView")
@@ -112,7 +114,7 @@ def main():
invokeMenuItem("Tools", "QML/JS", "Find Usages")
# check if usage was properly found
expectedResults = [ExpectedResult("color-animation.qml", 50, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"),
- ExpectedResult("color-animation.qml", 97, "anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom }"),
+ ExpectedResult("color-animation.qml", 110, "anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom }"),
ExpectedResult("property-animation.qml", 49, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"),
ExpectedResult("property-animation.qml", 58, "anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom }")]
resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView")
@@ -130,7 +132,7 @@ def main():
type(editorArea, "<Left>")
type(editorArea, "<Ctrl+Shift+u>")
# check if usage was properly found
- expectedResults = [ExpectedResult("color-animation.qml", 87, "SequentialAnimation on opacity {")]
+ expectedResults = [ExpectedResult("color-animation.qml", 93, "SequentialAnimation on opacity {")]
resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView")
test.verify(checkUsages(resultsView, expectedResults, templateDir),
"Verifying if usages were properly found using shortcut.")
diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py
index 43f1e72099..b6646b7f22 100644
--- a/tests/system/suite_debugger/tst_simple_debug/test.py
+++ b/tests/system/suite_debugger/tst_simple_debug/test.py
@@ -52,11 +52,10 @@ def main():
if result:
expectedBreakpointsOrder = [{os.path.join(workingDir, projectName, "main.cpp"):8},
{os.path.join(workingDir, projectName, "main.qml"):13}]
- # Only use 4.7.4 to work around QTBUG-25187
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug")
progressBarWait()
if not availableConfigs:
- test.fatal("Haven't found a suitable Qt version (need Qt 4.7.4) - leaving without debugging.")
+ test.fatal("Haven't found a suitable Qt version - leaving without debugging.")
for kit, config in availableConfigs:
test.log("Selecting '%s' as build config" % config)
verifyBuildConfig(len(checkedTargets), kit, config, True, enableQmlDebug=True)
diff --git a/tests/system/suite_general/tst_default_settings/testdata/win_compiler_paths.tsv b/tests/system/suite_general/tst_default_settings/testdata/win_compiler_paths.tsv
index 66149bb891..b26671f2ac 100644
--- a/tests/system/suite_general/tst_default_settings/testdata/win_compiler_paths.tsv
+++ b/tests/system/suite_general/tst_default_settings/testdata/win_compiler_paths.tsv
@@ -22,6 +22,6 @@
"VS120COMNTOOLS" "..\..\VC\Bin" "vcvars32.bat" "Microsoft Visual C++ Compiler 12.0" "x86" "" "false" ""
"VS120COMNTOOLS" "..\..\VC" "vcvarsall.bat" "Microsoft Visual C++ Compiler 12.0" "x86,amd64,x86_amd64,ia64,x86_ia64" "x86,amd64,x86_amd64,ia64,x86_ia64" "false" ""
"VS140COMNTOOLS" "..\..\VC\Bin" "vcvars32.bat" "Microsoft Visual C++ Compiler 14.0" "x86" "" "false" "..\IDE\devenv.exe"
-"VS140COMNTOOLS" "..\..\VC" "vcvarsall.bat" "Microsoft Visual C++ Compiler 14.0" "x86,amd64,x86_amd64,x86_arm,amd64_arm" "x86,amd64,x86_amd64,x86_arm,amd64_arm" "false" "..\IDE\devenv.exe"
+"VS140COMNTOOLS" "..\..\VC" "vcvarsall.bat" "Microsoft Visual C++ Compiler 14.0" "x86,amd64,x86_amd64,x86_arm,amd64_arm,amd64_x86" "x86,amd64,x86_amd64,x86_arm,amd64_arm,amd64_x86" "false" "..\IDE\devenv.exe"
"ProgramFiles" "Microsoft Visual C++ Build Tools" "vcbuildtools.bat" "Microsoft Visual C++ Build Tools" "x86,x64,x86_arm,x64_arm" "x86,amd64,x86_arm,amd64_arm" "false" ""
"ProgramFiles(x86)" "Microsoft Visual C++ Build Tools" "vcbuildtools.bat" "Microsoft Visual C++ Build Tools" "x86,x64,x86_arm,x64_arm" "x86,amd64,x86_arm,amd64_arm" "false" ""
diff --git a/tests/system/suite_general/tst_session_handling/test.py b/tests/system/suite_general/tst_session_handling/test.py
index d34f943624..a163f89059 100644
--- a/tests/system/suite_general/tst_session_handling/test.py
+++ b/tests/system/suite_general/tst_session_handling/test.py
@@ -39,11 +39,11 @@ def main():
"Verifying window title contains created session name.")
checkWelcomePage(sessionName, True)
for project in projects:
- openQmakeProject(project, Targets.DESKTOP_480_DEFAULT)
+ openQmakeProject(project, Targets.DESKTOP_531_DEFAULT)
progressBarWait(20000)
- checkNavigator(70, "Verifying whether all projects have been opened.")
- openDocument("propertyanimation.QML.qml.color-animation\\.qml")
- openDocument("declarative-music-browser.Headers.utility\\.h")
+ checkNavigator(53, "Verifying whether all projects have been opened.")
+ openDocument("animation.Resources.animation\\.qrc./animation.basics.animators\\.qml")
+ openDocument("keyinteraction.Sources.main\\.cpp")
checkOpenDocuments(2, "Verifying whether 2 files are open.")
originalText = str(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget").plainText)
switchSession("default")
@@ -56,9 +56,9 @@ def main():
switchSession(sessionName)
test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000),
"Verifying window title contains created session name.")
- checkNavigator(70, "Verifying whether all projects have been re-opened.")
+ checkNavigator(53, "Verifying whether all projects have been re-opened.")
checkOpenDocuments(2, "Verifying whether 2 files have been re-opened.")
- if test.verify("utility.h" in str(mainWindow.windowTitle),
+ if test.verify("main.cpp" in str(mainWindow.windowTitle),
"Verifying whether utility.h has been opened."):
current = str(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget").plainText)
test.verify(originalText == current, "Verifying that same file has been opened.")
@@ -66,10 +66,10 @@ def main():
invokeMenuItem("File", "Exit")
def prepareTestExamples():
- examples = [os.path.join(sdkPath, "Examples", "4.7", "declarative", "animation", "basics",
- "property-animation", "propertyanimation.pro"),
- os.path.join(sdkPath, "Examples", "QtMobility", "declarative-music-browser",
- "declarative-music-browser.pro")
+ examples = [os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_561_DEFAULT),
+ "quick", "animation", "animation.pro"),
+ os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_561_DEFAULT),
+ "quick", "keyinteraction", "keyinteraction.pro")
]
projects = []
for sourceExample in examples:
diff --git a/tests/system/suite_qtquick/tst_qml_outline/test.py b/tests/system/suite_qtquick/tst_qml_outline/test.py
index 2748601c00..e837f52346 100644
--- a/tests/system/suite_qtquick/tst_qml_outline/test.py
+++ b/tests/system/suite_qtquick/tst_qml_outline/test.py
@@ -27,19 +27,20 @@ source("../../shared/qtcreator.py")
qmlEditor = ":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"
outline = ":Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView"
+treebase = "keyinteraction.Resources.keyinteraction\\.qrc./keyinteraction.focus."
def main():
- sourceExample = os.path.abspath(os.path.join(sdkPath, "Examples", "4.7", "declarative",
- "keyinteraction", "focus"))
- proFile = "focus.pro"
+ sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_561_DEFAULT),
+ "quick", "keyinteraction")
+ proFile = "keyinteraction.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
templateDir = prepareTemplate(sourceExample)
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
- openQmakeProject(os.path.join(templateDir, proFile), Targets.DESKTOP_480_DEFAULT)
- qmlFiles = ["focus.QML.qml.focus\\.qml", "focus.QML.qml.Core.ListMenu\\.qml"]
+ openQmakeProject(os.path.join(templateDir, proFile), Targets.DESKTOP_531_DEFAULT)
+ qmlFiles = [treebase + "focus\\.qml", treebase + "Core.ListMenu\\.qml"]
checkOutlineFor(qmlFiles)
testModify()
invokeMenuItem("File", "Save All")
@@ -73,7 +74,7 @@ def processChildren(model, startIndex, level):
def testModify():
global qmlEditor
- if not openDocument("focus.QML.qml.focus\\.qml"):
+ if not openDocument(treebase + "focus\\.qml"):
test.fatal("Failed to open file focus.qml")
return
test.log("Testing whether modifications show up inside outline.")
diff --git a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod1_outline.tsv b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod1_outline.tsv
index d31ad3d148..c1c371696b 100644
--- a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod1_outline.tsv
+++ b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod1_outline.tsv
@@ -2,7 +2,7 @@
"Rectangle" "0" ""
"id" "1" "window"
"width" "1" "800"
-"height" "1" "480"
+"height" "1" "640"
"color" "1" """#3E606F"""
"Text" "1" ""
"id" "2" "addedText"
@@ -15,17 +15,25 @@
"width" "2" "parent.width"
"height" "2" "parent.height"
"focus" "2" "true"
+"TabMenu" "2" ""
+"id" "3" "tabMenu"
+"y" "3" "160"
+"width" "3" "parent.width"
+"height" "3" "160"
+"focus" "3" "true"
+"activeFocusOnTab" "3" "true"
"GridMenu" "2" ""
"id" "3" "gridMenu"
+"y" "3" "320"
"width" "3" "parent.width"
"height" "3" "320"
-"focus" "3" "true"
-"interactive" "3" "parent.activeFocus"
+"activeFocusOnTab" "3" "true"
"ListMenu" "2" ""
"id" "3" "listMenu"
-"y" "3" "320"
+"y" "3" "640"
"width" "3" "parent.width"
"height" "3" "320"
+"activeFocusOnTab" "3" "true"
"Rectangle" "2" ""
"id" "3" "shade"
"anchors.fill" "3" "parent"
@@ -33,13 +41,38 @@
"opacity" "3" "0"
"states" "2" ""
"State" "3" ""
-"name" "4" """showListViews"""
+"name" "4" """showTabViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "160"
"PropertyChanges" "4" ""
"target" "5" "gridMenu"
-"y" "5" "-160"
+"y" "5" "320"
"PropertyChanges" "4" ""
"target" "5" "listMenu"
+"y" "5" "640"
+"State" "3" ""
+"name" "4" """showGridViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
"y" "5" "160"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "480"
+"State" "3" ""
+"name" "4" """showListViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "-160"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "320"
"transitions" "2" ""
"Transition" "3" ""
"NumberAnimation" "4" ""
diff --git a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod2_outline.tsv b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod2_outline.tsv
index 27026b8717..81f4b67fae 100644
--- a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod2_outline.tsv
+++ b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod2_outline.tsv
@@ -2,7 +2,7 @@
"Rectangle" "0" ""
"id" "1" "window"
"width" "1" "800"
-"height" "1" "480"
+"height" "1" "640"
"color" "1" """white"""
"Text" "1" ""
"id" "2" "addedText"
@@ -15,17 +15,25 @@
"width" "2" "parent.width"
"height" "2" "parent.height"
"focus" "2" "true"
+"TabMenu" "2" ""
+"id" "3" "tabMenu"
+"y" "3" "160"
+"width" "3" "parent.width"
+"height" "3" "160"
+"focus" "3" "true"
+"activeFocusOnTab" "3" "true"
"GridMenu" "2" ""
"id" "3" "gridMenu"
+"y" "3" "320"
"width" "3" "parent.width"
"height" "3" "320"
-"focus" "3" "true"
-"interactive" "3" "parent.activeFocus"
+"activeFocusOnTab" "3" "true"
"ListMenu" "2" ""
"id" "3" "listMenu"
-"y" "3" "320"
+"y" "3" "640"
"width" "3" "parent.width"
"height" "3" "320"
+"activeFocusOnTab" "3" "true"
"Rectangle" "2" ""
"id" "3" "shade"
"anchors.fill" "3" "parent"
@@ -33,13 +41,38 @@
"opacity" "3" "0"
"states" "2" ""
"State" "3" ""
-"name" "4" """showListViews"""
+"name" "4" """showTabViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "160"
"PropertyChanges" "4" ""
"target" "5" "gridMenu"
-"y" "5" "-160"
+"y" "5" "320"
"PropertyChanges" "4" ""
"target" "5" "listMenu"
+"y" "5" "640"
+"State" "3" ""
+"name" "4" """showGridViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
"y" "5" "160"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "480"
+"State" "3" ""
+"name" "4" """showListViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "-160"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "320"
"transitions" "2" ""
"Transition" "3" ""
"NumberAnimation" "4" ""
diff --git a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv
index 086c391d2e..363393157b 100644
--- a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv
+++ b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv
@@ -5,7 +5,7 @@
"clicked" "1" ""
"clicked()" "1" ""
"width" "1" "800"
-"height" "1" "480"
+"height" "1" "640"
"color" "1" """white"""
"Text" "1" ""
"id" "2" "addedText"
@@ -18,17 +18,25 @@
"width" "2" "parent.width"
"height" "2" "parent.height"
"focus" "2" "true"
+"TabMenu" "2" ""
+"id" "3" "tabMenu"
+"y" "3" "160"
+"width" "3" "parent.width"
+"height" "3" "160"
+"focus" "3" "true"
+"activeFocusOnTab" "3" "true"
"GridMenu" "2" ""
"id" "3" "gridMenu"
+"y" "3" "320"
"width" "3" "parent.width"
"height" "3" "320"
-"focus" "3" "true"
-"interactive" "3" "parent.activeFocus"
+"activeFocusOnTab" "3" "true"
"ListMenu" "2" ""
"id" "3" "listMenu"
-"y" "3" "320"
+"y" "3" "640"
"width" "3" "parent.width"
"height" "3" "320"
+"activeFocusOnTab" "3" "true"
"Rectangle" "2" ""
"id" "3" "shade"
"anchors.fill" "3" "parent"
@@ -36,13 +44,38 @@
"opacity" "3" "0"
"states" "2" ""
"State" "3" ""
-"name" "4" """showListViews"""
+"name" "4" """showTabViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "160"
"PropertyChanges" "4" ""
"target" "5" "gridMenu"
-"y" "5" "-160"
+"y" "5" "320"
"PropertyChanges" "4" ""
"target" "5" "listMenu"
+"y" "5" "640"
+"State" "3" ""
+"name" "4" """showGridViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
"y" "5" "160"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "480"
+"State" "3" ""
+"name" "4" """showListViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "-160"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "320"
"transitions" "2" ""
"Transition" "3" ""
"NumberAnimation" "4" ""
diff --git a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_outline.tsv b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_outline.tsv
index 0f72a543a0..1b2b13e872 100644
--- a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_outline.tsv
+++ b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_outline.tsv
@@ -2,24 +2,32 @@
"Rectangle" "0" ""
"id" "1" "window"
"width" "1" "800"
-"height" "1" "480"
+"height" "1" "640"
"color" "1" """#3E606F"""
"FocusScope" "1" ""
"id" "2" "mainView"
"width" "2" "parent.width"
"height" "2" "parent.height"
"focus" "2" "true"
+"TabMenu" "2" ""
+"id" "3" "tabMenu"
+"y" "3" "160"
+"width" "3" "parent.width"
+"height" "3" "160"
+"focus" "3" "true"
+"activeFocusOnTab" "3" "true"
"GridMenu" "2" ""
"id" "3" "gridMenu"
+"y" "3" "320"
"width" "3" "parent.width"
"height" "3" "320"
-"focus" "3" "true"
-"interactive" "3" "parent.activeFocus"
+"activeFocusOnTab" "3" "true"
"ListMenu" "2" ""
"id" "3" "listMenu"
-"y" "3" "320"
+"y" "3" "640"
"width" "3" "parent.width"
"height" "3" "320"
+"activeFocusOnTab" "3" "true"
"Rectangle" "2" ""
"id" "3" "shade"
"anchors.fill" "3" "parent"
@@ -27,13 +35,38 @@
"opacity" "3" "0"
"states" "2" ""
"State" "3" ""
-"name" "4" """showListViews"""
+"name" "4" """showTabViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "160"
"PropertyChanges" "4" ""
"target" "5" "gridMenu"
-"y" "5" "-160"
+"y" "5" "320"
"PropertyChanges" "4" ""
"target" "5" "listMenu"
+"y" "5" "640"
+"State" "3" ""
+"name" "4" """showGridViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
"y" "5" "160"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "480"
+"State" "3" ""
+"name" "4" """showListViews"""
+"PropertyChanges" "4" ""
+"target" "5" "tabMenu"
+"y" "5" "-160"
+"PropertyChanges" "4" ""
+"target" "5" "gridMenu"
+"y" "5" "0"
+"PropertyChanges" "4" ""
+"target" "5" "listMenu"
+"y" "5" "320"
"transitions" "2" ""
"Transition" "3" ""
"NumberAnimation" "4" ""
diff --git a/tests/unit/unittest/clangcodecompleteresultstest.cpp b/tests/unit/unittest/clangcodecompleteresultstest.cpp
index b16c2266ed..4e266c0142 100644
--- a/tests/unit/unittest/clangcodecompleteresultstest.cpp
+++ b/tests/unit/unittest/clangcodecompleteresultstest.cpp
@@ -47,6 +47,12 @@ using ClangBackEnd::TranslationUnit;
using ClangBackEnd::UnsavedFiles;
using ClangBackEnd::ProjectPart;
+static unsigned completionOptions(const TranslationUnit &translationUnit)
+{
+ return translationUnit.defaultOptions() & CXTranslationUnit_IncludeBriefCommentsInCodeCompletion
+ ? CXCodeComplete_IncludeBriefComments : 0;
+}
+
TEST(ClangCodeCompleteResults, GetData)
{
ProjectPart projectPart(Utf8StringLiteral("projectPartId"));
@@ -58,7 +64,11 @@ TEST(ClangCodeCompleteResults, GetData)
Utf8StringVector(),
translationUnits);
Utf8String nativeFilePath = FilePath::toNativeSeparators(translationUnit.filePath());
- CXCodeCompleteResults *cxCodeCompleteResults = clang_codeCompleteAt(translationUnit.cxTranslationUnit(), nativeFilePath.constData(), 49, 1, 0, 0, 0);
+ CXCodeCompleteResults *cxCodeCompleteResults =
+ clang_codeCompleteAt(translationUnit.cxTranslationUnit(),
+ nativeFilePath.constData(),
+ 49, 1, 0, 0,
+ completionOptions(translationUnit));
ClangCodeCompleteResults codeCompleteResults(cxCodeCompleteResults);
@@ -85,7 +95,11 @@ TEST(ClangCodeCompleteResults, MoveClangCodeCompleteResults)
Utf8StringVector(),
translationUnits);
Utf8String nativeFilePath = FilePath::toNativeSeparators(translationUnit.filePath());
- CXCodeCompleteResults *cxCodeCompleteResults = clang_codeCompleteAt(translationUnit.cxTranslationUnit(), nativeFilePath.constData(), 49, 1, 0, 0, 0);
+ CXCodeCompleteResults *cxCodeCompleteResults =
+ clang_codeCompleteAt(translationUnit.cxTranslationUnit(),
+ nativeFilePath.constData(),
+ 49, 1, 0, 0,
+ completionOptions(translationUnit));
ClangCodeCompleteResults codeCompleteResults(cxCodeCompleteResults);