various menu improvements

This commit is contained in:
itsmattkc
2018-12-30 20:58:51 +11:00
parent 34fc8b81d2
commit f347c8eabe
9 changed files with 160 additions and 127 deletions
+23 -14
View File
@@ -268,6 +268,13 @@ MainWindow::~MainWindow() {
close_debug();
}
void MainWindow::make_new_menu(QMenu *parent) {
parent->addAction("&Project", this, SLOT(new_project()), QKeySequence("Ctrl+N"));
parent->addSeparator();
parent->addAction("&Sequence", this, SLOT(new_sequence()), QKeySequence("Ctrl+Shift+N"));
parent->addAction("&Folder", this, SLOT(new_folder()));
}
void MainWindow::show_about() {
AboutDialog a(this);
a.exec();
@@ -356,7 +363,7 @@ void MainWindow::redo() {
update_ui(true);
}
void MainWindow::openSpeedDialog() {
void MainWindow::open_speed_dialog() {
if (sequence != NULL) {
SpeedDialog s(this);
for (int i=0;i<sequence->clips.size();i++) {
@@ -469,10 +476,7 @@ void MainWindow::setup_menus() {
connect(file_menu, SIGNAL(aboutToShow()), this, SLOT(fileMenu_About_To_Be_Shown()));
QMenu* new_menu = file_menu->addMenu("&New");
new_menu->addAction("&Project", this, SLOT(new_project()), QKeySequence("Ctrl+N"));
new_menu->addSeparator();
new_menu->addAction("&Sequence", this, SLOT(new_sequence()), QKeySequence("Ctrl+Shift+N"));
new_menu->addAction("&Folder", this, SLOT(new_folder()));
make_new_menu(new_menu);
file_menu->addAction("&Open Project", this, SLOT(open_project()), QKeySequence("Ctrl+O"));
@@ -563,6 +567,10 @@ void MainWindow::setup_menus() {
track_lines->setCheckable(true);
track_lines->setData(reinterpret_cast<quintptr>(&config.show_track_lines));
rectified_waveforms = view_menu->addAction("Rectified Waveforms", this, SLOT(toggle_bool_action()));
rectified_waveforms->setCheckable(true);
rectified_waveforms->setData(reinterpret_cast<quintptr>(&config.rectified_waveforms));
view_menu->addSeparator();
frames_action = view_menu->addAction("Frames", this, SLOT(set_timecode_view()));
@@ -584,18 +592,23 @@ void MainWindow::setup_menus() {
title_safe_off = title_safe_area_menu->addAction("Off");
title_safe_off->setCheckable(true);
connect(title_safe_off, SIGNAL(triggered(bool)), this, SLOT(set_tsa_disable()));
title_safe_default = title_safe_area_menu->addAction("Default");
title_safe_default->setCheckable(true);
connect(title_safe_default, SIGNAL(triggered(bool)), this, SLOT(set_tsa_default()));
title_safe_43 = title_safe_area_menu->addAction("4:3");
title_safe_43->setCheckable(true);
connect(title_safe_43, SIGNAL(triggered(bool)), this, SLOT(set_tsa_43()));
title_safe_169 = title_safe_area_menu->addAction("16:9");
title_safe_169->setCheckable(true);
connect(title_safe_169, SIGNAL(triggered(bool)), this, SLOT(set_tsa_169()));
title_safe_custom = title_safe_area_menu->addAction("Custom");
title_safe_custom->setCheckable(true);
connect(title_safe_custom, SIGNAL(triggered(bool)), this, SLOT(set_tsa_custom()));
view_menu->addSeparator();
@@ -709,10 +722,6 @@ void MainWindow::setup_menus() {
scroll_wheel_zooms->setCheckable(true);
scroll_wheel_zooms->setData(reinterpret_cast<quintptr>(&config.scroll_zooms));
rectified_waveforms = tools_menu->addAction("Rectified Waveforms", this, SLOT(toggle_bool_action()));
rectified_waveforms->setCheckable(true);
rectified_waveforms->setData(reinterpret_cast<quintptr>(&config.rectified_waveforms));
enable_drag_files_to_timeline = tools_menu->addAction("Enable Drag Files to Timeline", this, SLOT(toggle_bool_action()));
enable_drag_files_to_timeline->setCheckable(true);
enable_drag_files_to_timeline->setData(reinterpret_cast<quintptr>(&config.enable_drag_files_to_timeline));
@@ -1051,32 +1060,32 @@ void MainWindow::ripple_delete_inout()
}
}
void MainWindow::on_actionDefault_triggered() {
void MainWindow::set_tsa_default() {
config.show_title_safe_area = true;
config.use_custom_title_safe_ratio = false;
panel_sequence_viewer->viewer_widget->update();
}
void MainWindow::on_actionOff_triggered() {
void MainWindow::set_tsa_disable() {
config.show_title_safe_area = false;
panel_sequence_viewer->viewer_widget->update();
}
void MainWindow::on_action4_3_triggered() {
void MainWindow::set_tsa_43() {
config.show_title_safe_area = true;
config.use_custom_title_safe_ratio = true;
config.custom_title_safe_ratio = 4.0/3.0;
panel_sequence_viewer->viewer_widget->update();
}
void MainWindow::on_action16_9_triggered() {
void MainWindow::set_tsa_169() {
config.show_title_safe_area = true;
config.use_custom_title_safe_ratio = true;
config.custom_title_safe_ratio = 16.0/9.0;
panel_sequence_viewer->viewer_widget->update();
}
void MainWindow::on_actionCustom_triggered() {
void MainWindow::set_tsa_custom() {
QString input;
bool invalid = false;
QRegExp arTest("[0-9.]+:[0-9.]+");
+9 -6
View File
@@ -15,10 +15,12 @@ public:
void updateTitle(const QString &url);
~MainWindow();
void make_new_menu(QMenu* parent);
public slots:
void undo();
void redo();
void openSpeedDialog();
void open_speed_dialog();
void cut();
void copy();
void paste();
@@ -87,11 +89,12 @@ private slots:
void delete_inout();
void ripple_delete_inout();
void on_actionDefault_triggered();
void on_actionOff_triggered();
void on_action4_3_triggered();
void on_action16_9_triggered();
void on_actionCustom_triggered();
// title safe area functions
void set_tsa_disable();
void set_tsa_default();
void set_tsa_43();
void set_tsa_169();
void set_tsa_custom();
void set_marker();
+1 -1
View File
@@ -352,7 +352,7 @@ Media *Project::item_to_media(const QModelIndex &index) {
// return static_cast<Media*>(index.internalPointer());
}
void Project::get_all_media_from_table(QList<Media*> items, QList<Media*>& list, int search_type) {
void Project::get_all_media_from_table(QList<Media*>& items, QList<Media*>& list, int search_type) {
for (int i=0;i<items.size();i++) {
Media* item = items.at(i);
if (item->get_type() == MEDIA_TYPE_FOLDER) {
+1 -1
View File
@@ -76,6 +76,7 @@ public:
QModelIndexList get_current_selected();
void start_preview_generator(Media* item, bool replacing);
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
public slots:
void import_dialog();
void delete_selected_media();
@@ -89,7 +90,6 @@ private:
int folder_id;
int media_id;
int sequence_id;
void get_all_media_from_table(QList<Media *> items, QList<Media *> &list, int type);
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
QString get_file_name_from_path(const QString &path);
QDir proj_dir;
+68 -68
View File
@@ -7,94 +7,94 @@
Sequence::Sequence() :
playhead(0),
using_workarea(false),
workarea_in(0),
workarea_out(0),
wrapper_sequence(false)
using_workarea(false),
workarea_in(0),
workarea_out(0),
wrapper_sequence(false)
{
}
Sequence::~Sequence() {
// dealloc all clips
for (int i=0;i<clips.size();i++) {
delete clips.at(i);
}
// dealloc all clips
for (int i=0;i<clips.size();i++) {
delete clips.at(i);
}
}
Sequence* Sequence::copy() {
Sequence* s = new Sequence();
s->name = name + " (copy)";
s->width = width;
s->height = height;
s->frame_rate = frame_rate;
s->audio_frequency = audio_frequency;
s->audio_layout = audio_layout;
s->clips.resize(clips.size());
for (int i=0;i<clips.size();i++) {
Clip* c = clips.at(i);
if (c == NULL) {
s->clips[i] = NULL;
} else {
Clip* copy = c->copy(s);
copy->linked = c->linked;
s->clips[i] = copy;
}
}
return s;
Sequence* s = new Sequence();
s->name = name + " (copy)";
s->width = width;
s->height = height;
s->frame_rate = frame_rate;
s->audio_frequency = audio_frequency;
s->audio_layout = audio_layout;
s->clips.resize(clips.size());
for (int i=0;i<clips.size();i++) {
Clip* c = clips.at(i);
if (c == NULL) {
s->clips[i] = NULL;
} else {
Clip* copy = c->copy(s);
copy->linked = c->linked;
s->clips[i] = copy;
}
}
return s;
}
long Sequence::getEndFrame() {
long end = 0;
for (int j=0;j<clips.size();j++) {
Clip* c = clips.at(j);
if (c != NULL && c->timeline_out > end) {
end = c->timeline_out;
}
}
return end;
long end = 0;
for (int j=0;j<clips.size();j++) {
Clip* c = clips.at(j);
if (c != NULL && c->timeline_out > end) {
end = c->timeline_out;
}
}
return end;
}
void Sequence::hard_delete_transition(Clip *c, int type) {
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
if (transition_index > -1) {
bool del = true;
for (int i=0;i<clips.size();i++) {
Clip* cc = clips.at(i);
if (cc != NULL
&& c != cc
&& (cc->opening_transition == transition_index
|| cc->closing_transition == transition_index)) {
// another clip is using this, don't delete just yet
del = false;
break;
}
}
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
if (transition_index > -1) {
bool del = true;
for (int i=0;i<clips.size();i++) {
Clip* cc = clips.at(i);
if (cc != NULL
&& c != cc
&& (cc->opening_transition == transition_index
|| cc->closing_transition == transition_index)) {
// another clip is using this, don't delete just yet
del = false;
break;
}
}
if (del) {
delete transitions.at(transition_index);
transitions[transition_index] = NULL;
}
if (del) {
delete transitions.at(transition_index);
transitions[transition_index] = NULL;
}
if (type == TA_OPENING_TRANSITION) {
c->opening_transition = -1;
} else {
c->closing_transition = -1;
}
}
if (type == TA_OPENING_TRANSITION) {
c->opening_transition = -1;
} else {
c->closing_transition = -1;
}
}
}
void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
int vt = 0;
int at = 0;
for (int j=0;j<clips.size();j++) {
Clip* c = clips.at(j);
if (c != NULL) {
if (c->track < 0 && c->track < vt) { // video clip
vt = c->track;
} else if (c->track > at) {
at = c->track;
}
}
for (int j=0;j<clips.size();j++) {
Clip* c = clips.at(j);
if (c != NULL) {
if (c->track < 0 && c->track < vt) { // video clip
vt = c->track;
} else if (c->track > at) {
at = c->track;
}
}
}
if (video_tracks != NULL) *video_tracks = vt;
if (audio_tracks != NULL) *audio_tracks = at;
+14 -13
View File
@@ -8,35 +8,36 @@
struct Clip;
class Transition;
class Media;
struct Sequence {
Sequence();
~Sequence();
Sequence* copy();
QString name;
void getTrackLimits(int* video_tracks, int* audio_tracks);
Sequence* copy();
QString name;
void getTrackLimits(int* video_tracks, int* audio_tracks);
long getEndFrame();
void hard_delete_transition(Clip *c, int type);
void hard_delete_transition(Clip *c, int type);
int width;
int height;
double frame_rate;
double frame_rate;
int audio_frequency;
int audio_layout;
int audio_layout;
QVector<Selection> selections;
long playhead;
bool using_workarea;
long workarea_in;
long workarea_out;
bool using_workarea;
long workarea_in;
long workarea_out;
bool wrapper_sequence;
bool wrapper_sequence;
int save_id;
int save_id;
QVector<Marker> markers;
QVector<Marker> markers;
QVector<Clip*> clips;
QVector<Transition*> transitions;
QVector<Transition*> transitions;
};
// static variable for the currently active sequence
+2 -2
View File
@@ -52,8 +52,8 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
QAction* import_action = menu.addAction("Import...");
QObject::connect(import_action, SIGNAL(triggered(bool)), project_parent, SLOT(import_dialog()));
QAction* new_folder_action = menu.addAction("New Folder...");
QObject::connect(new_folder_action, SIGNAL(triggered(bool)), mainWindow, SLOT(new_folder()));
QMenu* new_menu = menu.addMenu("New");
mainWindow->make_new_menu(new_menu);
if (items.size() > 0) {
Media* m = project_parent->item_to_media(items.at(0));
+20 -1
View File
@@ -19,6 +19,7 @@
#include "dialogs/stabilizerdialog.h"
#include "project/media.h"
#include "ui/resizablescrollbar.h"
#include "dialogs/newsequencedialog.h"
#include "debug.h"
#include "project/effect.h"
@@ -133,7 +134,8 @@ void TimelineWidget::show_context_menu(const QPoint& pos) {
connect(ripple_delete_action, SIGNAL(triggered(bool)), this, SLOT(right_click_ripple()));
}
menu.addAction("Sequence settings coming soon...");
QAction* seq_settings = menu.addAction("Sequence Settings");
connect(seq_settings, SIGNAL(triggered(bool)), this, SLOT(open_sequence_properties()));
} else {
// clips are selected
QAction* cutAction = menu.addAction("C&ut");
@@ -256,6 +258,23 @@ void TimelineWidget::show_stabilizer_diag() {
sd.exec();
}
void TimelineWidget::open_sequence_properties() {
QList<Media*> sequence_items;
QList<Media*> all_top_level_items;
for (int i=0;i<project_model.childCount();i++) {
all_top_level_items.append(project_model.child(i));
}
panel_project->get_all_media_from_table(all_top_level_items, sequence_items, MEDIA_TYPE_SEQUENCE); // find all sequences in project
for (int i=0;i<sequence_items.size();i++) {
if (sequence_items.at(i)->to_sequence() == sequence) {
NewSequenceDialog nsd(this, sequence_items.at(i));
nsd.exec();
return;
}
}
QMessageBox::critical(this, "Error", "Couldn't locate media wrapper for sequence.");
}
bool same_sign(int a, int b) {
return (a < 0) == (b < 0);
}
+22 -21
View File
@@ -33,13 +33,13 @@ public:
protected:
void paintEvent(QPaintEvent*);
void resizeEvent(QResizeEvent *event);
void resizeEvent(QResizeEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void leaveEvent(QEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void leaveEvent(QEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
@@ -49,18 +49,18 @@ protected:
void wheelEvent(QWheelEvent *event);
private:
void init_ghosts();
void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
bool is_track_visible(int track);
int getTrackFromScreenPoint(int y);
void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
bool is_track_visible(int track);
int getTrackFromScreenPoint(int y);
int getScreenPointFromTrack(int track);
int getClipIndexFromCoords(long frame, int track);
int track_resize_mouse_cache;
int track_resize_old_value;
bool track_resizing;
int track_target;
int track_resize_mouse_cache;
int track_resize_old_value;
bool track_resizing;
int track_target;
QVector<Clip*> pre_clips;
QVector<Clip*> pre_clips;
QVector<Clip*> post_clips;
Sequence* self_created_sequence;
@@ -68,10 +68,10 @@ private:
// used for "right click ripple"
long rc_ripple_min;
long rc_ripple_max;
Media* rc_reveal_media;
Media* rc_reveal_media;
QTimer tooltip_timer;
int tooltip_clip;
QTimer tooltip_timer;
int tooltip_clip;
int scroll;
@@ -84,11 +84,12 @@ public slots:
private slots:
void reveal_media();
void right_click_ripple();
void show_context_menu(const QPoint& pos);
void toggle_autoscale();
void tooltip_timer_timeout();
void show_context_menu(const QPoint& pos);
void toggle_autoscale();
void tooltip_timer_timeout();
void rename_clip();
void show_stabilizer_diag();
void show_stabilizer_diag();
void open_sequence_properties();
};
#endif // TIMELINEWIDGET_H