[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()
|
||||
{
|
||||
printf("Shutting down...\n");
|
||||
SetDPMS(true);
|
||||
Utils::SetDPMS(true);
|
||||
mpv_render_context_free(mpv_gl);
|
||||
mpv_terminate_destroy(mpv);
|
||||
printf("MPV terminated.\n");
|
||||
|
@ -443,7 +443,7 @@ void
|
|||
MpvPlayerBackend::toggleOnTop()
|
||||
{
|
||||
onTop = !onTop;
|
||||
AlwaysOnTop(window()->winId(), onTop);
|
||||
Utils::AlwaysOnTop(window()->winId(), onTop);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -471,7 +471,7 @@ MpvPlayerBackend::updateDurationString()
|
|||
void
|
||||
MpvPlayerBackend::updateAppImage()
|
||||
{
|
||||
updateAppImageLinux();
|
||||
Utils::updateAppImage();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -93,11 +93,11 @@ main(int argc, char* argv[])
|
|||
app.setApplicationName("KittehPlayer");
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!qstrcmp(argv[i], "--update")) {
|
||||
updateAppImageLinux();
|
||||
Utils::updateAppImage();
|
||||
}
|
||||
}
|
||||
|
||||
SetDPMS(false);
|
||||
Utils::SetDPMS(false);
|
||||
|
||||
QString newpath =
|
||||
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
||||
|
|
|
@ -7,6 +7,16 @@
|
|||
#include <QQmlApplicationEngine>
|
||||
#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
|
||||
getPlatformName()
|
||||
{
|
||||
|
@ -15,7 +25,7 @@ getPlatformName()
|
|||
return qapp->platformName();
|
||||
}
|
||||
void
|
||||
updateAppImageLinux()
|
||||
updateAppImage()
|
||||
{
|
||||
QString program =
|
||||
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
||||
|
@ -30,13 +40,6 @@ updateAppImageLinux()
|
|||
}
|
||||
|
||||
#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
|
||||
SetDPMS(bool on)
|
||||
{
|
||||
|
@ -95,4 +98,5 @@ SetDPMS(bool on)
|
|||
qDebug() << "Can't set DPMS for platform: " << getPlatformName();
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -3,11 +3,12 @@
|
|||
#include <QWindow>
|
||||
#include <stdbool.h>
|
||||
|
||||
namespace Utils {
|
||||
void
|
||||
SetDPMS(bool on);
|
||||
void
|
||||
AlwaysOnTop(WId wid, bool on);
|
||||
void
|
||||
updateAppImageLinux();
|
||||
|
||||
updateAppImage();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue