Merge remote-tracking branch 'origin/3.3'

This commit is contained in:
Eike Ziller
2014-11-06 12:38:37 +01:00
305 changed files with 2046 additions and 1525 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -59,6 +59,12 @@
You can detect problems in memory management by using the Memcheck
tool and find cache misses in the code by using the Callgrind tool.
\li \l{Using Clang Static Analyzer}{Clang Static Analyzer}
In \QC Enterprise, you can detect problems in C, C++, and
Objective-C programs by using the experimental plugin that
integrates the Clang Static Analyzer source code analysis tool.
\endlist
*/

View File

@@ -0,0 +1,77 @@
/****************************************************************************
**
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/
// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************
/*!
\contentspage {Qt Creator Manual}
\previouspage creator-running-valgrind-remotely.html
\page creator-clang-static-analyzer.html
\nextpage creator-advanced.html
\title Using Clang Static Analyzer
\QC Enterprise integrates the \l{http://clang-analyzer.llvm.org}
{Clang Static Analyzer} for finding problems in C, C++, and Objective-C
programs. You must have Clang installed to use the plugin. At the time of
this writing, the plugin is experimental and only available on Linux and
OS X.
\image qtcreator-clang-static-analyzer.png
The Clang Static Analyzer runs with all the default checkers enabled. For
more information about the checkers, see
\l{http://clang-analyzer.llvm.org/available_checks.html}{Available Checkers}.
To set up the Clang Static Analyzer:
\list 1
\li Select \gui Help > \gui {About Plugins} > \gui {Code Analyzer} >
\gui {Clang Static Analyzer} to enable the experimental plugin.
\li Restart \QC to be able to use the plugin.
\li Select \gui Tools > \gui Options > \gui Analyzer >
\gui {Clang Static Analyzer} to check that the path to the Clang
executable is set correctly in the \gui {Clang executable} field.
\image qtcreator-clang-static-analyzer-options.png
\endlist
To run the Clang Static Analyzer to analyze an open project:
\list 1
\li Select \gui Analyze > \gui {Clang Static Analyzer}.
\li Select the
\inlineimage qtcreator-analyze-start-button.png
(\gui Start) button to run the Clang Static Analyzer on the
application.
\endlist
*/

View File

@@ -254,7 +254,7 @@
\contentspage {Qt Creator Manual}
\previouspage creator-cache-profiler.html
\page creator-running-valgrind-remotely.html
\nextpage creator-advanced.html
\nextpage creator-clang-static-analyzer.html
\title Running Valgrind Tools on External Applications

View File

@@ -528,6 +528,56 @@
\li Qt Quick Designer only supports states in the root QML type
\li
\row
\li M208
\li Error
\li This type (%1) is not supported as a root element by \QMLD.
\li
\row
\li M220
\li Error
\li This type (%1) is not supported as a root element of a Qt Quick UI
form.
\li
\row
\li M221
\li Error
\li This type (%1) is not supported in a Qt Quick UI form.
\li
\row
\li M222
\li Error
\li Functions are not supported in a Qt Quick UI form.
\li
\row
\li M223
\li Error
\li Java Script blocks are not supported in a Qt Quick UI form.
\li
\row
\li M224
\li Error
\li Behavior type is not supported in a Qt Quick UI form.
\li
\row
\li M225
\li Error
\li States are only supported in the root item in a Qt Quick UI form.
\li
\row
\li M226
\li Error
\li Referencing the parent of the root item is not supported in a Qt
Quick UI form.
\li
\row
\li M300
\li Error
@@ -671,6 +721,12 @@
\li 'Number' elements expected in array value
\li
\row
\li M324
\li Warning
\li Using Qt Quick 1 code model instead of Qt Quick 2
\li
\endtable
*/

View File

