1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 19:31:02 +01:00

Make it so!

Fixes issue #2527
This commit is contained in:
John Maguire 2012-01-10 17:00:17 +01:00
parent 6ab38e0093
commit dfdb71b164
6 changed files with 31 additions and 6 deletions

View File

@ -10,6 +10,7 @@
const char* BackgroundStreams::kSettingsGroup = "BackgroundStreams";
const char* BackgroundStreams::kHypnotoadUrl = "hypnotoad:///";
const char* BackgroundStreams::kRainUrl = "http://data.clementine-player.org/rainymood";
const char* BackgroundStreams::kEnterpriseUrl = "enterprise:///";
BackgroundStreams::BackgroundStreams(EngineBase* engine, QObject* parent)
: QObject(parent),
@ -25,12 +26,14 @@ void BackgroundStreams::LoadStreams() {
s.beginGroup(kSettingsGroup);
int version = s.value("version", 0).toInt();
if (version < kVersion) {
s.setValue("version", kVersion);
if (version < 1) {
AddStream(QT_TR_NOOP("Hypnotoad"), QUrl(kHypnotoadUrl));
AddStream(QT_TR_NOOP("Rain"), QUrl(kRainUrl));
SaveStreams();
return;
}
if (version < kVersion) {
s.setValue("version", kVersion);
AddStream(QT_TR_NOOP("Make it so!"), QUrl(kEnterpriseUrl));
}
int size = s.beginReadArray("streams");
@ -41,6 +44,8 @@ void BackgroundStreams::LoadStreams() {
s.value("volume").toInt(),
s.value("enabled").toBool());
}
SaveStreams();
}
void BackgroundStreams::SaveStreams() {

View File

@ -59,10 +59,11 @@ class BackgroundStreams : public QObject {
QMap<QString, Stream*> streams_;
static const char* kSettingsGroup;
static const int kVersion = 1;
static const int kVersion = 2;
static const char* kHypnotoadUrl;
static const char* kRainUrl;
static const char* kEnterpriseUrl;
};
#endif

View File

@ -56,13 +56,16 @@ using boost::shared_ptr;
const char* GstEngine::kSettingsGroup = "GstEngine";
const char* GstEngine::kAutoSink = "autoaudiosink";
const char* GstEngine::kHypnotoadPipeline =
const char* GstEngine::kHypnotoadPipeline =
"audiotestsrc wave=6 ! "
"audioecho intensity=1 delay=50000000 ! "
"audioecho intensity=1 delay=25000000 ! "
"equalizer-10bands "
"band0=-24 band1=-3 band2=7.5 band3=12 band4=8 "
"band5=6 band6=5 band7=6 band8=0 band9=-24";
const char* GstEngine::kEnterprisePipeline =
"audiotestsrc wave=5 ! "
"audiocheblimit mode=0 cutoff=120";
GstEngine::GstEngine()
: Engine::Base(),
@ -700,6 +703,11 @@ shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline(const QUrl& url,
return ret;
}
if (url.scheme() == "enterprise") {
ret->InitFromString(kEnterprisePipeline);
return ret;
}
if (!ret->InitFromUrl(url, end_nanosec))
ret.reset();

View File

@ -153,6 +153,7 @@ class GstEngine : public Engine::Base, public BufferConsumer {
static const int kSeekDelayNanosec = 100 * kNsecPerMsec; // 100msec
static const char* kHypnotoadPipeline;
static const char* kEnterprisePipeline;
QFuture<void> initialising_;

View File

@ -371,6 +371,7 @@ MainWindow::MainWindow(
background_streams_->AddAction("Rain", ui_->action_rain);
background_streams_->AddAction("Hypnotoad", ui_->action_hypnotoad);
background_streams_->AddAction("Make it so!", ui_->action_enterprise);
// Playlist view actions
ui_->action_next_playlist->setShortcuts(QList<QKeySequence>()

View File

@ -474,6 +474,7 @@
</property>
<addaction name="action_rain"/>
<addaction name="action_hypnotoad"/>
<addaction name="action_enterprise"/>
<addaction name="action_kittens"/>
<addaction name="separator"/>
</widget>
@ -687,6 +688,14 @@
<string comment="Label for button to enable/disable Hypnotoad background sound.">All Glory to the Hypnotoad!</string>
</property>
</action>
<action name="action_enterprise">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string comment="Label for button to enable/disable Enterprise background sound.">Make it so!</string>
</property>
</action>
<action name="action_kittens">
<property name="checkable">
<bool>true</bool>