Add big hack to make KittehPlayer run on pinephone without config changes.
This commit is contained in:
parent
15862e5c44
commit
0dba1c9146
23
src/main.cpp
23
src/main.cpp
|
@ -89,7 +89,6 @@ spdLogger(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
qInstallMessageHandler(spdLogger);
|
qInstallMessageHandler(spdLogger);
|
||||||
|
|
||||||
auto launcherLogger = initLogger("launcher");
|
auto launcherLogger = initLogger("launcher");
|
||||||
|
@ -102,13 +101,27 @@ main(int argc, char* argv[])
|
||||||
app.setOrganizationDomain("namedkitten.pw");
|
app.setOrganizationDomain("namedkitten.pw");
|
||||||
app.setApplicationName("KittehPlayer");
|
app.setApplicationName("KittehPlayer");
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
catchUnixSignals({ SIGQUIT, SIGINT, SIGTERM, SIGHUP });
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
Utils::SetDPMS(false);
|
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 =
|
QString newpath =
|
||||||
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
||||||
"/usr/bin:" + QProcessEnvironment::systemEnvironment().value("PATH", "");
|
"/usr/bin:" + QProcessEnvironment::systemEnvironment().value("PATH", "");
|
||||||
|
|
|
@ -21,15 +21,14 @@ Item {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: globalConnections
|
target: globalConnections
|
||||||
onHideUI: function(force) {
|
onHideUI: function (force) {
|
||||||
controlsBarItem.controlsShowing=false
|
controlsBarItem.controlsShowing = false
|
||||||
}
|
}
|
||||||
onShowUI: {
|
onShowUI: {
|
||||||
controlsBarItem.controlsShowing=true
|
controlsBarItem.controlsShowing = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
setControlsTheme(appearance.themeName)
|
setControlsTheme(appearance.themeName)
|
||||||
}
|
}
|
||||||
|
@ -115,16 +114,17 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoProgress {
|
VideoProgress {
|
||||||
id: progressBar
|
id: progressBar
|
||||||
visible: controlsBarItem.controlsShowing && (appearance.themeName == "RoosterTeeth" ? false : true)
|
visible: controlsBarItem.controlsShowing
|
||||||
anchors.bottom: controlsBackground.top
|
&& (appearance.themeName == "RoosterTeeth" ? false : true)
|
||||||
anchors.left: controlsBackground.left
|
anchors.bottom: controlsBackground.top
|
||||||
anchors.right: controlsBackground.right
|
anchors.left: controlsBackground.left
|
||||||
anchors.bottomMargin: 0
|
anchors.right: controlsBackground.right
|
||||||
bottomPadding: 0
|
anchors.bottomMargin: 0
|
||||||
z: 20
|
bottomPadding: 0
|
||||||
}
|
z: 20
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: controlsBackground
|
id: controlsBackground
|
||||||
|
|
|
@ -98,7 +98,6 @@ Slider {
|
||||||
onEntered: timestampBox.visible = true
|
onEntered: timestampBox.visible = true
|
||||||
onExited: timestampBox.visible = false
|
onExited: timestampBox.visible = false
|
||||||
|
|
||||||
|
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
var a = (progressBar.to / progressBar.availableWidth)
|
var a = (progressBar.to / progressBar.availableWidth)
|
||||||
* (mouseAreaProgressBar.mapToItem(
|
* (mouseAreaProgressBar.mapToItem(
|
||||||
|
@ -111,7 +110,7 @@ Slider {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
anchors.bottom: parent.bottom
|
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
|
id: progressBackground
|
||||||
z: 30
|
z: 30
|
||||||
width: progressBar.availableWidth
|
width: progressBar.availableWidth
|
||||||
|
@ -179,7 +178,8 @@ Slider {
|
||||||
id: handleRect
|
id: handleRect
|
||||||
x: progressBar.visualPosition * (progressBar.availableWidth - width)
|
x: progressBar.visualPosition * (progressBar.availableWidth - width)
|
||||||
anchors.bottom: parent.bottom
|
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
|
implicitHeight: radius
|
||||||
implicitWidth: radius
|
implicitWidth: radius
|
||||||
radius: mainWindow.virtualHeight / 59
|
radius: mainWindow.virtualHeight / 59
|
||||||
|
|
|
@ -26,8 +26,8 @@ Window {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: globalConnections
|
id: globalConnections
|
||||||
signal showUI()
|
signal showUI
|
||||||
signal hideUI()
|
signal hideUI
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAppearanceValueForTheme(themeName, name) {
|
function getAppearanceValueForTheme(themeName, name) {
|
||||||
|
@ -305,37 +305,36 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
property real velocity: 0.0
|
property real velocity: 0.0
|
||||||
property int xStart: 0
|
property int xStart: 0
|
||||||
property int xPrev: 0
|
property int xPrev: 0
|
||||||
hoverEnabled: false
|
hoverEnabled: false
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
anchors.bottomMargin: controlsBar.combinedHeight
|
anchors.bottomMargin: controlsBar.combinedHeight
|
||||||
z: 1010
|
z: 1010
|
||||||
onPressed: {
|
onPressed: {
|
||||||
xStart = mouse.x
|
xStart = mouse.x
|
||||||
xPrev = mouse.x
|
xPrev = mouse.x
|
||||||
velocity = 0
|
velocity = 0
|
||||||
}
|
}
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
var currVel = (mouse.x-xPrev)
|
var currVel = (mouse.x - xPrev)
|
||||||
velocity = (velocity + currVel)/2.0
|
velocity = (velocity + currVel) / 2.0
|
||||||
xPrev = mouse.x
|
xPrev = mouse.x
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
if ( velocity > 2 && mouse.x > parent.width*0.2 ) {
|
if (velocity > 2 && mouse.x > parent.width * 0.2) {
|
||||||
appearance.scaleFactor += 0.2
|
appearance.scaleFactor += 0.2
|
||||||
} else if ( velocity < -2 && mouse.x > parent.width*0.2 ) {
|
} else if (velocity < -2 && mouse.x > parent.width * 0.2) {
|
||||||
appearance.scaleFactor -= 0.2
|
appearance.scaleFactor -= 0.2
|
||||||
} else {
|
} else {
|
||||||
console.info(velocity, mouse.x)
|
console.info(velocity, mouse.x)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: controlsOverlay
|
id: controlsOverlay
|
||||||
|
@ -345,16 +344,15 @@ Window {
|
||||||
property bool controlsShowing: true
|
property bool controlsShowing: true
|
||||||
z: 2
|
z: 2
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: globalConnections
|
target: globalConnections
|
||||||
onHideUI: function() {
|
onHideUI: function () {
|
||||||
mouseAreaPlayer.cursorShape = Qt.BlankCursor
|
mouseAreaPlayer.cursorShape = Qt.BlankCursor
|
||||||
|
}
|
||||||
|
onShowUI: {
|
||||||
|
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onShowUI: {
|
|
||||||
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseAreaBar
|
id: mouseAreaBar
|
||||||
|
@ -384,32 +382,32 @@ Window {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
|
|
||||||
|
Timer {
|
||||||
Timer{
|
|
||||||
id: mouseTapTimer
|
id: mouseTapTimer
|
||||||
interval: 200
|
interval: 200
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (appearance.clickToPause) {
|
if (appearance.clickToPause) {
|
||||||
player.playerCommand(Enums.Commands.TogglePlayPause)
|
player.playerCommand(Enums.Commands.TogglePlayPause)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function doubleMouseClick(mouse) {
|
function doubleMouseClick(mouse) {
|
||||||
if (appearance.doubleTapToSeek) {
|
if (appearance.doubleTapToSeek) {
|
||||||
if (mouse.x > (mouseAreaPlayer.width / 2)) {
|
if (mouse.x > (mouseAreaPlayer.width / 2)) {
|
||||||
player.playerCommand(Enums.Commands.Seek, String(appearance.doubleTapToSeekBy))
|
player.playerCommand(Enums.Commands.Seek, String(
|
||||||
|
appearance.doubleTapToSeekBy))
|
||||||
} else {
|
} else {
|
||||||
player.playerCommand(Enums.Commands.Seek,"-" + String(appearance.doubleTapToSeekBy))
|
player.playerCommand(Enums.Commands.Seek, "-" + String(
|
||||||
|
appearance.doubleTapToSeekBy))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toggleFullscreen()
|
toggleFullscreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClicked: function (mouse) {
|
||||||
onClicked: function(mouse) {
|
if (mouseTapTimer.running) {
|
||||||
if(mouseTapTimer.running) {
|
|
||||||
doubleMouseClick(mouse)
|
doubleMouseClick(mouse)
|
||||||
mouseTapTimer.stop()
|
mouseTapTimer.stop()
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue