cleanups
This commit is contained in:
@@ -284,6 +284,6 @@ void NewSequenceDialog::setup_ui() {
|
||||
verticalLayout->addWidget(buttonBox);
|
||||
|
||||
connect(preset_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(preset_changed(int)));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(create()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ void PreferencesDialog::setup_kbd_shortcuts(QMenuBar* menubar) {
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::save() {
|
||||
void PreferencesDialog::accept() {
|
||||
bool restart_after_saving = false;
|
||||
bool reinit_audio = false;
|
||||
bool reload_language = false;
|
||||
@@ -316,7 +316,7 @@ void PreferencesDialog::save() {
|
||||
olive::Global->load_translation_from_config();
|
||||
}
|
||||
|
||||
accept();
|
||||
QDialog::accept();
|
||||
|
||||
if (restart_after_saving) {
|
||||
// since we already ran can_close_project(), bypass checking again by running set_modified(false)
|
||||
@@ -794,6 +794,6 @@ void PreferencesDialog::setup_ui() {
|
||||
|
||||
verticalLayout->addWidget(buttonBox);
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(save()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "panels/grapheditor.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "ui/menuhelper.h"
|
||||
#include "ui/icons.h"
|
||||
#include "project/clipboard.h"
|
||||
#include "global/config.h"
|
||||
#include "ui/timelineheader.h"
|
||||
@@ -373,8 +374,8 @@ void EffectControls::setup_ui() {
|
||||
veHeaderLayout->setSpacing(0);
|
||||
veHeaderLayout->setMargin(0);
|
||||
|
||||
QIcon add_effect_icon(":/icons/add-effect.svg");
|
||||
QIcon add_transition_icon(":/icons/add-transition.svg");
|
||||
QIcon add_effect_icon = olive::icon::CreateIconFromSVG(":/icons/add-effect.svg", false);
|
||||
QIcon add_transition_icon = olive::icon::CreateIconFromSVG(":/icons/add-transition.svg", false);
|
||||
|
||||
btnAddVideoEffect = new QPushButton();
|
||||
btnAddVideoEffect->setIcon(add_effect_icon);
|
||||
|
||||
+12
-9
@@ -433,27 +433,30 @@ void Project::new_sequence() {
|
||||
}
|
||||
|
||||
MediaPtr Project::create_sequence_internal(ComboAction *ca, SequencePtr s, bool open, Media* parent) {
|
||||
if (parent == nullptr) {
|
||||
parent = olive::project_model.get_root();
|
||||
}
|
||||
|
||||
MediaPtr item = std::make_shared<Media>(parent);
|
||||
MediaPtr item = std::make_shared<Media>();
|
||||
item->set_sequence(s);
|
||||
|
||||
if (ca != nullptr) {
|
||||
|
||||
ca->append(new AddMediaCommand(item, parent));
|
||||
|
||||
if (open) {
|
||||
ca->append(new ChangeSequenceAction(s));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
olive::project_model.appendChild(parent, item);
|
||||
|
||||
if (open) {
|
||||
olive::Global->set_sequence(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
QString Project::get_file_name_from_path(const QString& path) {
|
||||
@@ -700,14 +703,14 @@ void Project::process_file_list(QStringList& files, bool recursive, MediaPtr rep
|
||||
subdir_filenames.append(subdir_files.at(j).filePath());
|
||||
}
|
||||
|
||||
process_file_list(subdir_filenames, true, nullptr, folder.get());
|
||||
|
||||
if (create_undo_action) {
|
||||
ca->append(new AddMediaCommand(folder, parent));
|
||||
} else {
|
||||
olive::project_model.appendChild(parent, folder);
|
||||
}
|
||||
|
||||
process_file_list(subdir_filenames, true, nullptr, folder.get());
|
||||
|
||||
imported = true;
|
||||
|
||||
} else if (!files.at(i).isEmpty()) {
|
||||
@@ -868,10 +871,10 @@ void Project::process_file_list(QStringList& files, bool recursive, MediaPtr rep
|
||||
if (replace != nullptr) {
|
||||
item = replace;
|
||||
} else {
|
||||
item = std::make_shared<Media>(parent);
|
||||
item = std::make_shared<Media>();
|
||||
}
|
||||
|
||||
m = FootagePtr(new Footage());
|
||||
m = std::make_shared<Footage>();
|
||||
|
||||
m->using_inout = false;
|
||||
m->url = file;
|
||||
@@ -886,7 +889,7 @@ void Project::process_file_list(QStringList& files, bool recursive, MediaPtr rep
|
||||
if (create_undo_action) {
|
||||
ca->append(new AddMediaCommand(item, parent));
|
||||
} else {
|
||||
parent->appendChild(item);
|
||||
olive::project_model.appendChild(parent, item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-7
@@ -283,7 +283,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
int folder = 0;
|
||||
|
||||
MediaPtr item = std::make_shared<Media>();
|
||||
FootagePtr f(new Footage());
|
||||
FootagePtr f = std::make_shared<Footage>();
|
||||
|
||||
f->using_inout = false;
|
||||
|
||||
@@ -608,6 +608,22 @@ Media* LoadThread::find_loaded_folder_by_id(int id) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LoadThread::OrganizeFolders(int folder) {
|
||||
qDebug() << "starting with" << folder;
|
||||
|
||||
for (int i=0;i<loaded_folders.size();i++) {
|
||||
MediaPtr item = loaded_folders.at(i);
|
||||
int parent_id = item->temp_id2;
|
||||
|
||||
if (parent_id == folder) {
|
||||
olive::project_model.appendChild(find_loaded_folder_by_id(parent_id), item);
|
||||
|
||||
OrganizeFolders(parent_id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void LoadThread::run() {
|
||||
mutex.lock();
|
||||
|
||||
@@ -660,15 +676,11 @@ void LoadThread::run() {
|
||||
cont = load_worker(file, stream, MEDIA_TYPE_FOLDER);
|
||||
}
|
||||
|
||||
// load media
|
||||
if (cont) {
|
||||
// since folders loaded correctly, organize them appropriately
|
||||
for (int i=0;i<loaded_folders.size();i++) {
|
||||
MediaPtr folder = loaded_folders.at(i);
|
||||
int parent = folder->temp_id2;
|
||||
olive::project_model.appendChild(find_loaded_folder_by_id(parent), folder);
|
||||
}
|
||||
OrganizeFolders();
|
||||
|
||||
// load media
|
||||
cont = load_worker(file, stream, MEDIA_TYPE_FOOTAGE);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ private:
|
||||
QVector<ClipPtr> loaded_clips;
|
||||
QVector<Media*> loaded_sequences;
|
||||
Media* find_loaded_folder_by_id(int id);
|
||||
void OrganizeFolders(int folder = 0);
|
||||
|
||||
int current_element_count;
|
||||
int total_element_count;
|
||||
|
||||
+5
-5
@@ -61,10 +61,10 @@ QString get_channel_layout_name(int channels, uint64_t layout) {
|
||||
}
|
||||
}
|
||||
|
||||
Media::Media(Media* iparent) {
|
||||
parent = iparent;
|
||||
root = false;
|
||||
type = -1;
|
||||
Media::Media() :
|
||||
root(false),
|
||||
type(-1)
|
||||
{
|
||||
}
|
||||
|
||||
Footage* Media::to_footage() {
|
||||
@@ -341,7 +341,7 @@ QVariant Media::data(int column, int role) {
|
||||
}
|
||||
|
||||
int Media::row() const {
|
||||
if (parent) {
|
||||
if (parent != nullptr) {
|
||||
for (int i=0;i<parent->children.size();i++) {
|
||||
if (parent->children.at(i).get() == this) {
|
||||
return i;
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ using MediaPtr = std::shared_ptr<Media>;
|
||||
class Media
|
||||
{
|
||||
public:
|
||||
Media(Media* iparent = nullptr);
|
||||
Media();
|
||||
|
||||
Footage *to_footage();
|
||||
SequencePtr to_sequence();
|
||||
|
||||
+14
-14
@@ -24,33 +24,33 @@
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
class ProjectFilter : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProjectFilter(QObject *parent = nullptr);
|
||||
ProjectFilter(QObject *parent = nullptr);
|
||||
|
||||
// are sequences visible
|
||||
bool get_show_sequences();
|
||||
// are sequences visible
|
||||
bool get_show_sequences();
|
||||
|
||||
public slots:
|
||||
|
||||
// set whether sequences are visible
|
||||
void set_show_sequences(bool b);
|
||||
// set whether sequences are visible
|
||||
void set_show_sequences(bool b);
|
||||
|
||||
// update search filter
|
||||
void update_search_filter(const QString& s);
|
||||
// update search filter
|
||||
void update_search_filter(const QString& s);
|
||||
|
||||
protected:
|
||||
|
||||
// function that filters whether rows are displayed or not
|
||||
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
||||
// function that filters whether rows are displayed or not
|
||||
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
||||
|
||||
private:
|
||||
|
||||
// internal variable for whether to show sequences
|
||||
bool show_sequences;
|
||||
// internal variable for whether to show sequences
|
||||
bool show_sequences;
|
||||
|
||||
// search filter variable
|
||||
QString search_filter;
|
||||
// search filter variable
|
||||
QString search_filter;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -43,8 +43,12 @@ void ProjectModel::make_root() {
|
||||
}
|
||||
|
||||
void ProjectModel::destroy_root() {
|
||||
if (panel_sequence_viewer != nullptr) panel_sequence_viewer->viewer_widget->delete_function();
|
||||
if (panel_footage_viewer != nullptr) panel_footage_viewer->viewer_widget->delete_function();
|
||||
if (panel_sequence_viewer != nullptr) {
|
||||
panel_sequence_viewer->viewer_widget->delete_function();
|
||||
}
|
||||
if (panel_footage_viewer != nullptr) {
|
||||
panel_footage_viewer->viewer_widget->delete_function();
|
||||
}
|
||||
|
||||
root_item_ = std::make_shared<Media>();
|
||||
}
|
||||
@@ -64,7 +68,9 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const {
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
return static_cast<Media*>(index.internalPointer())->data(index.column(), role);
|
||||
Media* media = static_cast<Media*>(index.internalPointer());
|
||||
|
||||
return media->data(index.column(), role);
|
||||
}
|
||||
|
||||
Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const {
|
||||
@@ -191,11 +197,20 @@ void ProjectModel::set_icon(Media* m, const QIcon &ico) {
|
||||
}
|
||||
|
||||
void ProjectModel::appendChild(Media* parent, MediaPtr child) {
|
||||
QModelIndex row_start;
|
||||
|
||||
if (parent == nullptr) {
|
||||
|
||||
parent = get_root();
|
||||
row_start = QModelIndex();
|
||||
|
||||
} else {
|
||||
|
||||
row_start = createIndex(parent->row(), 0, parent);
|
||||
|
||||
}
|
||||
beginInsertRows(parent == get_root() ?
|
||||
QModelIndex() : createIndex(parent->row(), 0, parent), parent->childCount(), parent->childCount());
|
||||
|
||||
beginInsertRows(row_start, parent->childCount(), parent->childCount());
|
||||
parent->appendChild(child);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
+59
-20
@@ -60,8 +60,6 @@
|
||||
|
||||
MainWindow* olive::MainWindow;
|
||||
|
||||
#define DEFAULT_CSS "QPushButton::checked { background: rgb(25, 25, 25); }"
|
||||
|
||||
void MainWindow::setup_layout(bool reset) {
|
||||
// load panels from file
|
||||
if (!reset) {
|
||||
@@ -407,25 +405,66 @@ void MainWindow::Restyle()
|
||||
} else {
|
||||
|
||||
// set default palette
|
||||
QPalette darkPalette;
|
||||
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
|
||||
darkPalette.setColor(QPalette::WindowText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Base, QColor(25,25,25));
|
||||
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53));
|
||||
darkPalette.setColor(QPalette::ToolTipBase, QColor(25,25,25));
|
||||
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Text, Qt::white);
|
||||
darkPalette.setColor(QPalette::Button, QColor(53,53,53));
|
||||
darkPalette.setColor(QPalette::ButtonText, Qt::white);
|
||||
darkPalette.setColor(QPalette::BrightText, Qt::red);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(128, 128, 128));
|
||||
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
|
||||
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
|
||||
qApp->setPalette(darkPalette);
|
||||
QPalette palette;
|
||||
|
||||
if (olive::CurrentConfig.style == olive::styling::kOliveDefaultLight) {
|
||||
|
||||
palette.setColor(QPalette::Window, QColor(208, 208, 208));
|
||||
palette.setColor(QPalette::WindowText, Qt::black);
|
||||
palette.setColor(QPalette::Base, QColor(240, 240, 240));
|
||||
palette.setColor(QPalette::AlternateBase, QColor(208, 208, 208));
|
||||
palette.setColor(QPalette::ToolTipBase, QColor(255, 255, 255));
|
||||
palette.setColor(QPalette::ToolTipText, Qt::black);
|
||||
palette.setColor(QPalette::Text, Qt::black);
|
||||
palette.setColor(QPalette::Button, QColor(208, 208, 208));
|
||||
palette.setColor(QPalette::ButtonText, Qt::black);
|
||||
palette.setColor(QPalette::BrightText, Qt::red);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(208, 208, 208));
|
||||
palette.setColor(QPalette::Link, QColor(42, 130, 218));
|
||||
palette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
palette.setColor(QPalette::HighlightedText, Qt::white);
|
||||
|
||||
/* Olive Mid
|
||||
palette.setColor(QPalette::Window, QColor(128, 128, 128));
|
||||
palette.setColor(QPalette::WindowText, Qt::black);
|
||||
palette.setColor(QPalette::Base, QColor(192, 192, 192));
|
||||
palette.setColor(QPalette::AlternateBase, QColor(128, 128, 128));
|
||||
palette.setColor(QPalette::ToolTipBase, QColor(192, 192, 192));
|
||||
palette.setColor(QPalette::ToolTipText, Qt::black);
|
||||
palette.setColor(QPalette::Text, Qt::black);
|
||||
palette.setColor(QPalette::Button, QColor(128, 128, 128));
|
||||
palette.setColor(QPalette::ButtonText, Qt::black);
|
||||
palette.setColor(QPalette::BrightText, Qt::red);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(128, 128, 128));
|
||||
palette.setColor(QPalette::Link, QColor(42, 130, 218));
|
||||
palette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
palette.setColor(QPalette::HighlightedText, Qt::black);
|
||||
*/
|
||||
|
||||
} else {
|
||||
|
||||
palette.setColor(QPalette::Window, QColor(53,53,53));
|
||||
palette.setColor(QPalette::WindowText, Qt::white);
|
||||
palette.setColor(QPalette::Base, QColor(25,25,25));
|
||||
palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
|
||||
palette.setColor(QPalette::ToolTipBase, QColor(25,25,25));
|
||||
palette.setColor(QPalette::ToolTipText, Qt::white);
|
||||
palette.setColor(QPalette::Text, Qt::white);
|
||||
palette.setColor(QPalette::Button, QColor(53,53,53));
|
||||
palette.setColor(QPalette::ButtonText, Qt::white);
|
||||
palette.setColor(QPalette::BrightText, Qt::red);
|
||||
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(128, 128, 128));
|
||||
palette.setColor(QPalette::Link, QColor(42, 130, 218));
|
||||
palette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
palette.setColor(QPalette::HighlightedText, Qt::white);
|
||||
|
||||
// set default CSS
|
||||
setStyleSheet("QPushButton::checked { background: rgb(25, 25, 25); }");
|
||||
|
||||
}
|
||||
|
||||
qApp->setPalette(palette);
|
||||
|
||||
// set default CSS
|
||||
setStyleSheet(DEFAULT_CSS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-2
@@ -316,16 +316,22 @@ void DeleteTransitionCommand::doRedo() {
|
||||
|
||||
AddMediaCommand::AddMediaCommand(MediaPtr iitem, Media *iparent) :
|
||||
item(iitem),
|
||||
parent(iparent)
|
||||
parent(iparent),
|
||||
done_(false)
|
||||
{
|
||||
doRedo();
|
||||
}
|
||||
|
||||
void AddMediaCommand::doUndo() {
|
||||
olive::project_model.removeChild(parent, item.get());
|
||||
done_ = false;
|
||||
}
|
||||
|
||||
void AddMediaCommand::doRedo() {
|
||||
olive::project_model.appendChild(parent, item);
|
||||
if (!done_) {
|
||||
olive::project_model.appendChild(parent, item);
|
||||
done_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
DeleteMediaCommand::DeleteMediaCommand(MediaPtr i) :
|
||||
|
||||
@@ -213,6 +213,7 @@ public:
|
||||
private:
|
||||
MediaPtr item;
|
||||
Media* parent;
|
||||
bool done_;
|
||||
};
|
||||
|
||||
class DeleteMediaCommand : public OliveAction {
|
||||
|
||||
Reference in New Issue
Block a user