diff --git a/src/MpvPlayerBackend.cpp b/src/MpvPlayerBackend.cpp index d827337..f88b409 100644 --- a/src/MpvPlayerBackend.cpp +++ b/src/MpvPlayerBackend.cpp @@ -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 diff --git a/src/main.cpp b/src/main.cpp index ab70def..4e4f2a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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", "") + diff --git a/src/utils.cpp b/src/utils.cpp index 22bf4d3..98675e2 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -7,6 +7,16 @@ #include #include +#ifdef __linux__ +#include +#include +#include +#include +#include +#include +#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 -#include -#include -#include -#include -#include - void SetDPMS(bool on) { @@ -95,4 +98,5 @@ SetDPMS(bool on) qDebug() << "Can't set DPMS for platform: " << getPlatformName(); } -#endif \ No newline at end of file +#endif +} \ No newline at end of file diff --git a/src/utils.hpp b/src/utils.hpp index 136d720..158d123 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -3,11 +3,12 @@ #include #include +namespace Utils { void SetDPMS(bool on); void AlwaysOnTop(WId wid, bool on); void -updateAppImageLinux(); - +updateAppImage(); +} #endif