summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-07-28 17:18:43 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-07-28 17:18:43 (GMT)
commit1ec33812527b7ccc0c5b3bb2026994c362ef389c (patch)
tree687e3ceeaf2d379b926fd55681ab91268d7881fd
parentd03d3fcc178442f053c91913f1c812b069dc6168 (diff)
Added support of "Light" properties to INDI. Eliminated a few bugs with
UI.
-rw-r--r--kstars/CMakeLists.txt1
-rw-r--r--kstars/indi/clientmanagerlite.cpp96
-rw-r--r--kstars/indi/clientmanagerlite.h15
-rw-r--r--kstars/indi/inditelescopelite.cpp2
-rw-r--r--kstars/kstarslite.h1
-rw-r--r--kstars/kstarslite/qml/indi/CMakeLists.txt1
-rw-r--r--kstars/kstarslite/qml/indi/DevicePanel.qml31
-rw-r--r--kstars/kstarslite/qml/indi/INDIControlPanel.qml11
-rw-r--r--kstars/kstarslite/qml/indi/ImagePreview.qml23
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSButtonSwitch.qml2
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml9
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSCheckBox.qml2
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSComboBox.qml7
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSINDIText.qml9
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSINDITextField.qml3
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSLed.qml53
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSTab.qml3
-rw-r--r--kstars/kstarslite/qml/indi/modules/MotionControl.qml2
-rw-r--r--kstars/kstarslite/qml/indi/modules/Property.qml88
-rw-r--r--kstars/kstarslite/qml/main.qml25
-rw-r--r--kstars/kstarslite/qml/modules/KSPage.qml37
-rw-r--r--kstars/kstarslite/skyitems/telescopesymbolsitem.cpp9
-rw-r--r--kstars/skymapliteevents.cpp13
23 files changed, 313 insertions, 130 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 1fad0f6..26bf6ac 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -692,6 +692,7 @@ if(BUILD_KSTARS_LITE)
kstarslite/qml/indi/ImagePreview.qml
kstarslite/qml/indi/modules/MotionControl.qml
kstarslite/qml/indi/modules/Led.qml
+ kstarslite/qml/indi/modules/KSLed.qml
kstarslite/qml/indi/modules/Property.qml
kstarslite/qml/indi/modules/KSTab.qml
kstarslite/qml/indi/modules/KSComboBox.qml
diff --git a/kstars/indi/clientmanagerlite.cpp b/kstars/indi/clientmanagerlite.cpp
index ec09159..854d074 100644
--- a/kstars/indi/clientmanagerlite.cpp
+++ b/kstars/indi/clientmanagerlite.cpp
@@ -35,6 +35,8 @@
#include "kspaths.h"
#include <QApplication>
+const char *libindi_strings_context = "string from libindi, used in the config dialog";
+
#ifdef Q_OS_ANDROID
#include "../../android_lib/include/libraw/libraw.h"
#endif
@@ -103,12 +105,24 @@ void ClientManagerLite::setConnected(bool connected) {
emit connectedChanged(connected);
}
-QString ClientManagerLite::updateLED(QString device, QString property) {
+QString ClientManagerLite::syncLED(QString device, QString property, QString name) {
foreach(DeviceInfoLite *devInfo, m_devices) {
if(devInfo->device->getDeviceName() == device) {
- INDI::Property *prop = devInfo->device->getProperty(property.toStdString().c_str());
+ INDI::Property *prop = devInfo->device->getProperty(property.toLatin1());
if(prop) {
- switch (prop->getState())
+ IPState state = prop->getState();
+ if(!name.isEmpty()) {
+ ILight *lights = prop->getLight()->lp;
+ for (int i=0; i < prop->getLight()->nlp; i++) {
+ if(lights[i].name == name) {
+ state = lights[i].s;
+ break;
+ }
+ if(i == prop->getLight()->nlp - 1) return ""; // no Light with name "name" found so return empty string
+ }
+
+ }
+ switch (state)
{
case IPS_IDLE:
return "grey";
@@ -368,6 +382,70 @@ void ClientManagerLite::buildSwitch(bool buttonGroup, ISwitch *sw, INDI::Propert
}
}
+void ClientManagerLite::buildLightGUI(INDI::Property *property) {
+ ILightVectorProperty *lvp = property->getLight();
+
+ if (lvp == NULL)
+ return;
+
+ for (int i=0; i < lvp->nlp; i++)
+ {
+ ILight *ilp = &(lvp->lp[i]);
+
+ QString name = ilp->name;
+ QString label = i18nc(libindi_strings_context, ilp->label);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = ilp->label;
+
+ if (label.isEmpty())
+ label = i18nc(libindi_strings_context, ilp->name);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = ilp->name;
+
+ emit createINDILight(property->getDeviceName(), property->getName(), label, name);
+ }
+}
+
+/*void ClientManagerLite::buildBLOBGUI(INDI::Property *property) {
+ IBLOBVectorProperty *ibp = property->getBLOB();
+
+ QString name = ibp->name;
+ QString label = i18nc(libindi_strings_context, ibp->label);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = ibp->label;
+
+ if (label.isEmpty())
+ label = i18nc(libindi_strings_context, ibp->name);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = ibp->name;
+
+ text = i18n("INDI DATA STREAM");
+
+ switch (property->getPermission())
+ {
+ case IP_RW:
+ setupElementRead(ELEMENT_READ_WIDTH);
+ setupElementWrite(ELEMENT_WRITE_WIDTH);
+ setupBrowseButton();
+ break;
+
+ case IP_RO:
+ setupElementRead(ELEMENT_FULL_WIDTH);
+ break;
+
+ case IP_WO:
+ setupElementWrite(ELEMENT_FULL_WIDTH);
+ setupBrowseButton();
+ break;
+ }
+
+ guiProp->addLayout(EHBox);
+}*/
+
void ClientManagerLite::sendNewINDISwitch(QString deviceName, QString propName, QString name) {
foreach(DeviceInfoLite *devInfo, m_devices) {
INDI::BaseDevice *device = devInfo->device;
@@ -597,7 +675,7 @@ void ClientManagerLite::newProperty(INDI::Property *property)
break;
case INDI_LIGHT:
- //buildLightGUI();
+ buildLightGUI(property);
break;
case INDI_BLOB:
@@ -610,7 +688,7 @@ void ClientManagerLite::newProperty(INDI::Property *property)
}
void ClientManagerLite::removeProperty(INDI::Property *property) {
- emit removeINDIProperty(property->getGroupName(),property->getName());
+ emit removeINDIProperty(property->getDeviceName(), property->getGroupName(),property->getName());
DeviceInfoLite *devInfo = nullptr;
foreach(DeviceInfoLite *di, m_devices) {
@@ -632,6 +710,7 @@ void ClientManagerLite::removeProperty(INDI::Property *property) {
void ClientManagerLite::newBLOB(IBLOB *bp) {
processBLOBasCCD(bp);
+ emit newLEDState(bp->bvp->device , bp->name);
}
bool ClientManagerLite::processBLOBasCCD(IBLOB *bp) {
@@ -785,6 +864,7 @@ void ClientManagerLite::newSwitch(ISwitchVectorProperty *svp) {
}
if(sw != NULL) {
emit newINDISwitch(svp->device, svp->name, sw->name, sw->s == ISS_ON);
+ emit newLEDState(svp->device, svp->name);
}
}
}
@@ -805,6 +885,7 @@ void ClientManagerLite::newNumber(INumberVectorProperty *nvp)
QString numberName = num.name;
emit newINDINumber(deviceName, propName, numberName, QString(buf).trimmed());
+ emit newLEDState(deviceName, propName);
}
}
@@ -816,12 +897,13 @@ void ClientManagerLite::newText(ITextVectorProperty *tvp) {
QString fieldName = text.name;
emit newINDIText(deviceName, propName, fieldName, text.text);
+ emit newLEDState(deviceName, propName);
}
}
void ClientManagerLite::newLight(ILightVectorProperty *lvp) {
- QString deviceName = lvp->device;
- QString propName = lvp->name;
+ emit newINDILight(lvp->device, lvp->name);
+ emit newLEDState(lvp->device, lvp->name);
}
void ClientManagerLite::newMessage(INDI::BaseDevice *dp, int messageID) {
diff --git a/kstars/indi/clientmanagerlite.h b/kstars/indi/clientmanagerlite.h
index cbd6fe0..f738d4b 100644
--- a/kstars/indi/clientmanagerlite.h
+++ b/kstars/indi/clientmanagerlite.h
@@ -61,13 +61,20 @@ public:
QString connectedHost() { return m_connectedHost; }
void setConnectedHost(QString connectedHost);
void setConnected(bool connected);
- Q_INVOKABLE QString updateLED(QString device, QString property);
+ /**
+ * @brief syncLED
+ * @param name of Light which LED needs to be synced
+ * @return color of state
+ */
+ Q_INVOKABLE QString syncLED(QString device, QString property, QString name = "");
void buildTextGUI(INDI::Property * property);
void buildNumberGUI(INDI::Property * property);
void buildMenuGUI(INDI::Property * property);
void buildSwitchGUI(INDI::Property * property, PGui guiType);
void buildSwitch(bool buttonGroup, ISwitch *sw, INDI::Property *property, bool exclusive = false, PGui guiType = PG_BUTTONS);
+ void buildLightGUI(INDI::Property *property);
+ //void buildBLOBGUI(INDI::Property *property);
Q_INVOKABLE void sendNewINDISwitch(QString deviceName, QString propName, QString name);
Q_INVOKABLE void sendNewINDISwitch(QString deviceName, QString propName, int index);
@@ -122,14 +129,18 @@ signals:
void createINDIMenu(QString deviceName, QString propName, QString switchLabel, QString switchName, bool isSelected);
- void removeINDIProperty(QString groupName, QString propName);
+ void createINDILight(QString deviceName, QString propName, QString label, QString lightName);
+
+ void removeINDIProperty(QString deviceName, QString groupName, QString propName);
//Update signals
void newINDISwitch(QString deviceName, QString propName, QString switchName, bool isOn);
void newINDINumber(QString deviceName, QString propName, QString numberName, QString value);
void newINDIText(QString deviceName, QString propName, QString fieldName, QString text);
void newINDIMessage(QString message);
+ void newINDILight(QString deviceName, QString propName);
void newINDIBLOBImage(QString deviceName, bool isLoaded);
+ void newLEDState(QString deviceName, QString propName); // to sync LED for properties
void connectedHostChanged(QString);
void connectedChanged(bool);
diff --git a/kstars/indi/inditelescopelite.cpp b/kstars/indi/inditelescopelite.cpp
index 0ff1299..d8aa4b0 100644
--- a/kstars/indi/inditelescopelite.cpp
+++ b/kstars/indi/inditelescopelite.cpp
@@ -26,6 +26,8 @@ TelescopeLite::TelescopeLite(INDI::BaseDevice *device)
IsParked=false;
clientManager = KStarsLite::Instance()->clientManagerLite();
+ setSlewRate(0);
+
setSlewDecreasable(false);
setSlewIncreasable(true);
}
diff --git a/kstars/kstarslite.h b/kstars/kstarslite.h
index a87e2e7..17e393f 100644
--- a/kstars/kstarslite.h
+++ b/kstars/kstarslite.h
@@ -47,7 +47,6 @@ class QQuickItem;
class KStarsLite : public QObject
{
Q_OBJECT
-
private:
/**
* @short Constructor.
diff --git a/kstars/kstarslite/qml/indi/CMakeLists.txt b/kstars/kstarslite/qml/indi/CMakeLists.txt
index 742f480..ac928c1 100644
--- a/kstars/kstarslite/qml/indi/CMakeLists.txt
+++ b/kstars/kstarslite/qml/indi/CMakeLists.txt
@@ -8,6 +8,7 @@ install( FILES modules/MotionControl.qml
modules/Led.qml
modules/Property.qml
modules/KSTab.qml
+ modules/KSLed.qml
modules/KSButtonSwitch.qml
modules/KSButtonsSwitchRow.qml
modules/KSINDIText.qml
diff --git a/kstars/kstarslite/qml/indi/DevicePanel.qml b/kstars/kstarslite/qml/indi/DevicePanel.qml
index 621cec1..ffdac30 100644
--- a/kstars/kstarslite/qml/indi/DevicePanel.qml
+++ b/kstars/kstarslite/qml/indi/DevicePanel.qml
@@ -13,18 +13,26 @@ Item {
devicesPage.showPage(backtoInit)
}
- property string title
+ property string deviceName
+ property ImagePreview imagePreview: null
KSPage {
id: devicesPage
contentItem: deviceTabView
- title: devicesPanel.title
+ title: devicesPanel.deviceName + " - " + deviceTabView.currentTabTitle
+
TabView {
id: deviceTabView
+ currentIndex: 0
property var groups: []
property var properties: []
property var tabs: []
+ property string currentTabTitle: ""
+
+ onCurrentIndexChanged: {
+ currentTabTitle = getTab(currentIndex).title
+ }
Component.onCompleted: {
if(Qt.platform.os != "android") {
@@ -39,7 +47,8 @@ Item {
Connections {
target: ClientManagerLite
onNewINDIProperty: {
- if(devicesPage.title === deviceName) {
+ if(deviceTabView.currentTabTitle == "") deviceTabView.currentTabTitle = groupName
+ if(devicesPanel.deviceName === deviceName) {
if(deviceTabView.groups.indexOf(groupName) == -1) {
deviceTabView.groups.push(groupName)
var newTabComp = Qt.createComponent("modules/KSTab.qml");
@@ -59,13 +68,14 @@ Item {
if(tab.title === groupName) {
var propComp = Qt.createComponent("modules/Property.qml");
var property = propComp.createObject(tab.columnItem)
- property.name = propName
+ property.propName = propName
property.label = label
- property.device = deviceName
- if(propName == "CCD_EXPOSURE") {
+ property.deviceName = deviceName
+ property.parentTab = tab
+ if(propName == "CCD_EXPOSURE" && devicesPanel.imagePreview == null) {
var imgPreviewComp = Qt.createComponent("ImagePreview.qml");
- var imagePreview = imgPreviewComp.createObject(devicesPanel)
- imagePreview.deviceName = devicesPanel.title
+ devicesPanel.imagePreview = imgPreviewComp.createObject(devicesPanel)
+ devicesPanel.imagePreview.deviceName = devicesPanel.deviceName
}
}
}
@@ -78,7 +88,7 @@ Item {
if(tab.title === groupName && groupName != "Motion Control") {
var columnItem = deviceTabView.tabs[i].columnItem
for(var c = 0; c < columnItem.children.length; ++c) {
- if(columnItem.children[c].name === propName) {
+ if(columnItem.children[c].propName === propName) {
columnItem.children[c].destroy()
}
}
@@ -87,6 +97,9 @@ Item {
groups.splice(groups.indexOf(groupName), 1)
tab.destroy()
}
+ /*if(propName == "CCD_EXPOSURE" && devicesPanel.imagePreview != null) {
+ imgPreview.destroy()
+ }*/
}
}
}
diff --git a/kstars/kstarslite/qml/indi/INDIControlPanel.qml b/kstars/kstarslite/qml/indi/INDIControlPanel.qml
index 008d0ee..a5b46be 100644
--- a/kstars/kstarslite/qml/indi/INDIControlPanel.qml
+++ b/kstars/kstarslite/qml/indi/INDIControlPanel.qml
@@ -33,6 +33,7 @@ KSPage {
devicesModel.get(i).panel.destroy()
}
devicesModel.clear()
+ showPage(initPage)
showPassiveNotification("Disconnected from the server")
}
}
@@ -40,12 +41,13 @@ KSPage {
ColumnLayout {
id: cPanelColumn
+ spacing: 5 * num.dp
anchors {
top: parent.top
left: parent.left
right: parent.right
- topMargin: 5 * num.dp
+ topMargin: 15 * num.dp
leftMargin: 25 * num.dp
rightMargin: 25 * num.dp
}
@@ -92,7 +94,8 @@ KSPage {
}
Controls.Button {
- text: indiPage.connected ? "Disconnect" : "Connect"
+ text: indiPage.connected ? "Disconnect" : "Connect "
+
onClicked: {
if(!indiPage.connected) {
if(ClientManagerLite.setHost(ipHost.text, parseInt(portHost.text))) {
@@ -134,7 +137,7 @@ KSPage {
onNewINDIDevice: {
var component = Qt.createComponent(Qt.resolvedUrl("./DevicePanel.qml"));
var devicePanel = component.createObject(pagesWindow);
- devicePanel.title = deviceName
+ devicePanel.deviceName = deviceName
devicesModel.append({ name: deviceName, panel: devicePanel })
}
onRemoveINDIDevice: {
@@ -170,6 +173,8 @@ KSPage {
topPadding: 0
bottomPadding: 0
+ visible: connected
+
ListView {
id: list
diff --git a/kstars/kstarslite/qml/indi/ImagePreview.qml b/kstars/kstarslite/qml/indi/ImagePreview.qml
index 8358df1..bd22e57 100644
--- a/kstars/kstarslite/qml/indi/ImagePreview.qml
+++ b/kstars/kstarslite/qml/indi/ImagePreview.qml
@@ -12,8 +12,8 @@ KSPage {
contentItem: imgPreviewColumn
title: "Image Preview - " + deviceName
- property string deviceName: title
- property Item buttonRow
+ property string deviceName
+ property Item buttonRow: null
Item {
id: imgPreviewColumn
@@ -29,6 +29,7 @@ KSPage {
Layout.fillWidth: true
spacing: 5 * num.dp
+
Controls.Button {
text: "Save As"
@@ -58,11 +59,13 @@ KSPage {
Connections {
target: ClientManagerLite
onNewINDIBLOBImage: {
- image.source = "image://images/ccdPreview"
- imagePreview.showPage()
+ if(imagePreview.deviceName == deviceName) {
+ image.source = "image://images/ccdPreview"
+ imagePreview.showPage()
+ }
}
onCreateINDIButton: {
- if(deviceName == imagePreview.deviceName) {
+ if(imagePreview.deviceName == deviceName) {
if(propName == "UPLOAD_MODE") {
if(imagePreview.buttonRow == null) {
var buttonRowComp = Qt.createComponent("modules/KSButtonsSwitchRow.qml");
@@ -75,5 +78,15 @@ KSPage {
}
}
}
+ onRemoveINDIProperty: {
+ if(imagePreview.deviceName == deviceName) {
+ if(propName == "UPLOAD_MODE") {
+ if(imagePreview.buttonRow != null) {
+ imagePreview.buttonRow.destroy()
+ imagePreview.buttonRow = null
+ }
+ }
+ }
+ }
}
}
diff --git a/kstars/kstarslite/qml/indi/modules/KSButtonSwitch.qml b/kstars/kstarslite/qml/indi/modules/KSButtonSwitch.qml
index 64d0c6b..96f4c54 100644
--- a/kstars/kstarslite/qml/indi/modules/KSButtonSwitch.qml
+++ b/kstars/kstarslite/qml/indi/modules/KSButtonSwitch.qml
@@ -3,7 +3,7 @@ import QtQuick.Controls 1.4
Button {
property string switchName: ""
- property Row parentRow
+ property Flow parentRow
checkable: true
checked: true
diff --git a/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml b/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml
index ac1d1ba..b95511d 100644
--- a/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml
+++ b/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml
@@ -1,13 +1,17 @@
import QtQuick 2.4
import QtQuick.Controls 1.4
+import QtQuick.Window 2.2
+import "../../constants" 1.0
+import QtQuick.Layouts 1.2
-Row {
+Flow {
id:buttonsRow
property bool checkBox: false
property string propName: ""
property string deviceName: ""
property bool exclusive: false
- spacing: 5
+ //Layout.fillWidth: true
+ spacing: 5 * num.dp
Connections {
target: ClientManagerLite
@@ -24,7 +28,6 @@ Row {
}
}
-
function addButton(propText, switchName, initChecked, enabled) {
var buttonComp = Qt.createComponent("KSButtonSwitch.qml");
var button = buttonComp.createObject(this)
diff --git a/kstars/kstarslite/qml/indi/modules/KSCheckBox.qml b/kstars/kstarslite/qml/indi/modules/KSCheckBox.qml
index 04e86df..c5b3b71 100644
--- a/kstars/kstarslite/qml/indi/modules/KSCheckBox.qml
+++ b/kstars/kstarslite/qml/indi/modules/KSCheckBox.qml
@@ -3,7 +3,7 @@ import QtQuick.Controls 1.4
CheckBox {
property string switchName: ""
- property Row parentRow
+ property Flow parentRow
onClicked: {
parentRow.sendNewSwitch(switchName, null)
diff --git a/kstars/kstarslite/qml/indi/modules/KSComboBox.qml b/kstars/kstarslite/qml/indi/modules/KSComboBox.qml
index cf371ba..d14f612 100644
--- a/kstars/kstarslite/qml/indi/modules/KSComboBox.qml
+++ b/kstars/kstarslite/qml/indi/modules/KSComboBox.qml
@@ -2,14 +2,15 @@ import QtQuick 2.4
import QtQuick.Controls 1.4
ComboBox {
+ id: comboBox
property string deviceName: ""
property string propName: ""
Connections {
target: ClientManagerLite
onNewINDISwitch: {
- if(deviceName == device) {
- if(name == propName) {
+ if(comboBox.deviceName == deviceName) {
+ if(comboBox.propName == propName) {
for(var i = 0; i < model.count; ++i) {
if(model.get(i).name == switchName && isOn) {
currentIndex = i;
@@ -23,7 +24,7 @@ ComboBox {
onActivated: {
if(index >= 0) {
- ClientManagerLite.sendNewINDISwitch(deviceName,propName,index)
+ ClientManagerLite.sendNewINDISwitch(comboBox.deviceName, comboBox.propName,index)
}
}
diff --git a/kstars/kstarslite/qml/indi/modules/KSINDIText.qml b/kstars/kstarslite/qml/indi/modules/KSINDIText.qml
index 012d43e..94bc237 100644
--- a/kstars/kstarslite/qml/indi/modules/KSINDIText.qml
+++ b/kstars/kstarslite/qml/indi/modules/KSINDIText.qml
@@ -4,9 +4,10 @@ import "../../constants" 1.0
import org.kde.kirigami 1.0 as Kirigami
Column {
+ id: columnTextProp
Layout.fillHeight: true
+ Layout.fillWidth: true
spacing: 5 * num.dp
- width: parent.width
property string propLabel: ""
Kirigami.Label {
@@ -14,9 +15,9 @@ Column {
}
Rectangle {
- id:separator
+ id: separator
+ height: num.dp
color: "grey"
- height: 1 * num.dp
width: parent.width
}
@@ -24,7 +25,7 @@ Column {
var textItem
if(writable) {
var textComp = Qt.createComponent("KSINDITextField.qml");
- textItem = textComp.createObject(columnProp)
+ textItem = textComp.createObject(this)
textItem.deviceName = deviceName
textItem.propName = propName
textItem.fieldName = fieldName
diff --git a/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml b/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml
index e3f4711..92ab3cd 100644
--- a/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml
+++ b/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml
@@ -7,7 +7,7 @@ import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4
-Row {
+Flow {
id: textRow
spacing: 5 * num.dp
anchors {
@@ -62,5 +62,4 @@ Row {
}
}
}
-
}
diff --git a/kstars/kstarslite/qml/indi/modules/KSLed.qml b/kstars/kstarslite/qml/indi/modules/KSLed.qml
new file mode 100644
index 0000000..c16e146
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSLed.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 1.4
+import org.kde.kirigami 1.0 as Kirigami
+import "../../constants" 1.0
+import "../../modules"
+
+Row {
+ spacing: 5
+ id: ledRow
+ property string deviceName
+ property string propName
+ property string label
+ property string name //Used in Light
+
+ onDeviceNameChanged: {
+ syncLEDProperty()
+ }
+
+ onPropNameChanged: {
+ syncLEDProperty()
+ }
+
+ function syncLEDProperty() {
+ led.color = ClientManagerLite.syncLED(ledRow.deviceName, ledRow.propName)
+ }
+
+ function syncLEDLight() {
+ led.color = ClientManagerLite.syncLED(ledRow.deviceName, ledRow.propName, ledRow.name)
+ }
+
+ Connections {
+ target: ClientManagerLite
+ onNewINDILight: {
+ if(ledRow.deviceName == deviceName) {
+ if(ledRow.propName == propName) {
+ ledRow.syncLEDLight() // We update only Lights here
+ }
+ }
+ }
+ }
+
+ Led {
+ id: led
+ color: "red"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Kirigami.Label {
+ text: ledRow.label
+ anchors.verticalCenter: parent.verticalCenter
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSTab.qml b/kstars/kstarslite/qml/indi/modules/KSTab.qml
index ef8cb75..ae95d76 100644
--- a/kstars/kstarslite/qml/indi/modules/KSTab.qml
+++ b/kstars/kstarslite/qml/indi/modules/KSTab.qml
@@ -3,6 +3,7 @@ import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4
import org.kde.kirigami 1.0 as Kirigami
import "../../constants" 1.0
+import "../../modules"
Tab {
id: tab
@@ -10,7 +11,6 @@ Tab {
fill: parent
leftMargin: 5 * num.dp
rightMargin: 5 * num.dp
- bottomMargin: 5 * num.dp
}
active: true
@@ -27,7 +27,6 @@ Tab {
Column {
id: column
- anchors.leftMargin: 5 * num.dp
Component.onCompleted: {
tab.columnItem = this
diff --git a/kstars/kstarslite/qml/indi/modules/MotionControl.qml b/kstars/kstarslite/qml/indi/modules/MotionControl.qml
index d667167..e38ddf3 100644
--- a/kstars/kstarslite/qml/indi/modules/MotionControl.qml
+++ b/kstars/kstarslite/qml/indi/modules/MotionControl.qml
@@ -29,7 +29,7 @@ ColumnLayout {
}
}
onTelescopeAdded: {
- if(newTelescope.getDeviceName() == motionCColumn.deviceName) {
+ if(newTelescope.getDeviceName() === motionCColumn.deviceName) {
telescope = newTelescope
}
}
diff --git a/kstars/kstarslite/qml/indi/modules/Property.qml b/kstars/kstarslite/qml/indi/modules/Property.qml
index 63fdf3a..24d0c7a 100644
--- a/kstars/kstarslite/qml/indi/modules/Property.qml
+++ b/kstars/kstarslite/qml/indi/modules/Property.qml
@@ -10,82 +10,76 @@ ColumnLayout {
id: columnProp
Layout.fillHeight: true
- Layout.fillWidth: true
+ width: parentTab.width// : parent.width
- property string name: ""
- property string device: ""
+ property string deviceName: ""
+ property string propName: ""
property string label: ""
+ property Item parentTab
property ComboBox comboBox: null
- property Row buttonRow: null
+ property Flow buttonRow: null
- Row {
- id: labelRow
- spacing: 5
- Led {
- id: led
- color: ClientManagerLite.updateLED(device, name)
- anchors.verticalCenter: parent.verticalCenter
- }
+ KSLed {
+ id: led
+ deviceName: columnProp.deviceName
+ propName: columnProp.propName
+ label: columnProp.label
- Kirigami.Label {
- text: label
- anchors.verticalCenter: parent.verticalCenter
+ Component.onCompleted: {
+ syncLEDProperty()
}
}
- Item {
- id: propertyHolder
- Layout.fillHeight: true
- Layout.fillWidth: true
- }
-
Rectangle {
+ id: separator
height: num.dp
color: "grey"
- width: Screen.width
+ Layout.fillWidth: true
}
Connections {
target: ClientManagerLite
- onNewINDISwitch: {
- if(deviceName == device) {
- if(name == propName) {
- led.color = ClientManagerLite.updateLED(device, name)
+ onNewLEDState: {
+ if(columnProp.deviceName == deviceName) {
+ if(columnProp.propName == propName) {
+ led.syncLEDProperty()
}
}
}
onCreateINDIButton: {
- if(deviceName == device) {
- if(name == propName) {
+ if(columnProp.deviceName == deviceName) {
+ if(columnProp.propName == propName) {
if(buttonRow == null) {
var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml");
buttonRow = buttonRowComp.createObject(columnProp)
- buttonRow.deviceName = device
- buttonRow.propName = name
+ buttonRow.deviceName = deviceName
+ buttonRow.propName = propName
buttonRow.exclusive = exclusive
+ buttonRow.width = Qt.binding(function() { return parentTab.width })
}
buttonRow.addButton(propText, switchName, checked, enabled)
}
}
}
onCreateINDIRadio: {
- if(deviceName == device) {
- if(name == propName) {
+ if(columnProp.deviceName == deviceName) {
+ if(columnProp.propName == propName) {
if(buttonRow == null) {
var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml");
buttonRow = buttonRowComp.createObject(columnProp)
- buttonRow.deviceName = device
- buttonRow.propName = name
+ buttonRow.deviceName = deviceName
+ buttonRow.propName = propName
buttonRow.exclusive = exclusive
buttonRow.checkBox = true
+ buttonRow.width = Qt.binding(function() { return parentTab.width })
}
buttonRow.addCheckBox(propText, switchName, checked, enabled)
}
}
}
onCreateINDIMenu: {
- if(device == deviceName) {
- if(name == propName) {
+ if(columnProp.deviceName == deviceName) {
+ if(columnProp.propName == propName) {
if(comboBox == null) {
var CBoxComponent = Qt.createComponent("KSComboBox.qml");
comboBox = CBoxComponent.createObject(columnProp)
@@ -102,18 +96,19 @@ ColumnLayout {
}
onCreateINDIText: {
- if(deviceName == device) {
- if(name == propName) {
+ if(columnProp.deviceName == deviceName) {
+ if(columnProp.propName == propName) {
var indiTextComp = Qt.createComponent("KSINDIText.qml");
var indiText = indiTextComp.createObject(columnProp)
indiText.addField(false, deviceName, propName, fieldName, propText, write)
indiText.propLabel = propLabel
+ //indiText.width = Qt.binding(function() { return parentTab.width })
}
}
}
onCreateINDINumber: {
- if(deviceName == device) {
- if(name == propName) {
+ if(columnProp.deviceName == deviceName) {
+ if(columnProp.propName == propName) {
var indiNumComp = Qt.createComponent("KSINDIText.qml");
var indiNum = indiNumComp.createObject(columnProp)
indiNum.addField(true, deviceName, propName, numberName, propText, write)
@@ -121,5 +116,18 @@ ColumnLayout {
}
}
}
+ onCreateINDILight: {
+ if(columnProp.deviceName == deviceName) {
+ if(columnProp.propName == propName) {
+ var lightComp = Qt.createComponent("KSLed.qml")
+ var light = lightComp.createObject(columnProp)
+ light.deviceName = deviceName
+ light.propName = propName
+ light.label = label
+ light.name = name
+ light.syncLEDLight()
+ }
+ }
+ }
}
}
diff --git a/kstars/kstarslite/qml/main.qml b/kstars/kstarslite/qml/main.qml
index fadfc50..fec5b78 100644
--- a/kstars/kstarslite/qml/main.qml
+++ b/kstars/kstarslite/qml/main.qml
@@ -27,7 +27,16 @@ Kirigami.ApplicationWindow {
property var telescopes: []
- //pageStack.currentIndex: initPage
+ property bool loaded: false
+
+ Splash {
+ z:1
+ anchors.fill:parent
+ onTimeout: {
+ loaded = true
+ controlsVisible = true
+ }
+ }
property Item currentPage: initPage
@@ -37,8 +46,6 @@ Kirigami.ApplicationWindow {
visible: false
}
- property bool loaded: false
-
contentItem.anchors.topMargin: 0
wideScreen: true
@@ -81,6 +88,7 @@ Kirigami.ApplicationWindow {
maximumValue: 5.75954
minimumValue: 1.18778
value: SkyMapLite.magLim
+
onValueChanged: {
SkyMapLite.magLim = value
}
@@ -121,7 +129,7 @@ Kirigami.ApplicationWindow {
KSPage {
id: initPage
title: "Main Screen"
- visible:true
+ visible: loaded
TapSensor {
onReadingChanged: {
@@ -204,15 +212,6 @@ Kirigami.ApplicationWindow {
]
}
- Splash {
- z:1
- anchors.fill:parent
- onTimeout: {
- loaded = true
- mainWindow.controlsVisible = true
- }
- }
-
/*content is made Rectangle to allow z-index ordering
(for some reason it doesn't work with plain Item)*/
Item {
diff --git a/kstars/kstarslite/qml/modules/KSPage.qml b/kstars/kstarslite/qml/modules/KSPage.qml
index 2c4c5bd..173ef7f 100644
--- a/kstars/kstarslite/qml/modules/KSPage.qml
+++ b/kstars/kstarslite/qml/modules/KSPage.qml
@@ -55,7 +55,7 @@ Kirigami.Page {
left: parent.left
right: parent.right
}
- height: Screen.height * 0.07 + headerSeparator.height
+ height: Screen.height * 0.09 + headerSeparator.height
gradient: Gradient {
GradientStop { position: 0.0; color: "#207ce5" }
GradientStop { position: 0.70; color: "#499bea" }
@@ -64,17 +64,17 @@ Kirigami.Page {
RowLayout {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
- anchors.leftMargin: 10
+ anchors.leftMargin: 10 * num.dp
Rectangle {
id: backRect
radius: width * 0.5
- color: "grey"
- opacity: 0
+ color: "#F0F0F0"
+ //opacity: 0
state: "released"
- width: 30 * num.dp
- height: 30 * num.dp
+ width: pageTitle.height + 15 * num.dp
+ height: width
MouseArea {
anchors.fill: parent
@@ -84,8 +84,10 @@ Kirigami.Page {
onPressedChanged: {
if(pressed) {
backRect.state = "pressed"
+ console.log(backRect.state)
} else {
backRect.state = "released"
+ console.log(backRect.state)
}
}
}
@@ -93,28 +95,26 @@ Kirigami.Page {
states: [
State {
name: "pressed"
- PropertyChanges { target: backRect; opacity: 0.6 }
- PropertyChanges { target: backButton; opacity: 0.6 }
+ PropertyChanges { target: backRect; opacity: 0.3 }
+ //PropertyChanges { target: backButton; opacity: 0.6 }
},
State {
name: "released"
PropertyChanges { target: backRect; opacity: 0 }
- PropertyChanges { target: backButton; opacity: 1 }
+ //PropertyChanges { target: backButton; opacity: 1 }
}
]
transitions: [
Transition {
- from: "pressed"
- to: "released"
- OpacityAnimator { target: backRect; duration: 1000}
- OpacityAnimator { target: backButton; duration: 1000}
+ from: "released"
+ to: "pressed"
+ PropertyAnimation { target: backRect; properties: "opacity"; duration: 100 }
},
Transition {
- from: "released"
+ from: "pressed"
to: "released"
- OpacityAnimator { target: backRect; duration: 1000}
- OpacityAnimator { target: backButton; duration: 1000}
+ PropertyAnimation { target: backRect; properties: "opacity"; duration: 150 }
}
]
}
@@ -123,7 +123,8 @@ Kirigami.Page {
id: backButton
visible: prevPage !== null
source: "images/" + num.density + "/icons/back.png"
- sourceSize.height: pageTitle.width
+ sourceSize.height: pageTitle.height + 2 * num.dp
+ sourceSize.width: pageTitle.height + 2 * num.dp
anchors.centerIn: backRect
}
@@ -133,7 +134,7 @@ Kirigami.Page {
text: title
color: "white"
anchors.left: backButton.right
- anchors.leftMargin: 20
+ anchors.leftMargin: 20 * num.dp
}
}
diff --git a/kstars/kstarslite/skyitems/telescopesymbolsitem.cpp b/kstars/kstarslite/skyitems/telescopesymbolsitem.cpp
index 4e8452f..92a9450 100644
--- a/kstars/kstarslite/skyitems/telescopesymbolsitem.cpp
+++ b/kstars/kstarslite/skyitems/telescopesymbolsitem.cpp
@@ -35,9 +35,12 @@ TelescopeSymbolsItem::TelescopeSymbolsItem(RootNode *rootNode)
}
void TelescopeSymbolsItem::addTelescope(INDI::BaseDevice *bd) {
- CrosshairNode *crossHair = new CrosshairNode(bd, rootNode());
- appendChildNode(crossHair);
- m_telescopes.insert(bd, crossHair);
+ if(!m_telescopes.value(bd)) {
+ CrosshairNode *crossHair = new CrosshairNode(bd, rootNode());
+ appendChildNode(crossHair);
+
+ m_telescopes.insert(bd, crossHair);
+ }
}
void TelescopeSymbolsItem::removeTelescope(INDI::BaseDevice *bd) {
diff --git a/kstars/skymapliteevents.cpp b/kstars/skymapliteevents.cpp
index b895286..a0afe44 100644
--- a/kstars/skymapliteevents.cpp
+++ b/kstars/skymapliteevents.cpp
@@ -235,17 +235,6 @@ void SkyMapLite::wheelEvent( QWheelEvent *e ) {
void SkyMapLite::touchEvent( QTouchEvent *e) {
QList<QTouchEvent::TouchPoint> points = e->touchPoints();
- QTapReading *reading = m_tapSensor->reading();
-
- if(reading) {
- qDebug() << reading->isDoubleTap();
- }
-
- bool conn = m_tapSensor->isConnectedToBackend();
- qDebug() << conn << "Connect State";
- qDebug() << m_tapSensor->connectToBackend() << "trying to connect";
-
-
if(points.length() == 2) {
if ( projector()->unusablePoint( points[0].pos() ) ||
projector()->unusablePoint( points[1].pos() ))
@@ -361,7 +350,7 @@ void SkyMapLite::touchEvent( QTouchEvent *e) {
setClickedPoint( &m_MousePoint );
//Find object nearest to clickedPoint()
- double maxrad = 1000.0/Options::zoomFactor()*2; /* On high zoom-level it is very hard to select the object using touch screen.
+ double maxrad = 2.5;/*1000.0/Options::zoomFactor()*2; /* On high zoom-level it is very hard to select the object using touch screen.
That's why radius remains constant*/
qDebug() << maxrad << "maxrad";
SkyObject* obj = data->skyComposite()->objectNearest( clickedPoint(), maxrad );