Merge "Merge remote-tracking branch 'origin/7.0'"

This commit is contained in:
The Qt Project
2022-02-14 12:53:55 +00:00
37 changed files with 404 additions and 165 deletions

View File

@@ -7,7 +7,7 @@ on:
- 'doc/**' - 'doc/**'
env: env:
QT_VERSION: 6.2.1 QT_VERSION: 6.2.3
CLANG_VERSION: 130 CLANG_VERSION: 130
ELFUTILS_VERSION: 0.175 ELFUTILS_VERSION: 0.175
CMAKE_VERSION: 3.21.1 CMAKE_VERSION: 3.21.1
@@ -31,12 +31,12 @@ jobs:
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
is_msvc: true is_msvc: true
} }
- { # - {
name: "Windows Latest MinGW", artifact: "Windows-MinGW", # name: "Windows Latest MinGW", artifact: "Windows-MinGW",
os: windows-latest, # os: windows-latest,
cc: "gcc", cxx: "g++", # cc: "gcc", cxx: "g++",
is_msvc: false # is_msvc: false
} # }
- { - {
name: "Ubuntu Latest GCC", artifact: "Linux", name: "Ubuntu Latest GCC", artifact: "Linux",
os: ubuntu-latest, os: ubuntu-latest,
@@ -123,22 +123,22 @@ jobs:
if ("x${{ matrix.config.environment_script }}" STREQUAL "x") if ("x${{ matrix.config.environment_script }}" STREQUAL "x")
set(qt_package_arch_suffix "win64_mingw81") set(qt_package_arch_suffix "win64_mingw81")
set(qt_dir_prefix "${qt_version}/mingw81_64") set(qt_dir_prefix "${qt_version}/mingw81_64")
set(qt_package_suffix "-Windows-Windows_10-Mingw-Windows-Windows_10-X86_64") set(qt_package_suffix "-Windows-Windows_10_21H2-Mingw-Windows-Windows_10_21H2-X86_64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat") elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
set(qt_package_arch_suffix "win64_msvc2019_64") set(qt_package_arch_suffix "win64_msvc2019_64")
set(qt_dir_prefix "${qt_version}/msvc2019_64") set(qt_dir_prefix "${qt_version}/msvc2019_64")
set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64") set(qt_package_suffix "-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64")
endif() endif()
elseif ("${{ runner.os }}" STREQUAL "Linux") elseif ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64") set(url_os "linux_x64")
set(qt_package_arch_suffix "gcc_64") set(qt_package_arch_suffix "gcc_64")
set(qt_dir_prefix "${qt_version}/gcc_64") set(qt_dir_prefix "${qt_version}/gcc_64")
set(qt_package_suffix "-Linux-RHEL_8_2-GCC-Linux-RHEL_8_2-X86_64") set(qt_package_suffix "-Linux-RHEL_8_4-GCC-Linux-RHEL_8_4-X86_64")
elseif ("${{ runner.os }}" STREQUAL "macOS") elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64") set(url_os "mac_x64")
set(qt_package_arch_suffix "clang_64") set(qt_package_arch_suffix "clang_64")
set(qt_dir_prefix "${qt_version}/macos") set(qt_dir_prefix "${qt_version}/macos")
set(qt_package_suffix "-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64-ARM64") set(qt_package_suffix "-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64")
endif() endif()
set(qt_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}") set(qt_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}")
@@ -673,10 +673,10 @@ jobs:
name: "Windows Latest MSVC", artifact: "Windows-MSVC", name: "Windows Latest MSVC", artifact: "Windows-MSVC",
os: ubuntu-latest os: ubuntu-latest
} }
- { # - {
name: "Windows Latest MinGW", artifact: "Windows-MinGW", # name: "Windows Latest MinGW", artifact: "Windows-MinGW",
os: ubuntu-latest # os: ubuntu-latest
} # }
- { - {
name: "Ubuntu Latest GCC", artifact: "Linux", name: "Ubuntu Latest GCC", artifact: "Linux",
os: ubuntu-latest os: ubuntu-latest

View File

@@ -7,7 +7,7 @@ instructions:
variableValue: "RelWithDebInfo" variableValue: "RelWithDebInfo"
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: QTC_QT_BASE_URL variableName: QTC_QT_BASE_URL
variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.2/6.2.0-final-released/" variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.2/6.2.3-final-released/Qt6.2.3"
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: QTC_QT_MODULES variableName: QTC_QT_MODULES
variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations" variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations"

View File

@@ -32,7 +32,7 @@ instructions:
property: host.os property: host.os
in_values: [MacOS, Linux, Windows] in_values: [MacOS, Linux, Windows]
- type: ExecuteCommand - type: ExecuteCommand
command: "python -u {{.AgentWorkingDir}}/build/qtsdk/packaging-tools/install_qt.py --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --temp-path {{.AgentWorkingDir}}/build/qt_temp --base-url {{.Env.QTC_QT_BASE_URL}} --base-url-postfix=-Linux-RHEL_8_2-GCC-Linux-RHEL_8_2-X86_64.7z --icu7z http://master.qt.io/development_releases/prebuilt/icu/prebuilt/56.1/icu-linux-g++-Rhel7.2-x64.7z {{.Env.QTC_QT_MODULES}}" command: "python -u {{.AgentWorkingDir}}/build/qtsdk/packaging-tools/install_qt.py --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --temp-path {{.AgentWorkingDir}}/build/qt_temp --base-url {{.Env.QTC_QT_BASE_URL}} --base-url-postfix=-Linux-RHEL_8_4-GCC-Linux-RHEL_8_4-X86_64.7z --icu7z http://master.qt.io/development_releases/prebuilt/icu/prebuilt/56.1/icu-linux-g++-Rhel7.2-x64.7z {{.Env.QTC_QT_MODULES}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
maxTimeInSeconds: 3600 maxTimeInSeconds: 3600
maxTimeBetweenOutput: 360 maxTimeBetweenOutput: 360
@@ -42,7 +42,7 @@ instructions:
property: host.os property: host.os
equals_value: Linux equals_value: Linux
- type: ExecuteCommand - type: ExecuteCommand
command: "python -u {{.AgentWorkingDir}}/build/qtsdk/packaging-tools/install_qt.py --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --temp-path {{.AgentWorkingDir}}/build/qt_temp --base-url {{.Env.QTC_QT_BASE_URL}} --base-url-postfix=-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64-ARM64.7z {{.Env.QTC_QT_MODULES}}" command: "python -u {{.AgentWorkingDir}}/build/qtsdk/packaging-tools/install_qt.py --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --temp-path {{.AgentWorkingDir}}/build/qt_temp --base-url {{.Env.QTC_QT_BASE_URL}} --base-url-postfix=-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64.7z {{.Env.QTC_QT_MODULES}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
maxTimeInSeconds: 3600 maxTimeInSeconds: 3600
maxTimeBetweenOutput: 360 maxTimeBetweenOutput: 360

View File

@@ -179,6 +179,8 @@ QImage Quick3DNodeInstance::renderPreviewImage(const QSize &previewImageSize) co
return transparentImage; return transparentImage;
} }
} }
#else
Q_UNUSED(previewImageSize)
#endif #endif
return {}; return {};
} }

