1
0
Fork 0

Add debug dialog and configurable window height/width

This commit is contained in:
namedkitten 2020-05-14 11:51:51 +01:00
parent 8804658d75
commit d6364ce766
4 changed files with 88 additions and 3 deletions

View 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()
}
}
}

View file

@ -8,13 +8,18 @@ Window {
id: mainWindow id: mainWindow
title: "KittehPlayer" title: "KittehPlayer"
visible: true visible: true
width: Math.min(720, Screen.width) width: Math.min(appearance.defaultWidth, Screen.width)
height: Math.min(480, Screen.height) height: Math.min(appearance.defaultHeight, Screen.height)
property bool controlsShowing: true property bool controlsShowing: true
property int virtualHeight: Screen.height * appearance.scaleFactor property int virtualHeight: Screen.height * appearance.scaleFactor
property int virtualWidth: Screen.width * appearance.scaleFactor property int virtualWidth: Screen.width * appearance.scaleFactor
property bool onTop: false property bool onTop: false
DebugDialog {
}
QMLDebugger { QMLDebugger {
id: qmlDebugger id: qmlDebugger
} }
@ -66,6 +71,8 @@ Window {
property string fontName: "Roboto" property string fontName: "Roboto"
property double scaleFactor: 1.0 property double scaleFactor: 1.0
property int subtitlesFontSize: 24 property int subtitlesFontSize: 24
property int defaultHeight: 405
property int defaultWidth: 720
property int uiFadeTimer: 1000 property int uiFadeTimer: 1000
property bool doubleTapToSeek: true property bool doubleTapToSeek: true
property double doubleTapToSeekBy: 5 property double doubleTapToSeekBy: 5

View file

@ -35,6 +35,7 @@
<file alias="SettingsDialog.qml">Dialogs/SettingsDialog.qml</file> <file alias="SettingsDialog.qml">Dialogs/SettingsDialog.qml</file>
<file alias="LanguageSettings.qml">Dialogs/SettingsItems/LanguageSettings.qml</file> <file alias="LanguageSettings.qml">Dialogs/SettingsItems/LanguageSettings.qml</file>
<file alias="PlaylistDialog.qml">Dialogs/PlaylistDialog.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/play.svg</file>
<file>icons/YouTube/pause.svg</file> <file>icons/YouTube/pause.svg</file>
<file>icons/YouTube/forward.svg</file> <file>icons/YouTube/forward.svg</file>

View file

@ -1 +1 @@
11 12