- Add PickRenderableFormat / IsColorAttachmentSupported so 3-channel Vulkan formats fall back to 4-channel when unsupported. - Make oakvulkan target and C ABI check conditional on Vulkan_FOUND; skip liboakvulkan build/dependencies when Vulkan headers/libs are absent. - Update Preferences tooltip to reflect Vulkan is an experimental prototype that may fall back to OpenGL. - Revise dynamic backend plan doc: phase 3/4/5 described as prototype frameworks with runtime validation pending, and list recent Vulkan fixes (init idempotency, descriptor/sampler lifetime, dynamic viewport/scissor, render pass clear, format probing). Both OAK_ENABLE_DYNAMIC_RENDER_BACKEND=ON and OFF configurations build and pass ctest (4/4).
194 lines
6.7 KiB
C++
194 lines
6.7 KiB
C++
/***
|
|
|
|
Olive - Non-Linear Video Editor
|
|
Copyright (C) 2022 Olive Team
|
|
Modifications Copyright (C) 2025 mikesolar
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
#include "preferencesbehaviortab.h"
|
|
|
|
#include <QCheckBox>
|
|
#include <QComboBox>
|
|
#include <QVBoxLayout>
|
|
|
|
#include "config/config.h"
|
|
|
|
namespace olive
|
|
{
|
|
|
|
PreferencesBehaviorTab::PreferencesBehaviorTab()
|
|
{
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
behavior_tree_ = new QTreeWidget();
|
|
layout->addWidget(behavior_tree_);
|
|
|
|
behavior_tree_->setColumnCount(2);
|
|
behavior_tree_->setHeaderLabels({ tr("Behavior"), tr("Setting") });
|
|
|
|
QTreeWidgetItem *general_group = AddParent(tr("General"));
|
|
AddItem(
|
|
tr("Enable hover focus"), QStringLiteral("HoverFocus"),
|
|
tr("Panels will be considered focused when the mouse cursor is over them without having to click them."),
|
|
general_group);
|
|
AddItem(tr("Enable slider ladder"), QStringLiteral("UseSliderLadders"),
|
|
general_group);
|
|
AddItem(
|
|
tr("Scrolling zooms by default"), QStringLiteral("ScrollZooms"),
|
|
tr("By default, scrolling will move the view around, and holding Ctrl/Cmd will make it zoom instead. "
|
|
"Enabling this will switch those, scrolling will zoom by default, and holding Ctrl/Cmd will move the view instead."),
|
|
general_group);
|
|
|
|
QTreeWidgetItem *audio_group = AddParent(tr("Audio"));
|
|
AddItem(tr("Enable audio scrubbing"), QStringLiteral("AudioScrubbing"),
|
|
audio_group);
|
|
|
|
QTreeWidgetItem *timeline_group = AddParent(tr("Timeline"));
|
|
AddItem(tr("Auto-Seek to Imported Clips"),
|
|
QStringLiteral("EnableSeekToImport"), timeline_group);
|
|
AddItem(tr("Edit Tool Also Seeks"), QStringLiteral("EditToolAlsoSeeks"),
|
|
timeline_group);
|
|
AddItem(tr("Edit Tool Selects Links"),
|
|
QStringLiteral("EditToolSelectsLinks"), timeline_group);
|
|
AddItem(tr("Enable Drag Files to Timeline"),
|
|
QStringLiteral("EnableDragFilesToTimeline"), timeline_group);
|
|
AddItem(tr("Invert Timeline Scroll Axes"),
|
|
QStringLiteral("InvertTimelineScrollAxes"),
|
|
tr("Hold ALT on any UI element to switch scrolling axes"),
|
|
timeline_group);
|
|
AddItem(tr("Seek Also Selects"), QStringLiteral("SeekAlsoSelects"),
|
|
timeline_group);
|
|
AddItem(tr("Seek to the End of Pastes"), QStringLiteral("PasteSeeks"),
|
|
timeline_group);
|
|
AddItem(tr("Selecting Also Seeks"), QStringLiteral("SelectAlsoSeeks"),
|
|
timeline_group);
|
|
|
|
QTreeWidgetItem *playback_group = AddParent(tr("Playback"));
|
|
AddItem(tr("Ask For Name When Setting Marker"),
|
|
QStringLiteral("SetNameWithMarker"), playback_group);
|
|
AddItem(tr("Automatically rewind at the end of a sequence"),
|
|
QStringLiteral("AutoSeekToBeginning"), playback_group);
|
|
|
|
QTreeWidgetItem *project_group = AddParent(tr("Project"));
|
|
AddItem(tr("Drop Files on Media to Replace"),
|
|
QStringLiteral("DropFileOnMediaToReplace"), project_group);
|
|
|
|
QTreeWidgetItem *node_group = AddParent(tr("Nodes"));
|
|
AddItem(tr("Add Default Effects to New Clips"),
|
|
QStringLiteral("AddDefaultEffectsToClips"), node_group);
|
|
AddItem(tr("Auto-Scale By Default"), QStringLiteral("AutoscaleByDefault"),
|
|
node_group);
|
|
AddItem(
|
|
tr("Splitting Clips Copies Dependencies"),
|
|
QStringLiteral("SplitClipsCopyNodes"),
|
|
tr("Multiple clips can share the same nodes. Disable this to automatically share node "
|
|
"dependencies among clips when copying or splitting them."),
|
|
node_group);
|
|
|
|
QTreeWidgetItem *rendering_group = AddParent(tr("Rendering"));
|
|
QTreeWidgetItem *graphics_backend_item =
|
|
new QTreeWidgetItem({ tr("Graphics Backend") });
|
|
graphics_backend_item->setToolTip(
|
|
0, tr("Selects the graphics API Oak should request on next launch. "
|
|
"Vulkan is experimental: on most systems it will fall back to "
|
|
"OpenGL or use a prototype Vulkan path that is not yet fully validated."));
|
|
rendering_group->addChild(graphics_backend_item);
|
|
graphics_backend_combobox_ = new QComboBox();
|
|
graphics_backend_combobox_->addItem(tr("OpenGL"), QStringLiteral("opengl"));
|
|
graphics_backend_combobox_->addItem(tr("Vulkan (experimental)"),
|
|
QStringLiteral("vulkan"));
|
|
const QString current_backend =
|
|
OLIVE_CONFIG("GraphicsBackend").toString().toLower();
|
|
const int backend_index = graphics_backend_combobox_->findData(
|
|
current_backend.isEmpty() ? QStringLiteral("opengl")
|
|
: current_backend);
|
|
graphics_backend_combobox_->setCurrentIndex(backend_index >= 0
|
|
? backend_index
|
|
: 0);
|
|
behavior_tree_->setItemWidget(graphics_backend_item, 1,
|
|
graphics_backend_combobox_);
|
|
|
|
QTreeWidgetItem *opengl_group = AddParent(tr("OpenGL"), rendering_group);
|
|
AddItem(tr("Use glFinish"), QStringLiteral("UseGLFinish"), opengl_group);
|
|
}
|
|
|
|
void PreferencesBehaviorTab::Accept(MultiUndoCommand *command)
|
|
{
|
|
Q_UNUSED(command)
|
|
|
|
for (auto iterator = config_map_.begin(); iterator != config_map_.end();
|
|
iterator++) {
|
|
OLIVE_CONFIG_STR(iterator.value()) =
|
|
(iterator.key()->checkState(0) == Qt::Checked);
|
|
}
|
|
|
|
OLIVE_CONFIG("GraphicsBackend") =
|
|
graphics_backend_combobox_->currentData().toString();
|
|
}
|
|
|
|
QTreeWidgetItem *PreferencesBehaviorTab::AddItem(const QString &text,
|
|
const QString &config_key,
|
|
const QString &tooltip,
|
|
QTreeWidgetItem *parent)
|
|
{
|
|
QTreeWidgetItem *item = new QTreeWidgetItem({ text });
|
|
item->setToolTip(0, tooltip);
|
|
item->setCheckState(
|
|
0, OLIVE_CONFIG_STR(config_key).toBool() ? Qt::Checked : Qt::Unchecked);
|
|
|
|
config_map_.insert(item, config_key);
|
|
|
|
if (parent) {
|
|
parent->addChild(item);
|
|
} else {
|
|
behavior_tree_->addTopLevelItem(item);
|
|
}
|
|
|
|
return item;
|
|
}
|
|
|
|
QTreeWidgetItem *PreferencesBehaviorTab::AddItem(const QString &text,
|
|
const QString &config_key,
|
|
QTreeWidgetItem *parent)
|
|
{
|
|
return AddItem(text, config_key, QString(), parent);
|
|
}
|
|
|
|
QTreeWidgetItem *PreferencesBehaviorTab::AddParent(const QString &text,
|
|
const QString &tooltip,
|
|
QTreeWidgetItem *parent)
|
|
{
|
|
QTreeWidgetItem *item = new QTreeWidgetItem({ text });
|
|
item->setToolTip(0, tooltip);
|
|
|
|
if (parent) {
|
|
parent->addChild(item);
|
|
} else {
|
|
behavior_tree_->addTopLevelItem(item);
|
|
}
|
|
|
|
return item;
|
|
}
|
|
|
|
QTreeWidgetItem *PreferencesBehaviorTab::AddParent(const QString &text,
|
|
QTreeWidgetItem *parent)
|
|
{
|
|
return AddParent(text, QString(), parent);
|
|
}
|
|
|
|
}
|