smaller fixes
This commit is contained in:
parent
e160ad9665
commit
7a666cc384
@ -64,6 +64,7 @@ void Scripts::removeScript(const QUuid &id)
|
||||
beginRemoveRows(QModelIndex(), i, i);
|
||||
m_list.takeAt(i)->deleteLater();
|
||||
endRemoveRows();
|
||||
emit countChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ Page {
|
||||
|
||||
HeaderButton {
|
||||
imageSource: Qt.resolvedUrl("images/script.svg")
|
||||
visible: engine.jsonRpcClient.ensureServerVersion("4.1")
|
||||
onClicked: {
|
||||
pageStack.push("magic/ScriptsPage.qml")
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import QtQuick.Controls 2.2
|
||||
import Nymea 1.0
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Controls.Material 2.1
|
||||
import Qt.labs.settings 1.0
|
||||
import "../components"
|
||||
import "scripting"
|
||||
|
||||
@ -17,6 +18,23 @@ Page {
|
||||
} else {
|
||||
scriptEdit.text = "import QtQuick 2.0\nimport nymea 1.0\n\nItem {\n \n}\n"
|
||||
}
|
||||
|
||||
if ((Qt.platform.os == "android" || Qt.platform.os == "ios") && !popupCache.shown) {
|
||||
var component = Qt.createComponent(Qt.resolvedUrl("../components/MeaDialog.qml"));
|
||||
var infoPopup = component.createObject(root,
|
||||
{
|
||||
title: qsTr("Did you know..."),
|
||||
headerIcon: "../images/info.svg",
|
||||
text: qsTr("nymea:app is available for all kinds of devices. In order to edit scripts we recommend to use nymea:app on your personal computer or connect a keyboard to your tablet.")
|
||||
})
|
||||
infoPopup.open();
|
||||
popupCache.shown = true
|
||||
}
|
||||
}
|
||||
|
||||
Settings {
|
||||
id: popupCache
|
||||
property bool shown: false
|
||||
}
|
||||
|
||||
header: NymeaHeader {
|
||||
@ -91,7 +109,10 @@ Page {
|
||||
if (scriptError == "ScriptErrorNoError") {
|
||||
d.scriptId = scriptId;
|
||||
d.oldContent = scriptEdit.text;
|
||||
} else if (scriptError == "ScriptErrorInvalidScript") {
|
||||
content.ToolTip.show(qsTr("The script has not been deployed because it contains errors."))
|
||||
}
|
||||
|
||||
errorModel.update(errors);
|
||||
}
|
||||
}
|
||||
@ -101,6 +122,8 @@ Page {
|
||||
d.callId = -1;
|
||||
if (scriptError == "ScriptErrorNoError") {
|
||||
d.oldContent = scriptEdit.text;
|
||||
} else if (scriptError == "ScriptErrorInvalidScript") {
|
||||
content.ToolTip.show(qsTr("The script has not been deployed because it contains errors."))
|
||||
}
|
||||
errorModel.update(errors)
|
||||
}
|
||||
@ -152,6 +175,7 @@ Page {
|
||||
leftPadding: lineNumbers.width + 2
|
||||
rightPadding: 20
|
||||
bottomPadding: 28
|
||||
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
|
||||
|
||||
font.family: "Monospace"
|
||||
font.pixelSize: app.extraSmallFont
|
||||
@ -387,5 +411,4 @@ Page {
|
||||
BusyOverlay {
|
||||
shown: d.callId != -1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ Page {
|
||||
text: qsTr("Press \"Add script\" to get started.")
|
||||
imageSource: "../images/script.svg"
|
||||
buttonText: qsTr("Add script")
|
||||
visible: engine.scriptManager.scripts.count === 0
|
||||
onButtonClicked: {
|
||||
pageStack.push("ScriptEditor.qml");
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
text: model.displayText
|
||||
color: app.foregroundColor
|
||||
|
||||
@ -13,16 +13,15 @@ Rectangle {
|
||||
|
||||
width: {
|
||||
var ret = fontMetrics.maximumCharacterWidth * 2;
|
||||
var tmp = scriptEdit.lineCount
|
||||
var tmp = textArea.lineCount
|
||||
while (tmp >= 10) {
|
||||
ret += fontMetrics.maximumCharacterWidth;
|
||||
tmp /= 10;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
height: scriptEdit.height - 10
|
||||
height: root.textArea.height - 10
|
||||
color: (app.backgroundColor.r * 0.2126 + app.backgroundColor.g * 0.7152 + app.backgroundColor.b * 0.0722) * 255 < 128 ? "#202020" : "#e0e0e0"
|
||||
anchors { left: parent.left; leftMargin: scriptFlickable.contentX }
|
||||
Component.onCompleted: {
|
||||
print("..", app.backgroundColor.r)
|
||||
print("*** background", (app.backgroundColor.r * 0.2126 + app.backgroundColor.g * 0.7152 + app.backgroundColor.b * 0.0722) * 255 < 128 )
|
||||
|
||||
Reference in New Issue
Block a user