stash SVGs that are continuously reused
This commit is contained in:
@@ -302,27 +302,6 @@ void OliveGlobal::open_project_worker(const QString& fn, bool autorecovery) {
|
||||
olive::UndoStack.clear();
|
||||
}
|
||||
|
||||
QIcon OliveGlobal::CreateIconFromSVG(const QString &path)
|
||||
{
|
||||
QIcon icon;
|
||||
|
||||
QPixmap normal(path);
|
||||
icon.addPixmap(normal, QIcon::Normal, QIcon::On);
|
||||
|
||||
QPixmap disabled(normal.size());
|
||||
disabled.fill(Qt::transparent);
|
||||
|
||||
// draw semi-transparent version of icon for the disabled variant
|
||||
QPainter p(&disabled);
|
||||
p.setOpacity(0.5);
|
||||
p.drawPixmap(0, 0, normal);
|
||||
p.end();
|
||||
|
||||
icon.addPixmap(disabled, QIcon::Disabled, QIcon::On);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
void OliveGlobal::undo() {
|
||||
// workaround to prevent crash (and also users should never need to do this)
|
||||
if (!panel_timeline->importing) {
|
||||
|
||||
@@ -115,15 +115,6 @@ public:
|
||||
*/
|
||||
void load_translation_from_config();
|
||||
|
||||
/**
|
||||
* @brief Converts an SVG into a QIcon with a semi-transparent for the QIcon::Disabled property
|
||||
*
|
||||
* @param path
|
||||
*
|
||||
* Path to SVG file
|
||||
*/
|
||||
static QIcon CreateIconFromSVG(const QString& path);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Undo user's last action
|
||||
|
||||
+9
-8
@@ -37,6 +37,7 @@
|
||||
#include "io/clipboard.h"
|
||||
#include "ui/sourcetable.h"
|
||||
#include "ui/sourceiconview.h"
|
||||
#include "ui/icons.h"
|
||||
#include "ui/menuhelper.h"
|
||||
#include "ui/mediaiconservice.h"
|
||||
#include "project/sourcescommon.h"
|
||||
@@ -102,31 +103,31 @@ Project::Project(QWidget *parent) :
|
||||
toolbar->setSpacing(0);
|
||||
|
||||
QPushButton* toolbar_new = new QPushButton();
|
||||
toolbar_new->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/add-button.svg")));
|
||||
toolbar_new->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/add-button.svg")));
|
||||
toolbar_new->setToolTip("New");
|
||||
connect(toolbar_new, SIGNAL(clicked(bool)), this, SLOT(make_new_menu()));
|
||||
toolbar->addWidget(toolbar_new);
|
||||
|
||||
QPushButton* toolbar_open = new QPushButton();
|
||||
toolbar_open->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/open.svg")));
|
||||
toolbar_open->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/open.svg")));
|
||||
toolbar_open->setToolTip("Open Project");
|
||||
connect(toolbar_open, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(open_project()));
|
||||
toolbar->addWidget(toolbar_open);
|
||||
|
||||
QPushButton* toolbar_save = new QPushButton();
|
||||
toolbar_save->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/save.svg")));
|
||||
toolbar_save->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/save.svg")));
|
||||
toolbar_save->setToolTip("Save Project");
|
||||
connect(toolbar_save, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(save_project()));
|
||||
toolbar->addWidget(toolbar_save);
|
||||
|
||||
QPushButton* toolbar_undo = new QPushButton();
|
||||
toolbar_undo->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/undo.svg")));
|
||||
toolbar_undo->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/undo.svg")));
|
||||
toolbar_undo->setToolTip("Undo");
|
||||
connect(toolbar_undo, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(undo()));
|
||||
toolbar->addWidget(toolbar_undo);
|
||||
|
||||
QPushButton* toolbar_redo = new QPushButton();
|
||||
toolbar_redo->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/redo.svg")));
|
||||
toolbar_redo->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/redo.svg")));
|
||||
toolbar_redo->setToolTip("Redo");
|
||||
connect(toolbar_redo, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(redo()));
|
||||
toolbar->addWidget(toolbar_redo);
|
||||
@@ -137,13 +138,13 @@ Project::Project(QWidget *parent) :
|
||||
toolbar->addWidget(toolbar_search);
|
||||
|
||||
QPushButton* toolbar_tree_view = new QPushButton();
|
||||
toolbar_tree_view->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/treeview.svg")));
|
||||
toolbar_tree_view->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/treeview.svg")));
|
||||
toolbar_tree_view->setToolTip("Tree View");
|
||||
connect(toolbar_tree_view, SIGNAL(clicked(bool)), this, SLOT(set_tree_view()));
|
||||
toolbar->addWidget(toolbar_tree_view);
|
||||
|
||||
QPushButton* toolbar_icon_view = new QPushButton();
|
||||
toolbar_icon_view->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/iconview.svg")));
|
||||
toolbar_icon_view->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/iconview.svg")));
|
||||
toolbar_icon_view->setToolTip("Icon View");
|
||||
connect(toolbar_icon_view, SIGNAL(clicked(bool)), this, SLOT(set_icon_view()));
|
||||
toolbar->addWidget(toolbar_icon_view);
|
||||
@@ -174,7 +175,7 @@ Project::Project(QWidget *parent) :
|
||||
icon_view_controls->setSpacing(0);
|
||||
|
||||
directory_up = new QPushButton();
|
||||
directory_up->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/dirup.svg")));
|
||||
directory_up->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/dirup.svg")));
|
||||
directory_up->setEnabled(false);
|
||||
icon_view_controls->addWidget(directory_up);
|
||||
|
||||
|
||||
+14
-13
@@ -26,6 +26,7 @@
|
||||
#include "project/projectelements.h"
|
||||
|
||||
#include "ui/timelinewidget.h"
|
||||
#include "ui/icons.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "rendering/audio.h"
|
||||
#include "rendering/cacher.h"
|
||||
@@ -1870,84 +1871,84 @@ void Timeline::setup_ui() {
|
||||
tool_buttons_layout->setMargin(0);
|
||||
|
||||
toolArrowButton = new QPushButton();
|
||||
toolArrowButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/arrow.svg")));
|
||||
toolArrowButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/arrow.svg")));
|
||||
toolArrowButton->setCheckable(true);
|
||||
toolArrowButton->setProperty("tool", TIMELINE_TOOL_POINTER);
|
||||
connect(toolArrowButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolArrowButton);
|
||||
|
||||
toolEditButton = new QPushButton();
|
||||
toolEditButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/beam.svg")));
|
||||
toolEditButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/beam.svg")));
|
||||
toolEditButton->setCheckable(true);
|
||||
toolEditButton->setProperty("tool", TIMELINE_TOOL_EDIT);
|
||||
connect(toolEditButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolEditButton);
|
||||
|
||||
toolRippleButton = new QPushButton();
|
||||
toolRippleButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/ripple.svg")));
|
||||
toolRippleButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/ripple.svg")));
|
||||
toolRippleButton->setCheckable(true);
|
||||
toolRippleButton->setProperty("tool", TIMELINE_TOOL_RIPPLE);
|
||||
connect(toolRippleButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolRippleButton);
|
||||
|
||||
toolRazorButton = new QPushButton();
|
||||
toolRazorButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/razor.svg")));
|
||||
toolRazorButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/razor.svg")));
|
||||
toolRazorButton->setCheckable(true);
|
||||
toolRazorButton->setProperty("tool", TIMELINE_TOOL_RAZOR);
|
||||
connect(toolRazorButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolRazorButton);
|
||||
|
||||
toolSlipButton = new QPushButton();
|
||||
toolSlipButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/slip.svg")));
|
||||
toolSlipButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/slip.svg")));
|
||||
toolSlipButton->setCheckable(true);
|
||||
toolSlipButton->setProperty("tool", TIMELINE_TOOL_SLIP);
|
||||
connect(toolSlipButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolSlipButton);
|
||||
|
||||
toolSlideButton = new QPushButton();
|
||||
toolSlideButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/slide.svg")));
|
||||
toolSlideButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/slide.svg")));
|
||||
toolSlideButton->setCheckable(true);
|
||||
toolSlideButton->setProperty("tool", TIMELINE_TOOL_SLIDE);
|
||||
connect(toolSlideButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolSlideButton);
|
||||
|
||||
toolHandButton = new QPushButton();
|
||||
toolHandButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/hand.svg")));
|
||||
toolHandButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/hand.svg")));
|
||||
toolHandButton->setCheckable(true);
|
||||
|
||||
toolHandButton->setProperty("tool", TIMELINE_TOOL_HAND);
|
||||
connect(toolHandButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolHandButton);
|
||||
toolTransitionButton = new QPushButton();
|
||||
toolTransitionButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/transition-tool.svg")));
|
||||
toolTransitionButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/transition-tool.svg")));
|
||||
toolTransitionButton->setCheckable(true);
|
||||
connect(toolTransitionButton, SIGNAL(clicked(bool)), this, SLOT(transition_tool_click()));
|
||||
tool_buttons_layout->addWidget(toolTransitionButton);
|
||||
|
||||
snappingButton = new QPushButton();
|
||||
snappingButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/magnet.svg")));
|
||||
snappingButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/magnet.svg")));
|
||||
snappingButton->setCheckable(true);
|
||||
snappingButton->setChecked(true);
|
||||
connect(snappingButton, SIGNAL(toggled(bool)), this, SLOT(snapping_clicked(bool)));
|
||||
tool_buttons_layout->addWidget(snappingButton);
|
||||
|
||||
zoomInButton = new QPushButton();
|
||||
zoomInButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/zoomin.svg")));
|
||||
zoomInButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/zoomin.svg")));
|
||||
connect(zoomInButton, SIGNAL(clicked(bool)), this, SLOT(zoom_in()));
|
||||
tool_buttons_layout->addWidget(zoomInButton);
|
||||
|
||||
zoomOutButton = new QPushButton();
|
||||
zoomOutButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/zoomout.svg")));
|
||||
zoomOutButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/zoomout.svg")));
|
||||
connect(zoomOutButton, SIGNAL(clicked(bool)), this, SLOT(zoom_out()));
|
||||
tool_buttons_layout->addWidget(zoomOutButton);
|
||||
|
||||
recordButton = new QPushButton();
|
||||
recordButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/record.svg")));
|
||||
recordButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/record.svg")));
|
||||
connect(recordButton, SIGNAL(clicked(bool)), this, SLOT(record_btn_click()));
|
||||
tool_buttons_layout->addWidget(recordButton);
|
||||
|
||||
addButton = new QPushButton();
|
||||
addButton->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/add-button.svg")));
|
||||
addButton->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/add-button.svg")));
|
||||
connect(addButton, SIGNAL(clicked()), this, SLOT(add_btn_click()));
|
||||
tool_buttons_layout->addWidget(addButton);
|
||||
|
||||
|
||||
+11
-9
@@ -37,6 +37,7 @@
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/timelineheader.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "ui/icons.h"
|
||||
#include "oliveglobal.h"
|
||||
#include "debug.h"
|
||||
|
||||
@@ -669,30 +670,27 @@ void Viewer::setup_ui() {
|
||||
playback_control_layout->setMargin(0);
|
||||
|
||||
go_to_start_button = new QPushButton();
|
||||
go_to_start_button->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/prev.svg")));
|
||||
go_to_start_button->setIcon(olive::icon::ViewerGoToStart);
|
||||
connect(go_to_start_button, SIGNAL(clicked(bool)), this, SLOT(go_to_in()));
|
||||
playback_control_layout->addWidget(go_to_start_button);
|
||||
|
||||
prev_frame_button = new QPushButton();
|
||||
prev_frame_button->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/rew.svg")));
|
||||
prev_frame_button->setIcon(olive::icon::ViewerPrevFrame);
|
||||
connect(prev_frame_button, SIGNAL(clicked(bool)), this, SLOT(previous_frame()));
|
||||
playback_control_layout->addWidget(prev_frame_button);
|
||||
|
||||
play_icon_ = OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/play.svg"));
|
||||
pause_icon_ = QPixmap(":/icons/pause.svg");
|
||||
|
||||
play_button = new QPushButton();
|
||||
play_button->setIcon(play_icon_);
|
||||
play_button->setIcon(olive::icon::ViewerPlay);
|
||||
connect(play_button, SIGNAL(clicked(bool)), this, SLOT(toggle_play()));
|
||||
playback_control_layout->addWidget(play_button);
|
||||
|
||||
next_frame_button = new QPushButton();
|
||||
next_frame_button->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/ff.svg")));
|
||||
next_frame_button->setIcon(olive::icon::ViewerNextFrame);
|
||||
connect(next_frame_button, SIGNAL(clicked(bool)), this, SLOT(next_frame()));
|
||||
playback_control_layout->addWidget(next_frame_button);
|
||||
|
||||
go_to_end_frame = new QPushButton();
|
||||
go_to_end_frame->setIcon(OliveGlobal::CreateIconFromSVG(QStringLiteral(":/icons/next.svg")));
|
||||
go_to_end_frame->setIcon(olive::icon::ViewerGoToEnd);
|
||||
connect(go_to_end_frame, SIGNAL(clicked(bool)), this, SLOT(go_to_out()));
|
||||
playback_control_layout->addWidget(go_to_end_frame);
|
||||
|
||||
@@ -737,6 +735,7 @@ void Viewer::set_media(Media* m) {
|
||||
seq->workarea_out = footage->out;
|
||||
}
|
||||
|
||||
// FIXME: Move this magic number to Config
|
||||
seq->frame_rate = 30;
|
||||
|
||||
if (footage->video_tracks.size() > 0) {
|
||||
@@ -750,6 +749,7 @@ void Viewer::set_media(Media* m) {
|
||||
c->set_timeline_in(0);
|
||||
c->set_timeline_out(footage->get_length_in_frames(seq->frame_rate));
|
||||
if (c->timeline_out() <= 0) {
|
||||
// FIXME: Move this magic number to Config
|
||||
c->set_timeline_out(150);
|
||||
}
|
||||
c->set_track(-1);
|
||||
@@ -757,6 +757,7 @@ void Viewer::set_media(Media* m) {
|
||||
c->refresh();
|
||||
seq->clips.append(c);
|
||||
} else {
|
||||
// FIXME: Move this magic number to Config
|
||||
seq->width = 1920;
|
||||
seq->height = 1080;
|
||||
}
|
||||
@@ -781,6 +782,7 @@ void Viewer::set_media(Media* m) {
|
||||
viewer_widget->frame_update();
|
||||
}
|
||||
} else {
|
||||
// FIXME: Move this magic number to Config
|
||||
seq->audio_frequency = 48000;
|
||||
}
|
||||
|
||||
@@ -907,5 +909,5 @@ void Viewer::set_sequence(bool main, SequencePtr s) {
|
||||
}
|
||||
|
||||
void Viewer::set_playpause_icon(bool play) {
|
||||
play_button->setIcon(play ? play_icon_ : pause_icon_);
|
||||
play_button->setIcon(play ? olive::icon::ViewerPlay : olive::icon::ViewerPause);
|
||||
}
|
||||
|
||||
@@ -142,9 +142,6 @@ private:
|
||||
long get_seq_in();
|
||||
long get_seq_out();
|
||||
|
||||
QIcon play_icon_;
|
||||
QIcon pause_icon_;
|
||||
|
||||
void setup_ui();
|
||||
|
||||
ResizableScrollBar* horizontal_bar;
|
||||
|
||||
+3
-2
@@ -26,6 +26,7 @@
|
||||
#include "io/config.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "panels/project.h"
|
||||
#include "ui/icons.h"
|
||||
#include "projectmodel.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -86,7 +87,7 @@ void Media::set_footage(FootagePtr f) {
|
||||
}
|
||||
|
||||
void Media::set_sequence(SequencePtr s) {
|
||||
set_icon(":/icons/sequence.svg");
|
||||
set_icon(olive::icon::MediaSequence);
|
||||
type = MEDIA_TYPE_SEQUENCE;
|
||||
object = VoidPtr(s);
|
||||
if (s != nullptr) update_tooltip();
|
||||
@@ -96,7 +97,7 @@ void Media::set_folder() {
|
||||
if (folder_name.isEmpty()) {
|
||||
folder_name = QCoreApplication::translate("Media", "New Folder");
|
||||
}
|
||||
set_icon(":/icons/folder.svg");
|
||||
set_icon(olive::icon::MediaFolder);
|
||||
type = MEDIA_TYPE_FOLDER;
|
||||
object = nullptr;
|
||||
}
|
||||
|
||||
+66
-68
@@ -20,8 +20,6 @@
|
||||
|
||||
#include "collapsiblewidget.h"
|
||||
|
||||
#include "ui/checkboxex.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
@@ -32,113 +30,113 @@
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ui/checkboxex.h"
|
||||
#include "ui/icons.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
selected = false;
|
||||
selected = false;
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
title_bar = new CollapsibleWidgetHeader(this);
|
||||
title_bar->setFocusPolicy(Qt::ClickFocus);
|
||||
title_bar->setAutoFillBackground(true);
|
||||
title_bar_layout = new QHBoxLayout(title_bar);
|
||||
title_bar_layout->setMargin(5);
|
||||
enabled_check = new CheckboxEx(title_bar);
|
||||
enabled_check->setChecked(true);
|
||||
header = new QLabel(title_bar);
|
||||
collapse_button = new QPushButton(title_bar);
|
||||
collapse_button->setIconSize(collapse_button->iconSize()*0.5);
|
||||
collapse_button->setStyleSheet("QPushButton { border: none; }");
|
||||
setText(tr("<untitled>"));
|
||||
title_bar_layout->addWidget(collapse_button);
|
||||
title_bar_layout->addWidget(enabled_check);
|
||||
title_bar_layout->addWidget(header);
|
||||
title_bar_layout->addStretch();
|
||||
layout->addWidget(title_bar);
|
||||
title_bar = new CollapsibleWidgetHeader(this);
|
||||
title_bar->setFocusPolicy(Qt::ClickFocus);
|
||||
title_bar->setAutoFillBackground(true);
|
||||
title_bar_layout = new QHBoxLayout(title_bar);
|
||||
title_bar_layout->setMargin(5);
|
||||
enabled_check = new CheckboxEx(title_bar);
|
||||
enabled_check->setChecked(true);
|
||||
header = new QLabel(title_bar);
|
||||
collapse_button = new QPushButton(title_bar);
|
||||
collapse_button->setIconSize(collapse_button->iconSize()*0.5);
|
||||
collapse_button->setStyleSheet("QPushButton { border: none; }");
|
||||
setText(tr("<untitled>"));
|
||||
title_bar_layout->addWidget(collapse_button);
|
||||
title_bar_layout->addWidget(enabled_check);
|
||||
title_bar_layout->addWidget(header);
|
||||
title_bar_layout->addStretch();
|
||||
layout->addWidget(title_bar);
|
||||
|
||||
tri_down_ = QIcon(":/icons/tri-down.svg");
|
||||
tri_right_ = QIcon(":/icons/tri-right.svg");
|
||||
connect(title_bar, SIGNAL(select(bool, bool)), this, SLOT(header_click(bool, bool)));
|
||||
|
||||
connect(title_bar, SIGNAL(select(bool, bool)), this, SLOT(header_click(bool, bool)));
|
||||
set_button_icon(true);
|
||||
|
||||
set_button_icon(true);
|
||||
|
||||
contents = nullptr;
|
||||
contents = nullptr;
|
||||
}
|
||||
|
||||
void CollapsibleWidget::header_click(bool s, bool deselect) {
|
||||
selected = s;
|
||||
title_bar->selected = s;
|
||||
if (s) {
|
||||
QPalette p = title_bar->palette();
|
||||
p.setColor(QPalette::Background, QColor(255, 255, 255, 64));
|
||||
title_bar->setPalette(p);
|
||||
} else {
|
||||
title_bar->setPalette(palette());
|
||||
}
|
||||
if (deselect) emit deselect_others(this);
|
||||
selected = s;
|
||||
title_bar->selected = s;
|
||||
if (s) {
|
||||
QPalette p = title_bar->palette();
|
||||
p.setColor(QPalette::Background, QColor(255, 255, 255, 64));
|
||||
title_bar->setPalette(p);
|
||||
} else {
|
||||
title_bar->setPalette(palette());
|
||||
}
|
||||
if (deselect) emit deselect_others(this);
|
||||
}
|
||||
|
||||
bool CollapsibleWidget::is_focused() {
|
||||
if (hasFocus()) return true;
|
||||
return title_bar->hasFocus();
|
||||
if (hasFocus()) return true;
|
||||
return title_bar->hasFocus();
|
||||
}
|
||||
|
||||
bool CollapsibleWidget::is_expanded() {
|
||||
return contents->isVisible();
|
||||
return contents->isVisible();
|
||||
}
|
||||
|
||||
void CollapsibleWidget::set_button_icon(bool open) {
|
||||
collapse_button->setIcon(open ? tri_down_ : tri_right_);
|
||||
collapse_button->setIcon(open ? olive::icon::DownArrow : olive::icon::RightArrow);
|
||||
}
|
||||
|
||||
void CollapsibleWidget::setContents(QWidget* c) {
|
||||
bool existing = (contents != nullptr);
|
||||
contents = c;
|
||||
if (!existing) {
|
||||
layout->addWidget(contents);
|
||||
connect(enabled_check, SIGNAL(toggled(bool)), this, SLOT(on_enabled_change(bool)));
|
||||
connect(collapse_button, SIGNAL(clicked()), this, SLOT(on_visible_change()));
|
||||
}
|
||||
bool existing = (contents != nullptr);
|
||||
contents = c;
|
||||
if (!existing) {
|
||||
layout->addWidget(contents);
|
||||
connect(enabled_check, SIGNAL(toggled(bool)), this, SLOT(on_enabled_change(bool)));
|
||||
connect(collapse_button, SIGNAL(clicked()), this, SLOT(on_visible_change()));
|
||||
}
|
||||
}
|
||||
|
||||
void CollapsibleWidget::setText(const QString &s) {
|
||||
header->setText(s);
|
||||
header->setText(s);
|
||||
}
|
||||
|
||||
void CollapsibleWidget::on_enabled_change(bool b) {
|
||||
contents->setEnabled(b);
|
||||
contents->setEnabled(b);
|
||||
}
|
||||
|
||||
void CollapsibleWidget::on_visible_change() {
|
||||
contents->setVisible(!contents->isVisible());
|
||||
set_button_icon(contents->isVisible());
|
||||
emit visibleChanged();
|
||||
contents->setVisible(!contents->isVisible());
|
||||
set_button_icon(contents->isVisible());
|
||||
emit visibleChanged();
|
||||
}
|
||||
|
||||
CollapsibleWidgetHeader::CollapsibleWidgetHeader(QWidget* parent) : QWidget(parent), selected(false) {
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
}
|
||||
|
||||
void CollapsibleWidgetHeader::mousePressEvent(QMouseEvent* event) {
|
||||
if (selected) {
|
||||
if ((event->modifiers() & Qt::ShiftModifier)) {
|
||||
selected = false;
|
||||
emit select(selected, false);
|
||||
}
|
||||
} else {
|
||||
selected = true;
|
||||
emit select(selected, !(event->modifiers() & Qt::ShiftModifier));
|
||||
}
|
||||
if (selected) {
|
||||
if ((event->modifiers() & Qt::ShiftModifier)) {
|
||||
selected = false;
|
||||
emit select(selected, false);
|
||||
}
|
||||
} else {
|
||||
selected = true;
|
||||
emit select(selected, !(event->modifiers() & Qt::ShiftModifier));
|
||||
}
|
||||
}
|
||||
|
||||
void CollapsibleWidgetHeader::paintEvent(QPaintEvent *event) {
|
||||
QWidget::paintEvent(event);
|
||||
QPainter p(this);
|
||||
QWidget::paintEvent(event);
|
||||
QPainter p(this);
|
||||
p.setPen(Qt::white);
|
||||
int line_y = height() - 1;
|
||||
int line_y = height() - 1;
|
||||
p.drawLine(0, line_y, width(), line_y);
|
||||
}
|
||||
|
||||
@@ -66,9 +66,6 @@ private:
|
||||
QHBoxLayout* title_bar_layout;
|
||||
void set_button_icon(bool open);
|
||||
|
||||
QIcon tri_right_;
|
||||
QIcon tri_down_;
|
||||
|
||||
signals:
|
||||
void deselect_others(QWidget*);
|
||||
void visibleChanged();
|
||||
|
||||
@@ -1,3 +1,69 @@
|
||||
#include "icons.h"
|
||||
|
||||
#include "oliveglobal.h"
|
||||
|
||||
QIcon olive::icon::LeftArrow;
|
||||
QIcon olive::icon::RightArrow;
|
||||
QIcon olive::icon::UpArrow;
|
||||
QIcon olive::icon::DownArrow;
|
||||
QIcon olive::icon::Diamond;
|
||||
QIcon olive::icon::Clock;
|
||||
|
||||
QIcon olive::icon::MediaVideo;
|
||||
QIcon olive::icon::MediaAudio;
|
||||
QIcon olive::icon::MediaImage;
|
||||
QIcon olive::icon::MediaError;
|
||||
QIcon olive::icon::MediaSequence;
|
||||
QIcon olive::icon::MediaFolder;
|
||||
|
||||
QIcon olive::icon::ViewerGoToStart;
|
||||
QIcon olive::icon::ViewerPrevFrame;
|
||||
QIcon olive::icon::ViewerPlay;
|
||||
QIcon olive::icon::ViewerPause;
|
||||
QIcon olive::icon::ViewerNextFrame;
|
||||
QIcon olive::icon::ViewerGoToEnd;
|
||||
|
||||
QIcon olive::icon::CreateIconFromSVG(const QString &path)
|
||||
{
|
||||
QIcon icon;
|
||||
|
||||
QPixmap normal(path);
|
||||
icon.addPixmap(normal, QIcon::Normal, QIcon::On);
|
||||
|
||||
QPixmap disabled(normal.size());
|
||||
disabled.fill(Qt::transparent);
|
||||
|
||||
// draw semi-transparent version of icon for the disabled variant
|
||||
QPainter p(&disabled);
|
||||
p.setOpacity(0.5);
|
||||
p.drawPixmap(0, 0, normal);
|
||||
p.end();
|
||||
|
||||
icon.addPixmap(disabled, QIcon::Disabled, QIcon::On);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
void olive::icon::Initialize()
|
||||
{
|
||||
LeftArrow = QIcon(":/icons/tri-left.svg");
|
||||
RightArrow = QIcon(":/icons/tri-right.svg");
|
||||
UpArrow = QIcon(":/icons/tri-up.svg");
|
||||
DownArrow = QIcon(":/icons/tri-down.svg");
|
||||
Diamond = QIcon(":/icons/diamond.svg");
|
||||
Clock = QIcon(":/icons/clock.svg");
|
||||
|
||||
MediaVideo = QIcon(":/icons/videosource.svg");
|
||||
MediaAudio = QIcon(":/icons/audiosource.svg");
|
||||
MediaImage = QIcon(":/icons/imagesource.svg");
|
||||
MediaError = QIcon(":/icons/error.svg");
|
||||
MediaSequence = QIcon(":/icons/sequence.svg");
|
||||
MediaFolder = QIcon(":/icons/folder.svg");
|
||||
|
||||
ViewerGoToStart = CreateIconFromSVG(QStringLiteral(":/icons/prev.svg"));
|
||||
ViewerPrevFrame = CreateIconFromSVG(QStringLiteral(":/icons/rew.svg"));
|
||||
ViewerPlay = CreateIconFromSVG(QStringLiteral(":/icons/play.svg"));
|
||||
ViewerPause = QPixmap(":/icons/pause.svg");
|
||||
ViewerNextFrame = CreateIconFromSVG(QStringLiteral(":/icons/ff.svg"));
|
||||
ViewerGoToEnd = CreateIconFromSVG(QStringLiteral(":/icons/next.svg"));
|
||||
}
|
||||
|
||||
+31
-3
@@ -5,9 +5,37 @@
|
||||
|
||||
namespace olive {
|
||||
namespace icon {
|
||||
extern QIcon KeyframeLeft;
|
||||
extern QIcon KeyframeSet;
|
||||
extern QIcon KeyframeRight;
|
||||
extern QIcon LeftArrow;
|
||||
extern QIcon RightArrow;
|
||||
extern QIcon UpArrow;
|
||||
extern QIcon DownArrow;
|
||||
extern QIcon Diamond;
|
||||
extern QIcon Clock;
|
||||
|
||||
extern QIcon MediaVideo;
|
||||
extern QIcon MediaAudio;
|
||||
extern QIcon MediaImage;
|
||||
extern QIcon MediaError;
|
||||
extern QIcon MediaSequence;
|
||||
extern QIcon MediaFolder;
|
||||
|
||||
extern QIcon ViewerGoToStart;
|
||||
extern QIcon ViewerPrevFrame;
|
||||
extern QIcon ViewerPlay;
|
||||
extern QIcon ViewerPause;
|
||||
extern QIcon ViewerNextFrame;
|
||||
extern QIcon ViewerGoToEnd;
|
||||
|
||||
void Initialize();
|
||||
|
||||
/**
|
||||
* @brief Converts an SVG into a QIcon with a semi-transparent for the QIcon::Disabled property
|
||||
*
|
||||
* @param path
|
||||
*
|
||||
* Path to SVG file
|
||||
*/
|
||||
QIcon CreateIconFromSVG(const QString &path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+43
-41
@@ -25,62 +25,64 @@
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "ui/icons.h"
|
||||
|
||||
KeyframeNavigator::KeyframeNavigator(QWidget *parent, bool addLeftPad) : QWidget(parent) {
|
||||
key_controls = new QHBoxLayout(this);
|
||||
key_controls->setSpacing(0);
|
||||
key_controls->setMargin(0);
|
||||
key_controls = new QHBoxLayout(this);
|
||||
key_controls->setSpacing(0);
|
||||
key_controls->setMargin(0);
|
||||
|
||||
if (addLeftPad) {
|
||||
key_controls->addStretch();
|
||||
}
|
||||
if (addLeftPad) {
|
||||
key_controls->addStretch();
|
||||
}
|
||||
|
||||
left_key_nav = new QPushButton(this);
|
||||
left_key_nav->setIcon(QIcon(":/icons/tri-left.svg"));
|
||||
left_key_nav->setIconSize(left_key_nav->iconSize()*0.5);
|
||||
left_key_nav->setVisible(false);
|
||||
key_controls->addWidget(left_key_nav);
|
||||
connect(left_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(goto_previous_key()));
|
||||
connect(left_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
left_key_nav = new QPushButton(this);
|
||||
left_key_nav->setIcon(olive::icon::LeftArrow);
|
||||
left_key_nav->setIconSize(left_key_nav->iconSize()*0.5);
|
||||
left_key_nav->setVisible(false);
|
||||
key_controls->addWidget(left_key_nav);
|
||||
connect(left_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(goto_previous_key()));
|
||||
connect(left_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
|
||||
key_addremove = new QPushButton(this);
|
||||
key_addremove->setIcon(QIcon(":/icons/diamond.svg"));
|
||||
key_addremove->setIconSize(key_addremove->iconSize()*0.5);
|
||||
key_addremove->setVisible(false);
|
||||
key_controls->addWidget(key_addremove);
|
||||
connect(key_addremove, SIGNAL(clicked(bool)), this, SIGNAL(toggle_key()));
|
||||
connect(key_addremove, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
key_addremove = new QPushButton(this);
|
||||
key_addremove->setIcon(olive::icon::Diamond);
|
||||
key_addremove->setIconSize(key_addremove->iconSize()*0.5);
|
||||
key_addremove->setVisible(false);
|
||||
key_controls->addWidget(key_addremove);
|
||||
connect(key_addremove, SIGNAL(clicked(bool)), this, SIGNAL(toggle_key()));
|
||||
connect(key_addremove, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
|
||||
right_key_nav = new QPushButton(this);
|
||||
right_key_nav->setIcon(QIcon(":/icons/tri-right.svg"));
|
||||
right_key_nav->setIconSize(right_key_nav->iconSize()*0.5);
|
||||
right_key_nav->setVisible(false);
|
||||
key_controls->addWidget(right_key_nav);
|
||||
connect(right_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(goto_next_key()));
|
||||
connect(right_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
right_key_nav = new QPushButton(this);
|
||||
right_key_nav->setIcon(olive::icon::RightArrow);
|
||||
right_key_nav->setIconSize(right_key_nav->iconSize()*0.5);
|
||||
right_key_nav->setVisible(false);
|
||||
key_controls->addWidget(right_key_nav);
|
||||
connect(right_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(goto_next_key()));
|
||||
connect(right_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
|
||||
keyframe_enable = new QPushButton(QIcon(":/icons/clock.svg"), "", this);
|
||||
keyframe_enable->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
|
||||
keyframe_enable->setIconSize(keyframe_enable->iconSize()*0.75);
|
||||
keyframe_enable->setCheckable(true);
|
||||
keyframe_enable->setToolTip(tr("Enable Keyframes"));
|
||||
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SIGNAL(keyframe_enabled_changed(bool)));
|
||||
connect(keyframe_enable, SIGNAL(toggled(bool)), this, SLOT(keyframe_ui_enabled(bool)));
|
||||
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
key_controls->addWidget(keyframe_enable);
|
||||
keyframe_enable = new QPushButton(olive::icon::Clock, "", this);
|
||||
keyframe_enable->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
|
||||
keyframe_enable->setIconSize(keyframe_enable->iconSize()*0.75);
|
||||
keyframe_enable->setCheckable(true);
|
||||
keyframe_enable->setToolTip(tr("Enable Keyframes"));
|
||||
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SIGNAL(keyframe_enabled_changed(bool)));
|
||||
connect(keyframe_enable, SIGNAL(toggled(bool)), this, SLOT(keyframe_ui_enabled(bool)));
|
||||
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
key_controls->addWidget(keyframe_enable);
|
||||
}
|
||||
|
||||
KeyframeNavigator::~KeyframeNavigator() {}
|
||||
|
||||
void KeyframeNavigator::enable_keyframes(bool b) {
|
||||
keyframe_enable->setChecked(b);
|
||||
keyframe_enable->setChecked(b);
|
||||
}
|
||||
|
||||
void KeyframeNavigator::enable_keyframe_toggle(bool b) {
|
||||
keyframe_enable->setVisible(b);
|
||||
keyframe_enable->setVisible(b);
|
||||
}
|
||||
|
||||
void KeyframeNavigator::keyframe_ui_enabled(bool enabled) {
|
||||
left_key_nav->setVisible(enabled);
|
||||
key_addremove->setVisible(enabled);
|
||||
right_key_nav->setVisible(enabled);
|
||||
left_key_nav->setVisible(enabled);
|
||||
key_addremove->setVisible(enabled);
|
||||
right_key_nav->setVisible(enabled);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ const int kThrobberLimit = 20;
|
||||
const int kThrobberSize = 50;
|
||||
|
||||
#include "project/projectmodel.h"
|
||||
#include "ui/icons.h"
|
||||
|
||||
std::unique_ptr<MediaIconService> olive::media_icon_service;
|
||||
|
||||
@@ -54,13 +55,13 @@ void MediaIconService::SetMediaIcon(Media *media, int icon_type) {
|
||||
|
||||
switch (icon_type) {
|
||||
case ICON_TYPE_VIDEO:
|
||||
olive::project_model.set_icon(media, QIcon(":/icons/videosource.svg"));
|
||||
olive::project_model.set_icon(media, olive::icon::MediaVideo);
|
||||
break;
|
||||
case ICON_TYPE_AUDIO:
|
||||
olive::project_model.set_icon(media, QIcon(":/icons/audiosource.svg"));
|
||||
olive::project_model.set_icon(media, olive::icon::MediaAudio);
|
||||
break;
|
||||
case ICON_TYPE_IMAGE:
|
||||
olive::project_model.set_icon(media, QIcon(":/icons/imagesource.svg"));
|
||||
olive::project_model.set_icon(media, olive::icon::MediaImage);
|
||||
break;
|
||||
case ICON_TYPE_LOADING:
|
||||
throbber_items_.append(media);
|
||||
@@ -75,7 +76,7 @@ void MediaIconService::SetMediaIcon(Media *media, int icon_type) {
|
||||
}
|
||||
break;
|
||||
case ICON_TYPE_ERROR:
|
||||
olive::project_model.set_icon(media, QIcon(":/icons/error.svg"));
|
||||
olive::project_model.set_icon(media, olive::icon::MediaError);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user