Merge remote-tracking branch 'origin/4.10'

Change-Id: I4d24269ef040c45e2143dfa86d1be3f7e8008521
This commit is contained in:
Eike Ziller
2019-08-15 08:57:27 +02:00
36 changed files with 228 additions and 79 deletions

View File

@@ -20,6 +20,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
option(WITH_TESTS "Build Tests" OFF) option(WITH_TESTS "Build Tests" OFF)
option(WITH_DEBUG_CMAKE "Enabled CMake project debugging functionality (e.g. source file disk checking)" 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) set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -35,7 +36,7 @@ endif()
find_package(Qt5 find_package(Qt5
COMPONENTS Concurrent Core Network PrintSupport Qml Quick QuickWidgets COMPONENTS Concurrent Core Network PrintSupport Qml Quick QuickWidgets
Sql ${_TEST_QT_COMPONENT} Sql Widgets ${_TEST_QT_COMPONENT}
REQUIRED REQUIRED
) )

View File

@@ -250,6 +250,42 @@ function(qtc_plugin_enabled varName name)
endif() endif()
endfunction() 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 # Public API functions
# #
@@ -330,6 +366,7 @@ function(add_qtc_library name)
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${IDE_LIBRARY_PATH}" ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${IDE_LIBRARY_PATH}"
${_arg_PROPERTIES} ${_arg_PROPERTIES}
) )
enable_pch(${name})
unset(NAMELINK_OPTION) unset(NAMELINK_OPTION)
if (library_type STREQUAL "SHARED") if (library_type STREQUAL "SHARED")
@@ -534,6 +571,7 @@ function(add_qtc_plugin target_name)
OUTPUT_NAME "${name}" OUTPUT_NAME "${name}"
${_arg_PROPERTIES} ${_arg_PROPERTIES}
) )
enable_pch(${target_name})
foreach(file IN LISTS _arg_EXPLICIT_MOC) foreach(file IN LISTS _arg_EXPLICIT_MOC)
set_explicit_moc(${target_name} "${file}") set_explicit_moc(${target_name} "${file}")
@@ -595,6 +633,15 @@ function(extend_qtc_target target_name)
set(_arg_SOURCES ${prefixed_sources}) set(_arg_SOURCES ${prefixed_sources})
endif() endif()
target_sources(${target_name} PRIVATE ${_arg_SOURCES}) 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}") set_public_headers(${target_name} "${_arg_SOURCES}")
foreach(file IN LISTS _arg_EXPLICIT_MOC) foreach(file IN LISTS _arg_EXPLICIT_MOC)
@@ -662,6 +709,7 @@ function(add_qtc_executable name)
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${_DESTINATION}" RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${_DESTINATION}"
${_arg_PROPERTIES} ${_arg_PROPERTIES}
) )
enable_pch(${name})
if (NOT _arg_SKIP_INSTALL) if (NOT _arg_SKIP_INSTALL)
install(TARGETS ${name} DESTINATION "${_DESTINATION}") install(TARGETS ${name} DESTINATION "${_DESTINATION}")
@@ -702,6 +750,7 @@ function(add_qtc_test name)
BUILD_RPATH "${_RPATH_BASE}/${_RPATH}" BUILD_RPATH "${_RPATH_BASE}/${_RPATH}"
INSTALL_RPATH "${_RPATH_BASE}/${_RPATH}" INSTALL_RPATH "${_RPATH_BASE}/${_RPATH}"
) )
enable_pch(${name})
if (NOT _arg_GTEST) if (NOT _arg_GTEST)
add_test(NAME ${name} COMMAND ${name}) add_test(NAME ${name} COMMAND ${name})

View File

