Finalize recording.
Yet to fix GIFs and implement WebP/WebM/MP4 I wouldn't mind help
This commit is contained in:
parent
c523af9927
commit
1d059cc08a
@ -6,6 +6,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QComboBox>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
@ -90,8 +91,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
addHotkeyItem("Color picker", "picker", [] { ColorPickerScene::showPicker(); });
|
addHotkeyItem("Color picker", "picker", [] { ColorPickerScene::showPicker(); });
|
||||||
addHotkeyItem("Stop Recording", "recordingstop", [&] { controller->end(); });
|
addHotkeyItem("Stop Recording", "recordingstop", [&] { controller->end(); });
|
||||||
addHotkeyItem("Start Recording", "recordingstart", [&] {
|
addHotkeyItem("Start Recording", "recordingstart", [&] {
|
||||||
|
auto f = static_cast<RecordingFormats::Format>(
|
||||||
|
settings::settings().value("recording/format", (int)RecordingFormats::None).toInt());
|
||||||
|
if (f == RecordingFormats::None) return;
|
||||||
RecordingContext *ctx = new RecordingContext;
|
RecordingContext *ctx = new RecordingContext;
|
||||||
RecordingFormats *format = new RecordingFormats(RecordingFormats::GIF);
|
RecordingFormats *format = new RecordingFormats(f);
|
||||||
ctx->consumer = format->getConsumer();
|
ctx->consumer = format->getConsumer();
|
||||||
ctx->finalizer = format->getFinalizer();
|
ctx->finalizer = format->getFinalizer();
|
||||||
ctx->validator = format->getValidator();
|
ctx->validator = format->getValidator();
|
||||||
@ -102,6 +106,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
ui->quickMode->setChecked(settings::settings().value("quickMode", false).toBool());
|
ui->quickMode->setChecked(settings::settings().value("quickMode", false).toBool());
|
||||||
ui->hideToTray->setChecked(settings::settings().value("hideOnClose", true).toBool());
|
ui->hideToTray->setChecked(settings::settings().value("hideOnClose", true).toBool());
|
||||||
ui->captureCursor->setChecked(settings::settings().value("captureCursor", true).toBool());
|
ui->captureCursor->setChecked(settings::settings().value("captureCursor", true).toBool());
|
||||||
|
|
||||||
|
for (int i = 0; i < RecordingFormats::None; i++) {
|
||||||
|
ui->formatBox->addItem(RecordingFormats::getExt(static_cast<RecordingFormats::Format>(i)));
|
||||||
|
}
|
||||||
|
ui->formatBox->addItem("None");
|
||||||
|
ui->formatBox->setCurrentIndex(settings::settings().value("recording/format", (int)RecordingFormats::None).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
@ -205,3 +215,7 @@ void MainWindow::on_actionColor_Picker_triggered() {
|
|||||||
void MainWindow::on_captureCursor_clicked(bool checked) {
|
void MainWindow::on_captureCursor_clicked(bool checked) {
|
||||||
settings::settings().setValue("captureCursor", checked);
|
settings::settings().setValue("captureCursor", checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_formatBox_currentIndexChanged(int index) {
|
||||||
|
settings::settings().setValue("recording/format", index);
|
||||||
|
}
|
||||||
|
@ -34,6 +34,8 @@ private slots:
|
|||||||
void on_actionColor_Picker_triggered();
|
void on_actionColor_Picker_triggered();
|
||||||
void on_captureCursor_clicked(bool checked);
|
void on_captureCursor_clicked(bool checked);
|
||||||
|
|
||||||
|
void on_formatBox_currentIndexChanged(int index);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = 0);
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>512</width>
|
<width>512</width>
|
||||||
<height>410</height>
|
<height>412</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -26,15 +26,10 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="9" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="QComboBox" name="comboBox">
|
<widget class="QComboBox" name="formatBox">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Recording disabled</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
|
@ -37,7 +37,6 @@ RecordingFormats::RecordingFormats(RecordingFormats::Format f) {
|
|||||||
GifWriter writer;
|
GifWriter writer;
|
||||||
GifBegin(&writer, tmpDir.absoluteFilePath("resulting.gif").toLocal8Bit().constData(), startImg.width(),
|
GifBegin(&writer, tmpDir.absoluteFilePath("resulting.gif").toLocal8Bit().constData(), startImg.width(),
|
||||||
startImg.height(), d);
|
startImg.height(), d);
|
||||||
int i = 0;
|
|
||||||
for (QImage &a : frames) {
|
for (QImage &a : frames) {
|
||||||
QByteArray alpha8((char *)a.bits(), a.byteCount());
|
QByteArray alpha8((char *)a.bits(), a.byteCount());
|
||||||
GifWriteFrame(&writer, (uint8_t *)alpha8.data(), a.width(), a.height(), d);
|
GifWriteFrame(&writer, (uint8_t *)alpha8.data(), a.width(), a.height(), d);
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
|
||||||
|
#include <QMutex>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
QMutex *lock = new QMutex;
|
||||||
|
|
||||||
QSettings &settings::settings() {
|
QSettings &settings::settings() {
|
||||||
|
QMutexLocker l(lock);
|
||||||
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
|
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
|
||||||
if (configDir.dirName() != "KShare") {
|
if (configDir.dirName() != "KShare") {
|
||||||
configDir.mkdir("KShare");
|
configDir.mkdir("KShare");
|
||||||
|
Loading…
Reference in New Issue
Block a user