code: use config macro

Macro is much easier to use and more readable
This commit is contained in:
itsmattkc
2022-05-04 09:50:34 -07:00
parent 5f13a83009
commit 91b761693b
38 changed files with 105 additions and 106 deletions
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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;i<end;i++) {
sample_index = next_sample_index;
+1
View File
@@ -31,6 +31,7 @@
namespace olive {
#define OLIVE_CONFIG(x) Config::Current()[QStringLiteral(x)]
#define OLIVE_CONFIG_STR(x) Config::Current()[x]
class Config {
public:
+8 -8
View File
@@ -794,7 +794,7 @@ void Core::StartGUI(bool full_screen)
connect(this, &Core::ProjectClosed, main_window_, &MainWindow::ProjectClose);
// Start autorecovery timer using the config value as its interval
SetAutorecoveryInterval(Config::Current()["AutorecoveryInterval"].toInt());
SetAutorecoveryInterval(OLIVE_CONFIG("AutorecoveryInterval").toInt());
connect(&autorecovery_timer_, &QTimer::timeout, this, &Core::SaveAutorecovery);
autorecovery_timer_.start();
@@ -960,7 +960,7 @@ bool Core::RevertProjectInternal(Project *p, bool by_opening_existing)
void Core::SaveAutorecovery()
{
if (Config::Current()[QStringLiteral("AutorecoveryEnabled")].toBool()) {
if (OLIVE_CONFIG("AutorecoveryEnabled").toBool()) {
foreach (Project* p, open_projects_) {
if (!p->has_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<Timecode::Display>(Config::Current()["TimecodeDisplay"].toInt());
return static_cast<Timecode::Display>(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<Node *> &nodes, MultiUndoCommand *parent)
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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<VideoParams::Format>(Config::Current()[QStringLiteral("OnlinePixelFormat")].toInt()));
video_tab_->pixel_format_field()->SetPixelFormat(static_cast<VideoParams::Format>(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);
@@ -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; i<color_btns_.size(); i++) {
Config::Current()[QStringLiteral("CatColor%1").arg(i)] = color_btns_.at(i)->GetSelectedColor();
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();
}
}
@@ -108,10 +108,8 @@ void PreferencesBehaviorTab::Accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
QMap<QTreeWidgetItem*, QString>::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);
@@ -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<rational>().toDouble());
cache_ahead_slider_->SetValue(OLIVE_CONFIG("DiskCacheAhead").value<rational>().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<rational>().toDouble());
cache_behind_slider_->SetValue(OLIVE_CONFIG("DiskCacheBehind").value<rational>().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()));
}
}
@@ -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<rational>());
default_still_length_->SetValue(OLIVE_CONFIG("DefaultStillLength").value<rational>());
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());
}
+8 -8
View File
@@ -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());
}
}
@@ -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<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
const bool default_autocache = Config::Current()[QStringLiteral("DefaultSequenceAutoCache")].toBool();
const VideoParams::Format default_format = static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt());
const bool default_autocache = OLIVE_CONFIG("DefaultSequenceAutoCache").toBool();
QTreeWidgetItem* parent = CreateFolder(name);
AddStandardItem(parent, std::make_shared<SequencePreset>(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<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
const bool default_autocache = Config::Current()[QStringLiteral("DefaultSequenceAutoCache")].toBool();
const VideoParams::Format default_format = static_cast<VideoParams::Format>(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<SequencePreset>(tr("%1 Standard").arg(name),
+3 -3
View File
@@ -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();
+10 -10
View File
@@ -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<rational>(),
static_cast<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>(),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount,
Config::Current()["DefaultSequencePixelAspect"].value<rational>(),
Config::Current()["DefaultSequenceInterlacing"].value<VideoParams::Interlacing>(),
OLIVE_CONFIG("DefaultSequencePixelAspect").value<rational>(),
OLIVE_CONFIG("DefaultSequenceInterlacing").value<VideoParams::Interlacing>(),
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<ViewerOutput *> foo
SetVideoParams(VideoParams(s.width(),
s.height(),
using_timebase,
static_cast<VideoParams::Format>(Config::Current()[QStringLiteral("OfflinePixelFormat")].toInt()),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount,
s.pixel_aspect_ratio(),
s.interlacing(),
@@ -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();
@@ -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();
@@ -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();
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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();
}
+3 -3
View File
@@ -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<rational>(),
playhead + Config::Current()[QStringLiteral("DiskCacheAhead")].value<rational>());
cache_range_ = TimeRange(playhead - OLIVE_CONFIG("DiskCacheBehind").value<rational>(),
playhead + OLIVE_CONFIG("DiskCacheAhead").value<rational>());
RequeueFrames();
}
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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>();
rational default_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>();
video_stream.set_time_base(default_timebase);
video_stream.set_frame_rate(default_timebase.flipped());
+1 -1
View File
@@ -29,7 +29,7 @@
namespace olive {
TimelineMarker::TimelineMarker(QObject *parent) :
color_(Config::Current()[QStringLiteral("MarkerColor")].toInt())
color_(OLIVE_CONFIG("MarkerColor").toInt())
{
setParent(parent);
}
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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;
@@ -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);
}
+1 -1
View File
@@ -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<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount));
}
+1 -1
View File
@@ -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<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt()),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount));
float waveform_dim_x = ceil((width() - 1.0) * waveform_scale);
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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;
}
+3 -3
View File
@@ -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<AutoScroll::Method>(Config::Current()["Autoscroll"].toInt())) {
switch (static_cast<AutoScroll::Method>(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;
+3 -3
View File
@@ -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<rational>();
footage_duration = OLIVE_CONFIG("DefaultStillLength").value<rational>();
}
}
@@ -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<DropWithoutSequenceBehavior>(Config::Current()["DropWithoutSequenceBehavior"].toInt());
DropWithoutSequenceBehavior behavior = static_cast<DropWithoutSequenceBehavior>(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;
}
}
@@ -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())
{
}
@@ -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<Block>(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);
+6 -6
View File
@@ -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<ExportFormat::Format>(Config::Current()[QStringLiteral("AudioRecordingFormat")].toInt())))
ExportFormat::GetExtension(static_cast<ExportFormat::Format>(OLIVE_CONFIG("AudioRecordingFormat").toInt())))
);
AudioParams ap(OLIVE_CONFIG("AudioRecordingSampleRate").toInt(), OLIVE_CONFIG("AudioRecordingChannelLayout").toULongLong(), static_cast<AudioParams::Format>(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;
+2 -2
View File
@@ -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<VideoParams::Format>(Config::Current()["OfflinePixelFormat"].toInt());
VideoParams::Format device_format = static_cast<VideoParams::Format>(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_);
}
+2 -2
View File
@@ -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()
+1 -1
View File
@@ -473,7 +473,7 @@ void MainWindow::TimelinePanelSelectionChanged(const QVector<Block *> &blocks)
void MainWindow::ShowWelcomeDialog()
{
if (Config::Current()[QStringLiteral("ShowWelcomeDialog")].toBool()) {
if (OLIVE_CONFIG("ShowWelcomeDialog").toBool()) {
AboutDialog ad(true, this);
ad.exec();
}