file/folder restructuring
This commit is contained in:
+37
-37
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "audiomonitor.h"
|
||||
|
||||
#include "project/sequence.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "rendering/audio.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
@@ -39,60 +39,60 @@ extern "C" {
|
||||
}
|
||||
|
||||
AudioMonitor::AudioMonitor(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent)
|
||||
{
|
||||
clear_timer.setInterval(500);
|
||||
connect(&clear_timer, SIGNAL(timeout()), this, SLOT(clear()));
|
||||
clear_timer.setInterval(500);
|
||||
connect(&clear_timer, SIGNAL(timeout()), this, SLOT(clear()));
|
||||
}
|
||||
|
||||
void AudioMonitor::set_value(const QVector<double> &ivalues) {
|
||||
values = ivalues;
|
||||
update();
|
||||
values = ivalues;
|
||||
update();
|
||||
|
||||
QMetaObject::invokeMethod(&clear_timer, "start", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(&clear_timer, "start", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void AudioMonitor::clear() {
|
||||
clear_timer.stop();
|
||||
clear_timer.stop();
|
||||
|
||||
values.fill(1);
|
||||
update();
|
||||
values.fill(1);
|
||||
update();
|
||||
}
|
||||
|
||||
void AudioMonitor::resizeEvent(QResizeEvent *e) {
|
||||
gradient = QLinearGradient(QPoint(0, rect().top()), QPoint(0, rect().bottom()));
|
||||
gradient.setColorAt(0, Qt::red);
|
||||
gradient.setColorAt(0.25, Qt::yellow);
|
||||
gradient.setColorAt(1, Qt::green);
|
||||
QWidget::resizeEvent(e);
|
||||
gradient = QLinearGradient(QPoint(0, rect().top()), QPoint(0, rect().bottom()));
|
||||
gradient.setColorAt(0, Qt::red);
|
||||
gradient.setColorAt(0.25, Qt::yellow);
|
||||
gradient.setColorAt(1, Qt::green);
|
||||
QWidget::resizeEvent(e);
|
||||
}
|
||||
|
||||
void AudioMonitor::paintEvent(QPaintEvent *) {
|
||||
if (olive::ActiveSequence != nullptr && values.size() > 0) {
|
||||
QPainter p(this);
|
||||
int channel_x = AUDIO_MONITOR_GAP;
|
||||
int channel_count = values.size();
|
||||
int channel_width = (width()/channel_count) - AUDIO_MONITOR_GAP;
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
QRect r(channel_x, AUDIO_MONITOR_PEAK_HEIGHT + AUDIO_MONITOR_GAP, channel_width, height());
|
||||
p.fillRect(r, gradient);
|
||||
if (olive::ActiveSequence != nullptr && values.size() > 0) {
|
||||
QPainter p(this);
|
||||
int channel_x = AUDIO_MONITOR_GAP;
|
||||
int channel_count = values.size();
|
||||
int channel_width = (width()/channel_count) - AUDIO_MONITOR_GAP;
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
QRect r(channel_x, AUDIO_MONITOR_PEAK_HEIGHT + AUDIO_MONITOR_GAP, channel_width, height());
|
||||
p.fillRect(r, gradient);
|
||||
|
||||
bool peak = false;
|
||||
bool peak = false;
|
||||
|
||||
r.setHeight(qRound(r.height()*(values.at(i))));
|
||||
peak = (r.height() == 0);
|
||||
r.setHeight(qRound(r.height()*(values.at(i))));
|
||||
peak = (r.height() == 0);
|
||||
|
||||
QRect peak_rect(channel_x, 0, channel_width, AUDIO_MONITOR_PEAK_HEIGHT);
|
||||
if (peak) {
|
||||
p.fillRect(peak_rect, QColor(255, 0, 0));
|
||||
} else {
|
||||
p.fillRect(peak_rect, QColor(64, 0, 0));
|
||||
}
|
||||
QRect peak_rect(channel_x, 0, channel_width, AUDIO_MONITOR_PEAK_HEIGHT);
|
||||
if (peak) {
|
||||
p.fillRect(peak_rect, QColor(255, 0, 0));
|
||||
} else {
|
||||
p.fillRect(peak_rect, QColor(64, 0, 0));
|
||||
}
|
||||
|
||||
p.fillRect(r, QColor(0, 0, 0, 160));
|
||||
p.fillRect(r, QColor(0, 0, 0, 160));
|
||||
|
||||
channel_x += channel_width + AUDIO_MONITOR_GAP;
|
||||
}
|
||||
}
|
||||
channel_x += channel_width + AUDIO_MONITOR_GAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ public:
|
||||
protected:
|
||||
CheckboxEx* enabled_check;
|
||||
CollapsibleWidgetHeader* title_bar;
|
||||
QWidget* contents;
|
||||
private:
|
||||
bool selected;
|
||||
QWidget* contents;
|
||||
QLabel* header;
|
||||
QVBoxLayout* layout;
|
||||
QPushButton* collapse_button;
|
||||
|
||||
+19
-4
@@ -3,9 +3,10 @@
|
||||
#include <QPoint>
|
||||
#include <QMenu>
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "ui/menuhelper.h"
|
||||
#include "ui/keyframenavigator.h"
|
||||
#include "panels/panels.h"
|
||||
|
||||
EffectUI::EffectUI(Effect* e) :
|
||||
effect_(e)
|
||||
@@ -27,6 +28,8 @@ EffectUI::EffectUI(Effect* e) :
|
||||
|
||||
int maximum_column = 0;
|
||||
|
||||
widgets_.resize(e->row_count());
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
EffectRow* row = e->row(i);
|
||||
|
||||
@@ -36,12 +39,16 @@ EffectUI::EffectUI(Effect* e) :
|
||||
|
||||
layout_->addWidget(row_label, i, 0);
|
||||
|
||||
widgets_[i].resize(row->FieldCount());
|
||||
|
||||
int column = 1;
|
||||
for (int j=0;j<row->FieldCount();j++) {
|
||||
EffectField* field = row->Field(j);
|
||||
|
||||
QWidget* widget = field->CreateWidget();
|
||||
|
||||
widgets_[i][j] = widget;
|
||||
|
||||
layout_->addWidget(widget, i, column, 1, field->GetColumnSpan());
|
||||
|
||||
column += field->GetColumnSpan();
|
||||
@@ -64,6 +71,7 @@ EffectUI::EffectUI(Effect* e) :
|
||||
connect(nav, SIGNAL(goto_next_key()), row, SLOT(GoToNextKeyframe()));
|
||||
connect(nav, SIGNAL(keyframe_enabled_changed(bool)), row, SLOT(SetKeyframingEnabled(bool)));
|
||||
connect(nav, SIGNAL(clicked()), row, SLOT(FocusRow()));
|
||||
connect(row, SIGNAL(KeyframingSetChanged(bool)), nav, SLOT(enable_keyframes(bool)));
|
||||
|
||||
layout_->addWidget(nav, i, maximum_column);
|
||||
}
|
||||
@@ -76,10 +84,17 @@ Effect *EffectUI::GetEffect()
|
||||
return effect_;
|
||||
}
|
||||
|
||||
int EffectUI::GetRowPos(int row)
|
||||
{
|
||||
int EffectUI::GetRowY(int row, QWidget* mapToWidget) {
|
||||
QLabel* row_label = labels_.at(row);
|
||||
return mapToGlobal(row_label->rect().center()).y();
|
||||
return row_label->y()
|
||||
+ row_label->height() / 2
|
||||
+ mapToWidget->mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y()
|
||||
- title_bar->height();
|
||||
}
|
||||
|
||||
QWidget *EffectUI::Widget(int row, int field)
|
||||
{
|
||||
return widgets_.at(row).at(field);
|
||||
}
|
||||
|
||||
void EffectUI::show_context_menu(const QPoint& pos) {
|
||||
|
||||
+5
-2
@@ -2,7 +2,7 @@
|
||||
#define EFFECTUI_H
|
||||
|
||||
#include "collapsiblewidget.h"
|
||||
#include "project/effect.h"
|
||||
#include "effects/effect.h"
|
||||
|
||||
class EffectUI : public CollapsibleWidget {
|
||||
Q_OBJECT
|
||||
@@ -11,7 +11,9 @@ public:
|
||||
|
||||
Effect* GetEffect();
|
||||
|
||||
int GetRowPos(int row);
|
||||
int GetRowY(int row, QWidget *mapToWidget);
|
||||
|
||||
QWidget* Widget(int row, int field);
|
||||
signals:
|
||||
void CutRequested();
|
||||
void CopyRequested();
|
||||
@@ -20,6 +22,7 @@ private:
|
||||
Effect* effect_;
|
||||
QGridLayout* layout_;
|
||||
QVector<QLabel*> labels_;
|
||||
QVector< QVector<QWidget*> > widgets_;
|
||||
private slots:
|
||||
void show_context_menu(const QPoint&);
|
||||
};
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
#include "focusfilter.h"
|
||||
|
||||
#include "panels/panels.h"
|
||||
#include "project/sequence.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "ui/timelineheader.h"
|
||||
|
||||
FocusFilter olive::FocusFilter;
|
||||
|
||||
+7
-8
@@ -26,18 +26,17 @@
|
||||
#include <QMenu>
|
||||
#include <cfloat>
|
||||
|
||||
#include "io/config.h"
|
||||
#include "global/config.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "project/sequence.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "ui/keyframedrawing.h"
|
||||
#include "project/undo.h"
|
||||
#include "project/effect.h"
|
||||
#include "project/clip.h"
|
||||
#include "undo/undo.h"
|
||||
#include "effects/effect.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "ui/rectangleselect.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
|
||||
const double kGraphZoomSpeed = 0.05;
|
||||
@@ -702,7 +701,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
|
||||
void GraphView::mouseReleaseEvent(QMouseEvent *) {
|
||||
if (click_add_proc) {
|
||||
olive::UndoStack.push(new KeyframeFieldSet(click_add_field, click_add_key));
|
||||
olive::UndoStack.push(new KeyframeAdd(click_add_field, click_add_key));
|
||||
} else if (moved_keys && selected_keys.size() > 0) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
switch (current_handle) {
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@
|
||||
#include <QWidget>
|
||||
#include <QVector>
|
||||
|
||||
#include "project/effectrow.h"
|
||||
#include "project/effectfields.h"
|
||||
#include "effects/effectrow.h"
|
||||
#include "effects/effectfields.h"
|
||||
|
||||
QColor get_curve_color(int index, int length);
|
||||
|
||||
|
||||
@@ -32,8 +32,9 @@ class KeyframeNavigator : public QWidget
|
||||
public:
|
||||
KeyframeNavigator(QWidget* parent = nullptr, bool addLeftPad = true);
|
||||
~KeyframeNavigator();
|
||||
void enable_keyframes(bool);
|
||||
|
||||
void enable_keyframe_toggle(bool);
|
||||
void enable_keyframes(bool);
|
||||
signals:
|
||||
void goto_previous_key();
|
||||
void toggle_key();
|
||||
|
||||
+6
-6
@@ -20,22 +20,22 @@
|
||||
|
||||
#include "keyframeview.h"
|
||||
|
||||
#include "project/effect.h"
|
||||
#include "effects/effect.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "panels/panels.h"
|
||||
#include "project/clip.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "ui/timelineheader.h"
|
||||
#include "project/undo.h"
|
||||
#include "undo/undo.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "project/sequence.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "panels/grapheditor.h"
|
||||
#include "ui/keyframedrawing.h"
|
||||
#include "ui/clickablelabel.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "ui/rectangleselect.h"
|
||||
#include "project/keyframe.h"
|
||||
#include "effects/keyframe.h"
|
||||
#include "ui/graphview.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
@@ -124,7 +124,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* row = e->row(j);
|
||||
|
||||
int keyframe_y = container->GetRowPos(j);
|
||||
int keyframe_y = container->GetRowY(j, this);
|
||||
|
||||
QVector<long> key_times;
|
||||
|
||||
|
||||
+56
-67
@@ -20,11 +20,11 @@
|
||||
|
||||
#include "labelslider.h"
|
||||
|
||||
#include "project/undo.h"
|
||||
#include "undo/undo.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "io/config.h"
|
||||
#include "io/math.h"
|
||||
#include "debug.h"
|
||||
#include "global/config.h"
|
||||
#include "global/math.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QInputDialog>
|
||||
@@ -40,28 +40,33 @@ LabelSlider::LabelSlider(QWidget* parent) : QLabel(parent) {
|
||||
drag_proc = false;
|
||||
min_enabled = false;
|
||||
max_enabled = false;
|
||||
set_color();
|
||||
set_default_cursor();
|
||||
SetColor();
|
||||
SetDefaultCursor();
|
||||
internal_value = -1;
|
||||
set = false;
|
||||
display_type = LABELSLIDER_NORMAL;
|
||||
display_type = Normal;
|
||||
|
||||
set_default_value(0);
|
||||
SetDefault(0);
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu(const QPoint&)));
|
||||
}
|
||||
|
||||
void LabelSlider::set_frame_rate(double d) {
|
||||
void LabelSlider::SetFrameRate(double d) {
|
||||
frame_rate = d;
|
||||
}
|
||||
|
||||
void LabelSlider::set_display_type(const DisplayType& type) {
|
||||
display_type = type;
|
||||
setText(valueToString());
|
||||
void LabelSlider::SetDecimalPlaces(int places)
|
||||
{
|
||||
decimal_places = places;
|
||||
}
|
||||
|
||||
void LabelSlider::set_value(double v, bool userSet) {
|
||||
void LabelSlider::SetDisplayType(const DisplayType& type) {
|
||||
display_type = type;
|
||||
setText(ValueToString());
|
||||
}
|
||||
|
||||
void LabelSlider::SetValue(double v) {
|
||||
set = true;
|
||||
if (!qFuzzyCompare(v, internal_value)) {
|
||||
if (min_enabled && v < min_value) {
|
||||
@@ -72,32 +77,25 @@ void LabelSlider::set_value(double v, bool userSet) {
|
||||
internal_value = v;
|
||||
}
|
||||
|
||||
setText(valueToString());
|
||||
if (userSet) {
|
||||
emit valueChanged(internal_value);
|
||||
}
|
||||
setText(ValueToString());
|
||||
}
|
||||
}
|
||||
|
||||
bool LabelSlider::is_set() {
|
||||
return set;
|
||||
}
|
||||
|
||||
bool LabelSlider::is_dragging() {
|
||||
bool LabelSlider::IsDragging() {
|
||||
return drag_proc;
|
||||
}
|
||||
|
||||
QString LabelSlider::valueToString() {
|
||||
QString LabelSlider::ValueToString() {
|
||||
double v = internal_value;
|
||||
if (qIsNaN(v)) {
|
||||
return "---";
|
||||
} else {
|
||||
switch (display_type) {
|
||||
case LABELSLIDER_FRAMENUMBER:
|
||||
case FrameNumber:
|
||||
return frame_to_timecode(long(v), olive::CurrentConfig.timecode_view, frame_rate);
|
||||
case LABELSLIDER_PERCENT:
|
||||
case Percent:
|
||||
return QString::number((v*100), 'f', decimal_places).append("%");
|
||||
case LABELSLIDER_DECIBEL:
|
||||
case Decibel:
|
||||
{
|
||||
QString db_str;
|
||||
|
||||
@@ -120,15 +118,7 @@ QString LabelSlider::valueToString() {
|
||||
}
|
||||
}
|
||||
|
||||
double LabelSlider::getPreviousValue() {
|
||||
return previous_value;
|
||||
}
|
||||
|
||||
void LabelSlider::set_previous_value() {
|
||||
previous_value = internal_value;
|
||||
}
|
||||
|
||||
void LabelSlider::set_color(QString c) {
|
||||
void LabelSlider::SetColor(QString c) {
|
||||
if (c.isEmpty()) c = "#ffc000";
|
||||
setStyleSheet("QLabel{color:" + c + ";text-decoration:underline;}QLabel:disabled{color:#808080;}");
|
||||
}
|
||||
@@ -137,20 +127,20 @@ double LabelSlider::value() {
|
||||
return internal_value;
|
||||
}
|
||||
|
||||
void LabelSlider::set_default_value(double v) {
|
||||
void LabelSlider::SetDefault(double v) {
|
||||
default_value = v;
|
||||
if (!set) {
|
||||
set_value(v, false);
|
||||
SetValue(v);
|
||||
set = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LabelSlider::set_minimum_value(double v) {
|
||||
void LabelSlider::SetMinimum(double v) {
|
||||
min_value = v;
|
||||
min_enabled = true;
|
||||
}
|
||||
|
||||
void LabelSlider::set_maximum_value(double v) {
|
||||
void LabelSlider::SetMaximum(double v) {
|
||||
max_value = v;
|
||||
max_enabled = true;
|
||||
}
|
||||
@@ -166,7 +156,7 @@ void LabelSlider::mousePressEvent(QMouseEvent *ev) {
|
||||
if (ev->modifiers() & Qt::AltModifier) {
|
||||
|
||||
// reset to default
|
||||
reset_to_default_value();
|
||||
ResetToDefault();
|
||||
|
||||
} else {
|
||||
|
||||
@@ -174,7 +164,7 @@ void LabelSlider::mousePressEvent(QMouseEvent *ev) {
|
||||
if (qIsNaN(internal_value)) internal_value = 0;
|
||||
|
||||
// hide the cursor and store information about it for dragging
|
||||
set_active_cursor();
|
||||
SetActiveCursor();
|
||||
|
||||
drag_start = true;
|
||||
drag_start_x = cursor().pos().x();
|
||||
@@ -206,7 +196,7 @@ void LabelSlider::mouseMoveEvent(QMouseEvent* event) {
|
||||
// ctrl + drag drags in smaller increments
|
||||
if (event->modifiers() & Qt::ControlModifier) diff *= 0.01;
|
||||
|
||||
if (display_type == LABELSLIDER_PERCENT) {
|
||||
if (display_type == Percent) {
|
||||
// we'll also need to drag in smaller increments for a percent value
|
||||
|
||||
diff *= 0.01;
|
||||
@@ -215,7 +205,7 @@ void LabelSlider::mouseMoveEvent(QMouseEvent* event) {
|
||||
// determine what the new value will be
|
||||
double new_value;
|
||||
|
||||
if (display_type == LABELSLIDER_DECIBEL) {
|
||||
if (display_type == Decibel) {
|
||||
// we move in terms of dB for decibel display
|
||||
|
||||
new_value = db_to_amplitude(amplitude_to_db(internal_value) + diff);
|
||||
@@ -227,7 +217,8 @@ void LabelSlider::mouseMoveEvent(QMouseEvent* event) {
|
||||
}
|
||||
|
||||
// set internal value
|
||||
set_value(new_value, true);
|
||||
SetValue(new_value);
|
||||
emit valueChanged(internal_value);
|
||||
|
||||
// keep the cursor in the same location while dragging
|
||||
cursor().setPos(drag_start_x, drag_start_y);
|
||||
@@ -238,7 +229,7 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
if (drag_start) {
|
||||
|
||||
// unhide cursor
|
||||
set_default_cursor();
|
||||
SetDefaultCursor();
|
||||
|
||||
drag_start = false;
|
||||
|
||||
@@ -253,49 +244,47 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
|
||||
} else {
|
||||
|
||||
prompt_for_value();
|
||||
ShowDialog();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LabelSlider::set_default_cursor() {
|
||||
void LabelSlider::SetDefaultCursor() {
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
}
|
||||
|
||||
void LabelSlider::set_active_cursor() {
|
||||
void LabelSlider::SetActiveCursor() {
|
||||
setCursor(Qt::BlankCursor);
|
||||
}
|
||||
|
||||
void LabelSlider::show_context_menu(const QPoint &pos)
|
||||
void LabelSlider::ShowContextMenu(const QPoint &pos)
|
||||
{
|
||||
QMenu menu(this);
|
||||
|
||||
menu.addAction(tr("&Edit"), this, SLOT(prompt_for_value()));
|
||||
menu.addAction(tr("&Edit"), this, SLOT(ShowDialog()));
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
menu.addAction(tr("&Reset to Default"), this, SLOT(reset_to_default_value()));
|
||||
menu.addAction(tr("&Reset to Default"), this, SLOT(ResetToDefault()));
|
||||
|
||||
menu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void LabelSlider::reset_to_default_value()
|
||||
void LabelSlider::ResetToDefault()
|
||||
{
|
||||
// if the value is not already default, and there is a default to set
|
||||
if (!qFuzzyCompare(internal_value, default_value)
|
||||
&& !qIsNaN(default_value)) {
|
||||
|
||||
// cache current value
|
||||
set_previous_value();
|
||||
|
||||
// set back to default
|
||||
set_value(default_value, true);
|
||||
SetValue(default_value);
|
||||
emit valueChanged(internal_value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void LabelSlider::prompt_for_value()
|
||||
void LabelSlider::ShowDialog()
|
||||
{
|
||||
// if the user didn't actually drag, and just clicked in one place,
|
||||
// we instead present a dialog prompt for the user to enter a
|
||||
@@ -303,7 +292,7 @@ void LabelSlider::prompt_for_value()
|
||||
|
||||
double d = internal_value;
|
||||
|
||||
if (display_type == LABELSLIDER_FRAMENUMBER) {
|
||||
if (display_type == FrameNumber) {
|
||||
|
||||
// ask the user to enter a timecode
|
||||
QString s = QInputDialog::getText(
|
||||
@@ -311,7 +300,7 @@ void LabelSlider::prompt_for_value()
|
||||
tr("Set Value"),
|
||||
tr("New value:"),
|
||||
QLineEdit::Normal,
|
||||
valueToString()
|
||||
ValueToString()
|
||||
);
|
||||
if (s.isEmpty()) return;
|
||||
|
||||
@@ -325,9 +314,9 @@ void LabelSlider::prompt_for_value()
|
||||
|
||||
// value to show
|
||||
double shown_value = internal_value;
|
||||
if (display_type == LABELSLIDER_PERCENT) {
|
||||
if (display_type == Percent) {
|
||||
shown_value *= 100;
|
||||
} else if (display_type == LABELSLIDER_DECIBEL) {
|
||||
} else if (display_type == Decibel) {
|
||||
shown_value = amplitude_to_db(shown_value);
|
||||
}
|
||||
|
||||
@@ -336,7 +325,7 @@ void LabelSlider::prompt_for_value()
|
||||
if (min_enabled) {
|
||||
// if this field has a minimum value set, use it
|
||||
shown_minimum_value = min_value;
|
||||
} else if (display_type == LABELSLIDER_DECIBEL) {
|
||||
} else if (display_type == Decibel) {
|
||||
// minimum decibel amount is -96db
|
||||
shown_minimum_value = -96;
|
||||
} else {
|
||||
@@ -358,16 +347,16 @@ void LabelSlider::prompt_for_value()
|
||||
if (!ok) return;
|
||||
|
||||
// convert shown value back to internal value
|
||||
if (display_type == LABELSLIDER_PERCENT) {
|
||||
if (display_type == Percent) {
|
||||
d *= 0.01;
|
||||
} else if (display_type == LABELSLIDER_DECIBEL) {
|
||||
} else if (display_type == Decibel) {
|
||||
d = db_to_amplitude(d);
|
||||
}
|
||||
}
|
||||
|
||||
// if the value actually changed, trigger a change event
|
||||
if (!qFuzzyCompare(d, internal_value)) {
|
||||
set_previous_value();
|
||||
set_value(d, true);
|
||||
SetValue(d);
|
||||
emit valueChanged(internal_value);
|
||||
}
|
||||
}
|
||||
|
||||
+83
-112
@@ -37,20 +37,66 @@ public:
|
||||
LabelSlider(QWidget* parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Set the display frame rate
|
||||
* @brief Set the value
|
||||
* @param v
|
||||
*
|
||||
* If the `display_type` is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the
|
||||
* timecode will be in.
|
||||
* Value to set to.
|
||||
*
|
||||
* @param d
|
||||
* @param userSet
|
||||
*
|
||||
* **TRUE** if this was called through a user action, **FALSE** if this was called through some other way. The
|
||||
* only difference is **TRUE** will emit a signal (valueChanged()) indicating that the value has changed, and
|
||||
* **FALSE** will not.
|
||||
*/
|
||||
void set_frame_rate(double d);
|
||||
void SetValue(double v);
|
||||
|
||||
/**
|
||||
* @brief Set the default value
|
||||
*
|
||||
* If a default value is set, alt+clicking the LabelSlider will return to the default value.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as default
|
||||
*/
|
||||
void SetDefault(double v);
|
||||
|
||||
/**
|
||||
* @brief Set the minimum value
|
||||
*
|
||||
* If a minimum value is set, the value will never go below it. If the user manually sets a value lower than
|
||||
* the minimum, it will automatically snap to the minimum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as minimum
|
||||
*/
|
||||
void SetMinimum(double v);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum value
|
||||
*
|
||||
* If a maximum value is set, the value will never go above it. If the user manually sets a value higher than
|
||||
* the maximum, it will automatically snap to the maximum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as maximum
|
||||
*/
|
||||
void SetMaximum(double v);
|
||||
|
||||
/**
|
||||
* @brief Returns the internal value as a double
|
||||
* @return The internal value. This will not respect the `display_type`, i.e. 100% will return as 1.0, 12dB will
|
||||
* return as 400%, and a timecode will return as a frame number.
|
||||
*/
|
||||
double value();
|
||||
|
||||
enum DisplayType {
|
||||
LABELSLIDER_NORMAL,
|
||||
LABELSLIDER_FRAMENUMBER,
|
||||
LABELSLIDER_PERCENT,
|
||||
LABELSLIDER_DECIBEL
|
||||
Normal,
|
||||
FrameNumber,
|
||||
Percent,
|
||||
Decibel
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -67,107 +113,13 @@ public:
|
||||
*
|
||||
* The display type to set to.
|
||||
*/
|
||||
void set_display_type(const DisplayType& type);
|
||||
|
||||
/**
|
||||
* @brief Set the value
|
||||
* @param v
|
||||
*
|
||||
* Value to set to.
|
||||
*
|
||||
* @param userSet
|
||||
*
|
||||
* **TRUE** if this was called through a user action, **FALSE** if this was called through some other way. The
|
||||
* only difference is **TRUE** will emit a signal (valueChanged()) indicating that the value has changed, and
|
||||
* **FALSE** will not.
|
||||
*/
|
||||
void set_value(double v, bool userSet);
|
||||
|
||||
/**
|
||||
* @brief Set the default value
|
||||
*
|
||||
* If a default value is set, alt+clicking the LabelSlider will return to the default value.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as default
|
||||
*/
|
||||
void set_default_value(double v);
|
||||
|
||||
/**
|
||||
* @brief Set the minimum value
|
||||
*
|
||||
* If a minimum value is set, the value will never go below it. If the user manually sets a value lower than
|
||||
* the minimum, it will automatically snap to the minimum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as minimum
|
||||
*/
|
||||
void set_minimum_value(double v);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum value
|
||||
*
|
||||
* If a maximum value is set, the value will never go above it. If the user manually sets a value higher than
|
||||
* the maximum, it will automatically snap to the maximum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as maximum
|
||||
*/
|
||||
void set_maximum_value(double v);
|
||||
|
||||
/**
|
||||
* @brief Returns the internal value as a double
|
||||
* @return The internal value. This will not respect the `display_type`, i.e. 100% will return as 1.0, 12dB will
|
||||
* return as 400%, and a timecode will return as a frame number.
|
||||
*/
|
||||
double value();
|
||||
|
||||
/**
|
||||
* @brief Returns whether a value has been set or not
|
||||
*
|
||||
* If a value has been entered by any means (i.e. if set_value() was called), this will be **TRUE**. If set_value()
|
||||
* has not been called and is_set() is **FALSE**, calling set_default_value() will automatically set the value
|
||||
* to the default value WITHOUT changing the is_set() state (i.e. it will still be **FALSE** and calling
|
||||
* set_default_value() again will change the current value again unless it's been changed through some other means
|
||||
* in that time).
|
||||
*
|
||||
* @return **TRUE** if a value has been set, **FALSE** if not.
|
||||
*/
|
||||
bool is_set();
|
||||
void SetDisplayType(const DisplayType& type);
|
||||
|
||||
/**
|
||||
* @brief Returns whether the user is currently dragging
|
||||
* @return **TRUE** if the user is dragging, **FALSE** if not.
|
||||
*/
|
||||
bool is_dragging();
|
||||
|
||||
/**
|
||||
* @brief Convert the internal value to a displayed string according to `display_type`
|
||||
* @return The internal value as a string
|
||||
*/
|
||||
QString valueToString();
|
||||
|
||||
/**
|
||||
* @brief Returns whatever value was set before the last set_value()
|
||||
*
|
||||
* For various reasons (largely undo capabilities) it is helpful to retrieve whatever the value was before the
|
||||
* current one. If the user dragged the current value, this will return the value just before the user started
|
||||
* dragging.
|
||||
*
|
||||
* @return The previous value
|
||||
*/
|
||||
double getPreviousValue();
|
||||
|
||||
/**
|
||||
* @brief Updates previous value
|
||||
*
|
||||
* Called internally to store the current value as the previous value in anticipation of an upcoming value change.
|
||||
* Can also be called externally (mainly for dragged EffectGizmos) in anticipation of an external change.
|
||||
*/
|
||||
void set_previous_value();
|
||||
bool IsDragging();
|
||||
|
||||
/**
|
||||
* @brief Set the display color
|
||||
@@ -175,24 +127,43 @@ public:
|
||||
*
|
||||
* Color to set to
|
||||
*/
|
||||
void set_color(QString c = nullptr);
|
||||
void SetColor(QString c = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Set the display frame rate
|
||||
*
|
||||
* If the `display_type` is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the
|
||||
* timecode will be in.
|
||||
*
|
||||
* @param d
|
||||
*/
|
||||
void SetFrameRate(double d);
|
||||
|
||||
/**
|
||||
* @brief Set how many decimal places to show for a floating-point number
|
||||
*
|
||||
* Defaults to 1
|
||||
*/
|
||||
int decimal_places;
|
||||
void SetDecimalPlaces(int places);
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *ev);
|
||||
void mouseMoveEvent(QMouseEvent *ev);
|
||||
void mouseReleaseEvent(QMouseEvent *ev);
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Convert the internal value to a displayed string according to `display_type`
|
||||
* @return The internal value as a string
|
||||
*/
|
||||
QString ValueToString();
|
||||
|
||||
double default_value;
|
||||
double internal_value;
|
||||
double drag_start_value;
|
||||
double previous_value;
|
||||
|
||||
int decimal_places;
|
||||
|
||||
bool min_enabled;
|
||||
double min_value;
|
||||
bool max_enabled;
|
||||
@@ -212,12 +183,12 @@ private:
|
||||
/**
|
||||
* @brief Internal function to set the standard cursor (usually SizeHorCursor)
|
||||
*/
|
||||
void set_default_cursor();
|
||||
void SetDefaultCursor();
|
||||
|
||||
/**
|
||||
* @brief Internal function to set the cursor while dragging (usually NoCursor aka invisible)
|
||||
*/
|
||||
void set_active_cursor();
|
||||
void SetActiveCursor();
|
||||
private slots:
|
||||
/**
|
||||
* @brief Context menu slot to be connected to QWidget::customContextMenuRequested(const QPoint&)
|
||||
@@ -226,12 +197,12 @@ private slots:
|
||||
*
|
||||
* Current cursor position
|
||||
*/
|
||||
void show_context_menu(const QPoint& pos);
|
||||
void ShowContextMenu(const QPoint& pos);
|
||||
|
||||
/**
|
||||
* @brief Slot to reset current value to the default value
|
||||
*/
|
||||
void reset_to_default_value();
|
||||
void ResetToDefault();
|
||||
|
||||
/**
|
||||
* @brief Show prompt asking for value
|
||||
@@ -240,7 +211,7 @@ private slots:
|
||||
* Will show an input dialog asking for a new value to be entered manually. Asks for units in the selected
|
||||
* display type and converts them back to the internal value type.
|
||||
*/
|
||||
void prompt_for_value();
|
||||
void ShowDialog();
|
||||
signals:
|
||||
/**
|
||||
* @brief valueChanged signal
|
||||
|
||||
+1218
File diff suppressed because it is too large
Load Diff
+358
@@ -0,0 +1,358 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
class Project;
|
||||
class EffectControls;
|
||||
class Viewer;
|
||||
class Timeline;
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent);
|
||||
virtual ~MainWindow() override;
|
||||
|
||||
/**
|
||||
* @brief Update window title
|
||||
*
|
||||
* Updates the window title to reflect the current project filename. Call if the project filename changes.
|
||||
*
|
||||
* NOTE: It's recommended to use update_project_filename() from Olive::Global to update the filename completely
|
||||
* instead of calling this function directly (update_project_filename() calls this function in the process).
|
||||
*/
|
||||
void updateTitle();
|
||||
|
||||
/**
|
||||
* @brief Load shortcut file.
|
||||
*
|
||||
* Loads a shortcut configuration from file and sets Olive to use them.
|
||||
*
|
||||
* @param fn
|
||||
*
|
||||
* URL of the shortcut file to be loaded
|
||||
*
|
||||
*/
|
||||
void load_shortcuts(const QString &fn);
|
||||
|
||||
/**
|
||||
* @brief Save shortcut file.
|
||||
*
|
||||
* Saves the current shortcut configuration to file. Only saves shortcuts that have been changed from default.
|
||||
*
|
||||
* @param fn
|
||||
*
|
||||
* URL to save the shortcut file to.
|
||||
*/
|
||||
void save_shortcuts(const QString &fn);
|
||||
|
||||
/**
|
||||
* @brief Load a CSS/QSS style from file to customize Olive's interface.
|
||||
*
|
||||
* @param fn
|
||||
*
|
||||
* URL to load the CSS file from.
|
||||
*/
|
||||
void load_css_from_file(const QString& fn);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Toggles full screen mode.
|
||||
*
|
||||
* Toggles the main window between full screen and windowed modes.
|
||||
*/
|
||||
void toggle_full_screen();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted once when the main window has finished initializing
|
||||
*
|
||||
* Emitted the first time paintEvent runs. Connect this to functions that must be completed post-initialization.
|
||||
*/
|
||||
void finished_first_paint();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Close event
|
||||
*
|
||||
* Confirms whether the project can be closed, and if so performs various clean-up functions before the application
|
||||
* exits. It's preferable to call clean-up functions here rather than in the destructor because this will get called
|
||||
* first.
|
||||
*/
|
||||
virtual void closeEvent(QCloseEvent *) override;
|
||||
|
||||
/**
|
||||
* @brief Paint event
|
||||
*
|
||||
* Overridden to provide the finished_first_paint() signal.
|
||||
*/
|
||||
virtual void paintEvent(QPaintEvent *) override;
|
||||
|
||||
/**
|
||||
* @brief Change event
|
||||
*
|
||||
* Overridden to handle language changes (e->type() == QEvent::LanguageChange) by calling Retranslate().
|
||||
*
|
||||
* See documentation for QWidget::changeEvent() for more information.
|
||||
*
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
virtual void changeEvent(QEvent* e) override;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Maximizes the currently hovered panel.
|
||||
*
|
||||
* Saves the current state of the panels/dock widgets and removes all except the currently hovered panel,
|
||||
* effectively maximizing the panel to the entire window.
|
||||
*/
|
||||
void maximize_panel();
|
||||
|
||||
/**
|
||||
* @brief Reset panel layout to default.
|
||||
*
|
||||
* Resets the current panel layout to default. Doesn't save the current layout.
|
||||
*/
|
||||
void reset_layout();
|
||||
|
||||
/**
|
||||
* @brief Function to prepare File menu.
|
||||
*
|
||||
* Primarily used to populate the Open Recent Projects menu.
|
||||
*/
|
||||
void fileMenu_About_To_Be_Shown();
|
||||
|
||||
/**
|
||||
* @brief Function to prepare Edit menu.
|
||||
*
|
||||
* Primarily used to set the enabled state on Undo and Redo depending if there are undos/redos available.
|
||||
*/
|
||||
void editMenu_About_To_Be_Shown();
|
||||
|
||||
/**
|
||||
* @brief Function to prepare Window menu.
|
||||
*
|
||||
* Primarily used to set the checked state of menu items corresponding to the panels that are currently visible.
|
||||
*/
|
||||
void windowMenu_About_To_Be_Shown();
|
||||
|
||||
/**
|
||||
* @brief Function to prepare Playback menu.
|
||||
*
|
||||
* Primarily used to set the checked state on the "Loop" item.
|
||||
*/
|
||||
void playbackMenu_About_To_Be_Shown();
|
||||
|
||||
/**
|
||||
* @brief Function to prepare View menu.
|
||||
*
|
||||
* Primarily used to set the checked state of various options in the view menu (e.g. title safe area, timecode
|
||||
* units, etc.)
|
||||
*/
|
||||
void viewMenu_About_To_Be_Shown();
|
||||
|
||||
/**
|
||||
* @brief Function to prepare Tools menu.
|
||||
*
|
||||
* Primarily used to set the checked state on various settings available from the Tools menu.
|
||||
*/
|
||||
void toolMenu_About_To_Be_Shown();
|
||||
|
||||
/**
|
||||
* @brief Toggle whether a panel is visible or not.
|
||||
*
|
||||
* Assumes the sender() QAction has a pointer to a QDockWidget in its data variable. Casts it and toggles its
|
||||
* visibility.
|
||||
*/
|
||||
void toggle_panel_visibility();
|
||||
|
||||
/**
|
||||
* @brief Set panel lock
|
||||
*
|
||||
* @param locked
|
||||
*
|
||||
* If **TRUE** prevents panels from being moved around. Defaults to **FALSE**.
|
||||
*/
|
||||
void set_panels_locked(bool locked);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Internal function for setting the panel layout to a predetermined preset.
|
||||
*
|
||||
* Resets layout to default and optionally loads a layout from file. If loading from file, this function will
|
||||
* always load from `get_config_path() + "/layout"`.
|
||||
*
|
||||
* @param reset
|
||||
*
|
||||
* **TRUE** if this function should just reset the current layout. **FALSE** if it should load from the
|
||||
* aforementioned layout file.
|
||||
*/
|
||||
void setup_layout(bool reset);
|
||||
|
||||
/**
|
||||
* @brief Initialize menu bar menus and items.
|
||||
*
|
||||
* Internal initialization function for all menus and menu items in the main window. Called once from the
|
||||
* MainWindow() constructor.
|
||||
*/
|
||||
void setup_menus();
|
||||
|
||||
void Retranslate();
|
||||
|
||||
// file menu actions
|
||||
QMenu* file_menu;
|
||||
QMenu* new_menu;
|
||||
QAction* open_project;
|
||||
QMenu* open_recent;
|
||||
QAction* open_action;
|
||||
QAction* clear_open_recent_action;
|
||||
QAction* save_project;
|
||||
QAction* save_project_as;
|
||||
QAction* import_action;
|
||||
QAction* export_action;
|
||||
QAction* exit_action;
|
||||
|
||||
// edit menu actions
|
||||
QMenu* edit_menu;
|
||||
QAction* undo_action;
|
||||
QAction* redo_action;
|
||||
QAction* select_all_action;
|
||||
QAction* deselect_all_action;
|
||||
QAction* ripple_to_in_point_;
|
||||
QAction* ripple_to_out_point_;
|
||||
QAction* edit_to_in_point_;
|
||||
QAction* edit_to_out_point_;
|
||||
QAction* delete_inout_point_;
|
||||
QAction* ripple_delete_inout_point_;
|
||||
QAction* setedit_marker_;
|
||||
|
||||
|
||||
// view menu actions
|
||||
QMenu* view_menu;
|
||||
QAction* zoom_in_;
|
||||
QAction* zoom_out_;
|
||||
QAction* increase_track_height_;
|
||||
QAction* decrease_track_height_;
|
||||
QAction* track_lines;
|
||||
QAction* frames_action;
|
||||
QAction* drop_frame_action;
|
||||
QAction* nondrop_frame_action;
|
||||
QAction* milliseconds_action;
|
||||
QAction* no_autoscroll;
|
||||
QAction* page_autoscroll;
|
||||
QAction* smooth_autoscroll;
|
||||
|
||||
QMenu* title_safe_area_menu;
|
||||
QAction* title_safe_off;
|
||||
QAction* title_safe_default;
|
||||
QAction* title_safe_43;
|
||||
QAction* title_safe_169;
|
||||
QAction* title_safe_custom;
|
||||
|
||||
QAction* full_screen;
|
||||
QAction* full_screen_viewer_;
|
||||
QAction* show_all;
|
||||
|
||||
// playback menu
|
||||
QMenu* playback_menu;
|
||||
|
||||
QAction* go_to_start_;
|
||||
QAction* previous_frame_;
|
||||
QAction* playpause_;
|
||||
QAction* play_in_to_out_;
|
||||
QAction* next_frame_;
|
||||
QAction* go_to_end_;
|
||||
QAction* go_to_prev_cut_;
|
||||
QAction* go_to_next_cut_;
|
||||
QAction* go_to_in_point_;
|
||||
QAction* go_to_out_point_;
|
||||
QAction* shuttle_left_;
|
||||
QAction* shuttle_stop_;
|
||||
QAction* shuttle_right_;
|
||||
QAction* loop_action_;
|
||||
|
||||
// window menu
|
||||
|
||||
QMenu* window_menu;
|
||||
|
||||
QAction* window_project_action;
|
||||
QAction* window_effectcontrols_action;
|
||||
QAction* window_timeline_action;
|
||||
QAction* window_graph_editor_action;
|
||||
QAction* window_footageviewer_action;
|
||||
QAction* window_sequenceviewer_action;
|
||||
|
||||
QAction* maximize_panel_;
|
||||
QAction* lock_panels_;
|
||||
QAction* reset_default_layout_;
|
||||
|
||||
// tools menu
|
||||
QMenu* tools_menu;
|
||||
|
||||
QAction* pointer_tool_action;
|
||||
QAction* edit_tool_action;
|
||||
QAction* ripple_tool_action;
|
||||
QAction* razor_tool_action;
|
||||
QAction* slip_tool_action;
|
||||
QAction* slide_tool_action;
|
||||
QAction* hand_tool_action;
|
||||
QAction* transition_tool_action;
|
||||
QAction* snap_toggle;
|
||||
QAction* selecting_also_seeks;
|
||||
QAction* edit_tool_also_seeks;
|
||||
QAction* edit_tool_selects_links;
|
||||
QAction* seek_to_end_of_pastes;
|
||||
QAction* scroll_wheel_zooms;
|
||||
QAction* invert_timeline_scroll_axes;
|
||||
QAction* rectified_waveforms;
|
||||
QAction* enable_drag_files_to_timeline;
|
||||
QAction* autoscale_by_default;
|
||||
QAction* enable_seek_to_import;
|
||||
QAction* enable_audio_scrubbing;
|
||||
QAction* enable_drop_on_media_to_replace;
|
||||
QAction* enable_hover_focus;
|
||||
QAction* set_name_and_marker;
|
||||
QAction* seek_also_selects;
|
||||
QAction* preferences_action_;
|
||||
QAction* clear_undo_action_;
|
||||
|
||||
// help menu
|
||||
QMenu* help_menu;
|
||||
QAction* action_search_;
|
||||
QAction* debug_log_;
|
||||
QAction* about_action_;
|
||||
|
||||
// used to store the panel state when one panel is maximized
|
||||
QByteArray temp_panel_state;
|
||||
|
||||
// used in paintEvent() to determine the first paintEvent() performed
|
||||
bool first_show;
|
||||
};
|
||||
|
||||
namespace olive {
|
||||
extern MainWindow* MainWindow;
|
||||
}
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
+4
-4
@@ -25,10 +25,10 @@
|
||||
#include <QPushButton>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include "io/config.h"
|
||||
#include "io/clipboard.h"
|
||||
#include "mainwindow.h"
|
||||
#include "oliveglobal.h"
|
||||
#include "global/config.h"
|
||||
#include "project/clipboard.h"
|
||||
#include "ui/mainwindow.h"
|
||||
#include "global/global.h"
|
||||
#include "panels/panels.h"
|
||||
#include "ui/focusfilter.h"
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include <QWheelEvent>
|
||||
#include <QDebug>
|
||||
|
||||
#include "io/config.h"
|
||||
#include "global/config.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
|
||||
|
||||
+37
-37
@@ -25,65 +25,65 @@
|
||||
#include "panels/project.h"
|
||||
#include "project/media.h"
|
||||
#include "project/sourcescommon.h"
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
SourceIconView::SourceIconView(QWidget *parent) : QListView(parent) {
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setResizeMode(QListView::Adjust);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setResizeMode(QListView::Adjust);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
}
|
||||
|
||||
void SourceIconView::show_context_menu() {
|
||||
project_parent->sources_common->show_context_menu(this, selectedIndexes());
|
||||
project_parent->sources_common->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);
|
||||
}
|
||||
if (selectedIndexes().size() == 1 && index.column() == 0) {
|
||||
project_parent->sources_common->item_click(project_parent->item_to_media(index), index);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceIconView::mousePressEvent(QMouseEvent* event) {
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
if (!indexAt(event->pos()).isValid()) selectionModel()->clear();
|
||||
QListView::mousePressEvent(event);
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
if (!indexAt(event->pos()).isValid()) selectionModel()->clear();
|
||||
QListView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void SourceIconView::dragEnterEvent(QDragEnterEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragEnterEvent(event);
|
||||
}
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragEnterEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceIconView::dragMoveEvent(QDragMoveEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragMoveEvent(event);
|
||||
}
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragMoveEvent(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());
|
||||
QModelIndex drop_item = indexAt(event->pos());
|
||||
if (!drop_item.isValid()) drop_item = rootIndex();
|
||||
project_parent->sources_common->dropEvent(this, event, drop_item, selectedIndexes());
|
||||
}
|
||||
|
||||
void SourceIconView::mouseDoubleClickEvent(QMouseEvent *) {
|
||||
bool default_behavior = true;
|
||||
if (selectedIndexes().size() == 1) {
|
||||
Media* m = project_parent->item_to_media(selectedIndexes().at(0));
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
default_behavior = false;
|
||||
setRootIndex(selectedIndexes().at(0));
|
||||
emit changed_root();
|
||||
}
|
||||
}
|
||||
if (default_behavior) {
|
||||
bool default_behavior = true;
|
||||
if (selectedIndexes().size() == 1) {
|
||||
Media* m = project_parent->item_to_media(selectedIndexes().at(0));
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
default_behavior = false;
|
||||
setRootIndex(selectedIndexes().at(0));
|
||||
emit changed_root();
|
||||
}
|
||||
}
|
||||
if (default_behavior) {
|
||||
project_parent->sources_common->mouseDoubleClickEvent(selectedIndexes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
-30
@@ -26,13 +26,13 @@
|
||||
#include "panels/viewer.h"
|
||||
#include "panels/panels.h"
|
||||
#include "rendering/renderfunctions.h"
|
||||
#include "project/undo.h"
|
||||
#include "project/sequence.h"
|
||||
#include "undo/undo.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "mainwindow.h"
|
||||
#include "io/config.h"
|
||||
#include "global/config.h"
|
||||
#include "project/media.h"
|
||||
#include "project/sourcescommon.h"
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
#include <QDragEnterEvent>
|
||||
#include <QMimeData>
|
||||
@@ -46,30 +46,30 @@
|
||||
#include <QProcess>
|
||||
|
||||
SourceTable::SourceTable(QWidget* parent) : QTreeView(parent) {
|
||||
setSortingEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
sortByColumn(0, Qt::AscendingOrder);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
setDragDropMode(QAbstractItemView::DragDrop);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
setSortingEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
sortByColumn(0, Qt::AscendingOrder);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
setDragDropMode(QAbstractItemView::DragDrop);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
}
|
||||
|
||||
void SourceTable::show_context_menu() {
|
||||
project_parent->sources_common->show_context_menu(this, selectionModel()->selectedRows());
|
||||
project_parent->sources_common->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);
|
||||
}
|
||||
if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) {
|
||||
project_parent->sources_common->item_click(project_parent->item_to_media(index), index);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceTable::mousePressEvent(QMouseEvent* event) {
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
QTreeView::mousePressEvent(event);
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
QTreeView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) {
|
||||
@@ -77,21 +77,21 @@ void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) {
|
||||
}
|
||||
|
||||
void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragEnterEvent(event);
|
||||
}
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragEnterEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceTable::dragMoveEvent(QDragMoveEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragMoveEvent(event);
|
||||
}
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceTable::dropEvent(QDropEvent* event) {
|
||||
project_parent->sources_common->dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows());
|
||||
project_parent->sources_common->dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows());
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
#include "mainwindow.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "project/sequence.h"
|
||||
#include "project/undo.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "undo/undo.h"
|
||||
#include "project/media.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "io/config.h"
|
||||
#include "global/config.h"
|
||||
#include "ui/menuhelper.h"
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
|
||||
#include "timelinewidget.h"
|
||||
|
||||
#include "oliveglobal.h"
|
||||
#include "global/global.h"
|
||||
#include "panels/panels.h"
|
||||
#include "project/projectelements.h"
|
||||
|
||||
#include "rendering/audio.h"
|
||||
#include "io/config.h"
|
||||
#include "global/config.h"
|
||||
#include "ui/sourcetable.h"
|
||||
#include "ui/sourceiconview.h"
|
||||
#include "project/undo.h"
|
||||
#include "undo/undo.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "dialogs/newsequencedialog.h"
|
||||
@@ -39,9 +39,9 @@
|
||||
#include "ui/menuhelper.h"
|
||||
#include "ui/focusfilter.h"
|
||||
#include "dialogs/clippropertiesdialog.h"
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
#include "project/effect.h"
|
||||
#include "effects/effect.h"
|
||||
|
||||
#include "effects/internal/solideffect.h"
|
||||
#include "effects/internal/texteffect.h"
|
||||
|
||||
+3
-3
@@ -28,11 +28,11 @@
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "project/sequence.h"
|
||||
#include "project/clip.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "project/footage.h"
|
||||
#include "project/media.h"
|
||||
#include "project/undo.h"
|
||||
#include "undo/undo.h"
|
||||
#include "timelinetools.h"
|
||||
|
||||
class Timeline;
|
||||
|
||||
+50
-50
@@ -28,67 +28,67 @@
|
||||
|
||||
#include "viewerwidget.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "project/sequence.h"
|
||||
#include "debug.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
// enforces aspect ratio
|
||||
ViewerContainer::ViewerContainer(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
fit(true),
|
||||
child(nullptr)
|
||||
QWidget(parent),
|
||||
fit(true),
|
||||
child(nullptr)
|
||||
{
|
||||
horizontal_scrollbar = new QScrollBar(Qt::Horizontal, this);
|
||||
vertical_scrollbar = new QScrollBar(Qt::Vertical, this);
|
||||
horizontal_scrollbar = new QScrollBar(Qt::Horizontal, this);
|
||||
vertical_scrollbar = new QScrollBar(Qt::Vertical, this);
|
||||
|
||||
horizontal_scrollbar->setVisible(false);
|
||||
vertical_scrollbar->setVisible(false);
|
||||
horizontal_scrollbar->setVisible(false);
|
||||
vertical_scrollbar->setVisible(false);
|
||||
|
||||
horizontal_scrollbar->setSingleStep(20);
|
||||
vertical_scrollbar->setSingleStep(20);
|
||||
horizontal_scrollbar->setSingleStep(20);
|
||||
vertical_scrollbar->setSingleStep(20);
|
||||
|
||||
child = new ViewerWidget(this);
|
||||
child->container = this;
|
||||
child = new ViewerWidget(this);
|
||||
child->container = this;
|
||||
|
||||
connect(horizontal_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed()));
|
||||
connect(vertical_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed()));
|
||||
connect(horizontal_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed()));
|
||||
connect(vertical_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed()));
|
||||
}
|
||||
|
||||
ViewerContainer::~ViewerContainer() {}
|
||||
|
||||
void ViewerContainer::dragScrollPress(const QPoint &p) {
|
||||
drag_start_x = p.x();
|
||||
drag_start_y = p.y();
|
||||
drag_start_x = p.x();
|
||||
drag_start_y = p.y();
|
||||
|
||||
horiz_start = horizontal_scrollbar->value();
|
||||
vert_start = vertical_scrollbar->value();
|
||||
horiz_start = horizontal_scrollbar->value();
|
||||
vert_start = vertical_scrollbar->value();
|
||||
}
|
||||
|
||||
void ViewerContainer::dragScrollMove(const QPoint &p) {
|
||||
int this_x = p.x();
|
||||
int this_y = p.y();
|
||||
int this_x = p.x();
|
||||
int this_y = p.y();
|
||||
|
||||
horizontal_scrollbar->setValue(horiz_start + (drag_start_x-this_x));
|
||||
vertical_scrollbar->setValue(vert_start + (drag_start_y-this_y));
|
||||
horizontal_scrollbar->setValue(horiz_start + (drag_start_x-this_x));
|
||||
vertical_scrollbar->setValue(vert_start + (drag_start_y-this_y));
|
||||
}
|
||||
|
||||
void ViewerContainer::parseWheelEvent(QWheelEvent *event) {
|
||||
if (event->modifiers() & Qt::AltModifier) {
|
||||
QApplication::sendEvent(horizontal_scrollbar, event);
|
||||
} else {
|
||||
QApplication::sendEvent(vertical_scrollbar, event);
|
||||
}
|
||||
if (event->modifiers() & Qt::AltModifier) {
|
||||
QApplication::sendEvent(horizontal_scrollbar, event);
|
||||
} else {
|
||||
QApplication::sendEvent(vertical_scrollbar, event);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerContainer::adjust() {
|
||||
if (viewer->seq != nullptr) {
|
||||
if (child->waveform) {
|
||||
child->move(0, 0);
|
||||
child->resize(size());
|
||||
} else {
|
||||
horizontal_scrollbar->setVisible(false);
|
||||
vertical_scrollbar->setVisible(false);
|
||||
if (viewer->seq != nullptr) {
|
||||
if (child->waveform) {
|
||||
child->move(0, 0);
|
||||
child->resize(size());
|
||||
} else {
|
||||
horizontal_scrollbar->setVisible(false);
|
||||
vertical_scrollbar->setVisible(false);
|
||||
|
||||
int zoomed_width = qRound(double(viewer->seq->width)*zoom);
|
||||
int zoomed_width = qRound(double(viewer->seq->width)*zoom);
|
||||
int zoomed_height = qRound(double(viewer->seq->height)*zoom);
|
||||
|
||||
if (fit || zoomed_width > width() || zoomed_height > height()) {
|
||||
@@ -147,28 +147,28 @@ void ViewerContainer::adjust() {
|
||||
child->move(zoomed_x, zoomed_y);
|
||||
child->resize(zoomed_width, zoomed_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerContainer::adjust_scrollbars() {
|
||||
horizontal_scrollbar->move(0, height()-horizontal_scrollbar->height());
|
||||
horizontal_scrollbar->setFixedWidth(qMax(0, width()-vertical_scrollbar->width()));
|
||||
horizontal_scrollbar->setPageStep(width());
|
||||
horizontal_scrollbar->move(0, height()-horizontal_scrollbar->height());
|
||||
horizontal_scrollbar->setFixedWidth(qMax(0, width()-vertical_scrollbar->width()));
|
||||
horizontal_scrollbar->setPageStep(width());
|
||||
|
||||
vertical_scrollbar->move(width() - vertical_scrollbar->width(), 0);
|
||||
vertical_scrollbar->setFixedHeight(qMax(0, height()-horizontal_scrollbar->height()));
|
||||
vertical_scrollbar->setPageStep(height());
|
||||
vertical_scrollbar->move(width() - vertical_scrollbar->width(), 0);
|
||||
vertical_scrollbar->setFixedHeight(qMax(0, height()-horizontal_scrollbar->height()));
|
||||
vertical_scrollbar->setPageStep(height());
|
||||
}
|
||||
|
||||
void ViewerContainer::resizeEvent(QResizeEvent *event) {
|
||||
event->accept();
|
||||
adjust();
|
||||
event->accept();
|
||||
adjust();
|
||||
}
|
||||
|
||||
void ViewerContainer::scroll_changed() {
|
||||
child->set_scroll(
|
||||
double(horizontal_scrollbar->value())/double(horizontal_scrollbar->maximum()),
|
||||
double(vertical_scrollbar->value())/double(vertical_scrollbar->maximum())
|
||||
);
|
||||
child->set_scroll(
|
||||
double(horizontal_scrollbar->value())/double(horizontal_scrollbar->maximum()),
|
||||
double(vertical_scrollbar->value())/double(vertical_scrollbar->maximum())
|
||||
);
|
||||
}
|
||||
|
||||
+4
-4
@@ -46,11 +46,11 @@ extern "C" {
|
||||
#include "project/projectelements.h"
|
||||
#include "rendering/renderfunctions.h"
|
||||
#include "rendering/audio.h"
|
||||
#include "io/config.h"
|
||||
#include "debug.h"
|
||||
#include "io/math.h"
|
||||
#include "global/config.h"
|
||||
#include "global/debug.h"
|
||||
#include "global/math.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "project/undo.h"
|
||||
#include "undo/undo.h"
|
||||
#include "project/media.h"
|
||||
#include "ui/viewercontainer.h"
|
||||
#include "rendering/cacher.h"
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@
|
||||
#include <QWaitCondition>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "project/footage.h"
|
||||
#include "project/effect.h"
|
||||
#include "effects/effect.h"
|
||||
#include "ui/viewerwindow.h"
|
||||
#include "ui/viewercontainer.h"
|
||||
#include "rendering/renderthread.h"
|
||||
|
||||
Reference in New Issue
Block a user