@@ -68,6 +68,8 @@ Loader {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: gradientDialogLoader.visible = false onClicked: gradientDialogLoader.visible = false
preventStealing: true
hoverEnabled: true
} }
Rectangle { Rectangle {
id: background id: background

View File

@@ -28,7 +28,7 @@ import QtQuick.Layouts 1.0
import QtQuickDesignerTheme 1.0 import QtQuickDesignerTheme 1.0
import StudioControls 1.0 as StudioControls import StudioControls 1.0 as StudioControls
StudioControls.SpinBox { StudioControls.RealSpinBox {
id: spinBox id: spinBox
width: 82 width: 82
Layout.minimumWidth: 82 Layout.minimumWidth: 82
@@ -36,9 +36,10 @@ StudioControls.SpinBox {
property string propertyName property string propertyName
actionIndicatorVisible: false actionIndicatorVisible: false
from: -9999 realFrom: -9999
to: 9999 realTo: 9999
Component.onCompleted: spinBox.value = gradientLine.model.readGradientProperty(propertyName) realStepSize: 1
onCompressedValueModified: gradientLine.model.setGradientProperty(propertyName, spinBox.value)
stepSize: 1 Component.onCompleted: spinBox.realValue = gradientLine.model.readGradientProperty(propertyName)
onCompressedRealValueModified: gradientLine.model.setGradientProperty(propertyName, spinBox.realValue)
} }

View File

@@ -37,7 +37,6 @@ RowLayout {
property string filter: "*.png *.gif *.jpg *.bmp *.jpeg *.svg" property string filter: "*.png *.gif *.jpg *.bmp *.jpeg *.svg"
FileResourcesModel { FileResourcesModel {
modelNodeBackendProperty: modelNodeBackend modelNodeBackendProperty: modelNodeBackend
filter: urlChooser.filter filter: urlChooser.filter
@@ -63,15 +62,20 @@ RowLayout {
property bool isComplete: false property bool isComplete: false
property bool dirty: false
onEditTextChanged: comboBox.dirty = true
function setCurrentText(text) { function setCurrentText(text) {
if (text === "") if (text === "")
return return
var index = comboBox.find(text)
var index = comboBox.find(textValue)
if (index === -1) if (index === -1)
currentIndex = -1 currentIndex = -1
editText = textValue
editText = text
comboBox.dirty = false
} }
property string textValue: { property string textValue: {
@@ -81,9 +85,7 @@ RowLayout {
return backendValue.valueToString return backendValue.valueToString
} }
onTextValueChanged: { onTextValueChanged: setCurrentText(textValue)
setCurrentText(textValue)
}
Layout.fillWidth: true Layout.fillWidth: true
@@ -97,25 +99,41 @@ RowLayout {
setCurrentText(textValue) setCurrentText(textValue)
} }
onAccepted: { onAccepted: {
if (!comboBox.isComplete) if (!comboBox.isComplete)
return; return;
if (backendValue.value !== currentText) if (backendValue.value !== editText)
backendValue.value = currentText; backendValue.value = editText;
comboBox.dirty = false
} }
onActivated: { onFocusChanged: {
var cText = textAt(index) if (comboBox.dirty)
print(cText) handleActivate(comboBox.currentIndex)
if (backendValue === undefined) }
onActivated: handleActivate(index)
function handleActivate(index)
{
var cText = comboBox.textAt(index)
if (index === -1)
cText = comboBox.editText
if (urlChooser.backendValue === undefined)
return; return;
if (!comboBox.isComplete) if (!comboBox.isComplete)
return; return;
if (backendValue.value !== cText) if (urlChooser.backendValue.value !== cText)
backendValue.value = cText; urlChooser.backendValue.value = cText;
comboBox.dirty = false
} }
Component.onCompleted: { Component.onCompleted: {

View File

@@ -524,7 +524,8 @@ QStringList GccToolChain::gccPrepareArguments(const QStringList &flags,
const QString &flag = allFlags.at(i); const QString &flag = allFlags.at(i);
if (flag.startsWith("-stdlib=") || flag.startsWith("--gcc-toolchain=") if (flag.startsWith("-stdlib=") || flag.startsWith("--gcc-toolchain=")
|| flag.startsWith("-B") || flag.startsWith("--target=") || flag.startsWith("-B") || flag.startsWith("--target=")
|| (flag.startsWith("-isystem") && flag.length() > 8)) { || (flag.startsWith("-isystem") && flag.length() > 8)
|| flag == "-nostdinc" || flag == "-nostdinc++") {
arguments << flag; arguments << flag;
} else if ((flag == "-target" || flag == "-gcc-toolchain" || flag == "-isystem" } else if ((flag == "-target" || flag == "-gcc-toolchain" || flag == "-isystem"
|| flag == "-arch") || flag == "-arch")

View File

@@ -327,6 +327,22 @@ void AnimationCurve::analyze()
if (frame.position().y() > m_maxY) if (frame.position().y() > m_maxY)
m_maxY = frame.position().y(); 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();
}
} }
} }
} }

View File

@@ -42,12 +42,12 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent)
, m_tree(new TreeView(model, this)) , m_tree(new TreeView(model, this))
, m_view(new GraphicsView(model)) , m_view(new GraphicsView(model))
{ {
QSplitter *splitter = new QSplitter; auto *splitter = new QSplitter;
splitter->addWidget(m_tree); splitter->addWidget(m_tree);
splitter->addWidget(m_view); splitter->addWidget(m_view);
splitter->setStretchFactor(1, 2); splitter->setStretchFactor(1, 2);
QVBoxLayout *box = new QVBoxLayout; auto *box = new QVBoxLayout;
box->addWidget(createToolBar()); box->addWidget(createToolBar());
box->addWidget(splitter); box->addWidget(splitter);
setLayout(box); setLayout(box);
@@ -72,12 +72,12 @@ void CurveEditor::clearCanvas()
QToolBar *CurveEditor::createToolBar() QToolBar *CurveEditor::createToolBar()
{ {
QToolBar *bar = new QToolBar; auto *bar = new QToolBar;
bar->setFloatable(false); bar->setFloatable(false);
QAction *tangentLinearAction = bar->addAction("Linear"); QAction *tangentLinearAction = bar->addAction(QIcon(":/curveeditor/images/tangetToolsLinearIcon.png"), "Linear");
QAction *tangentStepAction = bar->addAction("Step"); QAction *tangentStepAction = bar->addAction(QIcon(":/curveeditor/images/tangetToolsStepIcon.png"), "Step");
QAction *tangentSplineAction = bar->addAction("Spline"); QAction *tangentSplineAction = bar->addAction(QIcon(":/curveeditor/images/tangetToolsSplineIcon.png"), "Spline");
QAction *tangentDefaultAction = bar->addAction("Set Default"); QAction *tangentDefaultAction = bar->addAction("Set Default");
auto setLinearInterpolation = [this]() { auto setLinearInterpolation = [this]() {

View File

@@ -44,3 +44,6 @@ SOURCES += \
$$PWD/detail/utils.cpp \ $$PWD/detail/utils.cpp \
$$PWD/keyframe.cpp \ $$PWD/keyframe.cpp \
$$PWD/treeitem.cpp $$PWD/treeitem.cpp
RESOURCES += \
$$PWD/curveeditor.qrc

View File

@@ -0,0 +1,20 @@
<RCC>
<qresource prefix="/curveeditor">
<file>images/tangetToolsSplineIcon.png</file>
<file>images/tangetToolsSplineIcon@2x.png</file>
<file>images/tangetToolsLinearIcon.png</file>
<file>images/tangetToolsLinearIcon@2x.png</file>
<file>images/tangetToolsStepIcon.png</file>
<file>images/tangetToolsStepIcon@2x.png</file>
<file>images/treeview_eye.png</file>
<file>images/treeview_eye@2x.png</file>
<file>images/treeview_pin.png</file>
<file>images/treeview_pin@2x.png</file>
<file>images/treeview_unpin.png</file>
<file>images/treeview_unpin@2x.png</file>
<file>images/treeview_unlock@2x.png</file>
<file>images/treeview_lock.png</file>
<file>images/treeview_lock@2x.png</file>
<file>images/treeview_unlock.png</file>
</qresource>
</RCC>

View File

@@ -27,6 +27,8 @@
#include "detail/shortcut.h" #include "detail/shortcut.h"
#include <utils/hostosinfo.h>
#include <QBitmap> #include <QBitmap>
#include <QBrush> #include <QBrush>
#include <QColor> #include <QColor>
@@ -39,10 +41,10 @@ namespace DesignTools {
struct TreeItemStyleOption struct TreeItemStyleOption
{ {
double margins; double margins;
QIcon pinnedIcon = QIcon(":/ICON_PINNED"); QIcon pinnedIcon = QIcon(":/curveeditor/images/treeview_pin.png");
QIcon unpinnedIcon = QIcon(":/ICON_UNPINNED"); QIcon unpinnedIcon = QIcon(":/curveeditor/images/treeview_unpin.png");
QIcon lockedIcon = QIcon(":/ICON_LOCKED"); QIcon lockedIcon = QIcon(":/curveeditor/images/treeview_lock.png");
QIcon unlockedIcon = QIcon(":/ICON_UNLOCKED"); QIcon unlockedIcon = QIcon(":/curveeditor/images/treeview_unlock.png");
}; };
struct HandleItemStyleOption struct HandleItemStyleOption
@@ -87,7 +89,9 @@ struct Shortcuts
Shortcut frameAll = Shortcut(Qt::NoModifier, Qt::Key_A); Shortcut frameAll = Shortcut(Qt::NoModifier, Qt::Key_A);
Shortcut insertKeyframe = Shortcut(Qt::MiddleButton, Qt::NoModifier); 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 struct CurveEditorStyle

View File

@@ -85,13 +85,19 @@ int CurveItem::type() const
QRectF CurveItem::boundingRect() const QRectF CurveItem::boundingRect() const
{ {
if (m_keyframes.empty())
return QRectF();
auto bbox = [](QRectF &bounds, const Keyframe &frame) { auto bbox = [](QRectF &bounds, const Keyframe &frame) {
grow(bounds, frame.position()); grow(bounds, frame.position());
grow(bounds, frame.leftHandle()); if (frame.hasLeftHandle())
grow(bounds, frame.rightHandle()); 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) for (auto *item : m_keyframes)
bbox(bounds, item->keyframe()); bbox(bounds, item->keyframe());
@@ -213,11 +219,9 @@ std::vector<AnimationCurve> CurveItem::curves() const
if (tmp.size() >= 2) if (tmp.size() >= 2)
out.push_back(AnimationCurve(tmp)); out.push_back(AnimationCurve(tmp));
out.push_back( out.push_back(AnimationCurve(current.data().value<QEasingCurve>(),
AnimationCurve( previous.position(),
current.data().value<QEasingCurve>(), current.position()));
previous.position(),
current.position()));
tmp.clear(); tmp.clear();
tmp.push_back(current); tmp.push_back(current);

View File

@@ -141,8 +141,7 @@ void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
const auto itemList = items(); const auto itemList = items();
for (auto *item : itemList) { for (auto *item : itemList) {
if (auto *curveItem = qgraphicsitem_cast<CurveItem *>(item)) { if (auto *curveItem = qgraphicsitem_cast<CurveItem *>(item)) {
// CurveItems might become invalid after a keyframe-drag operation.
// CurveItems might becom invalid after a keyframe-drag operation.
curveItem->restore(); curveItem->restore();
if (curveItem->contains(mouseEvent->scenePos())) 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 bool GraphicsScene::hasActiveKeyframe() const

View File

@@ -333,8 +333,6 @@ void GraphicsView::drawBackground(QPainter *painter, const QRectF &rect)
painter->fillRect(scene()->sceneRect(), m_style.backgroundAlternateBrush); painter->fillRect(scene()->sceneRect(), m_style.backgroundAlternateBrush);
drawGrid(painter, rect); drawGrid(painter, rect);
drawExtremaX(painter, rect);
drawExtremaY(painter, rect);
} }
int GraphicsView::mapTimeToX(double time) const int GraphicsView::mapTimeToX(double time) const
@@ -378,13 +376,16 @@ void GraphicsView::applyZoom(double x, double y, const QPoint &pivot)
double minTime = minimumTime(); double minTime = minimumTime();
double maxTime = maximumTime(); double maxTime = maximumTime();
double minValue = minimumValue();
double maxValue = maximumValue();
QRectF canvas = canvasRect(); QRectF canvas = canvasRect();
double xZoomedOut = canvas.width() / (maxTime - minTime); double xZoomedOut = canvas.width() / (maxTime - minTime);
double xZoomedIn = m_style.zoomInWidth; double xZoomedIn = m_style.zoomInWidth;
double scaleX = lerp(clamp(m_zoomX, 0.0, 1.0), xZoomedOut, xZoomedIn); 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 yZoomedIn = m_style.zoomInHeight;
double scaleY = lerp(clamp(m_zoomY, 0.0, 1.0), -yZoomedOut, -yZoomedIn); 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(); painter->restore();
} }
#if 0
void GraphicsView::drawExtremaX(QPainter *painter, const QRectF &rect) void GraphicsView::drawExtremaX(QPainter *painter, const QRectF &rect)
{ {
auto drawVerticalLine = [rect, painter](double position) { 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.minimumValue()));
drawHorizontalLine(mapValueToY(m_scene.maximumValue())); drawHorizontalLine(mapValueToY(m_scene.maximumValue()));
drawHorizontalLine(mapValueToY(0.0));
painter->restore(); painter->restore();
} }
#endif
void GraphicsView::drawTimeScale(QPainter *painter, const QRectF &rect) void GraphicsView::drawTimeScale(QPainter *painter, const QRectF &rect)
{ {

View File

@@ -130,9 +130,11 @@ private:
void drawGrid(QPainter *painter, const QRectF &rect); void drawGrid(QPainter *painter, const QRectF &rect);
#if 0
void drawExtremaX(QPainter *painter, const QRectF &rect); void drawExtremaX(QPainter *painter, const QRectF &rect);
void drawExtremaY(QPainter *painter, const QRectF &rect); void drawExtremaY(QPainter *painter, const QRectF &rect);
#endif
void drawTimeScale(QPainter *painter, const QRectF &rect); void drawTimeScale(QPainter *painter, const QRectF &rect);

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -37,6 +37,8 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h> #include <coreplugin/messagebox.h>
#include <QWidget>
enum { enum {
debug = false debug = false
}; };
@@ -181,10 +183,11 @@ void StatesEditorModel::renameState(int internalNodeId, const QString &newName)
return; return;
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) { 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() ? newName.isEmpty() ?
tr("The empty string as a name is reserved for the base state.") : tr("The empty string as a name is reserved for the base state.") :
tr("Name already used in another state")); tr("Name already used in another state"));
w->setAttribute(Qt::WA_ShowModal, false);
reset(); reset();
} else { } else {
m_statesEditorView->renameState(internalNodeId, newName); m_statesEditorView->renameState(internalNodeId, newName);

View File

@@ -56,31 +56,35 @@ DesignTools::CurveEditorStyle AnimationCurveEditorModel::style() const
{ {
// Pseudo auto generated. See: CurveEditorStyleDialog // Pseudo auto generated. See: CurveEditorStyleDialog
DesignTools::CurveEditorStyle out; DesignTools::CurveEditorStyle out;
out.backgroundBrush = QBrush(QColor(55, 55, 55)); out.backgroundBrush = QBrush(QColor(21, 21, 21));
out.backgroundAlternateBrush = QBrush(QColor(0, 0, 50)); out.backgroundAlternateBrush = QBrush(QColor(32, 32, 32));
out.fontColor = QColor(255, 255, 255); out.fontColor = QColor(255, 255, 255);
out.gridColor = QColor(114, 116, 118); out.gridColor = QColor(114, 116, 118);
out.canvasMargin = 15; out.canvasMargin = 15;
out.zoomInWidth = 99; out.zoomInWidth = 99;
out.zoomInHeight = 99; out.zoomInHeight = 99;
out.timeAxisHeight = 40; out.timeAxisHeight = 60;
out.timeOffsetLeft = 10; out.timeOffsetLeft = 10;
out.timeOffsetRight = 10; out.timeOffsetRight = 10;
out.rangeBarColor = QColor(46, 47, 48); out.rangeBarColor = QColor(50, 50, 255);
out.rangeBarCapsColor = QColor(50, 50, 255); out.rangeBarCapsColor = QColor(50, 50, 255);
out.valueAxisWidth = 60; out.valueAxisWidth = 60;
out.valueOffsetTop = 10; out.valueOffsetTop = 10;
out.valueOffsetBottom = 10; out.valueOffsetBottom = 10;
out.handleStyle.size = 12; out.handleStyle.size = 10;
out.handleStyle.lineWidth = 1; out.handleStyle.lineWidth = 1;
out.handleStyle.color = QColor(255, 255, 255); out.handleStyle.color = QColor(255, 255, 255);
out.handleStyle.selectionColor = 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.color = QColor(172, 210, 255);
out.keyframeStyle.selectionColor = QColor(255, 255, 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.color = QColor(0, 200, 0);
out.curveStyle.selectionColor = QColor(255, 255, 255); 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; return out;
} }

View File

@@ -55,6 +55,8 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/hostosinfo.h>
#include <QComboBox> #include <QComboBox>
#include <QGraphicsLinearLayout> #include <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
@@ -66,6 +68,14 @@
namespace QmlDesigner { namespace QmlDesigner {
static int deleteKey()
{
if (Utils::HostOsInfo::isMacHost())
return Qt::Key_Backspace;
return Qt::Key_Delete;
}
QList<QmlTimelineKeyframeGroup> allTimelineFrames(const QmlTimeline &timeline) QList<QmlTimelineKeyframeGroup> allTimelineFrames(const QmlTimeline &timeline)
{ {
QList<QmlTimelineKeyframeGroup> returnList; QList<QmlTimelineKeyframeGroup> returnList;
@@ -159,6 +169,7 @@ void TimelineGraphicsScene::setWidth(int width)
void TimelineGraphicsScene::invalidateLayout() void TimelineGraphicsScene::invalidateLayout()
{ {
m_layout->invalidate(); m_layout->invalidate();
toolBar()->setCurrentTimeline(currentTimeline());
} }
void TimelineGraphicsScene::setCurrenFrame(const QmlTimeline &timeline, qreal frame) void TimelineGraphicsScene::setCurrenFrame(const QmlTimeline &timeline, qreal frame)
@@ -566,14 +577,8 @@ void TimelineGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
return; return;
} }
switch (keyEvent->key()) { if (deleteKey() == keyEvent->key())
case Qt::Key_Delete:
handleKeyframeDeletion(); handleKeyframeDeletion();
break;
default:
break;
}
QGraphicsScene::keyReleaseEvent(keyEvent); QGraphicsScene::keyReleaseEvent(keyEvent);
} }
@@ -706,7 +711,7 @@ bool TimelineGraphicsScene::event(QEvent *event)
{ {
switch (event->type()) { switch (event->type()) {
case QEvent::ShortcutOverride: case QEvent::ShortcutOverride:
if (static_cast<QKeyEvent *>(event)->key() == Qt::Key_Delete) { if (static_cast<QKeyEvent *>(event)->key() == deleteKey()) {
QGraphicsScene::keyPressEvent(static_cast<QKeyEvent *>(event)); QGraphicsScene::keyPressEvent(static_cast<QKeyEvent *>(event));
event->accept(); event->accept();
return true; return true;

View File

@@ -236,24 +236,35 @@ bool TarPackageCreationStep::appendFile(QFile &tarFile, const QFileInfo &fileInf
return true; 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, bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileInfo,
const QString &remoteFilePath) const QString &remoteFilePath)
{ {
TarFileHeader header; TarFileHeader header;
std::memset(&header, '\0', sizeof header); std::memset(&header, '\0', sizeof header);
const QByteArray &filePath = remoteFilePath.toUtf8(); if (!setFilePath(header, remoteFilePath.toUtf8())) {
const int maxFilePathLength = sizeof header.fileNamePrefix + sizeof header.fileName; raiseError(tr("Cannot add file \"%1\" to tar-archive: path too long.").arg(remoteFilePath));
if (filePath.count() > maxFilePathLength) {
raiseError(tr("Cannot add file \"%1\" to tar-archive: path too long.")
.arg(QDir::toNativeSeparators(remoteFilePath)));
return false; return false;
} }
const int fileNameBytesToWrite = qMin<int>(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)) int permissions = (0400 * fileInfo.permission(QFile::ReadOwner))
| (0200 * fileInfo.permission(QFile::WriteOwner)) | (0200 * fileInfo.permission(QFile::WriteOwner))
| (0100 * fileInfo.permission(QFile::ExeOwner)) | (0100 * fileInfo.permission(QFile::ExeOwner))

View File

@@ -32,6 +32,9 @@
#include <coreplugin/imode.h> #include <coreplugin/imode.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
@@ -127,11 +130,10 @@ ProjectModel::ProjectModel(QObject *parent)
this, this,
&ProjectModel::resetProjects); &ProjectModel::resetProjects);
#ifdef LICENSECHECKER
if (!Utils::findOrDefault(ExtensionSystem::PluginManager::plugins(), if (!Utils::findOrDefault(ExtensionSystem::PluginManager::plugins(),
Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker")))) Utils::equal(&ExtensionSystem::PluginSpec::name, QString("LicenseChecker"))))
m_communityVersion = true; m_communityVersion = true;
#endif
} }
int ProjectModel::rowCount(const QModelIndex &) const int ProjectModel::rowCount(const QModelIndex &) const