feature/platformbackends (aka cursors) done for all but mac
This commit is contained in:
parent
5b6e9c2e36
commit
df61acdbb3
@ -84,6 +84,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
addHotkeyItem("Area image", "area", new std::function<void()>([] { screenshotter::area(); }));
|
||||
|
||||
ui->quickMode->setChecked(settings::settings().value("quickMode", false).toBool());
|
||||
ui->captureCursor->setChecked(settings::settings().value("captureCursor", true).toBool());
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
@ -172,3 +173,7 @@ void MainWindow::on_settingsButton_clicked() {
|
||||
void MainWindow::on_quickMode_clicked(bool checked) {
|
||||
settings::settings().setValue("quickMode", checked);
|
||||
}
|
||||
|
||||
void MainWindow::on_captureCursor_clicked(bool checked) {
|
||||
settings::settings().setValue("captureCursor", checked);
|
||||
}
|
||||
|
@ -25,14 +25,11 @@ class MainWindow : public QMainWindow {
|
||||
void on_actionArea_triggered();
|
||||
void on_uploaderList_clicked(const QModelIndex &);
|
||||
void on_nameScheme_textEdited(const QString &arg1);
|
||||
|
||||
void on_delay_valueChanged(double arg1);
|
||||
|
||||
void on_hotkeys_doubleClicked(const QModelIndex &index);
|
||||
|
||||
void on_settingsButton_clicked();
|
||||
|
||||
void on_quickMode_clicked(bool checked);
|
||||
void on_captureCursor_clicked(bool checked);
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>337</height>
|
||||
<width>483</width>
|
||||
<height>368</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -25,7 +25,17 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="nameScheme">
|
||||
<property name="toolTip">
|
||||
<string>http://doc.qt.io/qt-5/qdatetime.html#toString</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Screenshot %(yyyy-MM-dd HH:mm:ss)date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string><a href="https://github.com/ArsenArsen/KShare">Source code available free for everyone. Forever.</a>
|
||||
@ -37,6 +47,13 @@
|
||||
<item row="1" column="1" rowspan="5">
|
||||
<widget class="QListWidget" name="hotkeys"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Delay before taking a screenshot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QDoubleSpinBox" name="delay">
|
||||
<property name="toolTip">
|
||||
@ -50,24 +67,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="settingsButton">
|
||||
<property name="text">
|
||||
<string>File name scheme:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Uploader selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Delay before taking a screenshot</string>
|
||||
<string>Open settings directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -78,19 +81,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="uploaderList"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="nameScheme">
|
||||
<property name="toolTip">
|
||||
<string>http://doc.qt.io/qt-5/qdatetime.html#toString</string>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Screenshot %(yyyy-MM-dd HH:mm:ss)date</string>
|
||||
<string>File name scheme:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="uploaderList"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="quickMode">
|
||||
<property name="text">
|
||||
@ -98,10 +98,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="settingsButton">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Open settings directory</string>
|
||||
<string>Uploader selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="captureCursor">
|
||||
<property name="text">
|
||||
<string>Capture cursor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -112,7 +119,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<width>483</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -5,14 +5,15 @@
|
||||
#include "uploaders/uploadersingleton.hpp"
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QTimer>
|
||||
#include <settings.hpp>
|
||||
|
||||
void screenshotter::area() {
|
||||
CropEditor *editor = new CropEditor(screenshotutil::fullscreen());
|
||||
CropEditor *editor = new CropEditor(screenshotutil::fullscreen(settings::settings().value("captureCursor", true).toBool()));
|
||||
QObject::connect(editor, &CropEditor::cropped, [&](QPixmap *pixmap) { UploaderSingleton::inst().upload(pixmap); });
|
||||
}
|
||||
|
||||
void screenshotter::fullscreen() {
|
||||
UploaderSingleton::inst().upload(screenshotutil::fullscreen());
|
||||
UploaderSingleton::inst().upload(screenshotutil::fullscreen(settings::settings().value("captureCursor", true).toBool()));
|
||||
}
|
||||
|
||||
void screenshotter::areaDelayed() {
|
||||
|
@ -7,7 +7,8 @@
|
||||
#include <QScreen>
|
||||
#include <platformbackend.hpp>
|
||||
|
||||
QPixmap *screenshotutil::fullscreen() {
|
||||
QPixmap *screenshotutil::fullscreen(bool cursor) {
|
||||
if (cursor) {
|
||||
QPixmap *noCursor = window(0);
|
||||
QScopedPointer<QPixmap> p(noCursor);
|
||||
QPixmap *withCursor = new QPixmap(*noCursor);
|
||||
@ -16,6 +17,8 @@ QPixmap *screenshotutil::fullscreen() {
|
||||
painter.drawPixmap(QCursor::pos() - std::get<0>(cursorData), std::get<1>(cursorData));
|
||||
painter.end();
|
||||
return withCursor;
|
||||
}
|
||||
return window(0);
|
||||
}
|
||||
|
||||
QPixmap *screenshotutil::window(long wid) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QPixmap>
|
||||
|
||||
namespace screenshotutil {
|
||||
QPixmap *fullscreen();
|
||||
QPixmap *fullscreen(bool cursor = true);
|
||||
QPixmap *window(long wid);
|
||||
void toClipboard(QString value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user