1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-31 11:35:24 +01:00

Fix formatting

This commit is contained in:
Jonas Kvinge 2019-11-10 15:16:39 +01:00
parent ba31c755ef
commit 344023e6dd
14 changed files with 49 additions and 44 deletions

View File

@ -96,13 +96,11 @@ template <typename T>
void AnalyzerContainer::AddAnalyzerType() {
int id = analyzer_types_.count();
analyzer_types_ << &T::staticMetaObject;
QAction* action =
context_menu_->addAction(tr(T::kName));
QAction* action = context_menu_->addAction(tr(T::kName));
group_->addAction(action);
action->setCheckable(true);
actions_ << action;
connect(action, &QAction::triggered, [this, id]() { ChangeAnalyzer(id); } );
connect(action, &QAction::triggered, [this, id]() { ChangeAnalyzer(id); });
}
#endif // ANALYZERS_ANALYZERCONTAINER_H_

View File

@ -108,10 +108,12 @@ void GlobalShortcuts::AddShortcut(const QString& id, const QString& name,
connect(shortcut.action, SIGNAL(triggered()), this, signal);
}
void GlobalShortcuts::AddRatingShortcut(const QString& id, const QString& name, int rating,
void GlobalShortcuts::AddRatingShortcut(const QString& id, const QString& name,
int rating,
const QKeySequence& default_key) {
Shortcut shortcut = AddShortcut(id, name, default_key);
connect(shortcut.action, &QAction::triggered, [this, rating]() { RateCurrentSong(rating); } );
connect(shortcut.action, &QAction::triggered,
[this, rating]() { RateCurrentSong(rating); });
}
GlobalShortcuts::Shortcut GlobalShortcuts::AddShortcut(

View File

@ -56,7 +56,8 @@ IcecastFilterWidget::IcecastFilterWidget(QWidget* parent)
void IcecastFilterWidget::AddAction(QActionGroup* group, QAction* action,
IcecastModel::SortMode mode) {
group->addAction(action);
connect(action, &QAction::triggered, [this, mode]() { SortModeChanged(mode); } );
connect(action, &QAction::triggered,
[this, mode]() { SortModeChanged(mode); });
}
IcecastFilterWidget::~IcecastFilterWidget() { delete ui_; }

View File

@ -233,9 +233,10 @@ void LibraryFilterWidget::SetLibraryModel(LibraryModel* model) {
connect(group_by_dialog_.get(), SIGNAL(Accepted(LibraryModel::Grouping)),
model_, SLOT(SetGroupBy(LibraryModel::Grouping)));
for (QAction *action : filter_ages_.keys()) {
for (QAction* action : filter_ages_.keys()) {
int age = filter_ages_[action];
connect(action, &QAction::triggered, [this, age]() { model_->SetFilterAge(age); } );
connect(action, &QAction::triggered,
[this, age]() { model_->SetFilterAge(age); });
}
// Load settings

View File

@ -20,8 +20,8 @@
#include <memory>
#include <QWidget>
#include <QMap>
#include <QWidget>
#include "librarymodel.h"
#include "savedgroupingmanager.h"

View File

@ -112,8 +112,8 @@ void PlaylistHeader::AddColumnAction(int index) {
action->setChecked(!isSectionHidden(index));
show_actions_ << action;
connect(action, &QAction::triggered, [this, index]() { ToggleVisible(index); } );
connect(action, &QAction::triggered,
[this, index]() { ToggleVisible(index); });
}
void PlaylistHeader::HideCurrent() {

View File

@ -121,7 +121,8 @@ void Wizard::AddPlugin(WizardPlugin* plugin) {
type_page_->layout()->addWidget(radio_button);
type_page_->layout()->addWidget(description);
connect(radio_button, &QRadioButton::clicked, [this, index]() { TypeChanged(index); } );
connect(radio_button, &QRadioButton::clicked,
[this, index]() { TypeChanged(index); });
if (index == 0) {
radio_button->setChecked(true);

View File

@ -45,7 +45,7 @@ int SongInfoFetcher::FetchInfo(const Song& metadata) {
timeout_timers_[id]->setInterval(timeout_duration_);
timeout_timers_[id]->start();
connect(timeout_timers_[id], &QTimer::timeout, [this, id]() { Timeout(id); } );
connect(timeout_timers_[id], &QTimer::timeout, [this, id]() { Timeout(id); });
for (SongInfoProvider* provider : providers_) {
if (provider->is_enabled()) {
@ -85,7 +85,6 @@ void SongInfoFetcher::ProviderFinished(int id) {
}
void SongInfoFetcher::Timeout(int id) {
if (!results_.contains(id)) return;
if (!waiting_for_.contains(id)) return;

View File

@ -100,7 +100,7 @@ OrganiseDialog::OrganiseDialog(
for (const QString& title : tag_titles) {
QAction* action = tag_menu->addAction(title);
QString tag = tags[title];
connect(action, &QAction::triggered, [this, tag]() { InsertTag(tag); } );
connect(action, &QAction::triggered, [this, tag]() { InsertTag(tag); });
}
ui_->insert->setMenu(tag_menu);

View File

@ -102,14 +102,14 @@ void VisualisationContainer::Init() {
QMenu* fps_menu = menu_->addMenu(tr("Framerate"));
QActionGroup* fps_group = new QActionGroup(this);
AddFramerateMenuItem(tr("Low (%1 fps)").arg(kLowFramerate), kLowFramerate, fps_,
fps_group);
AddFramerateMenuItem(tr("Medium (%1 fps)").arg(kMediumFramerate), kMediumFramerate,
fps_, fps_group);
AddFramerateMenuItem(tr("High (%1 fps)").arg(kHighFramerate), kHighFramerate, fps_,
fps_group);
AddFramerateMenuItem(tr("Low (%1 fps)").arg(kLowFramerate), kLowFramerate,
fps_, fps_group);
AddFramerateMenuItem(tr("Medium (%1 fps)").arg(kMediumFramerate),
kMediumFramerate, fps_, fps_group);
AddFramerateMenuItem(tr("High (%1 fps)").arg(kHighFramerate), kHighFramerate,
fps_, fps_group);
AddFramerateMenuItem(tr("Super high (%1 fps)").arg(kSuperHighFramerate),
kSuperHighFramerate, fps_, fps_group);
kSuperHighFramerate, fps_, fps_group);
fps_menu->addActions(fps_group->actions());
QMenu* quality_menu = menu_->addMenu(tr("Quality", "Visualisation quality"));
@ -127,22 +127,21 @@ void VisualisationContainer::Init() {
tr("Close visualization"), this, SLOT(hide()));
}
void VisualisationContainer::AddFramerateMenuItem(const QString& name, int value, int def, QActionGroup* group) {
void VisualisationContainer::AddFramerateMenuItem(const QString& name,
int value, int def,
QActionGroup* group) {
QAction* action = group->addAction(name);
action->setCheckable(true);
action->setChecked(value == def);
connect(action, &QAction::triggered, [this, value]() { SetFps(value); } );
connect(action, &QAction::triggered, [this, value]() { SetFps(value); });
}
void VisualisationContainer::AddQualityMenuItem(const QString& name, int value, int def, QActionGroup* group) {
void VisualisationContainer::AddQualityMenuItem(const QString& name, int value,
int def, QActionGroup* group) {
QAction* action = group->addAction(name);
action->setCheckable(true);
action->setChecked(value == def);
connect(action, &QAction::triggered, [this, value]() { SetQuality(value); } );
connect(action, &QAction::triggered, [this, value]() { SetQuality(value); });
}
void VisualisationContainer::SetEngine(GstEngine* engine) {

View File

@ -73,8 +73,10 @@ class VisualisationContainer : public QGraphicsView {
void Init();
void SizeChanged();
void AddFramerateMenuItem(const QString& name, int value, int def, QActionGroup* group);
void AddQualityMenuItem(const QString& name, int value, int def, QActionGroup* group);
void AddFramerateMenuItem(const QString& name, int value, int def,
QActionGroup* group);
void AddQualityMenuItem(const QString& name, int value, int def,
QActionGroup* group);
private slots:
void ChangeOverlayOpacity(qreal value);

View File

@ -411,10 +411,11 @@ void FancyTabWidget::SetMode(FancyTabWidget::Mode mode) {
emit ModeChanged(mode);
}
void FancyTabWidget::addMenuItem(QActionGroup* group, const QString& text, Mode mode) {
void FancyTabWidget::addMenuItem(QActionGroup* group, const QString& text,
Mode mode) {
QAction* action = group->addAction(text);
action->setCheckable(true);
connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); } );
connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); });
if (mode == mode_) action->setChecked(true);
}

View File

@ -80,13 +80,12 @@ class FancyTabWidget : public QTabWidget {
void paintEvent(QPaintEvent *);
void contextMenuEvent(QContextMenuEvent* e);
private:
void addMenuItem(QActionGroup* group,
const QString& text, Mode mode);
void addMenuItem(QActionGroup* group, const QString& text, Mode mode);
QPixmap background_pixmap_;
QMenu* menu_;
Mode mode_;
QWidget *bottom_widget_;
QPixmap background_pixmap_;
QMenu* menu_;
Mode mode_;
QWidget* bottom_widget_;
};

View File

@ -94,8 +94,10 @@ NowPlayingWidget::NowPlayingWidget(QWidget* parent)
QActionGroup* mode_group = new QActionGroup(this);
CreateModeAction(SmallSongDetails, tr("Small album cover"), mode_group);
CreateModeAction(LargeSongDetails, tr("Large album cover"), mode_group);
CreateModeAction(LargeSongDetailsBelow, tr("Large album cover (details below)"), mode_group);
CreateModeAction(LargeNoSongDetails, tr("Large album cover (no details)"), mode_group);
CreateModeAction(LargeSongDetailsBelow,
tr("Large album cover (details below)"), mode_group);
CreateModeAction(LargeNoSongDetails, tr("Large album cover (no details)"),
mode_group);
menu_->addActions(mode_group->actions());
@ -182,7 +184,7 @@ void NowPlayingWidget::CreateModeAction(Mode mode, const QString& text,
QActionGroup* group) {
QAction* action = new QAction(text, group);
action->setCheckable(true);
connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); } );
connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); });
if (mode == mode_) action->setChecked(true);
}