View File

@@ -96,90 +96,93 @@ QtObject {
readonly property string distributeSpacingVertical: "\u005B" readonly property string distributeSpacingVertical: "\u005B"
readonly property string distributeTop: "\u005C" readonly property string distributeTop: "\u005C"
readonly property string download: "\u005D" readonly property string download: "\u005D"
readonly property string edit: "\u005E" readonly property string downloadUnavailable: "\u005E"
readonly property string eyeDropper: "\u005F" readonly property string downloadUpdate: "\u005F"
readonly property string favorite: "\u0060" readonly property string downloaded: "\u0060"
readonly property string flowAction: "\u0061" readonly property string edit: "\u0061"
readonly property string flowTransition: "\u0062" readonly property string eyeDropper: "\u0062"
readonly property string fontStyleBold: "\u0063" readonly property string favorite: "\u0063"
readonly property string fontStyleItalic: "\u0064" readonly property string flowAction: "\u0064"
readonly property string fontStyleStrikethrough: "\u0065" readonly property string flowTransition: "\u0065"
readonly property string fontStyleUnderline: "\u0066" readonly property string fontStyleBold: "\u0066"
readonly property string gradient: "\u0067" readonly property string fontStyleItalic: "\u0067"
readonly property string gridView: "\u0068" readonly property string fontStyleStrikethrough: "\u0068"
readonly property string idAliasOff: "\u0069" readonly property string fontStyleUnderline: "\u0069"
readonly property string idAliasOn: "\u006A" readonly property string gradient: "\u006A"
readonly property string infinity: "\u006B" readonly property string gridView: "\u006B"
readonly property string keyframe: "\u006C" readonly property string idAliasOff: "\u006C"
readonly property string linkTriangle: "\u006D" readonly property string idAliasOn: "\u006D"
readonly property string linked: "\u006E" readonly property string infinity: "\u006E"
readonly property string listView: "\u006F" readonly property string keyframe: "\u006F"
readonly property string lockOff: "\u0070" readonly property string linkTriangle: "\u0070"
readonly property string lockOn: "\u0071" readonly property string linked: "\u0071"
readonly property string mergeCells: "\u0072" readonly property string listView: "\u0072"
readonly property string minus: "\u0073" readonly property string lockOff: "\u0073"
readonly property string mirror: "\u0074" readonly property string lockOn: "\u0074"
readonly property string orientation: "\u0075" readonly property string mergeCells: "\u0075"
readonly property string paddingEdge: "\u0076" readonly property string minus: "\u0076"
readonly property string paddingFrame: "\u0077" readonly property string mirror: "\u0077"
readonly property string pasteStyle: "\u0078" readonly property string orientation: "\u0078"
readonly property string pause: "\u0079" readonly property string paddingEdge: "\u0079"
readonly property string pin: "\u007A" readonly property string paddingFrame: "\u007A"
readonly property string play: "\u007B" readonly property string pasteStyle: "\u007B"
readonly property string plus: "\u007C" readonly property string pause: "\u007C"
readonly property string promote: "\u007D" readonly property string pin: "\u007D"
readonly property string readOnly: "\u007E" readonly property string play: "\u007E"
readonly property string redo: "\u007F" readonly property string plus: "\u007F"
readonly property string rotationFill: "\u0080" readonly property string promote: "\u0080"
readonly property string rotationOutline: "\u0081" readonly property string readOnly: "\u0081"
readonly property string search: "\u0082" readonly property string redo: "\u0082"
readonly property string sectionToggle: "\u0083" readonly property string rotationFill: "\u0083"
readonly property string splitColumns: "\u0084" readonly property string rotationOutline: "\u0084"
readonly property string splitRows: "\u0085" readonly property string search: "\u0085"
readonly property string startNode: "\u0086" readonly property string sectionToggle: "\u0086"
readonly property string testIcon: "\u0087" readonly property string splitColumns: "\u0087"
readonly property string textAlignBottom: "\u0088" readonly property string splitRows: "\u0088"
readonly property string textAlignCenter: "\u0089" readonly property string startNode: "\u0089"
readonly property string textAlignJustified: "\u008A" readonly property string testIcon: "\u008A"
readonly property string textAlignLeft: "\u008B" readonly property string textAlignBottom: "\u008B"
readonly property string textAlignMiddle: "\u008C" readonly property string textAlignCenter: "\u008C"
readonly property string textAlignRight: "\u008D" readonly property string textAlignJustified: "\u008D"
readonly property string textAlignTop: "\u008E" readonly property string textAlignLeft: "\u008E"
readonly property string textBulletList: "\u008F" readonly property string textAlignMiddle: "\u008F"
readonly property string textFullJustification: "\u0090" readonly property string textAlignRight: "\u0090"
readonly property string textNumberedList: "\u0091" readonly property string textAlignTop: "\u0091"
readonly property string tickIcon: "\u0092" readonly property string textBulletList: "\u0092"
readonly property string translationCreateFiles: "\u0093" readonly property string textFullJustification: "\u0093"
readonly property string translationCreateReport: "\u0094" readonly property string textNumberedList: "\u0094"
readonly property string translationExport: "\u0095" readonly property string tickIcon: "\u0095"
readonly property string translationImport: "\u0096" readonly property string translationCreateFiles: "\u0096"
readonly property string translationSelectLanguages: "\u0097" readonly property string translationCreateReport: "\u0097"
readonly property string translationTest: "\u0098" readonly property string translationExport: "\u0098"
readonly property string transparent: "\u0099" readonly property string translationImport: "\u0099"
readonly property string triState: "\u009A" readonly property string translationSelectLanguages: "\u009A"
readonly property string triangleArcA: "\u009B" readonly property string translationTest: "\u009B"
readonly property string triangleArcB: "\u009D" readonly property string transparent: "\u009D"
readonly property string triangleCornerA: "\u009E" readonly property string triState: "\u009E"
readonly property string triangleCornerB: "\u009F" readonly property string triangleArcA: "\u009F"
readonly property string unLinked: "\u00A0" readonly property string triangleArcB: "\u00A0"
readonly property string undo: "\u00A1" readonly property string triangleCornerA: "\u00A1"
readonly property string unpin: "\u00A2" readonly property string triangleCornerB: "\u00A2"
readonly property string upDownIcon: "\u00A3" readonly property string unLinked: "\u00A3"
readonly property string upDownSquare2: "\u00A4" readonly property string undo: "\u00A4"
readonly property string visibilityOff: "\u00A5" readonly property string unpin: "\u00A5"
readonly property string visibilityOn: "\u00A6" readonly property string upDownIcon: "\u00A6"
readonly property string wildcard: "\u00A7" readonly property string upDownSquare2: "\u00A7"
readonly property string wizardsAutomotive: "\u00A8" readonly property string visibilityOff: "\u00A8"
readonly property string wizardsDesktop: "\u00A9" readonly property string visibilityOn: "\u00A9"
readonly property string wizardsGeneric: "\u00AA" readonly property string wildcard: "\u00AA"
readonly property string wizardsMcuEmpty: "\u00AB" readonly property string wizardsAutomotive: "\u00AB"
readonly property string wizardsMcuGraph: "\u00AC" readonly property string wizardsDesktop: "\u00AC"
readonly property string wizardsMobile: "\u00AE" readonly property string wizardsGeneric: "\u00AE"
readonly property string wizardsUnknown: "\u00AF" readonly property string wizardsMcuEmpty: "\u00AF"
readonly property string zoomAll: "\u00B0" readonly property string wizardsMcuGraph: "\u00B0"
readonly property string zoomIn: "\u00B1" readonly property string wizardsMobile: "\u00B1"
readonly property string zoomOut: "\u00B2" readonly property string wizardsUnknown: "\u00B2"
readonly property string zoomSelection: "\u00B3" readonly property string zoomAll: "\u00B3"
readonly property string zoomIn: "\u00B4"
readonly property string zoomOut: "\u00B5"
readonly property string zoomSelection: "\u00B6"
readonly property font iconFont: Qt.font({ readonly property font iconFont: Qt.font({
"family": controlIcons.name, "family": controlIcons.name,

View File

@@ -211,6 +211,10 @@ QtObject {
property string themePanelBackground: Theme.color(Theme.DSpanelBackground) property string themePanelBackground: Theme.color(Theme.DSpanelBackground)
property string themeGreenLight: Theme.color(Theme.DSgreenLight)
property string themeAmberLight: Theme.color(Theme.DSamberLight)
property string themeRedLight: Theme.color(Theme.DSredLight)
property string themeInteraction: Theme.color(Theme.DSinteraction) property string themeInteraction: Theme.color(Theme.DSinteraction)
property string themeError: Theme.color(Theme.DSerrorColor) property string themeError: Theme.color(Theme.DSerrorColor)
property string themeWarning: Theme.color(Theme.DSwarningColor) property string themeWarning: Theme.color(Theme.DSwarningColor)

View File

@@ -30,6 +30,10 @@ DSsubPanelBackground=ff1c1c1c
DSthumbnailBackground=ff232323 DSthumbnailBackground=ff232323
DSthumbnailLabelBackground=ff2b2a2a DSthumbnailLabelBackground=ff2b2a2a
DSgreenLight=ff5cdc68
DSamberLight=ffffbf00
DSredLight=ffff0401
DSinteraction=ff2aafd3 DSinteraction=ff2aafd3
DSerrorColor=ffdf3a3a DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning

View File

@@ -21,6 +21,10 @@ DSsubPanelBackground=ffEFEFEF
DSthumbnailBackground=ffE8E8E8 DSthumbnailBackground=ffE8E8E8
DSthumbnailLabelBackground=ffDDDDDD DSthumbnailLabelBackground=ffDDDDDD
DSgreenLight=ff5cdc68
DSamberLight=ffffbf00
DSredLight=ffff0401
DSinteraction=ff2aafd3 DSinteraction=ff2aafd3
DSerrorColor=ffdf3a3a DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning

View File

@@ -35,6 +35,10 @@ DSsubPanelBackground=ffEFEFEF
DSthumbnailBackground=ffE8E8E8 DSthumbnailBackground=ffE8E8E8
DSthumbnailLabelBackground=ffDDDDDD DSthumbnailLabelBackground=ffDDDDDD
DSgreenLight=ff5cdc68
DSamberLight=ffffbf00
DSredLight=ffff0401
DSinteraction=ff2aafd3 DSinteraction=ff2aafd3
DSerrorColor=ffdf3a3a DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning

View File

@@ -32,6 +32,10 @@ DSsubPanelBackground=ff1c1c1c
DSthumbnailBackground=ff232323 DSthumbnailBackground=ff232323
DSthumbnailLabelBackground=ff2b2a2a DSthumbnailLabelBackground=ff2b2a2a
DSgreenLight=ff5cdc68
DSamberLight=ffffbf00
DSredLight=ffff0401
DSinteraction=ff2aafd3 DSinteraction=ff2aafd3
DSerrorColor=ffdf3a3a DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning

View File

@@ -34,6 +34,10 @@ DSsubPanelBackground=ff1c1c1c
DSthumbnailBackground=ff232323 DSthumbnailBackground=ff232323
DSthumbnailLabelBackground=ff2b2a2a DSthumbnailLabelBackground=ff2b2a2a
DSgreenLight=ff5cdc68
DSamberLight=ffffbf00
DSredLight=ffff0401
DSinteraction=ff2aafd3 DSinteraction=ff2aafd3
DSerrorColor=ffdf3a3a DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning

View File

@@ -30,6 +30,10 @@ DSsubPanelBackground=ffEFEFEF
DSthumbnailBackground=ffE8E8E8 DSthumbnailBackground=ffE8E8E8
DSthumbnailLabelBackground=ffDDDDDD DSthumbnailLabelBackground=ffDDDDDD
DSgreenLight=ff5cdc68
DSamberLight=ffffbf00
DSredLight=ffff0401
DSinteraction=ff2aafd3 DSinteraction=ff2aafd3
DSerrorColor=ffdf3a3a DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning

View File

@@ -28,6 +28,10 @@ DSsubPanelBackground=ff1c1c1c
DSthumbnailBackground=ff232323 DSthumbnailBackground=ff232323
DSthumbnailLabelBackground=ff2b2a2a DSthumbnailLabelBackground=ff2b2a2a
DSgreenLight=ff5cdc68
DSamberLight=ffffbf00
DSredLight=ffff0401
DSinteraction=ff2aafd3 DSinteraction=ff2aafd3
DSerrorColor=ffdf3a3a DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning

View File

@@ -62,6 +62,8 @@ Project {
"format.cpp", "format.cpp",
"format.h", "format.h",
"format_p.h", "format_p.h",
"highlightingdata.cpp",
"highlightingdata_p.hpp",
"htmlhighlighter.cpp", "htmlhighlighter.cpp",
"htmlhighlighter.h", "htmlhighlighter.h",
"keywordlist.cpp", "keywordlist.cpp",

View File

@@ -1333,7 +1333,17 @@ static bool isIntegerValue(const Value *value)
if (value->asNumberValue() || value->asIntValue()) if (value->asNumberValue() || value->asIntValue())
return true; return true;
if (auto obj = value->asObjectValue()) if (auto obj = value->asObjectValue())
return obj->className() == "Number"; return obj->className() == "Number" || obj->className() == "int";
return false;
}
static bool isStringValue(const Value *value)
{
if (value->asStringValue())
return true;
if (auto obj = value->asObjectValue())
return obj->className() == "QString" || obj->className() == "string";
return false; return false;
} }
@@ -1349,6 +1359,8 @@ static bool strictCompareConstant(const Value *lhs, const Value *rhs)
return false; return false;
if (isIntegerValue(lhs) && isIntegerValue(rhs)) if (isIntegerValue(lhs) && isIntegerValue(rhs))
return false; return false;
if (isStringValue(lhs) && isStringValue(rhs))
return false;
if (lhs->asBooleanValue() && !rhs->asBooleanValue()) if (lhs->asBooleanValue() && !rhs->asBooleanValue())
return true; return true;
if (lhs->asNumberValue() && !rhs->asNumberValue()) if (lhs->asNumberValue() && !rhs->asNumberValue())

View File

@@ -432,6 +432,10 @@ public:
DSsubPanelBackground, DSsubPanelBackground,
DSthumbnailBackground, DSthumbnailBackground,
DSthumbnailLabelBackground, DSthumbnailLabelBackground,
DSgreenLight,
DSamberLight,
DSredLight,
}; };
enum Gradient { enum Gradient {

View File

@@ -2649,7 +2649,8 @@ static QList<BlockRange> cleanupDisabledCode(HighlightingResults &results, const
int rangeStartPos = -1; int rangeStartPos = -1;
for (auto it = results.begin(); it != results.end();) { for (auto it = results.begin(); it != results.end();) {
const bool wasIfdefedOut = rangeStartPos != -1; const bool wasIfdefedOut = rangeStartPos != -1;
if (it->textStyles.mainStyle != C_DISABLED_CODE) { const bool isIfDefedOut = it->textStyles.mainStyle == C_DISABLED_CODE;
if (!isIfDefedOut) {
if (wasIfdefedOut) { if (wasIfdefedOut) {
const QTextBlock block = doc->findBlockByNumber(it->line - 1); const QTextBlock block = doc->findBlockByNumber(it->line - 1);
ifdefedOutRanges << BlockRange(rangeStartPos, block.position()); ifdefedOutRanges << BlockRange(rangeStartPos, block.position());
@@ -2661,19 +2662,28 @@ static QList<BlockRange> cleanupDisabledCode(HighlightingResults &results, const
if (!wasIfdefedOut) if (!wasIfdefedOut)
rangeStartPos = doc->findBlockByNumber(it->line - 1).position(); rangeStartPos = doc->findBlockByNumber(it->line - 1).position();
const int pos = Utils::Text::positionInText(doc, it->line, it->column);
const QStringView content = subViewLen(docContent, pos, it->length).trimmed(); // Does the current line contain a potential "ifdefed-out switcher"?
if (!content.startsWith(QLatin1String("#if")) // If not, no state change is possible and we continue with the next line.
&& !content.startsWith(QLatin1String("#elif")) const auto isPreprocessorControlStatement = [&] {
&& !content.startsWith(QLatin1String("#else")) const int pos = Utils::Text::positionInText(doc, it->line, it->column);
&& !content.startsWith(QLatin1String("#endif"))) { const QStringView content = subViewLen(docContent, pos, it->length).trimmed();
static const QStringList ppSuffixes{"if", "ifdef", "elif", "else", "endif"}; if (content.isEmpty() || content.first() != '#')
const QList<QStringView> contentList = content.split(' ', Qt::SkipEmptyParts); return false;
if (contentList.size() < 2 || contentList.first() != QLatin1String("#") int offset = 1;
|| !ppSuffixes.contains(contentList.at(1))) { while (offset < content.size() && content.at(offset).isSpace())
++it; ++offset;
continue; if (offset == content.size())
} return false;
const QStringView ppDirective = content.mid(offset);
return ppDirective.startsWith(QLatin1String("if"))
|| ppDirective.startsWith(QLatin1String("elif"))
|| ppDirective.startsWith(QLatin1String("else"))
|| ppDirective.startsWith(QLatin1String("endif"));
};
if (!isPreprocessorControlStatement()) {
++it;
continue;
} }
if (!wasIfdefedOut) { if (!wasIfdefedOut) {
@@ -2700,6 +2710,12 @@ static QList<BlockRange> cleanupDisabledCode(HighlightingResults &results, const
if (rangeStartPos != -1) if (rangeStartPos != -1)
ifdefedOutRanges << BlockRange(rangeStartPos, doc->characterCount()); ifdefedOutRanges << BlockRange(rangeStartPos, doc->characterCount());
qCDebug(clangdLogHighlight) << "found" << ifdefedOutRanges.size() << "ifdefed-out ranges";
if (clangdLogHighlight().isDebugEnabled()) {
for (const BlockRange &r : qAsConst(ifdefedOutRanges))
qCDebug(clangdLogHighlight) << r.first() << r.last();
}
return ifdefedOutRanges; return ifdefedOutRanges;
} }
@@ -2741,10 +2757,22 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
// where the user sees that it's being written. // where the user sees that it's being written.
if (it->kind() == "CXXOperatorCall") { if (it->kind() == "CXXOperatorCall") {
const QList<AstNode> children = it->children().value_or(QList<AstNode>()); const QList<AstNode> children = it->children().value_or(QList<AstNode>());
// Child 1 is the call itself, Child 2 is the named entity on which the call happens
// (a lambda or a class instance), after that follow the actual call arguments.
if (children.size() < 2) if (children.size() < 2)
return false; return false;
if (!children.last().range().contains(range))
// The call itself is never modifiable.
if (children.first().range() == range)
return false; return false;
// The callable is never displayed as an output parameter.
// TODO: A good argument can be made to display objects on which a non-const
// operator or function is called as output parameters.
if (children.at(1).range() == range)
return false;
QList<AstNode> firstChildTree{children.first()}; QList<AstNode> firstChildTree{children.first()};
while (!firstChildTree.isEmpty()) { while (!firstChildTree.isEmpty()) {
const AstNode n = firstChildTree.takeFirst(); const AstNode n = firstChildTree.takeFirst();
@@ -2859,13 +2887,13 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
auto results = QtConcurrent::blockingMapped<HighlightingResults>(tokens, toResult); auto results = QtConcurrent::blockingMapped<HighlightingResults>(tokens, toResult);
const QList<BlockRange> ifdefedOutBlocks = cleanupDisabledCode(results, &doc, docContents); const QList<BlockRange> ifdefedOutBlocks = cleanupDisabledCode(results, &doc, docContents);
QMetaObject::invokeMethod(textDocument, [textDocument, ifdefedOutBlocks, docRevision] {
if (textDocument && textDocument->document()->revision() == docRevision)
textDocument->setIfdefedOutBlocks(ifdefedOutBlocks);
}, Qt::QueuedConnection);
ExtraHighlightingResultsCollector(future, results, filePath, ast, &doc, docContents).collect(); ExtraHighlightingResultsCollector(future, results, filePath, ast, &doc, docContents).collect();
if (!future.isCanceled()) { if (!future.isCanceled()) {
qCDebug(clangdLog) << "reporting" << results.size() << "highlighting results"; qCDebug(clangdLog) << "reporting" << results.size() << "highlighting results";
QMetaObject::invokeMethod(textDocument, [textDocument, ifdefedOutBlocks, docRevision] {
if (textDocument && textDocument->document()->revision() == docRevision)
textDocument->setIfdefedOutBlocks(ifdefedOutBlocks);
}, Qt::QueuedConnection);
QList<Range> virtualRanges; QList<Range> virtualRanges;
for (const HighlightingResult &r : results) { for (const HighlightingResult &r : results) {
if (r.textStyles.mainStyle != C_VIRTUAL_METHOD) if (r.textStyles.mainStyle != C_VIRTUAL_METHOD)
@@ -2880,8 +2908,7 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
client->setVirtualRanges(filePath, virtualRanges, docRevision); client->setVirtualRanges(filePath, virtualRanges, docRevision);
} }
}, Qt::QueuedConnection); }, Qt::QueuedConnection);
future.reportResults(QVector<HighlightingResult>(results.cbegin(), future.reportResults(QVector<HighlightingResult>(results.cbegin(), results.cend()));
results.cend()));
} }
future.reportFinished(); future.reportFinished();
} }

View File

@@ -1285,6 +1285,14 @@ void ClangdTestHighlighting::test_data()
<< QList<int>{C_LOCAL} << 0; << QList<int>{C_LOCAL} << 0;
QTest::newRow("const member as function argument") << 868 << 32 << 868 << 43 QTest::newRow("const member as function argument") << 868 << 32 << 868 << 43
<< QList<int>{C_FIELD} << 0; << QList<int>{C_FIELD} << 0;
QTest::newRow("lambda call without arguments (const var)") << 887 << 5 << 887 << 12
<< QList<int>{C_LOCAL} << 0;
QTest::newRow("lambda call without arguments (non-const var)") << 889 << 5 << 889 << 12
<< QList<int>{C_LOCAL} << 0;
QTest::newRow("non-const operator()") << 898 << 5 << 898 << 7
<< QList<int>{C_LOCAL} << 0;
QTest::newRow("const operator()") << 903 << 5 << 903 << 7
<< QList<int>{C_LOCAL} << 0;
} }
void ClangdTestHighlighting::test() void ClangdTestHighlighting::test()

View File

@@ -880,3 +880,25 @@ void constMemberAsFunctionArg()
#if 0 #if 0
#define BAR #define BAR
# endif # endif
void lambdaCall()
{
const auto lambda1 = [] {};
lambda1();
auto lambda2 = [] {};
lambda2();
}
void callOperators()
{
struct Callable1 {
void operator()() {};
};
Callable1 c1;
c1();
struct Callable2 {
void operator()() const {};
};
Callable2 c2;
c2();
}

View File

@@ -488,14 +488,14 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
if (m_buildConfiguration->isEnabled()) if (m_buildConfiguration->isEnabled())
setError(QString()); setError(QString());
}); });
connect(this, &QObject::destroyed, this, [this](const QObject *obj) { connect(this, &QObject::destroyed, this, [this] {
updateInitialCMakeArguments(); updateInitialCMakeArguments();
}); });
connect(bc->aspect<InitialCMakeArgumentsAspect>(), connect(bc->aspect<InitialCMakeArgumentsAspect>(),
&Utils::BaseAspect::labelLinkActivated, &Utils::BaseAspect::labelLinkActivated,
this, this,
[this](const QString &link) { [this](const QString &) {
const CMakeTool *tool = CMakeKitAspect::cmakeTool( const CMakeTool *tool = CMakeKitAspect::cmakeTool(
m_buildConfiguration->target()->kit()); m_buildConfiguration->target()->kit());
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options"); CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
@@ -503,7 +503,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
connect(bc->aspect<AdditionalCMakeOptionsAspect>(), connect(bc->aspect<AdditionalCMakeOptionsAspect>(),
&Utils::BaseAspect::labelLinkActivated, &Utils::BaseAspect::labelLinkActivated,
this, this,
[this](const QString &link) { [this](const QString &) {
const CMakeTool *tool = CMakeKitAspect::cmakeTool( const CMakeTool *tool = CMakeKitAspect::cmakeTool(
m_buildConfiguration->target()->kit()); m_buildConfiguration->target()->kit());
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options"); CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
@@ -527,7 +527,7 @@ void CMakeBuildSettingsWidget::batchEditConfiguration()
"To set or change a variable, use -D&lt;variable&gt;:&lt;type&gt;=&lt;value&gt;.<br/>" "To set or change a variable, use -D&lt;variable&gt;:&lt;type&gt;=&lt;value&gt;.<br/>"
"&lt;type&gt; can have one of the following values: FILEPATH, PATH, BOOL, INTERNAL, or STRING.<br/>" "&lt;type&gt; can have one of the following values: FILEPATH, PATH, BOOL, INTERNAL, or STRING.<br/>"
"To unset a variable, use -U&lt;variable&gt;.<br/>")); "To unset a variable, use -U&lt;variable&gt;.<br/>"));
connect(label, &QLabel::linkActivated, this, [this](const QString &link) { connect(label, &QLabel::linkActivated, this, [this](const QString &) {
const CMakeTool *tool = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit()); const CMakeTool *tool = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit());
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-variables.7.html"); CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-variables.7.html");
}); });

View File

@@ -353,7 +353,7 @@ public:
m_changeButton(createSubWidget<QPushButton>()) m_changeButton(createSubWidget<QPushButton>())
{ {
const CMakeTool *tool = CMakeKitAspect::cmakeTool(kit); const CMakeTool *tool = CMakeKitAspect::cmakeTool(kit);
connect(this, &KitAspectWidget::labelLinkActivated, this, [=](const QString &link) { connect(this, &KitAspectWidget::labelLinkActivated, this, [=](const QString &) {
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-generators.7.html"); CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-generators.7.html");
}); });
@@ -972,7 +972,7 @@ private:
"To set a variable, use -D&lt;variable&gt;:&lt;type&gt;=&lt;value&gt;.<br/>" "To set a variable, use -D&lt;variable&gt;:&lt;type&gt;=&lt;value&gt;.<br/>"
"&lt;type&gt; can have one of the following values: FILEPATH, PATH, " "&lt;type&gt; can have one of the following values: FILEPATH, PATH, "
"BOOL, INTERNAL, or STRING.")); "BOOL, INTERNAL, or STRING."));
connect(editorLabel, &QLabel::linkActivated, this, [=](const QString &link) { connect(editorLabel, &QLabel::linkActivated, this, [=](const QString &) {
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-variables.7.html"); CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-variables.7.html");
}); });
m_editor->setMinimumSize(800, 200); m_editor->setMinimumSize(800, 200);
@@ -984,7 +984,7 @@ private:
m_additionalEditor = new QLineEdit; m_additionalEditor = new QLineEdit;
auto additionalLabel = new QLabel(m_dialog); auto additionalLabel = new QLabel(m_dialog);
additionalLabel->setText(tr("Additional CMake <a href=\"options\">options</a>:")); additionalLabel->setText(tr("Additional CMake <a href=\"options\">options</a>:"));
connect(additionalLabel, &QLabel::linkActivated, this, [=](const QString &link) { connect(additionalLabel, &QLabel::linkActivated, this, [=](const QString &) {
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options"); CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
}); });

View File

@@ -70,7 +70,7 @@ static void showOutputPane(Flag flags)
m_messageOutputWindow->flash(); m_messageOutputWindow->flash();
break; break;
case Core::Flag::Disrupt: case Core::Flag::Disrupt:
m_messageOutputWindow->popup(IOutputPane::ModeSwitch); m_messageOutputWindow->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
break; break;
} }
} }

View File

@@ -329,7 +329,7 @@ void CodePasterPluginPrivate::finishPost(const QString &link)
if (m_settings.displayOutput.value()) if (m_settings.displayOutput.value())
MessageManager::writeDisrupting(link); MessageManager::writeDisrupting(link);
else else
MessageManager::writeSilently(link); MessageManager::writeFlashing(link);
} }
// Extract the characters that can be used for a file name from a title // Extract the characters that can be used for a file name from a title

View File

@@ -208,6 +208,6 @@ void FileShareProtocol::paste(
return; return;
} }
Core::MessageManager::writeSilently(tr("Pasted: %1").arg(saver.filePath().toUserOutput())); emit pasteDone(saver.filePath().toUserOutput());
} }
} // namespace CodePaster } // namespace CodePaster

View File

@@ -1030,6 +1030,7 @@ FilePath DockerDevice::mapToLocalAccess(const FilePath &filePath) const
return FilePath::fromString(d->m_mergedDir + '/' + path); return FilePath::fromString(d->m_mergedDir + '/' + path);
#else #else
QTC_CHECK(false); QTC_CHECK(false);
Q_UNUSED(filePath)
return {}; return {};
#endif #endif
} }
@@ -1047,6 +1048,7 @@ FilePath DockerDevice::mapFromLocalAccess(const QString &filePath) const
QTC_ASSERT(filePath.startsWith(d->m_mergedDir), return FilePath::fromString(filePath)); QTC_ASSERT(filePath.startsWith(d->m_mergedDir), return FilePath::fromString(filePath));
return mapToGlobalPath(FilePath::fromString(filePath.mid(d->m_mergedDir.size()))); return mapToGlobalPath(FilePath::fromString(filePath.mid(d->m_mergedDir.size())));
#else #else
Q_UNUSED(filePath)
QTC_CHECK(false); QTC_CHECK(false);
return {}; return {};
#endif #endif

