Add default marker color to config

This commit is contained in:
Thomas Wilshaw
2021-10-22 22:15:53 +01:00
parent 59c8c45018
commit 374b97b6a5
5 changed files with 26 additions and 3 deletions
+2
View File
@@ -134,6 +134,8 @@ void Config::SetDefaults()
// Online/offline settings
SetEntryInternal(QStringLiteral("OnlinePixelFormat"), NodeValue::kInt, VideoParams::kFormatFloat32);
SetEntryInternal(QStringLiteral("OfflinePixelFormat"), NodeValue::kInt, VideoParams::kFormatFloat16);
SetEntryInternal(QStringLiteral("MarkerColor"), NodeValue::kInt, ColorCoding::kRed);
}
void Config::Load()
@@ -82,6 +82,22 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
appearance_layout->addWidget(color_group, row, 0, 1, 2);
}
row++;
{
QGroupBox* marker_group = new QGroupBox();
marker_group->setTitle(tr("Default Marker Color"));
QGridLayout* marker_layout = new QGridLayout(marker_group);
marker_layout->addWidget(new QLabel("Marker"), 0, 0);
marker_btn_ = new ColorCodingComboBox();
marker_btn_->SetColor(Config::Current()[QStringLiteral("MarkerColor")].toInt());
marker_layout->addWidget(marker_btn_, 0, 1);
appearance_layout->addWidget(marker_group, row, 0, 1, 2);
}
layout->addStretch();
}
@@ -99,6 +115,8 @@ void PreferencesAppearanceTab::Accept(MultiUndoCommand *command)
for (int i=0; i<color_btns_.size(); i++) {
Config::Current()[QStringLiteral("CatColor%1").arg(i)] = color_btns_.at(i)->GetSelectedColor();
}
Config::Current()[QStringLiteral("MarkerColor")] = marker_btn_->GetSelectedColor();
}
}
@@ -47,6 +47,8 @@ private:
QVector<ColorCodingComboBox*> color_btns_;
ColorCodingComboBox* marker_btn_;
};
}
+3 -2
View File
@@ -21,15 +21,16 @@
#include "timelinemarker.h"
#include "common/xmlutils.h"
#include "config/config.h"
namespace olive {
TimelineMarker::TimelineMarker(const TimeRange &time, const QString &name, QObject *parent) :
QObject(parent),
time_(time),
name_(name),
color_(7) // FIXME: set via config
name_(name)
{
color_ = Config::Current()[QStringLiteral("MarkerColor")].toInt();
}
const TimeRange &TimelineMarker::time() const
+1 -1
View File
@@ -23,6 +23,7 @@
#include <QPainter>
#include "common/qtutils.h"
#include "config/config.h"
#include "ui/colorcoding.h"
#include "widget/menu/menu.h"
#include "widget/menu/menushared.h"
@@ -33,7 +34,6 @@ namespace olive {
Marker::Marker(QWidget *parent) :
QWidget(parent),
marker_color_(7), //green FIXME: add default color to config
active_(false)
{
//setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);