Few style fixes + avoid unneeded copies

This commit is contained in:
Arnaud Bienner 2014-02-12 22:11:28 +01:00
parent 858cfce9ff
commit faaa75cb61
6 changed files with 16 additions and 7 deletions

View File

@ -1125,7 +1125,7 @@ QList<QAction*> GroovesharkService::playlistitem_actions(const Song& song) {
QAction* add_to_playlists = new QAction(
IconLoader::Load("list-add"), tr("Add to Grooveshark playlists"), this);
QMenu* playlists_menu = new QMenu();
for (PlaylistInfo playlist_info : playlists_.values()) {
for (const PlaylistInfo& playlist_info : playlists_.values()) {
QAction* add_to_playlist = new QAction(playlist_info.name_, this);
add_to_playlist->setData(playlist_info.id_);
playlists_menu->addAction(add_to_playlist);

View File

@ -52,7 +52,9 @@ QStandardItem* SavedRadio::CreateRootItem() {
void SavedRadio::LazyPopulate(QStandardItem* item) {
switch (item->data(InternetModel::Role_Type).toInt()) {
case InternetModel::Type_Service:
for (const Stream& stream : streams_) AddStreamToList(stream, root_);
for (const Stream& stream : streams_) {
AddStreamToList(stream, root_);
}
break;

View File

@ -66,11 +66,15 @@ QString About::MakeHtml() const {
"<p><a href=\"%1\">%2</a></p>"
"<p><b>%3:</b>").arg(kUrl, kUrl, tr("Authors"));
for (const Person& person : authors_) ret += "<br />" + MakeHtml(person);
for (const Person& person : authors_) {
ret += "<br />" + MakeHtml(person);
}
ret += QString("</p><p><b>%3:</b>").arg(tr("Thanks to"));
for (const Person& person : thanks_to_) ret += "<br />" + MakeHtml(person);
for (const Person& person : thanks_to_) {
ret += "<br />" + MakeHtml(person);
}
ret += QString(
"<br />" + tr("All the translators") +
" &lt;<a href=\"https://www.transifex.net/projects/p/clementine\">"

View File

@ -1639,7 +1639,7 @@ void MainWindow::PlaylistRightClick(const QPoint& global_pos,
QMenu* add_to_another_menu = new QMenu(tr("Add to another playlist"), this);
add_to_another_menu->setIcon(IconLoader::Load("list-add"));
for (PlaylistBackend::Playlist playlist :
for (const PlaylistBackend::Playlist& playlist :
app_->playlist_backend()->GetAllOpenPlaylists()) {
// don't add the current playlist
if (playlist.id != app_->playlist_manager()->current()->id()) {

View File

@ -171,9 +171,10 @@ void FreeSpaceBar::DrawText(QPainter* p, const QRect& r) {
labels << Label(TextForSize(free_text_, free_ - additional_), kColorBg2);
int text_width = 0;
for (const Label& label : labels)
for (const Label& label : labels) {
text_width += kLabelBoxSize + kLabelBoxPadding + kLabelSpacing +
small_metrics.width(label.text);
}
// Draw the text
int x = (r.width() - text_width) / 2;

View File

@ -108,7 +108,9 @@ void StyleHelper::setBaseColor(const QColor& newcolor) {
if (color.isValid() && color != m_baseColor) {
m_baseColor = color;
for (QWidget* w : QApplication::topLevelWidgets()) w->update();
for (QWidget* w : QApplication::topLevelWidgets()) {
w->update();
}
}
}