Add debug dialog and configurable window height/width
This commit is contained in:
parent
8804658d75
commit
d6364ce766
77
src/qml/Dialogs/DebugDialog.qml
Normal file
77
src/qml/Dialogs/DebugDialog.qml
Normal file
|
@ -0,0 +1,77 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Dialogs 1.3
|
||||
import QtQuick.Window 2.2
|
||||
import player 1.0
|
||||
|
||||
Dialog {
|
||||
id: debugDialog
|
||||
title: "Debug"
|
||||
height: 480
|
||||
width: 720
|
||||
modality: Qt.NonModal
|
||||
standardButtons: Dialog.NoButton
|
||||
|
||||
Component {
|
||||
id: delegate
|
||||
Item {
|
||||
width: 200; height: 30
|
||||
Label {
|
||||
text: theOutput
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: modelly
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: output
|
||||
model: modelly
|
||||
delegate: delegate
|
||||
height: 50
|
||||
width: parent.width
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: input.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TextField {
|
||||
id: input
|
||||
width: parent.width
|
||||
height: 40
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
text: "h"
|
||||
function doJsEval() {
|
||||
var output;
|
||||
try {
|
||||
let result = eval(input.text)
|
||||
output = result instanceof Array ? "[" + String(result) + "]" : String(result)
|
||||
modelly.append({theOutput: output})
|
||||
} catch (e) {
|
||||
output = String(e)
|
||||
modelly.append({theOutput: output})
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
doJsEval()
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
Action {
|
||||
shortcut: "Ctrl+Shift+i"
|
||||
onTriggered: {
|
||||
debugDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,13 +8,18 @@ Window {
|
|||
id: mainWindow
|
||||
title: "KittehPlayer"
|
||||
visible: true
|
||||
width: Math.min(720, Screen.width)
|
||||
height: Math.min(480, Screen.height)
|
||||
width: Math.min(appearance.defaultWidth, Screen.width)
|
||||
height: Math.min(appearance.defaultHeight, Screen.height)
|
||||
property bool controlsShowing: true
|
||||
property int virtualHeight: Screen.height * appearance.scaleFactor
|
||||
property int virtualWidth: Screen.width * appearance.scaleFactor
|
||||
property bool onTop: false
|
||||
|
||||
DebugDialog {
|
||||
|
||||
}
|
||||
|
||||
|
||||
QMLDebugger {
|
||||
id: qmlDebugger
|
||||
}
|
||||
|
@ -66,6 +71,8 @@ Window {
|
|||
property string fontName: "Roboto"
|
||||
property double scaleFactor: 1.0
|
||||
property int subtitlesFontSize: 24
|
||||
property int defaultHeight: 405
|
||||
property int defaultWidth: 720
|
||||
property int uiFadeTimer: 1000
|
||||
property bool doubleTapToSeek: true
|
||||
property double doubleTapToSeekBy: 5
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<file alias="SettingsDialog.qml">Dialogs/SettingsDialog.qml</file>
|
||||
<file alias="LanguageSettings.qml">Dialogs/SettingsItems/LanguageSettings.qml</file>
|
||||
<file alias="PlaylistDialog.qml">Dialogs/PlaylistDialog.qml</file>
|
||||
<file alias="DebugDialog.qml">Dialogs/DebugDialog.qml</file>
|
||||
<file>icons/YouTube/play.svg</file>
|
||||
<file>icons/YouTube/pause.svg</file>
|
||||
<file>icons/YouTube/forward.svg</file>
|
||||
|
|
Loading…
Reference in a new issue