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

Prettify nyan.

Add dark blue background and adjust rainbow placement.
This commit is contained in:
Tyler Rhodes 2011-06-23 13:21:08 +00:00
parent 623acc8bd1
commit 612260cc9d
4 changed files with 31 additions and 28 deletions

View File

@ -21,6 +21,7 @@
#include <cmath>
#include <QTimerEvent>
#include <QBrush>
const char* NyanCatAnalyzer::kName = "Nyan nyan nyan";
const float NyanCatAnalyzer::kPixelScale = 0.03f;
@ -30,7 +31,8 @@ NyanCatAnalyzer::NyanCatAnalyzer(QWidget* parent)
: Analyzer::Base(parent, 9),
cat_(":/nyancat.png"),
timer_id_(startTimer(kFrameIntervalMs)),
frame_(0)
frame_(0),
background_brush_(QColor(0x0f, 0x43, 0x73))
{
memset(history_, 0, sizeof(history_));
@ -79,24 +81,27 @@ void NyanCatAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s) {
}
// Create polylines for the rainbows.
const float px_per_frame = float(width()) / kHistorySize;
const float px_per_frame = float(width() - kCatWidth + kRainbowOverlap) / kHistorySize;
QPointF polyline[kRainbowBands * kHistorySize];
QPointF* dest = polyline;
float* source = history_;
const float top_of_cat = float(height())/2 - float(kCatHeight)/2;
for (int band=0 ; band<kRainbowBands ; ++band) {
// Calculate the Y position of this band.
const float y = float(height()) / (kRainbowBands + 2) * (band + 0.5);
const float y = float(kCatHeight) / (kRainbowBands + 2) * (band + 0.5) + top_of_cat;
const float band_scale = std::pow(2.0, band);
// Add each point in the line.
for (int x=0 ; x<kHistorySize ; ++x) {
for (int x=0 ; x<kHistorySize; ++x) {
*dest = QPointF(px_per_frame * x, y + *source * kPixelScale * band_scale);
++ dest;
++ source;
}
}
p.fillRect(rect(), background_brush_);
// Draw the rainbows
p.setRenderHint(QPainter::Antialiasing);
for (int band=kRainbowBands-1 ; band>=0 ; --band) {
@ -109,4 +114,5 @@ void NyanCatAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s) {
QRect cat_dest(width() - kCatWidth, (height() - kCatHeight) / 2,
kCatWidth, kCatHeight);
p.drawPixmap(cat_dest, cat_, CatSourceRect());
}

View File

@ -22,7 +22,6 @@
#include <QDateTime>
class NyanCatAnalyzer : public Analyzer::Base {
Q_OBJECT
@ -62,6 +61,8 @@ private:
float history_[kHistorySize * kRainbowBands];
QPen colors_[kRainbowBands];
QBrush background_brush_;
};
#endif // NYANCATANALYZER_H

View File

@ -11,10 +11,10 @@ msgstr ""
"PO-Revision-Date: 2010-12-25 04:49+0000\n"
"Last-Translator: David Sansome <me@davidsansome.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"X-Launchpad-Export-Date: 2011-04-10 05:05+0000\n"
"X-Generator: Launchpad (build 12735)\n"
@ -85,15 +85,15 @@ msgstr ""
msgid "%L1 total plays"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "%n failed"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "%n finished"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "%n remaining"
msgstr ""
@ -770,6 +770,10 @@ msgstr ""
msgid "Cover art set from %1"
msgstr ""
#, qt-format
msgid "Covers from %1"
msgstr ""
msgid "Cross-fade when changing tracks automatically"
msgstr ""
@ -1744,9 +1748,6 @@ msgstr ""
msgid "Most played"
msgstr ""
msgid "Mount point"
msgstr ""
msgid "Mount points"
msgstr ""
@ -2858,9 +2859,6 @@ msgstr ""
msgid "Turn off"
msgstr ""
msgid "URI"
msgstr ""
msgid "URL(s)"
msgstr ""
@ -3134,7 +3132,7 @@ msgstr ""
msgid "Zero"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "add %n songs"
msgstr ""
@ -3223,7 +3221,7 @@ msgstr ""
msgid "press enter"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "remove %n songs"
msgstr ""

View File

@ -75,15 +75,15 @@ msgstr ""
msgid "%L1 total plays"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "%n failed"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "%n finished"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "%n remaining"
msgstr ""
@ -760,6 +760,10 @@ msgstr ""
msgid "Cover art set from %1"
msgstr ""
#, qt-format
msgid "Covers from %1"
msgstr ""
msgid "Cross-fade when changing tracks automatically"
msgstr ""
@ -1734,9 +1738,6 @@ msgstr ""
msgid "Most played"
msgstr ""
msgid "Mount point"
msgstr ""
msgid "Mount points"
msgstr ""
@ -2848,9 +2849,6 @@ msgstr ""
msgid "Turn off"
msgstr ""
msgid "URI"
msgstr ""
msgid "URL(s)"
msgstr ""
@ -3124,7 +3122,7 @@ msgstr ""
msgid "Zero"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "add %n songs"
msgstr ""
@ -3213,7 +3211,7 @@ msgstr ""
msgid "press enter"
msgstr ""
#, c-format, qt-plural-format
#, c-format
msgid "remove %n songs"
msgstr ""