@@ -65,7 +65,7 @@
\row
\li Subversion
\li \l{http://subversion.apache.org/}
\li Subversion version 1.6.17 and later
\li Subversion version 1.7.0 and later
\endtable
\section1 Setting Up Version Control Systems

View File

@@ -24,7 +24,7 @@
/*!
\contentspage {Qt Creator Manual}
\previouspage creator-running-valgrind-remotely.html
\previouspage creator-clang-static-analyzer.html
\page creator-advanced.html
\nextpage creator-os-supported-platforms.html

View File

@@ -120,6 +120,15 @@
the build step and add a custom build step that specifies another shell
command.
\QC Enterprise is integrated to \l{http://doc.qt.digia.com/QtQuickCompiler/}
{Qt Quick Compiler}. It is a commercial add-on for Qt Quick applications
that enables you to compile QML source code into the final binary. This
improves the startup time of the application and eliminates the need to
deploy QML files together with the application. \QC new project wizards
create projects that the Qt Quick Compiler can compile, because they are
set up to use the Qt Resource System. To compile Qt Quick projects, select
the \gui {Enable Qt Quick Compiler} check box.
\note For more information about the build steps when using Qbs, see
\l{Building Applications with Qbs}.

View File

@@ -254,6 +254,7 @@
\li \l{Profiling Function Execution}
\li \l{Running Valgrind Tools on External Applications}
\endlist
\li \l{Using Clang Static Analyzer}
\endlist
\endlist

View File

@@ -117,10 +117,10 @@ def qdump__CPlusPlus__Token(d, value):
k = value["f"]["kind"]
if int(k) == 6:
d.putValue("T_IDENTIFIER. offset: %d, len: %d"
% (value["offset"], value["f"]["length"]))
% (value["utf16charOffset"], value["f"]["utf16chars"]))
elif int(k) == 7:
d.putValue("T_NUMERIC_LITERAL. offset: %d, value: %d"
% (value["offset"], value["f"]["length"]))
d.putValue("T_NUMERIC_LITERAL. offset: %d, len: %d"
% (value["utf16charOffset"], value["f"]["utf16chars"]))
else:
val = str(k.cast(d.lookupType("CPlusPlus::Kind")))
d.putValue(val[11:]) # Strip "CPlusPlus::"

View File

@@ -49,24 +49,15 @@
#include <windows.h>
#endif
int main(int argc, char *argv[])
int internalMain(QGuiApplication *application)
{
// Since we always render text into an FBO, we need to globally disable
// subpixel antialiasing and instead use gray.
qputenv("QSG_DISTANCEFIELD_ANTIALIASING", "gray");
#ifdef Q_OS_MAC //This keeps qml2puppet from stealing focus
qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true");
#endif
QApplication application(argc, argv);
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setOrganizationDomain("qt-project.org");
QCoreApplication::setApplicationName("Qml2Puppet");
QCoreApplication::setApplicationVersion("1.0.0");
if (application.arguments().count() < 2
|| (application.arguments().at(1) == "--readcapturedstream" && application.arguments().count() < 3)) {
if (application->arguments().count() < 2
|| (application->arguments().at(1) == "--readcapturedstream" && application->arguments().count() < 3)) {
qDebug() << "Usage:\n";
qDebug() << "--test";
qDebug() << "--version";
@@ -75,16 +66,16 @@ int main(int argc, char *argv[])
return -1;
}
if (application.arguments().at(1) == "--readcapturedstream" && application.arguments().count() > 2) {
QFileInfo inputStreamFileInfo(application.arguments().at(2));
if (application->arguments().at(1) == "--readcapturedstream" && application->arguments().count() > 2) {
QFileInfo inputStreamFileInfo(application->arguments().at(2));
if (!inputStreamFileInfo.exists()) {
qDebug() << "Input stream does not exist:" << inputStreamFileInfo.absoluteFilePath();
return -1;
}
if (application.arguments().count() > 3) {
QFileInfo controlStreamFileInfo(application.arguments().at(3));
if (application->arguments().count() > 3) {
QFileInfo controlStreamFileInfo(application->arguments().at(3));
if (!controlStreamFileInfo.exists()) {
qDebug() << "Output stream does not exist:" << controlStreamFileInfo.absoluteFilePath();
@@ -93,7 +84,7 @@ int main(int argc, char *argv[])
}
}
if (application.arguments().count() == 2 && application.arguments().at(1) == "--test") {
if (application->arguments().count() == 2 && application->arguments().at(1) == "--test") {
qDebug() << QCoreApplication::applicationVersion();
QQmlEngine engine;
@@ -112,13 +103,13 @@ int main(int argc, char *argv[])
return 0;
}
if (application.arguments().count() == 2 && application.arguments().at(1) == "--version") {
if (application->arguments().count() == 2 && application->arguments().at(1) == "--version") {
std::cout << 2;
return 0;
}
if (application.arguments().at(1) != "--readcapturedstream" && application.arguments().count() < 4) {
qDebug() << "Wrong argument count: " << application.arguments().count();
if (application->arguments().at(1) != "--readcapturedstream" && application->arguments().count() < 4) {
qDebug() << "Wrong argument count: " << application->arguments().count();
return -1;
}
@@ -128,14 +119,36 @@ int main(int argc, char *argv[])
QtSystemExceptionHandler systemExceptionHandler;
#endif
new QmlDesigner::Qt5NodeInstanceClientProxy(&application);
new QmlDesigner::Qt5NodeInstanceClientProxy(application);
#if defined(Q_OS_WIN) && defined(QT_NO_DEBUG)
SetErrorMode(SEM_NOGPFAULTERRORBOX); //We do not want to see any message boxes
#endif
if (application.arguments().at(1) == "--readcapturedstream")
if (application->arguments().at(1) == "--readcapturedstream")
return 0;
return application.exec();
return application->exec();
}
int main(int argc, char *argv[])
{
// Since we always render text into an FBO, we need to globally disable
// subpixel antialiasing and instead use gray.
qputenv("QSG_DISTANCEFIELD_ANTIALIASING", "gray");
#ifdef Q_OS_OSX //This keeps qml2puppet from stealing focus
qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true");
#endif
//If a style different from Desktop is set we have to use QGuiApplication
bool useGuiApplication = !qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()
&& qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop";
if (useGuiApplication) {
QGuiApplication application(argc, argv);
return internalMain(&application);
} else {
QApplication application(argc, argv);
return internalMain(&application);
}
}

View File

@@ -43,7 +43,7 @@ Item {
signal clicked()
property alias toolTip: toolTipArea.toolTip
property alias tooltip: toolTipArea.tooltip
width: 24 + leftPadding
height: 24

View File

@@ -199,7 +199,7 @@ Column {
colorEditor.backendValue.resetValue()
gradientLine.deleteGradient()
}
toolTip: qsTr("Solid Color")
tooltip: qsTr("Solid Color")
}
ButtonRowButton {
visible: supportGradient
@@ -209,7 +209,7 @@ Column {
gradientLine.addGradient()
}
toolTip: qsTr("Gradient")
tooltip: qsTr("Gradient")
}
ButtonRowButton {
iconSource: "images/icon_color_none.png"
@@ -217,7 +217,7 @@ Column {
colorEditor.color = "#00000000"
gradientLine.deleteGradient()
}
toolTip: qsTr("Transparent")
tooltip: qsTr("Transparent")
}
}

View File

@@ -30,7 +30,7 @@
import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.1
import QtQuick.Controls.Styles 1.2
ComboBoxStyle {
property color borderColor: "#222"
@@ -106,4 +106,11 @@ ComboBoxStyle {
color: textColor
}
}
__dropDownStyle: MenuStyle {
__maxPopupHeight: 600
__menuItemType: "comboboxitem"
frame: Rectangle {
}
}
}

View File

@@ -98,7 +98,7 @@ Section {
Label {
text: qsTr("Behavior")
toolTip: qsTr("Bounds behavior")
tooltip: qsTr("Bounds behavior")
}
SecondColumnLayout {
@@ -126,7 +126,7 @@ Section {
Label {
text: qsTr("Max. velocity")
toolTip: qsTr("Maximum flick velocity")
tooltip: qsTr("Maximum flick velocity")
}
SecondColumnLayout {
@@ -143,7 +143,7 @@ Section {
Label {
text: qsTr("Deceleration")
toolTip: qsTr("Flick deceleration")
tooltip: qsTr("Flick deceleration")
}
SecondColumnLayout {

View File

@@ -36,7 +36,7 @@ import QtQuick.Controls.Private 1.0
Controls.Label {
id: label
property alias toolTip: toolTipArea.toolTip
property alias tooltip: toolTipArea.tooltip
width: Math.max(Math.min(240, parent.width - 220), 80)
color: "#eee"
@@ -49,6 +49,6 @@ Controls.Label {
ToolTipArea {
id: toolTipArea
anchors.fill: parent
toolTip: label.text
tooltip: label.text
}
}

View File

@@ -41,11 +41,11 @@ MouseArea {
hoverEnabled: true
property string toolTip
property string tooltip
Timer {
interval: 1000
running: mouseArea.containsMouse && toolTip.length
onTriggered: Tooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), toolTip)
running: mouseArea.containsMouse && tooltip.length
onTriggered: Tooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), tooltip)
}
}

View File

@@ -50,7 +50,7 @@ Column {
Label {
text: qsTr("Cache")
toolTip: qsTr("Cache buffer")
tooltip: qsTr("Cache buffer")
}
SectionLayout {
@@ -117,7 +117,7 @@ Column {
Label {
text: qsTr("Navigation wraps")
toolTip: qsTr("Determines whether the grid wraps key navigation.")
tooltip: qsTr("Determines whether the grid wraps key navigation.")
}
SectionLayout {
@@ -145,7 +145,7 @@ Column {
Label {
text: qsTr("Snap mode")
toolTip: qsTr("Determines how the view scrolling will settle following a drag or flick.")
tooltip: qsTr("Determines how the view scrolling will settle following a drag or flick.")
}
SecondColumnLayout {
@@ -169,7 +169,7 @@ Column {
Label {
text: qsTr("Range")
toolTip: qsTr("Highlight range")
tooltip: qsTr("Highlight range")
}
SecondColumnLayout {
@@ -184,7 +184,7 @@ Column {
Label {
text: qsTr("Move duration")
toolTip: qsTr("Move animation duration of the highlight delegate.")
tooltip: qsTr("Move animation duration of the highlight delegate.")
}
SectionLayout {
@@ -202,7 +202,7 @@ Column {
Label {
text: qsTr("Move speed")
toolTip: qsTr("Move animation speed of the highlight delegate.")
tooltip: qsTr("Move animation speed of the highlight delegate.")
}
SectionLayout {
@@ -220,7 +220,7 @@ Column {
Label {
text: qsTr("Preferred begin")
toolTip: qsTr("Preferred highlight begin - must be smaller than Preferred end.")
tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.")
}
SectionLayout {
@@ -238,7 +238,7 @@ Column {
Label {
text: qsTr("Preferred end")
toolTip: qsTr("Preferred highlight end - must be larger than Preferred begin.")
tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin.")
}
SectionLayout {
@@ -256,7 +256,7 @@ Column {
Label {
text: qsTr("Follows current")
toolTip: qsTr("Determines whether the highlight is managed by the view.")
tooltip: qsTr("Determines whether the highlight is managed by the view.")
}
SectionLayout {

View File

@@ -50,7 +50,7 @@ Column {
Label {
text: qsTr("Cache")
toolTip: qsTr("Cache buffer")
tooltip: qsTr("Cache buffer")
}
SectionLayout {
@@ -68,7 +68,7 @@ Column {
Label {
text: qsTr("Navigation wraps")
toolTip: qsTr("Determines whether the grid wraps key navigation.")
tooltip: qsTr("Determines whether the grid wraps key navigation.")
}
SectionLayout {
@@ -83,7 +83,7 @@ Column {
Label {
text: qsTr("Orientation")
toolTip: qsTr("Orientation of the list.")
tooltip: qsTr("Orientation of the list.")
}
SecondColumnLayout {
@@ -114,7 +114,7 @@ Column {
Label {
text: qsTr("Snap mode")
toolTip: qsTr("Determines how the view scrolling will settle following a drag or flick.")
tooltip: qsTr("Determines how the view scrolling will settle following a drag or flick.")
}
SecondColumnLayout {
@@ -131,7 +131,7 @@ Column {
Label {
text: qsTr("Spacing")
toolTip: qsTr("Spacing between items.")
tooltip: qsTr("Spacing between items.")
}
SectionLayout {
@@ -159,7 +159,7 @@ Column {
Label {
text: qsTr("Range")
toolTip: qsTr("Highlight range")
tooltip: qsTr("Highlight range")
}
SecondColumnLayout {
@@ -178,7 +178,7 @@ Column {
Label {
text: qsTr("Move duration")
toolTip: qsTr("Move animation duration of the highlight delegate.")
tooltip: qsTr("Move animation duration of the highlight delegate.")
}
SectionLayout {
@@ -196,7 +196,7 @@ Column {
Label {
text: qsTr("Move speed")
toolTip: qsTr("Move animation speed of the highlight delegate.")
tooltip: qsTr("Move animation speed of the highlight delegate.")
}
SectionLayout {
@@ -214,7 +214,7 @@ Column {
Label {
text: qsTr("Resize duration")
toolTip: qsTr("Resize animation duration of the highlight delegate.")
tooltip: qsTr("Resize animation duration of the highlight delegate.")
}
SectionLayout {
@@ -232,7 +232,7 @@ Column {
Label {
text: qsTr("Preferred begin")
toolTip: qsTr("Preferred highlight begin - must be smaller than Preferred end.")
tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end.")
}
SectionLayout {
@@ -250,7 +250,7 @@ Column {
Label {
text: qsTr("Preferred end")
toolTip: qsTr("Preferred highlight end - must be larger than Preferred begin.")
tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin.")
}
SectionLayout {
@@ -268,7 +268,7 @@ Column {
Label {
text: qsTr("Follows current")
toolTip: qsTr("Determines whether the highlight is managed by the view.")
tooltip: qsTr("Determines whether the highlight is managed by the view.")
}
SectionLayout {

View File

@@ -44,7 +44,7 @@ Column {
SectionLayout {
Label {
text: qsTr("Enabled")
toolTip: qsTr("This property holds whether the item accepts mouse events.")
tooltip: qsTr("This property holds whether the item accepts mouse events.")
}
SecondColumnLayout {
@@ -59,7 +59,7 @@ Column {
Label {
text: qsTr("Hover Enabled")
toolTip: qsTr("This property holds whether hover events are handled.")
tooltip: qsTr("This property holds whether hover events are handled.")
}
SecondColumnLayout {

View File

@@ -45,7 +45,7 @@ Column {
Label {
text: qsTr("Drag margin")
toolTip: qsTr("Drag margin")
tooltip: qsTr("Drag margin")
}
SecondColumnLayout {
@@ -80,7 +80,7 @@ Column {
Label {
text: qsTr("Interactive")
toolTip: qsTr("A user cannot drag or flick a PathView that is not interactive.")
tooltip: qsTr("A user cannot drag or flick a PathView that is not interactive.")
}
SecondColumnLayout {
@@ -95,7 +95,7 @@ Column {
Label {
text: qsTr("Offset")
toolTip: qsTr("Specifies how far along the path the items are from their initial positions. This is a real number that ranges from 0.0 to the count of items in the model.")
tooltip: qsTr("Specifies how far along the path the items are from their initial positions. This is a real number that ranges from 0.0 to the count of items in the model.")
}
SecondColumnLayout {
@@ -113,7 +113,7 @@ Column {
Label {
text: qsTr("Item count")
toolTip: qsTr("pathItemCount: number of items visible on the path at any one time.")
tooltip: qsTr("pathItemCount: number of items visible on the path at any one time.")
}
SecondColumnLayout {
@@ -139,7 +139,7 @@ Column {
Label {
text: qsTr("Range")
toolTip: qsTr("Highlight range")
tooltip: qsTr("Highlight range")
}
SecondColumnLayout {
@@ -158,7 +158,7 @@ Column {
Label {
text: qsTr("Move duration")
toolTip: qsTr("Move animation duration of the highlight delegate.")
tooltip: qsTr("Move animation duration of the highlight delegate.")
}
SecondColumnLayout {
@@ -176,7 +176,7 @@ Column {
Label {
text: qsTr("Preferred begin")
toolTip: qsTr("Preferred highlight begin - must be smaller than Preferred end. Note that the user has to add a highlight component.")
tooltip: qsTr("Preferred highlight begin - must be smaller than Preferred end. Note that the user has to add a highlight component.")
}
SecondColumnLayout {
@@ -194,7 +194,7 @@ Column {
Label {
text: qsTr("Preferred end")
toolTip: qsTr("Preferred highlight end - must be larger than Preferred begin. Note that the user has to add a highlight component.")
tooltip: qsTr("Preferred highlight end - must be larger than Preferred begin. Note that the user has to add a highlight component.")
}
SecondColumnLayout {

View File

@@ -73,7 +73,7 @@ Section {
Label {
visible: textInputSection.isTextInput
text: qsTr("Pass. char")
toolTip: qsTr("Character displayed when users enter passwords.")
tooltip: qsTr("Character displayed when users enter passwords.")
}
LineEdit {

View File

@@ -1,48 +0,0 @@
AlignmentHorizontalButtons 1.0 AlignmentHorizontalButtons.qml
AlignmentVerticalButtons 1.0 AlignmentVerticalButtons.qml
AnchorBox 1.0 AnchorBox.qml
AnchorButtons 1.0 AnchorButtons.qml
CheckBox 1.0 CheckBox.qml
ColorGroupBox 1.0 ColorGroupBox.qml
ColorLabel 1.0 ColorLabel.qml
ColorLineEdit 1.0 ColorLineEdit.qml
ColorScheme 1.0 ColorScheme.qml
ColorTypeButtons 1.0 ColorTypeButtons.qml
ComboBox 1.0 ComboBox.qml
DoubleSpinBox 1.0 DoubleSpinBox.qml
DoubleSpinBoxAlternate 1.0 DoubleSpinBoxAlternate.qml
ExpressionEditor 1.0 ExpressionEditor.qml
Extended 1.0 Extended.qml
ExtendedFunctionButton 1.0 ExtendedFunctionButton.qml
ExtendedPane 1.0 ExtendedPane.qml
ExtendedSwitches 1.0 ExtendedSwitches.qml
FlagedButton 1.0 FlagedButton.qml
FontComboBox 1.0 FontComboBox.qml
FontGroupBox 1.0 FontGroupBox.qml
FontStyleButtons 1.0 FontStyleButtons.qml
Geometry 1.0 Geometry.qml
GroupBox 1.0 GroupBox.qml
GroupBoxOption 1.0 GroupBoxOption.qml
HorizontalLayout 1.0 HorizontalLayout.qml
HorizontalWhiteLine 1.0 HorizontalWhiteLine.qml
IntEditor 1.0 IntEditor.qml
Label 1.0 Label.qml
Layout 1.0 Layout.qml
LayoutPane 1.0 LayoutPane.qml
LineEdit 1.0 LineEdit.qml
Modifiers 1.0 Modifiers.qml
PlaceHolder 1.0 PlaceHolder.qml
PropertyFrame 1.0 PropertyFrame.qml
ScrollArea 1.0 ScrollArea.qml
SliderWidget 1.0 SliderWidget.qml
SpinBox 1.0 SpinBox.qml
StandardTextColorGroupBox 1.0 StandardTextColorGroupBox.qml
StandardTextGroupBox 1.0 StandardTextGroupBox.qml
Switches 1.0 Switches.qml
TextEditor 1.0 TextEditor.qml
TextInputGroupBox 1.0 TextInputGroupBox.qml
Transformation 1.0 Transformation.qml
Type 1.0 Type.qml
VerticalLayout 1.0 VerticalLayout.qml
Visibility 1.0 Visibility.qml
UrlEdit 1.0 UrlEdit.qml

View File

@@ -0,0 +1,18 @@
import QtQuick 2.3
Rectangle {
property alias mouseArea: mouseArea
width: 360
height: 360
MouseArea {
id: mouseArea
anchors.fill: parent
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}

View File

@@ -3,18 +3,11 @@ import QtQuick.Window 2.2
Window {
visible: true
width: 360
height: 360
MouseArea {
MainForm {
anchors.fill: parent
onClicked: {
mouseArea.onClicked: {
Qt.quit();
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}

View File

@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>MainForm.ui.qml</file>
</qresource>
</RCC>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="BV"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.2.4"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.2.4, QtSupport.Wizards.FeatureQtQuick.UiFiles"
qrcdeployment="qrcdeployment.pri"
stubversionminor="5">
<displayname>Qt Quick 2.4</displayname>
<description>Creates a deployable Qt Quick 2 application using the QtQuick 2.4 import. Requires Qt 5.4 or newer.</description>
<description>Creates a deployable Qt Quick 2 application that contains a .ui.qml file using the QtQuick 2.4 import. Requires Qt 5.4 or newer.</description>
</template>

View File

@@ -0,0 +1,31 @@
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
Item {
width: 640
height: 480
property alias button3: button3
property alias button2: button2
property alias button1: button1
RowLayout {
anchors.centerIn: parent
Button {
id: button1
text: qsTr("Press Me 1")
}
Button {
id: button2
text: qsTr("Press Me 2")
}
Button {
id: button3
text: qsTr("Press Me 3")
}
}
}

View File

@@ -1,28 +1,42 @@
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
ApplicationWindow {
visible: true
title: qsTr("Hello World")
width: 640
height: 480
title: qsTr("Hello World")
visible: true
menuBar: MenuBar {
Menu {
title: qsTr("File")
title: qsTr("&File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
onTriggered: messageDialog.show(qsTr("Open action triggered"));
}
MenuItem {
text: qsTr("Exit")
text: qsTr("E&xit")
onTriggered: Qt.quit();
}
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
MainForm {
anchors.fill: parent
button1.onClicked: messageDialog.show(qsTr("Button 1 pressed"))
button2.onClicked: messageDialog.show(qsTr("Button 2 pressed"))
button3.onClicked: messageDialog.show(qsTr("Button 3 pressed"))
}
MessageDialog {
id: messageDialog
title: qsTr("May I have your attention, please?")
function show(caption) {
messageDialog.text = caption;
messageDialog.open();
}
}
}

View File

@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>MainForm.ui.qml</file>
</qresource>
</RCC>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="AW"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.Controls.1.3"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.Controls.1.3, QtSupport.Wizards.FeatureQtQuick.UiFiles"
qrcdeployment="qrcdeployment.pri"
stubversionminor="1">
<displayname>Qt Quick Controls 1.3</displayname>
<description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.4 or newer.</description>
<description>Creates a deployable Qt Quick 2 application that contains a .ui.qml file and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.4 or newer.</description>
</template>

View File

@@ -1,17 +1,14 @@
%{Cpp:LicenseTemplate}
%{Cpp:LicenseTemplate}\
#include "%{HdrFileName}"
%{JS: Cpp.openNamespaces('%{Class}')}
@if '%{IncludeQSharedData}'
class %{CN}Data : public QSharedData
{
public:
};
@endif
@endif
@if '%{Base}' === 'QObject'
%{CN}::%{CN}(QObject *parent) : QObject(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''}
@elsif '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow'
@@ -41,5 +38,4 @@ public:
{
}
%{JS: Cpp.closeNamespaces('%{Class}')}
%{JS: Cpp.closeNamespaces('%{Class}')}\

View File

@@ -1,4 +1,4 @@
%{Cpp:LicenseTemplate}
%{Cpp:LicenseTemplate}\
#ifndef %{GUARD}
#define %{GUARD}
@@ -12,10 +12,8 @@
( '%{IncludeQMainWindow}' ) ? 'QtWidgets/%{IncludeQMainWindow}' : '',
( '%{IncludeQDeclarativeItem}' ) ? 'QtQuick1/%{IncludeQDeclarativeItem}' : '',
( '%{IncludeQQuickItem}' ) ? 'QtDeclarative/%{IncludeQQuickItem}' : '',
( '%{IncludeQSharedData}' ) ? 'QtCore/QSharedDataPointer' : '' ])}
( '%{IncludeQSharedData}' ) ? 'QtCore/QSharedDataPointer' : '' ])}\
%{JS: Cpp.openNamespaces('%{Class}')}
@if '%{IncludeQSharedData}'
class %{CN}Data;
@@ -28,13 +26,13 @@ class %{CN}
{
@if '%{isQObject}'
Q_OBJECT
@endif
public:
@if '%{Base}' === 'QObject'
explicit %{CN}(QObject *parent = 0);
@elsif '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow'
public
explicit %{CN}(QWidget *parent = 0);
@else
public:
%{CN}();
@endif
@if '%{IncludeQSharedData}'
@@ -54,7 +52,5 @@ private:
QSharedDataPointer<%{CN}Data> data;
@endif
};
%{JS: Cpp.closeNamespaces('%{Class}')}
#endif // %{GUARD}
#endif // %{GUARD}\

View File

@@ -1,4 +1,4 @@
%{Cpp:LicenseTemplate}
%{Cpp:LicenseTemplate}\
#ifndef %{JS: Cpp.headerGuard('%{FileName}')}
#define %{JS: Cpp.headerGuard('%{FileName}')}

View File

@@ -1 +1 @@
%{Cpp:LicenseTemplate}
%{Cpp:LicenseTemplate}\

View File

@@ -1,2 +1 @@
<RCC/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

View File

@@ -0,0 +1,52 @@
{
"version": 1,
"kind": "project",
"id": "U.QtEmpty",
"category": "H.Project",
"trDescription": "Creates a qmake-based project without any files. This allows you to create an application without any default classes.",
"trDisplayName": "Empty qmake Project",
"trDisplayCategory": "Other Project",
"icon": "../../../global/guiapplication.png",
"featuresRequired": [ "Plugin.QmakeProjectManager", "QtSupport.Wizards.FeatureQt" ],
"options":
[
{ "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
{ "key": "IsTopLevelProject", "value": "%{JS: ('%{Exists:ProjectExplorer.Profile.Ids}') ? '' : 'yes'}" }
],
"pages":
[
{
"trDisplayName": "Project Location",
"trShortTitle": "Location",
"typeId": "Project"
},
{
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
"enabled": "%{IsTopLevelProject}",
"data": { "projectFilePath": "%{ProFileName}" }
},
{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
],
"generators":
[
{
"typeId": "File",
"data":
[
{
"source": "file.pro",
"target": "%{ProFileName}",
"openAsProject": true
}
]
}
]
}

View File

@@ -1,5 +1,6 @@
[General]
ThemeName=dark
PreferredStyles=Fusion
[Palette]
shadowBackground=ff232323
@@ -108,6 +109,7 @@ DrawIndicatorBranch=true
DrawProgressBarSunken=false
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
ApplyThemePaletteGlobally=true
[Gradients]
DetailsWidgetHeaderGradient\1\color=0

View File

@@ -1,5 +1,6 @@
[General]
ThemeName=default
PreferredStyles=
[Palette]
brightText = ffffffff
@@ -102,6 +103,7 @@ DrawIndicatorBranch=false
DrawProgressBarSunken=true
DrawSearchResultWidgetFrame=true
DrawTargetSelectorBottom=true
ApplyThemePaletteGlobally=false
[Gradients]
DetailsWidgetHeaderGradient\1\color=ffffff

View File

@@ -248,5 +248,7 @@
<string>$$QTCREATOR_VERSION</string>
<key>CFBundleShortVersionString</key>
<string>$$QTCREATOR_VERSION</string>
<key>LSMinimumSystemVersion</key>
<string>10.7.0</string>
</dict>
</plist>

View File

@@ -1,2 +0,0 @@
#include "LiteralTable.h"

View File

@@ -51,7 +51,6 @@ SOURCES += \
$$PWD/ObjectiveCAtKeywords.cpp \
$$PWD/ObjectiveCTypeQualifiers.cpp \
$$PWD/Lexer.cpp \
$$PWD/LiteralTable.cpp \
$$PWD/Literals.cpp \
$$PWD/MemoryPool.cpp \
$$PWD/Name.cpp \

View File

@@ -44,7 +44,6 @@ QtcLibrary {
"Keywords.cpp",
"Lexer.cpp",
"Lexer.h",
"LiteralTable.cpp",
"LiteralTable.h",
"Literals.cpp",
"Literals.h",

View File

@@ -1557,7 +1557,10 @@ bool Check::visit(CallExpression *ast)
&& name != QLatin1String("Boolean")
&& name != QLatin1String("Date")
&& name != QLatin1String("Number")
&& name != QLatin1String("Object")) {
&& name != QLatin1String("Object")
&& name != QLatin1String("QT_TR_NOOP")
&& name != QLatin1String("QT_TRANSLATE_NOOP")
&& name != QLatin1String("QT_TRID_NOOP")) {
addMessage(WarnExpectedNewWithUppercaseFunction, location);
}
if (cast<IdentifierExpression *>(ast->base) && name == QLatin1String("eval"))

View File

@@ -67,7 +67,7 @@ void ScopeBuilder::push(AST::Node *node)
// JS signal handler scope
if (UiScriptBinding *script = cast<UiScriptBinding *>(node)) {
QString name;
if (script->qualifiedId)
if (script->qualifiedId) {
name = script->qualifiedId->name.toString();
if (!_scopeChain->qmlScopeObjects().isEmpty()
&& name.startsWith(QLatin1String("on"))
@@ -90,6 +90,7 @@ void ScopeBuilder::push(AST::Node *node)
}
}
}
}
// JS scopes
switch (node->kind) {

View File

@@ -225,19 +225,19 @@ StaticAnalysisMessages::StaticAnalysisMessages()
newMsg(ErrUnsupportedRootTypeInVisualDesigner, Error,
tr("This type (%1) is not supported as a root element by Qt Quick Designer."), 1);
newMsg(ErrUnsupportedRootTypeInQmlUi, Error,
tr("This type (%1) is not supported as a root element of a Qt Quick ui file."), 1);
tr("This type (%1) is not supported as a root element of a Qt Quick UI form."), 1);
newMsg(ErrUnsupportedTypeInQmlUi, Error,
tr("This type (%1) is not supported in a Qt Quick ui file."), 1);
tr("This type (%1) is not supported in a Qt Quick UI form."), 1);
newMsg(ErrFunctionsNotSupportedInQmlUi, Error,
tr("Functions are not supported in a Qt Quick ui file."));
tr("Functions are not supported in a Qt Quick UI form."));
newMsg(ErrBlocksNotSupportedInQmlUi, Error,
tr("Java Script blocks are not supported in a Qt Quick ui file."));
tr("Java Script blocks are not supported in a Qt Quick UI form."));
newMsg(ErrBehavioursNotSupportedInQmlUi, Error,
tr("Behaviours are not supported in a Qt Quick ui file."));
tr("Behavior type is not supported in a Qt Quick UI form."));
newMsg(ErrStatesOnlyInRootItemInQmlUi, Error,
tr("States are only supported in the root item in a Qt Quick ui file."));
tr("States are only supported in the root item in a Qt Quick UI form."));
newMsg(ErrReferenceToParentItemNotSupportedInQmlUi, Error,
tr("Referencing the parent of the root item is not supported in a Qt Quick ui file."));
tr("Referencing the parent of the root item is not supported in a Qt Quick UI form."));
}
} // anonymous namespace

View File

@@ -143,6 +143,7 @@ enum KnownType
KT_QScriptValue = KT_Qt_Type + KT_HasSimpleDumper + 91,
KT_QHostAddress = KT_Qt_Type + KT_HasSimpleDumper + 92,
KT_QProcess = KT_Qt_Type + KT_HasSimpleDumper + 93,
KT_QTimeZone = KT_Qt_Type + KT_HasSimpleDumper + 94,
// Types: Qt primitive types
KT_QFixed = KT_Qt_Type + KT_Qt_PrimitiveType + 90,
KT_QTextItem = KT_Qt_Type + KT_Qt_PrimitiveType + 91,

View File

@@ -1225,6 +1225,8 @@ static KnownType knownClassTypeHelper(const std::string &type,
return KT_QMetaEnum;
if (!type.compare(qPos, 9, "QTextItem"))
return KT_QTextItem;
if (!type.compare(qPos, 9, "QTimeZone"))
return KT_QTimeZone;
if (!type.compare(qPos, 9, "QVector2D"))
return KT_QVector2D;
if (!type.compare(qPos, 9, "QVector3D"))
@@ -1789,12 +1791,25 @@ static bool dumpQByteArrayFromQPrivateClass(const SymbolGroupValue &v,
const ULONG64 byteArrayAddress = addressOfQPrivateMember(v, mode, additionalOffset);
if (!byteArrayAddress)
return false;
const std::string dumpType = QtInfo::get(v.context()).prependQtCoreModule("QByteArray");
const std::string symbolName = SymbolGroupValue::pointedToSymbolName(byteArrayAddress , dumpType);
std::string dumpType = QtInfo::get(v.context()).prependQtCoreModule("QByteArray");
std::string symbolName = SymbolGroupValue::pointedToSymbolName(byteArrayAddress , dumpType);
if (SymbolGroupValue::verbose > 1)
DebugPrint() << "dumpQByteArrayFromQPrivateClass of " << v.name() << '/'
<< v.type() << " mode=" << mode
<< " offset=" << additionalOffset << " address=0x" << std::hex << byteArrayAddress
<< std::dec << " expr=" << symbolName;
SymbolGroupNode *byteArrayNode =
v.node()->symbolGroup()->addSymbol(v.module(), symbolName, std::string(), &errorMessage);
if (!byteArrayNode && errorMessage.find("DEBUG_ANY_ID") != std::string::npos) {
// HACK:
// In some rare cases the AddSymbol can't create a node with a given module name,
// but is able to add the symbol without any modulename.
dumpType = QtInfo::get(v.context()).prependModuleAndNameSpace("QByteArray", "", QtInfo::get(v.context()).nameSpace);
symbolName = SymbolGroupValue::pointedToSymbolName(byteArrayAddress , dumpType);
byteArrayNode = v.node()->symbolGroup()->addSymbol(v.module(), symbolName, std::string(), &errorMessage);
if (!byteArrayNode)
return false;
}
return dumpQByteArray(SymbolGroupValue(byteArrayNode, v.context()), str);
}
@@ -2134,6 +2149,11 @@ static bool dumpQDateTime(const SymbolGroupValue &v, std::wostream &str)
return true;
}
static bool dumpQTimeZone(const SymbolGroupValue &v, std::wostream &str)
{
return dumpQByteArrayFromQPrivateClass(v, QPDM_qSharedDataPadded, SymbolGroupValue::pointerSize(), str);
}
static bool dumpQPixmap(const SymbolGroupValue &v, std::wostream &str)
{
const SymbolGroupValue pixmapSharedData = v["data"]["d"];
@@ -2754,6 +2774,9 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx,
case KT_QDateTime:
rc = dumpQDateTime(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
break;
case KT_QTimeZone:
rc = dumpQTimeZone(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
break;
case KT_QPoint:
case KT_QPointF:
rc = dumpQPoint_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;

View File

@@ -142,7 +142,7 @@ void SshKeyCreationDialog::saveKeys()
bool SshKeyCreationDialog::userForbidsOverwriting()
{
if (!QFileInfo(privateKeyFilePath()).exists() && !QFileInfo(publicKeyFilePath()).exists())
if (!QFileInfo::exists(privateKeyFilePath()) && !QFileInfo::exists(publicKeyFilePath()))
return false;
const QMessageBox::StandardButton reply = QMessageBox::question(this, tr("File Exists"),
tr("There already is a file of that name. Do you want to overwrite it?"),

View File

@@ -35,6 +35,7 @@
#include <algorithm>
#include <functional>
#include <QStringList>
namespace Utils
{
@@ -140,13 +141,100 @@ auto equal(R (S::*function)() const, T value)
// transform
/////////////////
// transform taking a member function pointer
template<typename T, typename R, typename S>
Q_REQUIRED_RESULT
auto transform(const QList<T> &container, R (S::*p)() const)
-> QList<typename std::remove_cv<typename std::remove_reference<R>::type>::type>
namespace {
// needed for msvc 2010, that doesn't have a declval
// can be removed once we stop supporting it
template<typename T>
T &&declval();
/////////////////
// helper code for transform to use back_inserter and thus push_back for everything
// and insert for QSet<>
//
// QSetInsertIterator, straight from the standard for insert_iterator
// just without the additional parameter to insert
template <class Container>
class QSetInsertIterator :
public std::iterator<std::output_iterator_tag,void,void,void,void>
{
QList<typename std::remove_cv<typename std::remove_reference<R>::type>::type> result;
protected:
Container *container;
public:
typedef Container container_type;
explicit QSetInsertIterator (Container &x)
: container(&x) {}
QSetInsertIterator<Container> &operator=(const typename Container::value_type &value)
{ container->insert(value); return *this; }
QSetInsertIterator<Container> &operator= (typename Container::value_type &&value)
{ container->insert(std::move(value)); return *this; }
QSetInsertIterator<Container >&operator*()
{ return *this; }
QSetInsertIterator<Container> &operator++()
{ return *this; }
QSetInsertIterator<Container> operator++(int)
{ return *this; }
};
// inserter helper function, returns a std::back_inserter for most containers
// and is overloaded for QSet<> to return a QSetInsertIterator
template<typename C>
inline std::back_insert_iterator<C>
inserter(C &container)
{
return std::back_inserter(container);
}
template<typename X>
inline QSetInsertIterator<QSet<X>>
inserter(QSet<X> &container)
{
return QSetInsertIterator<QSet<X>>(container);
}
// helper: removes const, volatile and references from a type
template<typename T>
struct RemoveCvAndReference
{
typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
};
template<typename F, typename T>
struct ResultOfFunctionWithoutCvAndReference
{
typedef typename RemoveCvAndReference<decltype(declval<F>()(declval<T>()))>::type type;
};
// actual implementation of transform
template<template<typename> class C, // result container type
template<typename> class SC, // input container type
typename T, // element type of input container
typename F> // function type
Q_REQUIRED_RESULT
auto transform_impl(const SC<T> &container, F function)
-> C<typename ResultOfFunctionWithoutCvAndReference<F, T>::type>
{
C<typename ResultOfFunctionWithoutCvAndReference<F, T>::type> result;
result.reserve(container.size());
std::transform(container.begin(), container.end(),
inserter(result),
function);
return result;
}
}
// transform taking a member function pointer
template<template<typename> class C,
typename T,
typename R,
typename S>
Q_REQUIRED_RESULT
auto transform(const C<T> &container, R (S::*p)() const)
-> C<typename RemoveCvAndReference<R>::type>
{
C<typename RemoveCvAndReference<R>::type> result;
result.reserve(container.size());
std::transform(container.begin(), container.end(),
std::back_inserter(result),
@@ -154,25 +242,53 @@ auto transform(const QList<T> &container, R (S::*p)() const)
return result;
}
namespace {
// needed for msvc 2010, that doesn't have a declval
// can be removed once we stop supporting it
template<typename T>
T &&declval();
// same container type for input and output, e.g. transforming a QList<QString> into QList<int>
template<template<typename> class C, // container
typename T, // element type
typename F> // function type
Q_REQUIRED_RESULT
auto transform(const C<T> &container, F function)
-> C<typename RemoveCvAndReference<decltype(declval<F>()(declval<T>()))>::type>
{
return transform_impl<QList>(container, function);
}
// Note: add overloads for other container types as needed
template<typename T, typename F>
// different container types for input and output, e.g. transforming a QList into a QSet
template<template<typename> class C, // result container type
template<typename> class SC, // input container type
typename T, // element type of input container
typename F> // function type
Q_REQUIRED_RESULT
auto transform(const QList<T> &container, F function)
-> QList<typename std::remove_cv<typename std::remove_reference<decltype(function(declval<T>()))>::type>::type>
auto transform(const SC<T> &container, F function)
-> C<typename RemoveCvAndReference<decltype(declval<F>()(declval<T>()))>::type>
{
QList<typename std::remove_cv<typename std::remove_reference<decltype(function(declval<T>()))>::type>::type> result;
result.reserve(container.size());
std::transform(container.begin(), container.end(),
std::back_inserter(result),
function);
return result;
return transform_impl(container, function);
}
//////////
// transform for QStringList, because that isn't a specialization but a separate type
// and g++ doesn't want to use the above templates for that
// clang and msvc do find the base class QList<QString>
//////////
// QStringList -> QList<>
template<typename F> // function type
Q_REQUIRED_RESULT
auto transform(const QStringList &container, F function)
-> QList<typename RemoveCvAndReference<decltype(declval<F>()(declval<QString>()))>::type>
{
return transform_impl<QList>(QList<QString>(container), function);
}
// QStringList -> any container type
template<template<typename> class C, // result container type
typename F> // function type
Q_REQUIRED_RESULT
auto transform(const QStringList &container, F function)
-> C<typename RemoveCvAndReference<decltype(declval<F>()(declval<QString>()))>::type>
{
return transform_impl<C>(QList<QString>(container), function);
}
//////////////////

View File

@@ -65,22 +65,40 @@ QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path)
return result;
}
static bool isQmake(const QString &path)
{
if (path.isEmpty())
return false;
QFileInfo fi(path);
if (BuildableHelperLibrary::isQtChooser(fi))
fi.setFile(BuildableHelperLibrary::qtChooserToQmakePath(fi.symLinkTarget()));
return !BuildableHelperLibrary::qtVersionForQMake(fi.absoluteFilePath()).isEmpty();
}
FileName BuildableHelperLibrary::findSystemQt(const Environment &env)
{
const QString qmake = QLatin1String("qmake");
QStringList paths = env.path();
foreach (const QString &path, paths) {
QString prefix = path;
if (!prefix.endsWith(QLatin1Char('/')))
prefix.append(QLatin1Char('/'));
foreach (const QString &possibleCommand, possibleQMakeCommands()) {
QFileInfo qmake(prefix + possibleCommand);
if (qmake.exists()) {
if (isQtChooser(qmake))
qmake.setFile(qtChooserToQmakePath(qmake.symLinkTarget()));
if (path.isEmpty())
continue;
if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull())
return FileName(qmake);
QDir dir(path);
if (dir.exists(qmake)) {
const QString qmakePath = dir.absoluteFilePath(qmake);
if (isQmake(qmakePath))
return FileName::fromString(qmakePath);
}
// Prefer qmake-qt5 to qmake-qt4 by sorting the filenames in reverse order.
foreach (const QFileInfo &fi, dir.entryInfoList(possibleQMakeCommands(), QDir::Files, QDir::Name | QDir::Reversed)) {
if (fi.fileName() == qmake)
continue;
if (isQmake(fi.absoluteFilePath()))
return FileName(fi);
}
}
return FileName();
@@ -88,20 +106,12 @@ FileName BuildableHelperLibrary::findSystemQt(const Environment &env)
QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath)
{
bool qmakeIsExecutable;
return BuildableHelperLibrary::qtVersionForQMake(qmakePath, &qmakeIsExecutable);
}
QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool *qmakeIsExecutable)
{
*qmakeIsExecutable = !qmakePath.isEmpty();
if (!*qmakeIsExecutable)
if (qmakePath.isEmpty())
return QString();
QProcess qmake;
qmake.start(qmakePath, QStringList(QLatin1String("--version")));
if (!qmake.waitForStarted()) {
*qmakeIsExecutable = false;
qWarning("Cannot start '%s': %s", qPrintable(qmakePath), qPrintable(qmake.errorString()));
return QString();
}
@@ -111,7 +121,6 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool
return QString();
}
if (qmake.exitStatus() != QProcess::NormalExit) {
*qmakeIsExecutable = false;
qWarning("'%s' crashed.", qPrintable(qmakePath));
return QString();
}
@@ -260,7 +269,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
log->append(newline);
const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
if (QFileInfo(arguments.directory + QLatin1String("/Makefile")).exists()) {
if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) {
if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
"%1 not found in PATH\n").arg(arguments.makeCommand);

View File

@@ -46,9 +46,8 @@ public:
static FileName findSystemQt(const Environment &env);
static bool isQtChooser(const QFileInfo &info);
static QString qtChooserToQmakePath(const QString &path);
// return true if the qmake at qmakePath is qt4 (used by QtVersion)
// return true if the qmake at qmakePath is a Qt (used by QtVersion)
static QString qtVersionForQMake(const QString &qmakePath);
static QString qtVersionForQMake(const QString &qmakePath, bool *qmakeIsExecutable);
// returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion)
static QStringList possibleQMakeCommands();

View File

@@ -110,11 +110,19 @@ void writeQtIncludeSection(const QStringList &qt4,
else
trans = [](const QString &i) { return i.mid(i.indexOf(QLatin1Char('/')) + 1); };
QSet<QString> qt4Only = QSet<QString>::fromList(Utils::transform(qt4, trans));
QSet<QString> qt5Only = QSet<QString>::fromList(Utils::transform(qt5, trans));
QSet<QString> common = qt4Only;
QSet<QString> qt4Only = Utils::transform<QSet>(qt4, trans);
QSet<QString> qt5Only = Utils::transform<QSet>(qt5, trans);
if (addQtVersionCheck) {
QSet<QString> common = qt4Only;
common.intersect(qt5Only);
// qglobal.h is needed for QT_VERSION
if (includeQtModule)
common.insert(QLatin1String("QtCore/qglobal.h"));
else
common.insert(QLatin1String("qglobal.h"));
qt4Only.subtract(common);
qt5Only.subtract(common);
@@ -130,6 +138,12 @@ void writeQtIncludeSection(const QStringList &qt4,
if (addQtVersionCheck)
str << QLatin1String("#endif\n");
}
} else {
if (!qt5Only.isEmpty()) // default to Qt5
qtSection(qt5Only.toList(), str);
else
qtSection(qt4Only.toList(), str);
}
}
QTCREATOR_UTILS_EXPORT

View File

@@ -324,8 +324,7 @@ void DockWidget::handleMouseTimeout()
void DockWidget::handleToplevelChanged(bool floating)
{
if (!floating)
m_titleBar->setActive(false);
m_titleBar->setActive(floating);
}

View File

@@ -144,7 +144,7 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt
{
QFileInfo srcFileInfo = srcFilePath.toFileInfo();
if (srcFileInfo.isDir()) {
if (!tgtFilePath.toFileInfo().exists()) {
if (!tgtFilePath.exists()) {
QDir targetDir(tgtFilePath.toString());
targetDir.cdUp();
if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) {
@@ -551,6 +551,13 @@ QString FileName::toUserOutput() const
return QDir::toNativeSeparators(toString());
}
/// \returns a bool indicating whether a file with this
/// FileName exists.
bool FileName::exists() const
{
return QFileInfo::exists(*this);
}
/// Find the parent directory of a given directory.
/// Returns an empty FileName if the current directory is already

View File

@@ -72,6 +72,7 @@ public:
static FileName fromUserInput(const QString &filename);
QString toString() const;
QString toUserOutput() const;
bool exists() const;
FileName parentDir() const;

View File

@@ -29,9 +29,11 @@
****************************************************************************/
#include "macroexpander.h"
#include "qtcprocess.h"
#include "algorithm.h"
#include "qtcassert.h"
#include "qtcprocess.h"
#include "stringutils.h"
#include <QCoreApplication>
#include <QDebug>
@@ -49,7 +51,9 @@ const char kFileBaseNamePostfix[] = ":FileBaseName";
class MacroExpanderPrivate : public AbstractMacroExpander
{
public:
MacroExpanderPrivate() : m_accumulating(false) {}
MacroExpanderPrivate()
: m_accumulating(false), m_aborted(false), m_lockDepth(0)
{}
bool resolveMacro(const QString &name, QString *ret)
{
@@ -101,12 +105,16 @@ public:
QHash<QByteArray, MacroExpander::StringFunction> m_map;
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
QSet<QByteArray> m_invisbleInChooser;
QVector<MacroExpander::ResolverFunction> m_extraResolvers;
QMap<QByteArray, QString> m_descriptions;
QString m_displayName;
QVector<MacroExpanderProvider> m_subProviders;
QVector<MacroExpander *> m_subExpanders; // Not owned
bool m_accumulating;
bool m_aborted;
int m_lockDepth;
};
} // Internal
@@ -260,8 +268,24 @@ QString MacroExpander::value(const QByteArray &variable, bool *found) const
*/
QString MacroExpander::expand(const QString &stringWithVariables) const
{
if (d->m_lockDepth == 0)
d->m_aborted = false;
if (d->m_lockDepth > 3) { // Limit recursion.
d->m_aborted = true;
return QString();
}
++d->m_lockDepth;
QString res = stringWithVariables;
Utils::expandMacros(&res, d);
--d->m_lockDepth;
if (d->m_lockDepth == 0 && d->m_aborted)
return tr("Infinite recursion error") + QLatin1String(": ") + stringWithVariables;
return res;
}
@@ -301,8 +325,10 @@ void MacroExpander::registerPrefix(const QByteArray &prefix, const QString &desc
* \sa registerFileVariables(), registerIntVariable(), registerPrefix()
*/
void MacroExpander::registerVariable(const QByteArray &variable,
const QString &description, const StringFunction &value)
const QString &description, const StringFunction &value, bool visibleInChooser)
{
if (!visibleInChooser)
d->m_invisbleInChooser.insert(variable);
d->m_descriptions.insert(variable, description);
d->m_map.insert(variable, value);
}
@@ -335,19 +361,19 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix,
const QString &heading, const StringFunction &base)
{
registerVariable(prefix + kFilePathPostfix,
QCoreApplication::translate("Utils::MacroExpander", "%1: Full path including file name.").arg(heading),
tr("%1: Full path including file name.").arg(heading),
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).filePath(); });
registerVariable(prefix + kPathPostfix,
QCoreApplication::translate("Utils::MacroExpander", "%1: Full path excluding file name.").arg(heading),
tr("%1: Full path excluding file name.").arg(heading),
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).path(); });
registerVariable(prefix + kFileNamePostfix,
QCoreApplication::translate("Utils::MacroExpander", "%1: File name without path.").arg(heading),
tr("%1: File name without path.").arg(heading),
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).fileName(); });
registerVariable(prefix + kFileBaseNamePostfix,
QCoreApplication::translate("Utils::MacroExpander", "%1: File base name without path and suffix.").arg(heading),
tr("%1: File base name without path and suffix.").arg(heading),
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).baseName(); });
}
@@ -362,9 +388,15 @@ void MacroExpander::registerExtraResolver(const MacroExpander::ResolverFunction
* \sa registerVariable()
* \sa registerFileVariables()
*/
QList<QByteArray> MacroExpander::variables() const
QList<QByteArray> MacroExpander::visibleVariables() const
{
return d->m_descriptions.keys();
QList<QByteArray> res;
for (auto it = d->m_descriptions.begin(), end = d->m_descriptions.end(); it != end; ++it) {
if (!d->m_invisbleInChooser.contains(it.key()))
res.append(it.key());
}
return res;
}
/*!
@@ -386,11 +418,6 @@ MacroExpanders MacroExpander::subExpanders() const
return expanders;
}
AbstractMacroExpander *MacroExpander::abstractExpander() const
{
return d;
}
QString MacroExpander::displayName() const
{
return d->m_displayName;
@@ -418,12 +445,10 @@ void MacroExpander::setAccumulating(bool on)
class GlobalMacroExpander : public MacroExpander
{
Q_DECLARE_TR_FUNCTIONS(Utils::MacroExpander)
public:
GlobalMacroExpander()
{
setDisplayName(tr("Global variables"));
setDisplayName(MacroExpander::tr("Global variables"));
registerPrefix("Env", tr("Access environment variables."),
[](const QString &value) { return QString::fromLocal8Bit(qgetenv(value.toLocal8Bit())); });
}

View File

@@ -31,7 +31,7 @@
#ifndef UTILS_MACROEXPANDER_H
#define UTILS_MACROEXPANDER_H
#include "stringutils.h"
#include "utils_global.h"
#include <functional>
@@ -49,15 +49,16 @@ typedef QVector<MacroExpander *> MacroExpanders;
class QTCREATOR_UTILS_EXPORT MacroExpander
{
Q_DECLARE_TR_FUNCTIONS("MacroExpander")
Q_DECLARE_TR_FUNCTIONS(Utils::MacroExpander)
Q_DISABLE_COPY(MacroExpander)
public:
explicit MacroExpander();
virtual ~MacroExpander();
~MacroExpander();
virtual bool resolveMacro(const QString &name, QString *ret) const;
bool resolveMacro(const QString &name, QString *ret) const;
virtual QString value(const QByteArray &variable, bool *found = 0) const;
QString value(const QByteArray &variable, bool *found = 0) const;
QString expand(const QString &stringWithVariables) const;
QByteArray expand(const QByteArray &stringWithVariables) const;
@@ -73,7 +74,8 @@ public:
const QString &description, const PrefixFunction &value);
void registerVariable(const QByteArray &variable,
const QString &description, const StringFunction &value);
const QString &description, const StringFunction &value,
bool visibleInChooser = true);
void registerIntVariable(const QByteArray &variable,
const QString &description, const IntFunction &value);
@@ -83,11 +85,10 @@ public:
void registerExtraResolver(const ResolverFunction &value);
QList<QByteArray> variables() const;
QList<QByteArray> visibleVariables() const;
QString variableDescription(const QByteArray &variable) const;
MacroExpanders subExpanders() const;
AbstractMacroExpander *abstractExpander() const;
QString displayName() const;
void setDisplayName(const QString &displayName);
@@ -98,9 +99,6 @@ public:
void setAccumulating(bool on);
private:
MacroExpander(const MacroExpander &) Q_DECL_EQ_DELETE;
void operator=(const MacroExpander &) Q_DECL_EQ_DELETE;
friend class Internal::MacroExpanderPrivate;
Internal::MacroExpanderPrivate *d;
};

View File

@@ -30,6 +30,7 @@
#include "theme.h"
#include "theme_p.h"
#include "../algorithm.h"
#include "../qtcassert.h"
#include <QApplication>
@@ -80,6 +81,11 @@ Theme::WidgetStyle Theme::widgetStyle() const
return d->widgetStyle;
}
QStringList Theme::preferredStyles() const
{
return d->preferredStyles;
}
bool Theme::flag(Theme::Flag f) const
{
return d->flags[f];
@@ -171,6 +177,7 @@ void Theme::writeSettings(const QString &filename) const
const QMetaObject &m = *metaObject();
{
settings.setValue(QLatin1String("ThemeName"), d->name);
settings.setValue(QLatin1String("PreferredStyles"), d->preferredStyles);
}
{
settings.beginGroup(QLatin1String("Palette"));
@@ -249,6 +256,7 @@ void Theme::readSettings(QSettings &settings)
{
d->name = settings.value(QLatin1String("ThemeName"), QLatin1String("unnamed")).toString();
d->preferredStyles = settings.value(QLatin1String("PreferredStyles")).toStringList();
}
{
settings.beginGroup(QLatin1String("Palette"));

View File

@@ -184,7 +184,8 @@ public:
DrawProgressBarSunken,
DrawIndicatorBranch,
ComboBoxDrawTextShadow,
DerivePaletteFromTheme
DerivePaletteFromTheme,
ApplyThemePaletteGlobally
};
enum WidgetStyle {
@@ -198,6 +199,7 @@ public:
QString imageFile(ImageFile imageFile, const QString &fallBack) const;
QGradientStops gradient(Gradient role) const;
QPalette palette(const QPalette &base) const;
QStringList preferredStyles() const;
QString fileName() const;
void setName(const QString &name);

View File

@@ -46,6 +46,7 @@ public:
QString fileName;
QString name;
QStringList preferredStyles;
QVector<QPair<QColor, QString> > colors;
QVector<QString> imageFiles;
QVector<QGradientStops> gradients;

View File

@@ -111,12 +111,12 @@ void TreeViewComboBox::keyPressEvent(QKeyEvent *e)
setCurrentIndex(indexBelow(m_view->currentIndex()));
} else if (e->key() == Qt::Key_Home) {
QModelIndex index = m_view->model()->index(0, 0);
if (index.isValid() && !model()->flags(index) & Qt::ItemIsSelectable)
if (index.isValid() && !(model()->flags(index) & Qt::ItemIsSelectable))
index = indexBelow(index);
setCurrentIndex(index);
} else if (e->key() == Qt::Key_End) {
QModelIndex index = lastIndex(m_view->rootIndex());
if (index.isValid() && !model()->flags(index) & Qt::ItemIsSelectable)
if (index.isValid() && !(model()->flags(index) & Qt::ItemIsSelectable))
index = indexAbove(index);
setCurrentIndex(index);
} else {

View File

@@ -384,7 +384,7 @@ FileName AndroidConfig::androidToolPath() const
// Java and I've made some progress on it. So if android.exe exists, return that instead.
FileName path = m_sdkLocation;
path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX));
if (path.toFileInfo().exists())
if (path.exists())
return path;
path = m_sdkLocation;
return path.appendPath(QLatin1String("tools/android" ANDROID_BAT_SUFFIX));
@@ -1213,7 +1213,7 @@ static FileName javaHomeForJavac(const FileName &location)
while (tries > 0) {
QDir dir = fileInfo.dir();
dir.cdUp();
if (QFileInfo(dir.filePath(QLatin1String("lib/tools.jar"))).exists())
if (QFileInfo::exists(dir.filePath(QLatin1String("lib/tools.jar"))))
return FileName::fromString(dir.path());
if (fileInfo.isSymLink())
fileInfo.setFile(fileInfo.symLinkTarget());
@@ -1252,7 +1252,7 @@ void AndroidConfigurations::load()
}
} else if (HostOsInfo::isMacHost()) {
QString javaHome = QLatin1String("/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home");
if (QFileInfo(javaHome).exists())
if (QFileInfo::exists(javaHome))
m_config.setOpenJDKLocation(Utils::FileName::fromString(javaHome));
} else if (HostOsInfo::isWindowsHost()) {
QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Javasoft\\Java Development Kit"), QSettings::NativeFormat);
@@ -1275,7 +1275,7 @@ void AndroidConfigurations::load()
settings.beginGroup(version);
QString tmpJavaHome = settings.value(QLatin1String("JavaHome")).toString();
settings.endGroup();
if (!QFileInfo(tmpJavaHome).exists())
if (!QFileInfo::exists(tmpJavaHome))
continue;
major = tmpMajor;
@@ -1299,7 +1299,7 @@ void AndroidConfigurations::load()
void AndroidConfigurations::updateAndroidDevice()
{
DeviceManager * const devMgr = DeviceManager::instance();
if (m_instance->m_config.adbToolPath().toFileInfo().exists())
if (m_instance->m_config.adbToolPath().exists())
devMgr->addDevice(IDevice::Ptr(new Internal::AndroidDevice));
else if (devMgr->find(Constants::ANDROID_DEVICE_ID))
devMgr->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID));

View File

@@ -166,7 +166,7 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
[this](const QString &errorMsg) {
QTC_ASSERT(m_runControl, return);
m_runControl->appendMessage(errorMsg, Utils::DebugFormat);
m_engine->notifyInferiorExited();
QMetaObject::invokeMethod(m_engine, "notifyInferiorExited", Qt::QueuedConnection);
});
connect(m_runner, &AndroidRunner::remoteErrorOutput,

View File

@@ -587,7 +587,7 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const
bool AndroidManager::checkForQt51Files(Utils::FileName fileName)
{
fileName.appendPath(QLatin1String("android")).appendPath(QLatin1String("version.xml"));
if (!fileName.toFileInfo().exists())
if (!fileName.exists())
return false;
QDomDocument dstVersionDoc;
if (!openXmlFile(dstVersionDoc, fileName))
@@ -684,7 +684,7 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
AndroidBuildApkStep *buildApkStep
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).toFileInfo().exists())
if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).exists())
return false;
GradleProperties localProperties;

View File

@@ -1259,7 +1259,7 @@ QIcon AndroidManifestEditorWidget::icon(const QString &baseDir, IconDPI dpi)
void AndroidManifestEditorWidget::copyIcon(IconDPI dpi, const QString &baseDir, const QString &filePath)
{
if (!QFileInfo(filePath).exists())
if (!QFileInfo::exists(filePath))
return;
const QString targetPath = iconPath(baseDir, dpi);

View File

@@ -256,9 +256,9 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
m_ui->gdbWarningLabel->setVisible(false);
if (m_androidConfig.ndkLocation().isEmpty()) {
m_ndkState = NotSet;
} else if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
|| !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
} else if (!platformPath.appendPath(QLatin1String("platforms")).exists()
|| !toolChainPath.appendPath(QLatin1String("toolchains")).exists()
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).exists()) {
m_ndkState = Error;
m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.")
.arg(m_androidConfig.ndkLocation().toUserOutput());
@@ -277,7 +277,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
if (ati.architecture != ProjectExplorer::Abi::ArmArchitecture)
continue;
Utils::FileName gdbPath = m_androidConfig.gdbPath(ati.architecture, ati.version);
if (gdbPath.toFileInfo().exists())
if (gdbPath.exists())
gdbPaths << gdbPath.toString();
}
@@ -325,8 +325,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
} else {
Utils::FileName bin = m_androidConfig.openJDKLocation();
bin.appendPath(QLatin1String("bin/javac" QTC_HOST_EXE_SUFFIX));
if (!m_androidConfig.openJDKLocation().toFileInfo().exists()
|| !bin.toFileInfo().exists())
if (!m_androidConfig.openJDKLocation().exists() || !bin.exists())
m_javaState = Error;
}
}
@@ -407,15 +406,15 @@ bool AndroidSettingsWidget::sdkLocationIsValid() const
Utils::FileName androidExe = m_androidConfig.sdkLocation();
Utils::FileName androidBat = m_androidConfig.sdkLocation();
Utils::FileName emulator = m_androidConfig.sdkLocation();
return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
|| androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
&& emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists();
return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).exists()
|| androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).exists())
&& emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).exists();
}
bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const
{
Utils::FileName adb = m_androidConfig.sdkLocation();
return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists();
return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).exists();
}
void AndroidSettingsWidget::saveSettings()
@@ -477,7 +476,7 @@ void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location)
ant.appendPath(QLatin1String("ant.bat"));
else
ant.appendPath(QLatin1String("ant"));
if (ant.toFileInfo().exists()) {
if (ant.exists()) {
m_androidConfig.setAntLocation(ant);
m_ui->AntLocationPathChooser->setFileName(ant);
}

View File

@@ -122,7 +122,7 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfig::toolsPrefix(targetAbi().architecture()));
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), m_ndkToolChainVersion);
QString javaHome = AndroidConfigurations::currentConfig().openJDKLocation().toString();
if (!javaHome.isEmpty() && QFileInfo(javaHome).exists())
if (!javaHome.isEmpty() && QFileInfo::exists(javaHome))
env.set(QLatin1String("JAVA_HOME"), javaHome);
env.set(QLatin1String("ANDROID_HOME"), AndroidConfigurations::currentConfig().sdkLocation().toString());
env.set(QLatin1String("ANDROID_SDK_ROOT"), AndroidConfigurations::currentConfig().sdkLocation().toString());
@@ -151,13 +151,13 @@ FileName AndroidToolChain::suggestedGdbServer() const
Utils::FileName path = AndroidConfigurations::currentConfig().ndkLocation();
path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver")
.arg(Abi::toString(targetAbi().architecture())));
if (path.toFileInfo().exists())
if (path.exists())
return path;
path = AndroidConfigurations::currentConfig().ndkLocation();
path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
.arg(AndroidConfig::toolchainPrefix(targetAbi().architecture()))
.arg(m_ndkToolChainVersion));
if (path.toFileInfo().exists())
if (path.exists())
return path;
return Utils::FileName();

View File

@@ -173,9 +173,8 @@ void AutoreconfStep::run(QFutureInterface<bool> &interface)
// Check whether we need to run autoreconf
const QString projectDir(bc->target()->project()->projectDirectory().toString());
const QFileInfo configureInfo(projectDir + QLatin1String("/configure"));
if (!configureInfo.exists())
if (!QFileInfo::exists(projectDir + QLatin1String("/configure")))
m_runAutoreconf = true;
if (!m_runAutoreconf) {

View File

@@ -247,6 +247,12 @@ public:
return true;
}
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const
{
Q_UNUSED(state)
return type == TypeRemoved ? BehaviorSilent : BehaviorAsk;
}
bool save(QString *errorString, const QString &fn, bool autoSave)
{
QTC_ASSERT(!autoSave, return true); // bineditor does not support autosave - it would be a bit expensive
@@ -363,8 +369,7 @@ public:
BinEditor(BinEditorWidget *widget)
{
setWidget(widget);
m_widget = widget;
m_file = new BinEditorDocument(m_widget);
m_file = new BinEditorDocument(widget);
m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context.add(Constants::C_BINEDITOR);
m_addressEdit = new QLineEdit;
@@ -387,13 +392,14 @@ public:
widget->setEditor(this);
connect(m_widget, SIGNAL(cursorPositionChanged(int)), SLOT(updateCursorPosition(int)));
connect(widget, SIGNAL(cursorPositionChanged(int)), SLOT(updateCursorPosition(int)));
connect(m_addressEdit, SIGNAL(editingFinished()), SLOT(jumpToAddress()));
connect(m_widget, SIGNAL(modificationChanged(bool)), m_file, SIGNAL(changed()));
updateCursorPosition(m_widget->cursorPosition());
connect(widget, SIGNAL(modificationChanged(bool)), m_file, SIGNAL(changed()));
updateCursorPosition(widget->cursorPosition());
}
~BinEditor() {
~BinEditor()
{
delete m_widget;
}
@@ -407,16 +413,22 @@ public:
private slots:
void updateCursorPosition(int position) {
m_addressEdit->setText(QString::number(m_widget->baseAddress() + position, 16));
m_addressEdit->setText(QString::number(editorWidget()->baseAddress() + position, 16));
}
void jumpToAddress() {
m_widget->jumpToAddress(m_addressEdit->text().toULongLong(0, 16));
updateCursorPosition(m_widget->cursorPosition());
editorWidget()->jumpToAddress(m_addressEdit->text().toULongLong(0, 16));
updateCursorPosition(editorWidget()->cursorPosition());
}
private:
inline BinEditorWidget *editorWidget() const
{
QTC_ASSERT(qobject_cast<BinEditorWidget *>(m_widget.data()), return 0);
return static_cast<BinEditorWidget *>(m_widget.data());
}
private:
BinEditorWidget *m_widget;
BinEditorDocument *m_file;
QToolBar *m_toolBar;
QLineEdit *m_addressEdit;

View File

@@ -61,11 +61,10 @@
#include <QCoreApplication>
#include <QDirIterator>
#include <QLoggingCategory>
#include <QTextCursor>
#include <QTextDocument>
static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1";
using namespace ClangCodeModel;
using namespace ClangCodeModel::Internal;
using namespace CPlusPlus;
@@ -73,6 +72,7 @@ using namespace CppTools;
using namespace TextEditor;
static const char SNIPPET_ICON_PATH[] = ":/texteditor/images/snippet.png";
static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.completion")
namespace {
@@ -170,17 +170,13 @@ static QList<CodeCompletionResult> unfilteredCompletion(const ClangCompletionAss
if (!modifiedInput.isEmpty())
unsavedFiles.insert(fileName, modifiedInput);
QTime t;
if (DebugTiming) {
qDebug() << "Here we go with ClangCompletionAssistProcessor....";
t.start();
}
qCDebug(log) << "Starting completion...";
QTime t; t.start();
QList<CodeCompletionResult> result = wrapper->codeCompleteAt(line, column + 1, unsavedFiles);
::Utils::sort(result);
if (DebugTiming)
qDebug() << "... Completion done in" << t.elapsed() << "ms, with" << result.count() << "items.";
qCDebug(log) << "Completion done in" << t.elapsed() << "ms, with" << result.count() << "items.";
return result;
}
@@ -977,8 +973,7 @@ int ClangCompletionAssistProcessor::startCompletionInternal(const QString fileNa
int l = line, c = column;
Convenience::convertPosition(m_interface->textDocument(), nameStart, &l, &c);
if (DebugTiming)
qDebug()<<"complete constructor or function @" << line<<":"<<column << "->"<<l<<":"<<c;
qCDebug(log)<<"complete constructor or function @" << line<<":"<<column << "->"<<l<<":"<<c;
const QList<CodeCompletionResult> completions = unfilteredCompletion(
m_interface.data(), fileName, l, c, QByteArray(), signalCompletion || slotCompletion);

View File

@@ -40,7 +40,9 @@
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1";
#include <QLoggingCategory>
static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.clangeditordocumentparser")
namespace {
@@ -91,20 +93,16 @@ void ClangEditorDocumentParser::update(CppTools::WorkingCopy workingCopy)
updateProjectPart();
const QStringList options = createOptions(filePath(), projectPart());
QTime t;
if (DebugTiming) {
qDebug("*** Reparse options (cmd line equivalent): %s",
qCDebug(log, "Reparse options (cmd line equivalent): %s",
commandLine(options, filePath()).toUtf8().constData());
t.start();
}
QTime t; t.start();
m_marker->setFileName(filePath());
m_marker->setCompilationOptions(options);
const Internal::UnsavedFiles unsavedFiles = Utils::createUnsavedFiles(workingCopy);
m_marker->reparse(unsavedFiles);
if (DebugTiming)
qDebug() << "*** Reparse took" << t.elapsed() << "ms.";
qCDebug(log) << "Reparse took" << t.elapsed() << "ms.";
}
QList<Diagnostic> ClangEditorDocumentParser::diagnostics() const

View File

@@ -42,7 +42,9 @@
#include <utils/qtcassert.h>
#include <utils/QtConcurrentTools>
static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1";
#include <QLoggingCategory>
static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.clangeditordocumentprocessor")
namespace {
@@ -55,8 +57,7 @@ QList<CppToolsDiagnostic> toCppToolsDiagnostics(
QList<CppToolsDiagnostic> converted;
foreach (const ClangCodeModel::Diagnostic &d, diagnostics) {
if (DebugTiming)
qDebug() << d.severityAsString() << d.location() << d.spelling();
qCDebug(log) << "diagnostic" << d.severityAsString() << d.location() << d.spelling();
if (d.location().fileName() != filePath)
continue;

View File

@@ -41,6 +41,7 @@
#include <QDir>
#include <QFile>
#include <QLoggingCategory>
#include <QSet>
#include <QString>
@@ -49,11 +50,11 @@ using namespace ClangCodeModel::Internal;
using namespace Core;
using namespace CppTools;
static const bool BeVerbose = qgetenv("QTC_CLANG_VERBOSE") == "1";
namespace ClangCodeModel {
namespace Utils {
Q_LOGGING_CATEGORY(verboseRunLog, "qtc.clangcodemodel.verboserun")
namespace {
bool isBlacklisted(const QString &path)
{
@@ -139,7 +140,7 @@ QStringList createClangOptions(const ProjectPart::Ptr &pPart, ProjectFile::Kind
if (pPart.isNull())
return result;
if (BeVerbose)
if (verboseRunLog().isDebugEnabled())
result << QLatin1String("-v");
const bool objcExt = pPart->languageExtensions & ProjectPart::ObjectiveCExtensions;

View File

@@ -36,9 +36,13 @@
#include <cpptools/cppmodelmanager.h>
#include <QLoggingCategory>
namespace ClangCodeModel {
namespace Utils {
Q_DECLARE_LOGGING_CATEGORY(verboseRunLog)
ClangCodeModel::Internal::UnsavedFiles createUnsavedFiles(CppTools::WorkingCopy workingCopy);
QStringList createClangOptions(const CppTools::ProjectPart::Ptr &pPart,

View File

@@ -35,17 +35,18 @@
#include <utils/runextensions.h>
#include <QCoreApplication>
#include <QLoggingCategory>
#include <QMutexLocker>
#include <QThreadPool>
#include <QDebug>
static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1";
using namespace ClangCodeModel;
using namespace ClangCodeModel::Internal;
using namespace CppTools;
static Q_LOGGING_CATEGORY(log, "qtc.clangcodemodel.createmarkers")
CreateMarkers *CreateMarkers::create(SemanticMarker::Ptr semanticMarker,
const QString &fileName,
unsigned firstLine, unsigned lastLine)
@@ -79,11 +80,9 @@ void CreateMarkers::run()
if (isCanceled())
return;
QTime t;
if (DebugTiming) {
qDebug() << "*** Highlighting from" << m_firstLine << "to" << m_lastLine << "of" << m_fileName;
t.start();
}
qCDebug(log) << "Creating markers from" << m_firstLine << "to" << m_lastLine
<< "of" << m_fileName;
QTime t; t.start();
m_usages.clear();
@@ -105,10 +104,7 @@ void CreateMarkers::run()
flush();
reportFinished();
if (DebugTiming) {
qDebug() << "*** Highlighting took" << t.elapsed() << "ms in total.";
t.restart();
}
qCDebug(log) << "Creating markers took" << t.elapsed() << "ms in total.";
}
void CreateMarkers::addUse(const SourceMarker &marker)

View File

@@ -29,6 +29,8 @@
****************************************************************************/
#include "unit.h"
#include "clangutils.h"
#include "unsavedfiledata.h"
#include "utils_p.h"
@@ -47,8 +49,6 @@ static QBasicAtomicInt unitDataCount = Q_BASIC_ATOMIC_INITIALIZER(0);
using namespace ClangCodeModel;
using namespace ClangCodeModel::Internal;
static const int DisplayDiagnostics = (qgetenv("QTC_CLANG_VERBOSE") == "1") ? 1 : 0;
Unit::Unit()
: m_index(0)
, m_tu(0)
@@ -56,7 +56,7 @@ Unit::Unit()
{}
Unit::Unit(const QString &fileName)
: m_index(clang_createIndex(/*excludeDeclsFromPCH*/ 1, DisplayDiagnostics))
: m_index(clang_createIndex(/*excludeDeclsFromPCH*/ 1, Utils::verboseRunLog().isDebugEnabled()))
, m_tu(0)
, m_fileName(fileName.toUtf8())
, m_managementOptions(0)

View File

@@ -219,7 +219,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
if (fi.isDir()) {
QDir subDir(fi.absoluteFilePath());
QString subProject = subDir.filePath(QLatin1String("CMakeLists.txt"));
if (QFileInfo(subProject).exists())
if (QFileInfo::exists(subProject))
fileName = subProject;
else
return link;

View File

@@ -147,10 +147,7 @@ CMakeManager *CMakeOpenProjectWizard::cmakeManager() const
bool CMakeOpenProjectWizard::hasInSourceBuild() const
{
QFileInfo fi(m_sourceDirectory + QLatin1String("/CMakeCache.txt"));
if (fi.exists())
return true;
return false;
return QFileInfo::exists(m_sourceDirectory + QLatin1String("/CMakeCache.txt"));
}
bool CMakeOpenProjectWizard::compatibleKitExist() const

View File

@@ -586,7 +586,7 @@ QString CMakeProject::uiHeaderFile(const QString &uiFile)
while (baseDirectory.isChildOf(project)) {
Utils::FileName cmakeListsTxt = baseDirectory;
cmakeListsTxt.appendPath(QLatin1String("CMakeLists.txt"));
if (cmakeListsTxt.toFileInfo().exists())
if (cmakeListsTxt.exists())
break;
QDir dir(baseDirectory.toString());
dir.cdUp();
@@ -875,12 +875,16 @@ void CMakeCbpParser::sortFiles()
} else {
int bestLength = -1;
int bestIndex = -1;
int bestIncludeCount = -1;
for (int i = 0; i < m_buildTargets.size(); ++i) {
const CMakeBuildTarget &target = m_buildTargets.at(i);
if (fileName.isChildOf(Utils::FileName::fromString(target.sourceDirectory))
&& target.sourceDirectory.size() > bestLength) {
if (fileName.isChildOf(Utils::FileName::fromString(target.sourceDirectory)) &&
(target.sourceDirectory.size() > bestLength ||
(target.sourceDirectory.size() == bestLength &&
target.includeFiles.count() > bestIncludeCount))) {
bestLength = target.sourceDirectory.size();
bestIncludeCount = target.includeFiles.count();
bestIndex = i;
}
}

View File

@@ -254,7 +254,7 @@ Command *ActionManager::registerAction(QAction *action, Id id, const Context &co
if (a) {
a->addOverrideAction(action, context, scriptable);
emit m_instance->commandListChanged();
emit m_instance->commandAdded(id.toString());
emit m_instance->commandAdded(id);
}
return a;
}

View File

@@ -73,7 +73,7 @@ public:
signals:
void commandListChanged();
void commandAdded(const QString &id);
void commandAdded(Core::Id id);
private:
ActionManager(QObject *parent = 0);

View File

@@ -421,18 +421,22 @@ bool Action::hasAttribute(Command::CommandAttribute attr) const
}
void Command::augmentActionWithShortcutToolTip(QAction *a) const
{
a->setToolTip(stringWithAppendedShortcut(a->text()));
QObject::connect(this, &Core::Command::keySequenceChanged, a, [this, a]() {
a->setToolTip(stringWithAppendedShortcut(a->text()));
});
QObject::connect(a, &QAction::changed, this, [this, a]() {
a->setToolTip(stringWithAppendedShortcut(a->text()));
});
}
QToolButton *Command::toolButtonWithAppendedShortcut(QAction *action, Command *cmd)
{
QToolButton *button = new QToolButton;
button->setDefaultAction(action);
if (cmd) {
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
QObject::connect(cmd, &Core::Command::keySequenceChanged, action, [cmd, action]() {
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
});
QObject::connect(action, &QAction::changed, cmd, [cmd, action]() {
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
});
}
if (cmd)
cmd->augmentActionWithShortcutToolTip(action);
return button;
}

View File

@@ -88,6 +88,7 @@ public:
virtual void setKeySequence(const QKeySequence &key) = 0;
virtual QString stringWithAppendedShortcut(const QString &str) const = 0;
void augmentActionWithShortcutToolTip(QAction *action) const;
static QToolButton *toolButtonWithAppendedShortcut(QAction *action, Command *cmd);
virtual bool isScriptable() const = 0;

View File

@@ -379,9 +379,9 @@ BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(Ge
static const QString symLinkMsg = tr("[symbolic link]");
foreach (const GeneratedFile &file, *files) {
const QFileInfo fi(file.path());
if (fi.exists())
existingFiles.append(file.path());
const QString path = file.path();
if (QFileInfo::exists(path))
existingFiles.append(path);
}
if (existingFiles.isEmpty())
return OverwriteOk;

View File

@@ -131,6 +131,8 @@ void CorePlugin::parseArguments(const QStringList &arguments)
Theme *theme = new Theme(qApp);
theme->readSettings(themeSettings);
setCreatorTheme(theme);
if (theme->flag(Theme::ApplyThemePaletteGlobally))
QApplication::setPalette(creatorTheme()->palette(QApplication::palette()));
// defer creation of these widgets until here,
// because they need a valid theme set

View File

@@ -679,8 +679,7 @@ void EditorManagerPrivate::doEscapeKeyFocusMoveMagic()
if (findPane && findPane->isVisible() && findPane->isUsedByWidget(focus)) {
findPane->hide();
stuffHidden = true;
}
if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
} else if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
QWidget *outputPane = OutputPanePlaceHolder::getCurrent();
if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) {
OutputPaneManager::instance()->slotHide();
@@ -691,6 +690,10 @@ void EditorManagerPrivate::doEscapeKeyFocusMoveMagic()
RightPaneWidget::instance()->setShown(false);
stuffHidden = true;
}
if (findPane && findPane->isVisible() && findPane->window() == activeWindow) {
findPane->hide();
stuffHidden = true;
}
}
if (stuffHidden)
return;

View File

@@ -72,9 +72,9 @@ bool CurrentDocumentFind::isEnabled() const
return m_currentFind && (!m_currentWidget || m_currentWidget->isVisible());
}
bool CurrentDocumentFind::candidateIsEnabled() const
IFindSupport *CurrentDocumentFind::candidate() const
{
return (m_candidateFind != 0);
return m_candidateFind;
}
bool CurrentDocumentFind::supportsReplace() const

