OBSBasic_Screenshots.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /******************************************************************************
  2. Copyright (C) 2023 by Lain Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #include "OBSBasic.hpp"
  15. #include <utility/ScreenshotObj.hpp>
  16. #include <qt-wrappers.hpp>
  17. void OBSBasic::Screenshot(OBSSource source)
  18. {
  19. if (!!screenshotData) {
  20. blog(LOG_WARNING, "Cannot take new screenshot, "
  21. "screenshot currently in progress");
  22. return;
  23. }
  24. screenshotData = new ScreenshotObj(source);
  25. }
  26. void OBSBasic::ScreenshotSelectedSource()
  27. {
  28. OBSSceneItem item = GetCurrentSceneItem();
  29. if (item) {
  30. Screenshot(obs_sceneitem_get_source(item));
  31. } else {
  32. blog(LOG_INFO, "Could not take a source screenshot: "
  33. "no source selected");
  34. }
  35. }
  36. void OBSBasic::ScreenshotProgram()
  37. {
  38. Screenshot(GetProgramSource());
  39. }
  40. void OBSBasic::ScreenshotScene()
  41. {
  42. Screenshot(GetCurrentSceneSource());
  43. }