[Utils] Moved utils to their own namespace.
This commit is contained in:
parent
e0107ac4a7
commit
75c7225dca
|
@ -169,7 +169,7 @@ MpvPlayerBackend::MpvPlayerBackend(QQuickItem* parent)
|
||||||
MpvPlayerBackend::~MpvPlayerBackend()
|
MpvPlayerBackend::~MpvPlayerBackend()
|
||||||
{
|
{
|
||||||
printf("Shutting down...\n");
|
printf("Shutting down...\n");
|
||||||
SetDPMS(true);
|
Utils::SetDPMS(true);
|
||||||
mpv_render_context_free(mpv_gl);
|
mpv_render_context_free(mpv_gl);
|
||||||
mpv_terminate_destroy(mpv);
|
mpv_terminate_destroy(mpv);
|
||||||
printf("MPV terminated.\n");
|
printf("MPV terminated.\n");
|
||||||
|
@ -443,7 +443,7 @@ void
|
||||||
MpvPlayerBackend::toggleOnTop()
|
MpvPlayerBackend::toggleOnTop()
|
||||||
{
|
{
|
||||||
onTop = !onTop;
|
onTop = !onTop;
|
||||||
AlwaysOnTop(window()->winId(), onTop);
|
Utils::AlwaysOnTop(window()->winId(), onTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -471,7 +471,7 @@ MpvPlayerBackend::updateDurationString()
|
||||||
void
|
void
|
||||||
MpvPlayerBackend::updateAppImage()
|
MpvPlayerBackend::updateAppImage()
|
||||||
{
|
{
|
||||||
updateAppImageLinux();
|
Utils::updateAppImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -93,11 +93,11 @@ main(int argc, char* argv[])
|
||||||
app.setApplicationName("KittehPlayer");
|
app.setApplicationName("KittehPlayer");
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!qstrcmp(argv[i], "--update")) {
|
if (!qstrcmp(argv[i], "--update")) {
|
||||||
updateAppImageLinux();
|
Utils::updateAppImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDPMS(false);
|
Utils::SetDPMS(false);
|
||||||
|
|
||||||
QString newpath =
|
QString newpath =
|
||||||
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
||||||
|
|
|
@ -7,6 +7,16 @@
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <QX11Info>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#include <X11/extensions/dpms.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
QString
|
QString
|
||||||
getPlatformName()
|
getPlatformName()
|
||||||
{
|
{
|
||||||
|
@ -15,7 +25,7 @@ getPlatformName()
|
||||||
return qapp->platformName();
|
return qapp->platformName();
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
updateAppImageLinux()
|
updateAppImage()
|
||||||
{
|
{
|
||||||
QString program =
|
QString program =
|
||||||
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
||||||
|
@ -30,13 +40,6 @@ updateAppImageLinux()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <QX11Info>
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
#include <X11/extensions/Xrandr.h>
|
|
||||||
#include <X11/extensions/dpms.h>
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SetDPMS(bool on)
|
SetDPMS(bool on)
|
||||||
{
|
{
|
||||||
|
@ -96,3 +99,4 @@ SetDPMS(bool on)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
|
@ -3,11 +3,12 @@
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
void
|
void
|
||||||
SetDPMS(bool on);
|
SetDPMS(bool on);
|
||||||
void
|
void
|
||||||
AlwaysOnTop(WId wid, bool on);
|
AlwaysOnTop(WId wid, bool on);
|
||||||
void
|
void
|
||||||
updateAppImageLinux();
|
updateAppImage();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue