diff --git a/CMakeLists.txt b/CMakeLists.txt index 43d7d9bce6e..41278e8d934 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) option(WITH_TESTS "Build Tests" OFF) option(WITH_DEBUG_CMAKE "Enabled CMake project debugging functionality (e.g. source file disk checking)" OFF) +option(BUILD_WITH_PCH "Build with precompiled headers" ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -35,7 +36,7 @@ endif() find_package(Qt5 COMPONENTS Concurrent Core Network PrintSupport Qml Quick QuickWidgets - Sql ${_TEST_QT_COMPONENT} + Sql Widgets ${_TEST_QT_COMPONENT} REQUIRED ) diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index ea959d67871..fddabb8d93b 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -250,6 +250,42 @@ function(qtc_plugin_enabled varName name) endif() endfunction() +function(enable_pch target) + if (BUILD_WITH_PCH) + get_target_property(target_sources ${target} SOURCES) + list(LENGTH target_sources target_sources_number) + if (${target_sources_number} GREATER "3") + set(PCH_FILE "${PROJECT_SOURCE_DIR}/src/shared/qtcreator_pch.h") + + function(_recursively_collect_dependencies input_target) + get_target_property(input_type ${input_target} TYPE) + if (${input_type} STREQUAL "INTERFACE_LIBRARY") + set(prefix "INTERFACE_") + endif() + get_target_property(link_libraries ${input_target} ${prefix}LINK_LIBRARIES) + foreach(library IN LISTS link_libraries) + if(TARGET ${library} AND NOT ${library} IN_LIST dependencies) + list(APPEND dependencies ${library}) + _recursively_collect_dependencies(${library}) + endif() + endforeach() + set(dependencies ${dependencies} PARENT_SCOPE) + endfunction() + _recursively_collect_dependencies(${target}) + + if ("Qt5::Widgets" IN_LIST dependencies) + set(PCH_FILE "${PROJECT_SOURCE_DIR}/src/shared/qtcreator_gui_pch.h") + endif() + + if (EXISTS ${PCH_FILE}) + set_target_properties(${target} PROPERTIES PRECOMPILE_HEADERS ${PCH_FILE}) + endif() + elseif(WITH_DEBUG_CMAKE) + message(STATUS "Skipped PCH for ${target}") + endif() + endif() +endfunction() + # # Public API functions # @@ -330,6 +366,7 @@ function(add_qtc_library name) ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${IDE_LIBRARY_PATH}" ${_arg_PROPERTIES} ) + enable_pch(${name}) unset(NAMELINK_OPTION) if (library_type STREQUAL "SHARED") @@ -534,6 +571,7 @@ function(add_qtc_plugin target_name) OUTPUT_NAME "${name}" ${_arg_PROPERTIES} ) + enable_pch(${target_name}) foreach(file IN LISTS _arg_EXPLICIT_MOC) set_explicit_moc(${target_name} "${file}") @@ -595,6 +633,15 @@ function(extend_qtc_target target_name) set(_arg_SOURCES ${prefixed_sources}) endif() target_sources(${target_name} PRIVATE ${_arg_SOURCES}) + + if (APPLE AND BUILD_WITH_PCH) + foreach(source IN LISTS _arg_SOURCES) + if (source MATCHES "^.*\.mm$") + set_source_files_properties(${source} PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + endif() + endforeach() + endif() + set_public_headers(${target_name} "${_arg_SOURCES}") foreach(file IN LISTS _arg_EXPLICIT_MOC) @@ -662,6 +709,7 @@ function(add_qtc_executable name) RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${_DESTINATION}" ${_arg_PROPERTIES} ) + enable_pch(${name}) if (NOT _arg_SKIP_INSTALL) install(TARGETS ${name} DESTINATION "${_DESTINATION}") @@ -702,6 +750,7 @@ function(add_qtc_test name) BUILD_RPATH "${_RPATH_BASE}/${_RPATH}" INSTALL_RPATH "${_RPATH_BASE}/${_RPATH}" ) + enable_pch(${name}) if (NOT _arg_GTEST) add_test(NAME ${name} COMMAND ${name}) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml index d206ad9b889..2373c32c648 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientDialogPopup.qml @@ -68,6 +68,8 @@ Loader { MouseArea { anchors.fill: parent onClicked: gradientDialogLoader.visible = false + preventStealing: true + hoverEnabled: true } Rectangle { id: background diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml index 54483e1598c..e316ef80b18 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml @@ -28,7 +28,7 @@ import QtQuick.Layouts 1.0 import QtQuickDesignerTheme 1.0 import StudioControls 1.0 as StudioControls -StudioControls.SpinBox { +StudioControls.RealSpinBox { id: spinBox width: 82 Layout.minimumWidth: 82 @@ -36,9 +36,10 @@ StudioControls.SpinBox { property string propertyName actionIndicatorVisible: false - from: -9999 - to: 9999 - Component.onCompleted: spinBox.value = gradientLine.model.readGradientProperty(propertyName) - onCompressedValueModified: gradientLine.model.setGradientProperty(propertyName, spinBox.value) - stepSize: 1 + realFrom: -9999 + realTo: 9999 + realStepSize: 1 + + Component.onCompleted: spinBox.realValue = gradientLine.model.readGradientProperty(propertyName) + onCompressedRealValueModified: gradientLine.model.setGradientProperty(propertyName, spinBox.realValue) } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml index d4b59a32d9d..327bfb2335e 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/UrlChooser.qml @@ -37,7 +37,6 @@ RowLayout { property string filter: "*.png *.gif *.jpg *.bmp *.jpeg *.svg" - FileResourcesModel { modelNodeBackendProperty: modelNodeBackend filter: urlChooser.filter @@ -63,15 +62,20 @@ RowLayout { property bool isComplete: false + property bool dirty: false + + onEditTextChanged: comboBox.dirty = true + function setCurrentText(text) { if (text === "") return - - var index = comboBox.find(textValue) + var index = comboBox.find(text) if (index === -1) currentIndex = -1 - editText = textValue + + editText = text + comboBox.dirty = false } property string textValue: { @@ -81,9 +85,7 @@ RowLayout { return backendValue.valueToString } - onTextValueChanged: { - setCurrentText(textValue) - } + onTextValueChanged: setCurrentText(textValue) Layout.fillWidth: true @@ -97,25 +99,41 @@ RowLayout { setCurrentText(textValue) } + onAccepted: { if (!comboBox.isComplete) return; - if (backendValue.value !== currentText) - backendValue.value = currentText; + if (backendValue.value !== editText) + backendValue.value = editText; + + comboBox.dirty = false } - onActivated: { - var cText = textAt(index) - print(cText) - if (backendValue === undefined) + onFocusChanged: { + if (comboBox.dirty) + handleActivate(comboBox.currentIndex) + } + + onActivated: handleActivate(index) + + function handleActivate(index) + { + var cText = comboBox.textAt(index) + + if (index === -1) + cText = comboBox.editText + + if (urlChooser.backendValue === undefined) return; if (!comboBox.isComplete) return; - if (backendValue.value !== cText) - backendValue.value = cText; + if (urlChooser.backendValue.value !== cText) + urlChooser.backendValue.value = cText; + + comboBox.dirty = false } Component.onCompleted: { diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index a2966ffe964..01e4e42608b 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -524,7 +524,8 @@ QStringList GccToolChain::gccPrepareArguments(const QStringList &flags, const QString &flag = allFlags.at(i); if (flag.startsWith("-stdlib=") || flag.startsWith("--gcc-toolchain=") || flag.startsWith("-B") || flag.startsWith("--target=") - || (flag.startsWith("-isystem") && flag.length() > 8)) { + || (flag.startsWith("-isystem") && flag.length() > 8) + || flag == "-nostdinc" || flag == "-nostdinc++") { arguments << flag; } else if ((flag == "-target" || flag == "-gcc-toolchain" || flag == "-isystem" || flag == "-arch") diff --git a/src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp b/src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp index f329ac6bae4..2c716652fdf 100644 --- a/src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/animationcurve.cpp @@ -327,6 +327,22 @@ void AnimationCurve::analyze() if (frame.position().y() > m_maxY) m_maxY = frame.position().y(); + + if (frame.hasLeftHandle()) { + if (frame.leftHandle().y() < m_minY) + m_minY = frame.leftHandle().y(); + + if (frame.leftHandle().y() > m_maxY) + m_maxY = frame.leftHandle().y(); + } + + if (frame.hasRightHandle()) { + if (frame.rightHandle().y() < m_minY) + m_minY = frame.rightHandle().y(); + + if (frame.rightHandle().y() > m_maxY) + m_maxY = frame.rightHandle().y(); + } } } } diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp b/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp index 2a1ee1c5c7c..d06ea3c4957 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditor.cpp @@ -42,12 +42,12 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent) , m_tree(new TreeView(model, this)) , m_view(new GraphicsView(model)) { - QSplitter *splitter = new QSplitter; + auto *splitter = new QSplitter; splitter->addWidget(m_tree); splitter->addWidget(m_view); splitter->setStretchFactor(1, 2); - QVBoxLayout *box = new QVBoxLayout; + auto *box = new QVBoxLayout; box->addWidget(createToolBar()); box->addWidget(splitter); setLayout(box); @@ -72,12 +72,12 @@ void CurveEditor::clearCanvas() QToolBar *CurveEditor::createToolBar() { - QToolBar *bar = new QToolBar; + auto *bar = new QToolBar; bar->setFloatable(false); - QAction *tangentLinearAction = bar->addAction("Linear"); - QAction *tangentStepAction = bar->addAction("Step"); - QAction *tangentSplineAction = bar->addAction("Spline"); + QAction *tangentLinearAction = bar->addAction(QIcon(":/curveeditor/images/tangetToolsLinearIcon.png"), "Linear"); + QAction *tangentStepAction = bar->addAction(QIcon(":/curveeditor/images/tangetToolsStepIcon.png"), "Step"); + QAction *tangentSplineAction = bar->addAction(QIcon(":/curveeditor/images/tangetToolsSplineIcon.png"), "Spline"); QAction *tangentDefaultAction = bar->addAction("Set Default"); auto setLinearInterpolation = [this]() { diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditor.pri b/src/plugins/qmldesigner/components/curveeditor/curveeditor.pri index 83896f04fc7..cd377aa2ced 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditor.pri +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditor.pri @@ -44,3 +44,6 @@ SOURCES += \ $$PWD/detail/utils.cpp \ $$PWD/keyframe.cpp \ $$PWD/treeitem.cpp + + RESOURCES += \ + $$PWD/curveeditor.qrc diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditor.qrc b/src/plugins/qmldesigner/components/curveeditor/curveeditor.qrc new file mode 100644 index 00000000000..2f553722601 --- /dev/null +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditor.qrc @@ -0,0 +1,20 @@ + + + images/tangetToolsSplineIcon.png + images/tangetToolsSplineIcon@2x.png + images/tangetToolsLinearIcon.png + images/tangetToolsLinearIcon@2x.png + images/tangetToolsStepIcon.png + images/tangetToolsStepIcon@2x.png + images/treeview_eye.png + images/treeview_eye@2x.png + images/treeview_pin.png + images/treeview_pin@2x.png + images/treeview_unpin.png + images/treeview_unpin@2x.png + images/treeview_unlock@2x.png + images/treeview_lock.png + images/treeview_lock@2x.png + images/treeview_unlock.png + + diff --git a/src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h b/src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h index 5a294e9aa0a..43e10bcd4c8 100644 --- a/src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h +++ b/src/plugins/qmldesigner/components/curveeditor/curveeditorstyle.h @@ -27,6 +27,8 @@ #include "detail/shortcut.h" +#include + #include #include #include @@ -39,10 +41,10 @@ namespace DesignTools { struct TreeItemStyleOption { double margins; - QIcon pinnedIcon = QIcon(":/ICON_PINNED"); - QIcon unpinnedIcon = QIcon(":/ICON_UNPINNED"); - QIcon lockedIcon = QIcon(":/ICON_LOCKED"); - QIcon unlockedIcon = QIcon(":/ICON_UNLOCKED"); + QIcon pinnedIcon = QIcon(":/curveeditor/images/treeview_pin.png"); + QIcon unpinnedIcon = QIcon(":/curveeditor/images/treeview_unpin.png"); + QIcon lockedIcon = QIcon(":/curveeditor/images/treeview_lock.png"); + QIcon unlockedIcon = QIcon(":/curveeditor/images/treeview_unlock.png"); }; struct HandleItemStyleOption @@ -87,7 +89,9 @@ struct Shortcuts Shortcut frameAll = Shortcut(Qt::NoModifier, Qt::Key_A); Shortcut insertKeyframe = Shortcut(Qt::MiddleButton, Qt::NoModifier); - Shortcut deleteKeyframe = Shortcut(Qt::NoModifier, Qt::Key_Delete); + + Shortcut deleteKeyframe = Utils::HostOsInfo::isMacHost() ? + Shortcut(Qt::NoModifier, Qt::Key_Backspace) : Shortcut(Qt::NoModifier, Qt::Key_Delete); }; struct CurveEditorStyle diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp index b327e18c01f..e1317265ff9 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/curveitem.cpp @@ -85,13 +85,19 @@ int CurveItem::type() const QRectF CurveItem::boundingRect() const { + if (m_keyframes.empty()) + return QRectF(); + auto bbox = [](QRectF &bounds, const Keyframe &frame) { grow(bounds, frame.position()); - grow(bounds, frame.leftHandle()); - grow(bounds, frame.rightHandle()); + if (frame.hasLeftHandle()) + grow(bounds, frame.leftHandle()); + if (frame.hasRightHandle()) + grow(bounds, frame.rightHandle()); }; - QRectF bounds; + QPointF init = m_keyframes[0]->keyframe().position(); + QRectF bounds(init, init); for (auto *item : m_keyframes) bbox(bounds, item->keyframe()); @@ -213,11 +219,9 @@ std::vector CurveItem::curves() const if (tmp.size() >= 2) out.push_back(AnimationCurve(tmp)); - out.push_back( - AnimationCurve( - current.data().value(), - previous.position(), - current.position())); + out.push_back(AnimationCurve(current.data().value(), + previous.position(), + current.position())); tmp.clear(); tmp.push_back(current); diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp index cf88397a46d..4cea35e098c 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp @@ -141,8 +141,7 @@ void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) const auto itemList = items(); for (auto *item : itemList) { if (auto *curveItem = qgraphicsitem_cast(item)) { - - // CurveItems might becom invalid after a keyframe-drag operation. + // CurveItems might become invalid after a keyframe-drag operation. curveItem->restore(); if (curveItem->contains(mouseEvent->scenePos())) @@ -155,6 +154,9 @@ void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) } } } + + if (m_dirty) + graphicsView()->setZoomY(0.0); } bool GraphicsScene::hasActiveKeyframe() const diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp index bfa836137f7..ed968bd0078 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp @@ -333,8 +333,6 @@ void GraphicsView::drawBackground(QPainter *painter, const QRectF &rect) painter->fillRect(scene()->sceneRect(), m_style.backgroundAlternateBrush); drawGrid(painter, rect); - drawExtremaX(painter, rect); - drawExtremaY(painter, rect); } int GraphicsView::mapTimeToX(double time) const @@ -378,13 +376,16 @@ void GraphicsView::applyZoom(double x, double y, const QPoint &pivot) double minTime = minimumTime(); double maxTime = maximumTime(); + double minValue = minimumValue(); + double maxValue = maximumValue(); + QRectF canvas = canvasRect(); double xZoomedOut = canvas.width() / (maxTime - minTime); double xZoomedIn = m_style.zoomInWidth; double scaleX = lerp(clamp(m_zoomX, 0.0, 1.0), xZoomedOut, xZoomedIn); - double yZoomedOut = canvas.height() / maximumValue(); + double yZoomedOut = canvas.height() / (maxValue - minValue); double yZoomedIn = m_style.zoomInHeight; double scaleY = lerp(clamp(m_zoomY, 0.0, 1.0), -yZoomedOut, -yZoomedIn); @@ -453,6 +454,7 @@ void GraphicsView::drawGrid(QPainter *painter, const QRectF &rect) painter->restore(); } +#if 0 void GraphicsView::drawExtremaX(QPainter *painter, const QRectF &rect) { auto drawVerticalLine = [rect, painter](double position) { @@ -480,10 +482,9 @@ void GraphicsView::drawExtremaY(QPainter *painter, const QRectF &rect) drawHorizontalLine(mapValueToY(m_scene.minimumValue())); drawHorizontalLine(mapValueToY(m_scene.maximumValue())); - drawHorizontalLine(mapValueToY(0.0)); - painter->restore(); } +#endif void GraphicsView::drawTimeScale(QPainter *painter, const QRectF &rect) { diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h index 01dd0ca0261..af138429bf2 100644 --- a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h +++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.h @@ -130,9 +130,11 @@ private: void drawGrid(QPainter *painter, const QRectF &rect); +#if 0 void drawExtremaX(QPainter *painter, const QRectF &rect); void drawExtremaY(QPainter *painter, const QRectF &rect); +#endif void drawTimeScale(QPainter *painter, const QRectF &rect); diff --git a/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsLinearIcon.png b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsLinearIcon.png new file mode 100644 index 00000000000..a21c69eb4f2 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsLinearIcon.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsLinearIcon@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsLinearIcon@2x.png new file mode 100644 index 00000000000..09a3c0d0062 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsLinearIcon@2x.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsSplineIcon.png b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsSplineIcon.png new file mode 100644 index 00000000000..73b97dca430 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsSplineIcon.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsSplineIcon@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsSplineIcon@2x.png new file mode 100644 index 00000000000..3c6b4584c16 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsSplineIcon@2x.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsStepIcon.png b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsStepIcon.png new file mode 100644 index 00000000000..0fed893c7e1 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsStepIcon.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsStepIcon@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsStepIcon@2x.png new file mode 100644 index 00000000000..682985785c3 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/tangetToolsStepIcon@2x.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_eye.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_eye.png new file mode 100644 index 00000000000..b65141f7e56 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_eye.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_eye@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_eye@2x.png new file mode 100644 index 00000000000..54bb4339a57 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_eye@2x.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_lock.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_lock.png new file mode 100644 index 00000000000..1458ac23c41 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_lock.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_lock@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_lock@2x.png new file mode 100644 index 00000000000..9a622de5762 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_lock@2x.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_pin.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_pin.png new file mode 100644 index 00000000000..5dc71ad902c Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_pin.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_pin@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_pin@2x.png new file mode 100644 index 00000000000..6342193e1e4 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_pin@2x.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_unlock.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unlock.png new file mode 100644 index 00000000000..b653b0c246a Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unlock.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_unlock@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unlock@2x.png new file mode 100644 index 00000000000..2563d5cc64b Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unlock@2x.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_unpin.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unpin.png new file mode 100644 index 00000000000..7a0e4264fab Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unpin.png differ diff --git a/src/plugins/qmldesigner/components/curveeditor/images/treeview_unpin@2x.png b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unpin@2x.png new file mode 100644 index 00000000000..396f6ce7616 Binary files /dev/null and b/src/plugins/qmldesigner/components/curveeditor/images/treeview_unpin@2x.png differ diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp index ae7400e3825..cb4b7cfe0a7 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp @@ -37,6 +37,8 @@ #include #include +#include + enum { debug = false }; @@ -181,10 +183,11 @@ void StatesEditorModel::renameState(int internalNodeId, const QString &newName) return; if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) { - Core::AsynchronousMessageBox::warning(tr("Invalid state name"), + auto w = Core::AsynchronousMessageBox::warning(tr("Invalid state name"), newName.isEmpty() ? tr("The empty string as a name is reserved for the base state.") : tr("Name already used in another state")); + w->setAttribute(Qt::WA_ShowModal, false); reset(); } else { m_statesEditorView->renameState(internalNodeId, newName); diff --git a/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp b/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp index 3ea519b79e2..e91d817772b 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/animationcurveeditormodel.cpp @@ -56,31 +56,35 @@ DesignTools::CurveEditorStyle AnimationCurveEditorModel::style() const { // Pseudo auto generated. See: CurveEditorStyleDialog DesignTools::CurveEditorStyle out; - out.backgroundBrush = QBrush(QColor(55, 55, 55)); - out.backgroundAlternateBrush = QBrush(QColor(0, 0, 50)); + out.backgroundBrush = QBrush(QColor(21, 21, 21)); + out.backgroundAlternateBrush = QBrush(QColor(32, 32, 32)); out.fontColor = QColor(255, 255, 255); out.gridColor = QColor(114, 116, 118); out.canvasMargin = 15; out.zoomInWidth = 99; out.zoomInHeight = 99; - out.timeAxisHeight = 40; + out.timeAxisHeight = 60; out.timeOffsetLeft = 10; out.timeOffsetRight = 10; - out.rangeBarColor = QColor(46, 47, 48); + out.rangeBarColor = QColor(50, 50, 255); out.rangeBarCapsColor = QColor(50, 50, 255); out.valueAxisWidth = 60; out.valueOffsetTop = 10; out.valueOffsetBottom = 10; - out.handleStyle.size = 12; + out.handleStyle.size = 10; out.handleStyle.lineWidth = 1; out.handleStyle.color = QColor(255, 255, 255); out.handleStyle.selectionColor = QColor(255, 255, 255); - out.keyframeStyle.size = 13; + out.keyframeStyle.size = 14; out.keyframeStyle.color = QColor(172, 210, 255); out.keyframeStyle.selectionColor = QColor(255, 255, 255); - out.curveStyle.width = 1; + out.curveStyle.width = 2; out.curveStyle.color = QColor(0, 200, 0); out.curveStyle.selectionColor = QColor(255, 255, 255); + out.treeItemStyle.margins = 0; + out.playhead.width = 20; + out.playhead.radius = 4; + out.playhead.color = QColor(200, 200, 0); return out; } diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp index 99cc4867101..09555f3ee37 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp @@ -55,6 +55,8 @@ #include #include +#include + #include #include #include @@ -66,6 +68,14 @@ namespace QmlDesigner { +static int deleteKey() +{ + if (Utils::HostOsInfo::isMacHost()) + return Qt::Key_Backspace; + + return Qt::Key_Delete; +} + QList allTimelineFrames(const QmlTimeline &timeline) { QList returnList; @@ -159,6 +169,7 @@ void TimelineGraphicsScene::setWidth(int width) void TimelineGraphicsScene::invalidateLayout() { m_layout->invalidate(); + toolBar()->setCurrentTimeline(currentTimeline()); } void TimelineGraphicsScene::setCurrenFrame(const QmlTimeline &timeline, qreal frame) @@ -566,14 +577,8 @@ void TimelineGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent) return; } - switch (keyEvent->key()) { - case Qt::Key_Delete: + if (deleteKey() == keyEvent->key()) handleKeyframeDeletion(); - break; - - default: - break; - } QGraphicsScene::keyReleaseEvent(keyEvent); } @@ -706,7 +711,7 @@ bool TimelineGraphicsScene::event(QEvent *event) { switch (event->type()) { case QEvent::ShortcutOverride: - if (static_cast(event)->key() == Qt::Key_Delete) { + if (static_cast(event)->key() == deleteKey()) { QGraphicsScene::keyPressEvent(static_cast(event)); event->accept(); return true; diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index 51067a9106a..e8165bee7cd 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -236,24 +236,35 @@ bool TarPackageCreationStep::appendFile(QFile &tarFile, const QFileInfo &fileInf return true; } +static bool setFilePath(TarFileHeader &header, const QByteArray &filePath) +{ + if (filePath.length() <= int(sizeof header.fileName)) { + std::memcpy(&header.fileName, filePath.data(), filePath.length()); + return true; + } + int sepIndex = filePath.indexOf('/'); + while (sepIndex != -1) { + const int fileNamePart = filePath.length() - sepIndex; + if (sepIndex <= int(sizeof header.fileNamePrefix) + && fileNamePart <= int(sizeof header.fileName)) { + std::memcpy(&header.fileNamePrefix, filePath.data(), sepIndex); + std::memcpy(&header.fileName, filePath.data() + sepIndex + 1, fileNamePart); + return true; + } + sepIndex = filePath.indexOf('/', sepIndex + 1); + } + return false; +} + bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileInfo, const QString &remoteFilePath) { TarFileHeader header; std::memset(&header, '\0', sizeof header); - const QByteArray &filePath = remoteFilePath.toUtf8(); - const int maxFilePathLength = sizeof header.fileNamePrefix + sizeof header.fileName; - if (filePath.count() > maxFilePathLength) { - raiseError(tr("Cannot add file \"%1\" to tar-archive: path too long.") - .arg(QDir::toNativeSeparators(remoteFilePath))); + if (!setFilePath(header, remoteFilePath.toUtf8())) { + raiseError(tr("Cannot add file \"%1\" to tar-archive: path too long.").arg(remoteFilePath)); return false; } - - const int fileNameBytesToWrite = qMin(filePath.length(), sizeof header.fileName); - const int fileNameOffset = filePath.length() - fileNameBytesToWrite; - std::memcpy(&header.fileName, filePath.data() + fileNameOffset, fileNameBytesToWrite); - if (fileNameOffset > 0) - std::memcpy(&header.fileNamePrefix, filePath.data(), fileNameOffset); int permissions = (0400 * fileInfo.permission(QFile::ReadOwner)) | (0200 * fileInfo.permission(QFile::WriteOwner)) | (0100 * fileInfo.permission(QFile::ExeOwner)) diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 82bb082c0a5..abdecb1180b 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -32,6 +32,9 @@ #include #include +#include +#include + #include #include #include @@ -127,11 +130,10 @@ ProjectModel::ProjectModel(QObject *parent) this, &ProjectModel::resetProjects); -#ifdef LICENSECHECKER + if (!Utils::findOrDefault(ExtensionSystem::PluginManager::plugins(), - Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")))) + Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")))) m_communityVersion = true; -#endif } int ProjectModel::rowCount(const QModelIndex &) const