various: enabled config saving
This commit is contained in:
+65
-55
@@ -42,6 +42,11 @@ Config::Config()
|
|||||||
SetDefaults();
|
SetDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Config::SetEntryInternal(const QString &key, NodeParam::DataType type, const QVariant &data)
|
||||||
|
{
|
||||||
|
config_map_[key] = {type, data};
|
||||||
|
}
|
||||||
|
|
||||||
QString Config::GetConfigFilePath()
|
QString Config::GetConfigFilePath()
|
||||||
{
|
{
|
||||||
return QDir(FileFunctions::GetConfigurationLocation()).filePath(QStringLiteral("config.xml"));
|
return QDir(FileFunctions::GetConfigurationLocation()).filePath(QStringLiteral("config.xml"));
|
||||||
@@ -55,63 +60,63 @@ Config &Config::Current()
|
|||||||
void Config::SetDefaults()
|
void Config::SetDefaults()
|
||||||
{
|
{
|
||||||
config_map_.clear();
|
config_map_.clear();
|
||||||
config_map_["TimecodeDisplay"] = Timecode::kTimecodeDropFrame;
|
SetEntryInternal(QStringLiteral("TimecodeDisplay"), NodeParam::kInt, Timecode::kTimecodeDropFrame);
|
||||||
config_map_["DefaultStillLength"] = QVariant::fromValue(rational(2));
|
SetEntryInternal(QStringLiteral("DefaultStillLength"), NodeParam::kRational, QVariant::fromValue(rational(2)));
|
||||||
config_map_["HoverFocus"] = false;
|
SetEntryInternal(QStringLiteral("HoverFocus"), NodeParam::kBoolean, false);
|
||||||
config_map_["AudioScrubbing"] = true;
|
SetEntryInternal(QStringLiteral("AudioScrubbing"), NodeParam::kBoolean, true);
|
||||||
config_map_["AutorecoveryInterval"] = 1;
|
SetEntryInternal(QStringLiteral("AutorecoveryInterval"), NodeParam::kInt, 1);
|
||||||
config_map_["Language"] = "en_US";
|
SetEntryInternal(QStringLiteral("Language"), NodeParam::kString, "en_US");
|
||||||
config_map_["ScrollZooms"] = false;
|
SetEntryInternal(QStringLiteral("ScrollZooms"), NodeParam::kBoolean, false);
|
||||||
config_map_["EnableSeekToImport"] = false;
|
SetEntryInternal(QStringLiteral("EnableSeekToImport"), NodeParam::kBoolean, false);
|
||||||
config_map_["EditToolAlsoSeeks"] = false;
|
SetEntryInternal(QStringLiteral("EditToolAlsoSeeks"), NodeParam::kBoolean, false);
|
||||||
config_map_["EditToolSelectsLinks"] = false;
|
SetEntryInternal(QStringLiteral("EditToolSelectsLinks"), NodeParam::kBoolean, false);
|
||||||
config_map_["EnableDragFilesToTimeline"] = true;
|
SetEntryInternal(QStringLiteral("EnableDragFilesToTimeline"), NodeParam::kBoolean, true);
|
||||||
config_map_["InvertTimelineScrollAxes"] = true;
|
SetEntryInternal(QStringLiteral("InvertTimelineScrollAxes"), NodeParam::kBoolean, true);
|
||||||
config_map_["SelectAlsoSeeks"] = false;
|
SetEntryInternal(QStringLiteral("SelectAlsoSeeks"), NodeParam::kBoolean, false);
|
||||||
config_map_["PasteSeeks"] = true;
|
SetEntryInternal(QStringLiteral("PasteSeeks"), NodeParam::kBoolean, true);
|
||||||
config_map_["SelectAlsoSeeks"] = false;
|
SetEntryInternal(QStringLiteral("SelectAlsoSeeks"), NodeParam::kBoolean, false);
|
||||||
config_map_["SetNameWithMarker"] = false;
|
SetEntryInternal(QStringLiteral("SetNameWithMarker"), NodeParam::kBoolean, false);
|
||||||
config_map_["AutoSeekToBeginning"] = true;
|
SetEntryInternal(QStringLiteral("AutoSeekToBeginning"), NodeParam::kBoolean, true);
|
||||||
config_map_["DropFileOnMediaToReplace"] = false;
|
SetEntryInternal(QStringLiteral("DropFileOnMediaToReplace"), NodeParam::kBoolean, false);
|
||||||
config_map_["AddDefaultEffectsToClips"] = true;
|
SetEntryInternal(QStringLiteral("AddDefaultEffectsToClips"), NodeParam::kBoolean, true);
|
||||||
config_map_["AutoscaleByDefault"] = false;
|
SetEntryInternal(QStringLiteral("AutoscaleByDefault"), NodeParam::kBoolean, false);
|
||||||
config_map_["Autoscroll"] = AutoScroll::kPage;
|
SetEntryInternal(QStringLiteral("Autoscroll"), NodeParam::kInt, AutoScroll::kPage);
|
||||||
config_map_["AutoSelectDivider"] = true;
|
SetEntryInternal(QStringLiteral("AutoSelectDivider"), NodeParam::kBoolean, true);
|
||||||
config_map_["SetNameWithMarker"] = false;
|
SetEntryInternal(QStringLiteral("SetNameWithMarker"), NodeParam::kBoolean, false);
|
||||||
config_map_["RectifiedWaveforms"] = false;
|
SetEntryInternal(QStringLiteral("RectifiedWaveforms"), NodeParam::kBoolean, false);
|
||||||
config_map_["DropWithoutSequenceBehavior"] = TimelineWidget::kDWSAsk;
|
SetEntryInternal(QStringLiteral("DropWithoutSequenceBehavior"), NodeParam::kInt, TimelineWidget::kDWSAsk);
|
||||||
config_map_["Loop"] = false;
|
SetEntryInternal(QStringLiteral("Loop"), NodeParam::kBoolean, false);
|
||||||
|
|
||||||
config_map_["AutoCacheInterval"] = 250;
|
SetEntryInternal(QStringLiteral("AutoCacheInterval"), NodeParam::kInt, 250);
|
||||||
|
|
||||||
config_map_["NodeCatColor0"] = QVariant::fromValue(Color(0.75f, 0.75f, 0.75f));
|
SetEntryInternal(QStringLiteral("NodeCatColor0"), NodeParam::kColor, QVariant::fromValue(Color(0.75f, 0.75f, 0.75f)));
|
||||||
config_map_["NodeCatColor1"] = QVariant::fromValue(Color(0.25f, 0.25f, 0.25f));
|
SetEntryInternal(QStringLiteral("NodeCatColor1"), NodeParam::kColor, QVariant::fromValue(Color(0.25f, 0.25f, 0.25f)));
|
||||||
config_map_["NodeCatColor2"] = QVariant::fromValue(Color(0.75f, 0.75f, 0.25f));
|
SetEntryInternal(QStringLiteral("NodeCatColor2"), NodeParam::kColor, QVariant::fromValue(Color(0.75f, 0.75f, 0.25f)));
|
||||||
config_map_["NodeCatColor3"] = QVariant::fromValue(Color(0.75f, 0.25f, 0.75f));
|
SetEntryInternal(QStringLiteral("NodeCatColor3"), NodeParam::kColor, QVariant::fromValue(Color(0.75f, 0.25f, 0.75f)));
|
||||||
config_map_["NodeCatColor4"] = QVariant::fromValue(Color(0.25f, 0.75f, 0.75f));
|
SetEntryInternal(QStringLiteral("NodeCatColor4"), NodeParam::kColor, QVariant::fromValue(Color(0.25f, 0.75f, 0.75f)));
|
||||||
config_map_["NodeCatColor5"] = QVariant::fromValue(Color(0.50f, 0.50f, 0.50f));
|
SetEntryInternal(QStringLiteral("NodeCatColor5"), NodeParam::kColor, QVariant::fromValue(Color(0.50f, 0.50f, 0.50f)));
|
||||||
config_map_["NodeCatColor6"] = QVariant::fromValue(Color(0.25f, 0.75f, 0.25f));
|
SetEntryInternal(QStringLiteral("NodeCatColor6"), NodeParam::kColor, QVariant::fromValue(Color(0.25f, 0.75f, 0.25f)));
|
||||||
config_map_["NodeCatColor7"] = QVariant::fromValue(Color(0.25f, 0.25f, 0.75f));
|
SetEntryInternal(QStringLiteral("NodeCatColor7"), NodeParam::kColor, QVariant::fromValue(Color(0.25f, 0.25f, 0.75f)));
|
||||||
config_map_["NodeCatColor8"] = QVariant::fromValue(Color(0.75f, 0.25f, 0.25f));
|
SetEntryInternal(QStringLiteral("NodeCatColor8"), NodeParam::kColor, QVariant::fromValue(Color(0.75f, 0.25f, 0.25f)));
|
||||||
|
|
||||||
config_map_["AudioOutput"] = QString();
|
SetEntryInternal(QStringLiteral("AudioOutput"), NodeParam::kString, QString());
|
||||||
config_map_["AudioInput"] = QString();
|
SetEntryInternal(QStringLiteral("AudioInput"), NodeParam::kString, QString());
|
||||||
|
|
||||||
config_map_["DiskCacheBehind"] = QVariant::fromValue(rational(1));
|
SetEntryInternal(QStringLiteral("DiskCacheBehind"), NodeParam::kRational, QVariant::fromValue(rational(1)));
|
||||||
config_map_["DiskCacheAhead"] = QVariant::fromValue(rational(5));
|
SetEntryInternal(QStringLiteral("DiskCacheAhead"), NodeParam::kRational, QVariant::fromValue(rational(5)));
|
||||||
|
|
||||||
config_map_["DefaultSequenceWidth"] = 1920;
|
SetEntryInternal(QStringLiteral("DefaultSequenceWidth"), NodeParam::kInt, 1920);
|
||||||
config_map_["DefaultSequenceHeight"] = 1080;
|
SetEntryInternal(QStringLiteral("DefaultSequenceHeight"), NodeParam::kInt, 1080);
|
||||||
config_map_["DefaultSequenceFrameRate"] = QVariant::fromValue(rational(1001, 30000));
|
SetEntryInternal(QStringLiteral("DefaultSequenceFrameRate"), NodeParam::kRational, QVariant::fromValue(rational(1001, 30000)));
|
||||||
config_map_["DefaultSequenceAudioFrequency"] = 48000;
|
SetEntryInternal(QStringLiteral("DefaultSequenceAudioFrequency"), NodeParam::kInt, 48000);
|
||||||
config_map_["DefaultSequenceAudioLayout"] = QVariant::fromValue(static_cast<uint64_t>(AV_CH_LAYOUT_STEREO));
|
SetEntryInternal(QStringLiteral("DefaultSequenceAudioLayout"), NodeParam::kInt, QVariant::fromValue(static_cast<int64_t>(AV_CH_LAYOUT_STEREO)));
|
||||||
config_map_["DefaultSequencePreviewFormat"] = PixelFormat::PIX_FMT_RGBA16F;
|
SetEntryInternal(QStringLiteral("DefaultSequencePreviewFormat"), NodeParam::kInt, PixelFormat::PIX_FMT_RGBA16F);
|
||||||
|
|
||||||
// Online/offline settings
|
// Online/offline settings
|
||||||
config_map_["OnlinePixelFormat"] = PixelFormat::PIX_FMT_RGBA32F;
|
SetEntryInternal(QStringLiteral("OnlinePixelFormat"), NodeParam::kInt, PixelFormat::PIX_FMT_RGBA32F);
|
||||||
config_map_["OfflinePixelFormat"] = PixelFormat::PIX_FMT_RGBA16F;
|
SetEntryInternal(QStringLiteral("OfflinePixelFormat"), NodeParam::kInt, PixelFormat::PIX_FMT_RGBA16F);
|
||||||
config_map_["OnlineOCIOMethod"] = ColorManager::kOCIOAccurate;
|
SetEntryInternal(QStringLiteral("OnlineOCIOMethod"), NodeParam::kInt, ColorManager::kOCIOAccurate);
|
||||||
config_map_["OfflineOCIOMethod"] = ColorManager::kOCIOFast;
|
SetEntryInternal(QStringLiteral("OfflineOCIOMethod"), NodeParam::kInt, ColorManager::kOCIOFast);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Load()
|
void Config::Load()
|
||||||
@@ -171,7 +176,7 @@ void Config::Load()
|
|||||||
|
|
||||||
current_config_[key] = QVariant::fromValue(match.flipped());
|
current_config_[key] = QVariant::fromValue(match.flipped());
|
||||||
} else {
|
} else {
|
||||||
current_config_[key] = value;
|
current_config_[key] = NodeInput::StringToValue(current_config_.GetConfigEntryType(key), value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,10 +221,10 @@ void Config::Save()
|
|||||||
// Anything after the hyphen is considered "unimportant" information
|
// Anything after the hyphen is considered "unimportant" information
|
||||||
writer.writeTextElement("Version", QCoreApplication::applicationVersion().split('-').first());
|
writer.writeTextElement("Version", QCoreApplication::applicationVersion().split('-').first());
|
||||||
|
|
||||||
QMapIterator<QString, QVariant> iterator(current_config_.config_map_);
|
QMapIterator<QString, ConfigEntry> iterator(current_config_.config_map_);
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
iterator.next();
|
iterator.next();
|
||||||
writer.writeTextElement(iterator.key(), iterator.value().toString());
|
writer.writeTextElement(iterator.key(), NodeInput::ValueToString(iterator.value().type, iterator.value().data, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.writeEndElement(); // Configuration
|
writer.writeEndElement(); // Configuration
|
||||||
@@ -231,12 +236,17 @@ void Config::Save()
|
|||||||
|
|
||||||
QVariant Config::operator[](const QString &key) const
|
QVariant Config::operator[](const QString &key) const
|
||||||
{
|
{
|
||||||
return config_map_[key];
|
return config_map_[key].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant &Config::operator[](const QString &key)
|
QVariant &Config::operator[](const QString &key)
|
||||||
{
|
{
|
||||||
return config_map_[key];
|
return config_map_[key].data;
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeParam::DataType Config::GetConfigEntryType(const QString &key) const
|
||||||
|
{
|
||||||
|
return config_map_[key].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
OLIVE_NAMESPACE_EXIT
|
OLIVE_NAMESPACE_EXIT
|
||||||
|
|||||||
+11
-1
@@ -26,6 +26,7 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include "common/timecodefunctions.h"
|
#include "common/timecodefunctions.h"
|
||||||
|
#include "node/param.h"
|
||||||
|
|
||||||
OLIVE_NAMESPACE_ENTER
|
OLIVE_NAMESPACE_ENTER
|
||||||
|
|
||||||
@@ -43,10 +44,19 @@ public:
|
|||||||
|
|
||||||
QVariant& operator[](const QString&);
|
QVariant& operator[](const QString&);
|
||||||
|
|
||||||
|
NodeParam::DataType GetConfigEntryType(const QString& key) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Config();
|
Config();
|
||||||
|
|
||||||
QMap<QString, QVariant> config_map_;
|
struct ConfigEntry {
|
||||||
|
NodeParam::DataType type;
|
||||||
|
QVariant data;
|
||||||
|
};
|
||||||
|
|
||||||
|
void SetEntryInternal(const QString& key, NodeParam::DataType type, const QVariant& data);
|
||||||
|
|
||||||
|
QMap<QString, ConfigEntry> config_map_;
|
||||||
|
|
||||||
static Config current_config_;
|
static Config current_config_;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -205,7 +205,7 @@ void Core::Start()
|
|||||||
void Core::Stop()
|
void Core::Stop()
|
||||||
{
|
{
|
||||||
// Save Config
|
// Save Config
|
||||||
//Config::Save();
|
Config::Save();
|
||||||
|
|
||||||
// Save recently opened projects
|
// Save recently opened projects
|
||||||
{
|
{
|
||||||
|
|||||||
+55
-17
@@ -327,17 +327,46 @@ void NodeInput::SetDefaultValue(const QVector<QVariant> &default_value)
|
|||||||
|
|
||||||
QString NodeInput::ValueToString(const QVariant &value) const
|
QString NodeInput::ValueToString(const QVariant &value) const
|
||||||
{
|
{
|
||||||
return ValueToString(data_type_, value);
|
return ValueToString(data_type_, value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NodeInput::ValueToString(const DataType& data_type, const QVariant &value)
|
QString NodeInput::ValueToString(const DataType& data_type, const QVariant &value, bool value_is_a_key_track)
|
||||||
{
|
{
|
||||||
switch (data_type) {
|
if (!value_is_a_key_track && data_type == kVec2) {
|
||||||
case kRational:
|
QVector2D vec = value.value<QVector2D>();
|
||||||
|
|
||||||
|
return QStringLiteral("%1:%2").arg(QString::number(vec.x()),
|
||||||
|
QString::number(vec.y()));
|
||||||
|
} else if (!value_is_a_key_track && data_type == kVec3) {
|
||||||
|
QVector3D vec = value.value<QVector3D>();
|
||||||
|
|
||||||
|
return QStringLiteral("%1:%2:%3").arg(QString::number(vec.x()),
|
||||||
|
QString::number(vec.y()),
|
||||||
|
QString::number(vec.z()));
|
||||||
|
} else if (!value_is_a_key_track && data_type == kVec4) {
|
||||||
|
QVector4D vec = value.value<QVector4D>();
|
||||||
|
|
||||||
|
return QStringLiteral("%1:%2:%3:%4").arg(QString::number(vec.x()),
|
||||||
|
QString::number(vec.y()),
|
||||||
|
QString::number(vec.z()),
|
||||||
|
QString::number(vec.w()));
|
||||||
|
} else if (!value_is_a_key_track && data_type == kColor) {
|
||||||
|
Color c = value.value<Color>();
|
||||||
|
|
||||||
|
return QStringLiteral("%1:%2:%3:%4").arg(QString::number(c.red()),
|
||||||
|
QString::number(c.green()),
|
||||||
|
QString::number(c.blue()),
|
||||||
|
QString::number(c.alpha()));
|
||||||
|
} else if (data_type == kRational) {
|
||||||
return value.value<rational>().toString();
|
return value.value<rational>().toString();
|
||||||
case kFootage:
|
} else if (data_type == kFootage) {
|
||||||
return QString::number(reinterpret_cast<quintptr>(value.value<StreamPtr>().get()));
|
return QString::number(reinterpret_cast<quintptr>(value.value<StreamPtr>().get()));
|
||||||
default:
|
} else if (data_type == kTexture
|
||||||
|
|| data_type == kSamples
|
||||||
|
|| data_type == kBuffer) {
|
||||||
|
// These data types need no XML representation
|
||||||
|
return QString();
|
||||||
|
} else {
|
||||||
if (value.canConvert<QString>()) {
|
if (value.canConvert<QString>()) {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
@@ -346,22 +375,31 @@ QString NodeInput::ValueToString(const DataType& data_type, const QVariant &valu
|
|||||||
qWarning() << "Failed to convert type" << ToHex(data_type) << "to string";
|
qWarning() << "Failed to convert type" << ToHex(data_type) << "to string";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fall through */
|
|
||||||
|
|
||||||
// These data types need no XML representation
|
|
||||||
case kTexture:
|
|
||||||
case kSamples:
|
|
||||||
case kBuffer:
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant NodeInput::StringToValue(const DataType& data_type, const QString &string)
|
QVariant NodeInput::StringToValue(const DataType& data_type, const QString &string, bool value_is_a_key_track)
|
||||||
{
|
{
|
||||||
switch (data_type) {
|
if (!value_is_a_key_track && data_type == kVec2) {
|
||||||
case kRational:
|
QStringList vals = string.split(':');
|
||||||
|
|
||||||
|
return QVector2D(vals.at(0).toFloat(), vals.at(1).toFloat());
|
||||||
|
} else if (!value_is_a_key_track && data_type == kVec3) {
|
||||||
|
QStringList vals = string.split(':');
|
||||||
|
|
||||||
|
return QVector3D(vals.at(0).toFloat(), vals.at(1).toFloat(), vals.at(2).toFloat());
|
||||||
|
} else if (!value_is_a_key_track && data_type == kVec4) {
|
||||||
|
QStringList vals = string.split(':');
|
||||||
|
|
||||||
|
return QVector4D(vals.at(0).toFloat(), vals.at(1).toFloat(), vals.at(2).toFloat(), vals.at(3).toFloat());
|
||||||
|
} else if (!value_is_a_key_track && data_type == kColor) {
|
||||||
|
QStringList vals = string.split(':');
|
||||||
|
|
||||||
|
return QVariant::fromValue(Color(vals.at(0).toFloat(), vals.at(1).toFloat(), vals.at(2).toFloat(), vals.at(3).toFloat()));
|
||||||
|
} else if (data_type == kRational) {
|
||||||
return QVariant::fromValue(rational::fromString(string));
|
return QVariant::fromValue(rational::fromString(string));
|
||||||
default:
|
} else {
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,7 +467,7 @@ QVariant NodeInput::StringToValue(const QString &string, QList<XMLNodeData::Foot
|
|||||||
footage_connections.append({this, string.toULongLong()});
|
footage_connections.append({this, string.toULongLong()});
|
||||||
}
|
}
|
||||||
|
|
||||||
return StringToValue(data_type_, string);
|
return StringToValue(data_type_, string, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeOutput *NodeInput::get_connected_output() const
|
NodeOutput *NodeInput::get_connected_output() const
|
||||||
|
|||||||
+2
-2
@@ -278,9 +278,9 @@ public:
|
|||||||
|
|
||||||
void set_combobox_strings(const QStringList& strings);
|
void set_combobox_strings(const QStringList& strings);
|
||||||
|
|
||||||
static QString ValueToString(const DataType& data_type, const QVariant& value);
|
static QString ValueToString(const DataType& data_type, const QVariant& value, bool value_is_a_key_track);
|
||||||
|
|
||||||
static QVariant StringToValue(const DataType &data_type, const QString &string);
|
static QVariant StringToValue(const DataType &data_type, const QString &string, bool value_is_a_key_track);
|
||||||
|
|
||||||
void GetDependencies(QList<Node*>& list, bool traverse, bool exclusive_only) const;
|
void GetDependencies(QList<Node*>& list, bool traverse, bool exclusive_only) const;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -240,8 +240,8 @@ QString NodeParam::GetPrettyDataTypeName(const NodeParam::DataType &type)
|
|||||||
QByteArray NodeParam::ValueToBytes(const NodeParam::DataType &type, const QVariant &value)
|
QByteArray NodeParam::ValueToBytes(const NodeParam::DataType &type, const QVariant &value)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kInt: return ValueToBytesInternal<int>(value);
|
case kInt: return ValueToBytesInternal<int64_t>(value);
|
||||||
case kFloat: return ValueToBytesInternal<float>(value);
|
case kFloat: return ValueToBytesInternal<double>(value);
|
||||||
case kColor: return ValueToBytesInternal<Color>(value);
|
case kColor: return ValueToBytesInternal<Color>(value);
|
||||||
case kText: return value.toString().toUtf8();
|
case kText: return value.toString().toUtf8();
|
||||||
case kBoolean: return ValueToBytesInternal<bool>(value);
|
case kBoolean: return ValueToBytesInternal<bool>(value);
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Integer type
|
* Integer type
|
||||||
*
|
*
|
||||||
* Resolves to `int` (may resolve to `long` in the future).
|
* Resolves to int64_t.
|
||||||
*/
|
*/
|
||||||
kInt = 0x1,
|
kInt = 0x1,
|
||||||
|
|
||||||
|
|||||||
@@ -238,11 +238,11 @@ QList<TimeRange> AudioPlaybackCache::GetValidRanges(const TimeRange& range, cons
|
|||||||
|
|
||||||
void AudioPlaybackCache::UpdateFilename(const QString &s)
|
void AudioPlaybackCache::UpdateFilename(const QString &s)
|
||||||
{
|
{
|
||||||
filename_ = QDir(GetCacheFilename()).filePath(s);
|
filename_ = QDir(GetCacheDirectory()).filePath(s);
|
||||||
filename_.append(QStringLiteral(".pcm"));
|
filename_.append(QStringLiteral(".pcm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &AudioPlaybackCache::GetCacheFilename() const
|
const QString &AudioPlaybackCache::GetPCMFilename() const
|
||||||
{
|
{
|
||||||
return filename_;
|
return filename_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
//void SetUuid(const QUuid& id);
|
//void SetUuid(const QUuid& id);
|
||||||
|
|
||||||
const QString& GetCacheFilename() const;
|
const QString& GetPCMFilename() const;
|
||||||
|
|
||||||
QList<TimeRange> GetValidRanges(const TimeRange &range, const qint64 &job_time);
|
QList<TimeRange> GetValidRanges(const TimeRange &range, const qint64 &job_time);
|
||||||
|
|
||||||
|
|||||||
@@ -297,9 +297,12 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
|
|||||||
|
|
||||||
switch (data_type) {
|
switch (data_type) {
|
||||||
case NodeInput::kInt:
|
case NodeInput::kInt:
|
||||||
|
// kInt technically specifies a LongLong, but OpenGL doesn't support those. This may lead to
|
||||||
|
// over/underflows if the number is large enough, but the likelihood of that is quite low.
|
||||||
shader->setUniformValue(variable_location, value.toInt());
|
shader->setUniformValue(variable_location, value.toInt());
|
||||||
break;
|
break;
|
||||||
case NodeInput::kFloat:
|
case NodeInput::kFloat:
|
||||||
|
// kFloat technically specifies a double but as above, OpenGL doesn't support those.
|
||||||
shader->setUniformValue(variable_location, value.toFloat());
|
shader->setUniformValue(variable_location, value.toFloat());
|
||||||
break;
|
break;
|
||||||
case NodeInput::kVec2:
|
case NodeInput::kVec2:
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ bool ExportTask::Run()
|
|||||||
|
|
||||||
if (params_.audio_enabled()) {
|
if (params_.audio_enabled()) {
|
||||||
// Write audio data now
|
// Write audio data now
|
||||||
encoder_->WriteAudio(audio_params(), audio_data_.GetCacheFilename());
|
encoder_->WriteAudio(audio_params(), audio_data_.GetPCMFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder_->Close();
|
encoder_->Close();
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ void NodeTableView::SetTime(const rational &time)
|
|||||||
{
|
{
|
||||||
QVector<QVariant> split_values = input->split_normal_value_into_track_values(value.data());
|
QVector<QVariant> split_values = input->split_normal_value_into_track_values(value.data());
|
||||||
for (int k=0;k<split_values.size();k++) {
|
for (int k=0;k<split_values.size();k++) {
|
||||||
sub_item->setText(2 + k, NodeInput::ValueToString(value.type(), split_values.at(k)));
|
sub_item->setText(2 + k, NodeInput::ValueToString(value.type(), split_values.at(k), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void AudioWaveformView::paintEvent(QPaintEvent *event)
|
|||||||
const AudioParams& params = playback_->GetParameters();
|
const AudioParams& params = playback_->GetParameters();
|
||||||
|
|
||||||
if (!playback_
|
if (!playback_
|
||||||
|| playback_->GetCacheFilename().isEmpty()
|
|| playback_->GetPCMFilename().isEmpty()
|
||||||
|| !params.is_valid()) {
|
|| !params.is_valid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ void AudioWaveformView::paintEvent(QPaintEvent *event)
|
|||||||
cached_waveform_ = QPixmap(size());
|
cached_waveform_ = QPixmap(size());
|
||||||
cached_waveform_.fill(Qt::transparent);
|
cached_waveform_.fill(Qt::transparent);
|
||||||
|
|
||||||
QFile fs(playback_->GetCacheFilename());
|
QFile fs(playback_->GetPCMFilename());
|
||||||
|
|
||||||
if (fs.open(QFile::ReadOnly)) {
|
if (fs.open(QFile::ReadOnly)) {
|
||||||
|
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ void ViewerWidget::PushScrubbedAudio()
|
|||||||
{
|
{
|
||||||
if (!IsPlaying() && Config::Current()["AudioScrubbing"].toBool()) {
|
if (!IsPlaying() && Config::Current()["AudioScrubbing"].toBool()) {
|
||||||
// Get audio src device from renderer
|
// Get audio src device from renderer
|
||||||
QString audio_fn = GetConnectedNode()->audio_playback_cache()->GetCacheFilename();
|
QString audio_fn = GetConnectedNode()->audio_playback_cache()->GetPCMFilename();
|
||||||
QFile audio_src(audio_fn);
|
QFile audio_src(audio_fn);
|
||||||
|
|
||||||
if (audio_src.open(QFile::ReadOnly)) {
|
if (audio_src.open(QFile::ReadOnly)) {
|
||||||
@@ -616,7 +616,7 @@ void ViewerWidget::FinishPlayPreprocess()
|
|||||||
{
|
{
|
||||||
int64_t playback_start_time = ruler()->GetTime();
|
int64_t playback_start_time = ruler()->GetTime();
|
||||||
|
|
||||||
QString audio_fn = GetConnectedNode()->audio_playback_cache()->GetCacheFilename();
|
QString audio_fn = GetConnectedNode()->audio_playback_cache()->GetPCMFilename();
|
||||||
if (!audio_fn.isEmpty()) {
|
if (!audio_fn.isEmpty()) {
|
||||||
AudioManager::instance()->SetOutputParams(GetConnectedNode()->audio_playback_cache()->GetParameters());
|
AudioManager::instance()->SetOutputParams(GetConnectedNode()->audio_playback_cache()->GetParameters());
|
||||||
AudioManager::instance()->StartOutput(audio_fn,
|
AudioManager::instance()->StartOutput(audio_fn,
|
||||||
|
|||||||
Reference in New Issue
Block a user