Commit 4680dbed authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

sketch: Cleanup the Tool panel and tool config pages

It is not too surprising the panel cannot scroll when the container item
has a size of 0. This also cleans up most of the tool config pages that
contained way too many nested things. As a bonus, the RangeInput fields
in the tool panel now work again.

BUG: 332860
BUG: 331772
parent e7ae54f3
......@@ -180,6 +180,7 @@ Panel {
right: parent.right;
}
height: childrenRect.height;
z: 2;
Item {
id: firstToolSelector;
width: parent.width;
......@@ -239,18 +240,22 @@ Panel {
Flickable {
id: toolOptionsFullFlickable;
contentHeight: toolOptionsFull.height;
clip: true;
boundsBehavior: Flickable.StopAtBounds;
anchors {
top: toolSelectorContainer.bottom;
left: parent.left;
leftMargin: Constants.DefaultMargin;
right: parent.right;
rightMargin: Constants.DefaultMargin * 2;
bottom: parent.bottom;
}
MouseArea {
anchors.fill: parent;
hoverEnabled: true;
onContainsMouseChanged: toolOptionsFull.focus = containsMouse;
}
Loader {
id: toolOptionsFull;
width: parent.width;
......@@ -258,6 +263,6 @@ Panel {
source: "toolconfigpages/paint.qml";
}
}
ScrollDecorator { flickableItem: toolOptionsFullFlickable; }
ScrollDecorator { anchors.topMargin: toolSelectorContainer.height; flickableItem: toolOptionsFullFlickable; }
}
}
......@@ -19,20 +19,21 @@
import QtQuick 1.1
import "../../components"
Item {
Column {
id: base
property bool fullView: true;
height: childrenRect.height;
spacing: Constants.DefaultMargin;
function apply() {
toolManager.currentTool.crop();
}
ExpandingListView {
id: cropTypeList;
anchors {
top: parent.top;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
width: parent.width;
visible: fullView;
expandedHeight: Constants.GridHeight * 2;
currentIndex: toolManager.currentTool.cropType !== undefined ? toolManager.currentTool.cropType : 0;
onCurrentIndexChanged: if (toolManager.currentTool && toolManager.currentTool.cropType !== undefined) toolManager.currentTool.cropType = currentIndex;
model: ListModel {
......@@ -46,12 +47,9 @@ Item {
}
ExpandingListView {
id: cropDecorationList;
anchors {
top: cropTypeList.bottom;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
width: parent.width;
visible: fullView;
expandedHeight: Constants.GridHeight * 3;
currentIndex: toolManager.currentTool.decoration !== undefined ? toolManager.currentTool.decoration : 0;
onCurrentIndexChanged: if (toolManager.currentTool && toolManager.currentTool.decoration !== undefined && toolManager.currentTool.decoration !== currentIndex) toolManager.currentTool.decoration = currentIndex;
model: ListModel {
......@@ -69,61 +67,48 @@ Item {
}
}
}
Column {
anchors {
top: cropDecorationList.bottom;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
spacing: Constants.DefaultMargin;
RangeInput {
id: widthInput;
width: parent.width;
placeholder: "Width";
min: 0; max: sketchView.imageWidth; decimals: 0;
value: toolManager.currentTool.cropWidth !== undefined ? toolManager.currentTool.cropWidth : 0;
onValueChanged: if (toolManager.currentTool.cropWidth !== value) toolManager.currentTool.cropWidth = value;
}
RangeInput {
id: heightInput;
width: parent.width;
placeholder: "Height";
min: 0; max: sketchView.imageHeight; decimals: 0;
value: toolManager.currentTool.cropHeight !== undefined ? toolManager.currentTool.cropHeight : 0;
onValueChanged: if (toolManager.currentTool.cropHeight !== value) toolManager.currentTool.cropHeight = value;
}
/*RangeInput {
id: ratioInput;
width: parent.width;
placeholder: "Ratio";
min: 0; max: 2000; decimals: 2;
value: toolManager.currentTool.ratio !== undefined ? toolManager.currentTool.ratio : 0;
onValueChanged: if (toolManager.currentTool) toolManager.currentTool.ratio = value;
}*/
RangeInput {
id: xInput;
width: parent.width;
placeholder: "X";
min: 0; max: sketchView.imageWidth; decimals: 0;
value: toolManager.currentTool.cropX !== undefined ? toolManager.currentTool.cropX : 0;
onValueChanged: if (toolManager.currentTool.cropX !== value) toolManager.currentTool.cropX = value;
}
RangeInput {
id: yInput;
width: parent.width;
placeholder: "Y";
min: 0; max: sketchView.imageHeight; decimals: 0;
value: toolManager.currentTool.cropY !== undefined ? toolManager.currentTool.cropY : 0;
onValueChanged: if (toolManager.currentTool.cropY !== value) toolManager.currentTool.cropY = value;
}
RangeInput {
id: xInput;
width: parent.width;
placeholder: "X";
min: 0; max: sketchView.imageWidth; decimals: 0;
value: toolManager.currentTool.cropX !== undefined ? toolManager.currentTool.cropX : 0;
onValueChanged: if (toolManager.currentTool.cropX !== value) toolManager.currentTool.cropX = value;
}
RangeInput {
id: yInput;
width: parent.width;
visible: fullView;
placeholder: "Y";
min: 0; max: sketchView.imageHeight; decimals: 0;
value: toolManager.currentTool.cropY !== undefined ? toolManager.currentTool.cropY : 0;
onValueChanged: if (toolManager.currentTool.cropY !== value) toolManager.currentTool.cropY = value;
}
RangeInput {
id: widthInput;
width: parent.width;
placeholder: "Width";
min: 0; max: sketchView.imageWidth; decimals: 0;
value: toolManager.currentTool.cropWidth !== undefined ? toolManager.currentTool.cropWidth : 0;
onValueChanged: if (toolManager.currentTool.cropWidth !== value) toolManager.currentTool.cropWidth = value;
}
RangeInput {
id: heightInput;
width: parent.width;
placeholder: "Height";
min: 0; max: sketchView.imageHeight; decimals: 0;
value: toolManager.currentTool.cropHeight !== undefined ? toolManager.currentTool.cropHeight : 0;
onValueChanged: if (toolManager.currentTool.cropHeight !== value) toolManager.currentTool.cropHeight = value;
}
Connections {
target: toolManager.currentTool;
onCropWidthChanged: if (widthInput.value !== toolManager.currentTool.cropWidth) widthInput.value = toolManager.currentTool.cropWidth;
onCropHeightChanged: if (heightInput.value !== toolManager.currentTool.cropHeight) heightInput.value = toolManager.currentTool.cropHeight;
//onRatioChanged: if (ratioInput.value !== toolManager.currentTool.ratio) ratioInput.value = toolManager.currentTool.ratio;
onCropXChanged: if (xInput.value !== toolManager.currentTool.cropX) xInput.value = toolManager.currentTool.cropX;
onCropYChanged: if (yInput.value !== toolManager.currentTool.cropY) yInput.value = toolManager.currentTool.cropY;
}
......
......@@ -20,19 +20,15 @@ import QtQuick 1.1
import org.krita.sketch 1.0
import "../../components"
Item {
Column {
id: base
property bool fullView: true;
height: childrenRect.height;
spacing: Constants.DefaultMargin;
Label {
id: compositeModeListLabel
visible: fullView;
height: fullView ? Constants.DefaultFontSize : 0;
anchors {
top: parent.top;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
text: "Blending mode:"
font: Settings.theme.font("panelSection");
}
......@@ -40,12 +36,8 @@ Item {
id: compositeModeList
visible: fullView;
expandedHeight: Constants.GridHeight * 6;
anchors {
top: compositeModeListLabel.bottom;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
width: parent.width;
property bool firstSet: false;
onCurrentIndexChanged: {
if (firstSet) { model.activateItem(currentIndex); }
......@@ -53,6 +45,44 @@ Item {
}
model: compositeOpModel;
}
RangeInput {
id: opacityInput;
width: parent.width;
placeholder: "Opacity";
min: 0; max: 1; decimals: 2;
value: compositeOpModel.opacity;
onValueChanged: compositeOpModel.changePaintopValue("opacity", value);
enabled: compositeOpModel.opacityEnabled;
}
RangeInput {
id: thresholdInput;
width: parent.width;
placeholder: "Threshold";
min: 0; max: 255; decimals: 0;
value: 255;
onValueChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetThreshold(value);
}
CheckBox {
id: fillSelectionCheck;
visible: fullView;
width: parent.width;
text: "Fill Selection";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetFillSelection(checked);
}
CheckBox {
id: limitToLayerCheck;
visible: fullView;
width: parent.width;
text: "Limit to Layer";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetSampleMerged(checked);
}
Component.onCompleted: compositeModeList.currentIndex = compositeOpModel.indexOf(compositeOpModel.currentCompositeOpID);
Connections {
target: compositeOpModel;
......@@ -64,76 +94,4 @@ Item {
}
}
}
Column {
anchors {
top: fullView ? compositeModeList.bottom : compositeModeList.top;
left: parent.left;
leftMargin: Constants.DefaultMargin;
right: parent.right;
rightMargin: Constants.DefaultMargin;
}
height: childrenRect.height;
RangeInput {
id: opacityInput;
width: parent.width;
placeholder: "Opacity";
min: 0; max: 1; decimals: 2;
value: compositeOpModel.opacity;
onValueChanged: compositeOpModel.changePaintopValue("opacity", value);
enabled: compositeOpModel.opacityEnabled;
}
Item {
width: parent.width;
height: Constants.DefaultMargin;
visible: fullView;
}
RangeInput {
id: thresholdInput;
width: parent.width;
placeholder: "Threshold";
min: 0; max: 255; decimals: 0;
value: 255;
onValueChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetThreshold(value);
}
CheckBox {
id: fillSelectionCheck;
visible: fullView;
anchors {
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
text: "Fill Selection";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetFillSelection(checked);
}
CheckBox {
id: limitToLayerCheck;
visible: fullView;
anchors {
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
text: "Limit to Layer";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetSampleMerged(checked);
}
/*CheckBox {
id: usePatternCheck;
visible: fullView;
anchors {
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
text: "Use Pattern";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetUsePattern(checked);
}*/
}
}
......@@ -19,32 +19,25 @@
import QtQuick 1.1
import "../../components"
Item {
Column {
id: base
property bool fullView: true;
height: childrenRect.height;
spacing: Constants.DefaultMargin;
Label {
id: compositeModeListLabel
visible: fullView;
height: fullView ? Constants.DefaultFontSize : 0;
anchors {
top: parent.top;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
text: "Blending mode:"
font: Settings.theme.font("panelSection");
}
ExpandingListView {
id: compositeModeList
visible: fullView;
expandedHeight: Constants.GridHeight * 6;
anchors {
top: compositeModeListLabel.bottom;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
width: parent.width;
property bool firstSet: false;
onCurrentIndexChanged: {
if (firstSet) { model.activateItem(currentIndex); }
......@@ -52,53 +45,22 @@ Item {
}
model: compositeOpModel;
}
Component.onCompleted: compositeModeList.currentIndex = compositeOpModel.indexOf(compositeOpModel.currentCompositeOpID);
Connections {
target: compositeOpModel;
onOpacityChanged: opacityInput.value = compositeOpModel.opacity;
onCurrentCompositeOpIDChanged: {
var newIndex = compositeOpModel.indexOf(compositeOpModel.currentCompositeOpID);
if (compositeModeList.currentIndex !== newIndex) {
compositeModeList.currentIndex = newIndex;
}
}
}
Column {
id: firstColumn
anchors {
top: fullView ? compositeModeList.bottom : compositeModeList.top;
left: parent.left;
leftMargin: Constants.DefaultMargin;
right: parent.right;
rightMargin: Constants.DefaultMargin;
}
height: childrenRect.height;
RangeInput {
id: opacityInput;
width: parent.width;
placeholder: "Opacity";
min: 0; max: 1; decimals: 2;
value: compositeOpModel.opacity;
onValueChanged: compositeOpModel.changePaintopValue("opacity", value);
enabled: compositeOpModel.opacityEnabled;
}
Item {
width: parent.width;
height: Constants.DefaultMargin;
}
RangeInput {
id: opacityInput;
width: parent.width;
placeholder: "Opacity";
min: 0; max: 1; decimals: 2;
value: compositeOpModel.opacity;
onValueChanged: compositeOpModel.changePaintopValue("opacity", value);
enabled: compositeOpModel.opacityEnabled;
}
ExpandingListView {
id: shapeList;
anchors {
top: firstColumn.bottom;
left: parent.left;
leftMargin: Constants.DefaultMargin;
right: parent.right;
rightMargin: Constants.DefaultMargin;
}
width: parent.width;
visible: fullView;
onCurrentIndexChanged: if (toolManager.currentTool && toolManager.currentTool.slotSetShape) toolManager.currentTool.slotSetShape(currentIndex);
model: ListModel {
ListElement {
......@@ -122,42 +84,49 @@ Item {
}
}
Column {
anchors {
top: shapeList.bottom;
left: parent.left;
leftMargin: Constants.DefaultMargin;
right: parent.right;
rightMargin: Constants.DefaultMargin;
}
height: childrenRect.height;
RangeInput {
width: parent.width;
placeholder: "Anti-alias";
min: 0; max: 1; decimals: 3;
value: 0.2;
onValueChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetAntiAliasThreshold(value);
}
RangeInput {
visible: fullView;
width: parent.width;
placeholder: "Anti-alias";
min: 0; max: 1; decimals: 3;
value: 0.2;
onValueChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetAntiAliasThreshold(value);
}
RangeInput {
width: parent.width;
placeholder: "Preview";
min: 0; max: 100; decimals: 0;
value: 75;
onValueChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetPreviewOpacity(value);
}
RangeInput {
visible: fullView;
width: parent.width;
placeholder: "Preview";
min: 0; max: 100; decimals: 0;
value: 75;
onValueChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetPreviewOpacity(value);
}
CheckBox {
width: parent.width;
text: "Reverse";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetReverse(checked);
}
CheckBox {
width: parent.width;
text: "Repeat";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetRepeat(checked);
CheckBox {
visible: fullView;
width: parent.width;
text: "Reverse";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetReverse(checked);
}
CheckBox {
visible: fullView;
width: parent.width;
text: "Repeat";
checked: false;
onCheckedChanged: if (toolManager.currentTool) toolManager.currentTool.slotSetRepeat(checked);
}
Component.onCompleted: compositeModeList.currentIndex = compositeOpModel.indexOf(compositeOpModel.currentCompositeOpID);
Connections {
target: compositeOpModel;
onOpacityChanged: opacityInput.value = compositeOpModel.opacity;
onCurrentCompositeOpIDChanged: {
var newIndex = compositeOpModel.indexOf(compositeOpModel.currentCompositeOpID);
if (compositeModeList.currentIndex !== newIndex) {
compositeModeList.currentIndex = newIndex;
}
}
}
}
......@@ -22,6 +22,8 @@ import "../../components"
Item {
id: base
property bool fullView: true;
height: childrenRect.height;
ExpandingListView {
anchors {
top: parent.top;
......@@ -29,6 +31,7 @@ Item {
right: parent.right;
margins: Constants.DefaultMargin;
}
expandedHeight: Constants.GridHeight * 3;
model: ListModel {
ListElement {
text: "Current Layer";
......
......@@ -20,40 +20,166 @@ import QtQuick 1.1
import org.krita.sketch 1.0
import "../../components"
Item {
Column {
id: base
property bool fullView: true;
height: childrenRect.height;
spacing: Constants.DefaultMargin;
// === Blending Mode ===
Label {
id: compositeModeListLabel
visible: fullView;
height: fullView ? Constants.DefaultFontSize : 0;
anchors {
top: parent.top;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
text: "Blending mode:"
font: Settings.theme.font("panelSection");
}
ExpandingListView {
id: compositeModeList
visible: fullView;
width: parent.width;
expandedHeight: Constants.GridHeight * 6;
anchors {
top: compositeModeListLabel.bottom;
left: parent.left;
right: parent.right;
margins: Constants.DefaultMargin;
}
property bool firstSet: false;
onCurrentIndexChanged: {
if (firstSet) { model.activateItem(currentIndex); }
else { firstSet = true; }
}
model: compositeOpModel;