Add configurable proxy settings and a menu entry
- Extend ProxyManager::ProxyParams with crf and preset, and update ProxyTask/ProxyParamsEqual to use them. - Add global config keys ProxyWidth, ProxyHeight, ProxyCRF, ProxyPreset. - Add a Proxy Settings group to Preferences -> Disk with width/height/CRF/preset controls. - Read proxy settings from config when generating proxies from the timeline. - Add Tools -> Proxy Settings... menu entry that opens Preferences on the Disk tab. - Add ConfigDialogBase::SetCurrentTab() so PreferencesDialog can start on a specific tab.
This commit is contained in:
@@ -35,7 +35,8 @@ bool ProxyParamsEqual(const ProxyManager::ProxyParams &a,
|
|||||||
const ProxyManager::ProxyParams &b)
|
const ProxyManager::ProxyParams &b)
|
||||||
{
|
{
|
||||||
return a.width == b.width && a.height == b.height &&
|
return a.width == b.width && a.height == b.height &&
|
||||||
a.version == b.version && a.extension == b.extension;
|
a.version == b.version && a.extension == b.extension &&
|
||||||
|
a.crf == b.crf && a.preset == b.preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProxyManager::GetProxyDirectory(const QString &cache_path)
|
QString ProxyManager::GetProxyDirectory(const QString &cache_path)
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public:
|
|||||||
int height = 720;
|
int height = 720;
|
||||||
int version = 1;
|
int version = 1;
|
||||||
QString extension = QStringLiteral("mp4");
|
QString extension = QStringLiteral("mp4");
|
||||||
|
int crf = 23;
|
||||||
|
QString preset = QStringLiteral("veryfast");
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Proxy {
|
struct Proxy {
|
||||||
|
|||||||
@@ -228,6 +228,12 @@ void Config::SetDefaults()
|
|||||||
SetEntryInternal(QStringLiteral("DiskCacheAhead"), NodeValue::kRational,
|
SetEntryInternal(QStringLiteral("DiskCacheAhead"), NodeValue::kRational,
|
||||||
QVariant::fromValue(rational(60)));
|
QVariant::fromValue(rational(60)));
|
||||||
|
|
||||||
|
SetEntryInternal(QStringLiteral("ProxyWidth"), NodeValue::kInt, 1280);
|
||||||
|
SetEntryInternal(QStringLiteral("ProxyHeight"), NodeValue::kInt, 720);
|
||||||
|
SetEntryInternal(QStringLiteral("ProxyCRF"), NodeValue::kInt, 23);
|
||||||
|
SetEntryInternal(QStringLiteral("ProxyPreset"), NodeValue::kText,
|
||||||
|
QStringLiteral("veryfast"));
|
||||||
|
|
||||||
SetEntryInternal(QStringLiteral("DefaultSequenceWidth"), NodeValue::kInt,
|
SetEntryInternal(QStringLiteral("DefaultSequenceWidth"), NodeValue::kInt,
|
||||||
1920);
|
1920);
|
||||||
SetEntryInternal(QStringLiteral("DefaultSequenceHeight"), NodeValue::kInt,
|
SetEntryInternal(QStringLiteral("DefaultSequenceHeight"), NodeValue::kInt,
|
||||||
|
|||||||
+2
-2
@@ -484,9 +484,9 @@ void Core::DialogImportShow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::DialogPreferencesShow()
|
void Core::DialogPreferencesShow(int start_tab)
|
||||||
{
|
{
|
||||||
PreferencesDialog pd(main_window_);
|
PreferencesDialog pd(main_window_, start_tab);
|
||||||
pd.exec();
|
pd.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -350,7 +350,7 @@ public slots:
|
|||||||
/**
|
/**
|
||||||
* @brief Show Preferences dialog
|
* @brief Show Preferences dialog
|
||||||
*/
|
*/
|
||||||
void DialogPreferencesShow();
|
void DialogPreferencesShow(int start_tab = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Show Project Properties dialog
|
* @brief Show Project Properties dialog
|
||||||
|
|||||||
@@ -91,4 +91,11 @@ void ConfigDialogBase::AddTab(ConfigDialogBaseTab *tab, const QString &title)
|
|||||||
tabs_.append(tab);
|
tabs_.append(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigDialogBase::SetCurrentTab(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < list_widget_->count()) {
|
||||||
|
list_widget_->setCurrentRow(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ class ConfigDialogBase : public QDialog {
|
|||||||
public:
|
public:
|
||||||
ConfigDialogBase(QWidget *parent = nullptr);
|
ConfigDialogBase(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
void SetCurrentTab(int index);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/**
|
/**
|
||||||
* @brief Override of accept to save preferences to Config.
|
* @brief Override of accept to save preferences to Config.
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
namespace olive
|
namespace olive
|
||||||
{
|
{
|
||||||
|
|
||||||
PreferencesDialog::PreferencesDialog(MainWindow *main_window)
|
PreferencesDialog::PreferencesDialog(MainWindow *main_window, int start_tab)
|
||||||
: ConfigDialogBase(main_window)
|
: ConfigDialogBase(main_window)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Preferences"));
|
setWindowTitle(tr("Preferences"));
|
||||||
@@ -49,6 +49,8 @@ PreferencesDialog::PreferencesDialog(MainWindow *main_window)
|
|||||||
AddTab(new PreferencesDiskTab(), tr("Disk"));
|
AddTab(new PreferencesDiskTab(), tr("Disk"));
|
||||||
AddTab(new PreferencesAudioTab(), tr("Audio"));
|
AddTab(new PreferencesAudioTab(), tr("Audio"));
|
||||||
AddTab(new PreferencesKeyboardTab(main_window), tr("Keyboard"));
|
AddTab(new PreferencesKeyboardTab(main_window), tr("Keyboard"));
|
||||||
|
|
||||||
|
SetCurrentTab(start_tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::AcceptEvent()
|
void PreferencesDialog::AcceptEvent()
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class PreferencesDialog : public ConfigDialogBase {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PreferencesDialog(MainWindow *main_window);
|
PreferencesDialog(MainWindow *main_window, int start_tab = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void AcceptEvent() override;
|
virtual void AcceptEvent() override;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "common/filefunctions.h"
|
#include "common/filefunctions.h"
|
||||||
|
#include "config/config.h"
|
||||||
|
|
||||||
namespace olive
|
namespace olive
|
||||||
{
|
{
|
||||||
@@ -92,6 +93,60 @@ PreferencesDiskTab::PreferencesDiskTab()
|
|||||||
OLIVE_CONFIG("DiskCacheBehind").value<rational>().toDouble());
|
OLIVE_CONFIG("DiskCacheBehind").value<rational>().toDouble());
|
||||||
cache_behavior_layout->addWidget(cache_behind_slider_, row, 3);
|
cache_behavior_layout->addWidget(cache_behind_slider_, row, 3);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
|
||||||
|
QGroupBox *proxy_group = new QGroupBox(tr("Proxy Settings"));
|
||||||
|
outer_layout->addWidget(proxy_group);
|
||||||
|
QGridLayout *proxy_layout = new QGridLayout(proxy_group);
|
||||||
|
|
||||||
|
int proxy_row = 0;
|
||||||
|
|
||||||
|
proxy_layout->addWidget(new QLabel(tr("Proxy Width:")), proxy_row, 0);
|
||||||
|
proxy_width_slider_ = new IntegerSlider();
|
||||||
|
proxy_width_slider_->SetMinimum(160);
|
||||||
|
proxy_width_slider_->SetMaximum(4096);
|
||||||
|
proxy_width_slider_->SetValue(
|
||||||
|
OLIVE_CONFIG("ProxyWidth").value<int>());
|
||||||
|
proxy_layout->addWidget(proxy_width_slider_, proxy_row, 1);
|
||||||
|
|
||||||
|
proxy_layout->addWidget(new QLabel(tr("Proxy Height:")), proxy_row, 2);
|
||||||
|
proxy_height_slider_ = new IntegerSlider();
|
||||||
|
proxy_height_slider_->SetMinimum(120);
|
||||||
|
proxy_height_slider_->SetMaximum(2160);
|
||||||
|
proxy_height_slider_->SetValue(
|
||||||
|
OLIVE_CONFIG("ProxyHeight").value<int>());
|
||||||
|
proxy_layout->addWidget(proxy_height_slider_, proxy_row, 3);
|
||||||
|
|
||||||
|
proxy_row++;
|
||||||
|
|
||||||
|
proxy_layout->addWidget(new QLabel(tr("Proxy CRF:")), proxy_row, 0);
|
||||||
|
proxy_crf_slider_ = new IntegerSlider();
|
||||||
|
proxy_crf_slider_->SetMinimum(0);
|
||||||
|
proxy_crf_slider_->SetMaximum(51);
|
||||||
|
proxy_crf_slider_->SetValue(
|
||||||
|
OLIVE_CONFIG("ProxyCRF").value<int>());
|
||||||
|
proxy_layout->addWidget(proxy_crf_slider_, proxy_row, 1);
|
||||||
|
|
||||||
|
proxy_layout->addWidget(new QLabel(tr("Proxy Preset:")), proxy_row, 2);
|
||||||
|
proxy_preset_combo_ = new QComboBox();
|
||||||
|
const QStringList presets = {
|
||||||
|
QStringLiteral("ultrafast"),
|
||||||
|
QStringLiteral("superfast"),
|
||||||
|
QStringLiteral("veryfast"),
|
||||||
|
QStringLiteral("faster"),
|
||||||
|
QStringLiteral("fast"),
|
||||||
|
QStringLiteral("medium"),
|
||||||
|
QStringLiteral("slow"),
|
||||||
|
QStringLiteral("slower"),
|
||||||
|
QStringLiteral("veryslow"),
|
||||||
|
};
|
||||||
|
for (const QString &preset : presets) {
|
||||||
|
proxy_preset_combo_->addItem(preset);
|
||||||
|
}
|
||||||
|
proxy_preset_combo_->setCurrentText(
|
||||||
|
OLIVE_CONFIG("ProxyPreset").toString());
|
||||||
|
proxy_layout->addWidget(proxy_preset_combo_, proxy_row, 3);
|
||||||
|
|
||||||
outer_layout->addStretch();
|
outer_layout->addStretch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +184,11 @@ void PreferencesDiskTab::Accept(MultiUndoCommand *command)
|
|||||||
rational::fromDouble(cache_behind_slider_->GetValue()));
|
rational::fromDouble(cache_behind_slider_->GetValue()));
|
||||||
OLIVE_CONFIG("DiskCacheAhead") = QVariant::fromValue(
|
OLIVE_CONFIG("DiskCacheAhead") = QVariant::fromValue(
|
||||||
rational::fromDouble(cache_ahead_slider_->GetValue()));
|
rational::fromDouble(cache_ahead_slider_->GetValue()));
|
||||||
|
|
||||||
|
OLIVE_CONFIG("ProxyWidth") = static_cast<int>(proxy_width_slider_->GetValue());
|
||||||
|
OLIVE_CONFIG("ProxyHeight") = static_cast<int>(proxy_height_slider_->GetValue());
|
||||||
|
OLIVE_CONFIG("ProxyCRF") = static_cast<int>(proxy_crf_slider_->GetValue());
|
||||||
|
OLIVE_CONFIG("ProxyPreset") = proxy_preset_combo_->currentText();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,14 @@
|
|||||||
#define PREFERENCESDISKTAB_H
|
#define PREFERENCESDISKTAB_H
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QComboBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "dialog/configbase/configdialogbase.h"
|
#include "dialog/configbase/configdialogbase.h"
|
||||||
#include "render/diskmanager.h"
|
#include "render/diskmanager.h"
|
||||||
#include "widget/slider/floatslider.h"
|
#include "widget/slider/floatslider.h"
|
||||||
|
#include "widget/slider/integerslider.h"
|
||||||
#include "widget/path/pathwidget.h"
|
#include "widget/path/pathwidget.h"
|
||||||
|
|
||||||
namespace olive
|
namespace olive
|
||||||
@@ -51,6 +53,11 @@ private:
|
|||||||
FloatSlider *cache_behind_slider_;
|
FloatSlider *cache_behind_slider_;
|
||||||
|
|
||||||
DiskCacheFolder *default_disk_cache_folder_;
|
DiskCacheFolder *default_disk_cache_folder_;
|
||||||
|
|
||||||
|
IntegerSlider *proxy_width_slider_;
|
||||||
|
IntegerSlider *proxy_height_slider_;
|
||||||
|
IntegerSlider *proxy_crf_slider_;
|
||||||
|
QComboBox *proxy_preset_combo_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ bool ProxyTask::Run()
|
|||||||
<< QStringLiteral("-an")
|
<< QStringLiteral("-an")
|
||||||
<< QStringLiteral("-vf") << scale_filter
|
<< QStringLiteral("-vf") << scale_filter
|
||||||
<< QStringLiteral("-c:v") << QStringLiteral("libx264")
|
<< QStringLiteral("-c:v") << QStringLiteral("libx264")
|
||||||
<< QStringLiteral("-preset") << QStringLiteral("veryfast")
|
<< QStringLiteral("-preset") << params_.preset
|
||||||
<< QStringLiteral("-crf") << QStringLiteral("23")
|
<< QStringLiteral("-crf") << QString::number(params_.crf)
|
||||||
<< QStringLiteral("-pix_fmt") << QStringLiteral("yuv420p")
|
<< QStringLiteral("-pix_fmt") << QStringLiteral("yuv420p")
|
||||||
<< QStringLiteral("-movflags") << QStringLiteral("+faststart")
|
<< QStringLiteral("-movflags") << QStringLiteral("+faststart")
|
||||||
<< QStringLiteral("-f") << container_format
|
<< QStringLiteral("-f") << container_format
|
||||||
|
|||||||
@@ -1196,6 +1196,10 @@ void TimelineWidget::GenerateProxiesForSelectedClips()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProxyManager::ProxyParams params;
|
ProxyManager::ProxyParams params;
|
||||||
|
params.width = OLIVE_CONFIG("ProxyWidth").value<int>();
|
||||||
|
params.height = OLIVE_CONFIG("ProxyHeight").value<int>();
|
||||||
|
params.crf = OLIVE_CONFIG("ProxyCRF").value<int>();
|
||||||
|
params.preset = OLIVE_CONFIG("ProxyPreset").toString();
|
||||||
const ProxyManager::Proxy proxy =
|
const ProxyManager::Proxy proxy =
|
||||||
ProxyManager::instance()->GetOrStartProxy(
|
ProxyManager::instance()->GetOrStartProxy(
|
||||||
item->project()->cache_path(), item->filename(),
|
item->project()->cache_path(), item->filename(),
|
||||||
|
|||||||
@@ -360,6 +360,12 @@ MainMenu::MainMenu(MainWindow *parent)
|
|||||||
|
|
||||||
tools_menu_->addSeparator();
|
tools_menu_->addSeparator();
|
||||||
|
|
||||||
|
tools_proxy_settings_item_ = new QAction(this);
|
||||||
|
Menu::ConformItem(tools_proxy_settings_item_, "proxysettings");
|
||||||
|
connect(tools_proxy_settings_item_, &QAction::triggered, this,
|
||||||
|
[]() { Core::instance()->DialogPreferencesShow(3); });
|
||||||
|
tools_menu_->addAction(tools_proxy_settings_item_);
|
||||||
|
|
||||||
tools_preferences_item_ = tools_menu_->AddItem(
|
tools_preferences_item_ = tools_menu_->AddItem(
|
||||||
"prefs", Core::instance(), &Core::DialogPreferencesShow, tr("Ctrl+,"));
|
"prefs", Core::instance(), &Core::DialogPreferencesShow, tr("Ctrl+,"));
|
||||||
|
|
||||||
@@ -879,6 +885,7 @@ void MainMenu::Retranslate()
|
|||||||
tools_add_item_->setText(tr("Add Tool"));
|
tools_add_item_->setText(tr("Add Tool"));
|
||||||
tools_record_item_->setText(tr("Record Tool"));
|
tools_record_item_->setText(tr("Record Tool"));
|
||||||
tools_snapping_item_->setText(tr("Enable Snapping"));
|
tools_snapping_item_->setText(tr("Enable Snapping"));
|
||||||
|
tools_proxy_settings_item_->setText(tr("Proxy Settings..."));
|
||||||
tools_preferences_item_->setText(tr("Preferences"));
|
tools_preferences_item_->setText(tr("Preferences"));
|
||||||
tools_add_item_menu_->setTitle(tr("Add Tool Item"));
|
tools_add_item_menu_->setTitle(tr("Add Tool Item"));
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|||||||
@@ -281,6 +281,7 @@ private:
|
|||||||
QAction *tools_add_item_;
|
QAction *tools_add_item_;
|
||||||
QAction *tools_record_item_;
|
QAction *tools_record_item_;
|
||||||
QAction *tools_snapping_item_;
|
QAction *tools_snapping_item_;
|
||||||
|
QAction *tools_proxy_settings_item_;
|
||||||
QAction *tools_preferences_item_;
|
QAction *tools_preferences_item_;
|
||||||
Menu *tools_add_item_menu_;
|
Menu *tools_add_item_menu_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user