remove magic numbers
This commit is contained in:
parent
29b8d308b3
commit
b6bf54be6c
|
@ -35,9 +35,9 @@ CurrentArtLoader::CurrentArtLoader(Application* app, QObject* parent)
|
||||||
id_(0) {
|
id_(0) {
|
||||||
options_.scale_output_image_ = false;
|
options_.scale_output_image_ = false;
|
||||||
options_.pad_output_image_ = false;
|
options_.pad_output_image_ = false;
|
||||||
options_.default_output_image_ = IconLoader::Load("nocover",
|
QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
|
||||||
IconLoader::Other)
|
options_.default_output_image_ = nocover.pixmap(nocover.availableSizes()
|
||||||
.pixmap(300).toImage();
|
.last()).toImage();
|
||||||
|
|
||||||
connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)),
|
connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)),
|
||||||
SLOT(TempArtLoaded(quint64, QImage)));
|
SLOT(TempArtLoaded(quint64, QImage)));
|
||||||
|
|
|
@ -33,8 +33,9 @@ GlobalSearchModel::GlobalSearchModel(GlobalSearch* engine, QObject* parent)
|
||||||
group_by_[1] = LibraryModel::GroupBy_Album;
|
group_by_[1] = LibraryModel::GroupBy_Album;
|
||||||
group_by_[2] = LibraryModel::GroupBy_None;
|
group_by_[2] = LibraryModel::GroupBy_None;
|
||||||
|
|
||||||
no_cover_icon_ = QPixmap(IconLoader::Load("nocover", IconLoader::Other)
|
QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
|
||||||
.pixmap(300)).scaled(LibraryModel::kPrettyCoverSize,
|
no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()).scaled(
|
||||||
|
LibraryModel::kPrettyCoverSize,
|
||||||
LibraryModel::kPrettyCoverSize,
|
LibraryModel::kPrettyCoverSize,
|
||||||
Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,9 +107,10 @@ LibraryModel::LibraryModel(LibraryBackend* backend, Application* app,
|
||||||
Utilities::GetConfigPath(Utilities::Path_CacheRoot) + "/pixmapcache");
|
Utilities::GetConfigPath(Utilities::Path_CacheRoot) + "/pixmapcache");
|
||||||
icon_cache_->setMaximumCacheSize(LibraryModel::kIconCacheSize);
|
icon_cache_->setMaximumCacheSize(LibraryModel::kIconCacheSize);
|
||||||
|
|
||||||
no_cover_icon_ = QPixmap(IconLoader::Load("nocover", IconLoader::Other)
|
QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
|
||||||
.pixmap(300)).scaled(kPrettyCoverSize,
|
no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()).scaled(
|
||||||
kPrettyCoverSize, Qt::KeepAspectRatio,
|
kPrettyCoverSize, kPrettyCoverSize,
|
||||||
|
Qt::KeepAspectRatio,
|
||||||
Qt::SmoothTransformation);
|
Qt::SmoothTransformation);
|
||||||
|
|
||||||
connect(backend_, SIGNAL(SongsDiscovered(SongList)),
|
connect(backend_, SIGNAL(SongsDiscovered(SongList)),
|
||||||
|
|
|
@ -173,10 +173,10 @@ LibraryView::LibraryView(QWidget* parent)
|
||||||
app_(nullptr),
|
app_(nullptr),
|
||||||
filter_(nullptr),
|
filter_(nullptr),
|
||||||
total_song_count_(-1),
|
total_song_count_(-1),
|
||||||
nomusic_(IconLoader::Load("nocover",
|
|
||||||
IconLoader::Other).pixmap(300)),
|
|
||||||
context_menu_(nullptr),
|
context_menu_(nullptr),
|
||||||
is_in_keyboard_search_(false) {
|
is_in_keyboard_search_(false) {
|
||||||
|
QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
|
||||||
|
nomusic_ = nocover.pixmap(nocover.availableSizes().last());
|
||||||
setItemDelegate(new LibraryItemDelegate(this));
|
setItemDelegate(new LibraryItemDelegate(this));
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
setHeaderHidden(true);
|
setHeaderHidden(true);
|
||||||
|
|
|
@ -128,10 +128,6 @@ PlaylistView::PlaylistView(QWidget* parent)
|
||||||
inhibit_autoscroll_(false),
|
inhibit_autoscroll_(false),
|
||||||
currently_autoscrolling_(false),
|
currently_autoscrolling_(false),
|
||||||
row_height_(-1),
|
row_height_(-1),
|
||||||
currenttrack_play_(IconLoader::Load("currenttrack_play",
|
|
||||||
IconLoader::Other).pixmap(16)),
|
|
||||||
currenttrack_pause_(IconLoader::Load("currenttrack_pause",
|
|
||||||
IconLoader::Other).pixmap(16)),
|
|
||||||
cached_current_row_row_(-1),
|
cached_current_row_row_(-1),
|
||||||
drop_indicator_row_(-1),
|
drop_indicator_row_(-1),
|
||||||
drag_over_(false),
|
drag_over_(false),
|
||||||
|
@ -141,6 +137,17 @@ PlaylistView::PlaylistView(QWidget* parent)
|
||||||
setStyle(style_);
|
setStyle(style_);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
|
QIcon currenttrack_play = IconLoader::Load("currenttrack_play",
|
||||||
|
IconLoader::Other);
|
||||||
|
currenttrack_play_ = currenttrack_play.pixmap(currenttrack_play
|
||||||
|
.availableSizes()
|
||||||
|
.last());
|
||||||
|
QIcon currenttrack_pause = IconLoader::Load("currenttrack_pause",
|
||||||
|
IconLoader::Other);
|
||||||
|
currenttrack_pause_ = currenttrack_pause.pixmap(currenttrack_pause
|
||||||
|
.availableSizes()
|
||||||
|
.last());
|
||||||
|
|
||||||
connect(header_, SIGNAL(sectionResized(int, int, int)), SLOT(SaveGeometry()));
|
connect(header_, SIGNAL(sectionResized(int, int, int)), SLOT(SaveGeometry()));
|
||||||
connect(header_, SIGNAL(sectionMoved(int, int, int)), SLOT(SaveGeometry()));
|
connect(header_, SIGNAL(sectionMoved(int, int, int)), SLOT(SaveGeometry()));
|
||||||
connect(header_, SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)),
|
connect(header_, SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)),
|
||||||
|
|
|
@ -89,8 +89,10 @@ AlbumCoverManager::AlbumCoverManager(Application* app,
|
||||||
album_cover_choice_controller_->SetApplication(app_);
|
album_cover_choice_controller_->SetApplication(app_);
|
||||||
|
|
||||||
// Get a square version of nocover.png
|
// Get a square version of nocover.png
|
||||||
QImage nocover(IconLoader::Load("nocover", IconLoader::Other).pixmap(300)
|
no_cover_icon_ = IconLoader::Load("nocover", IconLoader::Other);
|
||||||
.toImage());
|
no_cover_image_ = no_cover_icon_.pixmap(no_cover_icon_.availableSizes()
|
||||||
|
.last()).toImage();
|
||||||
|
QImage nocover(no_cover_image_);
|
||||||
nocover =
|
nocover =
|
||||||
nocover.scaled(120, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
nocover.scaled(120, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
QImage square_nocover(120, 120, QImage::Format_ARGB32);
|
QImage square_nocover(120, 120, QImage::Format_ARGB32);
|
||||||
|
@ -100,7 +102,6 @@ AlbumCoverManager::AlbumCoverManager(Application* app,
|
||||||
p.drawImage((120 - nocover.width()) / 2, (120 - nocover.height()) / 2,
|
p.drawImage((120 - nocover.width()) / 2, (120 - nocover.height()) / 2,
|
||||||
nocover);
|
nocover);
|
||||||
p.end();
|
p.end();
|
||||||
no_cover_icon_ = QPixmap::fromImage(square_nocover);
|
|
||||||
|
|
||||||
cover_searcher_ = new AlbumCoverSearcher(no_cover_icon_, app_, this);
|
cover_searcher_ = new AlbumCoverSearcher(no_cover_icon_, app_, this);
|
||||||
cover_export_ = new AlbumCoverExport(this);
|
cover_export_ = new AlbumCoverExport(this);
|
||||||
|
@ -601,8 +602,7 @@ void AlbumCoverManager::SaveCoverToFile() {
|
||||||
|
|
||||||
// load the image from disk
|
// load the image from disk
|
||||||
if (song.has_manually_unset_cover()) {
|
if (song.has_manually_unset_cover()) {
|
||||||
image = IconLoader::Load("nocover", IconLoader::Other).pixmap(300)
|
image = no_cover_image_;
|
||||||
.toImage();
|
|
||||||
} else {
|
} else {
|
||||||
if (!song.art_manual().isEmpty() && QFile::exists(song.art_manual())) {
|
if (!song.art_manual().isEmpty() && QFile::exists(song.art_manual())) {
|
||||||
image = QImage(song.art_manual());
|
image = QImage(song.art_manual());
|
||||||
|
@ -610,8 +610,7 @@ void AlbumCoverManager::SaveCoverToFile() {
|
||||||
QFile::exists(song.art_automatic())) {
|
QFile::exists(song.art_automatic())) {
|
||||||
image = QImage(song.art_automatic());
|
image = QImage(song.art_automatic());
|
||||||
} else {
|
} else {
|
||||||
image = IconLoader::Load("nocover", IconLoader::Other).pixmap(300)
|
image = no_cover_image_;
|
||||||
.toImage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,11 +61,11 @@ EditTagDialog::EditTagDialog(Application* app, QWidget* parent)
|
||||||
cover_art_id_(0),
|
cover_art_id_(0),
|
||||||
cover_art_is_set_(false),
|
cover_art_is_set_(false),
|
||||||
results_dialog_(new TrackSelectionDialog(this)) {
|
results_dialog_(new TrackSelectionDialog(this)) {
|
||||||
|
QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
|
||||||
cover_options_.default_output_image_ =
|
cover_options_.default_output_image_ =
|
||||||
AlbumCoverLoader::ScaleAndPad(cover_options_,
|
AlbumCoverLoader::ScaleAndPad(cover_options_,
|
||||||
IconLoader::Load("nocover",
|
nocover.pixmap(nocover.availableSizes().last())
|
||||||
IconLoader::Other).pixmap(300)
|
.toImage());
|
||||||
.toImage());
|
|
||||||
|
|
||||||
connect(app_->album_cover_loader(),
|
connect(app_->album_cover_loader(),
|
||||||
SIGNAL(ImageLoaded(quint64, QImage, QImage)),
|
SIGNAL(ImageLoaded(quint64, QImage, QImage)),
|
||||||
|
|
|
@ -34,9 +34,10 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog)
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
setWindowIcon(IconLoader::Load("help-hint", IconLoader::Base));
|
setWindowIcon(IconLoader::Load("help-hint", IconLoader::Base));
|
||||||
|
|
||||||
|
QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
|
||||||
pretty_popup_->SetMessage(tr("OSD Preview"), tr("Drag to reposition"),
|
pretty_popup_->SetMessage(tr("OSD Preview"), tr("Drag to reposition"),
|
||||||
IconLoader::Load("nocover", IconLoader::Other)
|
nocover.pixmap(nocover.availableSizes().last())
|
||||||
.pixmap(300).toImage());
|
.toImage());
|
||||||
|
|
||||||
ui_->notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue),
|
ui_->notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue),
|
||||||
Qt::DecorationRole);
|
Qt::DecorationRole);
|
||||||
|
|
|
@ -32,11 +32,12 @@
|
||||||
|
|
||||||
SystemTrayIcon::SystemTrayIcon(QObject* parent)
|
SystemTrayIcon::SystemTrayIcon(QObject* parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
percentage_(0),
|
percentage_(0) {
|
||||||
playing_icon_(IconLoader::Load("tiny-start",
|
QIcon tiny_start = IconLoader::Load("tiny-start", IconLoader::Other);
|
||||||
IconLoader::Other).pixmap(64)),
|
playing_icon_ = tiny_start.pixmap(tiny_start.availableSizes().last());
|
||||||
paused_icon_(IconLoader::Load("tiny-pause",
|
QIcon tiny_pause = IconLoader::Load("tiny-pause", IconLoader::Other);
|
||||||
IconLoader::Other).pixmap(64)) {}
|
paused_icon_ = tiny_pause.pixmap(tiny_pause.availableSizes().last());
|
||||||
|
}
|
||||||
|
|
||||||
QPixmap SystemTrayIcon::CreateIcon(const QPixmap& icon,
|
QPixmap SystemTrayIcon::CreateIcon(const QPixmap& icon,
|
||||||
const QPixmap& grey_icon) {
|
const QPixmap& grey_icon) {
|
||||||
|
|
|
@ -32,9 +32,12 @@ const int FavoriteWidget::kStarSize = 16;
|
||||||
FavoriteWidget::FavoriteWidget(int tab_index, bool favorite, QWidget* parent)
|
FavoriteWidget::FavoriteWidget(int tab_index, bool favorite, QWidget* parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
tab_index_(tab_index),
|
tab_index_(tab_index),
|
||||||
favorite_(favorite),
|
favorite_(favorite) {
|
||||||
on_(IconLoader::Load("star-on", IconLoader::Other).pixmap(16)),
|
QIcon star_on = IconLoader::Load("star-on", IconLoader::Other);
|
||||||
off_(IconLoader::Load("star-off", IconLoader::Other).pixmap(16)) {}
|
on_ = star_on.pixmap(star_on.availableSizes().last());
|
||||||
|
QIcon star_off = IconLoader::Load("star-off", IconLoader::Other);
|
||||||
|
off_ = star_off.pixmap(star_off.availableSizes().last());
|
||||||
|
}
|
||||||
|
|
||||||
void FavoriteWidget::SetFavorite(bool favorite) {
|
void FavoriteWidget::SetFavorite(bool favorite) {
|
||||||
if (favorite_ != favorite) {
|
if (favorite_ != favorite) {
|
||||||
|
|
|
@ -29,8 +29,10 @@ const int RatingPainter::kStarSize;
|
||||||
|
|
||||||
RatingPainter::RatingPainter() {
|
RatingPainter::RatingPainter() {
|
||||||
// Load the base pixmaps
|
// Load the base pixmaps
|
||||||
QPixmap on(IconLoader::Load("star-on", IconLoader::Other).pixmap(16));
|
QIcon star_on = IconLoader::Load("star-on", IconLoader::Other);
|
||||||
QPixmap off(IconLoader::Load("star-off", IconLoader::Other).pixmap(16));
|
QPixmap on(star_on.pixmap(star_on.availableSizes().last()));
|
||||||
|
QIcon star_off = IconLoader::Load("star-off", IconLoader::Other);
|
||||||
|
QPixmap off(star_off.pixmap(star_off.availableSizes().last()));
|
||||||
|
|
||||||
// Generate the 10 states, better to do it now than on the fly
|
// Generate the 10 states, better to do it now than on the fly
|
||||||
for (int i = 0; i < kStarCount * 2 + 1; ++i) {
|
for (int i = 0; i < kStarCount * 2 + 1; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue