proxy: add dedicated Proxy dialog and preferences fields

- New ProxyDialog (Tools > Proxy Settings..., plus 'Proxy Settings...'
  in the project panel and timeline Proxy submenus) unifying global
  proxy settings, per-footage custom presets, generation and deletion
  in one place instead of three scattered entry points; this also fixes
  the Tools menu action opening the wrong preferences tab
- Preferences Disk tab gains an 'include audio in proxies' checkbox and
  an ffmpeg executable path field (blank = auto-detect)
- Add ProxyDialog smoke tests
This commit is contained in:
2026-07-16 22:53:13 +08:00
parent 6aaf37e2e5
commit ddca6a5e01
13 changed files with 592 additions and 2 deletions
+1
View File
@@ -45,6 +45,7 @@ add_executable(olive-gtest
viewer_display_repro_test.cpp
project_serializer_test.cpp
proxy_manager_test.cpp
proxy_dialog_test.cpp
timeline_marker_test.cpp
undo_stack_test.cpp
plugin_support_test.cpp
+72
View File
@@ -0,0 +1,72 @@
#include <gtest/gtest.h>
#include "config/config.h"
#include "dialog/proxy/proxydialog.h"
#include "node/project/footage/footage.h"
namespace
{
QVariant ProxyDialogConfigValue(const char *key)
{
return olive::Config::Current()[QString::fromUtf8(key)];
}
} // namespace
TEST(ProxyDialog, ConstructsInGlobalModeWithNullParent)
{
olive::ProxyDialog dialog(nullptr);
// The global settings editors must reflect the current config values
EXPECT_EQ(dialog.ProxyWidth(),
ProxyDialogConfigValue("ProxyWidth").value<int>());
EXPECT_EQ(dialog.ProxyHeight(),
ProxyDialogConfigValue("ProxyHeight").value<int>());
EXPECT_EQ(dialog.ProxyCRF(),
ProxyDialogConfigValue("ProxyCRF").value<int>());
EXPECT_EQ(dialog.ProxyPreset(),
ProxyDialogConfigValue("ProxyPreset").toString());
EXPECT_EQ(dialog.ProxyIncludeAudio(),
ProxyDialogConfigValue("ProxyIncludeAudio").toBool());
EXPECT_EQ(dialog.FFmpegPath(),
ProxyDialogConfigValue("FFmpegPath").toString());
}
TEST(ProxyDialog, ConstructsWithFootageList)
{
olive::Footage footage;
const QVector<olive::Footage *> items = { &footage };
olive::ProxyDialog dialog(nullptr, items);
SUCCEED();
}
TEST(ProxyDialog, AcceptSavesGlobalSettingsToConfig)
{
const int old_width = ProxyDialogConfigValue("ProxyWidth").value<int>();
const bool old_include_audio =
ProxyDialogConfigValue("ProxyIncludeAudio").toBool();
const QString old_ffmpeg_path =
ProxyDialogConfigValue("FFmpegPath").toString();
{
olive::ProxyDialog dialog(nullptr);
dialog.SetProxyWidth(640);
dialog.SetProxyIncludeAudio(!old_include_audio);
dialog.SetFFmpegPath(QStringLiteral("/tmp/oak-test-ffmpeg"));
dialog.accept();
}
EXPECT_EQ(ProxyDialogConfigValue("ProxyWidth").value<int>(), 640);
EXPECT_EQ(ProxyDialogConfigValue("ProxyIncludeAudio").toBool(),
!old_include_audio);
EXPECT_EQ(ProxyDialogConfigValue("FFmpegPath").toString(),
QStringLiteral("/tmp/oak-test-ffmpeg"));
// Restore previous config values so other tests are unaffected
olive::Config::Current()[QStringLiteral("ProxyWidth")] = old_width;
olive::Config::Current()[QStringLiteral("ProxyIncludeAudio")] =
old_include_audio;
olive::Config::Current()[QStringLiteral("FFmpegPath")] = old_ffmpeg_path;
}