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:
@@ -22,8 +22,6 @@ set(OLIVE_SOURCES
|
||||
window/mainwindow/mainstatusbar.cpp
|
||||
window/mainwindow/mainwindow.h
|
||||
window/mainwindow/mainwindow.cpp
|
||||
window/mainwindow/mainwindowlayoutinfo.h
|
||||
window/mainwindow/mainwindowlayoutinfo.cpp
|
||||
window/mainwindow/mainwindowundo.h
|
||||
window/mainwindow/mainwindowundo.cpp
|
||||
PARENT_SCOPE
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <kddockwidgets/Config.h>
|
||||
#include <kddockwidgets/MainWindow.h>
|
||||
|
||||
#include "mainwindowlayoutinfo.h"
|
||||
#include "node/project/serializer/mainwindowlayoutinfo.h"
|
||||
#include "node/project.h"
|
||||
#include "panel/multicam/multicampanel.h"
|
||||
#include "panel/panelmanager.h"
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
/*
|
||||
* Oak Video Editor - Non-Linear Video Editor
|
||||
* Copyright (C) 2025 Olive CE Team
|
||||
*
|
||||
* 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 "mainwindowlayoutinfo.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
void MainWindowLayoutInfo::to_xml(QXmlStreamWriter *writer) const
|
||||
{
|
||||
writer->writeAttribute(QStringLiteral("version"),
|
||||
QString::number(k_version));
|
||||
|
||||
writer->writeStartElement(QStringLiteral("folders"));
|
||||
|
||||
foreach (Folder *folder, open_folders_) {
|
||||
writer->writeTextElement(
|
||||
QStringLiteral("folder"),
|
||||
QString::number(reinterpret_cast<quintptr>(folder)));
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // folders
|
||||
|
||||
writer->writeStartElement(QStringLiteral("timeline"));
|
||||
|
||||
foreach (Sequence *sequence, open_sequences_) {
|
||||
writer->writeTextElement(
|
||||
QStringLiteral("sequence"),
|
||||
QString::number(reinterpret_cast<quintptr>(sequence)));
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // timeline
|
||||
|
||||
writer->writeStartElement(QStringLiteral("viewers"));
|
||||
|
||||
foreach (ViewerOutput *viewer, open_viewers_) {
|
||||
writer->writeTextElement(
|
||||
QStringLiteral("viewer"),
|
||||
QString::number(reinterpret_cast<quintptr>(viewer)));
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // viewers
|
||||
|
||||
writer->writeStartElement(QStringLiteral("data"));
|
||||
|
||||
for (auto it = panel_data_.cbegin(); it != panel_data_.cend(); it++) {
|
||||
writer->writeStartElement(QStringLiteral("panel"));
|
||||
|
||||
writer->writeAttribute(QStringLiteral("id"), it->first);
|
||||
|
||||
const PanelWidget::Info &info = it->second;
|
||||
for (auto jt = info.cbegin(); jt != info.cend(); jt++) {
|
||||
writer->writeStartElement(QStringLiteral("option"));
|
||||
|
||||
writer->writeAttribute(QStringLiteral("name"), jt->first);
|
||||
|
||||
writer->writeCharacters(jt->second);
|
||||
|
||||
writer->writeEndElement(); // option
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // panel
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // data
|
||||
|
||||
writer->writeTextElement(QStringLiteral("state"),
|
||||
QString(state_.toBase64()));
|
||||
}
|
||||
|
||||
MainWindowLayoutInfo
|
||||
MainWindowLayoutInfo::from_xml(QXmlStreamReader *reader,
|
||||
const QHash<quintptr, Node *> &node_ptrs)
|
||||
{
|
||||
MainWindowLayoutInfo info;
|
||||
|
||||
unsigned int file_version = 0;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("version")) {
|
||||
file_version = attr.value().toUInt();
|
||||
}
|
||||
}
|
||||
|
||||
// Really basic version checking, in the future we may use this to parse multiple versions
|
||||
if (file_version != k_version) {
|
||||
}
|
||||
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("folders")) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("folder")) {
|
||||
quintptr item_id = reader->readElementText().toULongLong();
|
||||
|
||||
Folder *open_item =
|
||||
static_cast<Folder *>(node_ptrs.value(item_id));
|
||||
info.open_folders_.push_back(open_item);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("timeline")) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("sequence")) {
|
||||
quintptr item_id = reader->readElementText().toULongLong();
|
||||
|
||||
Sequence *open_seq =
|
||||
static_cast<Sequence *>(node_ptrs.value(item_id));
|
||||
info.open_sequences_.push_back(open_seq);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("viewers")) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("viewer")) {
|
||||
quintptr item_id = reader->readElementText().toULongLong();
|
||||
|
||||
ViewerOutput *open_viewer =
|
||||
static_cast<ViewerOutput *>(node_ptrs.value(item_id));
|
||||
info.open_viewers_.push_back(open_viewer);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("state")) {
|
||||
info.state_ =
|
||||
QByteArray::fromBase64(reader->readElementText().toLatin1());
|
||||
|
||||
} else if (reader->name() == QStringLiteral("data")) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("panel")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("id")) {
|
||||
id = attr.value().toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (!id.isEmpty()) {
|
||||
PanelWidget::Info i;
|
||||
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("option")) {
|
||||
QString name;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("name")) {
|
||||
name = attr.value().toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (!name.isEmpty()) {
|
||||
i[name] = reader->readElementText();
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
info.panel_data_[id] = i;
|
||||
}
|
||||
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void MainWindowLayoutInfo::add_folder(olive::Folder *f)
|
||||
{
|
||||
open_folders_.push_back(f);
|
||||
}
|
||||
|
||||
void MainWindowLayoutInfo::add_sequence(Sequence *seq)
|
||||
{
|
||||
open_sequences_.push_back(seq);
|
||||
}
|
||||
|
||||
void MainWindowLayoutInfo::add_viewer(ViewerOutput *viewer)
|
||||
{
|
||||
open_viewers_.push_back(viewer);
|
||||
}
|
||||
|
||||
void MainWindowLayoutInfo::set_panel_data(const QString &id,
|
||||
const PanelWidget::Info &data)
|
||||
{
|
||||
panel_data_[id] = data;
|
||||
}
|
||||
|
||||
void MainWindowLayoutInfo::move_panel_data(const QString &old,
|
||||
const QString &now)
|
||||
{
|
||||
PanelWidget::Info tmp = panel_data_.at(old);
|
||||
panel_data_.erase(old);
|
||||
panel_data_[now] = tmp;
|
||||
}
|
||||
|
||||
void MainWindowLayoutInfo::set_state(const QByteArray &layout)
|
||||
{
|
||||
state_ = layout;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Oak Video Editor - Non-Linear Video Editor
|
||||
* Copyright (C) 2025 Olive CE Team
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef OAK_MAINWINDOWLAYOUTINFO_H
|
||||
#define OAK_MAINWINDOWLAYOUTINFO_H
|
||||
|
||||
#include "node/project/folder/folder.h"
|
||||
#include "node/project/sequence/sequence.h"
|
||||
#include "panel/panel.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
class MainWindowLayoutInfo {
|
||||
public:
|
||||
MainWindowLayoutInfo() = default;
|
||||
|
||||
void to_xml(QXmlStreamWriter *writer) const;
|
||||
|
||||
static MainWindowLayoutInfo
|
||||
from_xml(QXmlStreamReader *reader, const QHash<quintptr, Node *> &node_map);
|
||||
|
||||
void add_folder(Folder *f);
|
||||
|
||||
void add_sequence(Sequence *seq);
|
||||
|
||||
void add_viewer(ViewerOutput *viewer);
|
||||
|
||||
void set_panel_data(const QString &id, const PanelWidget::Info &data);
|
||||
|
||||
void move_panel_data(const QString &old, const QString &now);
|
||||
|
||||
void set_state(const QByteArray &layout);
|
||||
|
||||
const std::vector<Folder *> &open_folders() const
|
||||
{
|
||||
return open_folders_;
|
||||
}
|
||||
|
||||
const std::vector<Sequence *> &open_sequences() const
|
||||
{
|
||||
return open_sequences_;
|
||||
}
|
||||
|
||||
const std::vector<ViewerOutput *> &open_viewers() const
|
||||
{
|
||||
return open_viewers_;
|
||||
}
|
||||
|
||||
const std::map<QString, PanelWidget::Info> &panel_data() const
|
||||
{
|
||||
return panel_data_;
|
||||
}
|
||||
|
||||
const QByteArray &state() const
|
||||
{
|
||||
return state_;
|
||||
}
|
||||
|
||||
private:
|
||||
QByteArray state_;
|
||||
|
||||
std::vector<Folder *> open_folders_;
|
||||
|
||||
std::vector<Sequence *> open_sequences_;
|
||||
|
||||
std::vector<ViewerOutput *> open_viewers_;
|
||||
|
||||
std::map<QString, PanelWidget::Info> panel_data_;
|
||||
|
||||
static const unsigned int k_version = 1;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(olive::MainWindowLayoutInfo)
|
||||
|
||||
#endif // OAK_MAINWINDOWLAYOUTINFO_H
|
||||
Reference in New Issue
Block a user