Skip to content

Instantly share code, notes, and snippets.

@kimmoli

kimmoli/kt.qml Secret

Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimmoli/1286171768835306ec6a to your computer and use it in GitHub Desktop.
Save kimmoli/1286171768835306ec6a to your computer and use it in GitHub Desktop.
.
import QtQuick 2.0
import QtMultimedia 5.0
import Sailfish.Silica 1.0
Dialog {
id: soundDialog;
allowedOrientations: Orientation.Portrait | Orientation.Landscape;
//canAccept: false;
property bool vibrate: false;
property bool sound: true;
SilicaFlickable {
anchors.fill: parent
contentHeight: column.height
DialogHeader {
id: header;
}
Column {
id: column;
anchors.top: header.bottom
width: soundDialog.width;
spacing: Theme.paddingLarge;
TextSwitch {
id: noSound;
checked: !sound;
leftMargin: Theme.paddingMedium;
text: qsTr('Disable sound');
onCheckedChanged: {
console.log('NoSound', checked)
sound = !checked;
}
onClicked: {
console.log('NoSound tapped', automaticCheck)
}
}
TextSwitch {
id: doVibrate;
checked: vibrate;
leftMargin: Theme.paddingMedium;
text: qsTr('Vibrate');
description: 'Since <code>QtFeedback</code> is not yet allowed, this does nothing.';
onCheckedChanged: {
console.log('Vibrate', checked)
vibrate = checked;
}
}
BackgroundItem {
//enabled: sound;
height: Theme.itemSizeLarge
width: parent.width;
Row {
spacing: theme.paddingMedium
anchors.verticalCenter: parent.verticalCenter
Image {
source: "image://theme/icon-l-music"
anchors.verticalCenter: parent.verticalCenter
}
Label {
textFormat: Text.StyledText;
text: qsTr('Select music file');
anchors.verticalCenter: parent.verticalCenter
}
}
onClicked: {
console.log('Select file', checked)
pageStack.push(Qt.resolvedUrl('SoundSelectDialog.qml'));
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment