app: migrate all engine access to the C ABI facade (nm U _ZN5olive = 0)
Every app module now reaches liboakengine exclusively through oakengine_* C calls, EngineEventBridge subscriptions and app-side handle headers (cliphandle/keyframehandle/nodevaluehandle/oakvaluehelper). Direct C++ command construction, engine signal connect()s, and engine type usage in MOC-visible signatures are gone: 557 -> 0 undefined olive:: symbols in oak-editor.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(cursors)
|
||||
add_subdirectory(icons)
|
||||
add_subdirectory(graphics)
|
||||
add_subdirectory(style)
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2022 Olive 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/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
ui/icons/icons.h
|
||||
ui/icons/icons.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,224 @@
|
||||
/***
|
||||
|
||||
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 "icons.h"
|
||||
|
||||
#include <QHash>
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
/// Works in conjunction with `genicons.sh` to generate and utilize icons of specific sizes
|
||||
const int icon_size_count = 4;
|
||||
const int icon_sizes[] = { 16, 32, 64, 128 };
|
||||
|
||||
/// Internal icon library for use throughout Olive without having to regenerate constantly
|
||||
QIcon icon::go_to_start;
|
||||
QIcon icon::prev_frame;
|
||||
QIcon icon::play;
|
||||
QIcon icon::pause;
|
||||
QIcon icon::next_frame;
|
||||
QIcon icon::go_to_end;
|
||||
QIcon icon::New;
|
||||
QIcon icon::open;
|
||||
QIcon icon::save;
|
||||
QIcon icon::undo;
|
||||
QIcon icon::redo;
|
||||
QIcon icon::tree_view;
|
||||
QIcon icon::list_view;
|
||||
QIcon icon::icon_view;
|
||||
QIcon icon::tool_pointer;
|
||||
QIcon icon::tool_edit;
|
||||
QIcon icon::tool_ripple;
|
||||
QIcon icon::tool_rolling;
|
||||
QIcon icon::tool_razor;
|
||||
QIcon icon::tool_slip;
|
||||
QIcon icon::tool_slide;
|
||||
QIcon icon::tool_hand;
|
||||
QIcon icon::tool_transition;
|
||||
QIcon icon::tool_track_select;
|
||||
QIcon icon::folder;
|
||||
QIcon icon::sequence;
|
||||
QIcon icon::video;
|
||||
QIcon icon::audio;
|
||||
QIcon icon::image;
|
||||
QIcon icon::mini_map;
|
||||
QIcon icon::tri_up;
|
||||
QIcon icon::tri_left;
|
||||
QIcon icon::tri_down;
|
||||
QIcon icon::tri_right;
|
||||
QIcon icon::text_bold;
|
||||
QIcon icon::text_italic;
|
||||
QIcon icon::text_underline;
|
||||
QIcon icon::text_strikethrough;
|
||||
QIcon icon::text_small_caps;
|
||||
QIcon icon::text_align_left;
|
||||
QIcon icon::text_align_right;
|
||||
QIcon icon::text_align_center;
|
||||
QIcon icon::text_align_justify;
|
||||
QIcon icon::text_align_top;
|
||||
QIcon icon::text_align_bottom;
|
||||
QIcon icon::text_align_middle;
|
||||
QIcon icon::snapping;
|
||||
QIcon icon::zoom_in;
|
||||
QIcon icon::zoom_out;
|
||||
QIcon icon::record;
|
||||
QIcon icon::add;
|
||||
QIcon icon::error;
|
||||
QIcon icon::dir_up;
|
||||
QIcon icon::clock;
|
||||
QIcon icon::diamond;
|
||||
QIcon icon::plus;
|
||||
QIcon icon::minus;
|
||||
QIcon icon::add_effect;
|
||||
QIcon icon::eye_opened;
|
||||
QIcon icon::eye_closed;
|
||||
QIcon icon::lock_opened;
|
||||
QIcon icon::lock_closed;
|
||||
QIcon icon::pencil;
|
||||
QIcon icon::subtitles;
|
||||
QIcon icon::color_picker;
|
||||
|
||||
QIcon icon::from_name(const QString &name)
|
||||
{
|
||||
static const QHash<QString, QIcon *> map = {
|
||||
{ QStringLiteral("prev"), &go_to_start },
|
||||
{ QStringLiteral("rew"), &prev_frame },
|
||||
{ QStringLiteral("play"), &play },
|
||||
{ QStringLiteral("pause"), &pause },
|
||||
{ QStringLiteral("ff"), &next_frame },
|
||||
{ QStringLiteral("next"), &go_to_end },
|
||||
{ QStringLiteral("new"), &New },
|
||||
{ QStringLiteral("open"), &open },
|
||||
{ QStringLiteral("save"), &save },
|
||||
{ QStringLiteral("undo"), &undo },
|
||||
{ QStringLiteral("redo"), &redo },
|
||||
{ QStringLiteral("treeview"), &tree_view },
|
||||
{ QStringLiteral("listview"), &list_view },
|
||||
{ QStringLiteral("iconview"), &icon_view },
|
||||
{ QStringLiteral("folder"), &folder },
|
||||
{ QStringLiteral("sequence"), &sequence },
|
||||
{ QStringLiteral("video"), &video },
|
||||
{ QStringLiteral("audio"), &audio },
|
||||
{ QStringLiteral("image"), &image },
|
||||
{ QStringLiteral("subtitles"), &subtitles },
|
||||
{ QStringLiteral("error"), &error },
|
||||
};
|
||||
|
||||
QIcon *icon_ptr = map.value(name, nullptr);
|
||||
return icon_ptr ? *icon_ptr : QIcon();
|
||||
}
|
||||
|
||||
void icon::load_all(const QString &theme)
|
||||
{
|
||||
go_to_start = create(theme, "prev");
|
||||
prev_frame = create(theme, "rew");
|
||||
play = create(theme, "play");
|
||||
pause = create(theme, "pause");
|
||||
next_frame = create(theme, "ff");
|
||||
go_to_end = create(theme, "next");
|
||||
|
||||
New = create(theme, "new");
|
||||
open = create(theme, "open");
|
||||
save = create(theme, "save");
|
||||
undo = create(theme, "undo");
|
||||
redo = create(theme, "redo");
|
||||
tree_view = create(theme, "treeview");
|
||||
list_view = create(theme, "listview");
|
||||
icon_view = create(theme, "iconview");
|
||||
|
||||
tool_pointer = create(theme, "arrow");
|
||||
tool_edit = create(theme, "beam");
|
||||
tool_ripple = create(theme, "ripple");
|
||||
tool_rolling = create(theme, "rolling");
|
||||
tool_razor = create(theme, "razor");
|
||||
tool_slip = create(theme, "slip");
|
||||
tool_slide = create(theme, "slide");
|
||||
tool_hand = create(theme, "hand");
|
||||
tool_transition = create(theme, "transition-tool");
|
||||
tool_track_select = create(theme, "track-tool");
|
||||
|
||||
folder = create(theme, "folder");
|
||||
sequence = create(theme, "sequence");
|
||||
video = create(theme, "videosource");
|
||||
audio = create(theme, "audiosource");
|
||||
image = create(theme, "imagesource");
|
||||
|
||||
mini_map = create(theme, "map");
|
||||
|
||||
tri_up = create(theme, "tri-up");
|
||||
tri_left = create(theme, "tri-left");
|
||||
tri_down = create(theme, "tri-down");
|
||||
tri_right = create(theme, "tri-right");
|
||||
|
||||
text_bold = create(theme, "text-bold");
|
||||
text_italic = create(theme, "text-italic");
|
||||
text_underline = create(theme, "text-underline");
|
||||
text_strikethrough = create(theme, "text-strikethrough");
|
||||
text_small_caps = create(theme, "text-small-caps");
|
||||
text_align_left = create(theme, "align-left");
|
||||
text_align_right = create(theme, "align-right");
|
||||
text_align_center = create(theme, "align-center");
|
||||
text_align_justify = create(theme, "align-justify-all");
|
||||
text_align_top = create(theme, "align-v-top");
|
||||
text_align_bottom = create(theme, "align-v-bottom");
|
||||
text_align_middle = create(theme, "align-v-middle");
|
||||
|
||||
snapping = create(theme, "magnet");
|
||||
zoom_in = create(theme, "zoomin");
|
||||
zoom_out = create(theme, "zoomout");
|
||||
record = create(theme, "record");
|
||||
add = create(theme, "add-button");
|
||||
error = create(theme, "error");
|
||||
dir_up = create(theme, "dirup");
|
||||
clock = create(theme, "clock");
|
||||
diamond = create(theme, "diamond");
|
||||
plus = create(theme, "plus");
|
||||
minus = create(theme, "minus");
|
||||
add_effect = create(theme, "add-effect");
|
||||
color_picker = create(theme, "color-picker");
|
||||
|
||||
eye_opened = create(theme, "eye-opened");
|
||||
eye_closed = create(theme, "eye-closed");
|
||||
lock_opened = create(theme, "lock-opened");
|
||||
lock_closed = create(theme, "lock-closed");
|
||||
|
||||
pencil = create(theme, "text-edit");
|
||||
subtitles = create(theme, "subtitles");
|
||||
}
|
||||
|
||||
QIcon icon::create(const QString &theme, const QString &name)
|
||||
{
|
||||
QIcon icon;
|
||||
|
||||
for (int i = 0; i < icon_size_count; i++) {
|
||||
icon.addFile(QStringLiteral("%1/png/%2.%3.png")
|
||||
.arg(theme, name, QString::number(icon_sizes[i])),
|
||||
QSize(icon_sizes[i], icon_sizes[i]), QIcon::Normal);
|
||||
icon.addFile(QStringLiteral("%1/png/%2.%3.disabled.png")
|
||||
.arg(theme, name, QString::number(icon_sizes[i])),
|
||||
QSize(icon_sizes[i], icon_sizes[i]), QIcon::Disabled);
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/***
|
||||
|
||||
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/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef OAK_ICONS_H
|
||||
#define OAK_ICONS_H
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
#include "common/define.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
namespace icon
|
||||
{
|
||||
|
||||
// Playback Icons
|
||||
extern QIcon go_to_start;
|
||||
extern QIcon prev_frame;
|
||||
extern QIcon play;
|
||||
extern QIcon pause;
|
||||
extern QIcon next_frame;
|
||||
extern QIcon go_to_end;
|
||||
|
||||
// Project Management Toolbar Icons
|
||||
extern QIcon New;
|
||||
extern QIcon open;
|
||||
extern QIcon save;
|
||||
extern QIcon undo;
|
||||
extern QIcon redo;
|
||||
extern QIcon tree_view;
|
||||
extern QIcon list_view;
|
||||
extern QIcon icon_view;
|
||||
|
||||
// Tool Icons
|
||||
extern QIcon tool_pointer;
|
||||
extern QIcon tool_edit;
|
||||
extern QIcon tool_ripple;
|
||||
extern QIcon tool_rolling;
|
||||
extern QIcon tool_razor;
|
||||
extern QIcon tool_slip;
|
||||
extern QIcon tool_slide;
|
||||
extern QIcon tool_hand;
|
||||
extern QIcon tool_transition;
|
||||
extern QIcon tool_track_select;
|
||||
|
||||
// Project Icons
|
||||
extern QIcon folder;
|
||||
extern QIcon sequence;
|
||||
extern QIcon video;
|
||||
extern QIcon audio;
|
||||
extern QIcon image;
|
||||
|
||||
// Node Icons
|
||||
extern QIcon mini_map;
|
||||
|
||||
// Triangle Arrows
|
||||
extern QIcon tri_up;
|
||||
extern QIcon tri_left;
|
||||
extern QIcon tri_down;
|
||||
extern QIcon tri_right;
|
||||
|
||||
// Text
|
||||
extern QIcon text_bold;
|
||||
extern QIcon text_italic;
|
||||
extern QIcon text_underline;
|
||||
extern QIcon text_strikethrough;
|
||||
extern QIcon text_small_caps;
|
||||
extern QIcon text_align_left;
|
||||
extern QIcon text_align_right;
|
||||
extern QIcon text_align_center;
|
||||
extern QIcon text_align_justify;
|
||||
extern QIcon text_align_top;
|
||||
extern QIcon text_align_bottom;
|
||||
extern QIcon text_align_middle;
|
||||
|
||||
// Miscellaneous Icons
|
||||
extern QIcon snapping;
|
||||
extern QIcon zoom_in;
|
||||
extern QIcon zoom_out;
|
||||
extern QIcon record;
|
||||
extern QIcon add;
|
||||
extern QIcon error;
|
||||
extern QIcon dir_up;
|
||||
extern QIcon clock;
|
||||
extern QIcon diamond;
|
||||
extern QIcon plus;
|
||||
extern QIcon minus;
|
||||
extern QIcon add_effect;
|
||||
extern QIcon eye_opened;
|
||||
extern QIcon eye_closed;
|
||||
extern QIcon lock_opened;
|
||||
extern QIcon lock_closed;
|
||||
extern QIcon pencil;
|
||||
extern QIcon subtitles;
|
||||
extern QIcon color_picker;
|
||||
|
||||
/**
|
||||
* @brief Look up a loaded icon by its resource name
|
||||
*
|
||||
* Engine-side metadata (e.g. Node::data(Node::icon)) carries icon identity as a
|
||||
* plain resource name string ("folder", "video", ...) so the headless engine
|
||||
* never has to depend on QIcon. This maps such a name back to the corresponding
|
||||
* globally loaded icon. Returns a null QIcon for unknown names.
|
||||
*/
|
||||
QIcon from_name(const QString &name);
|
||||
|
||||
/**
|
||||
* @brief Create an icon object loaded from file
|
||||
*
|
||||
* Using `name`, this function will load icon files to create an icon object that can be used throughout the
|
||||
* application.
|
||||
*
|
||||
* Olive's icons are stored in a very specific format. They are all sourced from SVGs, but stored as PNGs of various
|
||||
* sizes. See `app/ui/icons/genicons.sh`, as this script not only generates the multiple sizes but also the QRC file
|
||||
* used to compile the icons into the executable.
|
||||
*
|
||||
* This function is heavily tied into `genicons.sh` and will load all the different sized images (using the same
|
||||
* filename formatting and QRC resource directory) that `genicons.sh` generates into one QIcon file. If you change
|
||||
* either this function or `genicons.sh`, you will very likely have to change the other too.
|
||||
*
|
||||
* There is not much reason to call this outside of LoadAll() (which stores icons globally in memory so they don't
|
||||
* have to be reloaded each time a new object needs an icon).
|
||||
*
|
||||
* @param theme
|
||||
*
|
||||
* Name of the theme (used in the URL as the folder to load PNGs from)
|
||||
*
|
||||
* @param name
|
||||
*
|
||||
* Name of the icon (will correspond to the original SVG's filename with no path or extension)
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* A QIcon object containing the various icon sizes loaded from resource
|
||||
*/
|
||||
QIcon create(const QString &theme, const QString &name);
|
||||
|
||||
/**
|
||||
* @brief Methodically load all Olive icons into global variables that can be accessed throughout the application
|
||||
*
|
||||
* It's recommended to load any UI icons here so they're ready at startup and don't need to be re-loaded upon each
|
||||
* use.
|
||||
*/
|
||||
void load_all(const QString &theme);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // OAK_ICONS_H
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QStyleFactory>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "config/config.h"
|
||||
#include "common/configwrapper.h"
|
||||
#include "ui/icons/icons.h"
|
||||
|
||||
namespace olive
|
||||
|
||||
Reference in New Issue
Block a user