Merge remote-tracking branch 'origin/4.1'

Conflicts:
	README.md
	src/plugins/modeleditor/actionhandler.cpp

Change-Id: I65c2885593b881eda94872168a3891cab9cafe71
This commit is contained in:
Eike Ziller
2016-07-11 10:46:05 +02:00
136 changed files with 1523 additions and 850 deletions

View File

@@ -21,6 +21,7 @@ Prerequisites:
* jom
* On Mac OS X: latest Xcode
* On Linux: g++ 4.8 or later
* LLVM 3.8.0 or later for the Clang Code Model
The installed toolchains have to match the one Qt was compiled with.
@@ -114,7 +115,7 @@ For detailed information on the supported compilers, see
command...` error. If a `sh.exe` is found, the compile process will fail.
You have to remove it from the path.
10. To enable the Clang-based code model: Install Clang (>= version 3.6.2)
10. To enable the Clang-based code model: Install Clang (>= version 3.8.0)
and set the environment variable LLVM_INSTALL_DIR to point to the
installation location.

195
dist/changes-4.1.0.md vendored Normal file
View File

@@ -0,0 +1,195 @@
Qt Creator version 4.1 contains bug fixes and new features.
The most important changes are listed in this document. For a complete
list of changes, see the Git log for the Qt Creator sources that
you can check out from the public Git repository. For example:
git clone git://code.qt.io/qt-creator/qt-creator.git
git log --cherry-pick --pretty=oneline origin/4.0..v4.1.0
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
Editing
* Added automatic release of resources for unmodified documents that have
not been visible a long time (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)
All Projects
* Improved feedback when build results in errors and there
are issues with the kit (QTCREATORBUG-16079)
* Fixed issue with building in paths with non-ASCII characters
(QTCREATORBUG-15855)
* Fixed that `%{buildDir}` and `%{sourceDir}` stopped working in
run configurations (QTCREATORBUG-16338)
QMake Projects
* Added `Duplicate File` to context menu in project tree (QTCREATORBUG-15952)
* Added `QtWebEngine` to modules list
* Changed `Run Qmake` from `qmake -r` to `qmake && make qmake_all` for Qt 5
* Fixed renaming files used in QRC files (QTCREATORBUG-15786)
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)
Qbs Projects
* Added support for `qtcRunnable` property, similar to `qtc_runnable` for
Qmake projects
C++ Support
* Added separate highlighting for function declarations and usages
(QTCREATORBUG-15564)
* Added highlighting option for global variables
* Added coding style option for preferring getters with `get`
* Fixed parsing of `-std=gnu++XX` option (QTCREATORBUG-16290)
* Fixed refactoring of methods with ref-qualifier
QML Support
* Added formal parameters of JavaScript functions to outline and Locator
Debugging
* Added support for copying selected values from `Locals and Expressions`
(QTCREATORBUG-14956)
* Fixed jumping to address in binary editor (QTCREATORBUG-11064)
* GDB
* Fixed that `qint8` values where shown as unsigned values
(QTCREATORBUG-16353)
QML Profiler
* Improved progress information
* Improved performance when many events are involved
Qt Quick Designer
* Added support for Qt Quick Controls 2 styles
* Added `Move to Component` action
* Added `Add new Signal Handler` action
* Improved performance
* Improved error dialog (QTCREATORBUG-15772)
* Fixed crumble bar for component navigation
* Fixed that `Connections` was not allowed in `.ui.qml` files
* Fixed crashes with spaces in properties (QTCREATORBUG-16059)
* Fixed that child items of `State` were rendered (QTCREATORBUG-13003)
Version Control Systems
* Git
* Added date and time information to branch dialog
* Added support for running `git blame` only on selected lines
(QTCREATORBUG-16055)
* Fixed that branch dialog suggested existing branch name for new branch
(QTCREATORBUG-16264)
* SVN
* Added conflicted files to file list in submit editor
Test Integration
* Fixed that test case summary stayed visible even if no entries matched
the applied filter
* Fixed parsing of failure location for Google Test on Windows
FakeVim
* Added expansion of `~` in file names (QTCREATORBUG-11160)
Model Editor
* Added zooming of diagrams
Beautifier
* Added option to automatically format files on save
* Uncrustify
* Fixed issues with non-C++ files (QTCREATORBUG-15575)
Platform Specific
Windows
* Added detection of MSVC amd64_x86 toolchain
macOS
* Fixed include search order with frameworks (QTCREATORBUG-11599)
Remote Linux
* Added support for TCP/IP forward tunneling with SSH
iOS
* 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
Alessandro Portale
Alexander Drozdov
Andre Hartmann
André Pönitz
Antoine Poliakov
Arnold Dumas
BogDan Vatra
Christian Kandeler
Christian Stenger
Cristian Adam
David Schulz
Dmitry Ashkadov
Eike Ziller
Erik Verbrüggen
Filippo Cucchetto
Finn Brudal
Georger Araújo
Jake Petroules
Jaroslaw Kobus
Jean Gressmann
Jochen Becher
Leena Miettinen
Lorenz Haas
Lukas Holecek
Marco Benelli
Marco Bubke
Marc Reilly
Mashrab Kuvatov
Maurice Kalinowski
Nikita Baryshnikov
Nikolai Kosjar
Orgad Shaneh
Oswald Buddenhagen
Philip Lorenz
Robert Löhning
Shinnok
Takumi ASAKI
Thiago Macieira
Thomas Hartmann
Tim Jenssen
Tobias Hunger
Ulf Hermann
Unai IRIGOYEN
Victor Heng
Vikas Pachdha
Vlad Seryakov
Wolfgang Bremer

View File

@@ -103,7 +103,7 @@
\list 1
\li Acquire Clang 3.6.2 or higher in one of the following ways:
\li Acquire Clang 3.8.0 or higher in one of the following ways:
\list

View File

@@ -25,7 +25,7 @@ QtcProduct {
name: "Qt.test"
}
cpp.createSymlinks: false
cpp.internalVersion: ""
cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"])
cpp.sonamePrefix: qbs.targetOS.contains("osx")
? "@rpath"

View File

@@ -1,6 +1,6 @@
var Environment = loadExtension("qbs.Environment")
var File = loadExtension("qbs.File")
var MinimumLLVMVersion = "3.6.2"
var MinimumLLVMVersion = "3.8.0"
var Process = loadExtension("qbs.Process")
function readOutput(executable, args)
@@ -27,8 +27,7 @@ function llvmConfig(qbs, qtcFunctions)
{
var llvmInstallDirFromEnv = Environment.getEnv("LLVM_INSTALL_DIR")
var llvmConfigVariants = [
"llvm-config", "llvm-config-3.2", "llvm-config-3.3", "llvm-config-3.4",
"llvm-config-3.5", "llvm-config-3.6", "llvm-config-4.0", "llvm-config-4.1"
"llvm-config", "llvm-config-3.8", "llvm-config-3.9", "llvm-config-4.0", "llvm-config-4.1"
];
// Prefer llvm-config* from LLVM_INSTALL_DIR

View File

@@ -5,13 +5,13 @@ import "qtc.js" as HelperFunctions
Module {
property string ide_version_major: '4'
property string ide_version_minor: '0'
property string ide_version_release: '82'
property string ide_version_release: '83'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.'
+ ide_version_release
property string ide_compat_version_major: '4'
property string ide_compat_version_minor: '0'
property string ide_compat_version_release: '82'
property string ide_compat_version_release: '83'
property string qtcreator_compat_version: ide_compat_version_major + '.'
+ ide_compat_version_minor + '.' + ide_compat_version_release

View File

@@ -1,10 +1,10 @@
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
QTCREATOR_PRI_INCLUDED = 1
QTCREATOR_VERSION = 4.0.82
QTCREATOR_COMPAT_VERSION = 4.0.82
QTCREATOR_VERSION = 4.0.83
QTCREATOR_COMPAT_VERSION = 4.0.83
VERSION = $$QTCREATOR_VERSION
BINARY_ARTIFACTS_BRANCH = master
BINARY_ARTIFACTS_BRANCH = 4.1
# enable c++11
CONFIG += c++11

View File

@@ -49,8 +49,7 @@ Project {
break;
}
}
var fullQtcInstallDir
= FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, qbs.InstallDir);
var fullQtcInstallDir = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix);
var fullLibInstallDir = FileInfo.joinPaths(fullQtcInstallDir, qtc.ide_library_path);
var fullPluginInstallDir = FileInfo.joinPaths(fullQtcInstallDir, qtc.ide_plugin_path);
path = Qt.core.binPath + ";" + fullLibInstallDir + ";" + fullPluginInstallDir

View File

@@ -34,6 +34,7 @@ cd ${TEMPSOURCES} || exit 1
tar xf __qtcreator_main.tar || exit 1
tar xf __qtcreator_qbs.tar || exit 1
tar czf "${RESULTDIR}/${PREFIX}.tar.gz" ${PREFIX}/ || exit 1
tar cJf "${RESULTDIR}/${PREFIX}.tar.xz" ${PREFIX}/ || exit 1
echo "Creating zip archive..."
echo " Filtering binary vs text files..."

View File

@@ -346,3 +346,28 @@ def qdump__KDSoapValue(d, value):
p = (value.cast(lookupType("char*")) + 4).dereference().cast(lookupType("QString"))
d.putStringValue(p)
d.putPlainChildren(value["d"]["d"].dereference())
#######################################################################
#
# Webkit
#
#######################################################################
def qdump__WTF__String(d, value):
# WTF::String -> WTF::RefPtr<WTF::StringImpl> -> WTF::StringImpl*
data = value['m_impl']['m_ptr']
d.checkPointer(data)
stringLength = int(data['m_length'])
d.check(0 <= stringLength and stringLength <= 100000000)
# WTF::StringImpl* -> WTF::StringImpl -> sizeof(WTF::StringImpl)
offsetToData = data.type.target().sizeof
bufferPtr = data.cast(d.charPtrType()) + offsetToData
is8Bit = data['m_is8Bit']
charSize = 1
if not is8Bit:
charSize = 2
d.putCharArrayHelper(bufferPtr, stringLength, charSize)

View File

@@ -54,7 +54,11 @@ Rectangle {
style: ButtonStyle {
background: Rectangle {
color: control.hovered ? Qt.lighter(baseColor, 1.2) : "transparent"
radius: 2
Image {
source: "image://icons/close"
height: 16
width: 16
}
}
}
@@ -64,7 +68,6 @@ Rectangle {
anchors.verticalCenter: stateNameField.verticalCenter
height: 16
width: 16
iconSource: "images/darkclose.png"
visible: !isBaseState
onClicked: root.deleteState(internalNodeId)

View File

@@ -104,7 +104,6 @@ FocusScope {
anchors.verticalCenter: parent.verticalCenter
width: Math.max(parent.height / 2 - 8, 18)
height: width
iconSource: "images/plus.png"
onClicked: root.createNewState()
@@ -113,6 +112,13 @@ FocusScope {
property color buttonBaseColor: "#6f6f6f"
color: control.hovered ? Qt.lighter(buttonBaseColor, 1.2) : buttonBaseColor
border.width: 1
Image {
source: "image://icons/plus"
width: 16
height: 16
anchors.centerIn: parent
smooth: false
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

View File

@@ -70,8 +70,8 @@ IconsInterruptColor=ff587ff7
IconsInterruptToolBarColor=ff6a7bc3
IconsDebugColor=toolBarItem
IconsNavigationArrowsColor=ffebc322
IconsBuildHammerHandleColor=ffc26b14
IconsBuildHammerHeadColor=ff868687
IconsBuildHammerHandleColor=ffb06112
IconsBuildHammerHeadColor=ff828384
IconsModeWelcomeActiveColor=ff80c342
IconsModeEditActiveColor=ff99aaef
IconsModeDesignActiveColor=ffbb6000
@@ -89,8 +89,8 @@ IconsCodeModelMacroColor=ff476ba0
IconsCodeModelAttributeColor=ff316511
IconsCodeModelUniformColor=ff994899
IconsCodeModelVaryingColor=ffa08833
IconsCodeModelOverlayBackgroundColor=70ffffff
IconsCodeModelOverlayForegroundColor=ff232425
IconsCodeModelOverlayBackgroundColor=70000000
IconsCodeModelOverlayForegroundColor=ffd0d0d0
InfoBarBackground=ff505000
InfoBarText=text
MenuBarEmptyAreaBackgroundColor=shadowBackground
@@ -127,21 +127,21 @@ TreeViewArrowColorNormal=hoverBackground
TreeViewArrowColorSelected=text
OutputPanes_DebugTextColor=text
OutputPanes_ErrorMessageTextColor=ffaa0000
OutputPanes_MessageOutput=ff0000aa
OutputPanes_NormalMessageTextColor=ff0000aa
OutputPanes_StdErrTextColor=ffaa0000
OutputPanes_StdOutTextColor=ff000000
OutputPanes_WarningMessageTextColor=ff808000
OutputPanes_TestPassTextColor=ff009900
OutputPanes_TestFailTextColor=ffa00000
OutputPanes_TestXFailTextColor=ff28f028
OutputPanes_TestXPassTextColor=fff02828
OutputPanes_TestSkipTextColor=ff787878
OutputPanes_TestWarnTextColor=ffd0bb00
OutputPanes_TestFatalTextColor=ff640000
OutputPanes_ErrorMessageTextColor=ffff6c6c
OutputPanes_MessageOutput=ff008787
OutputPanes_NormalMessageTextColor=text
OutputPanes_StdErrTextColor=ffff6666
OutputPanes_StdOutTextColor=text
OutputPanes_WarningMessageTextColor=fff3c300
OutputPanes_TestPassTextColor=ff00b400
OutputPanes_TestFailTextColor=ffcf4848
OutputPanes_TestXFailTextColor=ff28dc28
OutputPanes_TestXPassTextColor=ffdc2828
OutputPanes_TestSkipTextColor=ff828282
OutputPanes_TestWarnTextColor=ffc8c800
OutputPanes_TestFatalTextColor=ffc82828
OutputPanes_TestDebugTextColor=ff329696
OutputPaneButtonFlashColor=ffff0000
OutputPaneButtonFlashColor=error
OutputPaneToggleButtonTextColorChecked=fancyBarsNormalTextColor
OutputPaneToggleButtonTextColorUnchecked=fancyBarsNormalTextColor

View File

@@ -314,7 +314,7 @@ PluginView::PluginView(QWidget *parent)
m_categoryView->setSelectionMode(QAbstractItemView::SingleSelection);
m_categoryView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_model = new LeveledTreeModel<CollectionItem, PluginItem>(this);
m_model = new LeveledTreeModel<TreeItem, CollectionItem, PluginItem>(this);
m_model->setHeader({ tr("Name"), tr("Load"), tr("Version"), tr("Vendor") });
m_sortModel = new CategorySortFilterModel(this);

View File

@@ -71,7 +71,7 @@ private:
bool setPluginsEnabled(const QSet<PluginSpec *> &plugins, bool enable);
Utils::TreeView *m_categoryView;
Utils::LeveledTreeModel<Internal::CollectionItem, Internal::PluginItem> *m_model;
Utils::LeveledTreeModel<Utils::TreeItem, Internal::CollectionItem, Internal::PluginItem> *m_model;
QSortFilterProxyModel *m_sortModel;
friend class Internal::CollectionItem;

View File

@@ -63,6 +63,18 @@ struct DebugPrint : public std::ostringstream {
}
};
struct Bench
{
Bench(const std::string &what) : m_initialTickCount(GetTickCount()), m_what(what) {}
~Bench()
{
DebugPrint() << m_what << " took "
<< GetTickCount() - m_initialTickCount << "ms to execute." << std::endl;
}
const DWORD m_initialTickCount;
const std::string m_what;
};
ULONG currentThreadId(IDebugSystemObjects *sysObjects);
ULONG currentThreadId(CIDebugClient *client);
ULONG currentProcessId(IDebugSystemObjects *sysObjects);

View File

@@ -30,7 +30,6 @@ import QtQuick.Controls.Styles 1.2
ToolBar {
id: buttons
readonly property int buttonWidth: 30
signal jumpToPrev()
signal jumpToNext()
@@ -63,7 +62,7 @@ ToolBar {
}
background: Rectangle {
anchors.fill: parent
color: "#9B9B9B"
color: creatorTheme.PanelStatusBarBackgroundColor
}
}
@@ -71,62 +70,56 @@ ToolBar {
spacing: 0
anchors.fill: parent
ToolButton {
ImageToolButton {
id: jumpToPrevButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: buttonWidth
iconSource: "qrc:/timeline/ico_prev.png"
imageSource: "image://icons/prev"
tooltip: qsTr("Jump to previous event.")
onClicked: buttons.jumpToPrev()
}
ToolButton {
ImageToolButton {
id: jumpToNextButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: buttonWidth
iconSource: "qrc:/timeline/ico_next.png"
imageSource: "image://icons/next"
tooltip: qsTr("Jump to next event.")
onClicked: buttons.jumpToNext()
}
ToolButton {
ImageToolButton {
id: zoomControlButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: buttonWidth
iconSource: "qrc:/timeline/ico_zoom.png"
imageSource: "image://icons/zoom"
tooltip: qsTr("Show zoom slider.")
checkable: true
checked: false
onCheckedChanged: buttons.zoomControlChanged()
}
ToolButton {
ImageToolButton {
id: rangeButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: buttonWidth
iconSource: checked ? "qrc:/timeline/ico_rangeselected.png" :
"qrc:/timeline/ico_rangeselection.png"
imageSource: "image://icons/" + (checked ? "rangeselected" : "rangeselection");
tooltip: qsTr("Select range.")
checkable: true
checked: false
onCheckedChanged: buttons.rangeSelectChanged()
}
ToolButton {
ImageToolButton {
id: lockButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: buttonWidth
iconSource: "qrc:/timeline/ico_selectionmode.png"
imageSource: "image://icons/selectionmode"
tooltip: qsTr("View event information on mouseover.")
checkable: true
checked: false

View File

@@ -0,0 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.2
ToolButton {
implicitWidth: 30
property string imageSource
Image {
source: parent.enabled ? parent.imageSource : parent.imageSource + "/disabled"
width: 16
height: 16
anchors.centerIn: parent
}
style: ButtonStyle {
background: Rectangle {
color: (control.checked || control.pressed)
? creatorTheme.FancyToolButtonSelectedColor
: control.hovered
? creatorTheme.FancyToolButtonHoverColor
: "#00000000"
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

View File

@@ -17,11 +17,11 @@
<file>arrow_right.png</file>
<file>range_handle.png</file>
<file>ico_selectionmode.png</file>
<file>ico_zoom.png</file>
<file>ico_prev.png</file>
<file>ico_next.png</file>
<file>ico_selectionmode@2x.png</file>
<file>ico_rangeselection.png</file>
<file>ico_rangeselection@2x.png</file>
<file>ico_rangeselected.png</file>
<file>ico_rangeselected@2x.png</file>
<file>ico_note.png</file>
<file>ButtonsBar.qml</file>
<file>timelineitems.vert</file>
@@ -33,5 +33,6 @@
<file>RowLabel.qml</file>
<file>SynchronousReloader.qml</file>
<file>TimelineText.qml</file>
<file>ImageToolButton.qml</file>
</qresource>
</RCC>

View File

@@ -15,7 +15,8 @@ SOURCES += \
$$PWD/timelinerenderstate.cpp \
$$PWD/timelinenotesmodel.cpp \
$$PWD/timelineabstractrenderer.cpp \
$$PWD/timelineoverviewrenderer.cpp
$$PWD/timelineoverviewrenderer.cpp \
$$PWD/timelinetheme.cpp
HEADERS += \
@@ -37,7 +38,8 @@ HEADERS += \
$$PWD/timelineabstractrenderer.h \
$$PWD/timelineabstractrenderer_p.h \
$$PWD/timelineoverviewrenderer_p.h \
$$PWD/timelineoverviewrenderer.h
$$PWD/timelineoverviewrenderer.h \
$$PWD/timelinetheme.h
RESOURCES += \
$$PWD/qml/timeline.qrc

View File

@@ -28,6 +28,7 @@ Project {
"timelinerenderpass.cpp", "timelinerenderpass.h",
"timelinerenderstate.cpp", "timelinerenderstate.h", "timelinerenderstate_p.h",
"timelineselectionrenderpass.cpp", "timelineselectionrenderpass.h",
"timelinetheme.cpp", "timelinetheme.h",
"timelinezoomcontrol.cpp", "timelinezoomcontrol.h"
]
}

View File

@@ -0,0 +1,99 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "timelinetheme.h"
#include <utils/icon.h>
#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
#include <utils/theme/theme.h>
#include <QIcon>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlPropertyMap>
#include <QQuickImageProvider>
namespace Timeline {
class TimelineImageIconProvider : public QQuickImageProvider
{
public:
TimelineImageIconProvider()
: QQuickImageProvider(Pixmap)
{
}
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override
{
Q_UNUSED(requestedSize)
const QStringList idElements = id.split(QLatin1Char('/'));
QTC_ASSERT(!idElements.isEmpty(), return QPixmap());
const QString &iconName = idElements.first();
const QIcon::Mode iconMode = (idElements.count() > 1
&& idElements.at(1) == QLatin1String("disabled"))
? QIcon::Disabled : QIcon::Normal;
Utils::Icon icon;
if (iconName == QLatin1String("prev"))
icon = Utils::Icons::PREV_TOOLBAR;
else if (iconName == QLatin1String("next"))
icon = Utils::Icons::NEXT_TOOLBAR;
else if (iconName == QLatin1String("zoom"))
icon = Utils::Icons::ZOOM_TOOLBAR;
else if (iconName == QLatin1String("rangeselection"))
icon = Utils::Icon({{QLatin1String(":/timeline/ico_rangeselection.png"),
Utils::Theme::IconsBaseColor}});
else if (iconName == QLatin1String("rangeselected"))
icon = Utils::Icon({{QLatin1String(":/timeline/ico_rangeselected.png"),
Utils::Theme::IconsBaseColor}});
else if (iconName == QLatin1String("selectionmode"))
icon = Utils::Icon({{QLatin1String(":/timeline/ico_selectionmode.png"),
Utils::Theme::IconsBaseColor}});
const QSize iconSize(16, 16);
const QPixmap result = icon.icon().pixmap(iconSize, iconMode);
if (size)
*size = result.size();
return result;
}
};
void TimelineTheme::setupTheme(QQmlEngine *engine)
{
QQmlPropertyMap *themePropertyMap = new QQmlPropertyMap(engine);
const QVariantHash creatorTheme = Utils::creatorTheme()->values();
for (auto it = creatorTheme.constBegin(); it != creatorTheme.constEnd(); ++it)
themePropertyMap->insert(it.key(), it.value());
engine->rootContext()->setContextProperty(QLatin1String("creatorTheme"), themePropertyMap);
engine->addImageProvider(QLatin1String("icons"), new TimelineImageIconProvider);
}
} // namespace Timeline

View File

@@ -0,0 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "timeline_global.h"
QT_FORWARD_DECLARE_CLASS(QQmlEngine)
namespace Timeline {
class TIMELINE_EXPORT TimelineTheme {
public:
static void setupTheme(QQmlEngine* engine);
};
} // namespace Timeline

View File

@@ -155,6 +155,9 @@ struct functionTraits<Callable&&> : public functionTraits<Callable>
{
};
template <typename F>
using functionResult_t = typename functionTraits<F>::ResultType;
////////////////////
// functionTakesArgument
////////////////////

View File

@@ -243,7 +243,7 @@ protected:
};
template <typename ResultType, typename Function, typename... Args>
typename functionTraits<Function>::ResultType
functionResult_t<Function>
callWithMaybeFutureInterfaceDispatch(std::false_type, QFutureInterface<ResultType> &,
Function &&function, Args&&... args)
{
@@ -251,7 +251,7 @@ callWithMaybeFutureInterfaceDispatch(std::false_type, QFutureInterface<ResultTyp
}
template <typename ResultType, typename Function, typename... Args>
typename functionTraits<Function>::ResultType
functionResult_t<Function>
callWithMaybeFutureInterfaceDispatch(std::true_type, QFutureInterface<ResultType> &futureInterface,
Function &&function, Args&&... args)
{
@@ -259,7 +259,7 @@ callWithMaybeFutureInterfaceDispatch(std::true_type, QFutureInterface<ResultType
}
template <typename ResultType, typename Function, typename... Args>
typename functionTraits<Function>::ResultType
functionResult_t<Function>
callWithMaybeFutureInterface(QFutureInterface<ResultType> &futureInterface,
Function &&function, Args&&... args)
{

View File

@@ -98,7 +98,7 @@ struct resultTypeWithArgument<Function, QFutureInterface<ResultType>&>
template <typename Function, typename Arg>
struct resultTypeWithArgument
{
using type = typename functionTraits<Function>::ResultType;
using type = functionResult_t<Function>;
};
template <typename Function, int index>
@@ -110,7 +110,7 @@ struct resultTypeTakesArguments<Function, index, true>
template <typename Function, int index>
struct resultTypeTakesArguments<Function, index, false>
{
using type = typename functionTraits<Function>::ResultType;
using type = functionResult_t<Function>;
};
template <typename Function>

View File

@@ -182,10 +182,8 @@ void Theme::readSettings(QSettings &settings)
}
{
settings.beginGroup(QLatin1String("Palette"));
foreach (const QString &key, settings.allKeys()) {
QColor c = readColor(settings.value(key).toString());
d->palette[key] = c;
}
foreach (const QString &key, settings.allKeys())
d->palette[key] = readNamedColor(settings.value(key).toString()).first;
settings.endGroup();
}
{

View File

@@ -617,17 +617,12 @@ TreeItem::~TreeItem()
removeChildren();
}
TreeItem *TreeItem::child(int pos) const
TreeItem *TreeItem::childAt(int pos) const
{
QTC_ASSERT(pos >= 0, return 0);
return pos < m_children.size() ? m_children.at(pos) : 0;
}
int TreeItem::rowCount() const
{
return m_children.size();
}
QVariant TreeItem::data(int column, int role) const
{
Q_UNUSED(column);
@@ -651,7 +646,7 @@ Qt::ItemFlags TreeItem::flags(int column) const
bool TreeItem::hasChildren() const
{
return canFetchMore() || rowCount() > 0;
return canFetchMore() || childCount() > 0;
}
bool TreeItem::canFetchMore() const
@@ -692,11 +687,11 @@ void TreeItem::insertChild(int pos, TreeItem *item)
void TreeItem::removeChildren()
{
if (rowCount() == 0)
if (childCount() == 0)
return;
if (m_model) {
QModelIndex idx = index();
m_model->beginRemoveRows(idx, 0, rowCount() - 1);
m_model->beginRemoveRows(idx, 0, childCount() - 1);
clear();
m_model->endRemoveRows();
} else {
@@ -707,7 +702,7 @@ void TreeItem::removeChildren()
void TreeItem::sortChildren(const std::function<bool(const TreeItem *, const TreeItem *)> &cmp)
{
if (m_model) {
if (const int n = rowCount()) {
if (const int n = childCount()) {
QVector<TreeItem *> tmp = m_children;
std::sort(tmp.begin(), tmp.end(), cmp);
if (tmp == m_children) {
@@ -850,8 +845,8 @@ QModelIndex TreeModel::parent(const QModelIndex &idx) const
if (!grandparent)
return QModelIndex();
for (int i = 0, n = grandparent->rowCount(); i < n; ++i)
if (grandparent->child(i) == parent)
for (int i = 0, n = grandparent->childCount(); i < n; ++i)
if (grandparent->childAt(i) == parent)
return createIndex(i, 0, (void*) parent);
return QModelIndex();
@@ -861,12 +856,12 @@ int TreeModel::rowCount(const QModelIndex &idx) const
{
CHECK_INDEX(idx);
if (!idx.isValid())
return m_root->rowCount();
return m_root->childCount();
if (idx.column() > 0)
return 0;
const TreeItem *item = itemForIndex(idx);
QTC_ASSERT(item, return 0);
return item->rowCount();
return item->childCount();
}
int TreeModel::columnCount(const QModelIndex &idx) const
@@ -985,9 +980,9 @@ QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) con
const TreeItem *item = itemForIndex(parent);
QTC_ASSERT(item, return QModelIndex());
if (row >= item->rowCount())
if (row >= item->childCount())
return QModelIndex();
return createIndex(row, column, (void*)(item->child(row)));
return createIndex(row, column, (void*)(item->childAt(row)));
}
TreeItem *TreeModel::itemForIndex(const QModelIndex &idx) const
@@ -1049,6 +1044,11 @@ TreeItem *TreeModel::takeItem(TreeItem *item)
return item;
}
void TreeModel::destroyItem(TreeItem *item)
{
delete takeItem(item);
}
StaticTreeItem::StaticTreeItem(const QStringList &displays)
: m_displays(displays)
{

View File

@@ -41,10 +41,6 @@ public:
TreeItem();
virtual ~TreeItem();
TreeItem *parent() const { return m_parent; }
virtual TreeItem *child(int pos) const;
virtual int rowCount() const;
virtual QVariant data(int column, int role) const;
virtual bool setData(int column, const QVariant &data, int role);
virtual Qt::ItemFlags flags(int column) const;
@@ -53,6 +49,8 @@ public:
virtual bool canFetchMore() const;
virtual void fetchMore() {}
TreeItem *parent() const { return m_parent; }
void prependChild(TreeItem *item);
void appendChild(TreeItem *item);
void insertChild(int pos, TreeItem *item);
@@ -67,7 +65,7 @@ public:
void setFlags(Qt::ItemFlags flags);
int childCount() const { return m_children.size(); }
TreeItem *childAt(int index) const { return m_children.at(index); }
TreeItem *childAt(int index) const;
QVector<TreeItem *> children() const { return m_children; }
QModelIndex index() const;
@@ -230,6 +228,7 @@ public:
void fetchMore(const QModelIndex &idx) override;
TreeItem *takeItem(TreeItem *item); // item is not destroyed.
void destroyItem(TreeItem *item); // item is destroyed.
signals:
void requestExpansion(QModelIndex);

View File

@@ -231,7 +231,10 @@ bool AndroidToolChain::isSecondaryToolChain() const
void AndroidToolChain::setSecondaryToolChain(bool b)
{
if (m_secondaryToolChain == b)
return;
m_secondaryToolChain = b;
toolChainUpdated();
}
GccToolChain::DetectedAbisResult AndroidToolChain::detectSupportedAbis() const

View File

@@ -1,10 +1,6 @@
<RCC>
<qresource prefix="/">
<file>images/autotest.png</file>
<file>images/expand.png</file>
<file>images/expand@2x.png</file>
<file>images/collapse.png</file>
<file>images/collapse@2x.png</file>
<file>images/sort.png</file>
<file>images/sort@2x.png</file>
<file>images/leafsort.png</file>

View File

@@ -30,10 +30,6 @@
namespace Autotest {
namespace Icons {
const Utils::Icon EXPAND({
{QLatin1String(":/images/expand.png"), Utils::Theme::IconsBaseColor}});
const Utils::Icon COLLAPSE({
{QLatin1String(":/images/collapse.png"), Utils::Theme::IconsBaseColor}});
const Utils::Icon SORT_ALPHABETICALLY({
{QLatin1String(":/images/sort.png"), Utils::Theme::IconsBaseColor}});
const Utils::Icon SORT_NATURALLY({

View File

@@ -202,30 +202,14 @@ static void performParse(QFutureInterface<TestParseResultPtr> &futureInterface,
/****** threaded parsing stuff *******/
void TestCodeParser::onCppDocumentUpdated(const CPlusPlus::Document::Ptr &document)
void TestCodeParser::onDocumentUpdated(const QString &fileName)
{
if (m_codeModelParsing) {
if (!m_fullUpdatePostponed) {
m_partialUpdatePostponed = true;
m_postponedFiles.insert(document->fileName());
}
return;
}
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
if (!project)
return;
const QString fileName = document->fileName();
if (!project->files(ProjectExplorer::Project::AllFiles).contains(fileName))
if (!project->files(ProjectExplorer::Project::SourceFiles).contains(fileName))
return;
qCDebug(LOG) << "calling scanForTests (onCppDocumentUpdated)";
scanForTests(QStringList(fileName));
}
void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document)
{
const QString &fileName = document->fileName();
if (m_codeModelParsing) {
if (!m_fullUpdatePostponed) {
m_partialUpdatePostponed = true;
@@ -234,22 +218,28 @@ void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document)
return;
}
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
if (!project)
return;
if (!project->files(ProjectExplorer::Project::AllFiles).contains(fileName)) {
// what if the file is not listed inside the pro file, but will be used anyway?
return;
}
scanForTests(QStringList(fileName));
}
void TestCodeParser::onCppDocumentUpdated(const CPlusPlus::Document::Ptr &document)
{
onDocumentUpdated(document->fileName());
}
void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document)
{
const QString fileName = document->fileName();
if (!fileName.endsWith(".qbs"))
onDocumentUpdated(fileName);
}
void TestCodeParser::onStartupProjectChanged(ProjectExplorer::Project *project)
{
if (m_parserState == FullParse || m_parserState == PartialParse)
if (m_parserState == FullParse || m_parserState == PartialParse) {
qCDebug(LOG) << "Canceling scanForTest (startup project changed)";
Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE);
else if (project)
}
if (project)
emitUpdateTestTree();
}
@@ -275,6 +265,7 @@ bool TestCodeParser::postponed(const QStringList &fileList)
m_partialUpdatePostponed = false;
m_postponedFiles.clear();
m_fullUpdatePostponed = true;
qCDebug(LOG) << "Canceling scanForTest (full parse triggered while running a scan)";
Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE);
} else {
// partial parse triggered, but full parse is postponed already, ignoring this
@@ -315,7 +306,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
bool isFullParse = fileList.isEmpty();
QStringList list;
if (isFullParse) {
list = ProjectExplorer::SessionManager::startupProject()->files(ProjectExplorer::Project::AllFiles);
list = ProjectExplorer::SessionManager::startupProject()->files(ProjectExplorer::Project::SourceFiles);
if (list.isEmpty())
return;
qCDebug(LOG) << "setting state to FullParse (scanForTests)";
@@ -352,8 +343,15 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
void TestCodeParser::onTaskStarted(Core::Id type)
{
if (type == CppTools::Constants::TASK_INDEX)
if (type == CppTools::Constants::TASK_INDEX) {
m_codeModelParsing = true;
if (m_parserState == FullParse || m_parserState == PartialParse) {
m_fullUpdatePostponed = m_parserState == FullParse;
m_partialUpdatePostponed = !m_fullUpdatePostponed;
qCDebug(LOG) << "Canceling scan for test (CppModelParsing started)";
Core::ProgressManager::instance()->cancelTasks(Constants::TASK_PARSE);
}
}
}
void TestCodeParser::onAllTasksFinished(Core::Id type)

View File

@@ -82,6 +82,7 @@ private:
bool postponed(const QStringList &fileList);
void scanForTests(const QStringList &fileList = QStringList());
void onDocumentUpdated(const QString &fileName);
void onTaskStarted(Core::Id type);
void onAllTasksFinished(Core::Id type);
void onFinished();

View File

@@ -172,6 +172,7 @@ void TestConfiguration::completeTestInformation(int runMode)
env = stdRunnable.environment;
hasDesktopTarget = true;
guessedRunConfiguration = true;
runConfigTarget = rc->target();
}
}
}
@@ -186,7 +187,7 @@ void TestConfiguration::completeTestInformation(int runMode)
setEnvironment(env);
setProject(project);
setGuessedConfiguration(guessedRunConfiguration);
if (!guessedRunConfiguration && runMode == TestRunner::Debug)
if (runMode == TestRunner::Debug)
m_runConfig = new TestRunConfiguration(runConfigTarget, this);
}
}

View File

@@ -202,11 +202,11 @@ QList<QToolButton *> TestNavigationWidget::createToolButtons()
m_sort->setToolTip(tr("Sort Naturally"));
QToolButton *expand = new QToolButton(this);
expand->setIcon(Icons::EXPAND.icon());
expand->setIcon(Core::Icons::EXPAND_TOOLBAR.icon());
expand->setToolTip(tr("Expand All"));
QToolButton *collapse = new QToolButton(this);
collapse->setIcon(Icons::COLLAPSE.icon());
collapse->setIcon(Core::Icons::COLLAPSE_TOOLBAR.icon());
collapse->setToolTip(tr("Collapse All"));
connect(expand, &QToolButton::clicked, m_view, &TestTreeView::expandAll);

View File

@@ -209,7 +209,7 @@ void TestResultModel::removeCurrentTestMessage()
for (int row = topLevelItems.size() - 1; row >= 0; --row) {
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(row));
if (current->testResult()->result() == Result::MessageCurrentTest) {
delete takeItem(current);
destroyItem(current);
break;
}
}

View File

@@ -146,7 +146,7 @@ TestResultsPane::TestResultsPane(QObject *parent) :
void TestResultsPane::createToolButtons()
{
m_expandCollapse = new QToolButton(m_treeView);
m_expandCollapse->setIcon(Core::Icons::EXPAND.icon());
m_expandCollapse->setIcon(Core::Icons::EXPAND_ALL_TOOLBAR.icon());
m_expandCollapse->setToolTip(tr("Expand All"));
m_expandCollapse->setCheckable(true);
m_expandCollapse->setChecked(false);
@@ -231,8 +231,7 @@ QWidget *TestResultsPane::outputWidget(QWidget *parent)
QList<QWidget *> TestResultsPane::toolBarWidgets() const
{
return QList<QWidget *>() << m_expandCollapse << m_runAll << m_runSelected << m_stopTestRun
<< m_filterButton;
return { m_expandCollapse, m_runAll, m_runSelected, m_stopTestRun, m_filterButton };
}
QString TestResultsPane::displayName() const
@@ -338,7 +337,7 @@ void TestResultsPane::goToNext()
if (!rootItem || !rootItem->childCount())
return;
nextCurrentIndex = m_filterModel->mapFromSource(m_model->indexForItem(rootItem->child(0)));
nextCurrentIndex = m_filterModel->mapFromSource(m_model->indexForItem(rootItem->childAt(0)));
}
m_treeView->setCurrentIndex(nextCurrentIndex);

View File

@@ -217,7 +217,7 @@ TestTreeItem *TestTreeItem::parentItem() const
TestTreeItem *TestTreeItem::childItem(int row) const
{
return static_cast<TestTreeItem *>(child(row));
return static_cast<TestTreeItem *>(childAt(row));
}
TestTreeItem *TestTreeItem::findChildByName(const QString &name)

View File

@@ -257,14 +257,14 @@ bool TestTreeModel::sweepChildren(TestTreeItem *item)
TestTreeItem *child = item->childItem(row);
if (child->parentItem()->type() != TestTreeItem::Root && child->markedForRemoval()) {
delete takeItem(child);
destroyItem(child);
hasChanged = true;
continue;
}
if (bool noEndNode = child->hasChildren()) {
hasChanged |= sweepChildren(child);
if (noEndNode && child->childCount() == 0) {
delete takeItem(child);
destroyItem(child);
hasChanged = true;
continue;
}

View File

@@ -184,7 +184,7 @@ void GdbServerProviderModel::markForRemoval(GdbServerProvider *provider)
{
GdbServerProviderNode *n = findNode(provider);
QTC_ASSERT(n, return);
delete takeItem(n);
destroyItem(n);
if (m_providersToAdd.contains(provider)) {
m_providersToAdd.removeOne(provider);
@@ -233,7 +233,7 @@ void GdbServerProviderModel::removeProvider(GdbServerProvider *provider)
{
m_providersToRemove.removeAll(provider);
if (GdbServerProviderNode *n = findNode(provider))
delete takeItem(n);
destroyItem(n);
emit providerStateChanged();
}

View File

@@ -108,10 +108,9 @@ void openEditorAt(const ClangBackEnd::SourceLocationContainer &location)
int(location.column() - 1));
}
void applyFixit(const ClangBackEnd::SourceLocationContainer &location,
const QVector<ClangBackEnd::FixItContainer> &fixits)
void applyFixit(const QVector<ClangBackEnd::FixItContainer> &fixits)
{
ClangCodeModel::ClangFixItOperation operation(location.filePath(), Utf8String(), fixits);
ClangCodeModel::ClangFixItOperation operation(Utf8String(), fixits);
operation.perform();
}
@@ -146,7 +145,7 @@ QWidget *createDiagnosticLabel(const ClangBackEnd::DiagnosticContainer &diagnost
label->setTextFormat(Qt::RichText);
QObject::connect(label, &QLabel::linkActivated, [location, fixits](const QString &action) {
if (action == QLatin1String(LINK_ACTION_APPLY_FIX))
applyFixit(location, fixits);
applyFixit(fixits);
else
openEditorAt(location);

View File

@@ -27,16 +27,21 @@
#include <texteditor/refactoringchanges.h>
#include <utils/qtcassert.h>
#include <QTextDocument>
namespace ClangCodeModel {
ClangFixItOperation::ClangFixItOperation(const Utf8String &filePath,
const Utf8String &fixItText,
const QVector<ClangBackEnd::FixItContainer> &fixItContainers)
: filePath(filePath),
fixItText(fixItText),
fixItContainers(fixItContainers)
using FileToFixits = QMap<QString, QVector<ClangBackEnd::FixItContainer>>;
using FileToFixitsIterator = QMapIterator<QString, QVector<ClangBackEnd::FixItContainer>>;
using RefactoringFilePtr = QSharedPointer<TextEditor::RefactoringFile>;
ClangFixItOperation::ClangFixItOperation(
const Utf8String &fixItText,
const QVector<ClangBackEnd::FixItContainer> &fixItContainers)
: fixItText(fixItText)
, fixItContainers(fixItContainers)
{
}
@@ -50,20 +55,56 @@ QString ClangCodeModel::ClangFixItOperation::description() const
return QStringLiteral("Apply Fix: ") + fixItText.toString();
}
static FileToFixits fixitsPerFile(const QVector<ClangBackEnd::FixItContainer> &fixItContainers)
{
FileToFixits mapping;
for (const auto &fixItContainer : fixItContainers) {
const QString rangeStartFilePath = fixItContainer.range().start().filePath().toString();
const QString rangeEndFilePath = fixItContainer.range().end().filePath().toString();
QTC_CHECK(rangeStartFilePath == rangeEndFilePath);
mapping[rangeStartFilePath].append(fixItContainer);
}
return mapping;
}
void ClangFixItOperation::perform()
{
const TextEditor::RefactoringChanges refactoringChanges;
refactoringFile = refactoringChanges.file(filePath.toString());
refactoringFile->setChangeSet(changeSet());
refactoringFile->apply();
const FileToFixits fileToFixIts = fixitsPerFile(fixItContainers);
FileToFixitsIterator i(fileToFixIts);
while (i.hasNext()) {
i.next();
const QString filePath = i.key();
const QVector<ClangBackEnd::FixItContainer> fixits = i.value();
RefactoringFilePtr refactoringFile = refactoringChanges.file(filePath);
refactoringFiles.append(refactoringFile);
applyFixitsToFile(*refactoringFile, fixits);
}
}
QString ClangFixItOperation::refactoringFileContent_forTestOnly() const
QString ClangFixItOperation::firstRefactoringFileContent_forTestOnly() const
{
return refactoringFile->document()->toPlainText();
return refactoringFiles.first()->document()->toPlainText();
}
Utils::ChangeSet ClangFixItOperation::changeSet() const
void ClangFixItOperation::applyFixitsToFile(
TextEditor::RefactoringFile &refactoringFile,
const QVector<ClangBackEnd::FixItContainer> fixItContainers)
{
const Utils::ChangeSet changeSet = toChangeSet(refactoringFile, fixItContainers);
refactoringFile.setChangeSet(changeSet);
refactoringFile.apply();
}
Utils::ChangeSet ClangFixItOperation::toChangeSet(
TextEditor::RefactoringFile &refactoringFile,
const QVector<ClangBackEnd::FixItContainer> fixItContainers) const
{
Utils::ChangeSet changeSet;
@@ -71,8 +112,8 @@ Utils::ChangeSet ClangFixItOperation::changeSet() const
const auto range = fixItContainer.range();
const auto start = range.start();
const auto end = range.end();
changeSet.replace(refactoringFile->position(start.line(), start.column()),
refactoringFile->position(end.line(), end.column()),
changeSet.replace(refactoringFile.position(start.line(), start.column()),
refactoringFile.position(end.line(), end.column()),
fixItContainer.text());
}

View File

@@ -36,6 +36,7 @@
namespace TextEditor
{
class RefactoringChanges;
class RefactoringFile;
}
@@ -44,23 +45,25 @@ namespace ClangCodeModel {
class ClangFixItOperation : public TextEditor::QuickFixOperation
{
public:
ClangFixItOperation(const Utf8String &filePath,
const Utf8String &fixItText,
ClangFixItOperation(const Utf8String &fixItText,
const QVector<ClangBackEnd::FixItContainer> &fixItContainers);
int priority() const override;
QString description() const override;
void perform() override;
QString refactoringFileContent_forTestOnly() const;
QString firstRefactoringFileContent_forTestOnly() const;
private:
Utils::ChangeSet changeSet() const;
void applyFixitsToFile(TextEditor::RefactoringFile &refactoringFile,
const QVector<ClangBackEnd::FixItContainer> fixItContainers);
Utils::ChangeSet toChangeSet(
TextEditor::RefactoringFile &refactoringFile,
const QVector<ClangBackEnd::FixItContainer> fixItContainers) const;
private:
Utf8String filePath;
Utf8String fixItText;
QSharedPointer<TextEditor::RefactoringFile> refactoringFile;
QVector<QSharedPointer<TextEditor::RefactoringFile>> refactoringFiles;
QVector<ClangBackEnd::FixItContainer> fixItContainers;
};

View File

@@ -109,16 +109,13 @@ ClangFixItOperationsExtractor::extract(const QString &filePath, int line)
}
void ClangFixItOperationsExtractor::appendFixitOperation(
const QString &filePath,
const QString &diagnosticText,
const QVector<ClangBackEnd::FixItContainer> &fixits)
{
if (!fixits.isEmpty()) {
const QString diagnosticTextTweaked = tweakedDiagnosticText(diagnosticText);
TextEditor::QuickFixOperation::Ptr operation(
new ClangFixItOperation(filePath,
diagnosticTextTweaked,
fixits));
new ClangFixItOperation(diagnosticTextTweaked, fixits));
operations.append(operation);
}
}
@@ -130,7 +127,7 @@ void ClangFixItOperationsExtractor::extractFromDiagnostic(
{
const QVector<ClangBackEnd::FixItContainer> fixIts = diagnosticContainer.fixIts();
if (hasFixItAt(fixIts, filePath, line)) {
appendFixitOperation(filePath, diagnosticContainer.text().toString(), fixIts);
appendFixitOperation(diagnosticContainer.text().toString(), fixIts);
foreach (const auto &child, diagnosticContainer.children())
extractFromDiagnostic(child, filePath, line);

View File

@@ -42,8 +42,7 @@ private:
void extractFromDiagnostic(const ClangBackEnd::DiagnosticContainer &diagnosticContainer,
const QString &filePath,
int line);
void appendFixitOperation(const QString &filePath,
const QString &diagnosticText,
void appendFixitOperation(const QString &diagnosticText,
const QVector<ClangBackEnd::FixItContainer> &fixits);
private:

View File

@@ -273,7 +273,7 @@ QVariant ExplainingStepItem::data(int column, int role) const
return QVariant::fromValue(static_cast<DiagnosticItem *>(parent())->diagnostic());
case Qt::DisplayRole: {
const int row = parent()->children().indexOf(const_cast<ExplainingStepItem *>(this)) + 1;
const int padding = static_cast<int>(std::log10(parent()->rowCount()))
const int padding = static_cast<int>(std::log10(parent()->childCount()))
- static_cast<int>(std::log10(row));
return QString::fromLatin1("%1%2: %3")
.arg(QString(padding, QLatin1Char(' ')))

View File

@@ -183,7 +183,10 @@ public:
|| type == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID)
optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n");
optionsBuilder.addToolchainAndProjectDefines();
if (type != ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID)
optionsBuilder.addDefines(projectPart.toolchainDefines);
optionsBuilder.addDefines(projectPart.projectDefines);
optionsBuilder.undefineClangVersionMacrosForMsvc();
optionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015();
optionsBuilder.addHeaderPathOptions();
optionsBuilder.addMsvcCompatibilityVersion();
@@ -203,6 +206,23 @@ public:
{
}
public:
void undefineClangVersionMacrosForMsvc()
{
if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) {
static QStringList macroNames {
"__clang__",
"__clang_major__",
"__clang_minor__",
"__clang_patchlevel__",
"__clang_version__"
};
foreach (const QString &macroName, macroNames)
add(QLatin1String("/U") + macroName);
}
}
private:
void addTargetTriple() override
{
@@ -272,6 +292,14 @@ static QStringList createOptionsToUndefineCppLanguageFeatureMacrosForMsvc2015(
return optionsBuilder.options();
}
static QStringList createOptionsToUndefineClangVersionMacrosForMsvc(const ProjectPart &projectPart)
{
ClangStaticAnalyzerOptionsBuilder optionsBuilder(projectPart);
optionsBuilder.undefineClangVersionMacrosForMsvc();
return optionsBuilder.options();
}
static QStringList tweakedArguments(const ProjectPart &projectPart,
const QString &filePath,
const QStringList &arguments,
@@ -281,6 +309,7 @@ static QStringList tweakedArguments(const ProjectPart &projectPart,
prependWordWidthArgumentIfNotIncluded(&newArguments, extraParams.wordWidth);
prependTargetTripleIfNotIncludedAndNotEmpty(&newArguments, extraParams.targetTriple);
newArguments.append(createMsCompatibilityVersionOption(projectPart));
newArguments.append(createOptionsToUndefineClangVersionMacrosForMsvc(projectPart));
newArguments.append(createOptionsToUndefineCppLanguageFeatureMacrosForMsvc2015(projectPart));
return newArguments;
@@ -564,7 +593,8 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess(const QString &l
void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &errorMessage,
const QString &errorDetails)
{
qCDebug(LOG) << "onRunnerFinishedWithFailure:" << errorMessage << errorDetails;
qCDebug(LOG).noquote() << "onRunnerFinishedWithFailure:"
<< errorMessage << '\n' << errorDetails;
++m_filesNotAnalyzed;
m_success = false;

View File

@@ -27,6 +27,7 @@
#include "clangstaticanalyzerconstants.h"
#include <utils/qtcprocess.h>
#include <utils/synchronousprocess.h>
#include <QDebug>
@@ -111,9 +112,9 @@ bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList &
QTC_ASSERT(!m_logFile.isEmpty(), return false);
const QStringList arguments = constructCommandLineArguments(filePath, m_logFile,
compilerOptions);
m_commandLine = (QStringList(m_clangExecutable) + arguments).join(QLatin1String("\" \""));
m_commandLine = Utils::QtcProcess::joinArgs(QStringList(m_clangExecutable) + arguments);
qCDebug(LOG) << "Starting" << m_commandLine;
qCDebug(LOG).noquote() << "Starting" << m_commandLine;
m_process.start(m_clangExecutable, arguments);
return true;
}
@@ -171,12 +172,13 @@ QString ClangStaticAnalyzerRunner::createLogFile(const QString &filePath) const
QString ClangStaticAnalyzerRunner::processCommandlineAndOutput() const
{
return tr("Command line: \"%1\"\n"
return tr("Command line: %1\n"
"Process Error: %2\n"
"Output:\n%3")
.arg(m_commandLine,
QString::number(m_process.error()),
QString::fromLocal8Bit(m_processOutput));
Utils::SynchronousProcess::normalizeNewlines(
QString::fromLocal8Bit(m_processOutput)));
}
QString ClangStaticAnalyzerRunner::actualLogFile() const

View File

@@ -16,7 +16,9 @@
#include <climits>
#include <clocale>
#include <cmath>
#include <codecvt>
#if !defined(__GNUC__) || __GNUC__ >= 5
# include <codecvt>
#endif
#include <complex>
#include <condition_variable>
#include <csetjmp>

View File

@@ -189,12 +189,12 @@ void CMakeToolItemModel::addCMakeTool(const CMakeTool *item, bool changed)
TreeItem *CMakeToolItemModel::autoGroupItem() const
{
return rootItem()->child(0);
return rootItem()->childAt(0);
}
TreeItem *CMakeToolItemModel::manualGroupItem() const
{
return rootItem()->child(1);
return rootItem()->childAt(1);
}
void CMakeToolItemModel::reevaluateChangedFlag(CMakeToolTreeItem *item) const
@@ -242,7 +242,7 @@ void CMakeToolItemModel::removeCMakeTool(const Core::Id &id)
CMakeToolTreeItem *treeItem = cmakeToolItem(id);
QTC_ASSERT(treeItem, return);
delete takeItem(treeItem);
destroyItem(treeItem);
m_removedItems.append(id);
}

View File

@@ -108,5 +108,9 @@
<file>images/desktopdevicesmall.png</file>
<file>images/desktopdevicesmall@2x.png</file>
<file>images/reset@2x.png</file>
<file>images/collapse.png</file>
<file>images/collapse@2x.png</file>
<file>images/expand.png</file>
<file>images/expand@2x.png</file>
</qresource>
</RCC>

View File

@@ -130,7 +130,7 @@ const Icon INFO({
{QLatin1String(":/core/images/info.png"), Theme::IconsInfoColor}}, Icon::Tint);
const Icon INFO_TOOLBAR({
{QLatin1String(":/core/images/info.png"), Theme::IconsInfoToolBarColor}});
const Icon EXPAND({
const Icon EXPAND_ALL_TOOLBAR({
{QLatin1String(":/find/images/expand.png"), Theme::IconsBaseColor}});
const Icon TOOLBAR_EXTENSION({
{QLatin1String(":/core/images/extension.png"), Theme::IconsBaseColor}});
@@ -155,6 +155,14 @@ const Icon EYE_CLOSED_TOOLBAR({
const Icon REPLACE({
{QLatin1String(":/core/images/replace_a.png"), Theme::PanelTextColorMid},
{QLatin1String(":/core/images/replace_b.png"), Theme::IconsInfoColor}}, Icon::Tint);
const Icon EXPAND({
{QLatin1String(":/core/images/expand.png"), Theme::PanelTextColorMid}}, Utils::Icon::Tint);
const Icon EXPAND_TOOLBAR({
{QLatin1String(":/core/images/expand.png"), Theme::IconsBaseColor}});
const Icon COLLAPSE({
{QLatin1String(":/core/images/collapse.png"), Theme::PanelTextColorMid}}, Utils::Icon::Tint);
const Icon COLLAPSE_TOOLBAR({
{QLatin1String(":/core/images/collapse.png"), Theme::IconsBaseColor}});
const Icon MODE_EDIT_CLASSIC(
QLatin1String(":/fancyactionbar/images/mode_Edit.png"));

View File

@@ -81,7 +81,7 @@ CORE_EXPORT extern const Utils::Icon ERROR_TOOLBAR;
CORE_EXPORT extern const Utils::Icon ERROR_TASKBAR;
CORE_EXPORT extern const Utils::Icon INFO;
CORE_EXPORT extern const Utils::Icon INFO_TOOLBAR;
CORE_EXPORT extern const Utils::Icon EXPAND;
CORE_EXPORT extern const Utils::Icon EXPAND_ALL_TOOLBAR;
CORE_EXPORT extern const Utils::Icon TOOLBAR_EXTENSION;
CORE_EXPORT extern const Utils::Icon RUN_SMALL;
CORE_EXPORT extern const Utils::Icon RUN_SMALL_TOOLBAR;
@@ -93,6 +93,10 @@ CORE_EXPORT extern const Utils::Icon BOUNDING_RECT;
CORE_EXPORT extern const Utils::Icon EYE_OPEN_TOOLBAR;
CORE_EXPORT extern const Utils::Icon EYE_CLOSED_TOOLBAR;
CORE_EXPORT extern const Utils::Icon REPLACE;
CORE_EXPORT extern const Utils::Icon EXPAND;
CORE_EXPORT extern const Utils::Icon EXPAND_TOOLBAR;
CORE_EXPORT extern const Utils::Icon COLLAPSE;
CORE_EXPORT extern const Utils::Icon COLLAPSE_TOOLBAR;
CORE_EXPORT extern const Utils::Icon MODE_EDIT_CLASSIC;
CORE_EXPORT extern const Utils::Icon MODE_EDIT_FLAT;

View File

@@ -26,6 +26,7 @@
#include "addtovcsdialog.h"
#include "ui_addtovcsdialog.h"
#include <QDir>
#include <QListWidgetItem>
namespace Core {
@@ -45,7 +46,7 @@ AddToVcsDialog::AddToVcsDialog(QWidget *parent, const QString &title,
setWindowTitle(title);
foreach (const QString &file, files) {
QListWidgetItem *item = new QListWidgetItem(file);
QListWidgetItem *item = new QListWidgetItem(QDir::toNativeSeparators(file));
ui->filesListWidget->addItem(item);
}
}

View File

@@ -136,7 +136,7 @@ namespace Internal {
m_expandCollapseButton->setAutoRaise(true);
m_expandCollapseAction->setCheckable(true);
m_expandCollapseAction->setIcon(Core::Icons::EXPAND.icon());
m_expandCollapseAction->setIcon(Core::Icons::EXPAND_ALL_TOOLBAR.icon());
Command *cmd = ActionManager::registerAction(m_expandCollapseAction, "Find.ExpandAll");
cmd->setAttribute(Command::CA_UpdateText);
m_expandCollapseButton->setDefaultAction(cmd->action());
@@ -340,8 +340,8 @@ QWidget *SearchResultWindow::outputWidget(QWidget *)
*/
QList<QWidget*> SearchResultWindow::toolBarWidgets() const
{
return QList<QWidget*>() << d->m_expandCollapseButton << d->m_spacer
<< d->m_historyLabel << d->m_spacer2 << d->m_recentSearchesBox;
return { d->m_expandCollapseButton, d->m_spacer,
d->m_historyLabel, d->m_spacer2, d->m_recentSearchesBox };
}
/*!

View File

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View File

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

View File

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 174 B

View File

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

View File

@@ -359,7 +359,7 @@ void LocatorSettingsPage::removeCustomFilter()
QTC_ASSERT(item, return);
ILocatorFilter *filter = item->filter();
QTC_ASSERT(m_customFilters.contains(filter), return);
delete m_model->takeItem(item);
m_model->destroyItem(item);
m_filters.removeAll(filter);
m_customFilters.removeAll(filter);
m_refreshFilters.removeAll(filter);

View File

@@ -137,10 +137,15 @@ void CompilerOptionsBuilder::addHeaderPathOptions(bool addAsNativePath)
void CompilerOptionsBuilder::addToolchainAndProjectDefines()
{
QByteArray extendedDefines = m_projectPart.toolchainDefines + m_projectPart.projectDefines;
addDefines(m_projectPart.toolchainDefines);
addDefines(m_projectPart.projectDefines);
}
void CompilerOptionsBuilder::addDefines(const QByteArray &defineDirectives)
{
QStringList result;
foreach (QByteArray def, extendedDefines.split('\n')) {
foreach (QByteArray def, defineDirectives.split('\n')) {
if (def.isEmpty() || excludeDefineLine(def))
continue;

View File

@@ -48,6 +48,7 @@ public:
virtual void enableExceptions();
void addHeaderPathOptions(bool addAsNativePath = false);
void addToolchainAndProjectDefines();
void addDefines(const QByteArray &defineDirectives);
virtual void addLanguageOption(ProjectFile::Kind fileKind);
virtual void addOptionsForLanguage(bool checkForBorlandExtensions = true);

View File

@@ -348,7 +348,7 @@ void BreakHandler::deletionHelper(BreakpointModelId id)
{
Breakpoint b = breakpointById(id);
QTC_ASSERT(b, return);
delete takeItem(b.b);
destroyItem(b.b);
}
Breakpoint BreakHandler::findWatchpoint(const BreakpointParameters &params) const
@@ -1169,7 +1169,7 @@ void BreakHandler::changeLineNumberFromMarkerHelper(BreakpointModelId id)
Breakpoint b = breakpointById(id);
QTC_ASSERT(b, return);
BreakpointParameters params = b.parameters();
delete takeItem(b.b);
destroyItem(b.b);
appendBreakpoint(params);
}

View File

@@ -69,8 +69,8 @@ ConsoleItemDelegate::ConsoleItemDelegate(ConsoleItemModel *model, QObject *paren
m_logIcon(Core::Icons::INFO.icon()),
m_warningIcon(Core::Icons::WARNING.icon()),
m_errorIcon(Core::Icons::ERROR.icon()),
m_expandIcon(QLatin1String(":/qmljstools/images/expand.png")),
m_collapseIcon(QLatin1String(":/qmljstools/images/collapse.png")),
m_expandIcon(Core::Icons::EXPAND.icon()),
m_collapseIcon(Core::Icons::COLLAPSE.icon()),
m_prompt(QLatin1String(":/qmljstools/images/prompt.png")),
m_cachedHeight(0)
{

View File

@@ -80,7 +80,7 @@ int ConsoleItemModel::sizeOfFile(const QFont &font)
lastReadOnlyRow -= 2; // skip editable row
if (lastReadOnlyRow < 0)
return 0;
QString filename = static_cast<ConsoleItem *>(rootItem()->child(lastReadOnlyRow))->file();
QString filename = static_cast<ConsoleItem *>(rootItem()->childAt(lastReadOnlyRow))->file();
const int pos = filename.lastIndexOf(QLatin1Char('/'));
if (pos != -1)
filename = filename.mid(pos + 1);

View File

@@ -169,7 +169,7 @@ void DebuggerItemModel::removeCurrentDebugger()
QVariant id = m_currentTreeItem->m_item.id();
DebuggerTreeItem *treeItem = m_currentTreeItem;
m_currentTreeItem = 0;
delete takeItem(treeItem);
destroyItem(treeItem);
m_removedItems.append(id);
}

View File

@@ -157,8 +157,8 @@ QVariant ModuleItem::data(int column, int role) const
static ModuleItem *moduleFromPath(TreeItem *root, const QString &modulePath)
{
// Recent modules are more likely to be unloaded first.
for (int i = root->rowCount(); --i >= 0; ) {
auto item = static_cast<ModuleItem *>(root->child(i));
for (int i = root->childCount(); --i >= 0; ) {
auto item = static_cast<ModuleItem *>(root->childAt(i));
if (item->module.modulePath == modulePath)
return item;
}
@@ -199,15 +199,15 @@ Modules ModulesHandler::modules() const
{
Modules mods;
TreeItem *root = m_model->rootItem();
for (int i = root->rowCount(); --i >= 0; )
mods.append(static_cast<ModuleItem *>(root->child(i))->module);
for (int i = root->childCount(); --i >= 0; )
mods.append(static_cast<ModuleItem *>(root->childAt(i))->module);
return mods;
}
void ModulesHandler::removeModule(const QString &modulePath)
{
if (ModuleItem *item = moduleFromPath(m_model->rootItem(), modulePath))
delete m_model->takeItem(item);
m_model->destroyItem(item);
}
void ModulesHandler::updateModule(const Module &module)
@@ -239,17 +239,17 @@ void ModulesHandler::updateModule(const Module &module)
void ModulesHandler::beginUpdateAll()
{
TreeItem *root = m_model->rootItem();
for (int i = root->rowCount(); --i >= 0; )
static_cast<ModuleItem *>(root->child(i))->updated = false;
for (int i = root->childCount(); --i >= 0; )
static_cast<ModuleItem *>(root->childAt(i))->updated = false;
}
void ModulesHandler::endUpdateAll()
{
TreeItem *root = m_model->rootItem();
for (int i = root->rowCount(); --i >= 0; ) {
auto item = static_cast<ModuleItem *>(root->child(i));
for (int i = root->childCount(); --i >= 0; ) {
auto item = static_cast<ModuleItem *>(root->childAt(i));
if (!item->updated)
delete m_model->takeItem(item);
m_model->destroyItem(item);
}
}

View File

@@ -320,7 +320,7 @@ void ThreadsHandler::updateThread(const ThreadData &threadData)
void ThreadsHandler::removeThread(ThreadId threadId)
{
if (ThreadItem *item = itemForThreadId(this, threadId))
delete takeItem(item);
destroyItem(item);
}
void ThreadsHandler::setThreads(const Threads &threads)
@@ -363,7 +363,7 @@ bool ThreadsHandler::notifyGroupExited(const QString &groupId)
list.append(item);
});
foreach (ThreadItem *item, list)
delete takeItem(item);
destroyItem(item);
m_pidForGroupId.remove(groupId);
return m_pidForGroupId.isEmpty();

View File

@@ -1162,7 +1162,7 @@ bool WatchModel::hasChildren(const QModelIndex &idx) const
const WatchItem *item = nonRootItemForIndex(idx);
if (!item)
return true;
if (item->rowCount() > 0)
if (item->childCount() > 0)
return true;
// "Can fetch more", see above.
@@ -1289,7 +1289,7 @@ bool WatchHandler::insertItem(WatchItem *item)
const QVector<TreeItem *> siblings = parent->children();
for (int row = 0, n = siblings.size(); row < n; ++row) {
if (static_cast<WatchItem *>(siblings.at(row))->iname == item->iname) {
delete m_model->takeItem(parent->children().at(row));
m_model->destroyItem(parent->children().at(row));
parent->insertChild(row, item);
found = true;
break;
@@ -1377,7 +1377,7 @@ void WatchHandler::notifyUpdateFinished()
});
foreach (auto item, toRemove)
delete m_model->takeItem(item);
m_model->destroyItem(item);
m_model->m_contentsValid = true;
updateWatchersWindow();
@@ -1400,7 +1400,7 @@ void WatchHandler::removeItemByIName(const QString &iname)
theWatcherNames.remove(item->exp);
saveWatchers();
}
delete m_model->takeItem(item);
m_model->destroyItem(item);
updateWatchersWindow();
}

File diff suppressed because it is too large Load Diff

View File

@@ -126,7 +126,7 @@ public:
explicit GitClient();
Utils::FileName vcsBinary() const override;
unsigned gitVersion(QString *errorMessage = 0) const;
unsigned gitVersion(QString *errorMessage = nullptr) const;
VcsBase::VcsCommand *vcsExecAbortable(const QString &workingDirectory, const QStringList &arguments);
@@ -154,10 +154,8 @@ public:
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
void reset(const QString &workingDirectory, const QString &argument, const QString &commit = QString());
void addFile(const QString &workingDirectory, const QString &fileName);
bool synchronousLog(const QString &workingDirectory,
const QStringList &arguments,
QString *output,
QString *errorMessage = 0,
bool synchronousLog(const QString &workingDirectory, const QStringList &arguments,
QString *output, QString *errorMessage = nullptr,
unsigned flags = 0);
bool synchronousAdd(const QString &workingDirectory, const QStringList &files);
bool synchronousDelete(const QString &workingDirectory,
@@ -166,20 +164,20 @@ public:
bool synchronousMove(const QString &workingDirectory,
const QString &from,
const QString &to);
bool synchronousReset(const QString &workingDirectory,
const QStringList &files = QStringList(),
QString *errorMessage = 0);
bool synchronousCleanList(const QString &workingDirectory, const QString &modulePath, QStringList *files, QStringList *ignoredFiles, QString *errorMessage);
bool synchronousApplyPatch(const QString &workingDirectory, const QString &file, QString *errorMessage, const QStringList &arguments = QStringList());
bool synchronousReset(const QString &workingDirectory, const QStringList &files = QStringList(),
QString *errorMessage = nullptr);
bool synchronousCleanList(const QString &workingDirectory, const QString &modulePath,
QStringList *files, QStringList *ignoredFiles, QString *errorMessage);
bool synchronousApplyPatch(const QString &workingDirectory, const QString &file,
QString *errorMessage, const QStringList &extraArguments = QStringList());
bool synchronousInit(const QString &workingDirectory);
bool synchronousCheckoutFiles(const QString &workingDirectory,
QStringList files = QStringList(),
QString revision = QString(), QString *errorMessage = 0,
bool synchronousCheckoutFiles(const QString &workingDirectory, QStringList files = QStringList(),
QString revision = QString(), QString *errorMessage = nullptr,
bool revertStaging = true);
// Checkout ref
bool stashAndCheckout(const QString &workingDirectory, const QString &ref);
bool synchronousCheckout(const QString &workingDirectory, const QString &ref,
QString *errorMessage = 0);
QString *errorMessage = nullptr);
QStringList setupCheckoutArguments(const QString &workingDirectory, const QString &ref);
void updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt);
@@ -188,39 +186,40 @@ public:
enum { StashPromptDescription = 0x1, StashImmediateRestore = 0x2, StashIgnoreUnchanged = 0x4 };
QString synchronousStash(const QString &workingDirectory,
const QString &messageKeyword = QString(),
unsigned flags = 0, bool *unchanged = 0) const;
unsigned flags = 0, bool *unchanged = nullptr) const;
bool executeSynchronousStash(const QString &workingDirectory,
const QString &message = QString(),
bool unstagedOnly = false,
QString *errorMessage = 0) const;
QString *errorMessage = nullptr) const;
bool synchronousStashRestore(const QString &workingDirectory,
const QString &stash,
bool pop = false,
const QString &branch = QString()) const;
bool synchronousStashRemove(const QString &workingDirectory,
const QString &stash = QString(),
QString *errorMessage = 0) const;
QString *errorMessage = nullptr) const;
bool synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
QString *output, QString *errorMessage) const;
bool synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs,
QString *output, QString *errorMessage) const;
bool synchronousForEachRefCmd(const QString &workingDirectory, QStringList args,
QString *output, QString *errorMessage = 0) const;
QString *output, QString *errorMessage = nullptr) const;
VcsBase::VcsCommand *asyncForEachRefCmd(const QString &workingDirectory, QStringList args) const;
bool synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs,
QString *output = 0, QString *errorMessage = 0, bool silent = false) const;
QString *output = nullptr, QString *errorMessage = nullptr,
bool silent = false) const;
QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory,
QString *errorMessage = 0) const;
QString *errorMessage = nullptr) const;
QStringList synchronousSubmoduleStatus(const QString &workingDirectory,
QString *errorMessage = 0) const;
QString *errorMessage = nullptr) const;
SubmoduleDataMap submoduleList(const QString &workingDirectory) const;
bool synchronousShow(const QString &workingDirectory, const QString &id,
QByteArray *output, QString *errorMessage) const;
bool synchronousRevListCmd(const QString &workingDirectory, const QStringList &arguments,
QString *output, QString *errorMessage = 0) const;
bool synchronousRevListCmd(const QString &workingDirectory, const QStringList &extraArguments,
QString *output, QString *errorMessage = nullptr) const;
bool synchronousParentRevisions(const QString &workingDirectory,
const QString &revision,
@@ -233,11 +232,11 @@ public:
QString synchronousCurrentLocalBranch(const QString &workingDirectory) const;
bool synchronousHeadRefs(const QString &workingDirectory, QStringList *output,
QString *errorMessage = 0) const;
QString *errorMessage = nullptr) const;
QString synchronousTopic(const QString &workingDirectory) const;
bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
QString *output, QString *errorMessage = 0) const;
QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = 0);
QString *output, QString *errorMessage = nullptr) const;
QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = nullptr);
void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QString &precedes, QString &follows) const;
bool isRemoteCommit(const QString &workingDirectory, const QString &commit);
@@ -270,21 +269,19 @@ public:
void stashPop(const QString &workingDirectory, const QString &stash = QString());
void revert(const QStringList &files, bool revertStaging);
bool synchronousStashList(const QString &workingDirectory,
QList<Stash> *stashes,
QString *errorMessage = 0) const;
bool synchronousStashList(const QString &workingDirectory, QList<Stash> *stashes,
QString *errorMessage = nullptr) const;
// Resolve a stash name from message (for IVersionControl's names).
bool stashNameFromMessage(const QString &workingDirectory,
const QString &messge, QString *name,
QString *errorMessage = 0) const;
bool stashNameFromMessage(const QString &workingDirectory, const QString &messge, QString *name,
QString *errorMessage = nullptr) const;
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;
bool readDataFromCommit(const QString &repoDirectory, const QString &commit,
CommitData &commitData, QString *errorMessage = 0,
QString *commitTemplate = 0);
CommitData &commitData, QString *errorMessage = nullptr,
QString *commitTemplate = nullptr);
bool getCommitData(const QString &workingDirectory, QString *commitTemplate,
CommitData &commitData, QString *errorMessage);
@@ -296,10 +293,8 @@ public:
VcsBase::SubmitFileModel *model);
enum StatusResult { StatusChanged, StatusUnchanged, StatusFailed };
StatusResult gitStatus(const QString &workingDirectory,
StatusMode mode,
QString *output = 0,
QString *errorMessage = 0) const;
StatusResult gitStatus(const QString &workingDirectory, StatusMode mode,
QString *output = nullptr, QString *errorMessage = nullptr) const;
CommandInProgress checkCommandInProgress(const QString &workingDirectory) const;
QString commandInProgressDescription(const QString &workingDirectory) const;
@@ -350,7 +345,7 @@ private:
std::function<DiffEditor::DiffEditorController *(Core::IDocument *)> factory) const;
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
unsigned synchronousGitVersion(QString *errorMessage = 0) const;
unsigned synchronousGitVersion(QString *errorMessage = nullptr) const;
QString readOneLine(const QString &workingDirectory, const QStringList &arguments) const;

View File

@@ -199,10 +199,10 @@ void ActionHandler::createActions()
Constants::OPEN_PARENT_DIAGRAM, [this]() { openParentDiagram(); }, Core::Context(), true,
tr("Open Parent Diagram"), QKeySequence(QStringLiteral("Ctrl+Shift+P")))->action();
d->openParentDiagramAction->setIcon(QIcon(QStringLiteral(":/modeleditor/up.png")));
registerCommand(Constants::ACTION_ADD_PACKAGE, nullptr, Core::Context());
registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr, Core::Context());
registerCommand(Constants::ACTION_ADD_CLASS, nullptr, Core::Context());
registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context());
registerCommand(Constants::ACTION_ADD_PACKAGE, nullptr, Core::Context(), true, tr("Add Package"));
registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr, Core::Context(), true, tr("Add Component"));
registerCommand(Constants::ACTION_ADD_CLASS, nullptr, Core::Context(), true, tr("Add Class"));
registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context(), true, tr("Add Canvas Diagram"));
d->synchronizeBrowserAction = registerCommand(
Constants::ACTION_SYNC_BROWSER, nullptr, Core::Context(), true,
tr("Synchronize Browser and Diagram<br><i><small>Press&Hold for options</small></i>"))->action();

View File

@@ -321,8 +321,7 @@ QWidget *AppOutputPane::outputWidget(QWidget *)
QList<QWidget*> AppOutputPane::toolBarWidgets() const
{
return QList<QWidget*>() << m_reRunButton << m_stopButton << m_attachButton
<< m_zoomInButton << m_zoomOutButton;
return { m_reRunButton, m_stopButton, m_attachButton, m_zoomInButton, m_zoomOutButton };
}
QString AppOutputPane::displayName() const

View File

@@ -244,9 +244,7 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *)
QList<QWidget *> CompileOutputWindow::toolBarWidgets() const
{
return QList<QWidget *>() << m_cancelBuildButton
<< m_zoomInButton
<< m_zoomOutButton;
return { m_cancelBuildButton, m_zoomInButton, m_zoomOutButton };
}
void CompileOutputWindow::appendText(const QString &text, BuildStep::OutputFormat format)

View File

@@ -164,7 +164,10 @@ const QStringList &CustomToolChain::rawPredefinedMacros() const
void CustomToolChain::setPredefinedMacros(const QStringList &list)
{
if (m_predefinedMacros == list)
return;
m_predefinedMacros = list;
toolChainUpdated();
}
QList<HeaderPath> CustomToolChain::systemHeaderPaths(const QStringList &cxxFlags, const FileName &) const
@@ -215,9 +218,14 @@ QStringList CustomToolChain::headerPathsList() const
void CustomToolChain::setHeaderPaths(const QStringList &list)
{
m_systemHeaderPaths = Utils::transform(list, [](const QString &headerPath) {
QList<HeaderPath> tmp = Utils::transform(list, [](const QString &headerPath) {
return HeaderPath(headerPath.trimmed(), HeaderPath::GlobalHeaderPath);
});
if (m_systemHeaderPaths == tmp)
return;
m_systemHeaderPaths = tmp;
toolChainUpdated();
}
void CustomToolChain::setCompilerCommand(const FileName &path)
@@ -261,8 +269,14 @@ const QStringList &CustomToolChain::cxx11Flags() const
void CustomToolChain::setMkspecs(const QString &specs)
{
m_mkspecs = Utils::transform(specs.split(QLatin1Char(',')),
[](QString fn) { return FileName::fromString(fn); });
Utils::FileNameList tmp
= Utils::transform(specs.split(QLatin1Char(',')),
[](QString fn) { return FileName::fromString(fn); });
if (tmp == m_mkspecs)
return;
m_mkspecs = tmp;
toolChainUpdated();
}
QString CustomToolChain::mkspecs() const
@@ -367,7 +381,10 @@ CustomToolChain::OutputParser CustomToolChain::outputParserType() const
void CustomToolChain::setOutputParserType(CustomToolChain::OutputParser parser)
{
if (m_outputParser == parser)
return;
m_outputParser = parser;
toolChainUpdated();
}
CustomParserSettings CustomToolChain::customParserSettings() const
@@ -377,7 +394,10 @@ CustomParserSettings CustomToolChain::customParserSettings() const
void CustomToolChain::setCustomParserSettings(const CustomParserSettings &settings)
{
if (m_customParserSettings == settings)
return;
m_customParserSettings = settings;
toolChainUpdated();
}
QString CustomToolChain::parserName(CustomToolChain::OutputParser parser)

View File

@@ -230,16 +230,25 @@ void GccToolChain::setCompilerCommand(const FileName &path)
return;
m_compilerCommand = path;
toolChainUpdated();
}
void GccToolChain::setSupportedAbis(const QList<Abi> &m_abis)
{
if (m_supportedAbis == m_abis)
return;
m_supportedAbis = m_abis;
toolChainUpdated();
}
void GccToolChain::setOriginalTargetTriple(const QString &targetTriple)
{
if (m_originalTargetTriple == targetTriple)
return;
m_originalTargetTriple = targetTriple;
toolChainUpdated();
}
void GccToolChain::setMacroCache(const QStringList &allCxxflags, const QByteArray &macros) const

View File

@@ -345,7 +345,7 @@ void KitModel::removeKit(Kit *k)
if (node == m_defaultNode)
setDefaultNode(findSecondLevelItem([node](KitNode *kn) { return kn != node; }));
delete takeItem(node);
destroyItem(node);
validateKitNames();
emit kitStateChanged();

View File

@@ -259,8 +259,6 @@ QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags,
QStringList split = line.split('=');
const QString key = split.at(0).mid(1);
QString value = split.at(1);
if (!value.isEmpty())
value.chop(1); //remove '\n'
predefinedMacros += "#define ";
predefinedMacros += key.toUtf8();
predefinedMacros += ' ';

View File

@@ -348,7 +348,7 @@ void TaskWindow::delayedInitialization()
QList<QWidget*> TaskWindow::toolBarWidgets() const
{
return QList<QWidget*>() << d->m_filterWarningsButton << d->m_categoriesButton;
return { d->m_filterWarningsButton, d->m_categoriesButton };
}
QWidget *TaskWindow::outputWidget(QWidget *)

View File

@@ -236,7 +236,7 @@ void ToolChainOptionsWidget::addToolChain(ToolChain *tc)
}
}
TreeItem *parent = m_model.rootItem()->child(tc->isAutoDetected() ? 0 : 1);
TreeItem *parent = m_model.rootItem()->childAt(tc->isAutoDetected() ? 0 : 1);
parent->appendChild(new ToolChainTreeItem(tc, false));
updateState();
@@ -255,7 +255,7 @@ void ToolChainOptionsWidget::removeToolChain(ToolChain *tc)
auto item = m_model.findSecondLevelItem([tc](ToolChainTreeItem *item) {
return tc->isAutoDetected() && item->toolChain == tc;
});
delete m_model.takeItem(item);
m_model.destroyItem(item);
updateState();
}

View File

@@ -0,0 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "stateseditoriconprovider.h"
#include <coreplugin/coreicons.h>
namespace QmlDesigner {
StatesEditorIconProvider::StatesEditorIconProvider()
: QQuickImageProvider(Pixmap)
{
}
QPixmap StatesEditorIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{
Q_UNUSED(requestedSize)
QPixmap result;
if (id == "close")
result = Core::Icons::CLOSE_TOOLBAR.pixmap();
else if (id == "plus")
result = Core::Icons::PLUS.pixmap();
if (size)
*size = result.size();
return result;
}
} // namespace QmlDesigner

View File

@@ -5,8 +5,10 @@ VPATH += $$PWD
SOURCES += stateseditorwidget.cpp \
stateseditormodel.cpp \
stateseditorview.cpp \
stateseditorimageprovider.cpp
stateseditorimageprovider.cpp \
stateeditorsiconprovider.cpp
HEADERS += stateseditorwidget.h \
stateseditormodel.h \
stateseditorview.h \
stateseditorimageprovider.cpp
stateseditorimageprovider.h \
stateseditoriconprovider.h

View File

@@ -0,0 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QQuickImageProvider>
namespace QmlDesigner {
class StatesEditorIconProvider : public QQuickImageProvider
{
public:
StatesEditorIconProvider();
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
};
} // namespace QmlDesigner

View File

@@ -27,10 +27,12 @@
#include "stateseditormodel.h"
#include "stateseditorview.h"
#include "stateseditorimageprovider.h"
#include "stateseditoriconprovider.h"
#include <invalidqmlsourceexception.h>
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
@@ -95,9 +97,10 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State
rootContext()->setContextProperty(QStringLiteral("statesEditorModel"), statesEditorModel);
rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor());
rootContext()->setContextProperty(QLatin1String("canAddNewStates"), true);
engine()->addImageProvider(QLatin1String("icons"), new StatesEditorIconProvider());
setWindowTitle(tr("States", "Title of Editor widget"));
// init the first load of the QML UI elements

View File

@@ -28,6 +28,7 @@ QtcProduct {
"../../../../share/qtcreator/qml/qmlpuppet/interfaces",
"../../../../share/qtcreator/qml/qmlpuppet/types",
])
cpp.internalVersion: ""
Group {
name: "controls"

View File

@@ -554,6 +554,9 @@ Project {
"propertyeditor/qmlmodelnodeproxy.h",
"resources/resources.qrc",
"stateseditor/stateseditorimageprovider.cpp",
"stateseditor/stateseditorimageprovider.h",
"stateseditor/stateeditorsiconprovider.cpp",
"stateseditor/stateseditoriconprovider.h",
"stateseditor/stateseditormodel.cpp",
"stateseditor/stateseditormodel.h",
"stateseditor/stateseditorview.cpp",

View File

@@ -8,6 +8,7 @@ QtcProduct {
cpp.defines: base.concat("QTQUICK_LIBRARY")
cpp.includePaths: base.concat("../designercore/include")
cpp.internalVersion: ""
Group {
name: "sources"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 986 B

Some files were not shown because too many files have changed in this diff Show More