View File

@@ -53,7 +53,7 @@ public:
QString completedFindString() const;
bool isEnabled() const;
bool candidateIsEnabled() const;
IFindSupport *candidate() const;
void highlightAll(const QString &txt, FindFlags findFlags);
IFindSupport::Result findIncremental(const QString &txt, FindFlags findFlags);
IFindSupport::Result findStep(const QString &txt, FindFlags findFlags);

View File

@@ -181,7 +181,6 @@ void FindPlugin::openFindFilter()
void FindPlugin::openFindDialog(IFindFilter *filter)
{
if (d->m_currentDocumentFind->candidateIsEnabled())
d->m_currentDocumentFind->acceptCandidate();
const QString currentFindString =
d->m_currentDocumentFind->isEnabled() ?

View File

@@ -144,6 +144,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
// register actions
Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::Context findcontext(Constants::C_FINDTOOLBAR);
Core::ActionContainer *mfind = Core::ActionManager::actionContainer(Constants::M_FIND);
Core::Command *cmd;
@@ -151,7 +152,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_goToCurrentFindAction = new QAction(this);
Core::ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR,
Context(Constants::C_FINDTOOLBAR));
findcontext);
connect(m_goToCurrentFindAction, SIGNAL(triggered()), this, SLOT(setFocusToCurrentFindSupport()));
QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace"));
@@ -161,6 +162,14 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT);
connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind()));
// Pressing the find shortcut while focus is in the tool bar should not change the search text,
// so register a different find action for the tool bar
auto localFindAction = new QAction(this);
cmd = ActionManager::registerAction(localFindAction, Constants::FIND_IN_DOCUMENT, findcontext);
connect(localFindAction, &QAction::triggered, this, [this]() {
openFindToolBar(FindToolBar::OpenFlags(UpdateAll & ~UpdateFindText));
});
if (QApplication::clipboard()->supportsFindBuffer()) {
m_enterFindStringAction = new QAction(tr("Enter Find String"), this);
cmd = Core::ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext);
@@ -174,15 +183,23 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
cmd = Core::ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::FindNext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeFindNext()));
m_ui.findNextButton->setDefaultAction(cmd->action());
connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeGlobalFindNext()));
m_localFindNextAction = new QAction(m_findNextAction->text(), this);
cmd = ActionManager::registerAction(m_localFindNextAction, Constants::FIND_NEXT, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localFindNextAction);
connect(m_localFindNextAction, &QAction::triggered, this, &FindToolBar::invokeFindNext);
m_ui.findNextButton->setDefaultAction(m_localFindNextAction);
m_findPreviousAction = new QAction(tr("Find Previous"), this);
cmd = Core::ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::FindPrevious);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeFindPrevious()));
m_ui.findPreviousButton->setDefaultAction(cmd->action());
connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeGlobalFindPrevious()));
m_localFindPreviousAction = new QAction(m_findPreviousAction->text(), this);
cmd = ActionManager::registerAction(m_localFindPreviousAction, Constants::FIND_PREVIOUS, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localFindPreviousAction);
connect(m_localFindPreviousAction, &QAction::triggered, this, &FindToolBar::invokeFindPrevious);
m_ui.findPreviousButton->setDefaultAction(m_localFindPreviousAction);
m_findNextSelectedAction = new QAction(tr("Find Next (Selected)"), this);
cmd = Core::ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext);
@@ -200,29 +217,43 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
cmd = Core::ActionManager::registerAction(m_replaceAction, Constants::REPLACE, globalcontext);
cmd->setDefaultKeySequence(QKeySequence());
mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeReplace()));
m_ui.replaceButton->setDefaultAction(cmd->action());
connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplace()));
m_localReplaceAction = new QAction(m_replaceAction->text(), this);
cmd = ActionManager::registerAction(m_localReplaceAction, Constants::REPLACE, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localReplaceAction);
connect(m_localReplaceAction, &QAction::triggered, this, &FindToolBar::invokeReplace);
m_ui.replaceButton->setDefaultAction(m_localReplaceAction);
m_replaceNextAction = new QAction(tr("Replace && Find"), this);
m_replaceNextAction->setIconText(tr("Replace && Find")); // work around bug in Qt that kills ampersands in tool button
cmd = Core::ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+=")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeReplaceNext()));
m_ui.replaceNextButton->setDefaultAction(cmd->action());
connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplaceNext()));
m_localReplaceNextAction = new QAction(m_replaceNextAction->text(), this);
cmd = ActionManager::registerAction(m_localReplaceNextAction, Constants::REPLACE_NEXT, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localReplaceNextAction);
connect(m_localReplaceNextAction, &QAction::triggered, this, &FindToolBar::invokeReplaceNext);
m_ui.replaceNextButton->setDefaultAction(m_localReplaceNextAction);
m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this);
cmd = Core::ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext);
// shortcut removed, clashes with Ctrl++ on many keyboard layouts
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+=")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeReplacePrevious()));
connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplacePrevious()));
m_localReplacePreviousAction = new QAction(m_replacePreviousAction->text(), this);
cmd = ActionManager::registerAction(m_localReplacePreviousAction, Constants::REPLACE_PREVIOUS, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localReplacePreviousAction);
connect(m_localReplacePreviousAction, &QAction::triggered, this, &FindToolBar::invokeReplacePrevious);
m_replaceAllAction = new QAction(tr("Replace All"), this);
cmd = Core::ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeReplaceAll()));
m_ui.replaceAllButton->setDefaultAction(cmd->action());
connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplaceAll()));
m_localReplaceAllAction = new QAction(m_replaceAllAction->text(), this);
cmd = ActionManager::registerAction(m_localReplaceAllAction, Constants::REPLACE_ALL, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localReplaceAllAction);
connect(m_localReplaceAllAction, &QAction::triggered, this, &FindToolBar::invokeReplaceAll);
m_ui.replaceAllButton->setDefaultAction(m_localReplaceAllAction);
m_caseSensitiveAction = new QAction(tr("Case Sensitive"), this);
m_caseSensitiveAction->setIcon(QIcon(QLatin1String(":/find/images/casesensitively.png")));
@@ -256,8 +287,13 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_preserveCaseAction, SIGNAL(toggled(bool)), this, SLOT(setPreserveCase(bool)));
connect(m_currentDocumentFind, SIGNAL(candidateChanged()), this, SLOT(adaptToCandidate()));
connect(m_currentDocumentFind, SIGNAL(changed()), this, SLOT(updateToolBar()));
connect(m_currentDocumentFind, &CurrentDocumentFind::candidateChanged,
this, &FindToolBar::adaptToCandidate);
connect(m_currentDocumentFind, &CurrentDocumentFind::changed,
this, &FindToolBar::updateGlobalActions);
connect(m_currentDocumentFind, &CurrentDocumentFind::changed,
this, &FindToolBar::updateToolBar);
updateGlobalActions();
updateToolBar();
m_findIncrementalTimer.setSingleShot(true);
@@ -326,7 +362,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
void FindToolBar::adaptToCandidate()
{
updateFindAction();
updateGlobalActions();
if (findToolBarPlaceHolder() == Core::FindToolBarPlaceHolder::getCurrent()) {
m_currentDocumentFind->acceptCandidate();
if (isVisible())
@@ -334,14 +370,22 @@ void FindToolBar::adaptToCandidate()
}
}
void FindToolBar::updateFindAction()
void FindToolBar::updateGlobalActions()
{
bool enabled = m_currentDocumentFind->candidateIsEnabled();
m_findInDocumentAction->setEnabled((toolBarHasFocus() && isEnabled()) || enabled);
IFindSupport *candidate = m_currentDocumentFind->candidate();
bool enabled = (candidate != 0);
bool replaceEnabled = enabled && candidate->supportsReplace();
m_findInDocumentAction->setEnabled(enabled || (toolBarHasFocus() && isEnabled()));
m_findNextSelectedAction->setEnabled(enabled);
m_findPreviousSelectedAction->setEnabled(enabled);
if (QApplication::clipboard()->supportsFindBuffer())
m_enterFindStringAction->setEnabled(enabled);
m_findNextAction->setEnabled(enabled);
m_findPreviousAction->setEnabled(enabled);
m_replaceAction->setEnabled(replaceEnabled);
m_replaceNextAction->setEnabled(replaceEnabled);
m_replacePreviousAction->setEnabled(replaceEnabled);
m_replaceAllAction->setEnabled(replaceEnabled);
}
void FindToolBar::updateToolBar()
@@ -350,13 +394,13 @@ void FindToolBar::updateToolBar()
bool replaceEnabled = enabled && m_currentDocumentFind->supportsReplace();
bool showAllControls = canShowAllControls(replaceEnabled);
m_findNextAction->setEnabled(enabled);
m_findPreviousAction->setEnabled(enabled);
m_localFindNextAction->setEnabled(enabled);
m_localFindPreviousAction->setEnabled(enabled);
m_replaceAction->setEnabled(replaceEnabled);
m_replaceNextAction->setEnabled(replaceEnabled);
m_replacePreviousAction->setEnabled(replaceEnabled);
m_replaceAllAction->setEnabled(replaceEnabled);
m_localReplaceAction->setEnabled(replaceEnabled);
m_localReplacePreviousAction->setEnabled(replaceEnabled);
m_localReplaceNextAction->setEnabled(replaceEnabled);
m_localReplaceAllAction->setEnabled(replaceEnabled);
m_caseSensitiveAction->setEnabled(enabled);
m_wholeWordAction->setEnabled(enabled);
@@ -419,12 +463,24 @@ void FindToolBar::invokeFindNext()
invokeFindStep();
}
void FindToolBar::invokeGlobalFindNext()
{
acceptCandidateAndMoveToolBar();
invokeFindNext();
}
void FindToolBar::invokeFindPrevious()
{
setFindFlag(FindBackward, true);
invokeFindStep();
}
void FindToolBar::invokeGlobalFindPrevious()
{
acceptCandidateAndMoveToolBar();
invokeFindPrevious();
}
QString FindToolBar::getFindText()
{
return m_ui.findEdit->text();
@@ -488,18 +544,36 @@ void FindToolBar::invokeReplace()
}
}
void FindToolBar::invokeGlobalReplace()
{
acceptCandidateAndMoveToolBar();
invokeReplace();
}
void FindToolBar::invokeReplaceNext()
{
setFindFlag(FindBackward, false);
invokeReplaceStep();
}
void FindToolBar::invokeGlobalReplaceNext()
{
acceptCandidateAndMoveToolBar();
invokeReplaceNext();
}
void FindToolBar::invokeReplacePrevious()
{
setFindFlag(FindBackward, true);
invokeReplaceStep();
}
void FindToolBar::invokeGlobalReplacePrevious()
{
acceptCandidateAndMoveToolBar();
invokeReplacePrevious();
}
void FindToolBar::invokeReplaceStep()
{
if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) {
@@ -517,6 +591,12 @@ void FindToolBar::invokeReplaceAll()
m_currentDocumentFind->replaceAll(getFindText(), getReplaceText(), effectiveFindFlags());
}
void FindToolBar::invokeGlobalReplaceAll()
{
acceptCandidateAndMoveToolBar();
invokeReplaceAll();
}
void FindToolBar::invokeResetIncrementalSearch()
{
m_findIncrementalTimer.stop();
@@ -531,7 +611,6 @@ void FindToolBar::putSelectionToFindClipboard()
openFind(false);
const QString text = m_currentDocumentFind->currentFindString();
QApplication::clipboard()->setText(text, QClipboard::FindBuffer);
setFindText(text);
}
@@ -666,13 +745,37 @@ bool FindToolBar::canShowAllControls(bool replaceIsVisible) const
return fullWidth - replaceFixedWidth >= MINIMUM_WIDTH_FOR_COMPLEX_LAYOUT;
}
/*!
Accepts the candidate find of the current focus widget (if any), and moves the tool bar
there, if it was visible before.
*/
void FindToolBar::acceptCandidateAndMoveToolBar()
{
if (!m_currentDocumentFind->candidate())
return;
if (isVisible()) {
openFindToolBar(UpdateHighlight);
} else {
// Make sure we are really hidden, and not just because our parent was hidden.
// Otherwise when the tool bar gets visible again, it will be in a different widget than
// the current document find it acts on.
// Test case: Open find in navigation side bar, hide side bar, click into editor,
// trigger find next, show side bar
hide();
m_currentDocumentFind->acceptCandidate();
}
}
void FindToolBar::openFind(bool focus)
{
setBackward(false);
openFindToolBar(focus);
OpenFlags flags = UpdateAll;
if (!focus) // remove focus flag
flags = flags & ~UpdateFocusAndSelect;
openFindToolBar(flags);
}
void FindToolBar::openFindToolBar(bool focus)
void FindToolBar::openFindToolBar(OpenFlags flags)
{
installEventFilters();
Core::FindToolBarPlaceHolder *holder = findToolBarPlaceHolder();
@@ -690,28 +793,31 @@ void FindToolBar::openFindToolBar(bool focus)
setVisible(true);
// We do not want to change the text when we currently have the focus and user presses the
// find shortcut
if (!focus || !toolBarHasFocus()) {
// if (!focus || !toolBarHasFocus()) {
if (flags & UpdateFindText) {
QString text = m_currentDocumentFind->currentFindString();
if (!text.isEmpty())
setFindText(text);
}
if (focus)
if (flags & UpdateFocusAndSelect)
setFocus();
if (flags & UpdateFindScope)
m_currentDocumentFind->defineFindScope();
if (flags & UpdateHighlight)
m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags());
if (focus)
if (flags & UpdateFocusAndSelect)
selectFindText();
}
void FindToolBar::findNextSelected()
{
openFind(false);
openFindToolBar(OpenFlags(UpdateAll & ~UpdateFocusAndSelect));
invokeFindNext();
}
void FindToolBar::findPreviousSelected()
{
openFind(false);
openFindToolBar(OpenFlags(UpdateAll & ~UpdateFocusAndSelect));
invokeFindPrevious();
}

