diff --git a/src/main.cpp b/src/main.cpp index ea96891..db9c5f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -89,7 +89,6 @@ spdLogger(QtMsgType type, const QMessageLogContext& context, const QString& msg) int main(int argc, char* argv[]) { - qInstallMessageHandler(spdLogger); auto launcherLogger = initLogger("launcher"); @@ -102,13 +101,27 @@ main(int argc, char* argv[]) app.setOrganizationDomain("namedkitten.pw"); app.setApplicationName("KittehPlayer"); -#ifdef __linux__ - catchUnixSignals({ SIGQUIT, SIGINT, SIGTERM, SIGHUP }); -#endif - QSettings settings; Utils::SetDPMS(false); +#ifdef __linux__ + catchUnixSignals({ SIGQUIT, SIGINT, SIGTERM, SIGHUP }); + + // WARNING, THIS IS A BIG HACK + // this is only to make it so KittehPlayer works first try on pinephone. + // TODO: launch a opengl window or use offscreen to see if GL_ARB_framebuffer_object + // can be found + if (! settings.value("Backend/disableSunxiCheck", false).toBool()) { + FILE *fd = popen("grep sunxi /proc/modules", "r"); + char buf[16]; + if (fread(buf, 1, sizeof (buf), fd) > 0) + launcherLogger->info("Running on sunxi, switching to NoFBO."); + settings.setValue("Backend/fbo", false); + } + +#endif + + QString newpath = QProcessEnvironment::systemEnvironment().value("APPDIR", "") + "/usr/bin:" + QProcessEnvironment::systemEnvironment().value("PATH", ""); diff --git a/src/qml/ControlsBar.qml b/src/qml/ControlsBar.qml index 436ae53..91c5695 100644 --- a/src/qml/ControlsBar.qml +++ b/src/qml/ControlsBar.qml @@ -21,15 +21,14 @@ Item { Connections { target: globalConnections - onHideUI: function(force) { - controlsBarItem.controlsShowing=false + onHideUI: function (force) { + controlsBarItem.controlsShowing = false } onShowUI: { - controlsBarItem.controlsShowing=true + controlsBarItem.controlsShowing = true } } - Component.onCompleted: { setControlsTheme(appearance.themeName) } @@ -115,16 +114,17 @@ Item { } } - VideoProgress { - id: progressBar - visible: controlsBarItem.controlsShowing && (appearance.themeName == "RoosterTeeth" ? false : true) - anchors.bottom: controlsBackground.top - anchors.left: controlsBackground.left - anchors.right: controlsBackground.right - anchors.bottomMargin: 0 - bottomPadding: 0 - z: 20 - } + VideoProgress { + id: progressBar + visible: controlsBarItem.controlsShowing + && (appearance.themeName == "RoosterTeeth" ? false : true) + anchors.bottom: controlsBackground.top + anchors.left: controlsBackground.left + anchors.right: controlsBackground.right + anchors.bottomMargin: 0 + bottomPadding: 0 + z: 20 + } Rectangle { id: controlsBackground diff --git a/src/qml/UIComponents/VideoProgress.qml b/src/qml/UIComponents/VideoProgress.qml index 3f55157..aa8b405 100644 --- a/src/qml/UIComponents/VideoProgress.qml +++ b/src/qml/UIComponents/VideoProgress.qml @@ -98,7 +98,6 @@ Slider { onEntered: timestampBox.visible = true onExited: timestampBox.visible = false - onPositionChanged: { var a = (progressBar.to / progressBar.availableWidth) * (mouseAreaProgressBar.mapToItem( @@ -111,7 +110,7 @@ Slider { background: Rectangle { anchors.bottom: parent.bottom - anchors.bottomMargin: progressBar.center ? (progressBar.height / 2) - (height / 2) : 0 + anchors.bottomMargin: progressBar.center ? (progressBar.height / 2) - (height / 2) : 0 id: progressBackground z: 30 width: progressBar.availableWidth @@ -179,7 +178,8 @@ Slider { id: handleRect x: progressBar.visualPosition * (progressBar.availableWidth - width) anchors.bottom: parent.bottom - anchors.bottomMargin: progressBar.center ? (progressBar.height / 2) - (height / 2) : -height / 4 + anchors.bottomMargin: progressBar.center ? (progressBar.height / 2) + - (height / 2) : -height / 4 implicitHeight: radius implicitWidth: radius radius: mainWindow.virtualHeight / 59 diff --git a/src/qml/main.qml b/src/qml/main.qml index 5a5231e..31960f4 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -26,8 +26,8 @@ Window { Item { id: globalConnections - signal showUI() - signal hideUI() + signal showUI + signal hideUI } function getAppearanceValueForTheme(themeName, name) { @@ -305,37 +305,36 @@ Window { } MouseArea { - anchors.fill: parent - width: parent.width - height: parent.height - property real velocity: 0.0 - property int xStart: 0 - property int xPrev: 0 - hoverEnabled: false - propagateComposedEvents: true - anchors.bottomMargin: controlsBar.combinedHeight - z: 1010 - onPressed: { - xStart = mouse.x - xPrev = mouse.x - velocity = 0 - } - onPositionChanged: { - var currVel = (mouse.x-xPrev) - velocity = (velocity + currVel)/2.0 - xPrev = mouse.x - } - onReleased: { - if ( velocity > 2 && mouse.x > parent.width*0.2 ) { - appearance.scaleFactor += 0.2 - } else if ( velocity < -2 && mouse.x > parent.width*0.2 ) { - appearance.scaleFactor -= 0.2 - } else { - console.info(velocity, mouse.x) - } + anchors.fill: parent + width: parent.width + height: parent.height + property real velocity: 0.0 + property int xStart: 0 + property int xPrev: 0 + hoverEnabled: false + propagateComposedEvents: true + anchors.bottomMargin: controlsBar.combinedHeight + z: 1010 + onPressed: { + xStart = mouse.x + xPrev = mouse.x + velocity = 0 + } + onPositionChanged: { + var currVel = (mouse.x - xPrev) + velocity = (velocity + currVel) / 2.0 + xPrev = mouse.x + } + onReleased: { + if (velocity > 2 && mouse.x > parent.width * 0.2) { + appearance.scaleFactor += 0.2 + } else if (velocity < -2 && mouse.x > parent.width * 0.2) { + appearance.scaleFactor -= 0.2 + } else { + console.info(velocity, mouse.x) } + } } - Item { id: controlsOverlay @@ -345,16 +344,15 @@ Window { property bool controlsShowing: true z: 2 - Connections { - target: globalConnections - onHideUI: function() { - mouseAreaPlayer.cursorShape = Qt.BlankCursor + Connections { + target: globalConnections + onHideUI: function () { + mouseAreaPlayer.cursorShape = Qt.BlankCursor + } + onShowUI: { + mouseAreaPlayer.cursorShape = Qt.ArrowCursor + } } - onShowUI: { - mouseAreaPlayer.cursorShape = Qt.ArrowCursor - } - } - MouseArea { id: mouseAreaBar @@ -384,32 +382,32 @@ Window { hoverEnabled: true propagateComposedEvents: true - - Timer{ + Timer { id: mouseTapTimer interval: 200 onTriggered: { if (appearance.clickToPause) { player.playerCommand(Enums.Commands.TogglePlayPause) - } + } } } function doubleMouseClick(mouse) { if (appearance.doubleTapToSeek) { if (mouse.x > (mouseAreaPlayer.width / 2)) { - player.playerCommand(Enums.Commands.Seek, String(appearance.doubleTapToSeekBy)) + player.playerCommand(Enums.Commands.Seek, String( + appearance.doubleTapToSeekBy)) } else { - player.playerCommand(Enums.Commands.Seek,"-" + String(appearance.doubleTapToSeekBy)) + player.playerCommand(Enums.Commands.Seek, "-" + String( + appearance.doubleTapToSeekBy)) } } else { toggleFullscreen() } } - - onClicked: function(mouse) { - if(mouseTapTimer.running) { + onClicked: function (mouse) { + if (mouseTapTimer.running) { doubleMouseClick(mouse) mouseTapTimer.stop() } else {