start moving core frameworks to external libraries

This commit is contained in:
itsmattkc
2023-01-19 09:51:47 -08:00
parent e7982239b8
commit dd9c52ab59
158 changed files with 478 additions and 2484 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ void ColorButton::UpdateColor()
color_.color_input(),
color_.color_output());
QColor managed = color_processor_->ConvertColor(color_).toQColor();
QColor managed = QtUtils::toQColor(color_processor_->ConvertColor(color_));
setStyleSheet(QStringLiteral("%1--ColorButton {background: %2;}").arg(MACRO_VAL_AS_STR(olive), managed.name()));
}
+2 -1
View File
@@ -24,6 +24,7 @@
#include <QPainter>
#include <QWidgetAction>
#include "common/qtutils.h"
#include "ui/colorcoding.h"
namespace olive {
@@ -40,7 +41,7 @@ ColorLabelMenu::ColorLabelMenu(QWidget *parent) :
QPainter painter(&p);
painter.setPen(Qt::black);
painter.setBrush(ColorCoding::standard_colors().at(i).toQColor());
painter.setBrush(QtUtils::toQColor(ColorCoding::standard_colors().at(i)));
painter.drawRect(p.rect().adjusted(0, 0, -1, -1));
QAction *a = AddItem(QStringLiteral("colorlabel%1").arg(i), this, &ColorLabelMenu::ActionTriggered);
@@ -62,7 +62,7 @@ void ColorGradientWidget::paintEvent(QPaintEvent *e)
}
for (int i=0;i<max;i++) {
p.setPen(GetManagedColor(LerpColor(start_, end_, i, max)).toQColor());
p.setPen(QtUtils::toQColor(GetManagedColor(LerpColor(start_, end_, i, max))));
if (orientation_ == Qt::Horizontal) {
p.drawLine(i, 0, i, height());
@@ -22,7 +22,6 @@
#define COLORGRADIENTGLWIDGET_H
#include "colorswatchwidget.h"
#include "render/color.h"
namespace olive {
+4 -2
View File
@@ -22,6 +22,8 @@
#include <QPainter>
#include "common/qtutils.h"
namespace olive {
ColorPreviewBox::ColorPreviewBox(QWidget *parent) :
@@ -53,9 +55,9 @@ void ColorPreviewBox::paintEvent(QPaintEvent *e)
// Color management
if (to_ref_processor_ && to_display_processor_) {
c = to_display_processor_->ConvertColor(to_ref_processor_->ConvertColor(color_)).toQColor();
c = QtUtils::toQColor(to_display_processor_->ConvertColor(to_ref_processor_->ConvertColor(color_)));
} else {
c = color_.toQColor();
c = QtUtils::toQColor(color_);
}
QPainter p(this);
-1
View File
@@ -23,7 +23,6 @@
#include <QWidget>
#include "render/color.h"
#include "render/colorprocessor.h"
namespace olive {
@@ -23,7 +23,6 @@
#include <QOpenGLWidget>
#include "render/color.h"
#include "render/colorprocessor.h"
namespace olive {
@@ -27,7 +27,6 @@
#include "colorpreviewbox.h"
#include "node/color/colormanager/colormanager.h"
#include "render/color.h"
#include "widget/slider/floatslider.h"
#include "widget/slider/stringslider.h"
+1 -1
View File
@@ -73,7 +73,7 @@ void ColorWheelWidget::paintEvent(QPaintEvent *e)
if (tri.hypotenuse <= radius) {
Color managed = GetManagedColor(GetColorFromTriangle(tri));
QColor c = managed.toQColor();
QColor c = QtUtils::toQColor(managed);
// Very basic antialiasing around the edges of the wheel
qreal alpha = qMin(1.0, radius - tri.hypotenuse);
-1
View File
@@ -24,7 +24,6 @@
#include <QOpenGLWidget>
#include "colorswatchwidget.h"
#include "render/color.h"
namespace olive {
-1
View File
@@ -28,7 +28,6 @@
#include "core.h"
#include "common/qtutils.h"
#include "common/timecodefunctions.h"
#include "node/node.h"
#include "widget/keyframeview/keyframeviewundo.h"
#include "widget/timeruler/timeruler.h"
+1 -1
View File
@@ -279,7 +279,7 @@ VideoParams ManagedDisplayWidget::GetViewportParams() const
{
int device_width = width() * devicePixelRatioF();
int device_height = height() * devicePixelRatioF();
VideoParams::Format device_format = static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt());
PixelFormat device_format = static_cast<PixelFormat::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt());
return VideoParams(device_width, device_height, device_format, VideoParams::kInternalChannelCount);
}
+1 -2
View File
@@ -23,7 +23,6 @@
#include <QActionGroup>
#include "core.h"
#include "common/timecodefunctions.h"
#include "panel/panelmanager.h"
#include "panel/timeline/timeline.h"
#include "window/mainwindow/mainwindow.h"
@@ -189,7 +188,7 @@ void MenuShared::AboutToShowTimeRulerActions(const rational& timebase)
Timecode::Display current_timecode_display = Core::instance()->GetTimecodeDisplay();
// Only show the drop-frame option if the timebase is drop-frame
view_timecode_view_dropframe_item_->setVisible(!timebase.isNull() && Timecode::TimebaseIsDropFrame(timebase));
view_timecode_view_dropframe_item_->setVisible(!timebase.isNull() && Timecode::timebase_is_drop_frame(timebase));
if (!view_timecode_view_dropframe_item_->isVisible() && current_timecode_display == Timecode::kTimecodeDropFrame) {
// If the current setting is drop-frame, correct to non-drop frame
+3 -1
View File
@@ -21,12 +21,14 @@
#ifndef MENUSHARED_H
#define MENUSHARED_H
#include "common/rational.h"
#include <olive/core/core.h>
#include "widget/colorlabelmenu/colorlabelmenu.h"
#include "widget/menu/menu.h"
namespace olive {
using namespace core;
/**
* @brief A static object that provides various "stock" menus for use throughout the application
*/
@@ -26,7 +26,6 @@
#include <QScrollBar>
#include <QSplitter>
#include "common/timecodefunctions.h"
#include "node/output/viewer/viewer.h"
#include "widget/nodeparamview/nodeparamviewundo.h"
#include "widget/nodeview/nodeviewundo.h"
+3 -3
View File
@@ -29,8 +29,8 @@ NodeViewContext::NodeViewContext(Node *context, QGraphicsItem *item) :
lbl_ = QCoreApplication::translate("NodeViewContext",
"%1 [%2] :: %3 - %4").arg(block->GetLabelAndName(),
Track::Reference::TypeToTranslatedString(block->track()->type()),
Timecode::time_to_timecode(block->in(), timebase, Core::instance()->GetTimecodeDisplay()),
Timecode::time_to_timecode(block->out(), timebase, Core::instance()->GetTimecodeDisplay()));
QString::fromStdString(Timecode::time_to_timecode(block->in(), timebase, Core::instance()->GetTimecodeDisplay())),
QString::fromStdString(Timecode::time_to_timecode(block->out(), timebase, Core::instance()->GetTimecodeDisplay())));
} else {
lbl_ = context_->GetLabelAndName();
}
@@ -244,7 +244,7 @@ void NodeViewContext::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
{
// Set pen and brush
Color color = context_->color();
QColor c = color.toQColor();
QColor c = QtUtils::toQColor(color);
QPen pen(c, 2);
if (option->state & QStyle::State_Selected) {
pen.setStyle(Qt::DotLine);
-1
View File
@@ -25,7 +25,6 @@
#include <QGroupBox>
#include <QWidget>
#include "render/color.h"
#include "widget/colorwheel/colorpreviewbox.h"
namespace olive {
@@ -198,9 +198,9 @@ void PlaybackControls::SetEndTime(const rational &r)
end_time_ = r;
end_tc_lbl_->setText(Timecode::time_to_timecode(end_time_,
time_base_,
Core::instance()->GetTimecodeDisplay()));
end_tc_lbl_->setText(QString::fromStdString(Timecode::time_to_timecode(end_time_,
time_base_,
Core::instance()->GetTimecodeDisplay())));
}
void PlaybackControls::ShowPauseButton()
@@ -26,7 +26,6 @@
#include <QPushButton>
#include <QStackedWidget>
#include "common/rational.h"
#include "dragbutton.h"
#include "widget/slider/rationalslider.h"
@@ -131,7 +131,7 @@ void ResizableTimelineScrollBar::paintEvent(QPaintEvent *event)
for (auto it=markers_->cbegin(); it!=markers_->cend(); it++) {
TimelineMarker* marker = *it;
QColor marker_color = ColorCoding::GetColor(marker->color()).toQColor();
QColor marker_color = QtUtils::toQColor(ColorCoding::GetColor(marker->color()));
int64_t in = qRound64(ratio * TimeToScene(marker->time().in()));
int64_t out = qRound64(ratio * TimeToScene(marker->time().out()));
int64_t length = qMax(int64_t(1), out-in);
+4 -5
View File
@@ -20,7 +20,6 @@
#include "rationalslider.h"
#include "common/timecodefunctions.h"
#include "core.h"
#include "widget/menu/menu.h"
#include "widget/menu/menushared.h"
@@ -107,11 +106,11 @@ QString RationalSlider::ValueToString(const QVariant &v) const
switch (display_type_) {
case kTime:
return Timecode::time_to_timecode(r, timebase_, Core::instance()->GetTimecodeDisplay());
return QString::fromStdString(Timecode::time_to_timecode(r, timebase_, Core::instance()->GetTimecodeDisplay()));
case kFloat:
return FloatToString(val, GetDecimalPlaces(), GetAutoTrimDecimalPlaces());
case kRational:
return v.value<rational>().toString();
return QString::fromStdString(v.value<rational>().toString());
}
return v.toString();
@@ -126,7 +125,7 @@ QVariant RationalSlider::StringToValue(const QString &s, bool *ok) const
switch (display_type_) {
case kTime:
{
r = Timecode::timecode_to_time(s, timebase_, Core::instance()->GetTimecodeDisplay(), ok);
r = Timecode::timecode_to_time(s.toStdString(), timebase_, Core::instance()->GetTimecodeDisplay(), ok);
break;
}
case kFloat:
@@ -142,7 +141,7 @@ QVariant RationalSlider::StringToValue(const QString &s, bool *ok) const
break;
}
case kRational:
r = rational::fromString(s, ok);
r = rational::fromString(s.toStdString(), ok);
break;
}
+3 -1
View File
@@ -21,13 +21,15 @@
#ifndef RATIONALSLIDER_H
#define RATIONALSLIDER_H
#include <olive/core/core.h>
#include <QMouseEvent>
#include "base/decimalsliderbase.h"
#include "common/rational.h"
namespace olive {
using namespace core;
/**
* @brief A olive::rational based slider
*
@@ -27,7 +27,6 @@
#include <QInputDialog>
#include <QMessageBox>
#include "common/rational.h"
#include "render/videoparams.h"
namespace olive {
@@ -121,7 +120,7 @@ private slots:
r = rational::fromDouble(d, &ok);
} else {
// Try converting to rational in case someone formatted that way
r = rational::fromString(s, &ok);
r = rational::fromString(s.toStdString(), &ok);
}
if (ok) {
@@ -35,21 +35,21 @@ public:
QComboBox(parent)
{
// Set up preview formats
for (int i=0;i<VideoParams::kFormatCount;i++) {
VideoParams::Format pix_fmt = static_cast<VideoParams::Format>(i);
for (int i=0;i<PixelFormat::FORMAT_COUNT;i++) {
PixelFormat pix_fmt = static_cast<PixelFormat::Format>(i);
if (!float_only || VideoParams::FormatIsFloat(pix_fmt)) {
this->addItem(VideoParams::GetFormatName(pix_fmt), pix_fmt);
if (!float_only || pix_fmt.is_float()) {
this->addItem(VideoParams::GetFormatName(pix_fmt), static_cast<PixelFormat::Format>(pix_fmt));
}
}
}
VideoParams::Format GetPixelFormat() const
PixelFormat GetPixelFormat() const
{
return static_cast<VideoParams::Format>(this->currentData().toInt());
return static_cast<PixelFormat::Format>(this->currentData().toInt());
}
void SetPixelFormat(VideoParams::Format fmt)
void SetPixelFormat(PixelFormat fmt)
{
for (int i=0; i<this->count(); i++) {
if (this->itemData(i).toInt() == fmt) {
+5 -4
View File
@@ -20,14 +20,15 @@
#include "elapsedcounterwidget.h"
#include <olive/core/core.h>
#include <QDateTime>
#include <QHBoxLayout>
#include <cmath>
#include "common/timecodefunctions.h"
namespace olive {
using namespace core;
ElapsedCounterWidget::ElapsedCounterWidget(QWidget* parent) :
QWidget(parent),
last_progress_(0),
@@ -87,8 +88,8 @@ void ElapsedCounterWidget::UpdateTimers()
remaining_ms = 0;
}
elapsed_lbl_->setText(tr("Elapsed: %1").arg(Timecode::TimeToString(elapsed_ms)));
remaining_lbl_->setText(tr("Remaining: %1").arg(Timecode::TimeToString(remaining_ms)));
elapsed_lbl_->setText(tr("Elapsed: %1").arg(QString::fromStdString(Timecode::time_to_string(elapsed_ms))));
remaining_lbl_->setText(tr("Remaining: %1").arg(QString::fromStdString(Timecode::time_to_string(remaining_ms))));
}
}
-1
View File
@@ -23,7 +23,6 @@
#include <QDateTime>
#include <QVBoxLayout>
#include "common/timecodefunctions.h"
#include "ui/icons/icons.h"
namespace olive {
-1
View File
@@ -25,7 +25,6 @@
#include <QScrollBar>
#include <QTimer>
#include "common/timecodefunctions.h"
#include "widget/timebased/timebasedwidget.h"
namespace olive {
@@ -27,8 +27,6 @@
#include <QToolTip>
#include "common/qtutils.h"
#include "common/rational.h"
#include "common/timecodefunctions.h"
#include "timebasedview.h"
#include "timebasedwidget.h"
#include "widget/timetarget/timetarget.h"
@@ -309,8 +307,9 @@ public:
display_time = initial_drag_item_->time();
}
QString tip = Timecode::time_to_timecode(display_time, timebase_,
Core::instance()->GetTimecodeDisplay(), false);
QString tip = QString::fromStdString(Timecode::time_to_timecode(
display_time, timebase_,
Core::instance()->GetTimecodeDisplay(), false));
if (!tip_format.isEmpty()) {
tip = tip_format.arg(tip);
-1
View File
@@ -24,7 +24,6 @@
#include "common/autoscroll.h"
#include "common/range.h"
#include "common/timecodefunctions.h"
#include "config/config.h"
#include "core.h"
#include "dialog/markerproperties/markerpropertiesdialog.h"
+1 -1
View File
@@ -21,9 +21,9 @@
#ifndef TIMELINESCALEDOBJECT_H
#define TIMELINESCALEDOBJECT_H
#include <olive/core/core.h>
#include <QWidget>
#include "common/rational.h"
#include "node/block/block.h"
namespace olive {
+3 -4
View File
@@ -27,7 +27,6 @@
#include "core.h"
#include "common/range.h"
#include "common/timecodefunctions.h"
#include "dialog/sequence/sequence.h"
#include "dialog/speedduration/speeddurationdialog.h"
#include "node/block/transition/transition.h"
@@ -660,7 +659,7 @@ bool TimelineWidget::CopySelected(bool cut)
}
foreach (Block* block, selected_blocks_) {
properties[block][QStringLiteral("in")] = (block->in() - earliest_in).toString();
properties[block][QStringLiteral("in")] = QString::fromStdString((block->in() - earliest_in).toString());
properties[block][QStringLiteral("track")] = block->track()->ToReference().ToString();
}
@@ -1978,7 +1977,7 @@ bool TimelineWidget::PasteInternal(bool insert)
for (auto it=res.GetLoadData().properties.cbegin(); it!=res.GetLoadData().properties.cend(); it++) {
rational length = static_cast<Block*>(it.key())->length();
rational in = rational::fromString(it.value()[QStringLiteral("in")]);
rational in = rational::fromString(it.value()[QStringLiteral("in")].toStdString());
paste_end = qMax(paste_end, paste_start + in + length);
}
@@ -1990,7 +1989,7 @@ bool TimelineWidget::PasteInternal(bool insert)
for (auto it=res.GetLoadData().properties.cbegin(); it!=res.GetLoadData().properties.cend(); it++) {
Block *block = static_cast<Block*>(it.key());
rational in = rational::fromString(it.value()[QStringLiteral("in")]);
rational in = rational::fromString(it.value()[QStringLiteral("in")].toStdString());
Track::Reference track = Track::Reference::FromString(it.value()[QStringLiteral("track")]);
command->add_child(new TrackPlaceBlockCommand(sequence()->track_list(track.type()),
@@ -23,7 +23,6 @@
#include <QHash>
#include "common/timerange.h"
#include "node/output/track/track.h"
namespace olive {
+3 -3
View File
@@ -150,9 +150,9 @@ void ImportTool::DragMove(TimelineViewMouseEvent *event)
// Generate tooltip (showing earliest in point of imported clip)
rational tooltip_timebase = parent()->GetTimebaseForTrackType(event->GetTrack().type());
QString tooltip_text = Timecode::time_to_timecode(earliest_ghost,
tooltip_timebase,
Core::instance()->GetTimecodeDisplay());
QString tooltip_text = QString::fromStdString(Timecode::time_to_timecode(earliest_ghost,
tooltip_timebase,
Core::instance()->GetTimecodeDisplay()));
// Force tooltip to update (otherwise the tooltip won't move as written in the documentation, and could get in the way
// of the cursor)
+4 -5
View File
@@ -26,7 +26,6 @@
#include "common/clamp.h"
#include "common/qtutils.h"
#include "common/range.h"
#include "common/timecodefunctions.h"
#include "config/config.h"
#include "core.h"
#include "node/block/gap/gap.h"
@@ -596,10 +595,10 @@ void PointerTool::ProcessDrag(const TimelineCoordinate &mouse_pos)
rational tooltip_timebase = parent()->GetTimebaseForTrackType(drag_start_.GetTrack().type());
QToolTip::hideText();
QToolTip::showText(QCursor::pos(),
Timecode::time_to_timecode(time_movement,
tooltip_timebase,
Core::instance()->GetTimecodeDisplay(),
true),
QString::fromStdString(Timecode::time_to_timecode(time_movement,
tooltip_timebase,
Core::instance()->GetTimecodeDisplay(),
true)),
parent());
}
+4 -5
View File
@@ -22,7 +22,6 @@
#include <QToolTip>
#include "common/timecodefunctions.h"
#include "config/config.h"
#include "slip.h"
#include "widget/timelinewidget/undo/timelineundogeneral.h"
@@ -58,10 +57,10 @@ void SlipTool::ProcessDrag(const TimelineCoordinate &mouse_pos)
rational tooltip_timebase = parent()->GetTimebaseForTrackType(drag_start_.GetTrack().type());
QToolTip::hideText();
QToolTip::showText(QCursor::pos(),
Timecode::time_to_timecode(time_movement,
tooltip_timebase,
Core::instance()->GetTimecodeDisplay(),
true),
QString::fromStdString(Timecode::time_to_timecode(time_movement,
tooltip_timebase,
Core::instance()->GetTimecodeDisplay(),
true)),
parent());
}
-1
View File
@@ -23,7 +23,6 @@
#include <QDragLeaveEvent>
#include "common/rational.h"
#include "widget/nodeview/nodeviewundo.h"
#include "widget/timelinewidget/view/timelineviewghostitem.h"
#include "widget/timelinewidget/view/timelineviewmouseevent.h"
@@ -29,7 +29,6 @@
#include "config/config.h"
#include "common/qtutils.h"
#include "common/timecodefunctions.h"
#include "node/project/footage/footage.h"
#include "panel/panelmanager.h"
#include "panel/timeline/timeline.h"
@@ -106,9 +105,9 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event)
Block* b = GetItemAtScenePos(timeline_event.GetFrame(), timeline_event.GetTrack().index());
if (b) {
setToolTip(tr("In: %1\nOut: %2\nDuration: %3").arg(
Timecode::time_to_timecode(b->in(), timebase(), Core::instance()->GetTimecodeDisplay()),
Timecode::time_to_timecode(b->out(), timebase(), Core::instance()->GetTimecodeDisplay()),
Timecode::time_to_timecode(b->length(), timebase(), Core::instance()->GetTimecodeDisplay())
QString::fromStdString(Timecode::time_to_timecode(b->in(), timebase(), Core::instance()->GetTimecodeDisplay())),
QString::fromStdString(Timecode::time_to_timecode(b->out(), timebase(), Core::instance()->GetTimecodeDisplay())),
QString::fromStdString(Timecode::time_to_timecode(b->length(), timebase(), Core::instance()->GetTimecodeDisplay()))
));
} else {
setToolTip(QString());
@@ -416,7 +415,7 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block, q
block_right - block_left,
block_height);
QColor shadow_color = block->is_enabled() ? block->color().toQColor().darker() : QColor(Qt::darkGray).darker();
QColor shadow_color = block->is_enabled() ? QtUtils::toQColor(block->color()).darker() : QColor(Qt::darkGray).darker();
const qreal MINIMUM_RECT_WIDTH = 2;
const qreal MINIMUM_DETAIL_WIDTH = 8;
-1
View File
@@ -24,7 +24,6 @@
#include <QHBoxLayout>
#include <QScrollBar>
#include "common/rational.h"
#include "widget/menu/menu.h"
#include "widget/timebased/timebasedviewselectionmanager.h"
+1 -2
View File
@@ -23,7 +23,6 @@
#include <QDebug>
#include <QPainter>
#include "common/timecodefunctions.h"
#include "common/qtutils.h"
#include "config/config.h"
#include "core.h"
@@ -206,7 +205,7 @@ void TimeRuler::drawForeground(QPainter *p, const QRectF &rect)
if (text_visible_) {
QRect text_rect;
Qt::Alignment text_align;
QString timecode_str = Timecode::time_to_timecode(SceneToTime(i), timebase(), Core::instance()->GetTimecodeDisplay());
QString timecode_str = QString::fromStdString(Timecode::time_to_timecode(SceneToTime(i), timebase(), Core::instance()->GetTimecodeDisplay()));
int timecode_width = QtUtils::QFontMetricsWidth(fm, timecode_str);
int timecode_left;
-1
View File
@@ -24,7 +24,6 @@
#include <QTimer>
#include <QWidget>
#include "common/timerange.h"
#include "seekablewidget.h"
#include "render/playbackcache.h"
-1
View File
@@ -34,7 +34,6 @@
#include "audio/audiomanager.h"
#include "common/clamp.h"
#include "common/ratiodialog.h"
#include "common/timecodefunctions.h"
#include "config/config.h"
#include "core.h"
#include "node/block/gap/gap.h"
-1
View File
@@ -30,7 +30,6 @@
#include "audio/audioprocessor.h"
#include "audiowaveformview.h"
#include "common/rational.h"
#include "node/output/viewer/viewer.h"
#include "render/previewaudiodevice.h"
#include "render/previewautocacher.h"
-1
View File
@@ -29,7 +29,6 @@
#include "node/node.h"
#include "node/output/track/tracklist.h"
#include "node/traverser.h"
#include "render/color.h"
#include "tool/tool.h"
#include "viewerplaybacktimer.h"
#include "viewerqueue.h"
+3 -3
View File
@@ -21,14 +21,14 @@
#ifndef VIEWERSIZER_H
#define VIEWERSIZER_H
#include <olive/core/core.h>
#include <QScrollBar>
#include <QWidget>
#include "common/define.h"
#include "common/rational.h"
namespace olive {
using namespace core;
/**
* @brief A container widget that enforces the aspect ratio of a child widget
*
-2
View File
@@ -23,8 +23,6 @@
#include <QKeyEvent>
#include <QVBoxLayout>
#include "common/timecodefunctions.h"
namespace olive {
ViewerWindow::ViewerWindow(QWidget *parent) :