View File

@@ -75,13 +75,22 @@ class FindToolBar : public Utils::StyledBar
Q_OBJECT
public:
enum OpenFlag {
UpdateFocusAndSelect = 0x01,
UpdateFindScope = 0x02,
UpdateFindText = 0x04,
UpdateHighlight = 0x08,
UpdateAll = 0x0F
};
Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
explicit FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumentFind);
~FindToolBar();
void readSettings();
void writeSettings();
void openFindToolBar(bool focus = true);
void openFindToolBar(OpenFlags flags = UpdateAll);
void setUseFakeVim(bool on);
void setLightColoredIcon(bool lightColored);
@@ -90,13 +99,19 @@ public slots:
private slots:
void invokeFindNext();
void invokeGlobalFindNext();
void invokeFindPrevious();
void invokeGlobalFindPrevious();
void invokeFindStep();
void invokeReplace();
void invokeGlobalReplace();
void invokeReplaceNext();
void invokeGlobalReplaceNext();
void invokeReplacePrevious();
void invokeGlobalReplacePrevious();
void invokeReplaceStep();
void invokeReplaceAll();
void invokeGlobalReplaceAll();
void invokeResetIncrementalSearch();
void invokeFindIncremental();
@@ -109,7 +124,7 @@ private slots:
void openFind(bool focus = true);
void findNextSelected();
void findPreviousSelected();
void updateFindAction();
void updateGlobalActions();
void updateToolBar();
void findFlagsChanged();
void findEditButtonClicked();
@@ -136,6 +151,7 @@ private:
Core::FindToolBarPlaceHolder *findToolBarPlaceHolder() const;
bool toolBarHasFocus() const;
bool canShowAllControls(bool replaceIsVisible) const;
void acceptCandidateAndMoveToolBar();
bool eventFilter(QObject *obj, QEvent *event);
void setFindText(const QString &text);
@@ -165,6 +181,14 @@ private:
QAction *m_wholeWordAction;
QAction *m_regularExpressionAction;
QAction *m_preserveCaseAction;
QAction *m_localFindNextAction;
QAction *m_localFindPreviousAction;
QAction *m_localReplaceAction;
QAction *m_localReplaceNextAction;
QAction *m_localReplacePreviousAction;
QAction *m_localReplaceAllAction;
FindFlags m_findFlags;
QTimer m_findIncrementalTimer;

View File

@@ -441,7 +441,7 @@ void HelpManager::verifyDocumenation()
{
const QStringList &registeredDocs = d->m_helpEngine->registeredDocumentations();
foreach (const QString &nameSpace, registeredDocs) {
if (!QFileInfo(d->m_helpEngine->documentationFileName(nameSpace)).exists())
if (!QFileInfo::exists(d->m_helpEngine->documentationFileName(nameSpace)))
d->m_nameSpacesToUnregister.append(nameSpace);
}
}

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