moved sleep prevention code for further abstraction, implemented macOS

This commit is contained in:
itsmattkc
2021-11-11 16:14:37 -08:00
parent 65446fd70b
commit ab8d9e14e8
5 changed files with 53 additions and 10 deletions
+3 -10
View File
@@ -30,10 +30,6 @@
#include <QtMath>
#include <QVBoxLayout>
#ifdef _WIN32
#include "winbase.h"
#endif
#include "audio/audiomanager.h"
#include "common/clamp.h"
#include "common/power.h"
@@ -44,6 +40,7 @@
#include "node/project/project.h"
#include "render/rendermanager.h"
#include "task/taskmanager.h"
#include "viewerpreventsleep.h"
#include "widget/menu/menu.h"
#include "window/mainwindow/mainwindow.h"
@@ -707,9 +704,7 @@ void ViewerWidget::PlayInternal(int speed, bool in_to_out_only)
}
}
// Force screen to stay awake
#ifdef _WIN32
SetThreadExecutionState(ES_DISPLAY_REQUIRED | ES_CONTINUOUS);
#endif
PreventSleep(true);
}
void ViewerWidget::PauseInternal()
@@ -752,9 +747,7 @@ void ViewerWidget::PauseInternal()
prequeuing_audio_ = 0;
// Reset screen timeout timer
#ifdef _WIN32
SetThreadExecutionState(ES_CONTINUOUS);
#endif
PreventSleep(false);
}
void ViewerWidget::PushScrubbedAudio()