View File

@@ -104,6 +104,9 @@ public:
distributeSpacingVertical, distributeSpacingVertical,
distributeTop, distributeTop,
download, download,
downloadUnavailable,
downloadUpdate,
downloaded,
edit, edit,
eyeDropper, eyeDropper,
favorite, favorite,

View File

@@ -484,7 +484,7 @@ void FormEditorView::customNotification(const AbstractView * /*view*/, const QSt
void FormEditorView::currentStateChanged(const ModelNode & /*node*/) void FormEditorView::currentStateChanged(const ModelNode & /*node*/)
{ {
temporaryBlockView(100); temporaryBlockView();
} }
AbstractFormEditorTool *FormEditorView::currentTool() const AbstractFormEditorTool *FormEditorView::currentTool() const

View File

@@ -147,7 +147,7 @@ private:
void setupFormEditorItemTree(const QmlItemNode &qmlItemNode); void setupFormEditorItemTree(const QmlItemNode &qmlItemNode);
void removeNodeFromScene(const QmlItemNode &qmlItemNode); void removeNodeFromScene(const QmlItemNode &qmlItemNode);
void createFormEditorWidget(); void createFormEditorWidget();
void temporaryBlockView(int duration = 1000); void temporaryBlockView(int duration = 100);
void resetNodeInstanceView(); void resetNodeInstanceView();
void addOrRemoveFormEditorItem(const ModelNode &node); void addOrRemoveFormEditorItem(const ModelNode &node);
void checkRootModelNode(); void checkRootModelNode();

View File

@@ -161,6 +161,8 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache,
, m_itemsWidget(new QQuickWidget(this)) , m_itemsWidget(new QQuickWidget(this))
, m_imageCache{imageCache} , m_imageCache{imageCache}
{ {
Q_UNUSED(asynchronousFontImageCache)
m_compressionTimer.setInterval(200); m_compressionTimer.setInterval(200);
m_compressionTimer.setSingleShot(true); m_compressionTimer.setSingleShot(true);
ItemLibraryModel::registerQmlTypes(); ItemLibraryModel::registerQmlTypes();

View File

@@ -865,7 +865,7 @@ ModelNode RewriterView::nodeAtTextCursorPositionHelper(const ModelNode &root, in
for (const myPair &pair : data) { for (const myPair &pair : data) {
ModelNode node = pair.first; ModelNode node = pair.first;
i++; i++;
if (i >= data.size()) { if (i >= int(data.size())) {
lastNode = node; lastNode = node;
break; break;
} }

View File

@@ -41,6 +41,8 @@
#include <QQuickItem> #include <QQuickItem>
#include <QQuickWidget> #include <QQuickWidget>
#include <algorithm>
using namespace Utils; using namespace Utils;
ExampleCheckout::ExampleCheckout(QObject *) {} ExampleCheckout::ExampleCheckout(QObject *) {}
@@ -137,11 +139,11 @@ FileDownloader::~FileDownloader()
void FileDownloader::start() void FileDownloader::start()
{ {
m_tempFile.setFileName(QDir::tempPath() + "/" + name() + ".XXXXXX" + ".zip"); m_tempFile.setFileName(QDir::tempPath() + "/" + name() + ".XXXXXX" + ".zip");
m_tempFile.open(QIODevice::WriteOnly); m_tempFile.open(QIODevice::WriteOnly);
auto request = QNetworkRequest(m_url); auto request = QNetworkRequest(m_url);
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, true); request.setAttribute(QNetworkRequest::RedirectPolicyAttribute,
QNetworkRequest::UserVerifiedRedirectPolicy);
QNetworkReply *reply = Utils::NetworkAccessManager::instance()->get(request); QNetworkReply *reply = Utils::NetworkAccessManager::instance()->get(request);
QNetworkReply::connect(reply, &QNetworkReply::readyRead, [this, reply]() { QNetworkReply::connect(reply, &QNetworkReply::readyRead, [this, reply]() {
@@ -159,20 +161,20 @@ void FileDownloader::start()
emit progressChanged(); emit progressChanged();
}); });
QNetworkReply::connect(reply, &QNetworkReply::redirected, [reply](const QUrl &url) {
emit reply->redirectAllowed();
});
QNetworkReply::connect(reply, &QNetworkReply::finished, [this, reply]() { QNetworkReply::connect(reply, &QNetworkReply::finished, [this, reply]() {
if (reply->error()) { if (reply->error()) {
m_tempFile.remove(); m_tempFile.remove();
if (m_url != reply->url()) { qDebug() << Q_FUNC_INFO << m_url << reply->errorString();
m_url = reply->url(); emit downloadFailed();
start();
} else {
qDebug() << Q_FUNC_INFO << m_url << reply->errorString();
emit downloadFailed();
}
} else { } else {
m_tempFile.flush(); m_tempFile.flush();
m_tempFile.close(); m_tempFile.close();
m_finished = true; m_finished = true;
emit tempFileChanged();
emit finishedChanged(); emit finishedChanged();
} }
}); });
@@ -181,8 +183,9 @@ void FileDownloader::start()
void FileDownloader::setUrl(const QUrl &url) void FileDownloader::setUrl(const QUrl &url)
{ {
m_url = url; m_url = url;
emit nameChanged(); emit nameChanged();
probeUrl();
} }
QUrl FileDownloader::url() const QUrl FileDownloader::url() const
@@ -222,16 +225,71 @@ QString FileDownloader::tempFile() const
return QFileInfo(m_tempFile).canonicalFilePath(); return QFileInfo(m_tempFile).canonicalFilePath();
} }
QDateTime FileDownloader::lastModified() const
{
return m_lastModified;
}
bool FileDownloader::available() const
{
return m_available;
}
void FileDownloader::probeUrl()
{
auto request = QNetworkRequest(m_url);
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute,
QNetworkRequest::UserVerifiedRedirectPolicy);
QNetworkReply *reply = Utils::NetworkAccessManager::instance()->head(request);
QNetworkReply::connect(reply, &QNetworkReply::redirected, [reply](const QUrl &url) {
emit reply->redirectAllowed();
});
QNetworkReply::connect(reply, &QNetworkReply::finished, [this, reply]() {
if (reply->error())
return;
m_lastModified = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime();
emit lastModifiedChanged();
m_available = true;
emit availableChanged();
});
QNetworkReply::connect(reply,
&QNetworkReply::errorOccurred,
[this, reply](QNetworkReply::NetworkError code) {
// QNetworkReply::HostNotFoundError
// QNetworkReply::ContentNotFoundError
m_available = false;
emit availableChanged();
});
}
FileExtractor::FileExtractor(QObject *parent) FileExtractor::FileExtractor(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
if (Core::DocumentManager::instance()) m_targetPath = Utils::FilePath::fromString(
m_targetPath = Core::DocumentManager::projectsDirectory(); QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
if (!m_targetPath.isEmpty())
m_targetPath = m_targetPath.pathAppended("QtDesignStudio");
else else
m_targetPath = "/temp/"; m_targetPath = "/temp/";
m_timer.setInterval(500); m_timer.setInterval(100);
m_timer.setSingleShot(false); m_timer.setSingleShot(false);
QObject::connect(this, &FileExtractor::targetFolderExistsChanged, [this]() {
if (targetFolderExists()) {
m_birthTime = QFileInfo(m_targetPath.toString() + "/" + m_archiveName).birthTime();
} else
m_birthTime = QDateTime();
emit birthTimeChanged();
});
} }
FileExtractor::~FileExtractor() {} FileExtractor::~FileExtractor() {}
@@ -297,8 +355,17 @@ QString FileExtractor::count() const
bool FileExtractor::targetFolderExists() const bool FileExtractor::targetFolderExists() const
{ {
const QString targetFolder = m_targetPath.toString() + "/" + m_archiveName; return QFileInfo::exists(m_targetPath.toString() + "/" + m_archiveName);
return QFileInfo(targetFolder).exists(); }
int FileExtractor::progress() const
{
return m_progress;
}
QDateTime FileExtractor::birthTime() const
{
return m_birthTime;
} }
QString FileExtractor::archiveName() const QString FileExtractor::archiveName() const
@@ -320,8 +387,9 @@ void FileExtractor::extract()
m_timer.start(); m_timer.start();
const QString targetFolder = m_targetPath.toString() + "/" + m_archiveName; const QString targetFolder = m_targetPath.toString() + "/" + m_archiveName;
qint64 bytesBefore = QStorageInfo(m_targetPath.toFileInfo().dir()).bytesAvailable(); qint64 bytesBefore = QStorageInfo(m_targetPath.toFileInfo().dir()).bytesAvailable();
qint64 compressedSize = QFileInfo(m_sourceFile.toString()).size();
QTimer::connect(&m_timer, &QTimer::timeout, [this, bytesBefore, targetFolder]() { QTimer::connect(&m_timer, &QTimer::timeout, [this, bytesBefore, targetFolder, compressedSize]() {
static QHash<QString, int> hash; static QHash<QString, int> hash;
QDirIterator it(targetFolder, {"*.*"}, QDir::Files, QDirIterator::Subdirectories); QDirIterator it(targetFolder, {"*.*"}, QDir::Files, QDirIterator::Subdirectories);
@@ -336,9 +404,15 @@ void FileExtractor::extract()
count++; count++;
} }
m_size = QString::number(bytesBefore qint64 currentSize = bytesBefore
- QStorageInfo(m_targetPath.toFileInfo().dir()).bytesAvailable()); - QStorageInfo(m_targetPath.toFileInfo().dir()).bytesAvailable();
// We can not get the uncompressed size of the archive yet, that is why we use an
// approximation. We assume a 50% compression rate.
m_progress = std::min(100ll, currentSize * 100 / compressedSize * 2);
emit progressChanged();
m_size = QString::number(currentSize);
m_count = QString::number(count); m_count = QString::number(count);
emit sizeChanged(); emit sizeChanged();
}); });
@@ -351,6 +425,11 @@ void FileExtractor::extract()
QObject::connect(archive, &Utils::Archive::finished, [this](bool ret) { QObject::connect(archive, &Utils::Archive::finished, [this](bool ret) {
m_finished = ret; m_finished = ret;
m_timer.stop(); m_timer.stop();
m_progress = 100;
emit progressChanged();
emit targetFolderExistsChanged();
emit finishedChanged(); emit finishedChanged();
QTC_ASSERT(ret, ;); QTC_ASSERT(ret, ;);
}); });

View File

@@ -78,6 +78,8 @@ class FileExtractor : public QObject
Q_PROPERTY(QString sourceFile READ sourceFile WRITE setSourceFile) Q_PROPERTY(QString sourceFile READ sourceFile WRITE setSourceFile)
Q_PROPERTY(bool finished READ finished NOTIFY finishedChanged) Q_PROPERTY(bool finished READ finished NOTIFY finishedChanged)
Q_PROPERTY(bool targetFolderExists READ targetFolderExists NOTIFY targetFolderExistsChanged) Q_PROPERTY(bool targetFolderExists READ targetFolderExists NOTIFY targetFolderExistsChanged)
Q_PROPERTY(int progress READ progress NOTIFY progressChanged)
Q_PROPERTY(QDateTime birthTime READ birthTime NOTIFY birthTimeChanged)
public: public:
explicit FileExtractor(QObject *parent = nullptr); explicit FileExtractor(QObject *parent = nullptr);
@@ -94,6 +96,8 @@ public:
QString size() const; QString size() const;
QString count() const; QString count() const;
bool targetFolderExists() const; bool targetFolderExists() const;
int progress() const;
QDateTime birthTime() const;
QString sourceFile() const; QString sourceFile() const;
QString archiveName() const; QString archiveName() const;
@@ -108,6 +112,8 @@ signals:
void currentFileChanged(); void currentFileChanged();
void sizeChanged(); void sizeChanged();
void targetFolderExistsChanged(); void targetFolderExistsChanged();
void progressChanged();
void birthTimeChanged();
private: private:
Utils::FilePath m_targetPath; Utils::FilePath m_targetPath;
@@ -119,6 +125,8 @@ private:
QString m_size; QString m_size;
QString m_count; QString m_count;
QString m_archiveName; QString m_archiveName;
int m_progress = 0;
QDateTime m_birthTime;
}; };
class FileDownloader : public QObject class FileDownloader : public QObject
@@ -131,7 +139,9 @@ class FileDownloader : public QObject
Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(QString completeBaseName READ completeBaseName NOTIFY nameChanged) Q_PROPERTY(QString completeBaseName READ completeBaseName NOTIFY nameChanged)
Q_PROPERTY(int progress READ progress NOTIFY progressChanged) Q_PROPERTY(int progress READ progress NOTIFY progressChanged)
Q_PROPERTY(QString tempFile READ tempFile NOTIFY finishedChanged) Q_PROPERTY(QString tempFile READ tempFile NOTIFY tempFileChanged)
Q_PROPERTY(QDateTime lastModified READ lastModified NOTIFY lastModifiedChanged)
Q_PROPERTY(bool available READ available NOTIFY availableChanged)
public: public:
explicit FileDownloader(QObject *parent = nullptr); explicit FileDownloader(QObject *parent = nullptr);
@@ -147,6 +157,8 @@ public:
QString completeBaseName() const; QString completeBaseName() const;
int progress() const; int progress() const;
QString tempFile() const; QString tempFile() const;
QDateTime lastModified() const;
bool available() const;
Q_INVOKABLE void start(); Q_INVOKABLE void start();
@@ -155,12 +167,19 @@ signals:
void errorChanged(); void errorChanged();
void nameChanged(); void nameChanged();
void progressChanged(); void progressChanged();
void tempFileChanged();
void downloadFailed(); void downloadFailed();
void lastModifiedChanged();
void availableChanged();
private: private:
void probeUrl();
QUrl m_url; QUrl m_url;
bool m_finished = false; bool m_finished = false;
bool m_error = false; bool m_error = false;
int m_progress = 0; int m_progress = 0;
QFile m_tempFile; QFile m_tempFile;
QDateTime m_lastModified;
bool m_available;
}; };

