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
|
||||
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", "");
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
@ -117,7 +116,8 @@ Item {
|
|||
|
||||
VideoProgress {
|
||||
id: progressBar
|
||||
visible: controlsBarItem.controlsShowing && (appearance.themeName == "RoosterTeeth" ? false : true)
|
||||
visible: controlsBarItem.controlsShowing
|
||||
&& (appearance.themeName == "RoosterTeeth" ? false : true)
|
||||
anchors.bottom: controlsBackground.top
|
||||
anchors.left: controlsBackground.left
|
||||
anchors.right: controlsBackground.right
|
||||
|
|
|
@ -98,7 +98,6 @@ Slider {
|
|||
onEntered: timestampBox.visible = true
|
||||
onExited: timestampBox.visible = false
|
||||
|
||||
|
||||
onPositionChanged: {
|
||||
var a = (progressBar.to / progressBar.availableWidth)
|
||||
* (mouseAreaProgressBar.mapToItem(
|
||||
|
@ -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
|
||||
|
|
|
@ -26,8 +26,8 @@ Window {
|
|||
|
||||
Item {
|
||||
id: globalConnections
|
||||
signal showUI()
|
||||
signal hideUI()
|
||||
signal showUI
|
||||
signal hideUI
|
||||
}
|
||||
|
||||
function getAppearanceValueForTheme(themeName, name) {
|
||||
|
@ -321,14 +321,14 @@ Window {
|
|||
velocity = 0
|
||||
}
|
||||
onPositionChanged: {
|
||||
var currVel = (mouse.x-xPrev)
|
||||
velocity = (velocity + currVel)/2.0
|
||||
var currVel = (mouse.x - xPrev)
|
||||
velocity = (velocity + currVel) / 2.0
|
||||
xPrev = mouse.x
|
||||
}
|
||||
onReleased: {
|
||||
if ( velocity > 2 && mouse.x > parent.width*0.2 ) {
|
||||
if (velocity > 2 && mouse.x > parent.width * 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
|
||||
} else {
|
||||
console.info(velocity, mouse.x)
|
||||
|
@ -336,7 +336,6 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
id: controlsOverlay
|
||||
anchors.centerIn: player
|
||||
|
@ -347,7 +346,7 @@ Window {
|
|||
|
||||
Connections {
|
||||
target: globalConnections
|
||||
onHideUI: function() {
|
||||
onHideUI: function () {
|
||||
mouseAreaPlayer.cursorShape = Qt.BlankCursor
|
||||
}
|
||||
onShowUI: {
|
||||
|
@ -355,7 +354,6 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
MouseArea {
|
||||
id: mouseAreaBar
|
||||
width: parent.width
|
||||
|
@ -384,8 +382,7 @@ Window {
|
|||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
|
||||
|
||||
Timer{
|
||||
Timer {
|
||||
id: mouseTapTimer
|
||||
interval: 200
|
||||
onTriggered: {
|
||||
|
@ -398,18 +395,19 @@ Window {
|
|||
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 {
|
||||
|
|
Loading…
Reference in a new issue