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:
@@ -91,4 +91,11 @@ void ConfigDialogBase::AddTab(ConfigDialogBaseTab *tab, const QString &title)
|
||||
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:
|
||||
ConfigDialogBase(QWidget *parent = nullptr);
|
||||
|
||||
void SetCurrentTab(int index);
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Override of accept to save preferences to Config.
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
PreferencesDialog::PreferencesDialog(MainWindow *main_window)
|
||||
PreferencesDialog::PreferencesDialog(MainWindow *main_window, int start_tab)
|
||||
: ConfigDialogBase(main_window)
|
||||
{
|
||||
setWindowTitle(tr("Preferences"));
|
||||
@@ -49,6 +49,8 @@ PreferencesDialog::PreferencesDialog(MainWindow *main_window)
|
||||
AddTab(new PreferencesDiskTab(), tr("Disk"));
|
||||
AddTab(new PreferencesAudioTab(), tr("Audio"));
|
||||
AddTab(new PreferencesKeyboardTab(main_window), tr("Keyboard"));
|
||||
|
||||
SetCurrentTab(start_tab);
|
||||
}
|
||||
|
||||
void PreferencesDialog::AcceptEvent()
|
||||
|
||||
@@ -45,7 +45,7 @@ class PreferencesDialog : public ConfigDialogBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PreferencesDialog(MainWindow *main_window);
|
||||
PreferencesDialog(MainWindow *main_window, int start_tab = 0);
|
||||
|
||||
protected:
|
||||
virtual void AcceptEvent() override;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "common/filefunctions.h"
|
||||
#include "config/config.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
@@ -92,6 +93,60 @@ PreferencesDiskTab::PreferencesDiskTab()
|
||||
OLIVE_CONFIG("DiskCacheBehind").value<rational>().toDouble());
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -129,6 +184,11 @@ void PreferencesDiskTab::Accept(MultiUndoCommand *command)
|
||||
rational::fromDouble(cache_behind_slider_->GetValue()));
|
||||
OLIVE_CONFIG("DiskCacheAhead") = QVariant::fromValue(
|
||||
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
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
#include "render/diskmanager.h"
|
||||
#include "widget/slider/floatslider.h"
|
||||
#include "widget/slider/integerslider.h"
|
||||
#include "widget/path/pathwidget.h"
|
||||
|
||||
namespace olive
|
||||
@@ -51,6 +53,11 @@ private:
|
||||
FloatSlider *cache_behind_slider_;
|
||||
|
||||
DiskCacheFolder *default_disk_cache_folder_;
|
||||
|
||||
IntegerSlider *proxy_width_slider_;
|
||||
IntegerSlider *proxy_height_slider_;
|
||||
IntegerSlider *proxy_crf_slider_;
|
||||
QComboBox *proxy_preset_combo_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user