View File

@@ -58,7 +58,7 @@ QStringList RecentPresetsStore::addRecentToExisting(const RecentPreset &preset,
Utils::erase_one(recents, preset); Utils::erase_one(recents, preset);
Utils::prepend(recents, preset); Utils::prepend(recents, preset);
if (recents.size() > m_max) if (int(recents.size()) > m_max)
recents.pop_back(); recents.pop_back();
return encodeRecentPresets(recents); return encodeRecentPresets(recents);

View File

@@ -232,6 +232,28 @@ public:
QDesktopServices::openUrl(QUrl("qthelp://org.qt-project.qtcreator/doc/index.html")); QDesktopServices::openUrl(QUrl("qthelp://org.qt-project.qtcreator/doc/index.html"));
} }
Q_INVOKABLE void openExample(const QString &examplePath,
const QString &exampleName,
const QString &formFile,
const QString &explicitQmlproject)
{
const QString exampleFolder = examplePath + "/" + exampleName + "/";
QString projectFile = exampleFolder + exampleName + ".qmlproject";
if (!explicitQmlproject.isEmpty())
projectFile = exampleFolder + explicitQmlproject;
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile);
const QString qmlFile = QFileInfo(projectFile).dir().absolutePath() + "/" + formFile;
// This timer should be replaced with a signal send from project loading
QTimer::singleShot(1000, [qmlFile](){
Core::EditorManager::openEditor(Utils::FilePath::fromString(qmlFile));
});
}
Q_INVOKABLE void openExample(const QString &example, Q_INVOKABLE void openExample(const QString &example,
const QString &formFile, const QString &formFile,
const QString &url, const QString &url,
@@ -272,6 +294,7 @@ public:
Core::EditorManager::openEditor(qmlFile); Core::EditorManager::openEditor(qmlFile);
} }
public slots: public slots:
void resetProjects(); void resetProjects();
@@ -465,7 +488,7 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
case FilePathRole: case FilePathRole:
return data.first; return data.first;
case PrettyFilePathRole: case PrettyFilePathRole:
return Utils::withTildeHomePath(data.first); return Utils::withTildeHomePath(QFileInfo(data.first).dir().absolutePath());
case PreviewUrl: case PreviewUrl:
return QVariant(QStringLiteral("image://project_preview/") + appQmlFile(data.first)); return QVariant(QStringLiteral("image://project_preview/") + appQmlFile(data.first));
case TagData: case TagData:

