first commit of big refactor

This commit is contained in:
itsmattkc
2019-02-14 05:27:21 -08:00
parent bd5b2cf036
commit e9fe837236
52 changed files with 1419 additions and 1186 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ ActionSearch::ActionSearch(QWidget *parent) :
void ActionSearch::search_update(const QString &s, const QString &p, QMenu *parent) {
if (parent == nullptr) {
list_widget->clear();
QList<QAction*> menus = mainWindow->menuBar()->actions();
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);
+14 -16
View File
@@ -15,11 +15,9 @@
#include <QPushButton>
#include <QProgressBar>
#include "debug.h"
#include "oliveglobal.h"
#include "dialogs/advancedvideodialog.h"
#include "panels/panels.h"
#include "panels/viewer.h"
#include "panels/timeline.h"
#include "ui/viewerwidget.h"
#include "project/sequence.h"
#include "io/exportthread.h"
@@ -58,11 +56,11 @@ enum ExportFormats {
ExportDialog::ExportDialog(QWidget *parent) :
QDialog(parent)
{
setWindowTitle(tr("Export \"%1\"").arg(sequence->name));
setWindowTitle(tr("Export \"%1\"").arg(Olive::ActiveSequence->name));
setup_ui();
rangeCombobox->setCurrentIndex(0);
if (sequence->using_workarea) {
if (Olive::ActiveSequence->using_workarea) {
rangeCombobox->setEnabled(true);
rangeCombobox->setCurrentIndex(1);
}
@@ -95,10 +93,10 @@ ExportDialog::ExportDialog(QWidget *parent) :
}
formatCombobox->setCurrentIndex(FORMAT_MPEG4);
widthSpinbox->setValue(sequence->width);
heightSpinbox->setValue(sequence->height);
samplingRateSpinbox->setValue(sequence->audio_frequency);
framerateSpinbox->setValue(sequence->frame_rate);
widthSpinbox->setValue(Olive::ActiveSequence->width);
heightSpinbox->setValue(Olive::ActiveSequence->height);
samplingRateSpinbox->setValue(Olive::ActiveSequence->audio_frequency);
framerateSpinbox->setValue(Olive::ActiveSequence->frame_rate);
}
ExportDialog::~ExportDialog()
@@ -511,10 +509,10 @@ void ExportDialog::export_action() {
}
params.start_frame = 0;
params.end_frame = sequence->getEndFrame(); // entire sequence
params.end_frame = Olive::ActiveSequence->getEndFrame(); // entire sequence
if (rangeCombobox->currentIndex() == 1) {
params.start_frame = qMax(sequence->workarea_in, params.start_frame);
params.end_frame = qMin(sequence->workarea_out, params.end_frame);
params.start_frame = qMax(Olive::ActiveSequence->workarea_in, params.start_frame);
params.end_frame = qMin(Olive::ActiveSequence->workarea_out, params.end_frame);
}
et = new ExportThread(params, vcodec_params, this);
@@ -523,11 +521,11 @@ 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)));
closeActiveClips(sequence);
closeActiveClips(Olive::ActiveSequence);
mainWindow->set_rendering_state(true);
Olive::Global.data()->set_rendering_state(true);
mainWindow->autorecover_interval();
Olive::Global.data()->save_autorecovery_file();
prep_ui_for_render(true);
@@ -594,7 +592,7 @@ void ExportDialog::comp_type_changed(int) {
case COMPRESSION_TYPE_CBR:
case COMPRESSION_TYPE_TARGETBR:
videoBitrateLabel->setText(tr("Bitrate (Mbps):"));
videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * sequence->height) - 4.5)));
videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * Olive::ActiveSequence->height) - 4.5)));
break;
case COMPRESSION_TYPE_CFR:
videoBitrateLabel->setText(tr("Quality (CRF):"));
+5 -3
View File
@@ -6,8 +6,10 @@
#include <QProgressBar>
#include <QPushButton>
#include "oliveglobal.h"
#include "panels/panels.h"
#include "panels/project.h"
#include "io/loadthread.h"
#include "playback/playback.h"
#include "ui/sourcetable.h"
@@ -19,7 +21,7 @@ LoadDialog::LoadDialog(QWidget *parent, bool autorecovery) : QDialog(parent) {
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(new QLabel(tr("Loading '%1'...").arg(project_url.mid(project_url.lastIndexOf('/')+1)), this));
layout->addWidget(new QLabel(tr("Loading '%1'...").arg(Olive::ActiveProjectFilename.mid(Olive::ActiveProjectFilename.lastIndexOf('/')+1)), this));
bar = new QProgressBar(this);
bar->setValue(0);
@@ -51,7 +53,7 @@ void LoadDialog::cancel() {
}
void LoadDialog::die() {
mainWindow->new_project();
Olive::Global.data()->new_project();
reject();
}
+3 -4
View File
@@ -26,8 +26,7 @@
#include <QMessageBox>
#include <QAudioDeviceInfo>
#include <QApplication>
#include "debug.h"
#include <QDebug>
KeySequenceEditor::KeySequenceEditor(QWidget* parent, QAction* a)
: QKeySequenceEdit(parent), action(a) {
@@ -161,7 +160,7 @@ void PreferencesDialog::save() {
// save settings from UI to backend
config.css_path = custom_css_fn->text();
mainWindow->load_css_from_file(config.css_path);
Olive::MainWindow->load_css_from_file(config.css_path);
config.recording_mode = recordingComboBox->currentIndex() + 1;
config.img_seq_formats = imgSeqFormatEdit->text();
config.fast_seeking = fastSeekButton->isChecked();
@@ -411,7 +410,7 @@ void PreferencesDialog::setup_ui() {
for (int i=0;i<translation_files.size();i++) {
// get path of translation relative to the application path
QString locale_full_path = translation_dir.filePath(translation_files.at(i));
QString locale_relative_path = QDir(get_app_dir()).relativeFilePath(locale_full_path);
QString locale_relative_path = QDir(get_app_path()).relativeFilePath(locale_full_path);
QFileInfo locale_file(translation_files.at(i));
QString locale_file_basename = locale_file.baseName();
+1 -2
View File
@@ -6,7 +6,6 @@
#include <QComboBox>
#include <QFileDialog>
#include <QMessageBox>
#include <QDebug>
#include "io/proxygenerator.h"
@@ -133,7 +132,7 @@ void ProxyDialog::accept() {
proxy_generator.queue(info_list.at(i));
}
mainWindow->setWindowModified(true);
Olive::MainWindow->setWindowModified(true);
QDialog::accept();
}
+5 -9
View File
@@ -2,15 +2,11 @@
#include "ui/sourcetable.h"
#include "panels/panels.h"
#include "panels/timeline.h"
#include "panels/project.h"
#include "project/sequence.h"
#include "project/clip.h"
#include "project/projectelements.h"
#include "playback/playback.h"
#include "playback/cacher.h"
#include "project/footage.h"
#include "project/undo.h"
#include "project/media.h"
#include <QVBoxLayout>
#include <QTreeView>
@@ -84,7 +80,7 @@ void ReplaceClipMediaDialog::replace() {
QMessageBox::Ok
);
} else {
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && sequence == new_item->to_sequence()) {
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && Olive::ActiveSequence == new_item->to_sequence()) {
QMessageBox::critical(
this,
tr("Active sequence selected"),
@@ -98,8 +94,8 @@ void ReplaceClipMediaDialog::replace() {
use_same_media_in_points->isChecked()
);
for (int i=0;i<sequence->clips.size();i++) {
Clip* c = sequence->clips.at(i);
for (int i=0;i<Olive::ActiveSequence->clips.size();i++) {
Clip* c = Olive::ActiveSequence->clips.at(i);
if (c != nullptr && c->media == media) {
rcmc->clips.append(c);
}
+5 -5
View File
@@ -41,7 +41,7 @@ SpeedDialog::SpeedDialog(QWidget *parent) : QDialog(parent) {
grid->addWidget(new QLabel(tr("Duration:"), this), 2, 0);
duration = new LabelSlider(this);
duration->set_display_type(LABELSLIDER_FRAMENUMBER);
duration->set_frame_rate(sequence->frame_rate);
duration->set_frame_rate(Olive::ActiveSequence->frame_rate);
grid->addWidget(duration, 2, 1);
main_layout->addLayout(grid);
@@ -322,14 +322,14 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
sel.in = c->timeline_in;
sel.out = proposed_out;
sel.track = c->track;
sequence->selections.append(sel);
Olive::ActiveSequence->selections.append(sel);
}
void SpeedDialog::accept() {
ComboAction* ca = new ComboAction();
SetSelectionsCommand* sel_command = new SetSelectionsCommand(sequence);
sel_command->old_data = sequence->selections;
SetSelectionsCommand* sel_command = new SetSelectionsCommand(Olive::ActiveSequence);
sel_command->old_data = Olive::ActiveSequence->selections;
long earliest_point = LONG_MAX;
long longest_ripple = LONG_MIN;
@@ -402,7 +402,7 @@ void SpeedDialog::accept() {
ripple_clips(ca, clips.at(0)->sequence, earliest_point, longest_ripple);
}
sel_command->new_data = sequence->selections;
sel_command->new_data = Olive::ActiveSequence->selections;
ca->append(sel_command);
undo_stack.push(ca);