Fix some warnings shown on start-up (#5679)
* Fix 'RGB parameters out of range' with psychedelic colors * Fix 'edit-find' icon name * BlockAnalyzer::drawBackground(): do not attempt to paint on a null background * Use qBound()
This commit is contained in:
parent
18d2e35bc6
commit
0b34586e52
|
@ -236,12 +236,16 @@ QColor Analyzer::Base::getPsychedelicColor(const Scope& scope,
|
|||
rgb[(i * 3) / sBarkBandCount] += pow(bands[i], 2);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
// bias colours for a threshold around normally amplified audio
|
||||
rgb[i] = qMin(255, (int)((sqrt(rgb[i]) * ampFactor) + bias));
|
||||
}
|
||||
// bias colours for a threshold around normally amplified audio
|
||||
rgb[0] = sqrt(rgb[0]) * ampFactor + bias;
|
||||
rgb[1] = sqrt(rgb[1]) * ampFactor + bias;
|
||||
rgb[2] = sqrt(rgb[2]) * ampFactor + bias;
|
||||
|
||||
return QColor::fromRgb(rgb[0], rgb[1], rgb[2]);
|
||||
const int r = qBound(0, static_cast<int>(rgb[0]), 255);
|
||||
const int g = qBound(0, static_cast<int>(rgb[1]), 255);
|
||||
const int b = qBound(0, static_cast<int>(rgb[2]), 255);
|
||||
|
||||
return QColor::fromRgb(r, g, b);
|
||||
}
|
||||
|
||||
void Analyzer::Base::polishEvent() {
|
||||
|
|
|
@ -398,6 +398,10 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
|
|||
}
|
||||
|
||||
void BlockAnalyzer::drawBackground() {
|
||||
if (background_.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QColor bg = palette().color(QPalette::Background);
|
||||
const QColor bgdark = bg.dark(112);
|
||||
|
||||
|
|
|
@ -64,15 +64,15 @@ AlbumCoverChoiceController::AlbumCoverChoiceController(QWidget* parent)
|
|||
tr("Save cover to disk..."), this);
|
||||
cover_from_url_ = new QAction(IconLoader::Load("download", IconLoader::Base),
|
||||
tr("Load cover from URL..."), this);
|
||||
search_for_cover_ = new QAction(IconLoader::Load("find", IconLoader::Base),
|
||||
tr("Search for album covers..."), this);
|
||||
search_for_cover_ =
|
||||
new QAction(IconLoader::Load("edit-find", IconLoader::Base),
|
||||
tr("Search for album covers..."), this);
|
||||
unset_cover_ = new QAction(IconLoader::Load("list-remove", IconLoader::Base),
|
||||
tr("Unset cover"), this);
|
||||
show_cover_ = new QAction(IconLoader::Load("zoom-in", IconLoader::Base),
|
||||
tr("Show fullsize..."), this);
|
||||
|
||||
search_cover_auto_ = new QAction(IconLoader::Load("find", IconLoader::Base),
|
||||
tr("Search automatically"), this);
|
||||
search_cover_auto_ = new QAction(tr("Search automatically"), this);
|
||||
search_cover_auto_->setCheckable(true);
|
||||
search_cover_auto_->setChecked(false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue