upgrade to qt 6 compliance

This commit is contained in:
itsmattkc
2022-10-28 19:42:14 -07:00
parent 2a595cb4c7
commit 4d80044d6d
69 changed files with 152 additions and 130 deletions
+19 -10
View File
@@ -94,7 +94,7 @@ find_package(OpenEXR REQUIRED)
list(APPEND OLIVE_LIBRARIES ${OPENEXR_LIBRARIES})
list(APPEND OLIVE_INCLUDE_DIRS ${OPENEXR_INCLUDES})
# Link Qt 5
# Link Qt
set(QT_LIBRARIES
Core
Gui
@@ -102,25 +102,34 @@ set(QT_LIBRARIES
OpenGL
LinguistTools
Concurrent
OpenGLWidgets
)
if (UNIX AND NOT APPLE)
list(APPEND QT_LIBRARIES DBus)
endif()
find_package(Qt5 5.6 REQUIRED
find_package(QT NAMES Qt6 REQUIRED
COMPONENTS
${QT_LIBRARIES}
OPTIONAL_COMPONENTS
Network
)
if (NOT Qt5Network_FOUND)
message(" Qt5::Network module not found, crash reporting will be disabled.")
find_package(Qt${QT_VERSION_MAJOR} REQUIRED
COMPONENTS
${QT_LIBRARIES}
OPTIONAL_COMPONENTS
Network
)
message("Qt version: " ${QT_VERSION_MAJOR})
if (NOT Qt${QT_VERSION_MAJOR}Network_FOUND)
message(" Qt${QT_VERSION_MAJOR}::Network module not found, crash reporting will be disabled.")
endif()
list(APPEND OLIVE_LIBRARIES
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::OpenGL
Qt5::Concurrent
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::OpenGL
Qt${QT_VERSION_MAJOR}::Concurrent
Qt${QT_VERSION_MAJOR}::OpenGLWidgets
)
# Link FFmpeg
@@ -186,7 +195,7 @@ if (WIN32)
elseif (APPLE)
list(APPEND OLIVE_LIBRARIES "-framework IOKit")
elseif(UNIX)
list(APPEND OLIVE_LIBRARIES Qt5::DBus)
list(APPEND OLIVE_LIBRARIES Qt${QT_VERSION_MAJOR}::DBus)
endif()
# Generate Git hash
+3 -3
View File
@@ -44,7 +44,7 @@ add_subdirectory(widget)
add_subdirectory(window)
# Add translations
qt5_add_translation(OLIVE_QM_FILES ${OLIVE_TS_FILES})
qt_add_translation(OLIVE_QM_FILES ${OLIVE_TS_FILES})
set(QRC_BODY "")
foreach(QM_FILE ${OLIVE_QM_FILES})
@@ -64,7 +64,7 @@ add_library(olive-version-obj
version.cpp
version.h
)
target_link_libraries(olive-version-obj PRIVATE Qt5::Core)
target_link_libraries(olive-version-obj PRIVATE Qt${QT_VERSION_MAJOR}::Core)
target_compile_options(olive-version-obj PRIVATE -DAPPVERSION="${PROJECT_VERSION}" -DAPPVERSIONLONG="${PROJECT_LONG_VERSION}" )
# Add main library
@@ -142,6 +142,6 @@ target_include_directories(olive-editor PRIVATE ${OLIVE_INCLUDE_DIRS})
target_include_directories(libolive-editor PRIVATE ${OLIVE_INCLUDE_DIRS})
# Add crash handler
if (GoogleCrashpad_FOUND AND Qt5Network_FOUND)
if (GoogleCrashpad_FOUND AND Qt${QT_VERSION_MAJOR}Network_FOUND)
add_subdirectory(crashhandler)
endif()
+3 -18
View File
@@ -12,22 +12,7 @@ const QVector<QString> Html::kBlockTags = {
QStringLiteral("div")
};
inline bool StrEquals(const QString &a, const QStringRef &b)
{
return !a.compare(b, Qt::CaseInsensitive);
}
inline bool StrEquals(const QString &a, const QString &b)
{
return !a.compare(b, Qt::CaseInsensitive);
}
inline bool StrEquals(const QStringRef &a, const QString &b)
{
return !a.compare(b, Qt::CaseInsensitive);
}
inline bool StrEquals(const QStringRef &a, const QStringRef &b)
inline bool StrEquals(const QStringView &a, const QStringView &b)
{
return !a.compare(b, Qt::CaseInsensitive);
}
@@ -421,7 +406,7 @@ QMap<QString, QStringList> Html::GetCSSFromStyle(const QString &s)
// match. Also commas should be filtered out.
QStringList values;
const QString &val = kv.at(1);
QChar in_quote = 0;
QChar in_quote(0);
QString current_str;
for (int i=0; i<val.size(); i++) {
const QChar &current_char = val.at(i);
@@ -429,7 +414,7 @@ QMap<QString, QStringList> Html::GetCSSFromStyle(const QString &s)
if (!in_quote.isNull()) {
// If inside quotes and character isn't quote, indiscriminately append char
if (current_char == in_quote) {
in_quote = 0;
in_quote = QChar(0);
} else {
current_str.append(current_char);
}
-1
View File
@@ -25,7 +25,6 @@
#include <QApplication>
#include <QDateTime>
#include <QDebug>
#include <QLinkedList>
#include <QMutex>
#include <QTimer>
#include <stdint.h>
+2 -1
View File
@@ -22,6 +22,7 @@
#include <QCoreApplication>
#include <QMessageBox>
#include <QRegularExpression>
namespace olive {
@@ -49,7 +50,7 @@ double GetFloatRatioFromUser(QWidget* parent,
return qSNaN();
}
QStringList ratio_components = s.split(QRegExp(QStringLiteral(":|;|\\/")));
QStringList ratio_components = s.split(QRegularExpression(QStringLiteral(":|;|\\/")));
if (ratio_components.size() == 1) {
bool float_ok;
+2 -1
View File
@@ -24,6 +24,7 @@ extern "C" {
#include <libavutil/mathematics.h>
}
#include <QRegularExpression>
#include <QtMath>
#include "config/config.h"
@@ -149,7 +150,7 @@ int64_t Timecode::timecode_to_timestamp(const QString &timecode, const rational
case kTimecodeSeconds:
{
const int kTimecodeElementCount = 4;
QStringList timecode_split = timecode.split(QRegExp("(:)|(;)|(\\.)"));
QStringList timecode_split = timecode.split(QRegularExpression("(:)|(;)|(\\.)"));
bool valid;
+4 -4
View File
@@ -39,10 +39,10 @@ target_include_directories(
target_link_libraries(
olive-crashhandler
PRIVATE
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Network
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Network
${CRASHPAD_LIBRARIES}
)
+3 -3
View File
@@ -44,10 +44,10 @@ AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent) :
QFontMetrics fm = fontMetrics();
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(fm.height());
layout->setContentsMargins(fm.height(), fm.height(), fm.height(), fm.height());
QHBoxLayout *horiz_layout = new QHBoxLayout();
horiz_layout->setMargin(fm.height());
horiz_layout->setContentsMargins(fm.height(), fm.height(), fm.height(), fm.height());
horiz_layout->setSpacing(fm.height()*2);
QLabel* icon = new QLabel(QStringLiteral("<html><img src=':/graphics/olive-splash.png'></html>"));
@@ -108,7 +108,7 @@ AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent) :
layout->addWidget(new QLabel());
QHBoxLayout *btn_layout = new QHBoxLayout();
btn_layout->setMargin(0);
btn_layout->setContentsMargins(0, 0, 0, 0);
btn_layout->setSpacing(0);
if (welcome_dialog) {
+1 -1
View File
@@ -30,7 +30,7 @@ CineformSection::CineformSection(QWidget *parent) :
{
QGridLayout *layout = new QGridLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
+4 -4
View File
@@ -39,7 +39,7 @@ H264Section::H264Section(int default_crf, QWidget *parent) :
CodecSection(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
layout->addWidget(new QLabel(tr("Encode Speed:")), row, 0);
@@ -173,7 +173,7 @@ H264CRFSection::H264CRFSection(int default_crf, QWidget *parent) :
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF);
@@ -207,7 +207,7 @@ H264BitRateSection::H264BitRateSection(QWidget *parent) :
QWidget(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
@@ -261,7 +261,7 @@ H264FileSizeSection::H264FileSizeSection(QWidget *parent) :
QWidget(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
+1 -1
View File
@@ -29,7 +29,7 @@ ImageSection::ImageSection(QWidget* parent) :
CodecSection(parent)
{
QGridLayout* layout = new QGridLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
+3 -3
View File
@@ -58,7 +58,7 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode, QWi
preferences_area_ = new QWidget();
QGridLayout* preferences_layout = new QGridLayout(preferences_area_);
preferences_layout->setMargin(0);
preferences_layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
@@ -183,7 +183,7 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode, QWi
row++;
QHBoxLayout *btn_layout = new QHBoxLayout();
btn_layout->setMargin(0);
btn_layout->setContentsMargins(0, 0, 0, 0);
preferences_layout->addLayout(btn_layout, row, 0, 1, 4);
btn_layout->addStretch();
@@ -437,7 +437,7 @@ void ExportDialog::PresetComboBoxChanged()
if (loading_presets_) {
return;
}
QComboBox *c = static_cast<QComboBox *>(sender());
int preset_number = c->currentData().toInt();
@@ -38,7 +38,7 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
video_premultiply_alpha_(nullptr)
{
QGridLayout* video_layout = new QGridLayout(this);
video_layout->setMargin(0);
video_layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
@@ -36,7 +36,7 @@ PreferencesAudioTab::PreferencesAudioTab()
{
// Backend Layout
QGridLayout* main_layout = new QGridLayout();
main_layout->setMargin(0);
main_layout->setContentsMargins(0, 0, 0, 0);
int row = 0;
+1 -1
View File
@@ -55,7 +55,7 @@ ProgressDialog::ProgressDialog(const QString& message, const QString& title, QWi
QHBoxLayout* cancel_layout = new QHBoxLayout();
layout->addLayout(cancel_layout);
cancel_layout->setMargin(0);
cancel_layout->setContentsMargins(0, 0, 0, 0);
cancel_layout->setSpacing(0);
cancel_layout->addStretch();
@@ -47,7 +47,7 @@ SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget* parent) :
PresetManager<SequencePreset>(this, QStringLiteral("sequencepresets"))
{
QVBoxLayout* outer_layout = new QVBoxLayout(this);
outer_layout->setMargin(0);
outer_layout->setContentsMargins(0, 0, 0, 0);
preset_tree_ = new QTreeWidget();
preset_tree_->setColumnCount(1);
+1 -1
View File
@@ -56,7 +56,7 @@ void TaskDialog::showEvent(QShowEvent *e)
this, &TaskDialog::TaskFinished, Qt::QueuedConnection);
// Run task in another thread with QtConcurrent
task_watcher->setFuture(QtConcurrent::run(task_, &Task::Start));
task_watcher->setFuture(QtConcurrent::run(&Task::Start, task_));
already_shown_ = true;
}
@@ -297,7 +297,7 @@ QMatrix4x4 TransformDistortNode::AdjustMatrixByResolutions(const QMatrix4x4 &mat
adjusted_matrix.scale(2.0 / sequence_res.x(), 2.0 / sequence_res.y(), 1.0);
// Apply offset if applicable
adjusted_matrix.translate(offset);
adjusted_matrix.translate(offset.x(), offset.y());
// Adjust by the matrix we generated earlier
adjusted_matrix *= mat;
@@ -358,7 +358,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N
// Fold values into a matrix for the rectangle
QMatrix4x4 rectangle_matrix;
rectangle_matrix.scale(sequence_half_res);
rectangle_matrix.scale(sequence_half_res.x(), sequence_half_res.y());
rectangle_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, false, false, false, row[kParentInput].toMatrix()),
sequence_res,
tex_sz,
@@ -378,7 +378,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N
// Draw anchor point
QMatrix4x4 anchor_matrix;
anchor_matrix.scale(sequence_half_res);
anchor_matrix.scale(sequence_half_res.x(), sequence_half_res.y());
anchor_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, true, false, false, row[kParentInput].toMatrix()),
sequence_res,
tex_sz,
+2 -2
View File
@@ -128,7 +128,7 @@ QMatrix4x4 MatrixGenerator::GenerateMatrix(const QVector2D& pos,
QMatrix4x4 mat)
{
// Position
mat.translate(pos);
mat.translate(pos.x(), pos.y());
// Rotation
mat.rotate(rot, 0, 0, 1);
@@ -143,7 +143,7 @@ QMatrix4x4 MatrixGenerator::GenerateMatrix(const QVector2D& pos,
mat.scale(full_scale);
// Anchor Point
mat.translate(-anchor);
mat.translate(-anchor.x(), -anchor.y());
return mat;
}
+2 -2
View File
@@ -141,9 +141,9 @@ QVector4D MathNodeBase::RetrieveVector(const NodeValue &val)
// QVariant doesn't know that QVector*D can convert themselves so we do it here
switch (val.type()) {
case NodeValue::kVec2:
return val.toVec2();
return QVector4D(val.toVec2());
case NodeValue::kVec3:
return val.toVec3();
return QVector4D(val.toVec3());
case NodeValue::kVec4:
default:
return val.toVec4();
@@ -570,13 +570,13 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data, Q
} else if (reader->name() == QStringLiteral("caches")) {
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("audio")) {
node->audio_playback_cache()->SetUuid(reader->readElementText());
node->audio_playback_cache()->SetUuid(QUuid::fromString(reader->readElementText()));
} else if (reader->name() == QStringLiteral("video")) {
node->video_frame_cache()->SetUuid(reader->readElementText());
node->video_frame_cache()->SetUuid(QUuid::fromString(reader->readElementText()));
} else if (reader->name() == QStringLiteral("thumb")) {
node->thumbnail_cache()->SetUuid(reader->readElementText());
node->thumbnail_cache()->SetUuid(QUuid::fromString(reader->readElementText()));
} else if (reader->name() == QStringLiteral("waveform")) {
node->waveform_cache()->SetUuid(reader->readElementText());
node->waveform_cache()->SetUuid(QUuid::fromString(reader->readElementText()));
} else {
reader->skipCurrentElement();
}
+1 -1
View File
@@ -40,7 +40,7 @@ ProjectPanel::ProjectPanel(QWidget *parent) :
// Create main widget and its layout
QWidget* central_widget = new QWidget(this);
QVBoxLayout* layout = new QVBoxLayout(central_widget);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
SetWidgetWithPadding(central_widget);
+1 -1
View File
@@ -36,7 +36,7 @@ ScopePanel::ScopePanel(QWidget* parent) :
QVBoxLayout* layout = new QVBoxLayout(central);
QHBoxLayout* toolbar_layout = new QHBoxLayout();
toolbar_layout->setMargin(0);
toolbar_layout->setContentsMargins(0, 0, 0, 0);
scope_type_combobox_ = new QComboBox();
+5
View File
@@ -29,6 +29,11 @@ TimeBasedPanel::TimeBasedPanel(const QString &object_name, QWidget *parent) :
{
}
TimeBasedPanel::~TimeBasedPanel()
{
delete widget_;
}
rational TimeBasedPanel::GetTime()
{
return widget_->GetTime();
+2
View File
@@ -32,6 +32,8 @@ class TimeBasedPanel : public PanelWidget
public:
TimeBasedPanel(const QString& object_name, QWidget *parent = nullptr);
virtual ~TimeBasedPanel() override;
void ConnectViewerNode(ViewerOutput *node);
void DisconnectViewerNode()
+1
View File
@@ -22,6 +22,7 @@
#define RENDERTEXTURE_H
#include <memory>
#include <QVariant>
#include "render/videoparams.h"
+1 -1
View File
@@ -35,7 +35,7 @@ ProjectImportTask::ProjectImportTask(Folder *folder, const QStringList &filename
folder_(folder)
{
foreach (const QString& f, filenames) {
filenames_.append(f);
filenames_.append(QFileInfo(f));
}
file_count_ = Core::CountFilesInFileList(filenames_);
+1 -1
View File
@@ -93,7 +93,7 @@ void TaskManager::AddTask(Task* t)
tasks_.insert(watcher, t);
// Run task concurrently
watcher->setFuture(QtConcurrent::run(t, &Task::Start));
watcher->setFuture(QtConcurrent::run(&Task::Start, t));
// Emit signal that a Task was added
emit TaskAdded(t);
-5
View File
@@ -36,7 +36,6 @@ namespace olive {
const char* StyleManager::kDefaultStyle = "olive-dark";
QString StyleManager::current_style_;
QMap<QString, QString> StyleManager::available_themes_;
QPalette StyleManager::platform_palette_;
QPalette StyleManager::ParsePalette(const QString& ini_path)
{
@@ -127,10 +126,6 @@ void StyleManager::ParsePaletteColor(QSettings *ini, QPalette *palette, QPalette
void StyleManager::Init()
{
// Store standard palette before replacing it with our own
platform_palette_ = qApp->palette();
platform_palette_.resolve(-1);
qApp->setStyle(QStyleFactory::create("Fusion"));
available_themes_.insert(QStringLiteral("olive-dark"), QStringLiteral("Olive Dark"));
-2
View File
@@ -54,8 +54,6 @@ private:
static QMap<QString, QString> available_themes_;
static QPalette platform_palette_;
};
}
+1 -1
View File
@@ -44,7 +44,7 @@ ColorValuesWidget::ColorValuesWidget(ColorManager *manager, QWidget *parent) :
{
QHBoxLayout* preview_layout = new QHBoxLayout();
preview_layout->setMargin(0);
preview_layout->setContentsMargins(0, 0, 0, 0);
preview_layout->addWidget(new QLabel(tr("Preview")));
+2 -2
View File
@@ -53,7 +53,7 @@ CurveWidget::CurveWidget(QWidget *parent) :
QWidget* workarea = new QWidget();
QVBoxLayout* layout = new QVBoxLayout(workarea);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
splitter->addWidget(workarea);
QHBoxLayout* top_controls = new QHBoxLayout();
@@ -86,7 +86,7 @@ CurveWidget::CurveWidget(QWidget *parent) :
// We use a separate layout for the ruler+view combination so that there's no spacing between them
QVBoxLayout* ruler_view_layout = new QVBoxLayout();
ruler_view_layout->setMargin(0);
ruler_view_layout->setContentsMargins(0, 0, 0, 0);
ruler_view_layout->setSpacing(0);
ruler_view_layout->addWidget(ruler());
+1 -1
View File
@@ -34,7 +34,7 @@ FileField::FileField(QWidget* parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
line_edit_ = new QLineEdit();
connect(line_edit_, &QLineEdit::textChanged, this, &FileField::LineEditChanged);
+1 -1
View File
@@ -146,7 +146,7 @@ QSize FlowLayout::minimumSize() const
foreach (item, itemList)
size = size.expandedTo(item->minimumSize());
size += QSize(2*margin(), 2*margin());
size += QSize(2*contentsMargins().left(), 2*contentsMargins().top());
return size;
}
+3 -3
View File
@@ -38,7 +38,7 @@ ManagedDisplayWidget::ManagedDisplayWidget(QWidget *parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
if (RenderManager::instance()->backend() == RenderManager::kOpenGL) {
// Create OpenGL widget
@@ -312,11 +312,11 @@ bool ManagedDisplayWidget::eventFilter(QObject *o, QEvent *e)
{
// HACK: QWindows don't seem to receive ContextMenu events on right click (only when pressing
// the menu button on the keyboard) so we handle it manually here
QMouseEvent *ev = static_cast<QMouseEvent*>(e);
/*QMouseEvent *ev = static_cast<QMouseEvent*>(e);
if (ev->button() == Qt::RightButton) {
emit customContextMenuRequested(ev->pos());
return true;
}
}*/
break;
}
default:
@@ -48,6 +48,15 @@ class ManagedDisplayWidgetOpenGL
public:
ManagedDisplayWidgetOpenGL() = default;
virtual ~ManagedDisplayWidgetOpenGL() override
{
if (context()) {
DestroyListener();
disconnect(context(), &QOpenGLContext::aboutToBeDestroyed,
this, &ManagedDisplayWidgetOpenGL::DestroyListener);
}
}
signals:
// Render signals
void OnInit();
+2
View File
@@ -20,6 +20,8 @@
#include "menushared.h"
#include <QActionGroup>
#include "core.h"
#include "common/timecodefunctions.h"
#include "panel/panelmanager.h"
+2 -2
View File
@@ -46,7 +46,7 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
// Create horizontal layout to place scroll area in (and keyframe editing eventually)
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
QSplitter* splitter = new QSplitter(Qt::Horizontal);
layout->addWidget(splitter);
@@ -113,7 +113,7 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
QWidget* keyframe_area = new QWidget();
QVBoxLayout* keyframe_area_layout = new QVBoxLayout(keyframe_area);
keyframe_area_layout->setSpacing(0);
keyframe_area_layout->setMargin(0);
keyframe_area_layout->setContentsMargins(0, 0, 0, 0);
// Create ruler object
keyframe_area_layout->addWidget(ruler());
@@ -37,7 +37,7 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
connected_node_(nullptr)
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
QSizePolicy p = sizePolicy();
p.setHorizontalStretch(1);
@@ -47,7 +47,7 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
// Set up label area
QHBoxLayout *label_layout = new QHBoxLayout();
label_layout->setSpacing(QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral(" ")));
label_layout->setMargin(0);
label_layout->setContentsMargins(0, 0, 0, 0);
layout->addLayout(label_layout);
CollapseButton *collapse_btn = new CollapseButton(this);
@@ -33,7 +33,7 @@ NodeParamViewKeyframeControl::NodeParamViewKeyframeControl(bool right_align, QWi
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
if (right_align) {
@@ -31,7 +31,7 @@ NodeParamViewTextEdit::NodeParamViewTextEdit(QWidget *parent) :
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
line_edit_ = new QPlainTextEdit();
line_edit_->setUndoRedoEnabled(true);
@@ -567,7 +567,7 @@ void NodeParamViewWidgetBridge::SetProperty(const QString &key, const QVariant &
}
} else { // set specific track/widget
bool ok;
int element = key.midRef(7).toInt(&ok);
int element = key.mid(7).toInt(&ok);
int tracks = NodeValue::get_number_of_keyframe_tracks(data_type);
if (ok && element >= 0 && element < tracks) {
@@ -686,7 +686,7 @@ void NodeParamViewWidgetBridge::SetProperty(const QString &key, const QVariant &
}
} else {
bool ok;
int element = key.midRef(5).toInt(&ok);
int element = key.mid(5).toInt(&ok);
if (ok && element >= 0 && element < tracks) {
static_cast<SliderBase*>(widgets_.at(element))->SetColor(c);
}
+1 -1
View File
@@ -29,7 +29,7 @@ NodeTableWidget::NodeTableWidget(QWidget* parent) :
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
view_ = new NodeTableView();
layout->addWidget(view_);
+1 -1
View File
@@ -13,7 +13,7 @@ NodeViewToolBar::NodeViewToolBar(QWidget *parent) :
QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
add_node_btn_ = new QPushButton();
connect(add_node_btn_, &QPushButton::clicked, this, &NodeViewToolBar::AddNodeClicked);
+1 -1
View File
@@ -28,7 +28,7 @@ NodeWidget::NodeWidget(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout *outer_layout = new QVBoxLayout(this);
outer_layout->setMargin(0);
outer_layout->setContentsMargins(0, 0, 0, 0);
toolbar_ = new NodeViewToolBar();
outer_layout->addWidget(toolbar_);
+1 -1
View File
@@ -158,7 +158,7 @@ void PanelWidget::SetWidgetWithPadding(QWidget *widget)
{
QWidget* wrapper = new QWidget();
QHBoxLayout* layout = new QHBoxLayout(wrapper);
layout->setMargin(layout->margin() / 2);
layout->setContentsMargins(layout->contentsMargins() / 2);
layout->addWidget(widget);
setWidget(wrapper);
}
+1 -1
View File
@@ -32,7 +32,7 @@ PathWidget::PathWidget(const QString &path, QWidget *parent) :
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
path_edit_ = new QLineEdit();
path_edit_->setText(path);
+1 -1
View File
@@ -68,7 +68,7 @@ ManagedPixelSamplerWidget::ManagedPixelSamplerWidget(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
display_view_ = new PixelSamplerWidget();
display_view_->setTitle(tr("Display"));
@@ -37,7 +37,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
// Create lower controls
QHBoxLayout* lower_control_layout = new QHBoxLayout(this);
lower_control_layout->setSpacing(0);
lower_control_layout->setMargin(0);
lower_control_layout->setContentsMargins(0, 0, 0, 0);
QSizePolicy lower_container_size_policy(QSizePolicy::Maximum, QSizePolicy::Expanding);
lower_container_size_policy.setHorizontalStretch(1);
@@ -51,7 +51,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
QHBoxLayout* lower_left_layout = new QHBoxLayout(lower_left_container_);
lower_left_layout->setSpacing(0);
lower_left_layout->setMargin(0);
lower_left_layout->setContentsMargins(0, 0, 0, 0);
cur_tc_lbl_ = new RationalSlider();
cur_tc_lbl_->SetDisplayType(RationalSlider::kTime);
@@ -73,7 +73,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
QHBoxLayout* lower_middle_layout = new QHBoxLayout(lower_middle_container);
lower_middle_layout->setSpacing(0);
lower_middle_layout->setMargin(0);
lower_middle_layout->setContentsMargins(0, 0, 0, 0);
lower_middle_layout->addStretch();
QSizePolicy btn_sz_policy(QSizePolicy::Maximum, QSizePolicy::Preferred);
@@ -124,7 +124,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
av_btn_widget->setSizePolicy(lower_container_size_policy);
QHBoxLayout* av_btn_layout = new QHBoxLayout(av_btn_widget);
av_btn_layout->setSpacing(0);
av_btn_layout->setMargin(0);
av_btn_layout->setContentsMargins(0, 0, 0, 0);
video_drag_btn_ = new DragButton();
connect(video_drag_btn_, &QPushButton::clicked, this, &PlaybackControls::VideoClicked);
connect(video_drag_btn_, &DragButton::MousePressed, this, &PlaybackControls::VideoPressed);
@@ -143,7 +143,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
QHBoxLayout* lower_right_layout = new QHBoxLayout(lower_right_container_);
lower_right_layout->setSpacing(0);
lower_right_layout->setMargin(0);
lower_right_layout->setContentsMargins(0, 0, 0, 0);
lower_right_layout->addStretch();
end_tc_lbl_ = new QLabel();
@@ -53,7 +53,7 @@ ProjectExplorer::ProjectExplorer(QWidget *parent) :
// Create layout
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
// Set up navigation bar
nav_bar_ = new ProjectExplorerNavigation(this);
@@ -33,7 +33,7 @@ ProjectExplorerNavigation::ProjectExplorerNavigation(QWidget *parent) :
{
// Create widget layout
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
// Create "directory up" button
dir_up_btn_ = new QPushButton(this);
+1 -1
View File
@@ -33,7 +33,7 @@ ProjectToolbar::ProjectToolbar(QWidget *parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
new_button_ = new QPushButton();
connect(new_button_, &QPushButton::clicked, this, &ProjectToolbar::NewClicked);
+14 -2
View File
@@ -103,14 +103,26 @@ void SliderBase::changeEvent(QEvent *e)
super::changeEvent(e);
}
bool SliderBase::GetLabelSubstitution(const QVariant &v, QString *out) const
{
for (auto it=label_substitutions_.constBegin(); it!=label_substitutions_.constEnd(); it++) {
if (it->first == v) {
*out = it->second;
return true;
}
}
return false;
}
void SliderBase::UpdateLabel()
{
QString s;
if (tristate_) {
s = tr("---");
} else if (label_substitutions_.contains(GetValueInternal())) {
s = label_substitutions_.value(GetValueInternal());
} else if (GetLabelSubstitution(GetValueInternal(), &s)) {
// String will already be set, just pass through
} else {
s = GetFormattedValueToString();
}
+4 -2
View File
@@ -51,7 +51,7 @@ public:
void InsertLabelSubstitution(const QVariant &value, const QString &label)
{
label_substitutions_.insert(value, label);
label_substitutions_.append({value, label});
UpdateLabel();
}
@@ -90,6 +90,8 @@ protected:
virtual void changeEvent(QEvent* e) override;
private:
bool GetLabelSubstitution(const QVariant &v, QString *out) const;
SliderLabel* label_;
FocusableLineEdit* editor_;
@@ -103,7 +105,7 @@ private:
bool format_plural_;
QMap<QVariant, QString> label_substitutions_;
QVector<QPair<QVariant, QString> > label_substitutions_;
private slots:
void LineEditConfirmed();
+1 -1
View File
@@ -42,7 +42,7 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString
QFrame(parent, Qt::Popup)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
setFrameShape(QFrame::Box);
@@ -43,7 +43,7 @@ public:
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(inner_);
RepopulateList();
+1 -1
View File
@@ -34,7 +34,7 @@ ElapsedCounterWidget::ElapsedCounterWidget(QWidget* parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(layout->spacing() * 8);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
elapsed_lbl_ = new QLabel();
layout->addWidget(elapsed_lbl_);
+1 -1
View File
@@ -37,7 +37,7 @@ TaskView::TaskView(QWidget* parent) :
// Create layout for central widget
layout_ = new QVBoxLayout(central_widget_);
layout_->setSpacing(0);
layout_->setMargin(0);
layout_->setContentsMargins(0, 0, 0, 0);
// Add a "stretch" so that TaskViewItems don't try to expand all the way to the bottom
layout_->addStretch();
@@ -30,7 +30,7 @@ TimelineAndTrackView::TimelineAndTrackView(Qt::Alignment vertical_alignment, QWi
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
splitter_ = new QSplitter(Qt::Horizontal);
splitter_->setChildrenCollapsible(false);
+1 -1
View File
@@ -73,7 +73,7 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
{
QVBoxLayout* vert_layout = new QVBoxLayout(this);
vert_layout->setSpacing(0);
vert_layout->setMargin(0);
vert_layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* ruler_and_time_layout = new QHBoxLayout();
vert_layout->addLayout(ruler_and_time_layout);
@@ -42,7 +42,7 @@ TrackView::TrackView(Qt::Alignment vertical_alignment, QWidget *parent) :
setWidgetResizable(true);
QVBoxLayout* layout = new QVBoxLayout(central);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
if (alignment_ == Qt::AlignBottom) {
@@ -40,7 +40,7 @@ TrackViewItem::TrackViewItem(Track* track, QWidget *parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
stack_ = new QStackedWidget();
layout->addWidget(stack_);
+1 -1
View File
@@ -38,7 +38,7 @@ Toolbar::Toolbar(QWidget *parent) :
super(parent)
{
layout_ = new FlowLayout(this);
layout_->setMargin(0);
layout_->setContentsMargins(0, 0, 0, 0);
// Create standard tool buttons
btn_pointer_tool_ = CreateToolButton(Tool::kPointer);
+5 -2
View File
@@ -82,7 +82,7 @@ ViewerWidget::ViewerWidget(ViewerDisplayWidget *display, QWidget *parent) :
{
// Set up main layout
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
// Create main OpenGL-based view and sizer
sizer_ = new ViewerSizer();
@@ -166,6 +166,9 @@ ViewerWidget::~ViewerWidget()
foreach (ViewerWindow* window, windows) {
delete window;
}
delete display_widget_;
display_widget_ = nullptr;
}
void ViewerWidget::TimeChangedEvent(const rational &time)
@@ -1146,7 +1149,7 @@ RenderTicketPtr ViewerWidget::GetFrame(const rational &t)
// Frame has been cached, grab the frame
RenderTicketPtr ticket = std::make_shared<RenderTicket>();
ticket->setProperty("time", QVariant::fromValue(t));
QtConcurrent::run(ViewerWidget::DecodeCachedImage, ticket, GetConnectedNode()->video_frame_cache()->GetCacheDirectory(), GetConnectedNode()->video_frame_cache()->GetUuid(), Timecode::time_to_timestamp(t, timebase(), Timecode::kFloor));
QtConcurrent::run(static_cast<void(*)(RenderTicketPtr, const QString &, const QUuid &, const int64_t &)>(ViewerWidget::DecodeCachedImage), ticket, GetConnectedNode()->video_frame_cache()->GetCacheDirectory(), GetConnectedNode()->video_frame_cache()->GetUuid(), Timecode::time_to_timestamp(t, timebase(), Timecode::kFloor));
return ticket;
}
}
+4 -4
View File
@@ -1051,7 +1051,7 @@ void ViewerDisplayWidget::DrawSubtitleTracks()
f.setFamily(family);
}
f.setWeight(OLIVE_CONFIG("DefaultSubtitleWeight").toInt());
f.setWeight(static_cast<QFont::Weight>(OLIVE_CONFIG("DefaultSubtitleWeight").toInt()));
bounding_box.adjust(bounding_box.width()/10, bounding_box.height()/10, -bounding_box.width()/10, -bounding_box.height()/10);
@@ -1145,7 +1145,7 @@ void ViewerDisplayWidget::ForwardDragEventToTextEdit(T *e)
bool ViewerDisplayWidget::ForwardMouseEventToTextEdit(QMouseEvent *event, bool check_if_outside)
{
// Transform screen mouse coords to world mouse coords
QPointF local_pos = GetVirtualPosForTextEdit(event->localPos());
QPointF local_pos = GetVirtualPosForTextEdit(event->position());
if (check_if_outside) {
if (local_pos.x() < 0 || local_pos.x() >= text_edit_->width() || local_pos.y() < 0 || local_pos.y() >= text_edit_->height()) {
@@ -1156,8 +1156,8 @@ bool ViewerDisplayWidget::ForwardMouseEventToTextEdit(QMouseEvent *event, bool c
local_pos = AdjustPosByVAlign(local_pos);
event->setLocalPos(local_pos);
return ForwardEventToTextEdit(event);
QMouseEvent derived(event->type(), local_pos, event->scenePosition(), event->globalPosition(), event->button(), event->buttons(), event->modifiers(), event->source(), event->pointingDevice());
return ForwardEventToTextEdit(&derived);
}
bool ViewerDisplayWidget::ForwardEventToTextEdit(QEvent *event)
-2
View File
@@ -21,8 +21,6 @@
#ifndef VIEWERQUEUE_H
#define VIEWERQUEUE_H
#include <QLinkedList>
#include "codec/frame.h"
namespace olive {
+1 -1
View File
@@ -32,7 +32,7 @@ ViewerWindow::ViewerWindow(QWidget *parent) :
pixel_aspect_(1)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
display_widget_ = new ViewerDisplayWidget();
+1
View File
@@ -20,6 +20,7 @@
#include "mainmenu.h"
#include <QActionGroup>
#include <QDesktopServices>
#include <QEvent>
#include <QStyleFactory>
-1
View File
@@ -22,7 +22,6 @@
#include <QApplication>
#include <QDebug>
#include <QDesktopWidget>
#include <QMessageBox>
#include <QScreen>