merged fxrestructure
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "oliveglobal.h"
|
||||
#include "global/global.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
|
||||
+87
-87
@@ -25,123 +25,123 @@
|
||||
#include <QMenuBar>
|
||||
#include <QLabel>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
ActionSearch::ActionSearch(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
QDialog(parent)
|
||||
{
|
||||
setObjectName("ASDiag");
|
||||
setStyleSheet("#ASDiag{border: 2px solid #808080;}");
|
||||
setObjectName("ASDiag");
|
||||
setStyleSheet("#ASDiag{border: 2px solid #808080;}");
|
||||
|
||||
resize(parent->width()/3, parent->height()/3);
|
||||
resize(parent->width()/3, parent->height()/3);
|
||||
|
||||
setWindowFlags(Qt::Popup);
|
||||
setWindowFlags(Qt::Popup);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
ActionSearchEntry* entry_field = new ActionSearchEntry(this);
|
||||
QFont entry_field_font = entry_field->font();
|
||||
entry_field_font.setPointSize(qRound(entry_field_font.pointSize()*1.2));
|
||||
entry_field->setFont(entry_field_font);
|
||||
entry_field->setPlaceholderText(tr("Search for action..."));
|
||||
connect(entry_field, SIGNAL(textChanged(const QString&)), this, SLOT(search_update(const QString &)));
|
||||
connect(entry_field, SIGNAL(returnPressed()), this, SLOT(perform_action()));
|
||||
connect(entry_field, SIGNAL(moveSelectionUp()), this, SLOT(move_selection_up()));
|
||||
connect(entry_field, SIGNAL(moveSelectionDown()), this, SLOT(move_selection_down()));
|
||||
layout->addWidget(entry_field);
|
||||
ActionSearchEntry* entry_field = new ActionSearchEntry(this);
|
||||
QFont entry_field_font = entry_field->font();
|
||||
entry_field_font.setPointSize(qRound(entry_field_font.pointSize()*1.2));
|
||||
entry_field->setFont(entry_field_font);
|
||||
entry_field->setPlaceholderText(tr("Search for action..."));
|
||||
connect(entry_field, SIGNAL(textChanged(const QString&)), this, SLOT(search_update(const QString &)));
|
||||
connect(entry_field, SIGNAL(returnPressed()), this, SLOT(perform_action()));
|
||||
connect(entry_field, SIGNAL(moveSelectionUp()), this, SLOT(move_selection_up()));
|
||||
connect(entry_field, SIGNAL(moveSelectionDown()), this, SLOT(move_selection_down()));
|
||||
layout->addWidget(entry_field);
|
||||
|
||||
list_widget = new ActionSearchList(this);
|
||||
QFont list_widget_font = list_widget->font();
|
||||
list_widget_font.setPointSize(qRound(list_widget_font.pointSize()*1.2));
|
||||
list_widget->setFont(list_widget_font);
|
||||
layout->addWidget(list_widget);
|
||||
connect(list_widget, SIGNAL(dbl_click()), this, SLOT(perform_action()));
|
||||
list_widget = new ActionSearchList(this);
|
||||
QFont list_widget_font = list_widget->font();
|
||||
list_widget_font.setPointSize(qRound(list_widget_font.pointSize()*1.2));
|
||||
list_widget->setFont(list_widget_font);
|
||||
layout->addWidget(list_widget);
|
||||
connect(list_widget, SIGNAL(dbl_click()), this, SLOT(perform_action()));
|
||||
|
||||
entry_field->setFocus();
|
||||
entry_field->setFocus();
|
||||
}
|
||||
|
||||
void ActionSearch::search_update(const QString &s, const QString &p, QMenu *parent) {
|
||||
if (parent == nullptr) {
|
||||
list_widget->clear();
|
||||
if (parent == nullptr) {
|
||||
list_widget->clear();
|
||||
QList<QAction*> menus = olive::MainWindow->menuBar()->actions();
|
||||
for (int i=0;i<menus.size();i++) {
|
||||
QMenu* menu = menus.at(i)->menu();
|
||||
search_update(s, p, menu);
|
||||
}
|
||||
if (list_widget->count() > 0)
|
||||
list_widget->item(0)->setSelected(true);
|
||||
} else {
|
||||
QString menu_text;
|
||||
if (!p.isEmpty()) menu_text += p + " > ";
|
||||
menu_text += parent->title().replace("&", "");
|
||||
QList<QAction*> actions = parent->actions();
|
||||
for (int i=0;i<actions.size();i++) {
|
||||
QAction* a = actions.at(i);
|
||||
if (!a->isSeparator()) {
|
||||
if (a->menu() != nullptr) {
|
||||
search_update(s, menu_text, a->menu());
|
||||
} else {
|
||||
QString comp = a->text().replace("&", "");
|
||||
if (comp.contains(s, Qt::CaseInsensitive)) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QString("%1\n(%2)").arg(comp, menu_text), list_widget);
|
||||
item->setData(Qt::UserRole+1, reinterpret_cast<quintptr>(a));
|
||||
list_widget->addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0;i<menus.size();i++) {
|
||||
QMenu* menu = menus.at(i)->menu();
|
||||
search_update(s, p, menu);
|
||||
}
|
||||
if (list_widget->count() > 0)
|
||||
list_widget->item(0)->setSelected(true);
|
||||
} else {
|
||||
QString menu_text;
|
||||
if (!p.isEmpty()) menu_text += p + " > ";
|
||||
menu_text += parent->title().replace("&", "");
|
||||
QList<QAction*> actions = parent->actions();
|
||||
for (int i=0;i<actions.size();i++) {
|
||||
QAction* a = actions.at(i);
|
||||
if (!a->isSeparator()) {
|
||||
if (a->menu() != nullptr) {
|
||||
search_update(s, menu_text, a->menu());
|
||||
} else {
|
||||
QString comp = a->text().replace("&", "");
|
||||
if (comp.contains(s, Qt::CaseInsensitive)) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QString("%1\n(%2)").arg(comp, menu_text), list_widget);
|
||||
item->setData(Qt::UserRole+1, reinterpret_cast<quintptr>(a));
|
||||
list_widget->addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionSearch::perform_action() {
|
||||
QList<QListWidgetItem*> selected_items = list_widget->selectedItems();
|
||||
if (list_widget->count() > 0 && selected_items.size() > 0) {
|
||||
QListWidgetItem* item = selected_items.at(0);
|
||||
QAction* a = reinterpret_cast<QAction*>(item->data(Qt::UserRole+1).value<quintptr>());
|
||||
a->trigger();
|
||||
}
|
||||
accept();
|
||||
QList<QListWidgetItem*> selected_items = list_widget->selectedItems();
|
||||
if (list_widget->count() > 0 && selected_items.size() > 0) {
|
||||
QListWidgetItem* item = selected_items.at(0);
|
||||
QAction* a = reinterpret_cast<QAction*>(item->data(Qt::UserRole+1).value<quintptr>());
|
||||
a->trigger();
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
void ActionSearch::move_selection_up() {
|
||||
int lim = list_widget->count();
|
||||
for (int i=1;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i-1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i-1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
int lim = list_widget->count();
|
||||
for (int i=1;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i-1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i-1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionSearch::move_selection_down() {
|
||||
int lim = list_widget->count()-1;
|
||||
for (int i=0;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i+1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i+1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
int lim = list_widget->count()-1;
|
||||
for (int i=0;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i+1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i+1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ActionSearchEntry::ActionSearchEntry(QWidget *parent) : QLineEdit(parent) {}
|
||||
|
||||
void ActionSearchEntry::keyPressEvent(QKeyEvent * event) {
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Up:
|
||||
emit moveSelectionUp();
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
emit moveSelectionDown();
|
||||
break;
|
||||
default:
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Up:
|
||||
emit moveSelectionUp();
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
emit moveSelectionDown();
|
||||
break;
|
||||
default:
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
ActionSearchList::ActionSearchList(QWidget *parent) : QListWidget(parent) {}
|
||||
|
||||
void ActionSearchList::mouseDoubleClickEvent(QMouseEvent *) {
|
||||
emit dbl_click();
|
||||
emit dbl_click();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "io/exportthread.h"
|
||||
#include "rendering/exportthread.h"
|
||||
|
||||
/**
|
||||
* @brief The AdvancedVideoDialog class
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "panels/panels.h"
|
||||
#include "project/undo.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector<Clip *> clips) :
|
||||
QDialog(parent)
|
||||
@@ -33,8 +33,8 @@ ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector<Clip *> clip
|
||||
layout->addWidget(new QLabel(tr("Duration:")), row, 0);
|
||||
|
||||
duration_field_ = new LabelSlider();
|
||||
duration_field_->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
duration_field_->set_minimum_value(1);
|
||||
duration_field_->SetDisplayType(LabelSlider::FrameNumber);
|
||||
duration_field_->SetMinimum(1);
|
||||
layout->addWidget(duration_field_, row, 1);
|
||||
|
||||
row++;
|
||||
@@ -72,15 +72,15 @@ ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector<Clip *> clip
|
||||
}
|
||||
|
||||
// it's assumed all the clips come from the same sequence
|
||||
duration_field_->set_frame_rate(first_clip->sequence->frame_rate);
|
||||
duration_field_->SetFrameRate(first_clip->sequence->frame_rate);
|
||||
|
||||
if (all_clips_have_same_duration) {
|
||||
duration_field_->set_default_value(first_clip->length());
|
||||
duration_field_->set_value(first_clip->length(), false);
|
||||
duration_field_->set_maximum_value(first_clip->media_length());
|
||||
duration_field_->SetDefault(first_clip->length());
|
||||
duration_field_->SetValue(first_clip->length());
|
||||
duration_field_->SetMaximum(first_clip->media_length());
|
||||
} else {
|
||||
duration_field_->set_default_value(qSNaN());
|
||||
duration_field_->set_value(qSNaN(), false);
|
||||
duration_field_->SetDefault(qSNaN());
|
||||
duration_field_->SetValue(qSNaN());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "ui/labelslider.h"
|
||||
|
||||
class ClipPropertiesDialog : public QDialog {
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
#include <QScrollBar>
|
||||
#include <QEvent>
|
||||
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
DebugDialog* olive::DebugDialog = nullptr;
|
||||
|
||||
DebugDialog::DebugDialog(QWidget *parent) : QDialog(parent) {
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
textEdit = new QTextEdit(this);
|
||||
textEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||
textEdit = new QTextEdit(this);
|
||||
textEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||
layout->addWidget(textEdit);
|
||||
|
||||
Retranslate();
|
||||
@@ -45,7 +45,7 @@ void DebugDialog::Retranslate()
|
||||
}
|
||||
|
||||
void DebugDialog::update_log() {
|
||||
textEdit->setHtml(get_debug_str());
|
||||
textEdit->setHtml(get_debug_str());
|
||||
textEdit->verticalScrollBar()->setValue(textEdit->verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
@@ -59,5 +59,5 @@ void DebugDialog::changeEvent(QEvent *e)
|
||||
}
|
||||
|
||||
void DebugDialog::showEvent(QShowEvent *) {
|
||||
update_log();
|
||||
update_log();
|
||||
}
|
||||
|
||||
@@ -30,13 +30,14 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "oliveglobal.h"
|
||||
#include "global/global.h"
|
||||
#include "dialogs/advancedvideodialog.h"
|
||||
#include "panels/panels.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "rendering/renderfunctions.h"
|
||||
#include "io/exportthread.h"
|
||||
#include "mainwindow.h"
|
||||
#include "rendering/audio.h"
|
||||
#include "rendering/exportthread.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
@@ -341,6 +342,7 @@ void ExportDialog::render_thread_finished() {
|
||||
QMessageBox::Ok
|
||||
);
|
||||
}
|
||||
clear_audio_ibuffer();
|
||||
prep_ui_for_render(false);
|
||||
panel_sequence_viewer->viewer_widget->makeCurrent();
|
||||
panel_sequence_viewer->viewer_widget->initializeGL();
|
||||
@@ -543,7 +545,7 @@ void ExportDialog::export_action() {
|
||||
connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished()));
|
||||
connect(et, SIGNAL(progress_changed(int, qint64)), this, SLOT(update_progress_bar(int, qint64)));
|
||||
|
||||
close_active_clips(olive::ActiveSequence);
|
||||
close_active_clips(olive::ActiveSequence.get());
|
||||
|
||||
olive::Global->set_rendering_state(true);
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
#include <QProgressBar>
|
||||
#include <QGroupBox>
|
||||
|
||||
#include "project/sequence.h"
|
||||
#include "timeline/sequence.h"
|
||||
|
||||
#include "io/exportthread.h"
|
||||
#include "rendering/exportthread.h"
|
||||
|
||||
class ExportDialog : public QDialog
|
||||
{
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "oliveglobal.h"
|
||||
#include "global/global.h"
|
||||
|
||||
#include "panels/panels.h"
|
||||
|
||||
#include "ui/sourcetable.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
LoadDialog::LoadDialog(QWidget *parent, const QString& fn, bool autorecovery, bool clear) :
|
||||
QDialog(parent)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QHBoxLayout>
|
||||
|
||||
#include "project/projectelements.h"
|
||||
#include "io/loadthread.h"
|
||||
#include "project/loadthread.h"
|
||||
|
||||
class LoadDialog : public QDialog
|
||||
{
|
||||
|
||||
+142
-141
@@ -34,178 +34,179 @@
|
||||
#include "project/footage.h"
|
||||
#include "project/media.h"
|
||||
#include "panels/project.h"
|
||||
#include "project/undo.h"
|
||||
#include "undo/undo.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
QDialog(parent),
|
||||
item(i)
|
||||
QDialog(parent),
|
||||
item(i)
|
||||
{
|
||||
setWindowTitle(tr("\"%1\" Properties").arg(i->get_name()));
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setWindowTitle(tr("\"%1\" Properties").arg(i->get_name()));
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
QGridLayout* grid = new QGridLayout(this);
|
||||
QGridLayout* grid = new QGridLayout(this);
|
||||
|
||||
int row = 0;
|
||||
int row = 0;
|
||||
|
||||
FootagePtr f = item->to_footage();
|
||||
Footage* f = item->to_footage();
|
||||
|
||||
grid->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2);
|
||||
row++;
|
||||
grid->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2);
|
||||
row++;
|
||||
|
||||
track_list = new QListWidget(this);
|
||||
for (int i=0;i<f->video_tracks.size();i++) {
|
||||
const FootageStream& fs = f->video_tracks.at(i);
|
||||
track_list = new QListWidget(this);
|
||||
for (int i=0;i<f->video_tracks.size();i++) {
|
||||
const FootageStream& fs = f->video_tracks.at(i);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Video %1: %2x%3 %4FPS").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.video_width),
|
||||
QString::number(fs.video_height),
|
||||
QString::number(fs.video_frame_rate)
|
||||
),
|
||||
track_list
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
track_list->addItem(item);
|
||||
}
|
||||
for (int i=0;i<f->audio_tracks.size();i++) {
|
||||
const FootageStream& fs = f->audio_tracks.at(i);
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Audio %1: %2Hz %3").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.audio_frequency),
|
||||
tr("%n channel(s)", "", fs.audio_channels)
|
||||
),
|
||||
track_list
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
track_list->addItem(item);
|
||||
}
|
||||
grid->addWidget(track_list, row, 0, 1, 2);
|
||||
row++;
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Video %1: %2x%3 %4FPS").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.video_width),
|
||||
QString::number(fs.video_height),
|
||||
QString::number(fs.video_frame_rate)
|
||||
),
|
||||
track_list
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
track_list->addItem(item);
|
||||
}
|
||||
for (int i=0;i<f->audio_tracks.size();i++) {
|
||||
const FootageStream& fs = f->audio_tracks.at(i);
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Audio %1: %2Hz %3").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.audio_frequency),
|
||||
tr("%n channel(s)", "", fs.audio_channels)
|
||||
),
|
||||
track_list
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
track_list->addItem(item);
|
||||
}
|
||||
grid->addWidget(track_list, row, 0, 1, 2);
|
||||
row++;
|
||||
|
||||
if (f->video_tracks.size() > 0) {
|
||||
// frame conforming
|
||||
if (!f->video_tracks.at(0).infinite_length) {
|
||||
grid->addWidget(new QLabel(tr("Conform to Frame Rate:"), this), row, 0);
|
||||
conform_fr = new QDoubleSpinBox(this);
|
||||
conform_fr->setMinimum(0.01);
|
||||
conform_fr->setValue(f->video_tracks.at(0).video_frame_rate * f->speed);
|
||||
grid->addWidget(conform_fr, row, 1);
|
||||
}
|
||||
if (f->video_tracks.size() > 0) {
|
||||
// frame conforming
|
||||
if (!f->video_tracks.at(0).infinite_length) {
|
||||
grid->addWidget(new QLabel(tr("Conform to Frame Rate:"), this), row, 0);
|
||||
conform_fr = new QDoubleSpinBox(this);
|
||||
conform_fr->setMinimum(0.01);
|
||||
conform_fr->setValue(f->video_tracks.at(0).video_frame_rate * f->speed);
|
||||
grid->addWidget(conform_fr, row, 1);
|
||||
}
|
||||
|
||||
row++;
|
||||
row++;
|
||||
|
||||
// premultiplied alpha mode
|
||||
premultiply_alpha_setting = new QCheckBox(tr("Alpha is Premultiplied"), this);
|
||||
premultiply_alpha_setting->setChecked(f->alpha_is_premultiplied);
|
||||
grid->addWidget(premultiply_alpha_setting, row, 0);
|
||||
// premultiplied alpha mode
|
||||
premultiply_alpha_setting = new QCheckBox(tr("Alpha is Premultiplied"), this);
|
||||
premultiply_alpha_setting->setChecked(f->alpha_is_premultiplied);
|
||||
grid->addWidget(premultiply_alpha_setting, row, 0);
|
||||
|
||||
row++;
|
||||
row++;
|
||||
|
||||
// deinterlacing mode
|
||||
interlacing_box = new QComboBox(this);
|
||||
interlacing_box->addItem(
|
||||
tr("Auto (%1)").arg(
|
||||
get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
|
||||
)
|
||||
);
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
|
||||
// deinterlacing mode
|
||||
interlacing_box = new QComboBox(this);
|
||||
interlacing_box->addItem(
|
||||
tr("Auto (%1)").arg(
|
||||
get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
|
||||
)
|
||||
);
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
|
||||
|
||||
interlacing_box->setCurrentIndex(
|
||||
(f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing)
|
||||
? 0
|
||||
: f->video_tracks.at(0).video_interlacing + 1);
|
||||
interlacing_box->setCurrentIndex(
|
||||
(f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing)
|
||||
? 0
|
||||
: f->video_tracks.at(0).video_interlacing + 1);
|
||||
|
||||
grid->addWidget(new QLabel(tr("Interlacing:"), this), row, 0);
|
||||
grid->addWidget(interlacing_box, row, 1);
|
||||
grid->addWidget(new QLabel(tr("Interlacing:"), this), row, 0);
|
||||
grid->addWidget(interlacing_box, row, 1);
|
||||
|
||||
row++;
|
||||
}
|
||||
row++;
|
||||
}
|
||||
|
||||
name_box = new QLineEdit(item->get_name(), this);
|
||||
grid->addWidget(new QLabel(tr("Name:"), this), row, 0);
|
||||
grid->addWidget(name_box, row, 1);
|
||||
row++;
|
||||
name_box = new QLineEdit(item->get_name(), this);
|
||||
grid->addWidget(new QLabel(tr("Name:"), this), row, 0);
|
||||
grid->addWidget(name_box, row, 1);
|
||||
row++;
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
buttons->setCenterButtons(true);
|
||||
grid->addWidget(buttons, row, 0, 1, 2);
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
buttons->setCenterButtons(true);
|
||||
grid->addWidget(buttons, row, 0, 1, 2);
|
||||
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
void MediaPropertiesDialog::accept() {
|
||||
FootagePtr f = item->to_footage();
|
||||
Footage* f = item->to_footage();
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
// set track enable
|
||||
for (int i=0;i<track_list->count();i++) {
|
||||
QListWidgetItem* item = track_list->item(i);
|
||||
const QVariant& data = item->data(Qt::UserRole+1);
|
||||
if (!data.isNull()) {
|
||||
int index = data.toInt();
|
||||
bool found = false;
|
||||
for (int j=0;j<f->video_tracks.size();j++) {
|
||||
if (f->video_tracks.at(j).file_index == index) {
|
||||
f->video_tracks[j].enabled = (item->checkState() == Qt::Checked);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (int j=0;j<f->audio_tracks.size();j++) {
|
||||
if (f->audio_tracks.at(j).file_index == index) {
|
||||
f->audio_tracks[j].enabled = (item->checkState() == Qt::Checked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// set track enable
|
||||
for (int i=0;i<track_list->count();i++) {
|
||||
QListWidgetItem* item = track_list->item(i);
|
||||
const QVariant& data = item->data(Qt::UserRole+1);
|
||||
if (!data.isNull()) {
|
||||
int index = data.toInt();
|
||||
bool found = false;
|
||||
for (int j=0;j<f->video_tracks.size();j++) {
|
||||
if (f->video_tracks.at(j).file_index == index) {
|
||||
f->video_tracks[j].enabled = (item->checkState() == Qt::Checked);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (int j=0;j<f->audio_tracks.size();j++) {
|
||||
if (f->audio_tracks.at(j).file_index == index) {
|
||||
f->audio_tracks[j].enabled = (item->checkState() == Qt::Checked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool refresh_clips = false;
|
||||
bool refresh_clips = false;
|
||||
|
||||
// set interlacing
|
||||
if (f->video_tracks.size() > 0) {
|
||||
if (interlacing_box->currentIndex() > 0) {
|
||||
ca->append(new SetInt(&f->video_tracks[0].video_interlacing, interlacing_box->currentIndex() - 1));
|
||||
} else {
|
||||
ca->append(new SetInt(&f->video_tracks[0].video_interlacing, f->video_tracks.at(0).video_auto_interlacing));
|
||||
}
|
||||
// set interlacing
|
||||
if (f->video_tracks.size() > 0) {
|
||||
if (interlacing_box->currentIndex() > 0) {
|
||||
ca->append(new SetInt(&f->video_tracks[0].video_interlacing, interlacing_box->currentIndex() - 1));
|
||||
} else {
|
||||
ca->append(new SetInt(&f->video_tracks[0].video_interlacing, f->video_tracks.at(0).video_auto_interlacing));
|
||||
}
|
||||
|
||||
// set frame rate conform
|
||||
if (!f->video_tracks.at(0).infinite_length) {
|
||||
if (!qFuzzyCompare(conform_fr->value(), f->video_tracks.at(0).video_frame_rate)) {
|
||||
ca->append(new SetDouble(&f->speed, f->speed, conform_fr->value()/f->video_tracks.at(0).video_frame_rate));
|
||||
refresh_clips = true;
|
||||
}
|
||||
}
|
||||
// set frame rate conform
|
||||
if (!f->video_tracks.at(0).infinite_length) {
|
||||
if (!qFuzzyCompare(conform_fr->value(), f->video_tracks.at(0).video_frame_rate)) {
|
||||
ca->append(new SetDouble(&f->speed, f->speed, conform_fr->value()/f->video_tracks.at(0).video_frame_rate));
|
||||
refresh_clips = true;
|
||||
}
|
||||
}
|
||||
|
||||
// set premultiplied alpha
|
||||
f->alpha_is_premultiplied = premultiply_alpha_setting->isChecked();
|
||||
}
|
||||
// set premultiplied alpha
|
||||
f->alpha_is_premultiplied = premultiply_alpha_setting->isChecked();
|
||||
}
|
||||
|
||||
// set name
|
||||
MediaRename* mr = new MediaRename(item, name_box->text());
|
||||
// set name
|
||||
MediaRename* mr = new MediaRename(item, name_box->text());
|
||||
|
||||
ca->append(mr);
|
||||
ca->appendPost(new CloseAllClipsCommand());
|
||||
ca->appendPost(new UpdateFootageTooltip(item));
|
||||
if (refresh_clips) {
|
||||
ca->appendPost(new RefreshClips(item));
|
||||
}
|
||||
ca->appendPost(new UpdateViewer());
|
||||
ca->append(mr);
|
||||
ca->appendPost(new CloseAllClipsCommand());
|
||||
ca->appendPost(new UpdateFootageTooltip(item));
|
||||
if (refresh_clips) {
|
||||
ca->appendPost(new RefreshClips(item));
|
||||
}
|
||||
ca->appendPost(new UpdateViewer());
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::UndoStack.push(ca);
|
||||
|
||||
QDialog::accept();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
+188
-187
@@ -22,9 +22,10 @@
|
||||
|
||||
#include "panels/panels.h"
|
||||
#include "panels/project.h"
|
||||
#include "project/sequence.h"
|
||||
#include "project/undo.h"
|
||||
#include "project/clip.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "undo/undo.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "project/media.h"
|
||||
#include "rendering/audio.h"
|
||||
@@ -40,245 +41,245 @@
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing) :
|
||||
QDialog(parent),
|
||||
existing_item(existing)
|
||||
QDialog(parent),
|
||||
existing_item(existing)
|
||||
{
|
||||
setup_ui();
|
||||
setup_ui();
|
||||
|
||||
if (existing != nullptr) {
|
||||
existing_sequence = existing->to_sequence();
|
||||
setWindowTitle(tr("Editing \"%1\"").arg(existing_sequence->name));
|
||||
if (existing != nullptr) {
|
||||
existing_sequence = existing->to_sequence();
|
||||
setWindowTitle(tr("Editing \"%1\"").arg(existing_sequence->name));
|
||||
|
||||
width_numeric->setValue(existing_sequence->width);
|
||||
height_numeric->setValue(existing_sequence->height);
|
||||
int comp_rate = qRound(existing_sequence->frame_rate*100);
|
||||
for (int i=0;i<frame_rate_combobox->count();i++) {
|
||||
if (qRound(frame_rate_combobox->itemData(i).toDouble()*100) == comp_rate) {
|
||||
frame_rate_combobox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
sequence_name_edit->setText(existing_sequence->name);
|
||||
for (int i=0;i<audio_frequency_combobox->count();i++) {
|
||||
if (audio_frequency_combobox->itemData(i) == existing_sequence->audio_frequency) {
|
||||
audio_frequency_combobox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
existing_sequence = nullptr;
|
||||
setWindowTitle(tr("New Sequence"));
|
||||
}
|
||||
width_numeric->setValue(existing_sequence->width);
|
||||
height_numeric->setValue(existing_sequence->height);
|
||||
int comp_rate = qRound(existing_sequence->frame_rate*100);
|
||||
for (int i=0;i<frame_rate_combobox->count();i++) {
|
||||
if (qRound(frame_rate_combobox->itemData(i).toDouble()*100) == comp_rate) {
|
||||
frame_rate_combobox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
sequence_name_edit->setText(existing_sequence->name);
|
||||
for (int i=0;i<audio_frequency_combobox->count();i++) {
|
||||
if (audio_frequency_combobox->itemData(i) == existing_sequence->audio_frequency) {
|
||||
audio_frequency_combobox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
existing_sequence = nullptr;
|
||||
setWindowTitle(tr("New Sequence"));
|
||||
}
|
||||
}
|
||||
|
||||
NewSequenceDialog::~NewSequenceDialog()
|
||||
{}
|
||||
|
||||
void NewSequenceDialog::set_sequence_name(const QString& s) {
|
||||
sequence_name_edit->setText(s);
|
||||
sequence_name_edit->setText(s);
|
||||
}
|
||||
|
||||
void NewSequenceDialog::create() {
|
||||
if (existing_sequence == nullptr) {
|
||||
SequencePtr s(new Sequence());
|
||||
if (existing_sequence == nullptr) {
|
||||
SequencePtr s = std::make_shared<Sequence>();
|
||||
|
||||
s->name = sequence_name_edit->text();
|
||||
s->width = width_numeric->value();
|
||||
s->height = height_numeric->value();
|
||||
s->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
s->audio_frequency = audio_frequency_combobox->currentData().toInt();
|
||||
s->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
s->name = sequence_name_edit->text();
|
||||
s->width = width_numeric->value();
|
||||
s->height = height_numeric->value();
|
||||
s->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
s->audio_frequency = audio_frequency_combobox->currentData().toInt();
|
||||
s->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
panel_project->create_sequence_internal(ca, s, true, nullptr);
|
||||
olive::UndoStack.push(ca);
|
||||
} else {
|
||||
ComboAction* ca = new ComboAction();
|
||||
ComboAction* ca = new ComboAction();
|
||||
panel_project->create_sequence_internal(ca, s, true, nullptr);
|
||||
olive::UndoStack.push(ca);
|
||||
} else {
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
double multiplier = frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate;
|
||||
double multiplier = frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate;
|
||||
|
||||
EditSequenceCommand* esc = new EditSequenceCommand(existing_item, existing_sequence);
|
||||
esc->name = sequence_name_edit->text();
|
||||
esc->width = width_numeric->value();
|
||||
esc->height = height_numeric->value();
|
||||
esc->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
esc->audio_frequency = audio_frequency_combobox->currentData().toInt();
|
||||
esc->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
ca->append(esc);
|
||||
EditSequenceCommand* esc = new EditSequenceCommand(existing_item, existing_sequence);
|
||||
esc->name = sequence_name_edit->text();
|
||||
esc->width = width_numeric->value();
|
||||
esc->height = height_numeric->value();
|
||||
esc->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
esc->audio_frequency = audio_frequency_combobox->currentData().toInt();
|
||||
esc->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
ca->append(esc);
|
||||
|
||||
for (int i=0;i<existing_sequence->clips.size();i++) {
|
||||
ClipPtr c = existing_sequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
c->refactor_frame_rate(ca, multiplier, true);
|
||||
}
|
||||
}
|
||||
for (int i=0;i<existing_sequence->clips.size();i++) {
|
||||
ClipPtr c = existing_sequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
c->refactor_frame_rate(ca, multiplier, true);
|
||||
}
|
||||
}
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
}
|
||||
|
||||
accept();
|
||||
accept();
|
||||
}
|
||||
|
||||
void NewSequenceDialog::preset_changed(int index) {
|
||||
switch (index) {
|
||||
case 0: // FILM 4K
|
||||
width_numeric->setValue(4096);
|
||||
height_numeric->setValue(2160);
|
||||
break;
|
||||
case 1: // TV 4K
|
||||
width_numeric->setValue(3840);
|
||||
height_numeric->setValue(2160);
|
||||
break;
|
||||
case 2: // 1080p
|
||||
width_numeric->setValue(1920);
|
||||
height_numeric->setValue(1080);
|
||||
break;
|
||||
case 3: // 720p
|
||||
width_numeric->setValue(1280);
|
||||
height_numeric->setValue(720);
|
||||
break;
|
||||
case 4: // 480p
|
||||
width_numeric->setValue(640);
|
||||
height_numeric->setValue(480);
|
||||
break;
|
||||
case 5: // 360p
|
||||
width_numeric->setValue(640);
|
||||
height_numeric->setValue(360);
|
||||
break;
|
||||
case 6: // 240p
|
||||
width_numeric->setValue(320);
|
||||
height_numeric->setValue(240);
|
||||
break;
|
||||
case 7: // 144p
|
||||
width_numeric->setValue(192);
|
||||
height_numeric->setValue(144);
|
||||
break;
|
||||
case 8: // NTSC (480i)
|
||||
width_numeric->setValue(720);
|
||||
height_numeric->setValue(480);
|
||||
break;
|
||||
case 9: // PAL (576i)
|
||||
width_numeric->setValue(720);
|
||||
height_numeric->setValue(576);
|
||||
break;
|
||||
}
|
||||
switch (index) {
|
||||
case 0: // FILM 4K
|
||||
width_numeric->setValue(4096);
|
||||
height_numeric->setValue(2160);
|
||||
break;
|
||||
case 1: // TV 4K
|
||||
width_numeric->setValue(3840);
|
||||
height_numeric->setValue(2160);
|
||||
break;
|
||||
case 2: // 1080p
|
||||
width_numeric->setValue(1920);
|
||||
height_numeric->setValue(1080);
|
||||
break;
|
||||
case 3: // 720p
|
||||
width_numeric->setValue(1280);
|
||||
height_numeric->setValue(720);
|
||||
break;
|
||||
case 4: // 480p
|
||||
width_numeric->setValue(640);
|
||||
height_numeric->setValue(480);
|
||||
break;
|
||||
case 5: // 360p
|
||||
width_numeric->setValue(640);
|
||||
height_numeric->setValue(360);
|
||||
break;
|
||||
case 6: // 240p
|
||||
width_numeric->setValue(320);
|
||||
height_numeric->setValue(240);
|
||||
break;
|
||||
case 7: // 144p
|
||||
width_numeric->setValue(192);
|
||||
height_numeric->setValue(144);
|
||||
break;
|
||||
case 8: // NTSC (480i)
|
||||
width_numeric->setValue(720);
|
||||
height_numeric->setValue(480);
|
||||
break;
|
||||
case 9: // PAL (576i)
|
||||
width_numeric->setValue(720);
|
||||
height_numeric->setValue(576);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NewSequenceDialog::setup_ui() {
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
||||
|
||||
QWidget* widget = new QWidget(this);
|
||||
QWidget* widget = new QWidget(this);
|
||||
|
||||
QHBoxLayout* preset_layout = new QHBoxLayout(widget);
|
||||
preset_layout->setContentsMargins(0, 0, 0, 0);
|
||||
QHBoxLayout* preset_layout = new QHBoxLayout(widget);
|
||||
preset_layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
preset_layout->addWidget(new QLabel(tr("Preset:"), this));
|
||||
preset_layout->addWidget(new QLabel(tr("Preset:"), this));
|
||||
|
||||
preset_combobox = new QComboBox(widget);
|
||||
preset_combobox = new QComboBox(widget);
|
||||
|
||||
preset_combobox->addItem(tr("Film 4K"));
|
||||
preset_combobox->addItem(tr("TV 4K (Ultra HD/2160p)"));
|
||||
preset_combobox->addItem(tr("1080p"));
|
||||
preset_combobox->addItem(tr("720p"));
|
||||
preset_combobox->addItem(tr("480p"));
|
||||
preset_combobox->addItem(tr("360p"));
|
||||
preset_combobox->addItem(tr("240p"));
|
||||
preset_combobox->addItem(tr("144p"));
|
||||
preset_combobox->addItem(tr("NTSC (480i)"));
|
||||
preset_combobox->addItem(tr("PAL (576i)"));
|
||||
preset_combobox->addItem(tr("Custom"));
|
||||
preset_combobox->setCurrentIndex(2);
|
||||
preset_combobox->addItem(tr("Film 4K"));
|
||||
preset_combobox->addItem(tr("TV 4K (Ultra HD/2160p)"));
|
||||
preset_combobox->addItem(tr("1080p"));
|
||||
preset_combobox->addItem(tr("720p"));
|
||||
preset_combobox->addItem(tr("480p"));
|
||||
preset_combobox->addItem(tr("360p"));
|
||||
preset_combobox->addItem(tr("240p"));
|
||||
preset_combobox->addItem(tr("144p"));
|
||||
preset_combobox->addItem(tr("NTSC (480i)"));
|
||||
preset_combobox->addItem(tr("PAL (576i)"));
|
||||
preset_combobox->addItem(tr("Custom"));
|
||||
preset_combobox->setCurrentIndex(2);
|
||||
|
||||
preset_layout->addWidget(preset_combobox);
|
||||
preset_layout->addWidget(preset_combobox);
|
||||
|
||||
verticalLayout->addWidget(widget);
|
||||
verticalLayout->addWidget(widget);
|
||||
|
||||
QGroupBox* videoGroupBox = new QGroupBox(this);
|
||||
videoGroupBox->setTitle(tr("Video"));
|
||||
QGroupBox* videoGroupBox = new QGroupBox(this);
|
||||
videoGroupBox->setTitle(tr("Video"));
|
||||
|
||||
QGridLayout* videoLayout = new QGridLayout(videoGroupBox);
|
||||
QGridLayout* videoLayout = new QGridLayout(videoGroupBox);
|
||||
|
||||
videoLayout->addWidget(new QLabel(tr("Width:"), this), 0, 0, 1, 1);
|
||||
width_numeric = new QSpinBox(videoGroupBox);
|
||||
width_numeric->setMaximum(9999);
|
||||
width_numeric->setValue(1920);
|
||||
videoLayout->addWidget(width_numeric, 0, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Width:"), this), 0, 0, 1, 1);
|
||||
width_numeric = new QSpinBox(videoGroupBox);
|
||||
width_numeric->setMaximum(9999);
|
||||
width_numeric->setValue(1920);
|
||||
videoLayout->addWidget(width_numeric, 0, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel(tr("Height:"), this), 1, 0, 1, 2);
|
||||
height_numeric = new QSpinBox(videoGroupBox);
|
||||
height_numeric->setMaximum(9999);
|
||||
height_numeric->setValue(1080);
|
||||
videoLayout->addWidget(height_numeric, 1, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Height:"), this), 1, 0, 1, 2);
|
||||
height_numeric = new QSpinBox(videoGroupBox);
|
||||
height_numeric->setMaximum(9999);
|
||||
height_numeric->setValue(1080);
|
||||
videoLayout->addWidget(height_numeric, 1, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel(tr("Frame Rate:"), this), 2, 0, 1, 1);
|
||||
frame_rate_combobox = new QComboBox(videoGroupBox);
|
||||
frame_rate_combobox->addItem("10 FPS", 10.0);
|
||||
frame_rate_combobox->addItem("12.5 FPS", 12.5);
|
||||
frame_rate_combobox->addItem("15 FPS", 15.0);
|
||||
frame_rate_combobox->addItem("23.976 FPS", 23.976);
|
||||
frame_rate_combobox->addItem("24 FPS", 24.0);
|
||||
frame_rate_combobox->addItem("25 FPS", 25.0);
|
||||
frame_rate_combobox->addItem("29.97 FPS", 29.97);
|
||||
frame_rate_combobox->addItem("30 FPS", 30.0);
|
||||
frame_rate_combobox->addItem("50 FPS", 50.0);
|
||||
frame_rate_combobox->addItem("59.94 FPS", 59.94);
|
||||
frame_rate_combobox->addItem("60 FPS", 60.0);
|
||||
frame_rate_combobox->setCurrentIndex(6);
|
||||
videoLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Frame Rate:"), this), 2, 0, 1, 1);
|
||||
frame_rate_combobox = new QComboBox(videoGroupBox);
|
||||
frame_rate_combobox->addItem("10 FPS", 10.0);
|
||||
frame_rate_combobox->addItem("12.5 FPS", 12.5);
|
||||
frame_rate_combobox->addItem("15 FPS", 15.0);
|
||||
frame_rate_combobox->addItem("23.976 FPS", 23.976);
|
||||
frame_rate_combobox->addItem("24 FPS", 24.0);
|
||||
frame_rate_combobox->addItem("25 FPS", 25.0);
|
||||
frame_rate_combobox->addItem("29.97 FPS", 29.97);
|
||||
frame_rate_combobox->addItem("30 FPS", 30.0);
|
||||
frame_rate_combobox->addItem("50 FPS", 50.0);
|
||||
frame_rate_combobox->addItem("59.94 FPS", 59.94);
|
||||
frame_rate_combobox->addItem("60 FPS", 60.0);
|
||||
frame_rate_combobox->setCurrentIndex(6);
|
||||
videoLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel(tr("Pixel Aspect Ratio:"), this), 4, 0, 1, 1);
|
||||
par_combobox = new QComboBox(videoGroupBox);
|
||||
par_combobox->addItem(tr("Square Pixels (1.0)"));
|
||||
videoLayout->addWidget(par_combobox, 4, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Pixel Aspect Ratio:"), this), 4, 0, 1, 1);
|
||||
par_combobox = new QComboBox(videoGroupBox);
|
||||
par_combobox->addItem(tr("Square Pixels (1.0)"));
|
||||
videoLayout->addWidget(par_combobox, 4, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel(tr("Interlacing:"), this), 6, 0, 1, 1);
|
||||
interlacing_combobox = new QComboBox(videoGroupBox);
|
||||
interlacing_combobox->addItem(tr("None (Progressive)"));
|
||||
// interlacing_combobox->addItem("Upper Field First");
|
||||
// interlacing_combobox->addItem("Lower Field First");
|
||||
videoLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Interlacing:"), this), 6, 0, 1, 1);
|
||||
interlacing_combobox = new QComboBox(videoGroupBox);
|
||||
interlacing_combobox->addItem(tr("None (Progressive)"));
|
||||
// interlacing_combobox->addItem("Upper Field First");
|
||||
// interlacing_combobox->addItem("Lower Field First");
|
||||
videoLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
|
||||
|
||||
verticalLayout->addWidget(videoGroupBox);
|
||||
verticalLayout->addWidget(videoGroupBox);
|
||||
|
||||
QGroupBox* audioGroupBox = new QGroupBox(this);
|
||||
audioGroupBox->setTitle(tr("Audio"));
|
||||
QGroupBox* audioGroupBox = new QGroupBox(this);
|
||||
audioGroupBox->setTitle(tr("Audio"));
|
||||
|
||||
QGridLayout* audioLayout = new QGridLayout(audioGroupBox);
|
||||
QGridLayout* audioLayout = new QGridLayout(audioGroupBox);
|
||||
|
||||
audioLayout->addWidget(new QLabel(tr("Sample Rate: "), this), 0, 0, 1, 1);
|
||||
audioLayout->addWidget(new QLabel(tr("Sample Rate: "), this), 0, 0, 1, 1);
|
||||
|
||||
audio_frequency_combobox = new QComboBox(audioGroupBox);
|
||||
combobox_audio_sample_rates(audio_frequency_combobox);
|
||||
audio_frequency_combobox->setCurrentIndex(4);
|
||||
audio_frequency_combobox = new QComboBox(audioGroupBox);
|
||||
combobox_audio_sample_rates(audio_frequency_combobox);
|
||||
audio_frequency_combobox->setCurrentIndex(4);
|
||||
|
||||
audioLayout->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
|
||||
audioLayout->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
|
||||
|
||||
verticalLayout->addWidget(audioGroupBox);
|
||||
verticalLayout->addWidget(audioGroupBox);
|
||||
|
||||
QWidget* nameWidget = new QWidget(this);
|
||||
QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget);
|
||||
nameLayout->setContentsMargins(0, 0, 0, 0);
|
||||
QWidget* nameWidget = new QWidget(this);
|
||||
QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget);
|
||||
nameLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
nameLayout->addWidget(new QLabel(tr("Name:"), this));
|
||||
nameLayout->addWidget(new QLabel(tr("Name:"), this));
|
||||
|
||||
sequence_name_edit = new QLineEdit(nameWidget);
|
||||
sequence_name_edit = new QLineEdit(nameWidget);
|
||||
|
||||
nameLayout->addWidget(sequence_name_edit);
|
||||
nameLayout->addWidget(sequence_name_edit);
|
||||
|
||||
verticalLayout->addWidget(nameWidget);
|
||||
verticalLayout->addWidget(nameWidget);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
buttonBox->setCenterButtons(true);
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
buttonBox->setCenterButtons(true);
|
||||
|
||||
verticalLayout->addWidget(buttonBox);
|
||||
verticalLayout->addWidget(buttonBox);
|
||||
|
||||
connect(preset_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(preset_changed(int)));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(create()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(preset_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(preset_changed(int)));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(create()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
+18
-18
@@ -28,36 +28,36 @@
|
||||
|
||||
#include "panels/project.h"
|
||||
#include "project/media.h"
|
||||
#include "project/sequence.h"
|
||||
#include "timeline/sequence.h"
|
||||
|
||||
class NewSequenceDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NewSequenceDialog(QWidget *parent = nullptr, Media* existing = nullptr);
|
||||
~NewSequenceDialog();
|
||||
explicit NewSequenceDialog(QWidget *parent = nullptr, Media* existing = nullptr);
|
||||
~NewSequenceDialog();
|
||||
|
||||
void set_sequence_name(const QString& s);
|
||||
void set_sequence_name(const QString& s);
|
||||
|
||||
private slots:
|
||||
void create();
|
||||
void preset_changed(int index);
|
||||
void create();
|
||||
void preset_changed(int index);
|
||||
|
||||
private:
|
||||
SequencePtr existing_sequence;
|
||||
Media* existing_item;
|
||||
SequencePtr existing_sequence;
|
||||
Media* existing_item;
|
||||
|
||||
void setup_ui();
|
||||
void setup_ui();
|
||||
|
||||
QComboBox* preset_combobox;
|
||||
QSpinBox* height_numeric;
|
||||
QSpinBox* width_numeric;
|
||||
QComboBox* par_combobox;
|
||||
QComboBox* interlacing_combobox;
|
||||
QComboBox* frame_rate_combobox;
|
||||
QComboBox* audio_frequency_combobox;
|
||||
QLineEdit* sequence_name_edit;
|
||||
QComboBox* preset_combobox;
|
||||
QSpinBox* height_numeric;
|
||||
QSpinBox* width_numeric;
|
||||
QComboBox* par_combobox;
|
||||
QComboBox* interlacing_combobox;
|
||||
QComboBox* frame_rate_combobox;
|
||||
QComboBox* audio_frequency_combobox;
|
||||
QLineEdit* sequence_name_edit;
|
||||
};
|
||||
|
||||
#endif // NEWSEQUENCEDIALOG_H
|
||||
|
||||
+106
-50
@@ -20,11 +20,12 @@
|
||||
|
||||
#include "preferencesdialog.h"
|
||||
|
||||
#include "oliveglobal.h"
|
||||
#include "io/config.h"
|
||||
#include "io/path.h"
|
||||
#include "global/global.h"
|
||||
#include "global/config.h"
|
||||
#include "global/path.h"
|
||||
#include "rendering/audio.h"
|
||||
#include "mainwindow.h"
|
||||
#include "panels/panels.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
#include <QMenuBar>
|
||||
#include <QAction>
|
||||
@@ -74,7 +75,7 @@ QString KeySequenceEditor::export_shortcut() {
|
||||
if (ks != action->property("default")) {
|
||||
return action->property("id").toString() + "\t" + keySequence().toString();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget *parent) :
|
||||
@@ -168,6 +169,7 @@ void PreferencesDialog::save() {
|
||||
bool restart_after_saving = false;
|
||||
bool reinit_audio = false;
|
||||
bool reload_language = false;
|
||||
bool reload_effects = false;
|
||||
|
||||
// Validate whether the specified CSS file exists
|
||||
if (!custom_css_fn->text().isEmpty() && !QFileInfo::exists(custom_css_fn->text())) {
|
||||
@@ -199,11 +201,16 @@ void PreferencesDialog::save() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate whether the effects panel should refresh itself
|
||||
if (olive::CurrentConfig.effect_textbox_lines != effect_textbox_lines_field->value()) {
|
||||
reload_effects = true;
|
||||
}
|
||||
|
||||
// Check if any settings will require a restart of Olive
|
||||
if (olive::CurrentConfig.effect_textbox_lines != effect_textbox_lines_field->value()
|
||||
|| olive::CurrentConfig.use_software_fallback != use_software_fallbacks_checkbox->isChecked()
|
||||
if (olive::CurrentConfig.use_software_fallback != use_software_fallbacks_checkbox->isChecked()
|
||||
|| olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()
|
||||
|| olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) {
|
||||
|| olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()
|
||||
|| olive::CurrentConfig.style != static_cast<olive::styling::Style>(ui_style->currentData().toInt())) {
|
||||
|
||||
// any changes to these settings will require a restart - ask the user if we should do one now or later
|
||||
|
||||
@@ -243,8 +250,10 @@ void PreferencesDialog::save() {
|
||||
}
|
||||
|
||||
// save settings from UI to backend
|
||||
olive::CurrentConfig.css_path = custom_css_fn->text();
|
||||
olive::MainWindow->load_css_from_file(olive::CurrentConfig.css_path);
|
||||
if (olive::CurrentConfig.css_path != custom_css_fn->text()) {
|
||||
olive::CurrentConfig.css_path = custom_css_fn->text();
|
||||
olive::MainWindow->Restyle();
|
||||
}
|
||||
|
||||
olive::CurrentConfig.recording_mode = recordingComboBox->currentIndex() + 1;
|
||||
olive::CurrentConfig.img_seq_formats = imgSeqFormatEdit->text();
|
||||
@@ -265,6 +274,9 @@ void PreferencesDialog::save() {
|
||||
olive::CurrentConfig.enable_color_management = enable_color_management->isChecked();
|
||||
olive::CurrentConfig.ocio_config_path = ocio_config_file->text();
|
||||
|
||||
olive::CurrentConfig.style = static_cast<olive::styling::Style>(ui_style->currentData().toInt());
|
||||
|
||||
// Check if the thumbnail or waveform icon
|
||||
if (olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()
|
||||
|| olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) {
|
||||
// we're changing the size of thumbnails and waveforms, so let's delete them and regenerate them next start
|
||||
@@ -307,6 +319,10 @@ void PreferencesDialog::save() {
|
||||
init_audio();
|
||||
}
|
||||
|
||||
if (reload_effects) {
|
||||
panel_effect_controls->Reload();
|
||||
}
|
||||
|
||||
// reload language file if it changed
|
||||
if (reload_language) {
|
||||
olive::Global->load_translation_from_config();
|
||||
@@ -517,19 +533,6 @@ void PreferencesDialog::setup_ui() {
|
||||
|
||||
row++;
|
||||
|
||||
// General -> Custom CSS
|
||||
general_layout->addWidget(new QLabel(tr("Custom CSS:"), this), row, 0);
|
||||
|
||||
custom_css_fn = new QLineEdit(general_tab);
|
||||
custom_css_fn->setText(olive::CurrentConfig.css_path);
|
||||
general_layout->addWidget(custom_css_fn, row, 1, 1, 3);
|
||||
|
||||
QPushButton* custom_css_browse = new QPushButton(tr("Browse"), general_tab);
|
||||
connect(custom_css_browse, SIGNAL(clicked(bool)), this, SLOT(browse_css_file()));
|
||||
general_layout->addWidget(custom_css_browse, row, 4);
|
||||
|
||||
row++;
|
||||
|
||||
// General -> Image Sequence Formats
|
||||
general_layout->addWidget(new QLabel(tr("Image sequence formats:"), this), row, 0);
|
||||
|
||||
@@ -539,27 +542,6 @@ void PreferencesDialog::setup_ui() {
|
||||
|
||||
row++;
|
||||
|
||||
// General -> Audio Recording
|
||||
general_layout->addWidget(new QLabel(tr("Audio Recording:"), this), row, 0);
|
||||
|
||||
recordingComboBox = new QComboBox(general_tab);
|
||||
recordingComboBox->addItem(tr("Mono"));
|
||||
recordingComboBox->addItem(tr("Stereo"));
|
||||
recordingComboBox->setCurrentIndex(olive::CurrentConfig.recording_mode - 1);
|
||||
general_layout->addWidget(recordingComboBox, row, 1, 1, 4);
|
||||
|
||||
row++;
|
||||
|
||||
// General -> Effect Textbox Lines
|
||||
general_layout->addWidget(new QLabel(tr("Effect Textbox Lines:"), this), row, 0);
|
||||
|
||||
effect_textbox_lines_field = new QSpinBox(general_tab);
|
||||
effect_textbox_lines_field->setMinimum(1);
|
||||
effect_textbox_lines_field->setValue(olive::CurrentConfig.effect_textbox_lines);
|
||||
general_layout->addWidget(effect_textbox_lines_field, row, 1, 1, 4);
|
||||
|
||||
row++;
|
||||
|
||||
// General -> Thumbnail and Waveform Resolution
|
||||
general_layout->addWidget(new QLabel(tr("Thumbnail Resolution:"), this), row, 0);
|
||||
|
||||
@@ -589,6 +571,12 @@ void PreferencesDialog::setup_ui() {
|
||||
use_software_fallbacks_checkbox->setChecked(olive::CurrentConfig.use_software_fallback);
|
||||
general_layout->addWidget(use_software_fallbacks_checkbox, row, 0, 1, 4);
|
||||
|
||||
row++;
|
||||
|
||||
// General -> Default Sequence Settings
|
||||
QPushButton* default_sequence_settings = new QPushButton(tr("Default Sequence Settings"));
|
||||
general_layout->addWidget(default_sequence_settings);
|
||||
|
||||
tabWidget->addTab(general_tab, tr("General"));
|
||||
|
||||
// Behavior
|
||||
@@ -601,6 +589,50 @@ void PreferencesDialog::setup_ui() {
|
||||
add_default_effects_to_clips->setChecked(olive::CurrentConfig.add_default_effects_to_clips);
|
||||
behavior_tab_layout->addWidget(add_default_effects_to_clips);
|
||||
|
||||
// Appearance
|
||||
QWidget* appearance_tab = new QWidget(this);
|
||||
tabWidget->addTab(appearance_tab, tr("Appearance"));
|
||||
|
||||
row = 0;
|
||||
|
||||
QGridLayout* appearance_layout = new QGridLayout(appearance_tab);
|
||||
|
||||
// Appearance -> Theme
|
||||
appearance_layout->addWidget(new QLabel(tr("Theme")), row, 0);
|
||||
|
||||
ui_style = new QComboBox();
|
||||
ui_style->addItem(tr("Olive Dark (Default)"), olive::styling::kOliveDefaultDark);
|
||||
ui_style->addItem(tr("Olive Light"), olive::styling::kOliveDefaultLight);
|
||||
ui_style->addItem(tr("Native"), olive::styling::kNativeDarkIcons);
|
||||
ui_style->addItem(tr("Native (Light Icons)"), olive::styling::kNativeLightIcons);
|
||||
ui_style->setCurrentIndex(olive::CurrentConfig.style);
|
||||
appearance_layout->addWidget(ui_style, row, 1, 1, 2);
|
||||
|
||||
row++;
|
||||
|
||||
// Appearance -> Custom CSS
|
||||
appearance_layout->addWidget(new QLabel(tr("Custom CSS:"), this), row, 0);
|
||||
|
||||
custom_css_fn = new QLineEdit(general_tab);
|
||||
custom_css_fn->setText(olive::CurrentConfig.css_path);
|
||||
appearance_layout->addWidget(custom_css_fn, row, 1);
|
||||
|
||||
QPushButton* custom_css_browse = new QPushButton(tr("Browse"), general_tab);
|
||||
connect(custom_css_browse, SIGNAL(clicked(bool)), this, SLOT(browse_css_file()));
|
||||
appearance_layout->addWidget(custom_css_browse, row, 2);
|
||||
|
||||
row++;
|
||||
|
||||
// Appearance -> Effect Textbox Lines
|
||||
appearance_layout->addWidget(new QLabel(tr("Effect Textbox Lines:"), this), row, 0);
|
||||
|
||||
effect_textbox_lines_field = new QSpinBox(general_tab);
|
||||
effect_textbox_lines_field->setMinimum(1);
|
||||
effect_textbox_lines_field->setValue(olive::CurrentConfig.effect_textbox_lines);
|
||||
appearance_layout->addWidget(effect_textbox_lines_field, row, 1, 1, 2);
|
||||
|
||||
row++;
|
||||
|
||||
// Playback
|
||||
QWidget* playback_tab = new QWidget(this);
|
||||
QVBoxLayout* playback_tab_layout = new QVBoxLayout(playback_tab);
|
||||
@@ -636,7 +668,11 @@ void PreferencesDialog::setup_ui() {
|
||||
|
||||
QGridLayout* audio_tab_layout = new QGridLayout(audio_tab);
|
||||
|
||||
audio_tab_layout->addWidget(new QLabel(tr("Output Device:")), 0, 0);
|
||||
row = 0;
|
||||
|
||||
// Audio -> Output Device
|
||||
|
||||
audio_tab_layout->addWidget(new QLabel(tr("Output Device:")), row, 0);
|
||||
|
||||
audio_output_devices = new QComboBox();
|
||||
audio_output_devices->addItem(tr("Default"), "");
|
||||
@@ -653,9 +689,13 @@ void PreferencesDialog::setup_ui() {
|
||||
}
|
||||
}
|
||||
|
||||
audio_tab_layout->addWidget(audio_output_devices, 0, 1);
|
||||
audio_tab_layout->addWidget(audio_output_devices, row, 1);
|
||||
|
||||
audio_tab_layout->addWidget(new QLabel(tr("Input Device:")), 1, 0);
|
||||
row++;
|
||||
|
||||
// Audio -> Input Device
|
||||
|
||||
audio_tab_layout->addWidget(new QLabel(tr("Input Device:")), row, 0);
|
||||
|
||||
audio_input_devices = new QComboBox();
|
||||
audio_input_devices->addItem(tr("Default"), "");
|
||||
@@ -672,9 +712,13 @@ void PreferencesDialog::setup_ui() {
|
||||
}
|
||||
}
|
||||
|
||||
audio_tab_layout->addWidget(audio_input_devices, 1, 1);
|
||||
audio_tab_layout->addWidget(audio_input_devices, row, 1);
|
||||
|
||||
audio_tab_layout->addWidget(new QLabel(tr("Sample Rate:")), 2, 0);
|
||||
row++;
|
||||
|
||||
// Audio -> Sample Rate
|
||||
|
||||
audio_tab_layout->addWidget(new QLabel(tr("Sample Rate:")), row, 0);
|
||||
|
||||
audio_sample_rate = new QComboBox();
|
||||
combobox_audio_sample_rates(audio_sample_rate);
|
||||
@@ -685,7 +729,19 @@ void PreferencesDialog::setup_ui() {
|
||||
}
|
||||
}
|
||||
|
||||
audio_tab_layout->addWidget(audio_sample_rate, 2, 1);
|
||||
audio_tab_layout->addWidget(audio_sample_rate, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
// Audio -> Audio Recording
|
||||
audio_tab_layout->addWidget(new QLabel(tr("Audio Recording:"), this), row, 0);
|
||||
|
||||
recordingComboBox = new QComboBox(general_tab);
|
||||
recordingComboBox->addItem(tr("Mono"));
|
||||
recordingComboBox->addItem(tr("Stereo"));
|
||||
audio_tab_layout->addWidget(recordingComboBox, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
tabWidget->addTab(audio_tab, tr("Audio"));
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "timeline/sequence.h"
|
||||
|
||||
class KeySequenceEditor : public QKeySequenceEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -75,6 +77,13 @@ private:
|
||||
|
||||
// used to delete previews
|
||||
// type can be: 't' for thumbnails, 'w' for waveforms, or 1 for all
|
||||
/**
|
||||
* @brief Delete disk cached preview files (thumbnails, waveforms, etc.)
|
||||
*
|
||||
* @param type
|
||||
*
|
||||
* The types of previews to
|
||||
*/
|
||||
void delete_previews(char type);
|
||||
|
||||
QLineEdit* custom_css_fn;
|
||||
@@ -96,6 +105,8 @@ private:
|
||||
QCheckBox* add_default_effects_to_clips;
|
||||
QCheckBox* enable_color_management;
|
||||
QLineEdit* ocio_config_file;
|
||||
QComboBox* ui_style;
|
||||
Sequence sequence_settings;
|
||||
|
||||
QVector<QAction*> key_shortcut_actions;
|
||||
QVector<QTreeWidgetItem*> key_shortcut_items;
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
|
||||
#include "io/proxygenerator.h"
|
||||
#include "project/proxygenerator.h"
|
||||
#include "project/footage.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Media*> &media) :
|
||||
QDialog(parent),
|
||||
@@ -103,7 +103,7 @@ void ProxyDialog::accept() {
|
||||
info.codec_type = 0;
|
||||
info.size_multiplier = size_combobox->currentData().toDouble();
|
||||
|
||||
FootagePtr footage = selected_media.at(i)->to_footage();
|
||||
Footage* footage = selected_media.at(i)->to_footage();
|
||||
|
||||
QString base_footage_fn = QFileInfo(footage->url).baseName();
|
||||
|
||||
@@ -148,7 +148,7 @@ void ProxyDialog::accept() {
|
||||
|
||||
// all proxy info checks out, queue it with the proxy generator
|
||||
for (int i=0;i<info_list.size();i++) {
|
||||
FootagePtr footage = info_list.at(i).media->to_footage();
|
||||
Footage* footage = info_list.at(i).media->to_footage();
|
||||
footage->proxy = true;
|
||||
footage->proxy_path.clear();
|
||||
|
||||
|
||||
@@ -20,107 +20,107 @@
|
||||
|
||||
#include "replaceclipmediadialog.h"
|
||||
|
||||
#include "panels/panels.h"
|
||||
|
||||
#include "rendering/cacher.h"
|
||||
#include "project/undo.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "panels/panels.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "rendering/cacher.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media* old_media) :
|
||||
QDialog(parent),
|
||||
media(old_media)
|
||||
QDialog(parent),
|
||||
media(old_media)
|
||||
{
|
||||
setWindowTitle(tr("Replace clips using \"%1\"").arg(old_media->get_name()));
|
||||
setWindowTitle(tr("Replace clips using \"%1\"").arg(old_media->get_name()));
|
||||
|
||||
resize(300, 400);
|
||||
resize(300, 400);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
layout->addWidget(new QLabel(tr("Select which media you want to replace this media's clips with:"), this));
|
||||
layout->addWidget(new QLabel(tr("Select which media you want to replace this media's clips with:"), this));
|
||||
|
||||
tree = new QTreeView(this);
|
||||
tree = new QTreeView(this);
|
||||
|
||||
layout->addWidget(tree);
|
||||
layout->addWidget(tree);
|
||||
|
||||
use_same_media_in_points = new QCheckBox(tr("Keep the same media in-points"), this);
|
||||
use_same_media_in_points->setChecked(true);
|
||||
layout->addWidget(use_same_media_in_points);
|
||||
use_same_media_in_points = new QCheckBox(tr("Keep the same media in-points"), this);
|
||||
use_same_media_in_points->setChecked(true);
|
||||
layout->addWidget(use_same_media_in_points);
|
||||
|
||||
QHBoxLayout* buttons = new QHBoxLayout();
|
||||
|
||||
buttons->addStretch();
|
||||
buttons->addStretch();
|
||||
|
||||
QPushButton* replace_button = new QPushButton(tr("Replace"), this);
|
||||
connect(replace_button, SIGNAL(clicked(bool)), this, SLOT(replace()));
|
||||
buttons->addWidget(replace_button);
|
||||
QPushButton* replace_button = new QPushButton(tr("Replace"), this);
|
||||
connect(replace_button, SIGNAL(clicked(bool)), this, SLOT(replace()));
|
||||
buttons->addWidget(replace_button);
|
||||
|
||||
QPushButton* cancel_button = new QPushButton(tr("Cancel"), this);
|
||||
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||
buttons->addWidget(cancel_button);
|
||||
QPushButton* cancel_button = new QPushButton(tr("Cancel"), this);
|
||||
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||
buttons->addWidget(cancel_button);
|
||||
|
||||
buttons->addStretch();
|
||||
buttons->addStretch();
|
||||
|
||||
layout->addLayout(buttons);
|
||||
layout->addLayout(buttons);
|
||||
|
||||
tree->setModel(&olive::project_model);
|
||||
tree->setModel(&olive::project_model);
|
||||
}
|
||||
|
||||
void ReplaceClipMediaDialog::replace() {
|
||||
QModelIndexList selected_items = tree->selectionModel()->selectedRows();
|
||||
if (selected_items.size() != 1) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("No media selected"),
|
||||
tr("Please select a media to replace with or click 'Cancel'."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
QModelIndexList selected_items = tree->selectionModel()->selectedRows();
|
||||
if (selected_items.size() != 1) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("No media selected"),
|
||||
tr("Please select a media to replace with or click 'Cancel'."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
Media* new_item = static_cast<Media*>(selected_items.at(0).internalPointer());
|
||||
if (media == new_item) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Same media selected"),
|
||||
tr("You selected the same media that you're replacing. Please select a different one or click 'Cancel'."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else if (new_item->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Folder selected"),
|
||||
tr("You cannot replace footage with a folder."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == new_item->to_sequence()) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Active sequence selected"),
|
||||
tr("You cannot insert a sequence into itself."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
ReplaceClipMediaCommand* rcmc = new ReplaceClipMediaCommand(
|
||||
media,
|
||||
new_item,
|
||||
use_same_media_in_points->isChecked()
|
||||
);
|
||||
if (media == new_item) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Same media selected"),
|
||||
tr("You selected the same media that you're replacing. Please select a different one or click 'Cancel'."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else if (new_item->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Folder selected"),
|
||||
tr("You cannot replace footage with a folder."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == new_item->to_sequence()) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Active sequence selected"),
|
||||
tr("You cannot insert a sequence into itself."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
ReplaceClipMediaCommand* rcmc = new ReplaceClipMediaCommand(
|
||||
media,
|
||||
new_item,
|
||||
use_same_media_in_points->isChecked()
|
||||
);
|
||||
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && c->media() == media) {
|
||||
rcmc->clips.append(c);
|
||||
}
|
||||
}
|
||||
rcmc->clips.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
olive::UndoStack.push(rcmc);
|
||||
olive::UndoStack.push(rcmc);
|
||||
|
||||
close();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
-29
@@ -26,13 +26,14 @@
|
||||
#include <QPushButton>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "project/sequence.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "project/footage.h"
|
||||
#include "rendering/renderfunctions.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "project/undo.h"
|
||||
#include "project/effect.h"
|
||||
#include "undo/undo.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "effects/effect.h"
|
||||
#include "project/media.h"
|
||||
|
||||
SpeedDialog::SpeedDialog(QWidget *parent, QVector<Clip*> clips) : QDialog(parent) {
|
||||
@@ -47,20 +48,20 @@ SpeedDialog::SpeedDialog(QWidget *parent, QVector<Clip*> clips) : QDialog(parent
|
||||
|
||||
grid->addWidget(new QLabel(tr("Speed:"), this), 0, 0);
|
||||
percent = new LabelSlider(this);
|
||||
percent->decimal_places = 2;
|
||||
percent->set_display_type(LABELSLIDER_PERCENT);
|
||||
percent->set_default_value(1);
|
||||
percent->SetDecimalPlaces(2);
|
||||
percent->SetDisplayType(LabelSlider::Percent);
|
||||
percent->SetDefault(1);
|
||||
grid->addWidget(percent, 0, 1);
|
||||
|
||||
grid->addWidget(new QLabel(tr("Frame Rate:"), this), 1, 0);
|
||||
frame_rate = new LabelSlider(this);
|
||||
frame_rate->decimal_places = 3;
|
||||
frame_rate->SetDecimalPlaces(3);
|
||||
grid->addWidget(frame_rate, 1, 1);
|
||||
|
||||
grid->addWidget(new QLabel(tr("Duration:"), this), 2, 0);
|
||||
duration = new LabelSlider(this);
|
||||
duration->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
duration->set_frame_rate(olive::ActiveSequence->frame_rate);
|
||||
duration->SetDisplayType(LabelSlider::FrameNumber);
|
||||
duration->SetFrameRate(olive::ActiveSequence->frame_rate);
|
||||
grid->addWidget(duration, 2, 1);
|
||||
|
||||
main_layout->addLayout(grid);
|
||||
@@ -79,9 +80,9 @@ SpeedDialog::SpeedDialog(QWidget *parent, QVector<Clip*> clips) : QDialog(parent
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
|
||||
connect(percent, SIGNAL(valueChanged()), this, SLOT(percent_update()));
|
||||
connect(frame_rate, SIGNAL(valueChanged()), this, SLOT(frame_rate_update()));
|
||||
connect(duration, SIGNAL(valueChanged()), this, SLOT(duration_update()));
|
||||
connect(percent, SIGNAL(valueChanged(double)), this, SLOT(percent_update()));
|
||||
connect(frame_rate, SIGNAL(valueChanged(double)), this, SLOT(frame_rate_update()));
|
||||
connect(duration, SIGNAL(valueChanged(double)), this, SLOT(duration_update()));
|
||||
}
|
||||
|
||||
void SpeedDialog::run() {
|
||||
@@ -168,16 +169,16 @@ void SpeedDialog::run() {
|
||||
}
|
||||
}
|
||||
|
||||
frame_rate->set_minimum_value(1);
|
||||
percent->set_minimum_value(0.0001);
|
||||
duration->set_minimum_value(1);
|
||||
frame_rate->SetMinimum(1);
|
||||
percent->SetMinimum(0.0001);
|
||||
duration->SetMinimum(1);
|
||||
|
||||
frame_rate->setEnabled(enable_frame_rate);
|
||||
frame_rate->set_default_value(default_frame_rate);
|
||||
frame_rate->set_value(current_frame_rate, false);
|
||||
percent->set_value(current_percent, false);
|
||||
duration->set_default_value(default_length);
|
||||
duration->set_value((current_length == -1) ? qSNaN() : current_length, false);
|
||||
frame_rate->SetDefault(default_frame_rate);
|
||||
frame_rate->SetValue(current_frame_rate);
|
||||
percent->SetValue(current_percent);
|
||||
duration->SetDefault(default_length);
|
||||
duration->SetValue((current_length == -1) ? qSNaN() : current_length);
|
||||
|
||||
exec();
|
||||
}
|
||||
@@ -213,8 +214,8 @@ void SpeedDialog::percent_update() {
|
||||
}
|
||||
}
|
||||
|
||||
frame_rate->set_value(fr_val, false);
|
||||
duration->set_value((len_val == -1) ? qSNaN() : len_val, false);
|
||||
frame_rate->SetValue(fr_val);
|
||||
duration->SetValue((len_val == -1) ? qSNaN() : len_val);
|
||||
}
|
||||
|
||||
void SpeedDialog::duration_update() {
|
||||
@@ -248,8 +249,8 @@ void SpeedDialog::duration_update() {
|
||||
}
|
||||
}
|
||||
|
||||
frame_rate->set_value(fr_val, false);
|
||||
percent->set_value(pc_val, false);
|
||||
frame_rate->SetValue(fr_val);
|
||||
percent->SetValue(pc_val);
|
||||
}
|
||||
|
||||
void SpeedDialog::frame_rate_update() {
|
||||
@@ -301,7 +302,10 @@ void SpeedDialog::frame_rate_update() {
|
||||
Clip* c = clips_.at(i);
|
||||
|
||||
if (c->track() >= 0) {
|
||||
long new_clip_len = (qIsNaN(old_pc_val) || qIsNaN(pc_val)) ? c->length() : ((c->length() * c->speed().value) / pc_val);
|
||||
|
||||
long new_clip_len = (qIsNaN(old_pc_val) || qIsNaN(pc_val)) ?
|
||||
c->length() : qRound((c->length() * c->speed().value) / pc_val);
|
||||
|
||||
if (len_val > -1 && new_clip_len != len_val) {
|
||||
len_val = -1;
|
||||
break;
|
||||
@@ -309,8 +313,8 @@ void SpeedDialog::frame_rate_update() {
|
||||
}
|
||||
}
|
||||
|
||||
percent->set_value(pc_val, false);
|
||||
duration->set_value((len_val == -1) ? qSNaN() : len_val, false);
|
||||
percent->SetValue(pc_val);
|
||||
duration->SetValue((len_val == -1) ? qSNaN() : len_val);
|
||||
}
|
||||
|
||||
void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, long& lr) {
|
||||
@@ -318,7 +322,7 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
|
||||
|
||||
long proposed_out = c->timeline_out();
|
||||
double multiplier = (c->speed().value / speed);
|
||||
proposed_out = c->timeline_in() + (c->length() * multiplier);
|
||||
proposed_out = qRound(c->timeline_in() + (c->length() * multiplier));
|
||||
ca->append(new SetSpeedAction(c, speed));
|
||||
if (!ripple && proposed_out > c->timeline_out()) {
|
||||
for (int i=0;i<c->sequence->clips.size();i++) {
|
||||
@@ -353,7 +357,7 @@ void SpeedDialog::accept() {
|
||||
SetClipProperty* reversed_action = new SetClipProperty(kSetClipPropertyReversed);
|
||||
|
||||
// undoable action for restoring clip selections
|
||||
SetSelectionsCommand* sel_command = new SetSelectionsCommand(olive::ActiveSequence);
|
||||
SetSelectionsCommand* sel_command = new SetSelectionsCommand(olive::ActiveSequence.get());
|
||||
sel_command->old_data = olive::ActiveSequence->selections;
|
||||
|
||||
// variables used to calculate ripples
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "ui/labelslider.h"
|
||||
|
||||
class SpeedDialog : public QDialog
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SpeedDialog</class>
|
||||
<widget class="QDialog" name="SpeedDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>47</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>47</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Frame Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>47</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Duration:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SpeedDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SpeedDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+197
-15
@@ -22,33 +22,215 @@
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QIcon>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
TextEditDialog::TextEditDialog(QWidget *parent, const QString &s) :
|
||||
QDialog(parent)
|
||||
#include "ui/icons.h"
|
||||
|
||||
TextEditDialog::TextEditDialog(QWidget *parent, const QString &s, bool rich_text) :
|
||||
QDialog(parent),
|
||||
rich_text_(rich_text)
|
||||
{
|
||||
setWindowTitle(tr("Edit Text"));
|
||||
setWindowTitle(tr("Edit Text"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
textEdit = new QPlainTextEdit(this);
|
||||
textEdit->setPlainText(s);
|
||||
layout->addWidget(textEdit);
|
||||
// Create central text editor object
|
||||
textEdit = new QTextEdit(this);
|
||||
textEdit->setUndoRedoEnabled(true);
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
layout->addWidget(buttons);
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(cancel()));
|
||||
// Upper toolbar
|
||||
if (rich_text) {
|
||||
QHBoxLayout* toolbar = new QHBoxLayout();
|
||||
|
||||
// Bold Button
|
||||
/*
|
||||
bold_button = new QPushButton();
|
||||
bold_button->setIcon(QIcon(":/icons/bold.svg"));
|
||||
bold_button->setCheckable(true);
|
||||
connect(bold_button, SIGNAL(clicked(bool)), this, SLOT(SetBold(bool)));
|
||||
toolbar->addWidget(bold_button);
|
||||
*/
|
||||
|
||||
// Italic Button
|
||||
italic_button = new QPushButton();
|
||||
italic_button->setIcon(QIcon(":/icons/italic.svg"));
|
||||
italic_button->setCheckable(true);
|
||||
connect(italic_button, SIGNAL(clicked(bool)), textEdit, SLOT(setFontItalic(bool)));
|
||||
toolbar->addWidget(italic_button);
|
||||
|
||||
// Underline Button
|
||||
underline_button = new QPushButton();
|
||||
underline_button->setIcon(QIcon(":/icons/underline.svg"));
|
||||
underline_button->setCheckable(true);
|
||||
connect(underline_button, SIGNAL(clicked(bool)), textEdit, SLOT(setFontUnderline(bool)));
|
||||
toolbar->addWidget(underline_button);
|
||||
|
||||
// Font Name
|
||||
font_list = new QFontComboBox();
|
||||
connect(font_list, SIGNAL(currentIndexChanged(const QString&)), textEdit, SLOT(setFontFamily(const QString&)));
|
||||
toolbar->addWidget(font_list);
|
||||
|
||||
// Font Weight
|
||||
font_weight = new QComboBox();
|
||||
font_weight->addItem(tr("Thin"), QFont::Thin);
|
||||
font_weight->addItem(tr("Extra Light"), QFont::ExtraLight);
|
||||
font_weight->addItem(tr("Light"), QFont::Light);
|
||||
font_weight->addItem(tr("Normal"), QFont::Normal);
|
||||
font_weight->addItem(tr("Medium"), QFont::Medium);
|
||||
font_weight->addItem(tr("Demi Bold"), QFont::DemiBold);
|
||||
font_weight->addItem(tr("Bold"), QFont::Bold);
|
||||
font_weight->addItem(tr("Extra Bold"), QFont::ExtraBold);
|
||||
font_weight->addItem(tr("Black"), QFont::Black);
|
||||
connect(font_weight, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFontWeight(int)));
|
||||
toolbar->addWidget(font_weight);
|
||||
|
||||
// Font Size
|
||||
font_size = new LabelSlider();
|
||||
connect(font_size, SIGNAL(valueChanged(double)), textEdit, SLOT(setFontPointSize(qreal)));
|
||||
toolbar->addWidget(font_size);
|
||||
|
||||
// Font Color
|
||||
font_color = new ColorButton();
|
||||
connect(font_color, SIGNAL(color_changed(const QColor&)), textEdit, SLOT(setTextColor(const QColor &)));
|
||||
toolbar->addWidget(font_color);
|
||||
|
||||
toolbar->addStretch();
|
||||
|
||||
// Left Align
|
||||
left_align_button = new QPushButton();
|
||||
left_align_button->setIcon(QIcon(":/icons/align-left.svg"));
|
||||
left_align_button->setCheckable(true);
|
||||
left_align_button->setProperty("a", Qt::AlignLeft);
|
||||
connect(left_align_button, SIGNAL(clicked(bool)), this, SLOT(SetAlignmentFromProperty()));
|
||||
toolbar->addWidget(left_align_button);
|
||||
|
||||
// Center Align
|
||||
center_align_button = new QPushButton();
|
||||
center_align_button->setIcon(QIcon(":/icons/align-center.svg"));
|
||||
center_align_button->setCheckable(true);
|
||||
center_align_button->setProperty("a", Qt::AlignCenter);
|
||||
connect(center_align_button, SIGNAL(clicked(bool)), this, SLOT(SetAlignmentFromProperty()));
|
||||
toolbar->addWidget(center_align_button);
|
||||
|
||||
// Right Align
|
||||
right_align_button = new QPushButton();
|
||||
right_align_button->setIcon(QIcon(":/icons/align-right.svg"));
|
||||
right_align_button->setCheckable(true);
|
||||
right_align_button->setProperty("a", Qt::AlignRight);
|
||||
connect(right_align_button, SIGNAL(clicked(bool)), this, SLOT(SetAlignmentFromProperty()));
|
||||
toolbar->addWidget(right_align_button);
|
||||
|
||||
// Justify Align
|
||||
justify_align_button = new QPushButton();
|
||||
justify_align_button->setIcon(QIcon(":/icons/justify-center.svg"));
|
||||
justify_align_button->setCheckable(true);
|
||||
justify_align_button->setProperty("a", Qt::AlignJustify);
|
||||
connect(justify_align_button, SIGNAL(clicked(bool)), this, SLOT(SetAlignmentFromProperty()));
|
||||
toolbar->addWidget(justify_align_button);
|
||||
|
||||
layout->addLayout(toolbar);
|
||||
}
|
||||
|
||||
layout->addWidget(textEdit);
|
||||
|
||||
// Lower toolbar
|
||||
/*
|
||||
if (rich_text) {
|
||||
QHBoxLayout* lower_toolbar = new QHBoxLayout();
|
||||
|
||||
lower_toolbar->addWidget(new QLabel(tr("Letter Spacing:")));
|
||||
|
||||
letter_spacing = new LabelSlider();
|
||||
connect(letter_spacing, SIGNAL(valueChanged(double)), this, SLOT(SetLetterSpacing(qreal)));
|
||||
lower_toolbar->addWidget(letter_spacing);
|
||||
|
||||
lower_toolbar->addStretch();
|
||||
|
||||
layout->addLayout(lower_toolbar);
|
||||
}
|
||||
*/
|
||||
|
||||
// Create dialog buttons at the bottom
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
buttons->setCenterButtons(true);
|
||||
layout->addWidget(buttons);
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(cancel()));
|
||||
|
||||
connect(textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(UpdateUIFromTextCursor()));
|
||||
if (rich_text_) {
|
||||
textEdit->setHtml(s);
|
||||
} else {
|
||||
textEdit->setPlainText(s);
|
||||
}
|
||||
|
||||
// Helps ensure the UI elements update correctly at the beginning - when the cursor is at the start, the UI elements
|
||||
// show up blank...
|
||||
textEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
const QString& TextEditDialog::get_string() {
|
||||
return result_str;
|
||||
return result_str;
|
||||
}
|
||||
|
||||
void TextEditDialog::save() {
|
||||
result_str = textEdit->toPlainText();
|
||||
accept();
|
||||
result_str = rich_text_ ? textEdit->toHtml() : textEdit->toPlainText();
|
||||
accept();
|
||||
}
|
||||
|
||||
void TextEditDialog::cancel() {
|
||||
reject();
|
||||
reject();
|
||||
}
|
||||
|
||||
void TextEditDialog::SetBold(bool bold)
|
||||
{
|
||||
QFont f = textEdit->currentFont();
|
||||
f.setBold(bold);
|
||||
textEdit->setCurrentFont(f);
|
||||
UpdateUIFromTextCursor();
|
||||
}
|
||||
|
||||
void TextEditDialog::SetFontWeight(int i)
|
||||
{
|
||||
textEdit->setFontWeight(font_weight->itemData(i).toInt());
|
||||
}
|
||||
|
||||
void TextEditDialog::SetLetterSpacing(qreal spacing)
|
||||
{
|
||||
QFont f = textEdit->currentFont();
|
||||
f.setLetterSpacing(f.letterSpacingType(), spacing);
|
||||
textEdit->setCurrentFont(f);
|
||||
}
|
||||
|
||||
void TextEditDialog::SetAlignmentFromProperty()
|
||||
{
|
||||
textEdit->setAlignment(static_cast<Qt::Alignment>(sender()->property("a").toInt()));
|
||||
UpdateUIFromTextCursor();
|
||||
}
|
||||
|
||||
void TextEditDialog::UpdateUIFromTextCursor()
|
||||
{
|
||||
italic_button->setChecked(textEdit->fontItalic());
|
||||
underline_button->setChecked(textEdit->fontUnderline());
|
||||
font_list->setCurrentText(textEdit->fontFamily());
|
||||
font_size->SetValue(textEdit->fontPointSize());
|
||||
font_color->set_color(textEdit->textColor());
|
||||
|
||||
for (int i=0;i<font_weight->count();i++) {
|
||||
if (font_weight->itemData(i).toInt() == textEdit->fontWeight()) {
|
||||
font_weight->blockSignals(true);
|
||||
font_weight->setCurrentIndex(i);
|
||||
font_weight->blockSignals(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Qt::Alignment align = textEdit->alignment();
|
||||
left_align_button->setChecked(align == Qt::AlignLeft);
|
||||
center_align_button->setChecked(align == Qt::AlignCenter);
|
||||
right_align_button->setChecked(align == Qt::AlignRight);
|
||||
justify_align_button->setChecked(align == Qt::AlignJustify);
|
||||
}
|
||||
|
||||
@@ -23,18 +23,42 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QFontComboBox>
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/colorbutton.h"
|
||||
|
||||
class TextEditDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextEditDialog(QWidget* parent = nullptr, const QString& s = nullptr);
|
||||
const QString& get_string();
|
||||
TextEditDialog(QWidget* parent = nullptr, const QString& s = nullptr, bool rich_text = true);
|
||||
const QString& get_string();
|
||||
signals:
|
||||
void cursorPositionChanged();
|
||||
private slots:
|
||||
void save();
|
||||
void cancel();
|
||||
void save();
|
||||
void cancel();
|
||||
|
||||
void SetBold(bool bold);
|
||||
void SetFontWeight(int i);
|
||||
void SetLetterSpacing(qreal spacing);
|
||||
void SetAlignmentFromProperty();
|
||||
void UpdateUIFromTextCursor();
|
||||
private:
|
||||
QString result_str;
|
||||
QPlainTextEdit* textEdit;
|
||||
bool rich_text_;
|
||||
|
||||
QString result_str;
|
||||
QTextEdit* textEdit;
|
||||
QPushButton* italic_button;
|
||||
QPushButton* underline_button;
|
||||
QFontComboBox* font_list;
|
||||
QComboBox* font_weight;
|
||||
LabelSlider* font_size;
|
||||
ColorButton* font_color;
|
||||
QPushButton* left_align_button;
|
||||
QPushButton* center_align_button;
|
||||
QPushButton* right_align_button;
|
||||
QPushButton* justify_align_button;
|
||||
};
|
||||
|
||||
#endif // TEXTEDITDIALOG_H
|
||||
|
||||
Reference in New Issue
Block a user