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 -4
View File
@@ -391,16 +391,14 @@ bool MainWindow::load_css_from_file(const QString &fn) {
void MainWindow::Restyle()
{
// Set up UI style
if (olive::styling::UseNativeUI()) {
qApp->setStyle(QStyleFactory::create(""));
} else {
if (!olive::styling::UseNativeUI()) {
qApp->setStyle(QStyleFactory::create("Fusion"));
// Set up whether to load custom CSS or default CSS+palette
if (!olive::CurrentConfig.css_path.isEmpty()
&& load_css_from_file(olive::CurrentConfig.css_path)) {
setPalette(QPalette());
qApp->setPalette(qApp->style()->standardPalette());
} else {
+8 -6
View File
@@ -27,7 +27,9 @@
#include "project/sourcescommon.h"
#include "global/debug.h"
SourceIconView::SourceIconView(QWidget *parent) : QListView(parent) {
SourceIconView::SourceIconView(SourcesCommon &commons) :
commons_(commons)
{
setSelectionMode(QAbstractItemView::ExtendedSelection);
setResizeMode(QListView::Adjust);
setContextMenuPolicy(Qt::CustomContextMenu);
@@ -36,17 +38,17 @@ SourceIconView::SourceIconView(QWidget *parent) : QListView(parent) {
}
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) {
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) {
project_parent->sources_common->mousePressEvent(event);
commons_.mousePressEvent(event);
if (!indexAt(event->pos()).isValid()) selectionModel()->clear();
QListView::mousePressEvent(event);
}
@@ -70,7 +72,7 @@ void SourceIconView::dragMoveEvent(QDragMoveEvent *event) {
void SourceIconView::dropEvent(QDropEvent* event) {
QModelIndex drop_item = indexAt(event->pos());
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 *) {
@@ -84,6 +86,6 @@ void SourceIconView::mouseDoubleClickEvent(QMouseEvent *) {
}
}
if (default_behavior) {
project_parent->sources_common->mouseDoubleClickEvent(selectedIndexes());
commons_.mouseDoubleClickEvent(selectedIndexes());
}
}
+15 -11
View File
@@ -23,24 +23,28 @@
#include <QListView>
#include "project/sourcescommon.h"
class Project;
class SourceIconView : public QListView {
Q_OBJECT
Q_OBJECT
public:
SourceIconView(QWidget* parent = 0);
Project* project_parent;
SourceIconView(SourcesCommon& commons);
Project* project_parent;
void mousePressEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent* event);
void mousePressEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent* event);
signals:
void changed_root();
void changed_root();
private slots:
void show_context_menu();
void item_click(const QModelIndex& index);
void show_context_menu();
void item_click(const QModelIndex& index);
private:
SourcesCommon& commons_;
};
#endif // SOURCEICONVIEW_H
+6 -6
View File
@@ -45,7 +45,7 @@
#include <QDir>
#include <QProcess>
SourceTable::SourceTable(QWidget* parent) : QTreeView(parent) {
SourceTable::SourceTable(SourcesCommon& commons) : commons_(commons) {
setSortingEnabled(true);
setAcceptDrops(true);
sortByColumn(0, Qt::AscendingOrder);
@@ -58,22 +58,22 @@ SourceTable::SourceTable(QWidget* parent) : QTreeView(parent) {
}
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) {
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) {
project_parent->sources_common->mousePressEvent(event);
commons_.mousePressEvent(event);
QTreeView::mousePressEvent(event);
}
void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) {
project_parent->sources_common->mouseDoubleClickEvent(selectionModel()->selectedRows());
commons_.mouseDoubleClickEvent(selectionModel()->selectedRows());
}
void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
@@ -93,5 +93,5 @@ void SourceTable::dragMoveEvent(QDragMoveEvent *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 <QUndoCommand>
#include "project/sourcescommon.h"
class Project;
class Media;
@@ -32,7 +34,7 @@ class SourceTable : public QTreeView
{
Q_OBJECT
public:
SourceTable(QWidget* parent = 0);
SourceTable(SourcesCommon& commons);
Project* project_parent;
protected:
void mousePressEvent(QMouseEvent*);
@@ -43,6 +45,8 @@ protected:
private slots:
void item_click(const QModelIndex& index);
void show_context_menu();
private:
SourcesCommon& commons_;
};
#endif // SOURCETABLE_H
+1 -1
View File
@@ -240,7 +240,7 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) {
QVector<olive::timeline::MediaImportData> media_list;
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();
media_list.resize(items.size());
for (int i=0;i<items.size();i++) {