more documentation and added edit text button to stringfield
This commit is contained in:
@@ -372,10 +372,12 @@ void ExportDialog::render_thread_finished() {
|
||||
void ExportDialog::prep_ui_for_render(bool r) {
|
||||
export_button->setEnabled(!r);
|
||||
cancel_button->setEnabled(!r);
|
||||
videoGroupbox->setEnabled(!r);
|
||||
audioGroupbox->setEnabled(!r);
|
||||
renderCancel->setEnabled(r);
|
||||
}
|
||||
|
||||
void ExportDialog::export_action() {
|
||||
void ExportDialog::StartExport() {
|
||||
if (widthSpinbox->value()%2 == 1 || heightSpinbox->value()%2 == 1) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
@@ -533,6 +535,7 @@ void ExportDialog::export_action() {
|
||||
}
|
||||
}
|
||||
|
||||
// Set up export parameters to send to the ExportThread
|
||||
ExportParams params;
|
||||
params.filename = filename;
|
||||
params.video_enabled = videoGroupbox->isChecked();
|
||||
@@ -558,12 +561,15 @@ void ExportDialog::export_action() {
|
||||
params.end_frame = qMin(olive::ActiveSequence->workarea_out, params.end_frame);
|
||||
}
|
||||
|
||||
// Create export thread
|
||||
et = new ExportThread(params, vcodec_params, this);
|
||||
|
||||
// Connect export thread signals/slots
|
||||
connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished()));
|
||||
connect(et, SIGNAL(ProgressChanged(int, qint64)), this, SLOT(update_progress_bar(int, qint64)));
|
||||
connect(renderCancel, SIGNAL(clicked(bool)), et, SLOT(Interrupt()));
|
||||
|
||||
// Close all currently open clips
|
||||
close_active_clips(olive::ActiveSequence.get());
|
||||
|
||||
olive::Global->set_rendering_state(true);
|
||||
@@ -776,7 +782,7 @@ void ExportDialog::setup_ui() {
|
||||
|
||||
export_button = new QPushButton(this);
|
||||
export_button->setText("Export");
|
||||
connect(export_button, SIGNAL(clicked(bool)), this, SLOT(export_action()));
|
||||
connect(export_button, SIGNAL(clicked(bool)), this, SLOT(StartExport()));
|
||||
|
||||
buttonLayout->addWidget(export_button);
|
||||
|
||||
|
||||
+16
-1
@@ -51,8 +51,23 @@ public:
|
||||
explicit ExportDialog(QWidget *parent);
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Slot for when the user changes the format
|
||||
*
|
||||
* Used to populate the available codecs list for this format.
|
||||
*
|
||||
* @param index
|
||||
*
|
||||
* Current format index (corresponding to enum ExportFormats)
|
||||
*/
|
||||
void format_changed(int index);
|
||||
void export_action();
|
||||
|
||||
/**
|
||||
* @brief Slot for when the user clicks the Export button
|
||||
*
|
||||
* Asks the user for the file to save to.
|
||||
*/
|
||||
void StartExport();
|
||||
void update_progress_bar(int value, qint64 remaining_ms);
|
||||
void render_thread_finished();
|
||||
void vcodec_changed(int index);
|
||||
|
||||
@@ -31,9 +31,9 @@ QWidget *StringField::CreateWidget(QWidget *existing)
|
||||
text_edit->setUndoRedoEnabled(true);
|
||||
|
||||
// the "2" is because the height needs one extra pixel of padding on the top and the bottom
|
||||
text_edit->setFixedHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::CurrentConfig.effect_textbox_lines
|
||||
+ text_edit->document()->documentMargin()
|
||||
+ text_edit->document()->documentMargin() + 2));
|
||||
text_edit->setTextHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::CurrentConfig.effect_textbox_lines
|
||||
+ text_edit->document()->documentMargin()
|
||||
+ text_edit->document()->documentMargin() + 2));
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ void process_effect(Clip* c,
|
||||
}
|
||||
}
|
||||
|
||||
GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// qint64 time = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
GLuint final_fbo = params.main_buffer;
|
||||
@@ -666,7 +666,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void compose_audio(Viewer* viewer, Sequence* seq, int playback_speed, bool wait_for_mutexes) {
|
||||
void olive::rendering::compose_audio(Viewer* viewer, Sequence* seq, int playback_speed, bool wait_for_mutexes) {
|
||||
ComposeSequenceParams params;
|
||||
params.viewer = viewer;
|
||||
params.ctx = nullptr;
|
||||
|
||||
+54
-8
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "texteditex.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dialogs/texteditdialog.h"
|
||||
@@ -27,13 +28,58 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
TextEditEx::TextEditEx(QWidget *parent, bool enable_rich_text) :
|
||||
QTextEdit(parent),
|
||||
QWidget(parent),
|
||||
enable_rich_text_(enable_rich_text)
|
||||
{
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(text_edit_menu()));
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
connect(this, SIGNAL(textChanged()), this, SLOT(queue_text_modified()));
|
||||
text_editor_ = new QTextEdit();
|
||||
connect(text_editor_, SIGNAL(textChanged()), this, SLOT(queue_text_modified()));
|
||||
layout->addWidget(text_editor_);
|
||||
|
||||
QPushButton* edit_button = new QPushButton(tr("Edit Text"));
|
||||
layout->addWidget(edit_button);
|
||||
connect(edit_button, SIGNAL(clicked(bool)), this, SLOT(open_text_edit()));
|
||||
|
||||
/*
|
||||
text_editor_->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(text_editor_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(text_edit_menu()));
|
||||
*/
|
||||
}
|
||||
|
||||
void TextEditEx::setUndoRedoEnabled(bool e)
|
||||
{
|
||||
text_editor_->setUndoRedoEnabled(e);
|
||||
}
|
||||
|
||||
QTextDocument *TextEditEx::document()
|
||||
{
|
||||
return text_editor_->document();
|
||||
}
|
||||
|
||||
QTextCursor TextEditEx::textCursor()
|
||||
{
|
||||
return text_editor_->textCursor();
|
||||
}
|
||||
|
||||
void TextEditEx::setTextCursor(const QTextCursor &cursor)
|
||||
{
|
||||
text_editor_->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
void TextEditEx::setTextHeight(int h)
|
||||
{
|
||||
text_editor_->setFixedHeight(h);
|
||||
}
|
||||
|
||||
void TextEditEx::setHtml(const QString &text)
|
||||
{
|
||||
text_editor_->setHtml(text);
|
||||
}
|
||||
|
||||
void TextEditEx::setPlainText(const QString &text)
|
||||
{
|
||||
text_editor_->setPlainText(text);
|
||||
}
|
||||
|
||||
void TextEditEx::text_edit_menu() {
|
||||
@@ -45,21 +91,21 @@ void TextEditEx::text_edit_menu() {
|
||||
}
|
||||
|
||||
void TextEditEx::open_text_edit() {
|
||||
const QString& current_text = (enable_rich_text_) ? toHtml() : toPlainText();
|
||||
const QString& current_text = (enable_rich_text_) ? text_editor_->toHtml() : text_editor_->toPlainText();
|
||||
|
||||
TextEditDialog ted(olive::MainWindow, current_text, enable_rich_text_);
|
||||
ted.exec();
|
||||
QString result = ted.get_string();
|
||||
if (!result.isEmpty()) {
|
||||
if (enable_rich_text_) {
|
||||
setHtml(result);
|
||||
text_editor_->setHtml(result);
|
||||
} else {
|
||||
setPlainText(result);
|
||||
text_editor_->setPlainText(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditEx::queue_text_modified()
|
||||
{
|
||||
emit textModified(enable_rich_text_ ? toHtml() : toPlainText());
|
||||
emit textModified(enable_rich_text_ ? text_editor_->toHtml() : text_editor_->toPlainText());
|
||||
}
|
||||
|
||||
+13
-1
@@ -22,11 +22,21 @@
|
||||
#define TEXTEDITEX_H
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
class TextEditEx : public QTextEdit {
|
||||
class TextEditEx : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextEditEx(QWidget* parent = nullptr, bool enable_rich_text = true);
|
||||
|
||||
void setUndoRedoEnabled(bool e);
|
||||
QTextDocument* document();
|
||||
QTextCursor textCursor();
|
||||
void setTextCursor(const QTextCursor &cursor);
|
||||
void setTextHeight(int h);
|
||||
public slots:
|
||||
void setHtml(const QString &text);
|
||||
void setPlainText(const QString &text);
|
||||
signals:
|
||||
void textModified(const QString& s);
|
||||
private slots:
|
||||
@@ -34,6 +44,8 @@ private slots:
|
||||
void open_text_edit();
|
||||
void queue_text_modified();
|
||||
private:
|
||||
QTextEdit* text_editor_;
|
||||
|
||||
bool enable_rich_text_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user