From 91b761693bf42ab4416e402f13e7db1a5dc886b4 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Wed, 4 May 2022 09:50:34 -0700 Subject: [PATCH] code: use config macro Macro is much easier to use and more readable --- app/audio/audiomanager.cpp | 2 +- app/audio/audiovisualwaveform.cpp | 2 +- app/config/config.h | 1 + app/core.cpp | 16 +++++----- app/dialog/about/about.cpp | 2 +- app/dialog/export/export.cpp | 2 +- .../tabs/preferencesappearancetab.cpp | 10 +++---- .../tabs/preferencesbehaviortab.cpp | 8 ++--- .../preferences/tabs/preferencesdisktab.cpp | 8 ++--- .../tabs/preferencesgeneraltab.cpp | 30 +++++++++---------- app/dialog/sequence/sequence.cpp | 16 +++++----- .../sequence/sequencedialogpresettab.cpp | 8 ++--- app/node/node.cpp | 6 ++-- app/node/output/viewer/viewer.cpp | 20 ++++++------- .../project/serializer/serializer210528.cpp | 2 +- .../project/serializer/serializer210907.cpp | 2 +- .../project/serializer/serializer211228.cpp | 2 +- app/panel/panelmanager.cpp | 2 +- app/render/diskmanager.cpp | 2 +- app/render/previewautocacher.cpp | 6 ++-- app/render/renderprocessor.cpp | 2 +- app/task/project/import/import.cpp | 2 +- app/timeline/timelinemarker.cpp | 2 +- app/ui/style/style.cpp | 2 +- app/widget/colorwheel/colorvalueswidget.cpp | 4 +-- .../handmovableview/handmovableview.cpp | 2 +- app/widget/scope/scopebase/scopebase.cpp | 2 +- app/widget/scope/waveform/waveform.cpp | 2 +- app/widget/slider/base/numericsliderbase.cpp | 2 +- app/widget/slider/base/sliderladder.cpp | 2 +- app/widget/timebased/timebasedwidget.cpp | 6 ++-- app/widget/timelinewidget/tool/import.cpp | 6 ++-- .../timelinewidget/undo/timelineundogeneral.h | 2 +- .../timelinewidget/view/timelineview.cpp | 6 ++-- app/widget/viewer/viewer.cpp | 12 ++++---- app/widget/viewer/viewerdisplay.cpp | 4 +-- app/window/mainwindow/mainmenu.cpp | 4 +-- app/window/mainwindow/mainwindow.cpp | 2 +- 38 files changed, 105 insertions(+), 106 deletions(-) diff --git a/app/audio/audiomanager.cpp b/app/audio/audiomanager.cpp index 878944505..8fac9bd65 100644 --- a/app/audio/audiomanager.cpp +++ b/app/audio/audiomanager.cpp @@ -235,7 +235,7 @@ PaDeviceIndex AudioManager::FindConfigDeviceByName(bool is_output_device) { QString entry = is_output_device ? QStringLiteral("AudioOutput") : QStringLiteral("AudioInput"); - return FindDeviceByName(Config::Current()[entry].toString(), is_output_device); + return FindDeviceByName(OLIVE_CONFIG_STR(entry).toString(), is_output_device); } PaDeviceIndex AudioManager::FindDeviceByName(const QString &s, bool is_output_device) diff --git a/app/audio/audiovisualwaveform.cpp b/app/audio/audiovisualwaveform.cpp index af439bca0..dbc0cb973 100644 --- a/app/audio/audiovisualwaveform.cpp +++ b/app/audio/audiovisualwaveform.cpp @@ -426,7 +426,7 @@ void AudioVisualWaveform::DrawWaveform(QPainter *painter, const QRect& rect, con int start = qMax(rect.x(), -top_left.x()); int end = qMin(rect.right(), -top_left.x() + viewport.width()); - bool rectified = Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool(); + bool rectified = OLIVE_CONFIG("RectifiedWaveforms").toBool(); for (int i=start;ihas_autorecovery_been_saved()) { QDir project_autorecovery_dir(QDir(FileFunctions::GetAutoRecoveryRoot()).filePath(p->GetUuid().toString())); @@ -986,7 +986,7 @@ void Core::SaveAutorecovery() realname_file.close(); } - int64_t max_recoveries_per_file = Config::Current()[QStringLiteral("AutorecoveryMaximum")].toLongLong(); + int64_t max_recoveries_per_file = OLIVE_CONFIG("AutorecoveryMaximum").toLongLong(); // Since we write an extra file, increment total allowed files by 1 max_recoveries_per_file++; @@ -1075,12 +1075,12 @@ Folder *Core::GetSelectedFolderInActiveProject() const Timecode::Display Core::GetTimecodeDisplay() const { - return static_cast(Config::Current()["TimecodeDisplay"].toInt()); + return static_cast(OLIVE_CONFIG("TimecodeDisplay").toInt()); } void Core::SetTimecodeDisplay(Timecode::Display d) { - Config::Current()["TimecodeDisplay"] = d; + OLIVE_CONFIG("TimecodeDisplay") = d; emit TimecodeDisplayChanged(d); } @@ -1202,7 +1202,7 @@ void Core::SetStartupLocale() } } - QString use_locale = Config::Current()[QStringLiteral("Language")].toString(); + QString use_locale = OLIVE_CONFIG("Language").toString(); if (use_locale.isEmpty()) { // No configured locale, auto-detect the system's locale @@ -1423,12 +1423,12 @@ QString GetRenderModePreferencePrefix(RenderMode::Mode mode, const QString &pref QVariant Core::GetPreferenceForRenderMode(RenderMode::Mode mode, const QString &preference) { - return Config::Current()[GetRenderModePreferencePrefix(mode, preference)]; + return OLIVE_CONFIG_STR(GetRenderModePreferencePrefix(mode, preference)); } void Core::SetPreferenceForRenderMode(RenderMode::Mode mode, const QString &preference, const QVariant &value) { - Config::Current()[GetRenderModePreferencePrefix(mode, preference)] = value; + OLIVE_CONFIG_STR(GetRenderModePreferencePrefix(mode, preference)) = value; } bool Core::LabelNodes(const QVector &nodes, MultiUndoCommand *parent) diff --git a/app/dialog/about/about.cpp b/app/dialog/about/about.cpp index e3500e217..066f8b537 100644 --- a/app/dialog/about/about.cpp +++ b/app/dialog/about/about.cpp @@ -132,7 +132,7 @@ AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent) : void AboutDialog::accept() { if (dont_show_again_checkbox_ && dont_show_again_checkbox_->isChecked()) { - Config::Current()[QStringLiteral("ShowWelcomeDialog")] = false; + OLIVE_CONFIG("ShowWelcomeDialog") = false; } QDialog::accept(); diff --git a/app/dialog/export/export.cpp b/app/dialog/export/export.cpp index 8723634e2..58813f7d5 100644 --- a/app/dialog/export/export.cpp +++ b/app/dialog/export/export.cpp @@ -208,7 +208,7 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, QWidget *parent) : video_tab_->height_slider()->SetDefaultValue(vp.height()); video_tab_->SetSelectedFrameRate(vp.frame_rate()); video_tab_->pixel_aspect_combobox()->SetPixelAspectRatio(vp.pixel_aspect_ratio()); - video_tab_->pixel_format_field()->SetPixelFormat(static_cast(Config::Current()[QStringLiteral("OnlinePixelFormat")].toInt())); + video_tab_->pixel_format_field()->SetPixelFormat(static_cast(OLIVE_CONFIG("OnlinePixelFormat").toInt())); video_tab_->interlaced_combobox()->SetInterlaceMode(vp.interlacing()); audio_tab_->sample_rate_combobox()->SetSampleRate(ap.sample_rate()); audio_tab_->sample_format_combobox()->SetAttemptToRestoreFormat(false); diff --git a/app/dialog/preferences/tabs/preferencesappearancetab.cpp b/app/dialog/preferences/tabs/preferencesappearancetab.cpp index 761ea18dd..63c5da053 100644 --- a/app/dialog/preferences/tabs/preferencesappearancetab.cpp +++ b/app/dialog/preferences/tabs/preferencesappearancetab.cpp @@ -74,7 +74,7 @@ PreferencesAppearanceTab::PreferencesAppearanceTab() color_layout->addWidget(new QLabel(cat_name), i, 0); ColorCodingComboBox* ccc = new ColorCodingComboBox(); - ccc->SetColor(Config::Current()[QStringLiteral("CatColor%1").arg(i)].toInt()); + ccc->SetColor(OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)).toInt()); color_layout->addWidget(ccc, i, 1); color_btns_.append(ccc); } @@ -92,7 +92,7 @@ PreferencesAppearanceTab::PreferencesAppearanceTab() marker_layout->addWidget(new QLabel("Default Marker Color"), 0, 0); marker_btn_ = new ColorCodingComboBox(); - marker_btn_->SetColor(Config::Current()[QStringLiteral("MarkerColor")].toInt()); + marker_btn_->SetColor(OLIVE_CONFIG("MarkerColor").toInt()); marker_layout->addWidget(marker_btn_, 0, 1); appearance_layout->addWidget(marker_group, row, 0, 1, 2); @@ -109,14 +109,14 @@ void PreferencesAppearanceTab::Accept(MultiUndoCommand *command) if (style_path != StyleManager::GetStyle()) { StyleManager::SetStyle(style_path); - Config::Current()[QStringLiteral("Style")] = style_path; + OLIVE_CONFIG("Style") = style_path; } for (int i=0; iGetSelectedColor(); + OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)) = color_btns_.at(i)->GetSelectedColor(); } - Config::Current()[QStringLiteral("MarkerColor")] = marker_btn_->GetSelectedColor(); + OLIVE_CONFIG("MarkerColor") = marker_btn_->GetSelectedColor(); } } diff --git a/app/dialog/preferences/tabs/preferencesbehaviortab.cpp b/app/dialog/preferences/tabs/preferencesbehaviortab.cpp index 8d71b3df5..d16c7dce5 100644 --- a/app/dialog/preferences/tabs/preferencesbehaviortab.cpp +++ b/app/dialog/preferences/tabs/preferencesbehaviortab.cpp @@ -108,10 +108,8 @@ void PreferencesBehaviorTab::Accept(MultiUndoCommand *command) { Q_UNUSED(command) - QMap::const_iterator iterator; - - for (iterator=config_map_.begin();iterator!=config_map_.end();iterator++) { - Config::Current()[iterator.value()] = (iterator.key()->checkState(0) == Qt::Checked); + for (auto iterator=config_map_.begin();iterator!=config_map_.end();iterator++) { + OLIVE_CONFIG_STR(iterator.value()) = (iterator.key()->checkState(0) == Qt::Checked); } } @@ -119,7 +117,7 @@ QTreeWidgetItem* PreferencesBehaviorTab::AddItem(const QString &text, const QStr { QTreeWidgetItem* item = new QTreeWidgetItem({text}); item->setToolTip(0, tooltip); - item->setCheckState(0, Config::Current()[config_key].toBool() ? Qt::Checked : Qt::Unchecked); + item->setCheckState(0, OLIVE_CONFIG_STR(config_key).toBool() ? Qt::Checked : Qt::Unchecked); config_map_.insert(item, config_key); diff --git a/app/dialog/preferences/tabs/preferencesdisktab.cpp b/app/dialog/preferences/tabs/preferencesdisktab.cpp index f5258f34e..3d3ee3fa1 100644 --- a/app/dialog/preferences/tabs/preferencesdisktab.cpp +++ b/app/dialog/preferences/tabs/preferencesdisktab.cpp @@ -71,7 +71,7 @@ PreferencesDiskTab::PreferencesDiskTab() cache_ahead_slider_ = new FloatSlider(); cache_ahead_slider_->SetFormat(tr("%1 seconds")); cache_ahead_slider_->SetMinimum(0); - cache_ahead_slider_->SetValue(Config::Current()["DiskCacheAhead"].value().toDouble()); + cache_ahead_slider_->SetValue(OLIVE_CONFIG("DiskCacheAhead").value().toDouble()); cache_behavior_layout->addWidget(cache_ahead_slider_, row, 1); cache_behavior_layout->addWidget(new QLabel(tr("Cache Behind:")), row, 2); @@ -79,7 +79,7 @@ PreferencesDiskTab::PreferencesDiskTab() cache_behind_slider_ = new FloatSlider(); cache_behind_slider_->SetMinimum(0); cache_behind_slider_->SetFormat(tr("%1 seconds")); - cache_behind_slider_->SetValue(Config::Current()["DiskCacheBehind"].value().toDouble()); + cache_behind_slider_->SetValue(OLIVE_CONFIG("DiskCacheBehind").value().toDouble()); cache_behavior_layout->addWidget(cache_behind_slider_, row, 3); outer_layout->addStretch(); @@ -115,8 +115,8 @@ void PreferencesDiskTab::Accept(MultiUndoCommand *command) default_disk_cache_folder_->SetPath(disk_cache_location_->text()); } - Config::Current()["DiskCacheBehind"] = QVariant::fromValue(rational::fromDouble(cache_behind_slider_->GetValue())); - Config::Current()["DiskCacheAhead"] = QVariant::fromValue(rational::fromDouble(cache_ahead_slider_->GetValue())); + OLIVE_CONFIG("DiskCacheBehind") = QVariant::fromValue(rational::fromDouble(cache_behind_slider_->GetValue())); + OLIVE_CONFIG("DiskCacheAhead") = QVariant::fromValue(rational::fromDouble(cache_ahead_slider_->GetValue())); } } diff --git a/app/dialog/preferences/tabs/preferencesgeneraltab.cpp b/app/dialog/preferences/tabs/preferencesgeneraltab.cpp index 3c869bb73..2e6425731 100644 --- a/app/dialog/preferences/tabs/preferencesgeneraltab.cpp +++ b/app/dialog/preferences/tabs/preferencesgeneraltab.cpp @@ -55,7 +55,7 @@ PreferencesGeneralTab::PreferencesGeneralTab() AddLanguage(l); } - QString current_language = Config::Current()[QStringLiteral("Language")].toString(); + QString current_language = OLIVE_CONFIG("Language").toString(); if (current_language.isEmpty()) { // No configured language, use system language current_language = QLocale::system().name(); @@ -86,7 +86,7 @@ PreferencesGeneralTab::PreferencesGeneralTab() autoscroll_method_->addItem(tr("None"), AutoScroll::kNone); autoscroll_method_->addItem(tr("Page Scrolling"), AutoScroll::kPage); autoscroll_method_->addItem(tr("Smooth Scrolling"), AutoScroll::kSmooth); - autoscroll_method_->setCurrentIndex(Config::Current()["Autoscroll"].toInt()); + autoscroll_method_->setCurrentIndex(OLIVE_CONFIG("Autoscroll").toInt()); timeline_layout->addWidget(autoscroll_method_, row, 1); row++; @@ -94,7 +94,7 @@ PreferencesGeneralTab::PreferencesGeneralTab() timeline_layout->addWidget(new QLabel(tr("Rectified Waveforms:")), row, 0); rectified_waveforms_ = new QCheckBox(); - rectified_waveforms_->setChecked(Config::Current()["RectifiedWaveforms"].toBool()); + rectified_waveforms_->setChecked(OLIVE_CONFIG("RectifiedWaveforms").toBool()); timeline_layout->addWidget(rectified_waveforms_, row, 1); row++; @@ -105,7 +105,7 @@ PreferencesGeneralTab::PreferencesGeneralTab() default_still_length_->SetMinimum(rational(100, 1000)); default_still_length_->SetTimebase(rational(100, 1000)); default_still_length_->SetFormat(tr("%1 seconds")); - default_still_length_->SetValue(Config::Current()["DefaultStillLength"].value()); + default_still_length_->SetValue(OLIVE_CONFIG("DefaultStillLength").value()); timeline_layout->addWidget(default_still_length_); } @@ -119,7 +119,7 @@ PreferencesGeneralTab::PreferencesGeneralTab() autorecovery_layout->addWidget(new QLabel(tr("Enable Auto-Recovery:")), row, 0); autorecovery_enabled_ = new QCheckBox(); - autorecovery_enabled_->setChecked(Config::Current()[QStringLiteral("AutorecoveryEnabled")].toBool()); + autorecovery_enabled_->setChecked(OLIVE_CONFIG("AutorecoveryEnabled").toBool()); autorecovery_layout->addWidget(autorecovery_enabled_, row, 1); row++; @@ -130,7 +130,7 @@ PreferencesGeneralTab::PreferencesGeneralTab() autorecovery_interval_->SetMinimum(1); autorecovery_interval_->SetMaximum(60); autorecovery_interval_->SetFormat(QT_TRANSLATE_N_NOOP("olive::SliderBase", "%n minute(s)"), true); - autorecovery_interval_->SetValue(Config::Current()[QStringLiteral("AutorecoveryInterval")].toLongLong()); + autorecovery_interval_->SetValue(OLIVE_CONFIG("AutorecoveryInterval").toLongLong()); autorecovery_layout->addWidget(autorecovery_interval_, row, 1); row++; @@ -140,7 +140,7 @@ PreferencesGeneralTab::PreferencesGeneralTab() autorecovery_maximum_ = new IntegerSlider(); autorecovery_maximum_->SetMinimum(1); autorecovery_maximum_->SetMaximum(1000); - autorecovery_maximum_->SetValue(Config::Current()[QStringLiteral("AutorecoveryMaximum")].toLongLong()); + autorecovery_maximum_->SetValue(OLIVE_CONFIG("AutorecoveryMaximum").toLongLong()); autorecovery_layout->addWidget(autorecovery_maximum_, row, 1); row++; @@ -157,11 +157,11 @@ void PreferencesGeneralTab::Accept(MultiUndoCommand *command) { Q_UNUSED(command) - Config::Current()[QStringLiteral("RectifiedWaveforms")] = rectified_waveforms_->isChecked(); + OLIVE_CONFIG("RectifiedWaveforms") = rectified_waveforms_->isChecked(); - Config::Current()[QStringLiteral("Autoscroll")] = autoscroll_method_->currentData(); + OLIVE_CONFIG("Autoscroll") = autoscroll_method_->currentData(); - Config::Current()[QStringLiteral("DefaultStillLength")] = QVariant::fromValue(default_still_length_->GetValue()); + OLIVE_CONFIG("DefaultStillLength") = QVariant::fromValue(default_still_length_->GetValue()); QString set_language = language_combobox_->currentData().toString(); if (QLocale::system().name() == set_language) { @@ -170,14 +170,14 @@ void PreferencesGeneralTab::Accept(MultiUndoCommand *command) } // If the language has changed, set it now - if (Config::Current()[QStringLiteral("Language")].toString() != set_language) { - Config::Current()[QStringLiteral("Language")] = set_language; + if (OLIVE_CONFIG("Language").toString() != set_language) { + OLIVE_CONFIG("Language") = set_language; Core::instance()->SetLanguage(set_language.isEmpty() ? QLocale::system().name() : set_language); } - Config::Current()[QStringLiteral("AutorecoveryEnabled")] = autorecovery_enabled_->isChecked(); - Config::Current()[QStringLiteral("AutorecoveryInterval")] = QVariant::fromValue(autorecovery_interval_->GetValue()); - Config::Current()[QStringLiteral("AutorecoveryMaximum")] = QVariant::fromValue(autorecovery_maximum_->GetValue()); + OLIVE_CONFIG("AutorecoveryEnabled") = autorecovery_enabled_->isChecked(); + OLIVE_CONFIG("AutorecoveryInterval") = QVariant::fromValue(autorecovery_interval_->GetValue()); + OLIVE_CONFIG("AutorecoveryMaximum") = QVariant::fromValue(autorecovery_maximum_->GetValue()); Core::instance()->SetAutorecoveryInterval(autorecovery_interval_->GetValue()); } diff --git a/app/dialog/sequence/sequence.cpp b/app/dialog/sequence/sequence.cpp index e7daa93e5..4305e1894 100644 --- a/app/dialog/sequence/sequence.cpp +++ b/app/dialog/sequence/sequence.cpp @@ -148,14 +148,14 @@ void SequenceDialog::SetAsDefaultClicked() tr("Are you sure you want to set the current parameters as defaults?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { // Maybe replace with Preset system - Config::Current()[QStringLiteral("DefaultSequenceWidth")] = parameter_tab_->GetSelectedVideoWidth(); - Config::Current()[QStringLiteral("DefaultSequenceHeight")] = parameter_tab_->GetSelectedVideoHeight(); - Config::Current()[QStringLiteral("DefaultSequencePixelAspect")] = QVariant::fromValue(parameter_tab_->GetSelectedVideoPixelAspect()); - Config::Current()[QStringLiteral("DefaultSequenceFrameRate")] = QVariant::fromValue(parameter_tab_->GetSelectedVideoFrameRate().flipped()); - Config::Current()[QStringLiteral("DefaultSequenceInterlacing")] = parameter_tab_->GetSelectedVideoInterlacingMode(); - Config::Current()[QStringLiteral("DefaultSequenceAudioFrequency")] = parameter_tab_->GetSelectedAudioSampleRate(); - Config::Current()[QStringLiteral("DefaultSequenceAudioLayout")] = QVariant::fromValue(parameter_tab_->GetSelectedAudioChannelLayout()); - Config::Current()[QStringLiteral("DefaultSequenceAutoCache")] = QVariant::fromValue(parameter_tab_->GetSelectedPreviewAutoCache()); + OLIVE_CONFIG("DefaultSequenceWidth") = parameter_tab_->GetSelectedVideoWidth(); + OLIVE_CONFIG("DefaultSequenceHeight") = parameter_tab_->GetSelectedVideoHeight(); + OLIVE_CONFIG("DefaultSequencePixelAspect") = QVariant::fromValue(parameter_tab_->GetSelectedVideoPixelAspect()); + OLIVE_CONFIG("DefaultSequenceFrameRate") = QVariant::fromValue(parameter_tab_->GetSelectedVideoFrameRate().flipped()); + OLIVE_CONFIG("DefaultSequenceInterlacing") = parameter_tab_->GetSelectedVideoInterlacingMode(); + OLIVE_CONFIG("DefaultSequenceAudioFrequency") = parameter_tab_->GetSelectedAudioSampleRate(); + OLIVE_CONFIG("DefaultSequenceAudioLayout") = QVariant::fromValue(parameter_tab_->GetSelectedAudioChannelLayout()); + OLIVE_CONFIG("DefaultSequenceAutoCache") = QVariant::fromValue(parameter_tab_->GetSelectedPreviewAutoCache()); } } diff --git a/app/dialog/sequence/sequencedialogpresettab.cpp b/app/dialog/sequence/sequencedialogpresettab.cpp index c3e471b9c..74c5a0595 100644 --- a/app/dialog/sequence/sequencedialogpresettab.cpp +++ b/app/dialog/sequence/sequencedialogpresettab.cpp @@ -100,8 +100,8 @@ QTreeWidgetItem* SequenceDialogPresetTab::CreateFolder(const QString &name) QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &name, int width, int height, int divider) { - const VideoParams::Format default_format = static_cast(Config::Current()["OfflinePixelFormat"].toInt()); - const bool default_autocache = Config::Current()[QStringLiteral("DefaultSequenceAutoCache")].toBool(); + const VideoParams::Format default_format = static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()); + const bool default_autocache = OLIVE_CONFIG("DefaultSequenceAutoCache").toBool(); QTreeWidgetItem* parent = CreateFolder(name); AddStandardItem(parent, std::make_shared(tr("%1 23.976 FPS").arg(name), width, @@ -163,8 +163,8 @@ QTreeWidgetItem *SequenceDialogPresetTab::CreateHDPresetFolder(const QString &na QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(const QString &name, int width, int height, const rational& frame_rate, const rational &standard_par, const rational &wide_par, int divider) { - const VideoParams::Format default_format = static_cast(Config::Current()["OfflinePixelFormat"].toInt()); - const bool default_autocache = Config::Current()[QStringLiteral("DefaultSequenceAutoCache")].toBool(); + const VideoParams::Format default_format = static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()); + const bool default_autocache = OLIVE_CONFIG("DefaultSequenceAutoCache").toBool(); QTreeWidgetItem* parent = CreateFolder(name); preset_tree_->addTopLevelItem(parent); AddStandardItem(parent, std::make_shared(tr("%1 Standard").arg(name), diff --git a/app/node/node.cpp b/app/node/node.cpp index 4a0c60b03..907287880 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -148,7 +148,7 @@ Color Node::color() const if (override_color_ >= 0) { c = override_color_; } else { - c = Config::Current()[QStringLiteral("CatColor%1").arg(this->Category().first())].toInt(); + c = OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(this->Category().first())).toInt(); } return ColorCoding::GetColor(c); @@ -171,7 +171,7 @@ QLinearGradient Node::gradient_color(qreal top, qreal bottom) const QBrush Node::brush(qreal top, qreal bottom) const { - if (Config::Current()[QStringLiteral("UseGradients")].toBool()) { + if (OLIVE_CONFIG("UseGradients").toBool()) { return gradient_color(top, bottom); } else { return color().toQColor(); @@ -1103,7 +1103,7 @@ Node *Node::CopyNodeInGraph(Node *node, MultiUndoCommand *command) { Node* copy; - if (Config::Current()[QStringLiteral("SplitClipsCopyNodes")].toBool()) { + if (OLIVE_CONFIG("SplitClipsCopyNodes").toBool()) { copy = Node::CopyNodeAndDependencyGraphMinusItems(node, command); } else { copy = node->copy(); diff --git a/app/node/output/viewer/viewer.cpp b/app/node/output/viewer/viewer.cpp index 3c01d17e2..0f5a35852 100644 --- a/app/node/output/viewer/viewer.cpp +++ b/app/node/output/viewer/viewer.cpp @@ -188,26 +188,26 @@ AudioParams ViewerOutput::GetFirstEnabledAudioStream() const void ViewerOutput::set_default_parameters() { - int width = Config::Current()["DefaultSequenceWidth"].toInt(); - int height = Config::Current()["DefaultSequenceHeight"].toInt(); + int width = OLIVE_CONFIG("DefaultSequenceWidth").toInt(); + int height = OLIVE_CONFIG("DefaultSequenceHeight").toInt(); SetVideoParams(VideoParams( width, height, - Config::Current()["DefaultSequenceFrameRate"].value(), - static_cast(Config::Current()["OfflinePixelFormat"].toInt()), + OLIVE_CONFIG("DefaultSequenceFrameRate").value(), + static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()), VideoParams::kInternalChannelCount, - Config::Current()["DefaultSequencePixelAspect"].value(), - Config::Current()["DefaultSequenceInterlacing"].value(), + OLIVE_CONFIG("DefaultSequencePixelAspect").value(), + OLIVE_CONFIG("DefaultSequenceInterlacing").value(), VideoParams::generate_auto_divider(width, height) )); SetAudioParams(AudioParams( - Config::Current()["DefaultSequenceAudioFrequency"].toInt(), - Config::Current()["DefaultSequenceAudioLayout"].toULongLong(), + OLIVE_CONFIG("DefaultSequenceAudioFrequency").toInt(), + OLIVE_CONFIG("DefaultSequenceAudioLayout").toULongLong(), AudioParams::kInternalFormat )); - SetVideoAutoCacheEnabled(Config::Current()["DefaultSequenceAutoCache"].toBool()); + SetVideoAutoCacheEnabled(OLIVE_CONFIG("DefaultSequenceAutoCache").toBool()); } void ViewerOutput::ShiftVideoCache(const rational &from, const rational &to) @@ -499,7 +499,7 @@ void ViewerOutput::set_parameters_from_footage(const QVector foo SetVideoParams(VideoParams(s.width(), s.height(), using_timebase, - static_cast(Config::Current()[QStringLiteral("OfflinePixelFormat")].toInt()), + static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()), VideoParams::kInternalChannelCount, s.pixel_aspect_ratio(), s.interlacing(), diff --git a/app/node/project/serializer/serializer210528.cpp b/app/node/project/serializer/serializer210528.cpp index baf53e442..47700b240 100644 --- a/app/node/project/serializer/serializer210528.cpp +++ b/app/node/project/serializer/serializer210528.cpp @@ -605,7 +605,7 @@ void ProjectSerializer210528::LoadMarkerList(QXmlStreamReader *reader, TimelineM } } - new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers); + new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(), TimeRange(in, out), name, markers); } reader->skipCurrentElement(); diff --git a/app/node/project/serializer/serializer210907.cpp b/app/node/project/serializer/serializer210907.cpp index 96b69f214..b65678a04 100644 --- a/app/node/project/serializer/serializer210907.cpp +++ b/app/node/project/serializer/serializer210907.cpp @@ -597,7 +597,7 @@ void ProjectSerializer210907::LoadMarkerList(QXmlStreamReader *reader, TimelineM } } - new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers); + new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(), TimeRange(in, out), name, markers); } reader->skipCurrentElement(); diff --git a/app/node/project/serializer/serializer211228.cpp b/app/node/project/serializer/serializer211228.cpp index 139fd2438..70ae3b494 100644 --- a/app/node/project/serializer/serializer211228.cpp +++ b/app/node/project/serializer/serializer211228.cpp @@ -647,7 +647,7 @@ void ProjectSerializer211228::LoadMarkerList(QXmlStreamReader *reader, TimelineM } } - new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers); + new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(), TimeRange(in, out), name, markers); } reader->skipCurrentElement(); diff --git a/app/panel/panelmanager.cpp b/app/panel/panelmanager.cpp index e3959bfbf..edef10377 100644 --- a/app/panel/panelmanager.cpp +++ b/app/panel/panelmanager.cpp @@ -49,7 +49,7 @@ PanelWidget *PanelManager::CurrentlyFocused(bool enable_hover) const { // If hover focus is enabled, find the currently hovered panel and return it (if no panel is hovered, resort to // default behavior) - if (enable_hover && Config::Current()[QStringLiteral("HoverFocus")].toBool()) { + if (enable_hover && OLIVE_CONFIG("HoverFocus").toBool()) { PanelWidget* hovered = CurrentlyHovered(); if (hovered != nullptr) { diff --git a/app/render/diskmanager.cpp b/app/render/diskmanager.cpp index af67d6bfa..21b4b0413 100644 --- a/app/render/diskmanager.cpp +++ b/app/render/diskmanager.cpp @@ -196,7 +196,7 @@ DiskCacheFolder::DiskCacheFolder(const QString &path, QObject *parent) : { SetPath(path); - save_timer_.setInterval(Config::Current()[QStringLiteral("DiskCacheSaveInterval")].toInt()); + save_timer_.setInterval(OLIVE_CONFIG("DiskCacheSaveInterval").toInt()); connect(&save_timer_, &QTimer::timeout, this, &DiskCacheFolder::SaveDiskCacheIndex); save_timer_.start(); } diff --git a/app/render/previewautocacher.cpp b/app/render/previewautocacher.cpp index dcdb3d20a..c548b1f8f 100644 --- a/app/render/previewautocacher.cpp +++ b/app/render/previewautocacher.cpp @@ -48,7 +48,7 @@ PreviewAutoCacher::PreviewAutoCacher() : SetPlayhead(0); // Wait a certain amount of time before requeuing when we receive an invalidate signal - delayed_requeue_timer_.setInterval(Config::Current()[QStringLiteral("AutoCacheDelay")].toInt()); + delayed_requeue_timer_.setInterval(OLIVE_CONFIG("AutoCacheDelay").toInt()); delayed_requeue_timer_.setSingleShot(true); connect(&delayed_requeue_timer_, &QTimer::timeout, this, &PreviewAutoCacher::RequeueFrames); @@ -502,8 +502,8 @@ void PreviewAutoCacher::StartCachingAudioRange(const TimeRange &range) void PreviewAutoCacher::SetPlayhead(const rational &playhead) { - cache_range_ = TimeRange(playhead - Config::Current()[QStringLiteral("DiskCacheBehind")].value(), - playhead + Config::Current()[QStringLiteral("DiskCacheAhead")].value()); + cache_range_ = TimeRange(playhead - OLIVE_CONFIG("DiskCacheBehind").value(), + playhead + OLIVE_CONFIG("DiskCacheAhead").value()); RequeueFrames(); } diff --git a/app/render/renderprocessor.cpp b/app/render/renderprocessor.cpp index cdb742d55..dc4556f8d 100644 --- a/app/render/renderprocessor.cpp +++ b/app/render/renderprocessor.cpp @@ -106,7 +106,7 @@ FramePtr RenderProcessor::GenerateFrame(TexturePtr texture, const rational& time if (output_color_transform) { // Yes color transform, blit color managed render_ctx_->BlitColorManaged(output_color_transform, texture, - Config::Current()[QStringLiteral("ReassocLinToNonLin")].toBool() ? Renderer::kAlphaAssociated : Renderer::kAlphaNone, + OLIVE_CONFIG("ReassocLinToNonLin").toBool() ? Renderer::kAlphaAssociated : Renderer::kAlphaNone, blit_tex.get(), true, matrix); } else { // No color transform, just blit diff --git a/app/task/project/import/import.cpp b/app/task/project/import/import.cpp index 352a8f175..900cc1d8b 100644 --- a/app/task/project/import/import.cpp +++ b/app/task/project/import/import.cpp @@ -203,7 +203,7 @@ void ProjectImportTask::ValidateImageSequence(Footage *footage, QFileInfoList& i // User has confirmed it is a still image, let's set it accordingly. video_stream.set_video_type(VideoParams::kVideoTypeImageSequence); - rational default_timebase = Config::Current()[QStringLiteral("DefaultSequenceFrameRate")].value(); + rational default_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value(); video_stream.set_time_base(default_timebase); video_stream.set_frame_rate(default_timebase.flipped()); diff --git a/app/timeline/timelinemarker.cpp b/app/timeline/timelinemarker.cpp index 32eb98976..5fb5fb1fd 100644 --- a/app/timeline/timelinemarker.cpp +++ b/app/timeline/timelinemarker.cpp @@ -29,7 +29,7 @@ namespace olive { TimelineMarker::TimelineMarker(QObject *parent) : - color_(Config::Current()[QStringLiteral("MarkerColor")].toInt()) + color_(OLIVE_CONFIG("MarkerColor").toInt()) { setParent(parent); } diff --git a/app/ui/style/style.cpp b/app/ui/style/style.cpp index a63845984..af255fa38 100644 --- a/app/ui/style/style.cpp +++ b/app/ui/style/style.cpp @@ -136,7 +136,7 @@ void StyleManager::Init() available_themes_.insert(QStringLiteral("olive-dark"), QStringLiteral("Olive Dark")); available_themes_.insert(QStringLiteral("olive-light"), QStringLiteral("Olive Light")); - QString config_style = Config::Current()["Style"].toString(); + QString config_style = OLIVE_CONFIG("Style").toString(); if (config_style.isEmpty() || !available_themes_.contains(config_style)) { SetStyle(kDefaultStyle); diff --git a/app/widget/colorwheel/colorvalueswidget.cpp b/app/widget/colorwheel/colorvalueswidget.cpp index d65cf6b33..cb0218395 100644 --- a/app/widget/colorwheel/colorvalueswidget.cpp +++ b/app/widget/colorwheel/colorvalueswidget.cpp @@ -233,7 +233,7 @@ ColorValuesTab::ColorValuesTab(bool with_legacy_option, QWidget *parent) : if (with_legacy_option) { legacy_box_ = new QCheckBox(tr("Use legacy (8-bit) values")); - legacy_box_->setChecked(Config::Current()[QStringLiteral("UseLegacyColorInInputTab")].toBool()); + legacy_box_->setChecked(OLIVE_CONFIG("UseLegacyColorInInputTab").toBool()); connect(legacy_box_, &QCheckBox::clicked, this, &ColorValuesTab::LegacyChanged); layout->addWidget(legacy_box_, row, 0, 1, 2); row++; @@ -356,7 +356,7 @@ void ColorValuesTab::SliderChanged() void ColorValuesTab::LegacyChanged(bool legacy) { - Config::Current()[QStringLiteral("UseLegacyColorInInputTab")] = legacy; + OLIVE_CONFIG("UseLegacyColorInInputTab") = legacy; double legacy_multiplier = legacy ? kLegacyMultiplier : 1.0/kLegacyMultiplier; int decimal_places = legacy ? 0 : 5; diff --git a/app/widget/handmovableview/handmovableview.cpp b/app/widget/handmovableview/handmovableview.cpp index 5e0daa151..87086dcdc 100644 --- a/app/widget/handmovableview/handmovableview.cpp +++ b/app/widget/handmovableview/handmovableview.cpp @@ -32,7 +32,7 @@ namespace olive { HandMovableView::HandMovableView(QWidget* parent) : super(parent), dragging_hand_(false), - scroll_zooms_by_default_(Config::Current()[QStringLiteral("ScrollZooms")].toBool()) + scroll_zooms_by_default_(OLIVE_CONFIG("ScrollZooms").toBool()) { connect(Core::instance(), &Core::ToolChanged, this, &HandMovableView::ApplicationToolChanged); } diff --git a/app/widget/scope/scopebase/scopebase.cpp b/app/widget/scope/scopebase/scopebase.cpp index 8e6074e74..94eb210cd 100644 --- a/app/widget/scope/scopebase/scopebase.cpp +++ b/app/widget/scope/scopebase/scopebase.cpp @@ -53,7 +53,7 @@ void ScopeBase::DrawScope(TexturePtr managed_tex, QVariant pipeline) job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex))); renderer()->Blit(pipeline, job, VideoParams(width(), height(), - static_cast(Config::Current()["OfflinePixelFormat"].toInt()), + static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()), VideoParams::kInternalChannelCount)); } diff --git a/app/widget/scope/waveform/waveform.cpp b/app/widget/scope/waveform/waveform.cpp index 1962be72f..7bd440751 100644 --- a/app/widget/scope/waveform/waveform.cpp +++ b/app/widget/scope/waveform/waveform.cpp @@ -73,7 +73,7 @@ void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline) NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex))); renderer()->Blit(pipeline, job, VideoParams(width(), height(), - static_cast(Config::Current()["OfflinePixelFormat"].toInt()), + static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()), VideoParams::kInternalChannelCount)); float waveform_dim_x = ceil((width() - 1.0) * waveform_scale); diff --git a/app/widget/slider/base/numericsliderbase.cpp b/app/widget/slider/base/numericsliderbase.cpp index 5dc4b7d6f..3e65d83ee 100644 --- a/app/widget/slider/base/numericsliderbase.cpp +++ b/app/widget/slider/base/numericsliderbase.cpp @@ -139,7 +139,7 @@ bool NumericSliderBase::IsDragging() const bool NumericSliderBase::UsingLadders() const { - return ladder_element_count_ > 0 && Config::Current()[QStringLiteral("UseSliderLadders")].toBool(); + return ladder_element_count_ > 0 && OLIVE_CONFIG("UseSliderLadders").toBool(); } QVariant NumericSliderBase::AdjustValue(const QVariant &value) const diff --git a/app/widget/slider/base/sliderladder.cpp b/app/widget/slider/base/sliderladder.cpp index b85ed4d95..c7a5ec7ad 100644 --- a/app/widget/slider/base/sliderladder.cpp +++ b/app/widget/slider/base/sliderladder.cpp @@ -48,7 +48,7 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString setFrameShape(QFrame::Box); setLineWidth(1); - if (!Config::Current()[QStringLiteral("UseSliderLadders")].toBool()) { + if (!OLIVE_CONFIG("UseSliderLadders").toBool()) { nb_outer_values = 0; } diff --git a/app/widget/timebased/timebasedwidget.cpp b/app/widget/timebased/timebasedwidget.cpp index 379dd8102..ae9ae8746 100644 --- a/app/widget/timebased/timebasedwidget.cpp +++ b/app/widget/timebased/timebasedwidget.cpp @@ -292,7 +292,7 @@ void TimeBasedWidget::SetTime(const rational &time) QMetaObject::invokeMethod(this, "CatchUpScrollToPlayhead", Qt::QueuedConnection); } else { // Otherwise, assume we jumped to this out of nowhere and must now autoscroll - switch (static_cast(Config::Current()["Autoscroll"].toInt())) { + switch (static_cast(OLIVE_CONFIG("Autoscroll").toInt())) { case AutoScroll::kNone: // Do nothing break; @@ -606,12 +606,12 @@ void TimeBasedWidget::SetMarker() color = closest->color(); } else { // Fallback to default color in preferences - color = Config::Current()[QStringLiteral("MarkerColor")].toInt(); + color = OLIVE_CONFIG("MarkerColor").toInt(); } TimelineMarker *marker = new TimelineMarker(color, TimeRange(GetTime(), GetTime())); - if (Config::Current()[QStringLiteral("SetNameWithMarker")].toBool()) { + if (OLIVE_CONFIG("SetNameWithMarker").toBool()) { MarkerPropertiesDialog mpd({marker}, timebase(), this); if (mpd.exec() != QDialog::Accepted) { delete marker; diff --git a/app/widget/timelinewidget/tool/import.cpp b/app/widget/timelinewidget/tool/import.cpp index fdcd49afc..ed81a6f8b 100644 --- a/app/widget/timelinewidget/tool/import.cpp +++ b/app/widget/timelinewidget/tool/import.cpp @@ -222,7 +222,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const DraggedFootageData if (footage_duration.isNull()) { // Fallback to still length if legngth was 0 - footage_duration = Config::Current()[QStringLiteral("DefaultStillLength")].value(); + footage_duration = OLIVE_CONFIG("DefaultStillLength").value(); } } @@ -285,7 +285,7 @@ void ImportTool::DropGhosts(bool insert) } else { // There's no active timeline here, ask the user what to do - DropWithoutSequenceBehavior behavior = static_cast(Config::Current()["DropWithoutSequenceBehavior"].toInt()); + DropWithoutSequenceBehavior behavior = static_cast(OLIVE_CONFIG("DropWithoutSequenceBehavior").toInt()); if (behavior == kDWSAsk) { QCheckBox* dont_ask_again_box = new QCheckBox(QCoreApplication::translate("ImportTool", "Don't ask me again")); @@ -312,7 +312,7 @@ void ImportTool::DropGhosts(bool insert) } if (behavior != kDWSDisable && dont_ask_again_box->isChecked()) { - Config::Current()["DropWithoutSequenceBehavior"] = behavior; + OLIVE_CONFIG("DropWithoutSequenceBehavior") = behavior; } } diff --git a/app/widget/timelinewidget/undo/timelineundogeneral.h b/app/widget/timelinewidget/undo/timelineundogeneral.h index 40396f549..7c3df0a72 100644 --- a/app/widget/timelinewidget/undo/timelineundogeneral.h +++ b/app/widget/timelinewidget/undo/timelineundogeneral.h @@ -107,7 +107,7 @@ private: class TimelineAddTrackCommand : public UndoCommand { public: TimelineAddTrackCommand(TrackList *timeline) : - TimelineAddTrackCommand(timeline, Config::Current()[QStringLiteral("AutoMergeTracks")].toBool()) + TimelineAddTrackCommand(timeline, OLIVE_CONFIG("AutoMergeTracks").toBool()) { } diff --git a/app/widget/timelinewidget/view/timelineview.cpp b/app/widget/timelinewidget/view/timelineview.cpp index 32f268c03..567d1d0f1 100644 --- a/app/widget/timelinewidget/view/timelineview.cpp +++ b/app/widget/timelinewidget/view/timelineview.cpp @@ -158,7 +158,7 @@ void TimelineView::wheelEvent(QWheelEvent *event) QPoint angle_delta = event->angleDelta(); - if (Config::Current()[QStringLiteral("InvertTimelineScrollAxes")].toBool() // Check if config is set to invert timeline axes + if (OLIVE_CONFIG("InvertTimelineScrollAxes").toBool() // Check if config is set to invert timeline axes && event->source() != Qt::MouseEventSynthesizedBySystem) { // Never flip axes on Apple trackpads though angle_delta = QPoint(angle_delta.y(), angle_delta.x()); } @@ -184,7 +184,7 @@ void TimelineView::wheelEvent(QWheelEvent *event) Qt::Orientation orientation = event->orientation(); - if (Config::Current()["InvertTimelineScrollAxes"].toBool()) { + if (OLIVE_CONFIG("InvertTimelineScrollAxes").toBool()) { orientation = (orientation == Qt::Horizontal) ? Qt::Vertical : Qt::Horizontal; } @@ -307,7 +307,7 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect) Block *attached = Node::ValueToPtr(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)); - if (attached && Config::Current()[QStringLiteral("ShowClipWhileDragging")].toBool()) { + if (attached && OLIVE_CONFIG("ShowClipWhileDragging").toBool()) { int adj_track = ghost->GetAdjustedTrack().index(); qreal track_top = GetTrackY(adj_track); qreal track_height = GetTrackHeight(adj_track); diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp index f8b25247a..80fe1a444 100644 --- a/app/widget/viewer/viewer.cpp +++ b/app/widget/viewer/viewer.cpp @@ -741,7 +741,7 @@ void ViewerWidget::PauseInternal() void ViewerWidget::PushScrubbedAudio() { - if (!IsPlaying() && GetConnectedNode() && Config::Current()[QStringLiteral("AudioScrubbing")].toBool()) { + if (!IsPlaying() && GetConnectedNode() && OLIVE_CONFIG("AudioScrubbing").toBool()) { // Get audio src device from renderer const AudioParams& params = GetConnectedNode()->audio_playback_cache()->GetParameters(); @@ -1129,9 +1129,9 @@ void ViewerWidget::ShowContextMenu(const QPoint &pos) { QAction *stop_playback_on_last_frame = menu.addAction(tr("Stop Playback On Last Frame")); stop_playback_on_last_frame->setCheckable(true); - stop_playback_on_last_frame->setChecked(Config::Current()[QStringLiteral("StopPlaybackOnLastFrame")].toBool()); + stop_playback_on_last_frame->setChecked(OLIVE_CONFIG("StopPlaybackOnLastFrame").toBool()); connect(stop_playback_on_last_frame, &QAction::triggered, this, [](bool e){ - Config::Current()[QStringLiteral("StopPlaybackOnLastFrame")] = e; + OLIVE_CONFIG("StopPlaybackOnLastFrame") = e; }); menu.addSeparator(); @@ -1180,7 +1180,7 @@ void ViewerWidget::Play(bool in_to_out_only) recording_filename_ = audio_path.filePath(QStringLiteral("%1.%2").arg( QDateTime::currentDateTime().toString("yyyy-MM-dd hh-mm-ss"), - ExportFormat::GetExtension(static_cast(Config::Current()[QStringLiteral("AudioRecordingFormat")].toInt()))) + ExportFormat::GetExtension(static_cast(OLIVE_CONFIG("AudioRecordingFormat").toInt()))) ); AudioParams ap(OLIVE_CONFIG("AudioRecordingSampleRate").toInt(), OLIVE_CONFIG("AudioRecordingChannelLayout").toULongLong(), static_cast(OLIVE_CONFIG("AudioRecordingSampleFormat").toInt())); @@ -1304,7 +1304,7 @@ void ViewerWidget::PlaybackTimerUpdate() // If we're stopping playback on the last frame rather than after it, subtract our max time // by one timebase unit - if (Config::Current()[QStringLiteral("StopPlaybackOnLastFrame")].toBool()) { + if (OLIVE_CONFIG("StopPlaybackOnLastFrame").toBool()) { max_time = qMax(min_time, max_time - timebase()); } @@ -1329,7 +1329,7 @@ void ViewerWidget::PlaybackTimerUpdate() // or restart playback end_of_line = true; - if (Config::Current()[QStringLiteral("Loop")].toBool() && !recording_) { + if (OLIVE_CONFIG("Loop").toBool() && !recording_) { // If we're looping, jump to the other side of the workarea and continue time_to_set = (tripped_time == min_time) ? max_time : min_time; diff --git a/app/widget/viewer/viewerdisplay.cpp b/app/widget/viewer/viewerdisplay.cpp index 4a41a4c43..7ba11417c 100644 --- a/app/widget/viewer/viewerdisplay.cpp +++ b/app/widget/viewer/viewerdisplay.cpp @@ -428,7 +428,7 @@ void ViewerDisplayWidget::OnPaint() // Draw texture through color transform int device_width = width() * devicePixelRatioF(); int device_height = height() * devicePixelRatioF(); - VideoParams::Format device_format = static_cast(Config::Current()["OfflinePixelFormat"].toInt()); + VideoParams::Format device_format = static_cast(OLIVE_CONFIG("OfflinePixelFormat").toInt()); VideoParams device_params(device_width, device_height, device_format, VideoParams::kInternalChannelCount); if (push_mode_ == kPushBlank) { @@ -486,7 +486,7 @@ void ViewerDisplayWidget::OnPaint() } renderer()->BlitColorManaged(color_service(), texture_to_draw, - Config::Current()[QStringLiteral("ReassocLinToNonLin")].toBool() ? Renderer::kAlphaAssociated : Renderer::kAlphaNone, + OLIVE_CONFIG("ReassocLinToNonLin").toBool() ? Renderer::kAlphaAssociated : Renderer::kAlphaNone, device_params, false, combined_matrix_flipped_, crop_matrix_); } diff --git a/app/window/mainwindow/mainmenu.cpp b/app/window/mainwindow/mainmenu.cpp index c4ba08d5e..dec12a79e 100644 --- a/app/window/mainwindow/mainmenu.cpp +++ b/app/window/mainwindow/mainmenu.cpp @@ -381,7 +381,7 @@ void MainMenu::ToolsMenuAboutToShow() void MainMenu::PlaybackMenuAboutToShow() { - playback_loop_item_->setChecked(Config::Current()["Loop"].toBool()); + playback_loop_item_->setChecked(OLIVE_CONFIG("Loop").toBool()); } void MainMenu::SequenceMenuAboutToShow() @@ -506,7 +506,7 @@ void MainMenu::PlayInToOutTriggered() void MainMenu::LoopTriggered(bool enabled) { - Config::Current()["Loop"] = enabled; + OLIVE_CONFIG("Loop") = enabled; } void MainMenu::NextFrameTriggered() diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 6e02ffc07..8e247a76c 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -473,7 +473,7 @@ void MainWindow::TimelinePanelSelectionChanged(const QVector &blocks) void MainWindow::ShowWelcomeDialog() { - if (Config::Current()[QStringLiteral("ShowWelcomeDialog")].toBool()) { + if (OLIVE_CONFIG("ShowWelcomeDialog").toBool()) { AboutDialog ad(true, this); ad.exec(); }