refactor: cut engine-to-UI include violations ahead of the liboakengine split

- slider DisplayType enums sink to node/sliderdisplaytype.h (canonical
  engine home); FloatSlider/RationalSlider alias them for compatibility
- DropWithoutSequenceBehavior enum sinks to common/dropworkflowbehavior.h
- Config errors now go through a registered ErrorHandler hook instead of
  QMessageBox with a MainWindow parent; the style default no longer
  depends on the UI style manager
- MainWindowLayoutInfo moves to node/project/serializer/ and its panel
  dependency is reduced to a plain std::map alias (PanelLayoutInfo),
  breaking the engine -> PanelWidget -> KDDockWidgets chain
- ProjectImportErrorDialog moves from task/ to dialog/projectimport/
- remove confirmed-redundant UI includes and give project.h/import.h/
  project.cpp the direct includes they were borrowing transitively
- project.h includes folder/sequence headers directly (it used both
  types in its own API all along)
This commit is contained in:
2026-07-20 00:52:12 +08:00
parent 98f2f3e224
commit 03d4087124
71 changed files with 321 additions and 163 deletions
+14 -14
View File
@@ -33,7 +33,7 @@ namespace olive
FloatSlider::FloatSlider(QWidget *parent)
: super(parent)
, display_type_(k_normal)
, display_type_(slider::k_normal)
{
set_value(0.0);
}
@@ -68,13 +68,13 @@ void FloatSlider::set_display_type(const FloatSlider::DisplayType &type)
display_type_ = type;
switch (display_type_) {
case k_normal:
case slider::k_normal:
clear_format();
break;
case k_decibel:
case slider::k_decibel:
set_format(tr("%1 dB"));
break;
case k_percentage:
case slider::k_percentage:
set_format(tr("%1%"));
break;
}
@@ -83,12 +83,12 @@ void FloatSlider::set_display_type(const FloatSlider::DisplayType &type)
double FloatSlider::transform_value_to_display(double val, DisplayType display)
{
switch (display) {
case k_normal:
case slider::k_normal:
break;
case k_decibel:
case slider::k_decibel:
val = Decibel::from_linear(val);
break;
case k_percentage:
case slider::k_percentage:
val *= 100.0;
break;
}
@@ -99,12 +99,12 @@ double FloatSlider::transform_value_to_display(double val, DisplayType display)
double FloatSlider::transform_display_to_value(double val, DisplayType display)
{
switch (display) {
case k_normal:
case slider::k_normal:
break;
case k_decibel:
case slider::k_decibel:
val = Decibel::to_linear(val);
break;
case k_percentage:
case slider::k_percentage:
val *= 0.01;
break;
}
@@ -117,7 +117,7 @@ QString FloatSlider::value_to_string(double val, FloatSlider::DisplayType displa
bool autotrim_decimal_places)
{
// Return negative infinity for zero volume
if (display == k_decibel && qIsNull(val)) {
if (display == slider::k_decibel && qIsNull(val)) {
return tr("\xE2\x88\x9E");
}
@@ -154,17 +154,17 @@ QVariant FloatSlider::adjust_drag_distance_internal(const QVariant &start,
const double &drag) const
{
switch (display_type_) {
case k_normal:
case slider::k_normal:
// No change here
break;
case k_decibel: {
case slider::k_decibel: {
double current_db = Decibel::from_linear(start.toDouble());
current_db += drag;
double adjusted_linear = Decibel::to_linear(current_db);
return adjusted_linear;
}
case k_percentage:
case slider::k_percentage:
return super::adjust_drag_distance_internal(start, drag * 0.01);
}
+5 -1
View File
@@ -23,6 +23,7 @@
#define OAK_FLOATSLIDER_H
#include "base/decimalsliderbase.h"
#include "node/sliderdisplaytype.h"
namespace olive
{
@@ -32,7 +33,10 @@ class FloatSlider : public DecimalSliderBase {
public:
FloatSlider(QWidget *parent = nullptr);
enum DisplayType { k_normal, k_decibel, k_percentage };
// The canonical definition lives in the engine layer
// (node/sliderdisplaytype.h); this alias keeps existing call sites
// source-compatible. Use slider::k_normal etc. for the enumerators.
using DisplayType = slider::FloatDisplayType;
double get_value() const;
+14 -14
View File
@@ -39,7 +39,7 @@ RationalSlider::RationalSlider(QWidget *parent)
connect(SliderBase::label(), &SliderLabel::customContextMenuRequested, this,
&RationalSlider::show_display_type_menu);
set_display_type(k_float);
set_display_type(slider::k_float);
set_value(Rational(0, 0));
}
@@ -109,13 +109,13 @@ QString RationalSlider::value_to_string(const QVariant &v) const
double val = r.to_double() + get_offset().value<Rational>().to_double();
switch (display_type_) {
case k_time:
case slider::k_time:
return QString::fromStdString(Timecode::time_to_timecode(
r, timebase_, Core::instance()->get_timecode_display()));
case k_float:
case slider::k_float:
return float_to_string(val, get_decimal_places(),
get_auto_trim_decimal_places());
case k_rational:
case slider::k_rational:
return QString::fromStdString(v.value<Rational>().to_string());
}
@@ -129,13 +129,13 @@ QVariant RationalSlider::string_to_value(const QString &s, bool *ok) const
*ok = false;
switch (display_type_) {
case k_time: {
case slider::k_time: {
r = Timecode::timecode_to_time(s.toStdString(), timebase_,
Core::instance()->get_timecode_display(),
ok);
break;
}
case k_float: {
case slider::k_float: {
// First, convert to a double
double d = s.toDouble(ok);
if (!(*ok)) {
@@ -146,7 +146,7 @@ QVariant RationalSlider::string_to_value(const QString &s, bool *ok) const
r = Rational::from_double(d, ok);
break;
}
case k_rational:
case slider::k_rational:
r = Rational::from_string(s.toStdString(), ok);
break;
}
@@ -185,29 +185,29 @@ void RationalSlider::show_display_type_menu()
Menu m(this);
if (!get_lock_display_type()) {
if (!disabled_.contains(k_float)) {
if (!disabled_.contains(slider::k_float)) {
QAction *float_action = m.addAction(tr("Float"));
float_action->setData(k_float);
float_action->setData(slider::k_float);
connect(float_action, &QAction::triggered, this,
&RationalSlider::set_display_type_from_menu);
}
if (!disabled_.contains(k_rational)) {
if (!disabled_.contains(slider::k_rational)) {
QAction *rational_action = m.addAction(tr("Rational"));
rational_action->setData(k_rational);
rational_action->setData(slider::k_rational);
connect(rational_action, &QAction::triggered, this,
&RationalSlider::set_display_type_from_menu);
}
if (!disabled_.contains(k_time)) {
if (!disabled_.contains(slider::k_time)) {
QAction *time_action = m.addAction(tr("Time"));
time_action->setData(k_time);
time_action->setData(slider::k_time);
connect(time_action, &QAction::triggered, this,
&RationalSlider::set_display_type_from_menu);
}
}
if (display_type_ == k_time) {
if (display_type_ == slider::k_time) {
if (!m.actions().isEmpty()) {
m.addSeparator();
}
+6 -1
View File
@@ -26,6 +26,7 @@
#include <QMouseEvent>
#include "base/decimalsliderbase.h"
#include "node/sliderdisplaytype.h"
namespace olive
{
@@ -43,8 +44,12 @@ class RationalSlider : public DecimalSliderBase {
public:
/**
* @brief enum containing the possibly display types
*
* The canonical definition lives in the engine layer
* (node/sliderdisplaytype.h); this alias keeps existing call sites
* source-compatible. Use slider::k_time etc. for the enumerators.
*/
enum DisplayType { k_time, k_float, k_rational };
using DisplayType = slider::RationalDisplayType;
RationalSlider(QWidget *parent = nullptr);