[CMake+Utils] Made x11 optional and also improved .desktop file.
This commit is contained in:
parent
1f17f32b07
commit
bf0bee446a
|
@ -18,8 +18,13 @@ qtquick_compiler_add_resources(qml_QRC src/qml/qml.qrc)
|
|||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(MPV REQUIRED mpv)
|
||||
pkg_check_modules(X11 REQUIRED x11)
|
||||
pkg_check_modules(Xext REQUIRED xext)
|
||||
pkg_check_modules(X11 x11)
|
||||
pkg_check_modules(Xext xext)
|
||||
|
||||
if(X11_FOUND AND Xext_FOUND)
|
||||
add_definitions(-DENABLE_X11)
|
||||
endif(X11_FOUND AND Xext_FOUND)
|
||||
|
||||
|
||||
set(SOURCES
|
||||
src/main.cpp
|
||||
|
|
|
@ -5,4 +5,6 @@ Comment=KittehPlayer
|
|||
Icon=KittehPlayer
|
||||
Exec=KittehPlayer %U
|
||||
Terminal=false
|
||||
Categories=AudioVideo;Player;
|
||||
Categories=AudioVideo;Audio;Video;Player;TV;
|
||||
MimeType=application/ogg;application/x-ogg;application/mxf;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/vnd.dolby.heaac.1;audio/vnd.dolby.heaac.2;audio/aiff;audio/x-aiff;audio/m4a;audio/x-m4a;application/x-extension-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/mpeg2;audio/mpeg3;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/musepack;audio/x-musepack;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg2;video/x-mpeg3;video/mp4v-es;video/x-m4v;video/mp4;application/x-extension-mp4;video/divx;video/vnd.divx;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;audio/x-ms-asf;application/vnd.ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/avi;video/x-flic;video/fli;video/x-flc;video/flv;video/x-flv;video/x-theora;video/x-theora+ogg;video/x-matroska;video/mkv;audio/x-matroska;application/x-matroska;video/webm;audio/webm;audio/vorbis;audio/x-vorbis;audio/x-vorbis+ogg;video/x-ogm;video/x-ogm+ogg;application/x-ogm;application/x-ogm-audio;application/x-ogm-video;application/x-shorten;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;audio/eac3;audio/amr-wb;video/mp2t;audio/flac;audio/mp4;application/x-mpegurl;video/vnd.mpegurl;application/vnd.apple.mpegurl;audio/x-pn-au;video/3gp;video/3gpp;video/3gpp2;audio/3gpp;audio/3gpp2;video/dv;audio/dv;audio/opus;audio/vnd.dts;audio/vnd.dts.hd;audio/x-adpcm;application/x-cue;audio/m3u;
|
||||
X-KDE-Protocols=ftp,http,https,mms,rtmp,rtsp,sftp,smb,kittehplayer
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
TARGET = KittehPlayer
|
||||
|
||||
TEMPLATE = app
|
||||
QT += qml quickcontrols2 widgets x11extras
|
||||
QT += qml quickcontrols2 widgets
|
||||
|
||||
SOURCES += src/main.cpp src/MpvPlayerBackend.cpp src/DirectMpvPlayerBackend.cpp src/utils.cpp
|
||||
|
||||
|
@ -16,7 +16,6 @@ unix {
|
|||
isEmpty {
|
||||
PREFIX = /usr
|
||||
}
|
||||
PKGCONFIG += x11 xext
|
||||
|
||||
target.path = $$PREFIX/bin
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <QtCore>
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef ENABLE_X11
|
||||
#include <QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
@ -17,6 +18,7 @@
|
|||
#include <X11/extensions/dpms.h>
|
||||
#include <X11/keysym.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace Utils {
|
||||
QString
|
||||
|
@ -70,6 +72,7 @@ SetDPMS(bool on)
|
|||
if (getPlatformName() != "xcb") {
|
||||
return;
|
||||
}
|
||||
#ifdef ENABLE_X11
|
||||
Display* dpy = QX11Info::display();
|
||||
if (on) {
|
||||
DPMSEnable(dpy);
|
||||
|
@ -78,17 +81,21 @@ SetDPMS(bool on)
|
|||
DPMSDisable(dpy);
|
||||
qDebug() << "Disabled DPMS.";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void
|
||||
ResetScreensaver()
|
||||
{
|
||||
#ifdef ENABLE_X11
|
||||
Display* display = QX11Info::display();
|
||||
XResetScreenSaver(display);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AlwaysOnTop(WId wid, bool on)
|
||||
{
|
||||
#ifdef ENABLE_X11
|
||||
Display* display = QX11Info::display();
|
||||
XEvent event;
|
||||
event.xclient.type = ClientMessage;
|
||||
|
@ -110,6 +117,7 @@ AlwaysOnTop(WId wid, bool on)
|
|||
False,
|
||||
SubstructureRedirectMask | SubstructureNotifyMask,
|
||||
&event);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue