added proxy dialog
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
#include "proxydialog.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QComboBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) : QDialog(parent) {
|
||||
// set dialog title
|
||||
setWindowTitle(tr("Create Proxy"));
|
||||
|
||||
// set proxy folder name to "Proxy", depending on the user's language
|
||||
proxy_folder_name = tr("Proxy");
|
||||
|
||||
// set up dialog's layout
|
||||
QGridLayout* layout = new QGridLayout(this);
|
||||
|
||||
// set the video dimensions of the proxy
|
||||
layout->addWidget(new QLabel(tr("Dimensions:"), this), 0, 0);
|
||||
|
||||
QComboBox* size_combobox = new QComboBox(this);
|
||||
size_combobox->addItem(tr("Same Size as Source"), 1.0);
|
||||
size_combobox->addItem(tr("Half Resolution (1/2)"), 0.5);
|
||||
size_combobox->addItem(tr("Quarter Resolution (1/4)"), 0.25);
|
||||
size_combobox->addItem(tr("Eighth Resolution (1/8)"), 0.125);
|
||||
size_combobox->addItem(tr("Sixteenth Resolution (1/16)"), 0.0625);
|
||||
layout->addWidget(size_combobox, 0, 1);
|
||||
|
||||
// set the desired format of the proxy to create
|
||||
layout->addWidget(new QLabel(tr("Format:"), this), 1, 0);
|
||||
|
||||
QComboBox* format_combobox = new QComboBox(this);
|
||||
format_combobox->addItem(tr("ProRes HQ"));
|
||||
format_combobox->addItem(tr("ProRes SQ"));
|
||||
format_combobox->addItem(tr("ProRes LT"));
|
||||
format_combobox->addItem(tr("DNxHD"));
|
||||
format_combobox->addItem(tr("H.264"));
|
||||
layout->addWidget(format_combobox, 1, 1);
|
||||
|
||||
// set the location to place the proxies
|
||||
layout->addWidget(new QLabel(tr("Location:"), this), 2, 0);
|
||||
|
||||
location_combobox = new QComboBox(this);
|
||||
location_combobox->addItem(tr("Same as Source (in \"%1\" folder)").arg(proxy_folder_name));
|
||||
location_combobox->addItem("");
|
||||
connect(location_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(location_changed(int)));
|
||||
layout->addWidget(location_combobox, 2, 1);
|
||||
|
||||
// location_changed will set the default "location" items
|
||||
location_changed(0);
|
||||
|
||||
// set up dialog buttons
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
buttons->setCenterButtons(true);
|
||||
layout->addWidget(buttons, 3, 0, 1, 2);
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
void ProxyDialog::location_changed(int i) {
|
||||
custom_location.clear();
|
||||
if (i == 1) {
|
||||
QString s = QFileDialog::getExistingDirectory(this);
|
||||
if (s.isEmpty()) {
|
||||
location_combobox->setCurrentIndex(0);
|
||||
} else {
|
||||
location_combobox->setItemText(1, s);
|
||||
custom_location = s;
|
||||
}
|
||||
} else {
|
||||
location_combobox->setItemText(1, tr("Custom Location"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef PROXYDIALOG_H
|
||||
#define PROXYDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVector>
|
||||
#include <QComboBox>
|
||||
|
||||
struct Footage;
|
||||
|
||||
class ProxyDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProxyDialog(QWidget* parent, const QVector<Footage*>& footage);
|
||||
private:
|
||||
// user's dimensions
|
||||
QComboBox* size_combobox;
|
||||
|
||||
// allows users to set the location to store proxies
|
||||
QComboBox* location_combobox;
|
||||
|
||||
// stores the custom location to store proxies if the user sets a custom location
|
||||
QString custom_location;
|
||||
|
||||
// stores the subdirectory to be made next to the source in the user's language
|
||||
QString proxy_folder_name;
|
||||
private slots:
|
||||
void location_changed(int i);
|
||||
};
|
||||
|
||||
#endif // PROXYDIALOG_H
|
||||
@@ -133,7 +133,8 @@ SOURCES += \
|
||||
project/effectloaders.cpp \
|
||||
io/crossplatformlib.cpp \
|
||||
effects/internal/vsthost.cpp \
|
||||
ui/flowlayout.cpp
|
||||
ui/flowlayout.cpp \
|
||||
dialogs/proxydialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@@ -234,7 +235,8 @@ HEADERS += \
|
||||
project/effectloaders.h \
|
||||
io/crossplatformlib.h \
|
||||
effects/internal/vsthost.h \
|
||||
ui/flowlayout.h
|
||||
ui/flowlayout.h \
|
||||
dialogs/proxydialog.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "panels/viewer.h"
|
||||
#include "project/projectfilter.h"
|
||||
#include "io/config.h"
|
||||
#include "dialogs/proxydialog.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QProcess>
|
||||
@@ -126,6 +127,11 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
|
||||
if (all_footage) {
|
||||
QAction* delete_footage_from_sequences = menu.addAction(tr("Delete All Clips Using This Media"));
|
||||
QObject::connect(delete_footage_from_sequences, SIGNAL(triggered(bool)), project_parent, SLOT(delete_clips_using_selected_media()));
|
||||
|
||||
QMenu* proxies = menu.addMenu(tr("Proxy"));
|
||||
proxies->addAction(tr("Create Proxy"), this, SLOT(open_create_proxy_dialog()));
|
||||
// proxies->addAction(tr("Modify Proxy"));
|
||||
// proxies->addAction(tr("Restore Original"));
|
||||
}
|
||||
|
||||
// delete media
|
||||
@@ -293,3 +299,10 @@ void SourcesCommon::item_renamed(Media* item) {
|
||||
editing_item = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesCommon::open_create_proxy_dialog() {
|
||||
QVector<Footage*> selected_footage;
|
||||
|
||||
ProxyDialog pd(mainWindow, selected_footage);
|
||||
pd.exec();
|
||||
}
|
||||
|
||||
+19
-18
@@ -11,29 +11,30 @@ class QAbstractItemView;
|
||||
class QDropEvent;
|
||||
|
||||
class SourcesCommon : public QObject {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourcesCommon(Project *parent);
|
||||
QAbstractItemView* view;
|
||||
void show_context_menu(QWidget* parent, const QModelIndexList &items);
|
||||
SourcesCommon(Project *parent);
|
||||
QAbstractItemView* view;
|
||||
void show_context_menu(QWidget* parent, const QModelIndexList &items);
|
||||
|
||||
void mousePressEvent(QMouseEvent* e);
|
||||
void mouseDoubleClickEvent(QMouseEvent* e, const QModelIndexList& selected_items);
|
||||
void dropEvent(QWidget *parent, QDropEvent* e, const QModelIndex& drop_item, const QModelIndexList &items);
|
||||
void mousePressEvent(QMouseEvent* e);
|
||||
void mouseDoubleClickEvent(QMouseEvent* e, const QModelIndexList& selected_items);
|
||||
void dropEvent(QWidget *parent, QDropEvent* e, const QModelIndex& drop_item, const QModelIndexList &items);
|
||||
|
||||
void item_click(Media* m, const QModelIndex &index);
|
||||
void item_click(Media* m, const QModelIndex &index);
|
||||
private slots:
|
||||
void create_seq_from_selected();
|
||||
void reveal_in_browser();
|
||||
void rename_interval();
|
||||
void item_renamed(Media *item);
|
||||
void create_seq_from_selected();
|
||||
void reveal_in_browser();
|
||||
void rename_interval();
|
||||
void item_renamed(Media *item);
|
||||
void open_create_proxy_dialog();
|
||||
private:
|
||||
Media* editing_item;
|
||||
QModelIndex editing_index;
|
||||
QModelIndexList selected_items;
|
||||
Project* project_parent;
|
||||
void stop_rename_timer();
|
||||
QTimer rename_timer;
|
||||
Media* editing_item;
|
||||
QModelIndex editing_index;
|
||||
QModelIndexList selected_items;
|
||||
Project* project_parent;
|
||||
void stop_rename_timer();
|
||||
QTimer rename_timer;
|
||||
};
|
||||
|
||||
#endif // SOURCESCOMMON_H
|
||||
|
||||
Reference in New Issue
Block a user