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 <QCheckBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QComboBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QDoubleSpinBox>
|
||||
@ -90,8 +91,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
addHotkeyItem("Color picker", "picker", [] { ColorPickerScene::showPicker(); });
|
||||
addHotkeyItem("Stop Recording", "recordingstop", [&] { controller->end(); });
|
||||
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;
|
||||
RecordingFormats *format = new RecordingFormats(RecordingFormats::GIF);
|
||||
RecordingFormats *format = new RecordingFormats(f);
|
||||
ctx->consumer = format->getConsumer();
|
||||
ctx->finalizer = format->getFinalizer();
|
||||
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->hideToTray->setChecked(settings::settings().value("hideOnClose", 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() {
|
||||
@ -205,3 +215,7 @@ void MainWindow::on_actionColor_Picker_triggered() {
|
||||
void MainWindow::on_captureCursor_clicked(bool 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_captureCursor_clicked(bool checked);
|
||||
|
||||
void on_formatBox_currentIndexChanged(int index);
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>410</height>
|
||||
<height>412</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -26,15 +26,10 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<widget class="QComboBox" name="formatBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Recording disabled</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
|
@ -37,7 +37,6 @@ RecordingFormats::RecordingFormats(RecordingFormats::Format f) {
|
||||
GifWriter writer;
|
||||
GifBegin(&writer, tmpDir.absoluteFilePath("resulting.gif").toLocal8Bit().constData(), startImg.width(),
|
||||
startImg.height(), d);
|
||||
int i = 0;
|
||||
for (QImage &a : frames) {
|
||||
QByteArray alpha8((char *)a.bits(), a.byteCount());
|
||||
GifWriteFrame(&writer, (uint8_t *)alpha8.data(), a.width(), a.height(), d);
|
||||
|
@ -1,8 +1,12 @@
|
||||
#include "settings.hpp"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QStandardPaths>
|
||||
|
||||
QMutex *lock = new QMutex;
|
||||
|
||||
QSettings &settings::settings() {
|
||||
QMutexLocker l(lock);
|
||||
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
|
||||
if (configDir.dirName() != "KShare") {
|
||||
configDir.mkdir("KShare");
|
||||
|
Loading…
Reference in New Issue
Block a user