mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-26 17:30:32 -04:00
frontend: Demangle ScreenshotObj and OBSBasic
Co-Authored-By: Clayton Groeneveld <19962531+cg2121@users.noreply.github.com>
This commit is contained in:
committed by
Ryan Foster
co-authored by
Clayton Groeneveld
parent
ea7536c49c
commit
4044a1a142
@@ -353,11 +353,7 @@ void ScreenshotObj::onFinished()
|
||||
|
||||
if (outputWidth > 0 && outputHeight > 0) {
|
||||
if (outputToFile) {
|
||||
OBSBasic *main = OBSBasic::Get();
|
||||
main->ShowStatusBarMessage(
|
||||
QTStr("Basic.StatusBar.ScreenshotSavedTo").arg(QT_UTF8(path.c_str())));
|
||||
main->lastScreenshot = path;
|
||||
main->OnEvent(OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN);
|
||||
emit imageSaved(path);
|
||||
}
|
||||
|
||||
emit imageReady(image.copy());
|
||||
|
||||
@@ -34,7 +34,15 @@ public:
|
||||
|
||||
enum class Stage { Render, Download, Output, Finished };
|
||||
|
||||
Stage stage() { return stage_; }
|
||||
|
||||
void setSize(QSize size);
|
||||
void setSize(int width, int height);
|
||||
void setSaveToFile(bool save);
|
||||
|
||||
void processStage();
|
||||
|
||||
private:
|
||||
void renderScreenshot();
|
||||
void downloadData();
|
||||
void copyData();
|
||||
@@ -42,14 +50,6 @@ public:
|
||||
void muxFile();
|
||||
void onFinished();
|
||||
|
||||
Stage stage() { return stage_; }
|
||||
void setStage(Stage stage) { stage_ = stage; }
|
||||
|
||||
void setSize(QSize size);
|
||||
void setSize(int width, int height);
|
||||
void setSaveToFile(bool save);
|
||||
|
||||
private:
|
||||
Stage stage_ = Stage::Render;
|
||||
|
||||
gs_texrender_t *texrender = nullptr;
|
||||
@@ -69,6 +69,7 @@ private:
|
||||
bool outputToFile = true;
|
||||
|
||||
signals:
|
||||
void imageSaved(std::string path);
|
||||
void imageReady(QImage image);
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <settings/OBSBasicSettings.hpp>
|
||||
#include <utility/QuickTransition.hpp>
|
||||
#include <utility/SceneRenameDelegate.hpp>
|
||||
#include <utility/ScreenshotObj.hpp>
|
||||
#if defined(_WIN32) || defined(WHATSNEW_ENABLED)
|
||||
#include <utility/WhatsNewInfoThread.hpp>
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <util/util.hpp>
|
||||
|
||||
#include <QAccessible>
|
||||
#include <QPointer>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#include <deque>
|
||||
@@ -57,6 +58,7 @@ class OBSBasicTransform;
|
||||
class OBSLogViewer;
|
||||
class OBSMissingFiles;
|
||||
class OBSProjector;
|
||||
class ScreenshotObj;
|
||||
class VolumeControl;
|
||||
#ifdef YOUTUBE_ENABLED
|
||||
class YouTubeAppDock;
|
||||
@@ -215,7 +217,6 @@ class OBSBasic : public OBSMainWindow {
|
||||
friend class OBSYoutubeActions;
|
||||
friend struct BasicOutputHandler;
|
||||
friend struct OBSStudioAPI;
|
||||
friend class ScreenshotObj;
|
||||
|
||||
enum class MoveDir { Up, Down, Left, Right };
|
||||
|
||||
@@ -1336,7 +1337,7 @@ public:
|
||||
* -------------------------------------
|
||||
*/
|
||||
private:
|
||||
QPointer<QObject> screenshotData;
|
||||
QPointer<ScreenshotObj> screenshotData;
|
||||
std::string lastScreenshot;
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -30,6 +30,13 @@ void OBSBasic::Screenshot(OBSSource source)
|
||||
}
|
||||
|
||||
screenshotData = new ScreenshotObj(source);
|
||||
|
||||
connect(screenshotData, &ScreenshotObj::imageSaved, this, [this](std::string path) {
|
||||
ShowStatusBarMessage(QTStr("Basic.StatusBar.ScreenshotSavedTo").arg(QT_UTF8(path.c_str())));
|
||||
lastScreenshot = path;
|
||||
|
||||
OnEvent(OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN);
|
||||
});
|
||||
}
|
||||
|
||||
void OBSBasic::ScreenshotSelectedSource()
|
||||
|
||||
Reference in New Issue
Block a user