KShare/screenshotter.cpp

37 lines
1.3 KiB
C++
Raw Normal View History

2017-04-23 15:05:48 +02:00
#include "screenshotter.hpp"
#include "cropeditor/cropeditor.hpp"
2017-04-25 22:36:33 +02:00
#include "mainwindow.hpp"
2017-04-23 15:05:48 +02:00
#include "screenshotutil.hpp"
#include "uploaders/uploadersingleton.hpp"
2017-04-25 22:36:33 +02:00
#include <QDoubleSpinBox>
#include <QTimer>
#include <platformbackend.hpp>
#include <settings.hpp>
2017-04-23 15:05:48 +02:00
2017-05-06 13:21:12 +02:00
void screenshotter::area() {
CropEditor *editor = new CropEditor(screenshotutil::fullscreen(settings::settings().value("captureCursor", true).toBool()));
QObject::connect(editor, &CropEditor::cropped, [&](QPixmap pixmap) { UploaderSingleton::inst().upload(pixmap); });
2017-04-23 15:05:48 +02:00
}
2017-05-06 13:21:12 +02:00
void screenshotter::fullscreen() {
UploaderSingleton::inst().upload(screenshotutil::fullscreen(settings::settings().value("captureCursor", true).toBool()));
2017-04-23 15:05:48 +02:00
}
2017-04-25 22:36:33 +02:00
2017-05-06 13:21:12 +02:00
void screenshotter::areaDelayed() {
QTimer::singleShot(settings::settings().value("delay", 0.5).toFloat() * 1000, &screenshotter::area);
2017-04-25 22:36:33 +02:00
}
2017-05-06 13:21:12 +02:00
void screenshotter::fullscreenDelayed() {
QTimer::singleShot(settings::settings().value("delay", 0.5).toFloat() * 1000, &screenshotter::fullscreen);
2017-04-25 22:36:33 +02:00
}
void screenshotter::activeDelayed() {
QTimer::singleShot(settings::settings().value("delay", 0.5).toFloat() * 1000, &screenshotter::active);
}
void screenshotter::active() {
#ifdef PLATFORM_CAPABILITY_ACTIVEWINDOW
UploaderSingleton::inst().upload(screenshotutil::window(PlatformBackend::inst().getActiveWID()));
#endif
}