This commit is contained in:
itsmattkc
2019-03-23 00:56:54 +11:00
parent 90b089a80b
commit bd4b4f4e18
14 changed files with 125 additions and 73 deletions
+2 -5
View File
@@ -190,6 +190,7 @@ void PreferencesDialog::accept() {
if (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.thumbnail_resolution != thumbnail_res_spinbox->value()
|| olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value() || olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()
|| olive::CurrentConfig.css_path != custom_css_fn->text()
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
|| olive::CurrentConfig.use_native_menu_styling != native_menus->isChecked() || olive::CurrentConfig.use_native_menu_styling != native_menus->isChecked()
#endif #endif
@@ -233,11 +234,7 @@ void PreferencesDialog::accept() {
} }
// save settings from UI to backend // save settings from UI to backend
if (olive::CurrentConfig.css_path != custom_css_fn->text()) { 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.recording_mode = recordingComboBox->currentIndex() + 1;
olive::CurrentConfig.img_seq_formats = imgSeqFormatEdit->text(); olive::CurrentConfig.img_seq_formats = imgSeqFormatEdit->text();
olive::CurrentConfig.upcoming_queue_size = upcoming_queue_spinbox->value(); olive::CurrentConfig.upcoming_queue_size = upcoming_queue_spinbox->value();
+1 -1
View File
@@ -264,7 +264,7 @@ void Config::save(QString path) {
stream.writeTextElement("HoverFocus", QString::number(hover_focus)); stream.writeTextElement("HoverFocus", QString::number(hover_focus));
stream.writeTextElement("ProjectViewType", QString::number(project_view_type)); stream.writeTextElement("ProjectViewType", QString::number(project_view_type));
stream.writeTextElement("SetNameWithMarker", QString::number(set_name_with_marker)); stream.writeTextElement("SetNameWithMarker", QString::number(set_name_with_marker));
stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->toolbar_widget->isVisible())); stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->IsToolbarVisible()));
stream.writeTextElement("PreviousFrameQueueSize", QString::number(previous_queue_size)); stream.writeTextElement("PreviousFrameQueueSize", QString::number(previous_queue_size));
stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type)); stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type));
stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size)); stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size));
+14 -1
View File
@@ -91,7 +91,12 @@ void OliveGlobal::check_for_autorecovery_file() {
// detect auto-recovery file // detect auto-recovery file
autorecovery_filename = data_dir + "/autorecovery.ove"; autorecovery_filename = data_dir + "/autorecovery.ove";
if (QFile::exists(autorecovery_filename)) { if (QFile::exists(autorecovery_filename)) {
if (QMessageBox::question(nullptr, tr("Auto-recovery"), tr("Olive didn't close properly and an autorecovery file was detected. Would you like to open it?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { if (QMessageBox::question(nullptr,
tr("Auto-recovery"),
tr("Olive didn't close properly and an autorecovery file "
"was detected. Would you like to open it?"),
QMessageBox::Yes,
QMessageBox::No) == QMessageBox::Yes) {
enable_load_project_on_init = false; enable_load_project_on_init = false;
OpenProjectWorker(autorecovery_filename, true); OpenProjectWorker(autorecovery_filename, true);
} }
@@ -168,6 +173,12 @@ void OliveGlobal::SetNativeStyling(QWidget *w)
void OliveGlobal::LoadProject(const QString &fn, bool autorecovery) void OliveGlobal::LoadProject(const QString &fn, bool autorecovery)
{ {
// QSortFilterProxyModels are not thread-safe, and as we'll be loading in another thread, leaving it connected
// can cause glitches in its presentation. Therefore for the duration of the loading process, we disconnect it,
// and reconnect it later once the loading is complete.
panel_project->DisconnectFilterToModel();
LoadDialog ld(olive::MainWindow); LoadDialog ld(olive::MainWindow);
LoadThread* lt = new LoadThread(fn, autorecovery); LoadThread* lt = new LoadThread(fn, autorecovery);
@@ -179,6 +190,8 @@ void OliveGlobal::LoadProject(const QString &fn, bool autorecovery)
lt->start(); lt->start();
ld.exec(); ld.exec();
panel_project->ConnectFilterToModel();
} }
void OliveGlobal::ClearProject() void OliveGlobal::ClearProject()
+40 -20
View File
@@ -78,7 +78,9 @@ QString autorecovery_filename;
QStringList recent_projects; QStringList recent_projects;
Project::Project(QWidget *parent) : Project::Project(QWidget *parent) :
Panel(parent) Panel(parent),
sorter(this),
sources_common(this, sorter)
{ {
QWidget* dockWidgetContents = new QWidget(this); QWidget* dockWidgetContents = new QWidget(this);
@@ -88,10 +90,7 @@ Project::Project(QWidget *parent) :
setWidget(dockWidgetContents); setWidget(dockWidgetContents);
sources_common = new SourcesCommon(this); ConnectFilterToModel();
sorter = new ProjectFilter(this);
sorter->setSourceModel(&olive::project_model);
// optional toolbar // optional toolbar
toolbar_widget = new QWidget(); toolbar_widget = new QWidget();
@@ -134,7 +133,7 @@ Project::Project(QWidget *parent) :
toolbar_search = new QLineEdit(); toolbar_search = new QLineEdit();
toolbar_search->setClearButtonEnabled(true); toolbar_search->setClearButtonEnabled(true);
connect(toolbar_search, SIGNAL(textChanged(QString)), sorter, SLOT(update_search_filter(const QString&))); connect(toolbar_search, SIGNAL(textChanged(QString)), &sorter, SLOT(update_search_filter(const QString&)));
toolbar->addWidget(toolbar_search); toolbar->addWidget(toolbar_search);
QPushButton* toolbar_tree_view = new QPushButton(); QPushButton* toolbar_tree_view = new QPushButton();
@@ -152,9 +151,9 @@ Project::Project(QWidget *parent) :
verticalLayout->addWidget(toolbar_widget); verticalLayout->addWidget(toolbar_widget);
// tree view // tree view
tree_view = new SourceTable(); tree_view = new SourceTable(sources_common);
tree_view->project_parent = this; tree_view->project_parent = this;
tree_view->setModel(sorter); tree_view->setModel(&sorter);
verticalLayout->addWidget(tree_view); verticalLayout->addWidget(tree_view);
// Set the first column width // Set the first column width
@@ -189,9 +188,9 @@ Project::Project(QWidget *parent) :
icon_view_container_layout->addLayout(icon_view_controls); icon_view_container_layout->addLayout(icon_view_controls);
icon_view = new SourceIconView(); icon_view = new SourceIconView(sources_common);
icon_view->project_parent = this; icon_view->project_parent = this;
icon_view->setModel(sorter); icon_view->setModel(&sorter);
icon_view->setIconSize(QSize(100, 100)); icon_view->setIconSize(QSize(100, 100));
icon_view->setViewMode(QListView::IconMode); icon_view->setViewMode(QListView::IconMode);
icon_view->setUniformItemSizes(true); icon_view->setUniformItemSizes(true);
@@ -212,8 +211,14 @@ Project::Project(QWidget *parent) :
Retranslate(); Retranslate();
} }
Project::~Project() { void Project::ConnectFilterToModel()
delete sorter; {
sorter.setSourceModel(&olive::project_model);
}
void Project::DisconnectFilterToModel()
{
sorter.setSourceModel(nullptr);
} }
void Project::Retranslate() { void Project::Retranslate() {
@@ -418,10 +423,10 @@ void Project::new_folder() {
QModelIndex index = olive::project_model.create_index(m->row(), 0, m.get()); QModelIndex index = olive::project_model.create_index(m->row(), 0, m.get());
switch (olive::CurrentConfig.project_view_type) { switch (olive::CurrentConfig.project_view_type) {
case olive::PROJECT_VIEW_TREE: case olive::PROJECT_VIEW_TREE:
tree_view->edit(sorter->mapFromSource(index)); tree_view->edit(sorter.mapFromSource(index));
break; break;
case olive::PROJECT_VIEW_ICON: case olive::PROJECT_VIEW_ICON:
icon_view->edit(sorter->mapFromSource(index)); icon_view->edit(sorter.mapFromSource(index));
break; break;
} }
} }
@@ -475,7 +480,7 @@ MediaPtr Project::create_folder_internal(QString name) {
} }
Media* Project::item_to_media(const QModelIndex &index) { Media* Project::item_to_media(const QModelIndex &index) {
return static_cast<Media*>(sorter->mapToSource(index).internalPointer()); return static_cast<Media*>(sorter.mapToSource(index).internalPointer());
} }
MediaPtr Project::item_to_media_ptr(const QModelIndex &index) { MediaPtr Project::item_to_media_ptr(const QModelIndex &index) {
@@ -503,6 +508,21 @@ void Project::get_all_media_from_table(QList<Media*>& items, QList<Media*>& list
} }
} }
bool Project::IsToolbarVisible()
{
return toolbar_widget->isVisible();
}
void Project::SetToolbarVisible(bool visible)
{
toolbar_widget->setVisible(visible);
}
bool Project::IsProjectWidget(QObject *child)
{
return (child == tree_view || child == icon_view);
}
bool delete_clips_in_clipboard_with_media(ComboAction* ca, Media* m) { bool delete_clips_in_clipboard_with_media(ComboAction* ca, Media* m) {
int delete_count = 0; int delete_count = 0;
if (clipboard_type == CLIPBOARD_TYPE_CLIP) { if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
@@ -939,7 +959,7 @@ bool Project::reveal_media(Media *media, QModelIndex parent) {
// if m == media, then we found the media object we were looking for // if m == media, then we found the media object we were looking for
// get sorter proxy item (the item that's "visible") // get sorter proxy item (the item that's "visible")
QModelIndex sorted_index = sorter->mapFromSource(item); QModelIndex sorted_index = sorter.mapFromSource(item);
// retrieve its parent item // retrieve its parent item
QModelIndex hierarchy = sorted_index.parent(); QModelIndex hierarchy = sorted_index.parent();
@@ -954,8 +974,8 @@ bool Project::reveal_media(Media *media, QModelIndex parent) {
// select item (requires a QItemSelection object to select the whole row) // select item (requires a QItemSelection object to select the whole row)
QItemSelection row_select( QItemSelection row_select(
sorter->index(sorted_index.row(), 0, sorted_index.parent()), sorter.index(sorted_index.row(), 0, sorted_index.parent()),
sorter->index(sorted_index.row(), sorter->columnCount()-1, sorted_index.parent()) sorter.index(sorted_index.row(), sorter.columnCount()-1, sorted_index.parent())
); );
tree_view->selectionModel()->select(row_select, QItemSelectionModel::Select); tree_view->selectionModel()->select(row_select, QItemSelectionModel::Select);
@@ -1306,10 +1326,10 @@ void Project::update_view_type() {
switch (olive::CurrentConfig.project_view_type) { switch (olive::CurrentConfig.project_view_type) {
case olive::PROJECT_VIEW_TREE: case olive::PROJECT_VIEW_TREE:
sources_common->view = tree_view; sources_common.view = tree_view;
break; break;
case olive::PROJECT_VIEW_ICON: case olive::PROJECT_VIEW_ICON:
sources_common->view = icon_view; sources_common.view = icon_view;
break; break;
} }
} }
+14 -8
View File
@@ -55,7 +55,9 @@ class Project : public Panel {
Q_OBJECT Q_OBJECT
public: public:
explicit Project(QWidget *parent = nullptr); explicit Project(QWidget *parent = nullptr);
~Project();
void ConnectFilterToModel();
void DisconnectFilterToModel();
bool is_focused(); bool is_focused();
void clear(); void clear();
@@ -78,19 +80,14 @@ public:
QVector<Media*> list_all_project_sequences(); QVector<Media*> list_all_project_sequences();
SourceTable* tree_view;
SourceIconView* icon_view;
SourcesCommon* sources_common;
ProjectFilter* sorter;
QVector<Media*> last_imported_media; QVector<Media*> last_imported_media;
QModelIndexList get_current_selected(); QModelIndexList get_current_selected();
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1); void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
QWidget* toolbar_widget; bool IsToolbarVisible();
bool IsProjectWidget(QObject *child);
virtual void Retranslate() override; virtual void Retranslate() override;
protected: protected:
@@ -104,6 +101,8 @@ public slots:
void open_properties(); void open_properties();
void new_folder(); void new_folder();
void new_sequence(); void new_sequence();
void SetToolbarVisible(bool visible);
private: private:
void save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex &parent = QModelIndex()); void save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex &parent = QModelIndex());
int folder_id; int folder_id;
@@ -115,6 +114,13 @@ private:
QWidget* icon_view_container; QWidget* icon_view_container;
QPushButton* directory_up; QPushButton* directory_up;
QLineEdit* toolbar_search; QLineEdit* toolbar_search;
QWidget* toolbar_widget;
SourceTable* tree_view;
SourceIconView* icon_view;
ProjectFilter sorter;
SourcesCommon sources_common;
private slots: private slots:
void update_view_type(); void update_view_type();
void set_icon_view(); void set_icon_view();
+5 -1
View File
@@ -875,7 +875,11 @@ void Viewer::timer_update() {
previous_playhead = seq->playhead; previous_playhead = seq->playhead;
seq->playhead = qMax(0, qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate * playback_speed))); seq->playhead = qMax(0, qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate * playback_speed)));
if (olive::CurrentConfig.seek_also_selects) panel_timeline->select_from_playhead();
if (olive::CurrentConfig.seek_also_selects) {
panel_timeline->select_from_playhead();
}
update_parents(olive::CurrentConfig.seek_also_selects); update_parents(olive::CurrentConfig.seek_also_selects);
if (playing) { if (playing) {
+8 -7
View File
@@ -47,9 +47,10 @@
#include "ui/menu.h" #include "ui/menu.h"
#include "undo/undostack.h" #include "undo/undostack.h"
SourcesCommon::SourcesCommon(Project* parent) : SourcesCommon::SourcesCommon(Project* parent, ProjectFilter &sort_filter) :
editing_item(nullptr), editing_item(nullptr),
project_parent(parent) project_parent(parent),
sort_filter_(sort_filter)
{ {
rename_timer.setInterval(1000); rename_timer.setInterval(1000);
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval())); connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
@@ -97,13 +98,13 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
QAction* toolbar_action = view_menu->addAction(tr("Show Toolbar")); QAction* toolbar_action = view_menu->addAction(tr("Show Toolbar"));
toolbar_action->setCheckable(true); toolbar_action->setCheckable(true);
toolbar_action->setChecked(project_parent->toolbar_widget->isVisible()); toolbar_action->setChecked(project_parent->IsToolbarVisible());
connect(toolbar_action, SIGNAL(triggered(bool)), project_parent->toolbar_widget, SLOT(setVisible(bool))); connect(toolbar_action, SIGNAL(triggered(bool)), project_parent, SLOT(SetToolbarVisible(bool)));
QAction* show_sequences = view_menu->addAction(tr("Show Sequences")); QAction* show_sequences = view_menu->addAction(tr("Show Sequences"));
show_sequences->setCheckable(true); show_sequences->setCheckable(true);
show_sequences->setChecked(panel_project->sorter->get_show_sequences()); show_sequences->setChecked(sort_filter_.get_show_sequences());
connect(show_sequences, SIGNAL(triggered(bool)), panel_project->sorter, SLOT(set_show_sequences(bool))); connect(show_sequences, SIGNAL(triggered(bool)), &sort_filter_, SLOT(set_show_sequences(bool)));
if (items.size() > 0) { if (items.size() > 0) {
if (items.size() == 1) { if (items.size() == 1) {
@@ -282,7 +283,7 @@ void SourcesCommon::dropEvent(QWidget* parent,
bool replace = false; bool replace = false;
if (urls.size() == 1 if (urls.size() == 1
&& drop_item.isValid() && drop_item.isValid()
&& (m != nullptr && m->get_type() == MEDIA_TYPE_FOOTAGE) && m->get_type() == MEDIA_TYPE_FOOTAGE
&& !QFileInfo(paths.at(0)).isDir() && !QFileInfo(paths.at(0)).isDir()
&& olive::CurrentConfig.drop_on_media_to_replace && olive::CurrentConfig.drop_on_media_to_replace
&& QMessageBox::question( && QMessageBox::question(
+4 -1
View File
@@ -26,6 +26,7 @@
#include <QVector> #include <QVector>
#include "project/footage.h" #include "project/footage.h"
#include "project/projectfilter.h"
class Project; class Project;
class QMouseEvent; class QMouseEvent;
@@ -36,7 +37,7 @@ class QDropEvent;
class SourcesCommon : public QObject { class SourcesCommon : public QObject {
Q_OBJECT Q_OBJECT
public: public:
SourcesCommon(Project *parent); SourcesCommon(Project *parent, ProjectFilter& sort_filter);
QAbstractItemView* view; QAbstractItemView* view;
void show_context_menu(QWidget* parent, const QModelIndexList &items); void show_context_menu(QWidget* parent, const QModelIndexList &items);
@@ -66,6 +67,8 @@ private:
// we cache the selected footage items for open_create_proxy_dialog() // we cache the selected footage items for open_create_proxy_dialog()
QVector<Media*> cached_selected_footage; QVector<Media*> cached_selected_footage;
ProjectFilter& sort_filter_;
}; };
#endif // SOURCESCOMMON_H #endif // SOURCESCOMMON_H
+2 -4
View File
@@ -391,16 +391,14 @@ bool MainWindow::load_css_from_file(const QString &fn) {
void MainWindow::Restyle() void MainWindow::Restyle()
{ {
// Set up UI style // Set up UI style
if (olive::styling::UseNativeUI()) { if (!olive::styling::UseNativeUI()) {
qApp->setStyle(QStyleFactory::create(""));
} else {
qApp->setStyle(QStyleFactory::create("Fusion")); qApp->setStyle(QStyleFactory::create("Fusion"));
// Set up whether to load custom CSS or default CSS+palette // Set up whether to load custom CSS or default CSS+palette
if (!olive::CurrentConfig.css_path.isEmpty() if (!olive::CurrentConfig.css_path.isEmpty()
&& load_css_from_file(olive::CurrentConfig.css_path)) { && load_css_from_file(olive::CurrentConfig.css_path)) {
setPalette(QPalette()); qApp->setPalette(qApp->style()->standardPalette());
} else { } else {
+8 -6
View File
@@ -27,7 +27,9 @@
#include "project/sourcescommon.h" #include "project/sourcescommon.h"
#include "global/debug.h" #include "global/debug.h"
SourceIconView::SourceIconView(QWidget *parent) : QListView(parent) { SourceIconView::SourceIconView(SourcesCommon &commons) :
commons_(commons)
{
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
setResizeMode(QListView::Adjust); setResizeMode(QListView::Adjust);
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
@@ -36,17 +38,17 @@ SourceIconView::SourceIconView(QWidget *parent) : QListView(parent) {
} }
void SourceIconView::show_context_menu() { void SourceIconView::show_context_menu() {
project_parent->sources_common->show_context_menu(this, selectedIndexes()); commons_.show_context_menu(this, selectedIndexes());
} }
void SourceIconView::item_click(const QModelIndex& index) { void SourceIconView::item_click(const QModelIndex& index) {
if (selectedIndexes().size() == 1 && index.column() == 0) { if (selectedIndexes().size() == 1 && index.column() == 0) {
project_parent->sources_common->item_click(project_parent->item_to_media(index), index); commons_.item_click(project_parent->item_to_media(index), index);
} }
} }
void SourceIconView::mousePressEvent(QMouseEvent* event) { void SourceIconView::mousePressEvent(QMouseEvent* event) {
project_parent->sources_common->mousePressEvent(event); commons_.mousePressEvent(event);
if (!indexAt(event->pos()).isValid()) selectionModel()->clear(); if (!indexAt(event->pos()).isValid()) selectionModel()->clear();
QListView::mousePressEvent(event); QListView::mousePressEvent(event);
} }
@@ -70,7 +72,7 @@ void SourceIconView::dragMoveEvent(QDragMoveEvent *event) {
void SourceIconView::dropEvent(QDropEvent* event) { void SourceIconView::dropEvent(QDropEvent* event) {
QModelIndex drop_item = indexAt(event->pos()); QModelIndex drop_item = indexAt(event->pos());
if (!drop_item.isValid()) drop_item = rootIndex(); if (!drop_item.isValid()) drop_item = rootIndex();
project_parent->sources_common->dropEvent(this, event, drop_item, selectedIndexes()); commons_.dropEvent(this, event, drop_item, selectedIndexes());
} }
void SourceIconView::mouseDoubleClickEvent(QMouseEvent *) { void SourceIconView::mouseDoubleClickEvent(QMouseEvent *) {
@@ -84,6 +86,6 @@ void SourceIconView::mouseDoubleClickEvent(QMouseEvent *) {
} }
} }
if (default_behavior) { if (default_behavior) {
project_parent->sources_common->mouseDoubleClickEvent(selectedIndexes()); commons_.mouseDoubleClickEvent(selectedIndexes());
} }
} }
+15 -11
View File
@@ -23,24 +23,28 @@
#include <QListView> #include <QListView>
#include "project/sourcescommon.h"
class Project; class Project;
class SourceIconView : public QListView { class SourceIconView : public QListView {
Q_OBJECT Q_OBJECT
public: public:
SourceIconView(QWidget* parent = 0); SourceIconView(SourcesCommon& commons);
Project* project_parent; Project* project_parent;
void mousePressEvent(QMouseEvent* event); void mousePressEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent* event); void dropEvent(QDropEvent* event);
signals: signals:
void changed_root(); void changed_root();
private slots: private slots:
void show_context_menu(); void show_context_menu();
void item_click(const QModelIndex& index); void item_click(const QModelIndex& index);
private:
SourcesCommon& commons_;
}; };
#endif // SOURCEICONVIEW_H #endif // SOURCEICONVIEW_H
+6 -6
View File
@@ -45,7 +45,7 @@
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
SourceTable::SourceTable(QWidget* parent) : QTreeView(parent) { SourceTable::SourceTable(SourcesCommon& commons) : commons_(commons) {
setSortingEnabled(true); setSortingEnabled(true);
setAcceptDrops(true); setAcceptDrops(true);
sortByColumn(0, Qt::AscendingOrder); sortByColumn(0, Qt::AscendingOrder);
@@ -58,22 +58,22 @@ SourceTable::SourceTable(QWidget* parent) : QTreeView(parent) {
} }
void SourceTable::show_context_menu() { void SourceTable::show_context_menu() {
project_parent->sources_common->show_context_menu(this, selectionModel()->selectedRows()); commons_.show_context_menu(this, selectionModel()->selectedRows());
} }
void SourceTable::item_click(const QModelIndex& index) { void SourceTable::item_click(const QModelIndex& index) {
if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) { if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) {
project_parent->sources_common->item_click(project_parent->item_to_media(index), index); commons_.item_click(project_parent->item_to_media(index), index);
} }
} }
void SourceTable::mousePressEvent(QMouseEvent* event) { void SourceTable::mousePressEvent(QMouseEvent* event) {
project_parent->sources_common->mousePressEvent(event); commons_.mousePressEvent(event);
QTreeView::mousePressEvent(event); QTreeView::mousePressEvent(event);
} }
void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) { void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) {
project_parent->sources_common->mouseDoubleClickEvent(selectionModel()->selectedRows()); commons_.mouseDoubleClickEvent(selectionModel()->selectedRows());
} }
void SourceTable::dragEnterEvent(QDragEnterEvent *event) { void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
@@ -93,5 +93,5 @@ void SourceTable::dragMoveEvent(QDragMoveEvent *event) {
} }
void SourceTable::dropEvent(QDropEvent* event) { void SourceTable::dropEvent(QDropEvent* event) {
project_parent->sources_common->dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows()); commons_.dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows());
} }
+5 -1
View File
@@ -25,6 +25,8 @@
#include <QTimer> #include <QTimer>
#include <QUndoCommand> #include <QUndoCommand>
#include "project/sourcescommon.h"
class Project; class Project;
class Media; class Media;
@@ -32,7 +34,7 @@ class SourceTable : public QTreeView
{ {
Q_OBJECT Q_OBJECT
public: public:
SourceTable(QWidget* parent = 0); SourceTable(SourcesCommon& commons);
Project* project_parent; Project* project_parent;
protected: protected:
void mousePressEvent(QMouseEvent*); void mousePressEvent(QMouseEvent*);
@@ -43,6 +45,8 @@ protected:
private slots: private slots:
void item_click(const QModelIndex& index); void item_click(const QModelIndex& index);
void show_context_menu(); void show_context_menu();
private:
SourcesCommon& commons_;
}; };
#endif // SOURCETABLE_H #endif // SOURCETABLE_H
+1 -1
View File
@@ -240,7 +240,7 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) {
QVector<olive::timeline::MediaImportData> media_list; QVector<olive::timeline::MediaImportData> media_list;
panel_timeline->importing_files = false; panel_timeline->importing_files = false;
if (event->source() == panel_project->tree_view || event->source() == panel_project->icon_view) { if (panel_project->IsProjectWidget(event->source())) {
QModelIndexList items = panel_project->get_current_selected(); QModelIndexList items = panel_project->get_current_selected();
media_list.resize(items.size()); media_list.resize(items.size());
for (int i=0;i<items.size();i++) { for (int i=0;i<items.size();i++) {