[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-foilnotes.git</param>
<param name="branch">master</param>
- <param name="revision">50f722f</param>
+ <param name="revision">629469a</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/app.pro
^
|
@@ -139,6 +139,7 @@
HEADERS += \
$${HARBOUR_LIB_INCLUDE}/HarbourBase32.h \
+ $${HARBOUR_LIB_INCLUDE}/HarbourColorEditorModel.h \
$${HARBOUR_LIB_INCLUDE}/HarbourDebug.h \
$${HARBOUR_LIB_INCLUDE}/HarbourProcessState.h \
$${HARBOUR_LIB_INCLUDE}/HarbourOrganizeListModel.h \
@@ -153,6 +154,7 @@
SOURCES += \
$${HARBOUR_LIB_SRC}/HarbourBase32.cpp \
+ $${HARBOUR_LIB_SRC}/HarbourColorEditorModel.cpp \
$${HARBOUR_LIB_SRC}/HarbourMce.cpp \
$${HARBOUR_LIB_SRC}/HarbourOrganizeListModel.cpp \
$${HARBOUR_LIB_SRC}/HarbourProcessState.cpp \
@@ -165,12 +167,16 @@
$${HARBOUR_LIB_SRC}/HarbourTheme.cpp
HARBOUR_QML_COMPONENTS = \
+ $${HARBOUR_LIB_QML}/HarbourColorEditorDialog.qml \
+ $${HARBOUR_LIB_QML}/HarbourColorHueItem.qml \
+ $${HARBOUR_LIB_QML}/HarbourColorPickerDialog.qml \
$${HARBOUR_LIB_QML}/HarbourFitLabel.qml \
- $${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml\
- $${HARBOUR_LIB_QML}/HarbourHintIconButton.qml\
+ $${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml \
+ $${HARBOUR_LIB_QML}/HarbourHintIconButton.qml \
$${HARBOUR_LIB_QML}/HarbourHorizontalSwipeHint.qml\
$${HARBOUR_LIB_QML}/HarbourIconTextButton.qml \
$${HARBOUR_LIB_QML}/HarbourPasswordInputField.qml \
+ $${HARBOUR_LIB_QML}/HarbourPressEffect.qml \
$${HARBOUR_LIB_QML}/HarbourShakeAnimation.qml
OTHER_FILES += $${HARBOUR_QML_COMPONENTS}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/harbour-lib/harbour-lib.pro
^
|
@@ -26,6 +26,7 @@
src/HarbourBase32.cpp \
src/HarbourBase45.cpp \
src/HarbourClipboard.cpp \
+ src/HarbourColorEditorModel.cpp \
src/HarbourDisplayBlanking.cpp \
src/HarbourJson.cpp \
src/HarbourLib.cpp \
@@ -59,6 +60,7 @@
include/HarbourBase32.h \
include/HarbourBase45.h \
include/HarbourClipboard.h \
+ include/HarbourColorEditorModel.h \
include/HarbourDebug.h \
include/HarbourDisplayBlanking.h \
include/HarbourJson.h \
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/harbour-lib/include/HarbourColorEditorModel.h
^
|
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_COLOR_EDITOR_MODEL_H
+#define HARBOUR_COLOR_EDITOR_MODEL_H
+
+#include <QList>
+#include <QColor>
+#include <QAbstractListModel>
+
+class HarbourColorEditorModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList colors READ getColors WRITE setColors NOTIFY colorsChanged)
+ Q_PROPERTY(int dragPos READ getDragPos WRITE setDragPos NOTIFY dragPosChanged)
+ Q_ENUMS(ItemType)
+
+public:
+ enum ItemType {
+ ColorItem,
+ TrashedItem,
+ AddItem
+ };
+
+ HarbourColorEditorModel(QObject* aParent = Q_NULLPTR);
+
+ QStringList getColors() const;
+ void setColors(QStringList aColors);
+
+ int getDragPos() const;
+ void setDragPos(int pos);
+
+ Q_INVOKABLE void addColor(QColor aColor);
+ Q_INVOKABLE int indexOf(QColor aColor) const;
+
+ // QAbstractListModel
+ QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex& aParent) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex& aIndex, int aRole) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void colorsChanged();
+ void dragPosChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_COLOR_EDITOR_MODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/harbour-lib/qml/HarbourColorEditorDialog.qml
^
|
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Dialog {
+ id: thisDialog
+
+ readonly property color selectedColor: sampleItem.color
+ property color initialColor: Theme.highlightColor
+ property string acceptText: "Add color"
+ property alias hueSliderText: hueSlider.label // "Color"
+ property alias brightnessSliderText: brightnessSlider.label // "Brightness"
+ property string hexNotationText: "Hex notation"
+
+ canAccept: hexText.acceptableInput
+ forwardNavigation: !hueItem.pressed
+ backNavigation: !hueItem.pressed
+
+ DialogHeader {
+ id: header
+
+ acceptText: forwardNavigation ?
+ (thisDialog.acceptText ? thisDialog.acceptText : defaultAcceptText) : ""
+ }
+
+ Component.onCompleted: hexText.text = initialColor.toString().substr(1)
+
+ // Otherwise width is changing with a delay, causing visible layout changes
+ onIsLandscapeChanged: width = isLandscape ? Screen.height : Screen.width
+
+ SilicaFlickable {
+ clip: true
+ interactive: !hueItem.pressed
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: header.bottom
+ bottom: parent.bottom
+ }
+
+ HarbourColorHueItem {
+ id: hueItem
+
+ x: Theme.horizontalPageMargin
+ width: parent.width - 2 * x
+ anchors {
+ top: parent.top
+ bottom: toolPanel.top
+ bottomMargin: Theme.paddingSmall
+ }
+ brightness: brightnessSlider.sliderValue
+ onTapped: hueSlider.value = h
+ }
+
+ Column {
+ id: toolPanel
+
+ width: parent.width
+ anchors.bottom: parent.bottom
+
+ Slider {
+ id: hueSlider
+
+ width: parent.width
+ leftMargin: Theme.horizontalPageMargin
+ rightMargin: Theme.horizontalPageMargin
+ minimumValue: 0
+ maximumValue: 1
+ value: 1
+ label: "Color"
+ opacity: (y + parent.y >= 0) ? 1 : 0
+ onSliderValueChanged: hexText.updateText()
+ }
+
+ Slider {
+ id: brightnessSlider
+
+ width: parent.width
+ leftMargin: Theme.horizontalPageMargin
+ rightMargin: Theme.horizontalPageMargin
+ label: "Brightness"
+ minimumValue: 0
+ maximumValue: 1
+ value: 1
+ opacity: (y + parent.y >= 0) ? 1 : 0
+ onSliderValueChanged: hexText.updateText()
+ }
+
+ Item {
+ x: Theme.horizontalPageMargin
+ width: parent.width - 2 * x
+ height: hexText.height
+ Row {
+ spacing: Theme.paddingSmall
+
+ Label {
+ id: hexLabel
+
+ y: hexText.textTopMargin
+ text: "#"
+ font.pixelSize: Theme.fontSizeLarge
+ }
+
+ Item {
+ readonly property int maxWidth: toolPanel.width - 2 * Theme.horizontalPageMargin - hexLabel.width - parent.spacing - Theme.paddingLarge - sample.width
+ width: Math.min(Math.max(textLabelTemplate.implicitWidth, Theme.itemSizeHuge), maxWidth)
+ height: hexText.height
+
+ Label {
+ id: textLabelTemplate
+
+ // Same text as hexText.label
+ text: hexNotationText
+ font.pixelSize: Theme.fontSizeSmall
+ opacity: 0
+ }
+
+ TextField {
+ id: hexText
+
+ property int ignoreTextUpdates // to avoid binding loops
+ property color tmpColor
+
+ font.pixelSize: Theme.fontSizeLarge
+ width: parent.width
+ textLeftMargin: 0
+ textRightMargin: 0
+ label: hexNotationText
+ validator: RegExpValidator { regExp: /^[0-9a-fA-F]{6}$/ }
+ inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
+ EnterKey.iconSource: "image://theme/icon-m-enter-close"
+ EnterKey.onClicked: hexText.focus = false
+
+ onTextChanged: {
+ if (!ignoreTextUpdates && acceptableInput) {
+ tmpColor = "#" + text
+ ignoreTextUpdates++
+ brightnessSlider.value = hueItem.getV(tmpColor)
+ hueSlider.value = hueItem.getH(tmpColor)
+ ignoreTextUpdates--
+ }
+ }
+
+ onActiveFocusChanged: {
+ if (!activeFocus && !acceptableInput) {
+ updateText()
+ }
+ }
+
+ function updateText() {
+ if (!ignoreTextUpdates) {
+ ignoreTextUpdates++
+ var s = hueItem.getColor(hueSlider.sliderValue).toString()
+ text = (s.length > 0 && s.charAt(0) === '#') ? s.substr(1) : s
+ ignoreTextUpdates--
+ }
+ }
+ }
+ }
+ }
+
+ MouseArea {
+ id: sample
+
+ y: Theme.paddingLarge
+ width: 2 * height
+ height: hexText.height - 2 * Theme.paddingLarge
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/harbour-lib/qml/HarbourColorHueItem.qml
^
|
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Rectangle {
+ id: thisItem
+
+ color: "black"
+ property alias brightness: mouseArea.opacity
+ property alias pressed: mouseArea.pressed
+
+ readonly property color color0: "#ffffff" // 1.0
+ readonly property color color1: "#ff0000" // colorStop7
+ readonly property color color2: "#ff00ff" // colorStop6
+ readonly property color color3: "#0000ff" // colorStop5
+ readonly property color color4: "#00ffff" // colorStop4
+ readonly property color color5: "#00ff00" // colorStop3
+ readonly property color color6: "#ffff00" // colorStop2
+ readonly property color color7: "#ff0000" // colorStop1
+ readonly property color color8: "#ffffff" // 0.0
+
+ readonly property real colorStop1: 0.125
+ readonly property real colorStop2: 0.250
+ readonly property real colorStop3: 0.375
+ readonly property real colorStop4: 0.500
+ readonly property real colorStop5: 0.625
+ readonly property real colorStop6: 0.750
+ readonly property real colorStop7: 0.875
+ readonly property real hueLast: colorStop7
+ readonly property real hueRange: hueLast - colorStop1
+
+ signal tapped(var h)
+
+ function getColor(h) {
+ if (h < colorStop4) {
+ if (h > colorStop3) {
+ // colorStop3..colorStop4
+ return averageColor(color3, color4, (h - colorStop3)/(colorStop4 - colorStop3), brightness)
+ } else if (h > colorStop2) {
+ // colorStop2..colorStop3
+ return averageColor(color2, color3, (h - colorStop2)/(colorStop3 - colorStop2), brightness)
+ } else if (h > colorStop1) {
+ // colorStop1..colorStop2
+ return averageColor(color1, color2, (h - colorStop1)/(colorStop2 - colorStop1), brightness)
+ } else if (h > 0) {
+ // 0..colorStop1
+ return averageColor(color0, color1, h/colorStop1, brightness)
+ } else {
+ return adjustColor(color0, brightness)
+ }
+ } else {
+ if (h < colorStop5) {
+ // colorStop4..colorStop5
+ return averageColor(color4, color5, (h - colorStop4)/(colorStop5 - colorStop4), brightness)
+ } else if (h < colorStop6) {
+ // colorStop5..colorStop6
+ return averageColor(color5, color6, (h - colorStop5)/(colorStop6 - colorStop5), brightness)
+ } else if (h < colorStop7) {
+ // colorStop6..colorStop7
+ return averageColor(color6, color7, (h - colorStop6)/(colorStop7 - colorStop6), brightness)
+ } else if (h < 1) {
+ // colorStop7..1
+ return averageColor(color7, color8, (h - colorStop7)/(1 - colorStop7), brightness)
+ } else {
+ return adjustColor(color8, brightness)
+ }
+ }
+ }
+
+ function averageColor(c1,c2,h,v) {
+ return Qt.rgba((c1.r + (c2.r - c1.r) * h) * v,
+ (c1.g + (c2.g - c1.g) * h) * v,
+ (c1.b + (c2.b - c1.b) * h) * v, 1)
+ }
+
+ function adjustColor(c,v) {
+ return Qt.rgba(c.r * v, c.g * v, c.b * v, 1)
+ }
+
+ function getV(c) {
+ return Math.max(c.r, c.g, c.b)
+ }
+
+ function getH(c) {
+ var max = Math.max(c.r, c.g, c.b)
+ var min = Math.min(c.r, c.g, c.b)
+ var chroma = max - min
+ if (chroma === 0) {
+ return 0
+ } else {
+ if (max === c.r) {
+ return hueLast - (c.g - c.b)/chroma/6 * hueRange
+ } else if (max === c.g) {
+ return hueLast - (2 + (c.b - c.r)/chroma)/6 * hueRange
+ } else {
+ return hueLast - (4 + (c.r - c.g)/chroma)/6 * hueRange
+ }
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ width: parent.height
+ height: parent.width
+ anchors.centerIn: parent
+ rotation: -90
+
+ ShaderEffectSource {
+ anchors.fill: parent
+ sourceItem: Rectangle {
+ width: mouseArea.width
+ height: mouseArea.height
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: color0 }
+ GradientStop { position: colorStop1; color: color1 }
+ GradientStop { position: colorStop2; color: color2 }
+ GradientStop { position: colorStop3; color: color3 }
+ GradientStop { position: colorStop4; color: color4 }
+ GradientStop { position: colorStop5; color: color5 }
+ GradientStop { position: colorStop6; color: color6 }
+ GradientStop { position: colorStop7; color: color7 }
+ GradientStop { position: 1.0; color: color8 }
+ }
+ }
+ }
+ // mouseY/height because we are rotated
+ onClicked: thisItem.tapped(mouseY/height)
+ onPositionChanged: thisItem.tapped(mouseY/height)
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/harbour-lib/qml/HarbourColorPickerDialog.qml
^
|
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Dialog {
+ id: thisDialog
+
+ property color color
+ property alias colorModel: grid.model // HarbourColorEditorModel
+
+ // Localizable strings
+ property alias resetColorsMenuText: resetColorsMenuItem.text // "Reset colors"
+ property string acceptText: "Select color"
+ property string addColorAcceptText: "Add color"
+ property string addColorHueSliderText: "Color"
+ property string addColorBrightnessSliderText: "Brightness"
+ property string addColorHexNotationText: "Hex notation"
+
+ forwardNavigation: false
+
+ signal resetColors()
+
+ // Constants used by HarbourColorEditorModel
+ readonly property int itemTypeColor: 0
+ readonly property int itemTypeTrash: 1
+ readonly property int itemTypeAdd: 2
+
+ SilicaGridView {
+ id: grid
+
+ cellWidth: Math.floor(width/cellsPerRow)
+ cellHeight: cellWidth
+ anchors.fill: parent
+
+ VerticalScrollDecorator {}
+
+ PullDownMenu {
+ MenuItem {
+ id: resetColorsMenuItem
+
+ text: "Reset colors"
+ onClicked: thisDialog.resetColors()
+ }
+ }
+
+ property Item dragItem
+ property int pageHeaderHeight
+ readonly property int cellsPerRow: Math.floor(width / Theme.itemSizeHuge)
+
+ header: DialogHeader {
+ dialog: thisDialog
+ acceptText: thisDialog.acceptText
+ spacing: 0
+ Component.onCompleted: grid.pageHeaderHeight = height
+ onHeightChanged: grid.pageHeaderHeight = height
+ }
+
+ delegate: MouseArea {
+ id: colorDelegate
+
+ width: grid.cellWidth
+ height: grid.cellHeight
+
+ drag.target: dragging ? colorItem : null
+ drag.axis: Drag.XandYAxis
+
+ readonly property bool highlighted: (pressed && containsMouse)
+ readonly property bool dragging: grid.dragItem === colorDelegate
+ readonly property int index: model.index
+
+ Rectangle {
+ id: colorItem
+
+ width: grid.cellWidth
+ height: grid.cellHeight
+ color: model.color
+ scale: !colorDelegate.dragging ? 1 : isTrashed ? 0.8 : 1.1
+ opacity: isTrashed ? 0.8 : 1
+ layer.enabled: colorDelegate.highlighted || colorDelegate.dragging || scale > 1
+ layer.effect: HarbourPressEffect { source: colorItem }
+
+ readonly property bool isTrashed: model.itemType === itemTypeTrash
+ property real returnX
+ property real returnY
+ property bool snappingBack
+
+ Behavior on opacity { FadeAnimation { } }
+ Behavior on scale {
+ NumberAnimation {
+ easing.type: Easing.InQuad
+ duration: 150
+ }
+ }
+
+ Image {
+ anchors.centerIn: parent
+ source: opacity ? ("image://theme/graphic-close-app?" + deriveColor(model.color)) : ""
+ sourceSize: Qt.size(Theme.iconSizeLarge, Theme.iconSizeLarge)
+ opacity: (model.itemType === itemTypeTrash) ? 0.8 : 0
+ visible: opacity > 0
+ Behavior on opacity { FadeAnimation { } }
+
+ function deriveColor(color) {
+ var gray = 0.299 * color.r + 0.587 * color.g + 0.114 *color.b
+ var v = (gray > 0.5) ? 0 : 1
+ return Qt.rgba(v, v, v, color.a)
+ }
+ }
+
+ states: [
+ State {
+ name: "dragging"
+ when: colorDelegate.dragging
+ ParentChange {
+ target: colorItem
+ parent: grid
+ x: colorDelegate.mapToItem(grid, 0, 0).x
+ y: colorDelegate.mapToItem(grid, 0, 0).y
+ }
+ },
+ State {
+ name: "snappingBack"
+ when: !colorDelegate.dragging && colorItem.snappingBack
+ ParentChange {
+ target: colorItem
+ parent: grid
+ x: colorItem.returnX
+ y: colorItem.returnY
+ }
+ },
+ State {
+ name: "idle"
+ when: !colorDelegate.dragging && !colorItem.snappingBack
+ ParentChange {
+ target: colorItem
+ parent: colorDelegate
+ x: 0
+ y: 0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ to: "snappingBack"
+ SequentialAnimation {
+ SmoothedAnimation {
+ properties: "x,y"
+ duration: 150
+ }
+ ScriptAction { script: colorItem.snappingBack = false }
+ }
+ },
+ Transition {
+ to: "idle"
+ ScriptAction { script: colorModel.dragPos = -1 }
+ }
+ ]
+
+ Connections {
+ target: colorDelegate.dragging ? colorItem : null
+ onXChanged: colorItem.updateDragPos()
+ onYChanged: colorItem.scrollAndUpdateDragPos()
+ }
+
+ Connections {
+ target: colorDelegate.dragging ? grid : null
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/harbour-lib/src/HarbourColorEditorModel.cpp
^
|
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourColorEditorModel.h"
+#include "HarbourDebug.h"
+
+// ==========================================================================
+// HarbourColorEditorModel::Private
+// ==========================================================================
+
+class HarbourColorEditorModel::Private
+{
+public:
+ enum ModelRole {
+ ColorRole = Qt::UserRole,
+ ItemTypeRole
+ };
+
+ Private();
+
+ bool resetDragPos();
+ QStringList getColors() const;
+ QList<QColor> makeColors(const QStringList& aColors, bool* aChanged) const;
+ QVariant data(int aRow, ModelRole aRole) const;
+
+public:
+ int iDragPos;
+ int iDragStartPos;
+ QList<QColor> iColors;
+ const QColor iAddColor;
+};
+
+HarbourColorEditorModel::Private::Private() :
+ iDragPos(-1),
+ iDragStartPos(-1),
+ iAddColor(0, 0, 0, 0)
+{
+}
+
+bool HarbourColorEditorModel::Private::resetDragPos()
+{
+ if (iDragPos >= 0) {
+ iDragPos = -1;
+ iDragStartPos = -1;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+QStringList HarbourColorEditorModel::Private::getColors() const
+{
+ const int n = iColors.count();
+ QStringList colors;
+ colors.reserve(n);
+ for (int i = 0; i < n; i++) {
+ colors.append(iColors.at(i).name());
+ }
+ return colors;
+}
+
+QList<QColor> HarbourColorEditorModel::Private::makeColors(const QStringList& aColors, bool* aChanged) const
+{
+ const int n = aColors.count();
+ *aChanged = iColors.count() != n;
+ QList<QColor> newColors;
+ newColors.reserve(n);
+ for (int i = 0; i < n; i++) {
+ const QColor c(aColors.at(i));
+ newColors.append(c);
+ if (!*aChanged && iColors.at(i) != c) {
+ *aChanged = true;
+ }
+ }
+ return newColors;
+}
+
+QVariant HarbourColorEditorModel::Private::data(int aRow, ModelRole aRole) const
+{
+ const int n = iColors.count();
+ if (aRow >= 0 && aRow <= n) {
+ switch (aRole) {
+ case ColorRole:
+ if (iDragPos >= 0) {
+ if (aRow == iDragPos) {
+ // This includes the item dragged outside
+ return iColors.at(iDragStartPos);
+ } else {
+ if (iDragPos == n && aRow == (n - 1)) {
+ // When item is dragged outside, it becomes
+ // the last one and shifts the "add" item.
+ return iAddColor;
+ } else if (aRow >= iDragStartPos && aRow < iDragPos) {
+ return iColors.at(aRow + 1);
+ } else if (aRow > iDragPos && aRow <= iDragStartPos) {
+ return iColors.at(aRow - 1);
+ }
+ }
+ }
+ return (aRow == n) ? iAddColor : iColors.at(aRow);
+ case ItemTypeRole:
+ if (iDragPos == n) {
+ // Item is dragged outside
+ return (aRow == n) ? TrashedItem :
+ (aRow == (n - 1)) ? AddItem : ColorItem;
+ } else {
+ return (aRow == n) ? AddItem : ColorItem;
+ }
+ }
+ }
+ return QVariant();
+}
+
+// ==========================================================================
+// HarbourColorEditorModel::Private
+// ==========================================================================
+
+HarbourColorEditorModel::HarbourColorEditorModel(QObject* aParent) :
+ QAbstractListModel(aParent),
+ iPrivate(new Private)
+{
+}
+
+QHash<int,QByteArray> HarbourColorEditorModel::roleNames() const
+{
+ QHash<int,QByteArray> roles;
+ roles.insert(Private::ColorRole, "color");
+ roles.insert(Private::ItemTypeRole, "itemType");
+ return roles;
+}
+
+int HarbourColorEditorModel::rowCount(const QModelIndex&) const
+{
+ return iPrivate->iColors.count() + 1;
+}
+
+QVariant HarbourColorEditorModel::data(const QModelIndex& aIndex, int aRole) const
+{
+ return iPrivate->data(aIndex.row(), (Private::ModelRole)aRole);
+}
+
+QStringList HarbourColorEditorModel::getColors() const
+{
+ return iPrivate->getColors();
+}
+
+void HarbourColorEditorModel::setColors(QStringList aColors)
+{
+ bool changed;
+ const QList<QColor> prevColors(iPrivate->iColors);
+ const QList<QColor> newColors(iPrivate->makeColors(aColors, &changed));
+ if (changed) {
+ const int prevCount = prevColors.count();
+ const int newCount = newColors.count();
+ const QVector<int> colorRole(1, Private::ColorRole);
+ if (newCount < prevCount) {
+ beginRemoveRows(QModelIndex(), newCount + 1, prevCount);
+ iPrivate->iColors = newColors;
+ endRemoveRows();
+ } else if (newCount > prevCount) {
+ beginInsertRows(QModelIndex(), prevCount + 1, newCount);
+ iPrivate->iColors = newColors;
+ endInsertRows();
+ } else {
+ iPrivate->iColors = newColors;
+ }
+ // Change the colors
+ int rangeStart = -1;
+ const int n = qMin(prevCount, newCount);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/harbour-lib/src/HarbourPluginLoader.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017-2020 Jolla Ltd.
- * Copyright (C) 2017-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -78,6 +78,24 @@
// sym,ret,name,args
#define QMLTYPE_FUNCTIONS(f) \
+ f("_ZN12QQmlMetaType7qmlTypeERK7QStringii", \
+ QQmlType*, qmlType, (QString const&, int, int)) \
+ f("_ZNK8QQmlType23propertyValueSourceCastEv", \
+ int, propertyValueSourceCast, (QQmlType*)) \
+ f("_ZNK8QQmlType10createSizeEv", \
+ int, createSize, (QQmlType*)) \
+ f("_ZNK8QQmlType10metaObjectEv", \
+ const QMetaObject*, metaObject, (QQmlType*)) \
+ f("_ZNK8QQmlType16parserStatusCastEv", \
+ int, parserStatusCast, (QQmlType*)) \
+ f("_ZNK8QQmlType28propertyValueInterceptorCastEv", \
+ int, propertyValueInterceptorCast, (QQmlType*)) \
+ f("_ZNK8QQmlType6typeIdEv", \
+ int, typeId, (QQmlType*)) \
+ f("_ZNK8QQmlType14createFunctionEv", \
+ QQmlType::CreateFunc, createFunction, (QQmlType*)) \
+ f("_ZNK8QQmlType11qListTypeIdEv", \
+ int, qListTypeId, (QQmlType*)) \
f("_ZNK8QQmlType26attachedPropertiesFunctionEv", \
QQmlAttachedPropertiesFunc, AttachedPropertiesFunctionProc,(QQmlType*)) \
f("_ZNK8QQmlType22attachedPropertiesTypeEv", \
@@ -100,8 +118,8 @@
int parserStatusCast() const;
int propertyValueSourceCast() const;
int propertyValueInterceptorCast() const;
- QQmlAttachedPropertiesFunc attachedPropertiesFunction(QQmlEnginePrivate *engine) const;
- const QMetaObject *attachedPropertiesType(QQmlEnginePrivate *engine) const;
+ // attachedPropertiesFunction
+ // attachedPropertiesType
};
// PRIVATE QT API!
@@ -219,8 +237,10 @@
HarbourPluginLoader::Private::qmlType(
QString aName)
{
- QString fullName(iModule + '/' + aName);
- QQmlType* type = QQmlMetaType::qmlType(fullName, iMajor, iMinor);
+ const QString fullName(iModule + '/' + aName);
+ QQmlType* type = gLibQt5Qml.iSym.fn.qmlType ?
+ gLibQt5Qml.iSym.fn.qmlType(fullName, iMajor, iMinor) :
+ Q_NULLPTR;
if (!type) {
HWARN("Failed to load" << fullName);
}
@@ -259,7 +279,15 @@
int aMajor,
int aMinor)
{
- if (aType && iEngine) {
+ if (aType && iEngine &&
+ gLibQt5Qml.iSym.fn.typeId &&
+ gLibQt5Qml.iSym.fn.qListTypeId &&
+ gLibQt5Qml.iSym.fn.createSize &&
+ gLibQt5Qml.iSym.fn.createFunction &&
+ gLibQt5Qml.iSym.fn.metaObject &&
+ gLibQt5Qml.iSym.fn.parserStatusCast &&
+ gLibQt5Qml.iSym.fn.propertyValueSourceCast &&
+ gLibQt5Qml.iSym.fn.propertyValueInterceptorCast) {
// Get around the ABI break in Qt 5.6
QQmlAttachedPropertiesFunc attachedPropertiesFunction =
gLibQt5Qml.iSym.fn.AttachedPropertiesFunctionProc ?
@@ -275,21 +303,21 @@
NULL;
QQmlPrivate::RegisterType type = {
0, // int version;
- aType->typeId(), // int typeId;
- aType->qListTypeId(), // int listId;
- aType->createSize(), // int objectSize;
- aType->createFunction(), // void (*create)(void *);
+ gLibQt5Qml.iSym.fn.typeId(aType), // int typeId;
+ gLibQt5Qml.iSym.fn.qListTypeId(aType), // int listId;
+ gLibQt5Qml.iSym.fn.createSize(aType), // int objectSize;
+ gLibQt5Qml.iSym.fn.createFunction(aType), // void (*create)(void *);
QString(), // QString noCreationReason;
aModule, // const char *uri;
aMajor, // int versionMajor;
aMinor, // int versionMinor;
aQmlName, // const char *elementName;
- aType->metaObject(), // const QMetaObject *metaObject;
+ gLibQt5Qml.iSym.fn.metaObject(aType), // const QMetaObject *metaObject;
attachedPropertiesFunction,
attachedPropertiesMetaObject,
- aType->parserStatusCast(), // int parserStatusCast;
- aType->propertyValueSourceCast(), // int valueSourceCast;
- aType->propertyValueInterceptorCast(), // int valueInterceptorCast;
+ gLibQt5Qml.iSym.fn.parserStatusCast(aType), // int parserStatusCast;
+ gLibQt5Qml.iSym.fn.propertyValueSourceCast(aType), // int valueSourceCast;
+ gLibQt5Qml.iSym.fn.propertyValueInterceptorCast(aType), // int valueInterceptorCast;
Q_NULLPTR, // QObject *(*extensionObjectCreate)(QObject *);
Q_NULLPTR, // const QMetaObject *extensionMetaObject;
Q_NULLPTR, // QQmlCustomParser *customParser;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/qml/NotePage.qml
^
|
@@ -18,6 +18,8 @@
readonly property bool canUndo: "_editor" in textArea && textArea._editor.canUndo
readonly property bool canRedo: "_editor" in textArea && textArea._editor.canRedo
+ property var colorEditorModel
+
signal saveBody(var body)
signal deleteNote()
signal performAction()
@@ -37,12 +39,49 @@
// Otherwise width is changing with a delay, causing visible layout changes
onIsLandscapeChanged: width = isLandscape ? Screen.height : Screen.width
+ Component {
+ id: colorEditorModelComponent
+
+ HarbourColorEditorModel {
+ onColorsChanged: FoilNotesSettings.availableColors = colors
+ }
+ }
+
function pickColor() {
- pageStack.push("Sailfish.Silica.ColorPickerPage", {
- colors: FoilNotesSettings.availableColors
- }).colorClicked.connect(function(color) {
- page.color = color
- pageStack.pop()
+ if (!colorEditorModel) {
+ colorEditorModel = colorEditorModelComponent.createObject(page, {
+ colors: FoilNotesSettings.availableColors
+ })
+ }
+ var dialog = pageStack.push(Qt.resolvedUrl("harbour/HarbourColorPickerDialog.qml"), {
+ allowedOrientations: page.allowedOrientations,
+ acceptDestinationAction: PageStackAction.Replace,
+ colorModel: colorEditorModel,
+ color: page.color,
+ //: Pulley menu item
+ //% "Reset colors"
+ resetColorsMenuText: qsTrId("color_picker-menu-reset_colors"),
+ //: Dialog title label
+ //% "Select color"
+ acceptText: qsTrId("color_picker-action-select_color"),
+ //: Dialog title label
+ //% "Add color"
+ addColorAcceptText: qsTrId("color_picker-action-add_color"),
+ //: Hue slider label
+ //% "Color"
+ addColorHueSliderText: qsTrId("color_picker-slider-hue"),
+ //: Brightness slider label
+ //% "Brightness"
+ addColorBrightnessSliderText: qsTrId("color_picker-slider-brightness"),
+ //: Text field description
+ //% "Hex notation"
+ addColorHexNotationText: qsTrId("color_picker-text-hex_notation")
+ })
+ dialog.resetColors.connect(function() {
+ colorEditorModel.colors = FoilNotesSettings.defaultColors
+ })
+ dialog.accepted.connect(function() {
+ page.color = dialog.color
})
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/src/FoilNotesSettings.cpp
^
|
@@ -41,6 +41,7 @@
#include <QQmlEngine>
#define DCONF_KEY(x) FOILNOTES_DCONF_ROOT x
+#define KEY_AVAILABLE_COLORS DCONF_KEY("availableColors")
#define KEY_NEXT_COLOR_INDEX DCONF_KEY("nextColorIndex")
#define KEY_SHARED_KEY_WARNING DCONF_KEY("sharedKeyWarning")
#define KEY_SHARED_KEY_WARNING2 DCONF_KEY("sharedKeyWarning2")
@@ -56,19 +57,29 @@
// FoilNotesSettings::Private
// ==========================================================================
-class FoilNotesSettings::Private {
+class FoilNotesSettings::Private : public QObject
+{
+ Q_OBJECT
static const char* gAvailableColors[];
public:
Private(QObject* aParent);
+ static QStringList defaultColors();
+ QStringList availableColors() const;
+
+public Q_SLOTS:
+ void onAvailableColorsChanged();
+
public:
- QStringList iAvailableColors;
+ MGConfItem* iAvailableColorsConf;
MGConfItem* iNextColorIndex;
MGConfItem* iSharedKeyWarning;
MGConfItem* iSharedKeyWarning2;
MGConfItem* iAutoLockTime;
MGConfItem* iPlainTextView;
+ const QStringList iDefaultColors;
+ QStringList iAvailableColors;
QVariant iDefaultSharedKeyWarning;
QVariant iDefaultAutoLockTime;
};
@@ -82,14 +93,19 @@
};
FoilNotesSettings::Private::Private(QObject* aParent) :
+ QObject(aParent),
+ iAvailableColorsConf(new MGConfItem(KEY_AVAILABLE_COLORS, aParent)),
iNextColorIndex(new MGConfItem(KEY_NEXT_COLOR_INDEX, aParent)),
iSharedKeyWarning(new MGConfItem(KEY_SHARED_KEY_WARNING, aParent)),
iSharedKeyWarning2(new MGConfItem(KEY_SHARED_KEY_WARNING2, aParent)),
iAutoLockTime(new MGConfItem(KEY_AUTO_LOCK_TIME, aParent)),
iPlainTextView(new MGConfItem(KEY_PLAINTEXT_VIEW, aParent)),
+ iDefaultColors(defaultColors()),
iDefaultSharedKeyWarning(DEFAULT_SHARED_KEY_WARNING),
iDefaultAutoLockTime(DEFAULT_AUTO_LOCK_TIME)
{
+ QObject::connect(iAvailableColorsConf, SIGNAL(valueChanged()),
+ SLOT(onAvailableColorsChanged()));
QObject::connect(iNextColorIndex, SIGNAL(valueChanged()),
aParent, SIGNAL(nextColorIndexChanged()));
QObject::connect(iSharedKeyWarning, SIGNAL(valueChanged()),
@@ -100,11 +116,31 @@
aParent, SIGNAL(autoLockTimeChanged()));
QObject::connect(iPlainTextView, SIGNAL(valueChanged()),
aParent, SIGNAL(plaintextViewChanged()));
+ iAvailableColors = availableColors();
+}
+QStringList FoilNotesSettings::Private::defaultColors()
+{
+ QStringList colors;
const uint n = sizeof(gAvailableColors)/sizeof(gAvailableColors[0]);
- iAvailableColors.reserve(n);
+ colors.reserve(n);
for (uint i = 0; i < n; i++) {
- iAvailableColors.append(QLatin1String(gAvailableColors[i]));
+ colors.append(QLatin1String(gAvailableColors[i]));
+ }
+ return colors;
+}
+
+QStringList FoilNotesSettings::Private::availableColors() const
+{
+ return iAvailableColorsConf->value(iDefaultColors).toStringList();
+}
+
+void FoilNotesSettings::Private::onAvailableColorsChanged()
+{
+ const QStringList newColors(availableColors());
+ if (iAvailableColors != newColors) {
+ iAvailableColors = newColors;
+ Q_EMIT qobject_cast<FoilNotesSettings*>(parent())->availableColorsChanged();
}
}
@@ -132,6 +168,13 @@
return new FoilNotesSettings();
}
+// defaultColors
+const QStringList
+FoilNotesSettings::defaultColors() const
+{
+ return iPrivate->iDefaultColors;
+}
+
// availableColors
QStringList
@@ -140,6 +183,15 @@
return iPrivate->iAvailableColors;
}
+void
+FoilNotesSettings::setAvailableColors(QStringList aColors)
+{
+ iPrivate->iAvailableColorsConf->set(aColors);
+ if (iPrivate->iAvailableColors != aColors) {
+ Q_EMIT availableColorsChanged();
+ }
+}
+
// nextColorIndex
int
@@ -154,8 +206,7 @@
int aValue)
{
HDEBUG(aValue);
- iPrivate->iNextColorIndex->set(aValue %
- iPrivate->iAvailableColors.count());
+ iPrivate->iNextColorIndex->set(aValue % iPrivate->iAvailableColors.count());
}
int
@@ -239,3 +290,5 @@
HDEBUG(aValue);
iPrivate->iPlainTextView->set(aValue);
}
+
+#include "FoilNotesSettings.moc"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/src/FoilNotesSettings.h
^
|
@@ -42,7 +42,8 @@
class FoilNotesSettings : public QObject {
Q_OBJECT
- Q_PROPERTY(QStringList availableColors READ availableColors CONSTANT)
+ Q_PROPERTY(QStringList defaultColors READ defaultColors CONSTANT)
+ Q_PROPERTY(QStringList availableColors READ availableColors WRITE setAvailableColors NOTIFY availableColorsChanged)
Q_PROPERTY(int nextColorIndex READ nextColorIndex WRITE setNextColorIndex NOTIFY nextColorIndexChanged)
Q_PROPERTY(bool sharedKeyWarning READ sharedKeyWarning WRITE setSharedKeyWarning NOTIFY sharedKeyWarningChanged)
Q_PROPERTY(bool sharedKeyWarning2 READ sharedKeyWarning2 WRITE setSharedKeyWarning2 NOTIFY sharedKeyWarning2Changed)
@@ -56,7 +57,9 @@
// Callback for qmlRegisterSingletonType<FoilNotesSettings>
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+ const QStringList defaultColors() const;
QStringList availableColors() const;
+ void setAvailableColors(QStringList aColors);
int nextColorIndex() const;
void setNextColorIndex(int aValue);
@@ -76,6 +79,7 @@
Q_INVOKABLE QColor pickColor();
Q_SIGNALS:
+ void availableColorsChanged();
void nextColorIndexChanged();
void sharedKeyWarningChanged();
void sharedKeyWarning2Changed();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/src/main.cpp
^
|
@@ -43,6 +43,7 @@
#include "HarbourQrCodeImageProvider.h"
#include "HarbourDebug.h"
+#include "HarbourColorEditorModel.h"
#include "HarbourOrganizeListModel.h"
#include "HarbourProcessState.h"
#include "HarbourSystemState.h"
@@ -65,6 +66,7 @@
qmlRegisterSingletonType<FoilNotesModel>(uri, v1, v2, "FoilNotesModel", FoilNotesModel::createSingleton);
qmlRegisterSingletonType<FoilNotesPlaintextModel>(uri, v1, v2, "FoilNotesPlaintextModel", FoilNotesPlaintextModel::createSingleton);
qmlRegisterType<FoilNotesSearchModel>(uri, v1, v2, "FoilNotesSearchModel");
+ qmlRegisterType<HarbourColorEditorModel>(uri, v1, v2, "HarbourColorEditorModel");
qmlRegisterType<HarbourOrganizeListModel>(uri, v1, v2, "HarbourOrganizeListModel");
qmlRegisterType<HarbourQrCodeGenerator>(uri, v1, v2, "HarbourQrCodeGenerator");
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes-de.ts
^
|
@@ -347,5 +347,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation type="unfinished">Wenn Sie den Entwicklermodus aktiviert haben, können Sie auch versuchen, <b>%1</b> vom Terminal aus auszuführen. Entschuldigen Sie die Unannehmlichkeiten!</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Wähle eine Farbe</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation type="unfinished">Farbe hinzufügen</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation type="unfinished">Farben zurücksetzen</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation type="unfinished">Farbe</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation type="unfinished">Helligkeit</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation type="unfinished">Hex-Notation</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes-es.ts
^
|
@@ -347,5 +347,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation type="unfinished">Si tiene habilitado el modo de desarrollador, también puede intentar ejecutar <b>%1</b> desde la terminal. ¡Lo siento por los inconvenientes ocasionados!</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Seleccionar color</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation type="unfinished">Añadir color</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation type="unfinished">Restaurar colores</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation type="unfinished">Color</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation type="unfinished">Luminosidad</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation type="unfinished">Notación hexadecimal</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes-fr.ts
^
|
@@ -347,5 +347,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation type="unfinished">Si vous avez activé le mode développeur, vous pouvez également essayer d'exécuter foilnotes à partir du terminal. Désolé pour le dérangement!</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Sélectionner une couleur</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation type="unfinished">Ajouter de la couleur</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation type="unfinished">Réinitialiser les couleurs</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation type="unfinished">Couleur</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation type="unfinished">Luminosité</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation type="unfinished">Notation hexadécimale</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes-pl.ts
^
|
@@ -11,7 +11,7 @@
<message id="foilnotes-search-placeholder">
<source>Sorry, couldn't find anything</source>
<extracomment>Placeholder text</extracomment>
- <translation type="unfinished">Przepraszamy, nic nie znaleziono</translation>
+ <translation>Przepraszamy, nic nie znaleziono</translation>
</message>
<message id="foilnotes-plaintext_view-placeholder">
<source>You do not have any notes.</source>
@@ -145,7 +145,7 @@
<message id="foilnotes-notification-generated_key">
<source>Generated new key</source>
<extracomment>Pop-up notification</extracomment>
- <translation>Wygeneruj nowy klucz</translation>
+ <translation>Wygenerowano nowy klucz</translation>
</message>
<message id="foilnotes-notification-password_changed">
<source>Password changed</source>
@@ -350,5 +350,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation>Jeśli masz włączony tryb developera, możesz uruchomić <b>%1</b> z terminala. Przepraszam za niedogodności!</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation type="unfinished">Wybierz kolor</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation type="unfinished">Dodaj kolor</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation type="unfinished">Zresetuj kolory</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation type="unfinished">Kolor</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation type="unfinished">Jasność</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation type="unfinished">Format szesnastkowy</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes-ru.ts
^
|
@@ -350,5 +350,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation>А если у вас включен режим разработчика, то кажется вам повезло - вы можете запустить <b>%1</b> из терминала. Это, конечно, неудобно, но таким вот способом система как бы защищает вашу безопасность.</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Выбрать цвет</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Добавить цвет</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation>Сбросить цвета</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation>Цвет</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation>Яркость</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation>Текстовый формат</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes-sv.ts
^
|
@@ -347,5 +347,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation type="unfinished">Om du har aktiverat utvecklarläge kan du också försöka köra <b>%1</b> från terminalen. Beklagar olägenheten!</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Välj färg</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation type="unfinished">Lägg till färg</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation type="unfinished">Återställ färger</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation type="unfinished">Färg</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation type="unfinished">Ljusstyrka</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation type="unfinished">Hex-format</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes-zh_CN.ts
^
|
@@ -344,5 +344,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation type="unfinished">如果您启用了开发者模式,您也可以尝试从终端运行 <b>%1</b>。 带来不便敬请谅解!</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>选择颜色</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation type="unfinished">添加颜色</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation type="unfinished">重置颜色</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation type="unfinished">颜色</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation type="unfinished">亮度</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation type="unfinished">十六进制表示法</translation>
+ </message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilnotes-1.0.25.tar.gz/translations/harbour-foilnotes.ts
^
|
@@ -347,5 +347,35 @@
<extracomment>Hint suggesting to run the app from the terminal</extracomment>
<translation>If you have developer mode enabled, you may also try running <b>%1</b> from the terminal. Sorry for the inconvenience!</translation>
</message>
+ <message id="color_picker-action-select_color">
+ <source>Select color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Select color</translation>
+ </message>
+ <message id="color_picker-action-add_color">
+ <source>Add color</source>
+ <extracomment>Dialog title label</extracomment>
+ <translation>Add color</translation>
+ </message>
+ <message id="color_picker-menu-reset_colors">
+ <source>Reset colors</source>
+ <extracomment>Pulley menu item</extracomment>
+ <translation>Reset colors</translation>
+ </message>
+ <message id="color_picker-slider-hue">
+ <source>Color</source>
+ <extracomment>Hue slider label</extracomment>
+ <translation>Color</translation>
+ </message>
+ <message id="color_picker-slider-brightness">
+ <source>Brightness</source>
+ <extracomment>Brightness slider label</extracomment>
+ <translation>Brightness</translation>
+ </message>
+ <message id="color_picker-text-hex_notation">
+ <source>Hex notation</source>
+ <extracomment>Text field description</extracomment>
+ <translation>Hex notation</translation>
+ </message>
</context>
</TS>
|