View File

@@ -6,16 +6,15 @@ Limitations:
- Kits themselves need to be fixed up manually. - Kits themselves need to be fixed up manually.
- Shared mounts are restricted to locations on the host system - Shared mounts are restricted to locations on the host system
that can end up on the same absolute location in the container that can end up on the same absolute location in the container
- Windows host: Mounted drives cannot be used as shared mounts
What works: What works:
- Qmake in path is found - Qmake in path is found
- CMake in path is found - CMake in path is found
- Toolchain autodection finds gcc - Toolchain autodection finds gcc and clang
- Gdb in path is found - Gdb and lldb in path are found
- Building in the container with qmake works
- Building in the container with cmake works - Building in the container with cmake works
- Running locally or in a compatible docker container works - Running locally or in a compatible docker container works
@@ -30,7 +29,7 @@ For testing:
running ./build.sh. This builds a docker image containing a Desktop Qt running ./build.sh. This builds a docker image containing a Desktop Qt
build setup (including compiler etc) and second docker image container build setup (including compiler etc) and second docker image container
containing a run environment without the build tools, but e.g. with gdb containing a run environment without the build tools, but e.g. with gdb
for debugger testing for debugger testing and a third containing clang and lldb
- or - - or -

View File

@@ -254,9 +254,9 @@ void tst_CodeSize::codesize()
<< "\nExtra CXX Flags: " << c.extraCxxFlags.data(); << "\nExtra CXX Flags: " << c.extraCxxFlags.data();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# ifdef Q_CC_MSVC # ifdef Q_CC_MSVC
QString arguments = "release\\" + c.file + ".obj"; QString arguments = QString("release\\" + c.file + ".obj");
# else # else
QString arguments = "release\\" + c.file + ".o"; QString arguments = QString("release\\" + c.file + ".o");
# endif # endif
#else #else
QString arguments = QString(c.file + ".o"); QString arguments = QString(c.file + ".o");