Improvments to gstreamer backend and settings +++
- Fixed bug not setting environment for gstreamer before initialization - Fixed windows directsound device - Fixed crash on failure to create gstreamer element - Fixed crash when switching backend - Don't stop playback if equalizer or replay gain fails in gstreamer - Improvments to backend settings - Fixed backend settings to work for windows - Fixed replay gain settings not working - Fixed right click menu for album showing in statusview even when no song was playing - Removed redundant code
This commit is contained in:
parent
6bbc1271e4
commit
43bf7e3ca8
1
TODO
1
TODO
@ -3,4 +3,3 @@ Strawberry Music Player
|
|||||||
TODO
|
TODO
|
||||||
|
|
||||||
- Finalize / Improve status/context
|
- Finalize / Improve status/context
|
||||||
- Fix crash when switching backend while playing
|
|
||||||
|
@ -28,11 +28,6 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/pbutils/pbutils.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif // Q_OS_UNIX
|
#endif // Q_OS_UNIX
|
||||||
@ -89,10 +84,6 @@
|
|||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "core/systemtrayicon.h"
|
#include "core/systemtrayicon.h"
|
||||||
#include "core/scangiomodulepath.h"
|
#include "core/scangiomodulepath.h"
|
||||||
#include "engine/enginebase.h"
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
#include "engine/gstengine.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "widgets/osd.h"
|
#include "widgets/osd.h"
|
||||||
|
|
||||||
@ -116,12 +107,6 @@ int main(int argc, char* argv[]) {
|
|||||||
// Do Mac specific startup to get media keys working.
|
// Do Mac specific startup to get media keys working.
|
||||||
// This must go before QApplication initialisation.
|
// This must go before QApplication initialisation.
|
||||||
mac::MacMain();
|
mac::MacMain();
|
||||||
|
|
||||||
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) {
|
|
||||||
// Work around 10.9 issue.
|
|
||||||
// https://bugreports.qt-project.org/browse/QTBUG-32789
|
|
||||||
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
||||||
@ -241,11 +226,6 @@ int main(int argc, char* argv[]) {
|
|||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
mpris::Mpris mpris(&app);
|
mpris::Mpris mpris(&app);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
gst_init(nullptr, nullptr);
|
|
||||||
gst_pb_utils_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
MainWindow w(&app, tray_icon.get(), &osd, options);
|
MainWindow w(&app, tray_icon.get(), &osd, options);
|
||||||
|
@ -60,7 +60,6 @@ void RegisterMetaTypes() {
|
|||||||
qRegisterMetaType<Engine::State>("Engine::State");
|
qRegisterMetaType<Engine::State>("Engine::State");
|
||||||
qRegisterMetaType<Engine::TrackChangeFlags>("Engine::TrackChangeFlags");
|
qRegisterMetaType<Engine::TrackChangeFlags>("Engine::TrackChangeFlags");
|
||||||
qRegisterMetaType<Equalizer::Params>("Equalizer::Params");
|
qRegisterMetaType<Equalizer::Params>("Equalizer::Params");
|
||||||
qRegisterMetaType<EngineBase::PluginDetails>("EngineBase::PluginDetails");
|
|
||||||
qRegisterMetaType<EngineBase::OutputDetails>("EngineBase::OutputDetails");
|
qRegisterMetaType<EngineBase::OutputDetails>("EngineBase::OutputDetails");
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
qRegisterMetaType<GstBuffer*>("GstBuffer*");
|
qRegisterMetaType<GstBuffer*>("GstBuffer*");
|
||||||
|
@ -77,7 +77,7 @@ bool AmazonCoverProvider::StartSearch(const QString &artist, const QString &albu
|
|||||||
|
|
||||||
// Sign the request
|
// Sign the request
|
||||||
|
|
||||||
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toLatin1();
|
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toUtf8();
|
||||||
//const QByteArray signature(Utilities::HmacSha256(kSecretAccessKey, data_to_sign));
|
//const QByteArray signature(Utilities::HmacSha256(kSecretAccessKey, data_to_sign));
|
||||||
const QByteArray signature(Utilities::HmacSha256(QByteArray::fromBase64(kSecretAccessKeyB64), data_to_sign));
|
const QByteArray signature(Utilities::HmacSha256(QByteArray::fromBase64(kSecretAccessKeyB64), data_to_sign));
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void DiscogsCoverProvider::SendSearchRequest(DiscogsCoverSearchContext *s_ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sign the request
|
// Sign the request
|
||||||
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toLatin1();
|
const QByteArray data_to_sign = QString("GET\n%1\n%2\n%3").arg(url.host(), url.path(), query_items.join("&")).toUtf8();
|
||||||
const QByteArray signature(Utilities::HmacSha256(QByteArray::fromBase64(kSecretKeyB64), data_to_sign));
|
const QByteArray signature(Utilities::HmacSha256(QByteArray::fromBase64(kSecretKeyB64), data_to_sign));
|
||||||
|
|
||||||
// Add the signature to the request
|
// Add the signature to the request
|
||||||
|
@ -97,12 +97,9 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
|||||||
snd_pcm_info_get_name(pcminfo);
|
snd_pcm_info_get_name(pcminfo);
|
||||||
|
|
||||||
Device device;
|
Device device;
|
||||||
device.card = card;
|
|
||||||
device.device = dev;
|
|
||||||
device.description = QString("%1 %2").arg(snd_ctl_card_info_get_name(cardinfo)).arg(snd_pcm_info_get_name(pcminfo));
|
device.description = QString("%1 %2").arg(snd_ctl_card_info_get_name(cardinfo)).arg(snd_pcm_info_get_name(pcminfo));
|
||||||
device.string = QString("hw:%1,%2").arg(card).arg(dev);
|
device.value = QString("hw:%1,%2").arg(card).arg(dev);
|
||||||
device.device_property_value = QString("hw:%1,%2").arg(card).arg(dev);
|
device.iconname = GuessIconName(device.description);
|
||||||
device.iconname = GuessIconName("", device.description);
|
|
||||||
ret.append(device);
|
ret.append(device);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,10 @@
|
|||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
DeviceFinder::DeviceFinder(const QString &output): output_(output) {
|
DeviceFinder::DeviceFinder(const QString &name): name_(name) {
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__ << output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeviceFinder::GuessIconName(const QString &name, const QString &description) {
|
QString DeviceFinder::GuessIconName(const QString &description) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__ << name << description;
|
|
||||||
|
|
||||||
QString description_lower = description.toLower();
|
QString description_lower = description.toLower();
|
||||||
|
|
||||||
|
@ -31,18 +31,15 @@ class DeviceFinder {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct Device {
|
struct Device {
|
||||||
int card;
|
|
||||||
int device;
|
|
||||||
QVariant device_property_value;
|
|
||||||
QString string;
|
|
||||||
QString description;
|
QString description;
|
||||||
|
QVariant value;
|
||||||
QString iconname;
|
QString iconname;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~DeviceFinder() {}
|
virtual ~DeviceFinder() {}
|
||||||
|
|
||||||
// The name of the gstreamer sink element that devices found by this class can be used with.
|
// The name of the gstreamer sink element that devices found by this class can be used with.
|
||||||
QString output() const { return output_; }
|
QString name() const { return name_; }
|
||||||
|
|
||||||
// Does any necessary setup, returning false if this DeviceFinder cannot be used.
|
// Does any necessary setup, returning false if this DeviceFinder cannot be used.
|
||||||
virtual bool Initialise() = 0;
|
virtual bool Initialise() = 0;
|
||||||
@ -51,12 +48,12 @@ class DeviceFinder {
|
|||||||
virtual QList<Device> ListDevices() = 0;
|
virtual QList<Device> ListDevices() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit DeviceFinder(const QString &output);
|
explicit DeviceFinder(const QString &name);
|
||||||
|
|
||||||
static QString GuessIconName(const QString &, const QString &);
|
static QString GuessIconName(const QString &description);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString output_;
|
QString name_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,15 +44,13 @@ BOOL DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, LPCSTR description,
|
|||||||
|
|
||||||
State *state = reinterpret_cast<State*>(state_voidptr);
|
State *state = reinterpret_cast<State*>(state_voidptr);
|
||||||
|
|
||||||
if (guid) {
|
Device dev;
|
||||||
Device dev;
|
dev.description = QString::fromUtf8(description);
|
||||||
dev.description = QString::fromUtf8(description);
|
if (guid) dev.value = QUuid(*guid).toByteArray();
|
||||||
dev.device_property_value = QUuid(*guid).toByteArray();
|
else dev.value = QVariant();
|
||||||
dev.iconname = GuessIconName(dev.string, dev.description);
|
dev.iconname = GuessIconName(dev.description);
|
||||||
state->devices.append(dev);
|
state->devices.append(dev);
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,19 +90,11 @@ class Base : public QObject {
|
|||||||
bool crossfade_same_album() const { return crossfade_same_album_; }
|
bool crossfade_same_album() const { return crossfade_same_album_; }
|
||||||
|
|
||||||
static const int kScopeSize = 1024;
|
static const int kScopeSize = 1024;
|
||||||
|
|
||||||
struct PluginDetails {
|
|
||||||
QString name;
|
|
||||||
QString description;
|
|
||||||
QString iconname;
|
|
||||||
};
|
|
||||||
typedef QList<PluginDetails> PluginDetailsList;
|
|
||||||
|
|
||||||
struct OutputDetails {
|
struct OutputDetails {
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QString iconname;
|
QString iconname;
|
||||||
QVariant device_property_value;
|
|
||||||
};
|
};
|
||||||
typedef QList<OutputDetails> OutputDetailsList;
|
typedef QList<OutputDetails> OutputDetailsList;
|
||||||
|
|
||||||
@ -159,6 +151,13 @@ signals:
|
|||||||
int next_background_stream_id_;
|
int next_background_stream_id_;
|
||||||
bool fadeout_pause_enabled_;
|
bool fadeout_pause_enabled_;
|
||||||
qint64 fadeout_pause_duration_nanosec_;
|
qint64 fadeout_pause_duration_nanosec_;
|
||||||
|
|
||||||
|
struct PluginDetails {
|
||||||
|
QString name;
|
||||||
|
QString description;
|
||||||
|
QString iconname;
|
||||||
|
};
|
||||||
|
typedef QList<PluginDetails> PluginDetailsList;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool about_to_end_emitted_;
|
bool about_to_end_emitted_;
|
||||||
|
@ -81,7 +81,7 @@ void EngineDevice::Init() {
|
|||||||
|
|
||||||
for (DeviceFinder *finder : device_finders) {
|
for (DeviceFinder *finder : device_finders) {
|
||||||
if (!finder->Initialise()) {
|
if (!finder->Initialise()) {
|
||||||
qLog(Warning) << "Failed to initialise DeviceFinder for" << finder->output();
|
qLog(Warning) << "Failed to initialise DeviceFinder for" << finder->name();
|
||||||
delete finder;
|
delete finder;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,6 @@ class EngineDevice : public QObject {
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
QList<DeviceFinder*> device_finders_;
|
QList<DeviceFinder*> device_finders_;
|
||||||
|
|
||||||
protected:
|
|
||||||
//static QString GuessIconName(const QString &, const QString &);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString output_;
|
QString output_;
|
||||||
|
@ -149,10 +149,8 @@ bool GstEngine::Init() {
|
|||||||
|
|
||||||
void GstEngine::InitialiseGStreamer() {
|
void GstEngine::InitialiseGStreamer() {
|
||||||
|
|
||||||
#if 0
|
|
||||||
gst_init(nullptr, nullptr);
|
gst_init(nullptr, nullptr);
|
||||||
gst_pb_utils_init();
|
gst_pb_utils_init();
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +433,7 @@ bool GstEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool forc
|
|||||||
|
|
||||||
SetVolume(volume_);
|
SetVolume(volume_);
|
||||||
SetEqualizerEnabled(equalizer_enabled_);
|
SetEqualizerEnabled(equalizer_enabled_);
|
||||||
SetEqualizerParameters(equalizer_preamp_, equalizer_gains_);
|
if (equalizer_preamp_) SetEqualizerParameters(equalizer_preamp_, equalizer_gains_);
|
||||||
SetStereoBalance(stereo_balance_);
|
SetStereoBalance(stereo_balance_);
|
||||||
|
|
||||||
// Maybe fade in this track
|
// Maybe fade in this track
|
||||||
@ -757,7 +755,7 @@ GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin
|
|||||||
// Make a unique name
|
// Make a unique name
|
||||||
QString name = factoryName + "-" + QString::number(next_element_id_++);
|
QString name = factoryName + "-" + QString::number(next_element_id_++);
|
||||||
|
|
||||||
GstElement *element = gst_element_factory_make(factoryName.toLatin1().constData(), name.toLatin1().constData());
|
GstElement *element = gst_element_factory_make(factoryName.toUtf8().constData(), name.toUtf8().constData());
|
||||||
|
|
||||||
if (!element) {
|
if (!element) {
|
||||||
emit Error(QString("GStreamer could not create the element: %1. Please make sure that you have installed all necessary GStreamer plugins").arg(factoryName));
|
emit Error(QString("GStreamer could not create the element: %1. Please make sure that you have installed all necessary GStreamer plugins").arg(factoryName));
|
||||||
@ -889,18 +887,29 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
|||||||
EngineBase::OutputDetailsList ret;
|
EngineBase::OutputDetailsList ret;
|
||||||
|
|
||||||
PluginDetailsList plugins = GetPluginList("Sink/Audio");
|
PluginDetailsList plugins = GetPluginList("Sink/Audio");
|
||||||
for (const PluginDetails &plugin : plugins) {
|
//if (plugins.count() > 0) {
|
||||||
|
for (const PluginDetails &plugin : plugins) {
|
||||||
|
OutputDetails output;
|
||||||
|
output.name = plugin.name;
|
||||||
|
output.description = plugin.description;
|
||||||
|
if (plugin.name == kAutoSink) output.iconname = "soundcard";
|
||||||
|
else if ((plugin.name == kALSASink) || (plugin.name == kOSS4Sink) || (plugin.name == kOSS4Sink)) output.iconname = "alsa";
|
||||||
|
else if (plugin.name== kJackAudioSink) output.iconname = "jack";
|
||||||
|
else if (plugin.name == kPulseSink) output.iconname = "pulseaudio";
|
||||||
|
else if ((plugin.name == kA2DPSink) || (plugin.name == kAVDTPSink)) output.iconname = "bluetooth";
|
||||||
|
else output.iconname = "soundcard";
|
||||||
|
ret.append(output);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
}
|
||||||
|
else {
|
||||||
OutputDetails output;
|
OutputDetails output;
|
||||||
output.name = plugin.name;
|
output.name = kAutoSink;
|
||||||
output.description = plugin.description;
|
output.description = "Auto";
|
||||||
if (plugin.name == kAutoSink) output.iconname = "soundcard";
|
output.iconname = "soundcard";
|
||||||
else if ((plugin.name == kALSASink) || (plugin.name == kOSS4Sink) || (plugin.name == kOSS4Sink)) output.iconname = "alsa";
|
|
||||||
else if (plugin.name== kJackAudioSink) output.iconname = "jack";
|
|
||||||
else if (plugin.name == kPulseSink) output.iconname = "pulseaudio";
|
|
||||||
else if ((plugin.name == kA2DPSink) || (plugin.name == kAVDTPSink)) output.iconname = "bluetooth";
|
|
||||||
else output.iconname = "soundcard";
|
|
||||||
ret.append(output);
|
ret.append(output);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -189,29 +189,20 @@ bool GstEnginePipeline::InitAudioBin() {
|
|||||||
|
|
||||||
// Audio bin
|
// Audio bin
|
||||||
audiobin_ = gst_bin_new("audiobin");
|
audiobin_ = gst_bin_new("audiobin");
|
||||||
//audiobin_ = gst_bin_new("playbackbin");
|
|
||||||
//gst_bin_add(GST_BIN(pipeline_), audiobin_);
|
|
||||||
|
|
||||||
// Create the sink
|
// Create the sink
|
||||||
if (!(audiosink_ = engine_->CreateElement(sink_, audiobin_))) return false;
|
audiosink_ = engine_->CreateElement(sink_, audiobin_);
|
||||||
|
if (!audiosink_) return false;
|
||||||
//if (GstEngine::SinkDeviceSupport(sink_) && !device_.isEmpty())
|
|
||||||
//g_object_set(G_OBJECT(audiosink_), "device", device_.toUtf8().constData(), NULL);
|
|
||||||
|
|
||||||
|
|
||||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device") && !device_.toString().isEmpty()) {
|
|
||||||
|
|
||||||
|
if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device") && device_.isValid()) {
|
||||||
switch (device_.type()) {
|
switch (device_.type()) {
|
||||||
case QVariant::Int:
|
case QVariant::Int:
|
||||||
g_object_set(G_OBJECT(audiosink_), "device", device_.toInt(), nullptr);
|
g_object_set(G_OBJECT(audiosink_), "device", device_.toInt(), nullptr);
|
||||||
break;
|
break;
|
||||||
case QVariant::String:
|
case QVariant::String:
|
||||||
//qLog(Info) << "g_object_set: " << device_.toString().toUtf8().constData();
|
if (device_.toString().isEmpty()) break;
|
||||||
//g_object_set(G_OBJECT(audiosink_), "device", device_.toString().toUtf8().constData(), nullptr);
|
g_object_set(G_OBJECT(audiosink_), "device", device_.toString().toUtf8().constData(), nullptr);
|
||||||
g_object_set(audiosink_, "device", device_.toString().toUtf8().constData(), nullptr);
|
|
||||||
//g_object_set(G_OBJECT(audiosink_), "device", "hw:0,0", nullptr);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
case QVariant::ByteArray: {
|
case QVariant::ByteArray: {
|
||||||
GUID guid = QUuid(device_.toByteArray());
|
GUID guid = QUuid(device_.toByteArray());
|
||||||
@ -219,7 +210,6 @@ bool GstEnginePipeline::InitAudioBin() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // Q_OS_WIN32
|
#endif // Q_OS_WIN32
|
||||||
|
|
||||||
default:
|
default:
|
||||||
qLog(Warning) << "Unknown device type" << device_;
|
qLog(Warning) << "Unknown device type" << device_;
|
||||||
break;
|
break;
|
||||||
@ -245,7 +235,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
|||||||
audioscale_ = engine_->CreateElement("audioresample", audiobin_);
|
audioscale_ = engine_->CreateElement("audioresample", audiobin_);
|
||||||
convert = engine_->CreateElement("audioconvert", audiobin_);
|
convert = engine_->CreateElement("audioconvert", audiobin_);
|
||||||
|
|
||||||
if (!queue_ || !audioconvert_ || !tee || !probe_queue || !probe_converter || !probe_sink || !audio_queue || !equalizer_preamp_ || !equalizer_ || !stereo_panorama_ || !volume_ || !audioscale_ || !convert) {
|
if (!queue_ || !audioconvert_ || !tee || !probe_queue || !probe_converter || !probe_sink || !audio_queue || !volume_ || !audioscale_ || !convert) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,17 +248,14 @@ bool GstEnginePipeline::InitAudioBin() {
|
|||||||
rgvolume_ = engine_->CreateElement("rgvolume", audiobin_);
|
rgvolume_ = engine_->CreateElement("rgvolume", audiobin_);
|
||||||
rglimiter_ = engine_->CreateElement("rglimiter", audiobin_);
|
rglimiter_ = engine_->CreateElement("rglimiter", audiobin_);
|
||||||
audioconvert2_ = engine_->CreateElement("audioconvert", audiobin_);
|
audioconvert2_ = engine_->CreateElement("audioconvert", audiobin_);
|
||||||
event_probe = audioconvert2_;
|
if (rgvolume_ && rglimiter_ && audioconvert2_) {
|
||||||
convert_sink = rgvolume_;
|
event_probe = audioconvert2_;
|
||||||
|
convert_sink = rgvolume_;
|
||||||
if (!rgvolume_ || !rglimiter_ || !audioconvert2_) {
|
// Set replaygain settings
|
||||||
return false;
|
g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, nullptr);
|
||||||
|
g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr);
|
||||||
|
g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set replaygain settings
|
|
||||||
g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, nullptr);
|
|
||||||
g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr);
|
|
||||||
g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a pad on the outside of the audiobin and connect it to the pad of the first element.
|
// Create a pad on the outside of the audiobin and connect it to the pad of the first element.
|
||||||
@ -292,33 +279,35 @@ bool GstEnginePipeline::InitAudioBin() {
|
|||||||
// As a workaround, we create two dummy bands at both ends of the spectrum.
|
// As a workaround, we create two dummy bands at both ends of the spectrum.
|
||||||
// This causes the actual first and last adjustable bands to be implemented using band-pass filters.
|
// This causes the actual first and last adjustable bands to be implemented using band-pass filters.
|
||||||
|
|
||||||
g_object_set(G_OBJECT(equalizer_), "num-bands", 10 + 2, nullptr);
|
if (equalizer_) {
|
||||||
|
g_object_set(G_OBJECT(equalizer_), "num-bands", 10 + 2, nullptr);
|
||||||
|
|
||||||
// Dummy first band (bandwidth 0, cutting below 20Hz):
|
// Dummy first band (bandwidth 0, cutting below 20Hz):
|
||||||
GstObject *first_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), 0));
|
GstObject *first_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), 0));
|
||||||
g_object_set(G_OBJECT(first_band), "freq", 20.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
g_object_set(G_OBJECT(first_band), "freq", 20.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
||||||
g_object_unref(G_OBJECT(first_band));
|
g_object_unref(G_OBJECT(first_band));
|
||||||
|
|
||||||
// Dummy last band (bandwidth 0, cutting over 20KHz):
|
// Dummy last band (bandwidth 0, cutting over 20KHz):
|
||||||
GstObject *last_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), kEqBandCount + 1));
|
GstObject *last_band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), kEqBandCount + 1));
|
||||||
g_object_set(G_OBJECT(last_band), "freq", 20000.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
g_object_set(G_OBJECT(last_band), "freq", 20000.0, "bandwidth", 0, "gain", 0.0f, nullptr);
|
||||||
g_object_unref(G_OBJECT(last_band));
|
g_object_unref(G_OBJECT(last_band));
|
||||||
|
|
||||||
int last_band_frequency = 0;
|
int last_band_frequency = 0;
|
||||||
for (int i = 0; i < kEqBandCount; ++i) {
|
for (int i = 0; i < kEqBandCount; ++i) {
|
||||||
const int index_in_eq = i + 1;
|
const int index_in_eq = i + 1;
|
||||||
GstObject *band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), index_in_eq));
|
GstObject *band = GST_OBJECT(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), index_in_eq));
|
||||||
|
|
||||||
const float frequency = kEqBandFrequencies[i];
|
const float frequency = kEqBandFrequencies[i];
|
||||||
const float bandwidth = frequency - last_band_frequency;
|
const float bandwidth = frequency - last_band_frequency;
|
||||||
last_band_frequency = frequency;
|
last_band_frequency = frequency;
|
||||||
|
|
||||||
g_object_set(G_OBJECT(band), "freq", frequency, "bandwidth", bandwidth, "gain", 0.0f, nullptr);
|
g_object_set(G_OBJECT(band), "freq", frequency, "bandwidth", bandwidth, "gain", 0.0f, nullptr);
|
||||||
g_object_unref(G_OBJECT(band));
|
g_object_unref(G_OBJECT(band));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the stereo balance.
|
// Set the stereo balance.
|
||||||
g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr);
|
if (stereo_panorama_) g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr);
|
||||||
|
|
||||||
// Set the buffer duration. We set this on this queue instead of the decode bin (in ReplaceDecodeBin()) because setting it on the decode bin only affects network sources.
|
// Set the buffer duration. We set this on this queue instead of the decode bin (in ReplaceDecodeBin()) because setting it on the decode bin only affects network sources.
|
||||||
// Disable the default buffer and byte limits, so we only buffer based on time.
|
// Disable the default buffer and byte limits, so we only buffer based on time.
|
||||||
@ -340,7 +329,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
|||||||
gst_pad_link(gst_element_get_request_pad(tee, "src_%u"), gst_element_get_static_pad(audio_queue, "sink"));
|
gst_pad_link(gst_element_get_request_pad(tee, "src_%u"), gst_element_get_static_pad(audio_queue, "sink"));
|
||||||
|
|
||||||
// Link replaygain elements if enabled.
|
// Link replaygain elements if enabled.
|
||||||
if (rg_enabled_) {
|
if (rg_enabled_ && rgvolume_ && rglimiter_ && audioconvert2_) {
|
||||||
gst_element_link_many(rgvolume_, rglimiter_, audioconvert2_, tee, nullptr);
|
gst_element_link_many(rgvolume_, rglimiter_, audioconvert2_, tee, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +341,7 @@ bool GstEnginePipeline::InitAudioBin() {
|
|||||||
// Don't force 16 bit.
|
// Don't force 16 bit.
|
||||||
gst_element_link(probe_queue, probe_converter);
|
gst_element_link(probe_queue, probe_converter);
|
||||||
|
|
||||||
if (engine_->IsEqualizerEnabled()) gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_panorama_, volume_, audioscale_, convert, nullptr);
|
if (engine_->IsEqualizerEnabled() && equalizer_ && equalizer_preamp_ && stereo_panorama_) gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_panorama_, volume_, audioscale_, convert, nullptr);
|
||||||
else gst_element_link_many(audio_queue, volume_, audioscale_, convert, nullptr);
|
else gst_element_link_many(audio_queue, volume_, audioscale_, convert, nullptr);
|
||||||
|
|
||||||
// Let the audio output of the tee autonegotiate the bit depth and format.
|
// Let the audio output of the tee autonegotiate the bit depth and format.
|
||||||
@ -383,6 +372,8 @@ bool GstEnginePipeline::InitFromUrl(const QByteArray &url, qint64 end_nanosec) {
|
|||||||
end_offset_nanosec_ = end_nanosec;
|
end_offset_nanosec_ = end_nanosec;
|
||||||
|
|
||||||
pipeline_ = engine_->CreateElement("playbin");
|
pipeline_ = engine_->CreateElement("playbin");
|
||||||
|
if (pipeline_ == nullptr) return false;
|
||||||
|
|
||||||
g_object_set(G_OBJECT(pipeline_), "uri", url.constData(), nullptr);
|
g_object_set(G_OBJECT(pipeline_), "uri", url.constData(), nullptr);
|
||||||
CHECKED_GCONNECT(G_OBJECT(pipeline_), "about-to-finish", &AboutToFinishCallback, this);
|
CHECKED_GCONNECT(G_OBJECT(pipeline_), "about-to-finish", &AboutToFinishCallback, this);
|
||||||
|
|
||||||
@ -939,6 +930,8 @@ void GstEnginePipeline::SetStereoBalance(float value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::UpdateEqualizer() {
|
void GstEnginePipeline::UpdateEqualizer() {
|
||||||
|
|
||||||
|
if (!equalizer_ || !equalizer_preamp_) return;
|
||||||
|
|
||||||
// Update band gains
|
// Update band gains
|
||||||
for (int i = 0; i < kEqBandCount; ++i) {
|
for (int i = 0; i < kEqBandCount; ++i) {
|
||||||
@ -957,8 +950,7 @@ void GstEnginePipeline::UpdateEqualizer() {
|
|||||||
|
|
||||||
// Update preamp
|
// Update preamp
|
||||||
float preamp = 1.0;
|
float preamp = 1.0;
|
||||||
if (eq_enabled_)
|
if (eq_enabled_) preamp = float(eq_preamp_ + 100) * 0.01; // To scale from 0.0 to 2.0
|
||||||
preamp = float(eq_preamp_ + 100) * 0.01; // To scale from 0.0 to 2.0
|
|
||||||
|
|
||||||
g_object_set(G_OBJECT(equalizer_preamp_), "volume", preamp, nullptr);
|
g_object_set(G_OBJECT(equalizer_preamp_), "volume", preamp, nullptr);
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ QList<DeviceFinder::Device> OsxDeviceFinder::ListDevices() {
|
|||||||
|
|
||||||
Device dev;
|
Device dev;
|
||||||
dev.description = QString::fromUtf8(CFStringGetCStringPtr(*device_name, CFStringGetSystemEncoding()));
|
dev.description = QString::fromUtf8(CFStringGetCStringPtr(*device_name, CFStringGetSystemEncoding()));
|
||||||
dev.device_property_value = id;
|
dev.value = id;
|
||||||
dev.icon_name = GuessIconName(dev.description);
|
dev.iconname = GuessIconName(dev.description);
|
||||||
ret.append(dev);
|
ret.append(dev);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -116,9 +116,9 @@ void PulseDeviceFinder::GetSinkInfoCallback(pa_context *c, const pa_sink_info *i
|
|||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
Device dev;
|
Device dev;
|
||||||
dev.device_property_value = QString::fromUtf8(info->name);
|
|
||||||
dev.description = QString::fromUtf8(info->description);
|
dev.description = QString::fromUtf8(info->description);
|
||||||
dev.iconname = QString::fromUtf8(pa_proplist_gets(info->proplist, "device.icon_name"));
|
dev.value = QString::fromUtf8(info->name);
|
||||||
|
dev.iconname = QString::fromUtf8(pa_proplist_gets(info->proplist, "device.iconname"));
|
||||||
|
|
||||||
state->devices.append(dev);
|
state->devices.append(dev);
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QErrorMessage>
|
|
||||||
|
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
@ -44,6 +42,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "engine/devicefinder.h"
|
#include "engine/devicefinder.h"
|
||||||
|
|
||||||
|
#include "dialogs/errordialog.h"
|
||||||
|
|
||||||
const char *BackendSettingsPage::kSettingsGroup = "Backend";
|
const char *BackendSettingsPage::kSettingsGroup = "Backend";
|
||||||
const char *BackendSettingsPage::EngineText_Xine = "Xine";
|
const char *BackendSettingsPage::EngineText_Xine = "Xine";
|
||||||
const char *BackendSettingsPage::EngineText_GStreamer = "GStreamer";
|
const char *BackendSettingsPage::EngineText_GStreamer = "GStreamer";
|
||||||
@ -52,8 +52,6 @@ const char *BackendSettingsPage::EngineText_VLC = "VLC";
|
|||||||
|
|
||||||
BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_BackendSettingsPage) {
|
BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_BackendSettingsPage) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
setWindowIcon(IconLoader::Load("soundcard"));
|
setWindowIcon(IconLoader::Load("soundcard"));
|
||||||
|
|
||||||
@ -67,30 +65,22 @@ BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog) : SettingsPage(
|
|||||||
|
|
||||||
connect(ui_->stickslider_replaygainpreamp, SIGNAL(valueChanged(int)), SLOT(RgPreampChanged(int)));
|
connect(ui_->stickslider_replaygainpreamp, SIGNAL(valueChanged(int)), SLOT(RgPreampChanged(int)));
|
||||||
ui_->label_replaygainpreamp->setMinimumWidth(QFontMetrics(ui_->label_replaygainpreamp->font()).width("-WW.W dB"));
|
ui_->label_replaygainpreamp->setMinimumWidth(QFontMetrics(ui_->label_replaygainpreamp->font()).width("-WW.W dB"));
|
||||||
|
|
||||||
RgPreampChanged(ui_->stickslider_replaygainpreamp->value());
|
RgPreampChanged(ui_->stickslider_replaygainpreamp->value());
|
||||||
|
|
||||||
s_.beginGroup(BackendSettingsPage::kSettingsGroup);
|
s_.beginGroup(BackendSettingsPage::kSettingsGroup);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BackendSettingsPage::~BackendSettingsPage() {
|
BackendSettingsPage::~BackendSettingsPage() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
//dialog()->app()->player()->CreateEngine(engineloaded_);
|
|
||||||
//dialog()->app()->player()->ReloadSettings();
|
|
||||||
//dialog()->app()->player()->Init();
|
|
||||||
|
|
||||||
s_.endGroup();
|
|
||||||
|
|
||||||
|
s_.endGroup();
|
||||||
delete ui_;
|
delete ui_;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackendSettingsPage::Load() {
|
void BackendSettingsPage::Load() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
configloaded_ = false;
|
configloaded_ = false;
|
||||||
engineloaded_ = Engine::None;
|
engineloaded_ = Engine::None;
|
||||||
|
|
||||||
@ -111,10 +101,11 @@ void BackendSettingsPage::Load() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
configloaded_ = true;
|
configloaded_ = true;
|
||||||
|
enginereset_ = false;
|
||||||
|
|
||||||
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(enginetype));
|
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(enginetype));
|
||||||
if (enginetype != engineloaded_) Load_Engine(enginetype);
|
if (enginetype != engineloaded_) Load_Engine(enginetype);
|
||||||
|
|
||||||
ui_->spinbox_bufferduration->setValue(s_.value("bufferduration", 4000).toInt());
|
ui_->spinbox_bufferduration->setValue(s_.value("bufferduration", 4000).toInt());
|
||||||
ui_->checkbox_monoplayback->setChecked(s_.value("monoplayback", false).toBool());
|
ui_->checkbox_monoplayback->setChecked(s_.value("monoplayback", false).toBool());
|
||||||
ui_->slider_bufferminfill->setValue(s_.value("bufferminfill", 33).toInt());
|
ui_->slider_bufferminfill->setValue(s_.value("bufferminfill", 33).toInt());
|
||||||
@ -124,14 +115,18 @@ void BackendSettingsPage::Load() {
|
|||||||
ui_->stickslider_replaygainpreamp->setValue(s_.value("rgpreamp", 0.0).toDouble() * 10 + 150);
|
ui_->stickslider_replaygainpreamp->setValue(s_.value("rgpreamp", 0.0).toDouble() * 10 + 150);
|
||||||
ui_->checkbox_replaygaincompression->setChecked(s_.value("rgcompression", true).toBool());
|
ui_->checkbox_replaygaincompression->setChecked(s_.value("rgcompression", true).toBool());
|
||||||
|
|
||||||
|
//if (dialog()->app()->player()->engine()->state() != Engine::Empty) ui_->combobox_engine->setEnabled(false);
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
ui_->combobox_engine->setEnabled(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
|
void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
QString output = s_.value("output", "").toString();
|
||||||
|
QVariant device = s_.value("device", QVariant());
|
||||||
output_ = s_.value("output", "").toString();
|
|
||||||
device_ = s_.value("device", "").toString();
|
|
||||||
|
|
||||||
ui_->combobox_output->clear();
|
ui_->combobox_output->clear();
|
||||||
ui_->combobox_device->clear();
|
ui_->combobox_device->clear();
|
||||||
@ -141,13 +136,15 @@ void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
|
|||||||
|
|
||||||
ui_->lineedit_device->setEnabled(false);
|
ui_->lineedit_device->setEnabled(false);
|
||||||
ui_->lineedit_device->setText("");
|
ui_->lineedit_device->setText("");
|
||||||
|
|
||||||
|
ui_->groupbox_replaygain->setEnabled(false);
|
||||||
|
|
||||||
// If a engine is loaded (!= Engine::None) AND engine has been switched reset output and device.
|
// If a engine is loaded (!= Engine::None) AND engine has been switched reset output and device.
|
||||||
if ((engineloaded_ != Engine::None) && (engineloaded_ != enginetype)) {
|
if ((engineloaded_ != Engine::None) && (engineloaded_ != enginetype)) {
|
||||||
output_ = "";
|
output = "";
|
||||||
device_ = "";
|
device = QVariant();
|
||||||
s_.setValue("output", "");
|
s_.setValue("output", "");
|
||||||
s_.setValue("device", "");
|
s_.setValue("device", QVariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog()->app()->player()->engine()->type() != enginetype) {
|
if (dialog()->app()->player()->engine()->type() != enginetype) {
|
||||||
@ -159,168 +156,177 @@ void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
|
|||||||
switch(enginetype) {
|
switch(enginetype) {
|
||||||
#ifdef HAVE_XINE
|
#ifdef HAVE_XINE
|
||||||
case Engine::Xine:
|
case Engine::Xine:
|
||||||
Xine_Load();
|
Xine_Load(output, device);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
case Engine::GStreamer:
|
case Engine::GStreamer:
|
||||||
Gst_Load();
|
Gst_Load(output, device);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_PHONON
|
#ifdef HAVE_PHONON
|
||||||
case Engine::Phonon:
|
case Engine::Phonon:
|
||||||
Phonon_Load();
|
Phonon_Load(output, device);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_VLC
|
#ifdef HAVE_VLC
|
||||||
case Engine::VLC:
|
case Engine::VLC:
|
||||||
VLC_Load();
|
VLC_Load(output, device);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
QMessageBox messageBox;
|
|
||||||
QString msg = QString("Missing engine %1!").arg(Engine::EngineNameFromType(enginetype));
|
QString msg = QString("Missing engine %1!").arg(Engine::EngineNameFromType(enginetype));
|
||||||
messageBox.critical(nullptr, "Error", msg);
|
errordialog_.ShowMessage(msg);
|
||||||
messageBox.setFixedSize(500, 200);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackendSettingsPage::Load_Device(QString output) {
|
void BackendSettingsPage::Load_Device(QString output, QVariant device, bool alsa) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
int devices = 0;
|
||||||
|
DeviceFinder::Device dfdevice;
|
||||||
|
|
||||||
ui_->combobox_device->setEnabled(false);
|
|
||||||
ui_->combobox_device->clear();
|
ui_->combobox_device->clear();
|
||||||
ui_->lineedit_device->setEnabled(false);
|
ui_->combobox_device->setEnabled(false);
|
||||||
ui_->lineedit_device->setText("");
|
ui_->lineedit_device->setText("");
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
ui_->combobox_device->addItem(IconLoader::Load("soundcard"), "Automatically select", "");
|
ui_->combobox_device->addItem(IconLoader::Load("soundcard"), "Automatically select", "");
|
||||||
ui_->combobox_device->addItem(IconLoader::Load("soundcard"), "Custom", "");
|
#endif
|
||||||
int i = 0;
|
|
||||||
for (DeviceFinder *finder : dialog()->app()->enginedevice()->device_finders_) {
|
if (alsa) ui_->lineedit_device->setEnabled(true);
|
||||||
if (finder->output() != output) continue;
|
else ui_->lineedit_device->setEnabled(false);
|
||||||
for (const DeviceFinder::Device &device : finder->ListDevices()) {
|
|
||||||
i++;
|
for (DeviceFinder *f : dialog()->app()->enginedevice()->device_finders_) {
|
||||||
ui_->combobox_device->addItem(IconLoader::Load(device.iconname), device.description, device.string);
|
if (f->name() == "alsa" && !alsa) continue;
|
||||||
|
for (const DeviceFinder::Device &d : f->ListDevices()) {
|
||||||
|
devices++;
|
||||||
|
ui_->combobox_device->addItem(IconLoader::Load(d.iconname), d.description, d.value);
|
||||||
|
if (d.value == device) { dfdevice = d; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
|
||||||
ui_->combobox_device->setEnabled(true);
|
|
||||||
ui_->lineedit_device->setEnabled(true);
|
|
||||||
ui_->lineedit_device->setText(device_);
|
|
||||||
|
|
||||||
|
if (alsa) ui_->combobox_device->addItem(IconLoader::Load("soundcard"), "Custom", QVariant(""));
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
if (devices > 0) ui_->combobox_device->setEnabled(true);
|
||||||
|
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||||
|
QVariant d = ui_->combobox_device->itemData(i).value<QVariant>();
|
||||||
|
if (dfdevice.value == d) {
|
||||||
|
ui_->combobox_device->setCurrentIndex(i);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This allows a custom ALSA device string ie: "hw:0,0" even if it is not listed.
|
||||||
|
if (found == false && alsa && device.type() == QVariant::String && !device.toString().isEmpty()) {
|
||||||
|
ui_->lineedit_device->setText(device.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
void BackendSettingsPage::Gst_Load() {
|
void BackendSettingsPage::Gst_Load(QString output, QVariant device) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
if (output == "") output = GstEngine::kAutoSink;
|
||||||
|
|
||||||
if (output_ == "") output_ = GstEngine::kAutoSink;
|
|
||||||
|
|
||||||
if (dialog()->app()->player()->engine()->type() != Engine::GStreamer) {
|
if (dialog()->app()->player()->engine()->type() != Engine::GStreamer) {
|
||||||
QMessageBox messageBox;
|
errordialog_.ShowMessage("GStramer not initialized! Please restart.");
|
||||||
messageBox.critical(nullptr, "Error", "GStramer not initialized! Please restart.");
|
|
||||||
messageBox.setFixedSize(500, 200);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstEngine *gstengine = qobject_cast<GstEngine*>(dialog()->app()->player()->engine());
|
GstEngine *gstengine = qobject_cast<GstEngine*>(dialog()->app()->player()->engine());
|
||||||
|
|
||||||
ui_->combobox_output->clear();
|
ui_->combobox_output->clear();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const EngineBase::OutputDetails &output : gstengine->GetOutputsList()) {
|
for (const EngineBase::OutputDetails &o : gstengine->GetOutputsList()) {
|
||||||
i++;
|
i++;
|
||||||
ui_->combobox_output->addItem(IconLoader::Load(output.iconname), output.description, QVariant::fromValue(output));
|
ui_->combobox_output->addItem(IconLoader::Load(o.iconname), o.description, QVariant::fromValue(o));
|
||||||
//qLog(Debug) << output.description;
|
|
||||||
}
|
}
|
||||||
if (i > 0) ui_->combobox_output->setEnabled(true);
|
if (i > 0) ui_->combobox_output->setEnabled(true);
|
||||||
|
|
||||||
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
|
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
|
||||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails o = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
||||||
if (details.name == output_) {
|
if (o.name == output) {
|
||||||
ui_->combobox_output->setCurrentIndex(i);
|
ui_->combobox_output->setCurrentIndex(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
engineloaded_=Engine::GStreamer;
|
engineloaded_=Engine::GStreamer;
|
||||||
|
ui_->groupbox_replaygain->setEnabled(true);
|
||||||
|
|
||||||
|
Load_Device(output, device, GstEngine::ALSADeviceSupport(output));
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_XINE
|
#ifdef HAVE_XINE
|
||||||
void BackendSettingsPage::Xine_Load() {
|
void BackendSettingsPage::Xine_Load(QString output, QVariant device) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
if (output == "") output = "auto";
|
||||||
|
|
||||||
if (output_ == "") output_ = "auto";
|
|
||||||
|
|
||||||
if (dialog()->app()->player()->engine()->type() != Engine::Xine) {
|
if (dialog()->app()->player()->engine()->type() != Engine::Xine) {
|
||||||
QMessageBox messageBox;
|
errordialog_.ShowMessage("Xine not initialized! Please restart.");
|
||||||
messageBox.critical(nullptr, "Error", "Xine not initialized! Please restart.");
|
|
||||||
messageBox.setFixedSize(500, 200);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XineEngine *xineengine = qobject_cast<XineEngine*>(dialog()->app()->player()->engine());
|
XineEngine *xineengine = qobject_cast<XineEngine*>(dialog()->app()->player()->engine());
|
||||||
|
|
||||||
ui_->combobox_output->clear();
|
ui_->combobox_output->clear();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const EngineBase::OutputDetails &output : xineengine->GetOutputsList()) {
|
for (const EngineBase::OutputDetails &o : xineengine->GetOutputsList()) {
|
||||||
i++;
|
i++;
|
||||||
ui_->combobox_output->addItem(IconLoader::Load(output.iconname), output.description, QVariant::fromValue(output));
|
ui_->combobox_output->addItem(IconLoader::Load(o.iconname), o.description, QVariant::fromValue(o));
|
||||||
//qLog(Debug) << output.description;
|
|
||||||
}
|
}
|
||||||
if (i > 0) ui_->combobox_output->setEnabled(true);
|
if (i > 0) ui_->combobox_output->setEnabled(true);
|
||||||
|
|
||||||
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
|
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
|
||||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails o = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
|
||||||
if (details.name == output_) {
|
if (o.name == output) {
|
||||||
ui_->combobox_output->setCurrentIndex(i);
|
ui_->combobox_output->setCurrentIndex(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
engineloaded_=Engine::Xine;
|
engineloaded_=Engine::Xine;
|
||||||
|
|
||||||
|
Load_Device(output, device, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PHONON
|
#ifdef HAVE_PHONON
|
||||||
void BackendSettingsPage::Phonon_Load() {
|
void BackendSettingsPage::Phonon_Load(QString output, QVariant device) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
ui_->combobox_output->clear();
|
ui_->combobox_output->clear();
|
||||||
ui_->combobox_device->clear();
|
ui_->combobox_device->clear();
|
||||||
ui_->lineedit_device->setText("");
|
ui_->lineedit_device->setText("");
|
||||||
|
|
||||||
engineloaded_=Engine::Phonon;
|
engineloaded_=Engine::Phonon;
|
||||||
|
|
||||||
|
Load_Device(output, device, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_VLC
|
#ifdef HAVE_VLC
|
||||||
void BackendSettingsPage::VLC_Load() {
|
void BackendSettingsPage::VLC_Load(QString output, QVariant device) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
ui_->combobox_output->clear();
|
ui_->combobox_output->clear();
|
||||||
ui_->combobox_device->clear();
|
ui_->combobox_device->clear();
|
||||||
ui_->lineedit_device->setText("");
|
ui_->lineedit_device->setText("");
|
||||||
|
|
||||||
engineloaded_=Engine::VLC;
|
engineloaded_=Engine::VLC;
|
||||||
|
|
||||||
|
Load_Device(output, device, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void BackendSettingsPage::Save() {
|
void BackendSettingsPage::Save() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
s_.setValue("engine", ui_->combobox_engine->itemText(ui_->combobox_engine->currentIndex()).toLower());
|
s_.setValue("engine", ui_->combobox_engine->itemText(ui_->combobox_engine->currentIndex()).toLower());
|
||||||
|
|
||||||
QVariant myVariant = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
QVariant myVariant = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
||||||
@ -351,7 +357,8 @@ void BackendSettingsPage::Save() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_.setValue("device", ui_->lineedit_device->text());
|
s_.setValue("device", ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()).value<QVariant>());
|
||||||
|
|
||||||
s_.setValue("bufferduration", ui_->spinbox_bufferduration->value());
|
s_.setValue("bufferduration", ui_->spinbox_bufferduration->value());
|
||||||
s_.setValue("monoplayback", ui_->checkbox_monoplayback->isChecked());
|
s_.setValue("monoplayback", ui_->checkbox_monoplayback->isChecked());
|
||||||
s_.setValue("bufferminfill", ui_->slider_bufferminfill->value());
|
s_.setValue("bufferminfill", ui_->slider_bufferminfill->value());
|
||||||
@ -364,18 +371,9 @@ void BackendSettingsPage::Save() {
|
|||||||
|
|
||||||
#ifdef HAVE_XINE
|
#ifdef HAVE_XINE
|
||||||
void BackendSettingsPage::Xine_Save() {
|
void BackendSettingsPage::Xine_Save() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
XineEngine *xineengine = qobject_cast<XineEngine*>(dialog()->app()->player()->engine());
|
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||||
s_.setValue("output", output.name);
|
s_.setValue("output", output.name);
|
||||||
|
|
||||||
for (EngineBase::OutputDetails &output : xineengine->GetOutputsList()) {
|
|
||||||
if (xineengine->ALSADeviceSupport(output.name)) output.device_property_value = QVariant(ui_->lineedit_device->text());
|
|
||||||
else output.device_property_value = QVariant(ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -383,45 +381,36 @@ void BackendSettingsPage::Xine_Save() {
|
|||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
void BackendSettingsPage::Gst_Save() {
|
void BackendSettingsPage::Gst_Save() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
GstEngine *gstengine = qobject_cast<GstEngine*>(dialog()->app()->player()->engine());
|
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||||
s_.setValue("output", output.name);
|
s_.setValue("output", output.name);
|
||||||
|
|
||||||
for (EngineBase::OutputDetails &output : gstengine->GetOutputsList()) {
|
|
||||||
if (GstEngine::ALSADeviceSupport(output.name)) output.device_property_value = QVariant(ui_->lineedit_device->text());
|
|
||||||
else output.device_property_value = QVariant(ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PHONON
|
#ifdef HAVE_PHONON
|
||||||
void BackendSettingsPage::Phonon_Save() {
|
void BackendSettingsPage::Phonon_Save() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_VLC
|
#ifdef HAVE_VLC
|
||||||
void BackendSettingsPage::VLC_Save() {
|
void BackendSettingsPage::VLC_Save() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void BackendSettingsPage::EngineChanged(int index) {
|
void BackendSettingsPage::EngineChanged(int index) {
|
||||||
|
|
||||||
if (configloaded_ == false) return;
|
if (configloaded_ == false) return;
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
if ((engineloaded_ != Engine::None) && (dialog()->app()->player()->engine()->state() != Engine::Empty)) {
|
||||||
|
if (enginereset_ == true) { enginereset_ = false; return; }
|
||||||
QVariant myVariant = ui_->combobox_engine->itemData(index);
|
errordialog_.ShowMessage("Can't switch engine while playing!");
|
||||||
Engine::EngineType enginetype = myVariant.value<Engine::EngineType>();
|
enginereset_ = true;
|
||||||
|
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(engineloaded_));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant v = ui_->combobox_engine->itemData(index);
|
||||||
|
Engine::EngineType enginetype = v.value<Engine::EngineType>();
|
||||||
|
|
||||||
Load_Engine(enginetype);
|
Load_Engine(enginetype);
|
||||||
|
|
||||||
@ -429,18 +418,14 @@ void BackendSettingsPage::EngineChanged(int index) {
|
|||||||
|
|
||||||
void BackendSettingsPage::OutputChanged(int index) {
|
void BackendSettingsPage::OutputChanged(int index) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
QVariant v = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
||||||
|
Engine::EngineType enginetype = v.value<Engine::EngineType>();
|
||||||
QVariant myVariant = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
|
||||||
Engine::EngineType enginetype = myVariant.value<Engine::EngineType>();
|
|
||||||
OutputChanged(index, enginetype);
|
OutputChanged(index, enginetype);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackendSettingsPage::OutputChanged(int index, Engine::EngineType enginetype) {
|
void BackendSettingsPage::OutputChanged(int index, Engine::EngineType enginetype) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
switch(enginetype) {
|
switch(enginetype) {
|
||||||
case Engine::Xine:
|
case Engine::Xine:
|
||||||
#ifdef HAVE_XINE
|
#ifdef HAVE_XINE
|
||||||
@ -471,76 +456,82 @@ void BackendSettingsPage::OutputChanged(int index, Engine::EngineType enginetype
|
|||||||
#ifdef HAVE_XINE
|
#ifdef HAVE_XINE
|
||||||
void BackendSettingsPage::Xine_OutputChanged(int index) {
|
void BackendSettingsPage::Xine_OutputChanged(int index) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
||||||
|
Load_Device(output.name, QVariant(), false);
|
||||||
|
|
||||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
|
||||||
QString name = details.name;
|
|
||||||
if (XineEngine::ALSADeviceSupport(name)) Load_Device("alsa");
|
|
||||||
else Load_Device(name);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
void BackendSettingsPage::Gst_OutputChanged(int index) {
|
void BackendSettingsPage::Gst_OutputChanged(int index) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
EngineBase::OutputDetails details = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
||||||
QString name = details.name;
|
Load_Device(output.name, QVariant(), GstEngine::ALSADeviceSupport(output.name));
|
||||||
if (GstEngine::ALSADeviceSupport(name)) Load_Device("alsa");
|
|
||||||
else Load_Device(name);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PHONON
|
#ifdef HAVE_PHONON
|
||||||
void BackendSettingsPage::Phonon_OutputChanged(int index) {
|
void BackendSettingsPage::Phonon_OutputChanged(int index) {
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
Load_Device("", QVariant(), false);
|
||||||
Load_Device("");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_VLC
|
#ifdef HAVE_VLC
|
||||||
void BackendSettingsPage::VLC_OutputChanged(int index) {
|
void BackendSettingsPage::VLC_OutputChanged(int index) {
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
Load_Device("", QVariant(), false);
|
||||||
Load_Device("");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void BackendSettingsPage::DeviceSelectionChanged(int index) {
|
void BackendSettingsPage::DeviceSelectionChanged(int index) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
if (ui_->combobox_device->currentText() == "Custom") {
|
||||||
|
ui_->lineedit_device->setEnabled(true);
|
||||||
|
ui_->combobox_device->setItemData(index, QVariant(ui_->lineedit_device->text()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (index == 1) return;
|
QVariant device = ui_->combobox_device->itemData(index).value<QVariant>();
|
||||||
|
if (device.type() == QVariant::String) {
|
||||||
|
ui_->lineedit_device->setEnabled(true);
|
||||||
|
ui_->lineedit_device->setText(device.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString string = ui_->combobox_device->itemData(index).value<QString>();
|
ui_->lineedit_device->setEnabled(false);
|
||||||
|
ui_->lineedit_device->setText("");
|
||||||
ui_->lineedit_device->setText(string);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackendSettingsPage::DeviceStringChanged() {
|
void BackendSettingsPage::DeviceStringChanged() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
QString string = ui_->lineedit_device->text();
|
|
||||||
|
|
||||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||||
QString s = ui_->combobox_device->itemData(i).value<QString>();
|
QVariant v = ui_->combobox_device->itemData(i).value<QVariant>();
|
||||||
if (s == string ) {
|
if (v.type() != QVariant::String) continue;
|
||||||
|
if (v.toString() == ui_->lineedit_device->text()) {
|
||||||
ui_->combobox_device->setCurrentIndex(i);
|
ui_->combobox_device->setCurrentIndex(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assume this is a custom alsa device string
|
||||||
|
|
||||||
ui_->combobox_device->setCurrentIndex(1);
|
if (ui_->combobox_device->currentText() != "Custom") {
|
||||||
|
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||||
|
if (ui_->combobox_device->itemText(i) == "Custom") {
|
||||||
|
ui_->combobox_device->setCurrentIndex(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ui_->combobox_device->currentText() == "Custom") {
|
||||||
|
ui_->combobox_device->setItemData(ui_->combobox_device->currentIndex(), QVariant(ui_->lineedit_device->text()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackendSettingsPage::RgPreampChanged(int value) {
|
void BackendSettingsPage::RgPreampChanged(int value) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
float db = float(value) / 10 - 15;
|
float db = float(value) / 10 - 15;
|
||||||
QString db_str;
|
QString db_str;
|
||||||
db_str.sprintf("%+.1f dB", db);
|
db_str.sprintf("%+.1f dB", db);
|
||||||
@ -549,8 +540,5 @@ void BackendSettingsPage::RgPreampChanged(int value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BackendSettingsPage::BufferMinFillChanged(int value) {
|
void BackendSettingsPage::BufferMinFillChanged(int value) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
|
||||||
|
|
||||||
ui_->label_bufferminfillvalue->setText(QString::number(value) + "%");
|
ui_->label_bufferminfillvalue->setText(QString::number(value) + "%");
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include "engine/engine_fwd.h"
|
#include "engine/engine_fwd.h"
|
||||||
#include "engine/enginetype.h"
|
#include "engine/enginetype.h"
|
||||||
|
|
||||||
|
#include "dialogs/errordialog.h"
|
||||||
|
|
||||||
class Ui_BackendSettingsPage;
|
class Ui_BackendSettingsPage;
|
||||||
|
|
||||||
class BackendSettingsPage : public SettingsPage {
|
class BackendSettingsPage : public SettingsPage {
|
||||||
@ -40,7 +42,7 @@ class BackendSettingsPage : public SettingsPage {
|
|||||||
public:
|
public:
|
||||||
BackendSettingsPage(SettingsDialog *dialog);
|
BackendSettingsPage(SettingsDialog *dialog);
|
||||||
~BackendSettingsPage();
|
~BackendSettingsPage();
|
||||||
|
|
||||||
static const char *kSettingsGroup;
|
static const char *kSettingsGroup;
|
||||||
static const char *EngineText_Xine;
|
static const char *EngineText_Xine;
|
||||||
static const char *EngineText_GStreamer;
|
static const char *EngineText_GStreamer;
|
||||||
@ -63,39 +65,39 @@ private:
|
|||||||
|
|
||||||
void EngineChanged(Engine::EngineType enginetype);
|
void EngineChanged(Engine::EngineType enginetype);
|
||||||
void OutputChanged(int index, Engine::EngineType enginetype);
|
void OutputChanged(int index, Engine::EngineType enginetype);
|
||||||
|
|
||||||
void Load_Engine(Engine::EngineType enginetype);
|
void Load_Engine(Engine::EngineType enginetype);
|
||||||
void Load_Device(QString output);
|
void Load_Device(QString output, QVariant device, bool alsa);
|
||||||
|
|
||||||
#ifdef HAVE_XINE
|
#ifdef HAVE_XINE
|
||||||
void Xine_Load();
|
void Xine_Load(QString output, QVariant device);
|
||||||
void Xine_Save();
|
void Xine_Save();
|
||||||
void Xine_OutputChanged(int index);
|
void Xine_OutputChanged(int index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
void Gst_Load();
|
void Gst_Load(QString output, QVariant device);
|
||||||
void Gst_Save();
|
void Gst_Save();
|
||||||
void Gst_OutputChanged(int index);
|
void Gst_OutputChanged(int index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PHONON
|
#ifdef HAVE_PHONON
|
||||||
void Phonon_Load();
|
void Phonon_Load(QString output, QVariant device);
|
||||||
void Phonon_Save();
|
void Phonon_Save();
|
||||||
void Phonon_OutputChanged(int index);
|
void Phonon_OutputChanged(int index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_VLC
|
#ifdef HAVE_VLC
|
||||||
void VLC_Load();
|
void VLC_Load(QString output, QVariant device);
|
||||||
void VLC_Save();
|
void VLC_Save();
|
||||||
void VLC_OutputChanged(int index);
|
void VLC_OutputChanged(int index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool configloaded_;
|
bool configloaded_;
|
||||||
Engine::EngineType engineloaded_;
|
Engine::EngineType engineloaded_;
|
||||||
QString output_;
|
|
||||||
QString device_;
|
|
||||||
QSettings s_;
|
QSettings s_;
|
||||||
|
ErrorDialog errordialog_;
|
||||||
|
bool enginereset_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,19 +174,25 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupbox_replaygain">
|
<widget class="QGroupBox" name="groupbox_replaygain">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Replay Gain</string>
|
<string>Replay Gain</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkbox_replaygain">
|
<widget class="QCheckBox" name="checkbox_replaygain">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use Replay Gain metadata if it is available</string>
|
<string>Use Replay Gain metadata if it is available</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget_replaygain" native="true">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -295,5 +301,22 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>checkbox_replaygain</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>widget_replaygain</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>89</x>
|
||||||
|
<y>259</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>143</x>
|
||||||
|
<y>285</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -168,9 +168,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -195,22 +192,6 @@
|
|||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
|
||||||
<sender>replaygain</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>widget</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>89</x>
|
|
||||||
<y>259</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>143</x>
|
|
||||||
<y>285</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>fading_auto</sender>
|
<sender>fading_auto</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
|
@ -85,7 +85,7 @@ StatusView::StatusView(CollectionViewContainer *collectionviewcontainer, QWidget
|
|||||||
widgetstate_(None),
|
widgetstate_(None),
|
||||||
menu_(new QMenu(this))
|
menu_(new QMenu(this))
|
||||||
{
|
{
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
collectionview_ = collectionviewcontainer->view();
|
collectionview_ = collectionviewcontainer->view();
|
||||||
@ -112,7 +112,7 @@ StatusView::~StatusView() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::AddActions() {
|
void StatusView::AddActions() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
QList<QAction*> actions = album_cover_choice_controller_->GetAllActions();
|
QList<QAction*> actions = album_cover_choice_controller_->GetAllActions();
|
||||||
@ -130,13 +130,13 @@ void StatusView::AddActions() {
|
|||||||
|
|
||||||
menu_->addActions(actions);
|
menu_->addActions(actions);
|
||||||
menu_->addSeparator();
|
menu_->addSeparator();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::CreateWidget() {
|
void StatusView::CreateWidget() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
setLayout(layout_);
|
setLayout(layout_);
|
||||||
setStyleSheet("background-color: white;");
|
setStyleSheet("background-color: white;");
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ void StatusView::CreateWidget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::SetApplication(Application *app) {
|
void StatusView::SetApplication(Application *app) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
app_ = app;
|
app_ = app;
|
||||||
@ -263,7 +263,7 @@ void StatusView::SongWidget() {
|
|||||||
void StatusView::SwitchWidgets(WidgetState state) {
|
void StatusView::SwitchWidgets(WidgetState state) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (widgetstate_ == None) NoSongWidget();
|
if (widgetstate_ == None) NoSongWidget();
|
||||||
|
|
||||||
if ((state == Stopped) && (widgetstate_ != Stopped)) {
|
if ((state == Stopped) && (widgetstate_ != Stopped)) {
|
||||||
@ -279,7 +279,7 @@ void StatusView::SwitchWidgets(WidgetState state) {
|
|||||||
void StatusView::UpdateSong(const Song &song) {
|
void StatusView::UpdateSong(const Song &song) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
SwitchWidgets(Playing);
|
SwitchWidgets(Playing);
|
||||||
|
|
||||||
const Song *song_ = &song;
|
const Song *song_ = &song;
|
||||||
@ -331,7 +331,7 @@ void StatusView::UpdateSong(const Song &song) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::NoSong() {
|
void StatusView::NoSong() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
QString html;
|
QString html;
|
||||||
@ -368,7 +368,7 @@ void StatusView::NoSong() {
|
|||||||
void StatusView::SongChanged(const Song &song) {
|
void StatusView::SongChanged(const Song &song) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
stopped_ = false;
|
stopped_ = false;
|
||||||
metadata_ = song;
|
metadata_ = song;
|
||||||
const Song *song_ = &song;
|
const Song *song_ = &song;
|
||||||
@ -380,9 +380,9 @@ void StatusView::SongChanged(const Song &song) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::SongFinished() {
|
void StatusView::SongFinished() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
stopped_ = true;
|
stopped_ = true;
|
||||||
SetImage(image_blank_);
|
SetImage(image_blank_);
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ void StatusView::SongFinished() {
|
|||||||
bool StatusView::eventFilter(QObject *object, QEvent *event) {
|
bool StatusView::eventFilter(QObject *object, QEvent *event) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
switch(event->type()) {
|
switch(event->type()) {
|
||||||
case QEvent::Paint:{
|
case QEvent::Paint:{
|
||||||
handlePaintEvent(object, event);
|
handlePaintEvent(object, event);
|
||||||
@ -406,7 +406,7 @@ bool StatusView::eventFilter(QObject *object, QEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::handlePaintEvent(QObject *object, QEvent *event) {
|
void StatusView::handlePaintEvent(QObject *object, QEvent *event) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__ << object->objectName();
|
//qLog(Debug) << __PRETTY_FUNCTION__ << object->objectName();
|
||||||
|
|
||||||
if (object == label_playing_album_) {
|
if (object == label_playing_album_) {
|
||||||
@ -420,7 +420,7 @@ void StatusView::handlePaintEvent(QObject *object, QEvent *event) {
|
|||||||
void StatusView::paintEvent_album(QEvent *event) {
|
void StatusView::paintEvent_album(QEvent *event) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
QPainter p(label_playing_album_);
|
QPainter p(label_playing_album_);
|
||||||
|
|
||||||
DrawImage(&p);
|
DrawImage(&p);
|
||||||
@ -433,7 +433,7 @@ void StatusView::paintEvent_album(QEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::DrawImage(QPainter *p) {
|
void StatusView::DrawImage(QPainter *p) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
p->drawPixmap(0, 0, 300, 300, pixmap_current_);
|
p->drawPixmap(0, 0, 300, 300, pixmap_current_);
|
||||||
@ -444,9 +444,9 @@ void StatusView::DrawImage(QPainter *p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::FadePreviousTrack(qreal value) {
|
void StatusView::FadePreviousTrack(qreal value) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
pixmap_previous_opacity_ = value;
|
pixmap_previous_opacity_ = value;
|
||||||
if (qFuzzyCompare(pixmap_previous_opacity_, qreal(0.0))) {
|
if (qFuzzyCompare(pixmap_previous_opacity_, qreal(0.0))) {
|
||||||
pixmap_previous_ = QPixmap();
|
pixmap_previous_ = QPixmap();
|
||||||
@ -464,17 +464,17 @@ void StatusView::FadePreviousTrack(qreal value) {
|
|||||||
void StatusView::contextMenuEvent(QContextMenuEvent *e) {
|
void StatusView::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
|
|
||||||
// show the menu
|
// show the menu
|
||||||
menu_->popup(mapToGlobal(e->pos()));
|
if (menu_ && widgetstate_ == Playing) menu_->popup(mapToGlobal(e->pos()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::mouseReleaseEvent(QMouseEvent *) {
|
void StatusView::mouseReleaseEvent(QMouseEvent *) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::dragEnterEvent(QDragEnterEvent *e) {
|
void StatusView::dragEnterEvent(QDragEnterEvent *e) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
QWidget::dragEnterEvent(e);
|
QWidget::dragEnterEvent(e);
|
||||||
@ -482,7 +482,7 @@ void StatusView::dragEnterEvent(QDragEnterEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StatusView::dropEvent(QDropEvent *e) {
|
void StatusView::dropEvent(QDropEvent *e) {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
QWidget::dropEvent(e);
|
QWidget::dropEvent(e);
|
||||||
@ -541,9 +541,9 @@ void StatusView::SetImage(const QImage &image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool StatusView::GetCoverAutomatically() {
|
bool StatusView::GetCoverAutomatically() {
|
||||||
|
|
||||||
//qLog(Debug) << __PRETTY_FUNCTION__;
|
//qLog(Debug) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
SwitchWidgets(Playing);
|
SwitchWidgets(Playing);
|
||||||
|
|
||||||
// Search for cover automatically?
|
// Search for cover automatically?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user