Rectangle {
color:"#00000000"
- border.color: "black"
- width: 20
- height: 100
+ border.color: "darkGrey"
property bool horiz:false
property real val:0
property real max:100
property color textColor:"black"
property int textSize:30
id:calibrateDialog
- width: 800
- height: 600
+ width: 900
+ height: 500
data:
JoyStickCalibratorDesktop {
id:jsCalibrator
import com.nokia.meego 1.0
import JoyStick 1.0
Page {
- property color textColor:"black"
+ property color textColor:"White"
property int textSize:30
id:dialog
tools:commonTools
- Menu {
- id:uiMenu
- visualParent:pageStack
- MenuLayout {
- MenuItem { text:"MeeGo/Harmattan 854x480"; onClicked: { drone.confActiveUI="ardrone_harmattan.qml" }}
- MenuItem { text:"Desktop"; onClicked: { drone.confActiveUI="ardrone_desktop.qml"}}
- }
- }
+
Component.onCompleted: {
console.debug("Appending items to choices",uiList.count())
for(var j = 0; j < uiList.count();++j ) {
property color textColor:"white"
property int textSize:30
id:dialog
- tools:commonTools
- Menu {
- id:uiMenu
- visualParent:pageStack
- MenuLayout {
- MenuItem { text:"MeeGo/Harmattan 854x480"; onClicked: { drone.confActiveUI="ardrone_harmattan.qml" }}
- MenuItem { text:"Desktop"; onClicked: { drone.confActiveUI="ardrone_desktop.qml"}}
- }
- }
+ // tools:commonTools
+
Component.onCompleted: {
console.debug("Appending items to choices",uiList.count())
for(var j = 0; j < uiList.count();++j ) {
Item {
width: 600
- height: 800
+ height: 600
property int textSize:22
property int ctrlSize:40
ListModel {
id: axisMapModel
+ ListElement { text:"none"; mapAxis:0 }
ListElement { text:"Aileron"; mapAxis:1 }
ListElement { text:"Elevator"; mapAxis:2 }
ListElement { text:"Throtle"; mapAxis:3 }
}
Column {
Button{
- text:"Reset"
+ width:160
+ text:"Calibrate"
onClicked:{
- js.calibrate=false
- pageStack.pop();
+ js.calibrate=true
}
}
Button{
+ width:160
text:"Save"
onClicked:{
js.calibrate=false
- pageStack.pop();
}
}
}
columns:7
Text {
font.pixelSize :textSize
- text:" Raw"
+ text:" Raw"
}
Text {
font.pixelSize :textSize
width:200;
model: axisMapModel
onSelectedIndexChanged: {
- console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
- js.mapAxis1=selectedIndex+1;
+ console.debug("onSelectedIndexChanged axis1:" + selectedText + ", " + selectedIndex);
+ // js.mapAxis1=selectedIndex;
}
- selectedIndex:js.mapAxis1-1
+
+ selectedIndex:js.mapAxis1
}
-/* Button{
- width:200;height:ctrlSize
- text:js.mapAxis1==1?"Aileron":js.mapAxis1==2?"Elevator":js.mapAxis1==3?"Throtle":js.mapAxis1==4?"Rudder":"none"
- onClicked:js1map.open()
+ Binding {
+ target:js
+ property:"mapAxis1"
+ value:axisMap1UICombo.selectedIndex
}
-*/
-
Text {
font.pixelSize :textSize
checked:js.invertAxis2
onCheckedChanged:{js.invertAxis2=checked;}
}
- Button{
- width:200;height:ctrlSize
- text:js.mapAxis2==1?"Aileron":js.mapAxis2==2?"Elevator":js.mapAxis2==3?"Throtle":js.mapAxis2==4?"Rudder":"none"
- onClicked:js2map.open()
- }
-
+ ComboBox {
+ id: axisMap2UICombo;
+ width:200;
+ model: axisMapModel
+ onSelectedIndexChanged: {
+ console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+ // js.mapAxis2=selectedIndex+1;
+ }
+ selectedIndex:js.mapAxis2
+ }
Text {
checked:js.invertAxis3
onCheckedChanged:{js.invertAxis3=checked;}
}
- Button{
- width:200;height:ctrlSize
- text:js.mapAxis3==1?"Aileron":js.mapAxis3==2?"Elevator":js.mapAxis3==3?"Throtle":js.mapAxis3==4?"Rudder":"none"
- onClicked:js3map.open()
- }
-
+ ComboBox {
+ id: axisMap3UICombo;
+ width:200;
+ model: axisMapModel
+ onSelectedIndexChanged: {
+ console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+ // js.mapAxis3=selectedIndex+1;
+ }
+ selectedIndex:js.mapAxis3
+ }
Text {
font.pixelSize :textSize
text:js.rawAxis4
checked:js.invertAxis4
onCheckedChanged:{js.invertAxis4=checked;}
}
- Button{
- width:200;height:ctrlSize
- text:js.mapAxis4==1?"Aileron":js.mapAxis4==2?"Elevator":js.mapAxis4==3?"Throtle":js.mapAxis4==4?"Rudder":"none"
- onClicked:js4map.open()
- }
-
+ ComboBox {
+ id: axisMap4UICombo;
+ width:200;
+ model: axisMapModel
+ onSelectedIndexChanged: {
+ console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+ // js.mapAxis4=selectedIndex+1;
+ }
+ selectedIndex:js.mapAxis4
+ }
Text {
font.pixelSize :textSize
text:js.rawAxis5
checked:js.invertAxis5
onCheckedChanged:{js.invertAxis5=checked;}
}
- Button{
- width:200;height:ctrlSize
- text:js.mapAxis5==1?"Aileron":js.mapAxis5==2?"Elevator":js.mapAxis5==3?"Throtle":js.mapAxis5==4?"Rudder":"none"
- onClicked:js5map.open()
- }
-
+ ComboBox {
+ id: axisMap5UICombo;
+ width:200;
+ model: axisMapModel
+ onSelectedIndexChanged: {
+ console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+ // js.mapAxis5=selectedIndex+1;
+ }
+ selectedIndex:js.mapAxis5
+ }
Text {
font.pixelSize :textSize
text:js.rawAxis6
checked:js.invertAxis6
onCheckedChanged:{js.invertAxis6=checked;}
}
- Button{
- width:200;height:ctrlSize
- text:js.mapAxis6==1?"Aileron":js.mapAxis6==2?"Elevator":js.mapAxis6==3?"Throtle":js.mapAxis6==4?"Rudder":"none"
- onClicked:js6map.open()
- }
+ ComboBox {
+ id: axisMap6UICombo;
+ width:200;
+ model: axisMapModel
+ onSelectedIndexChanged: {
+ console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+ // js.mapAxis6=selectedIndex+1;
+ }
+ selectedIndex:js.mapAxis6
+ }
}
}
property Component dialogComponent
// property alias m: mainPage
- /*
- ToolBarLayout {
- id: commonTools
- visible: false
- ToolItem { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
- // ToolItem { iconId: "icon-m-toolbar-home"; onClicked: pageStack.pop(); }
- ToolItem { iconId: "icon-m-toolbar-view-menu"; onClicked: myMenu.open(); }
- }
- */
ToolBarLayout {
id: commonTools
ToolButton {
onRudderChanged: {if(drone.confUseJoyStick) drone.yaw=rudder;}
}
+ Keys.onUpPressed: {
+ console.debug("QML:Keys.onUpPressed",event.key)
+ if (event.key == Qt.Key_TopMenu)
+ console.debug("QML: opening menu!")
+ else if (event.key == Qt.Key_MediaPrevious) {
+ console.debug("QML: closing! (maybe)")
+ pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
+ }
+ }
+ Keys.onPressed: {
+ console.debug("QML:Keys.onPressed",event.key)
+ if (event.key == Qt.Key_TopMenu)
+ console.debug("QML: opening menu!")
+ else if (event.key == Qt.Key_MediaPrevious) {
+ console.debug("QML: closing! (maybe)")
+ pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
+ }
+ }
+
+ function backKey() {
+ console.debug("QML: backKey")
+ pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
+ }
+
Component {
id: mainpageComponent
Button {
x:400
- width:60
+ width:80
height:50
id:flyButton
anchors.bottom:parent.bottom
}
Button {
x:500;
- width:80
+ width:90
height:50
id:emergencyButton
anchors.bottom:parent.bottom
Window {
title: "MArdrone"
id:mainWindow
- width: 1024
+ width: 700
height: 800
maximumHeight: mainWindow.height
minimumHeight: 800
maximumWidth: 1280
- minimumWidth: 800
+ minimumWidth: 700
visible: true
Column {
width:parent.width
- spacing:5
+ // spacing:5
Rectangle {
id:mainWiew
width:parent.width
+ color:"black"
height:480
//onEntered:(mainWindow.fullscreen=true)
onPressedChanged: { drone.ctrlActive=pressed;}
}
}
+
+ Rectangle {
+ width:parent.width
+ // width:chlidrenRect.width
+ // height:childrenRect.height
+ height:320
+ color: "black"
+
+
+
Row {
+ id:instrumentPanel
spacing:5
+ anchors.fill:parent
+ anchors.margins:5
EfisPFD {
id:pDF
pitch:drone.dronePitch
bezel:"bezel.png"
}
- HeadingGauge {
+ Item {
width:120
height:120
- id:hdgGauge
- value:drone.droneYaw
- bezel:"bezel.png"
- }
+
+
GaugeArc {
- width:120
- height:120
- id:fuelGauge
- anchors.margins:10
- displayScale:0.85
+ anchors.fill:parent
+ id:speedGauge
+ // anchors.margins:10
+ displayScale:0.95
font.pixelSize:10
- tickIncrement:10
+ tickIncrement:20
tickSpacing:24
tickMinor:5
lowPosition:220
highPosition:120
low:0
- high:100
+ high:200
gaugeStyle:2
color:"white"
- value:drone.droneVBat
+ value:drone.droneSpeed
lineWidth:2
backColor:"black"
}
- GaugeHSI{
- anchors.margins:10
- displayScale:0.5
+ Image {
+ anchors.fill:parent
+ source:"bezel.png"
+ }
+ }
+
+ Item {
width:120
height:120
+
+
+ GaugeArc {
+ anchors.fill:parent
+ id:fuelGauge
+ // anchors.margins:10
+ displayScale:0.95
font.pixelSize:10
- tickIncrement:30
- tickSpacing:10
+ tickIncrement:10
+ tickSpacing:22
tickMinor:5
+ lowPosition:240
+ highPosition:120
+ low:0
+ high:100
gaugeStyle:2
color:"white"
+ value:drone.droneVBat
+ lineWidth:2
backColor:"black"
- id:hsi
}
+ Image {
+ anchors.fill:parent
+ source:"bezel.png"
+ }
+ }
+ Item {
+ width:120
+ height:120
+ HeadingGauge {
+ width:120
+ height:120
+ id:hdgGauge
+ value:drone.droneYaw
+ bezel:"bezel.png"
+ }
+ }
+ Item {
+ width:120
+ height:120
+ Rectangle {
+ anchors.fill:parent
+ anchors.margins:5
+ color:"gray"
+ }
Row {
+ anchors.centerIn:parent
spacing: 5
- anchors.rightMargin: 10
- height:100
+ anchors.margins: 30
+ height:90
BarGauge {
val:drone.pwm_motor1;
max: 255
- height:100
+ height:parent.height
+ width:10
}
BarGauge {
val:drone.pwm_motor2;
max: 255
- height:100
+ height:parent.height
+ width:10
}
BarGauge {
val:drone.pwm_motor3;
max: 255
- height:100
+ height:parent.height
+ width:10
}
BarGauge {
val:drone.pwm_motor4;
max: 255
- height:100
+ height:parent.height
+ width:10
}
+ /*
BarGauge {
val:drone.droneVBat
max: 100
- height:100
+ height:parent.height
+ width:10
+ }
+ */
+ }
+ Image {
+ anchors.fill:parent
+ source:"bezel.png"
}
}
+ Button {
+
+ width:80
+ height:50
+ id:flyButton
+ // anchors.bottom:parent.bottom
+ anchors.margins:15
+ text:"Fly";
+ checkable:true
+ onClicked:{drone.fly=checked;
+ // mainWindow.fullsecreen=checked;
+ }
+ }
+ Button {
+
+ width:90
+ height:50
+ id:emergencyButton
+ // anchors.bottom:parent.bottom
+ anchors.margins:15
+ text:"Emrg";
+ checkable:true
+ onClicked:{drone.emergency=checked;}
+ }
+
+ Button {
+
+ width:100
+ height:50
+ id:recordButton
+ // anchors.bottom:parent.bottom
+ anchors.margins:15
+ text:"Rec";
+ checkable:true
+ onClicked:{droneVideo.recVideo=checked; drone.logFileName=droneVideo.videoFileName; drone.recordLog=checked;}
+ }
} // Grid if instruments
- } // Column ( Main window content )
+ }
+ } // Column ( Main window content )
+ }
Dialog {
id:configDialog
width:800
height:600
data:ConfigDialogDesktop {}
}
- }
+
} // Main page
onRudderChanged: {if(drone.confUseJoyStick) drone.yaw=rudder;}
}
+ Keys.onPressed: {
+ console.debug("QML:Keys.onPressed",event.key)
+ if (event.key == Qt.Key_TopMenu)
+ console.debug("QML: opening menu!")
+ else if (event.key == Qt.Key_Close) {
+ console.debug("QML: closing! (maybe)")
+ pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
+ }
+ }
+
+ function backKey() {
+ console.debug("QML: backKey")
+ pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
+ }
Component {
id: mainpageComponent
{
if(m_joyCal && !val ) saveCalibration();
m_joyCal=val;
+ emit joyStickConfigChanged();
};
class JoyStick : public QObject
{
Q_OBJECT
- Q_PROPERTY(bool haveJoyStick READ haveJoyStick NOTIFY joyStickChanged)
- Q_PROPERTY(QString joyStickName READ joyStickName NOTIFY joyStickChanged)
+ Q_PROPERTY(bool haveJoyStick READ haveJoyStick NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(bool calibrate READ calibrate WRITE setCalibrate NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(QString joyStickName READ joyStickName NOTIFY joyStickConfigChanged)
Q_PROPERTY(int rawAxis1 READ rawAxis1 NOTIFY joyStickChanged)
Q_PROPERTY(int rawAxis2 READ rawAxis2 NOTIFY joyStickChanged)
Q_PROPERTY(int rawAxis3 READ rawAxis3 NOTIFY joyStickChanged)
Q_PROPERTY(float elevator READ axis2 NOTIFY joyStickChanged)
Q_PROPERTY(float throtle READ axis3 NOTIFY joyStickChanged)
Q_PROPERTY(float rudder READ axis4 NOTIFY joyStickChanged)
- Q_PROPERTY(int mapAxis1 READ mapAxis1 WRITE setMapAxis1 NOTIFY joyStickChanged)
- Q_PROPERTY(int mapAxis2 READ mapAxis2 WRITE setMapAxis2 NOTIFY joyStickChanged)
- Q_PROPERTY(int mapAxis3 READ mapAxis3 WRITE setMapAxis3 NOTIFY joyStickChanged)
- Q_PROPERTY(int mapAxis4 READ mapAxis4 WRITE setMapAxis4 NOTIFY joyStickChanged)
- Q_PROPERTY(int mapAxis5 READ mapAxis5 WRITE setMapAxis5 NOTIFY joyStickChanged)
- Q_PROPERTY(int mapAxis6 READ mapAxis6 WRITE setMapAxis6 NOTIFY joyStickChanged)
- Q_PROPERTY(bool invertAxis1 READ invertAxis1 WRITE setInvertAxis1 NOTIFY joyStickChanged)
- Q_PROPERTY(bool invertAxis2 READ invertAxis2 WRITE setInvertAxis2 NOTIFY joyStickChanged)
- Q_PROPERTY(bool invertAxis3 READ invertAxis3 WRITE setInvertAxis3 NOTIFY joyStickChanged)
- Q_PROPERTY(bool invertAxis4 READ invertAxis4 WRITE setInvertAxis4 NOTIFY joyStickChanged)
- Q_PROPERTY(bool invertAxis5 READ invertAxis5 WRITE setInvertAxis5 NOTIFY joyStickChanged)
- Q_PROPERTY(bool invertAxis6 READ invertAxis6 WRITE setInvertAxis6 NOTIFY joyStickChanged)
- Q_PROPERTY(bool calibrate READ calibrate WRITE setCalibrate)
-public:
+ Q_PROPERTY(int mapAxis1 READ mapAxis1 WRITE setMapAxis1 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(int mapAxis2 READ mapAxis2 WRITE setMapAxis2 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(int mapAxis3 READ mapAxis3 WRITE setMapAxis3 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(int mapAxis4 READ mapAxis4 WRITE setMapAxis4 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(int mapAxis5 READ mapAxis5 WRITE setMapAxis5 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(int mapAxis6 READ mapAxis6 WRITE setMapAxis6 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(bool invertAxis1 READ invertAxis1 WRITE setInvertAxis1 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(bool invertAxis2 READ invertAxis2 WRITE setInvertAxis2 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(bool invertAxis3 READ invertAxis3 WRITE setInvertAxis3 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(bool invertAxis4 READ invertAxis4 WRITE setInvertAxis4 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(bool invertAxis5 READ invertAxis5 WRITE setInvertAxis5 NOTIFY joyStickConfigChanged)
+ Q_PROPERTY(bool invertAxis6 READ invertAxis6 WRITE setInvertAxis6 NOTIFY joyStickConfigChanged)
+ public:
explicit JoyStick(QObject *parent = 0);
~JoyStick();
// JoyStick configuration
int invertAxis4() { return m_invertAxis4; };
int invertAxis5() { return m_invertAxis5; };
int invertAxis6() { return m_invertAxis6; };
- void setInvertAxis1(bool val) { m_invertAxis1=val; };
- void setInvertAxis2(bool val) { m_invertAxis2=val; };
- void setInvertAxis3(bool val) { m_invertAxis3=val; };
- void setInvertAxis4(bool val) { m_invertAxis4=val; };
- void setInvertAxis5(bool val) { m_invertAxis5=val; };
- void setInvertAxis6(bool val) { m_invertAxis6=val; };
- void setMapAxis1(int val) { m_mapAxis[0]=val; };
- void setMapAxis2(int val) { m_mapAxis[1]=val; };
- void setMapAxis3(int val) { m_mapAxis[2]=val; };
- void setMapAxis4(int val) { m_mapAxis[3]=val; };
- void setMapAxis5(int val) { m_mapAxis[4]=val; };
- void setMapAxis6(int val) { m_mapAxis[5]=val; };
+ void setInvertAxis1(bool val) { m_invertAxis1=val;emit joyStickConfigChanged(); };
+ void setInvertAxis2(bool val) { m_invertAxis2=val;emit joyStickConfigChanged(); };
+ void setInvertAxis3(bool val) { m_invertAxis3=val;emit joyStickConfigChanged(); };
+ void setInvertAxis4(bool val) { m_invertAxis4=val;emit joyStickConfigChanged(); };
+ void setInvertAxis5(bool val) { m_invertAxis5=val;emit joyStickConfigChanged(); };
+ void setInvertAxis6(bool val) { m_invertAxis6=val;emit joyStickConfigChanged(); };
+ void setMapAxis1(int val) { if(m_mapAxis[0]!=val) emit joyStickConfigChanged();m_mapAxis[0]=val; };
+ void setMapAxis2(int val) { if(m_mapAxis[1]!=val) emit joyStickConfigChanged();m_mapAxis[1]=val; };
+ void setMapAxis3(int val) { if(m_mapAxis[2]!=val) emit joyStickConfigChanged();m_mapAxis[2]=val; };
+ void setMapAxis4(int val) { if(m_mapAxis[3]!=val) emit joyStickConfigChanged();m_mapAxis[3]=val; };
+ void setMapAxis5(int val) { if(m_mapAxis[4]!=val) emit joyStickConfigChanged();m_mapAxis[4]=val; };
+ void setMapAxis6(int val) { if(m_mapAxis[5]!=val) emit joyStickConfigChanged();m_mapAxis[5]=val; };
float getMapped(int axis);
void setMapped(int axis,float value);
bool calibrate() { return m_joyCal; };
signals:
void joyStickChanged();
+ void joyStickConfigChanged();
public slots:
void updateJoyStick();
private: