Formatting

This commit is contained in:
Jonas Kvinge 2022-03-22 21:09:05 +01:00
parent 8cb4e75f70
commit f6b70fda71
106 changed files with 446 additions and 479 deletions

View File

@ -85,7 +85,6 @@ void GLog(const char *domain, int level, const char *message, void*) {
qLogCat(Debug, domain) << message; qLogCat(Debug, domain) << message;
break; break;
} }
} }
template<class T> template<class T>

View File

@ -174,7 +174,6 @@ WorkerPool<HandlerType>::WorkerPool(QObject *parent)
if (local_server_name_.isEmpty()) { if (local_server_name_.isEmpty()) {
local_server_name_ = "workerpool"; local_server_name_ = "workerpool";
} }
} }
template<typename HandlerType> template<typename HandlerType>
@ -205,7 +204,6 @@ WorkerPool<HandlerType>::~WorkerPool() {
for (ReplyType *reply : message_queue_) { for (ReplyType *reply : message_queue_) {
reply->Abort(); reply->Abort();
} }
} }
template<typename HandlerType> template<typename HandlerType>
@ -267,7 +265,6 @@ void WorkerPool<HandlerType>::DoStart() {
workers_ << worker; workers_ << worker;
} }
} }
template<typename HandlerType> template<typename HandlerType>
@ -311,7 +308,6 @@ void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
#endif #endif
worker->process_->start(executable_path_, QStringList() << worker->local_server_->fullServerName()); worker->process_->start(executable_path_, QStringList() << worker->local_server_->fullServerName());
} }
template<typename HandlerType> template<typename HandlerType>
@ -339,7 +335,6 @@ void WorkerPool<HandlerType>::NewConnection() {
worker->handler_ = new HandlerType(worker->local_socket_, this); worker->handler_ = new HandlerType(worker->local_socket_, this);
SendQueuedMessages(); SendQueuedMessages();
} }
template<typename HandlerType> template<typename HandlerType>
@ -367,7 +362,6 @@ void WorkerPool<HandlerType>::ProcessError(QProcess::ProcessError error) {
StartOneWorker(worker); StartOneWorker(worker);
break; break;
} }
} }
template<typename HandlerType> template<typename HandlerType>
@ -380,7 +374,6 @@ void WorkerPool<HandlerType>::ProcessReadyReadStandardOutput() {
fprintf(stdout, "%s", data.data()); fprintf(stdout, "%s", data.data());
fflush(stdout); fflush(stdout);
} }
template<typename HandlerType> template<typename HandlerType>
@ -423,7 +416,6 @@ WorkerPool<HandlerType>::SendMessageWithReply(MessageType *message) {
QMetaObject::invokeMethod(this, "SendQueuedMessages", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "SendQueuedMessages", Qt::QueuedConnection);
return reply; return reply;
} }
template<typename HandlerType> template<typename HandlerType>
@ -445,7 +437,6 @@ void WorkerPool<HandlerType>::SendQueuedMessages() {
handler->SendRequest(reply); handler->SendRequest(reply);
} }
} }
template<typename HandlerType> template<typename HandlerType>

View File

@ -113,6 +113,7 @@ class TagLibFileRefFactory : public FileRefFactory {
return new TagLib::FileRef(QFile::encodeName(filename).constData()); return new TagLib::FileRef(QFile::encodeName(filename).constData());
#endif #endif
} }
private: private:
Q_DISABLE_COPY(TagLibFileRefFactory) Q_DISABLE_COPY(TagLibFileRefFactory)
}; };
@ -306,7 +307,9 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
if (!map["TCMP"].isEmpty()) compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed(); if (!map["TCMP"].isEmpty()) compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed();
if (!map["TDOR"].isEmpty()) { song->set_originalyear(map["TDOR"].front()->toString().substr(0, 4).toInt()); } if (!map["TDOR"].isEmpty()) {
song->set_originalyear(map["TDOR"].front()->toString().substr(0, 4).toInt());
}
else if (!map["TORY"].isEmpty()) { else if (!map["TORY"].isEmpty()) {
song->set_originalyear(map["TORY"].front()->toString().substr(0, 4).toInt()); song->set_originalyear(map["TORY"].front()->toString().substr(0, 4).toInt());
} }

View File

@ -96,7 +96,6 @@ class AnalyzerContainer : public QWidget {
Analyzer::Base *current_analyzer_; Analyzer::Base *current_analyzer_;
EngineBase *engine_; EngineBase *engine_;
}; };
template<typename T> template<typename T>

View File

@ -64,7 +64,6 @@ BlockAnalyzer::BlockAnalyzer(QWidget *parent)
// mxcl says null pixmaps cause crashes, so let's play it safe // mxcl says null pixmaps cause crashes, so let's play it safe
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1)); std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1));
} }
void BlockAnalyzer::resizeEvent(QResizeEvent *e) { void BlockAnalyzer::resizeEvent(QResizeEvent *e) {

View File

@ -142,6 +142,6 @@ class RainbowDashAnalyzer : public RainbowAnalyzer {
static const char *kName; static const char *kName;
}; };
} } // namespace Rainbow
#endif // RAINBOWANALYZER_H #endif // RAINBOWANALYZER_H

View File

@ -634,9 +634,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
added_songs << new_song; added_songs << new_song;
continue; continue;
} }
} }
// Create new song // Create new song

View File

@ -84,8 +84,7 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
"</span><span style=\"font-style:italic;\">" + "</span><span style=\"font-style:italic;\">" +
available_fields + available_fields +
QString("</span>.") + QString("</span>.") +
QString("</p></body></html>") QString("</p></body></html>"));
);
QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed); QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed);
QObject::connect(filter_delay_, &QTimer::timeout, this, &CollectionFilterWidget::FilterDelayTimeout); QObject::connect(filter_delay_, &QTimer::timeout, this, &CollectionFilterWidget::FilterDelayTimeout);
@ -186,7 +185,6 @@ void CollectionFilterWidget::Init(CollectionModel *model) {
} }
s.endGroup(); s.endGroup();
} }
} }
void CollectionFilterWidget::ReloadSettings() { void CollectionFilterWidget::ReloadSettings() {

View File

@ -2874,7 +2874,6 @@ void MainWindow::Raise() {
show(); show();
activateWindow(); activateWindow();
hidden_ = false; hidden_ = false;
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -2889,7 +2888,6 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
thumbbar_->HandleWinEvent(msg); thumbbar_->HandleWinEvent(msg);
} }
return QMainWindow::nativeEvent(eventType, message, result); return QMainWindow::nativeEvent(eventType, message, result);
} }
#endif // Q_OS_WIN #endif // Q_OS_WIN

View File

@ -131,7 +131,9 @@ Engine::EngineType Player::CreateEngine(Engine::EngineType enginetype) {
break; break;
#endif #endif
default: default:
if (i > 0) { qFatal("No engine available!"); } if (i > 0) {
qFatal("No engine available!");
}
enginetype = Engine::None; enginetype = Engine::None;
break; break;
} }
@ -167,7 +169,9 @@ void Player::Init() {
CreateEngine(enginetype); CreateEngine(enginetype);
} }
if (!engine_->Init()) { qFatal("Error initializing audio engine"); } if (!engine_->Init()) {
qFatal("Error initializing audio engine");
}
analyzer_->SetEngine(engine_.get()); analyzer_->SetEngine(engine_.get());

View File

@ -88,7 +88,6 @@ QModelIndex SimpleTreeModel<T>::index(int row, int, const QModelIndex &parent) c
return QModelIndex(); return QModelIndex();
return ItemToIndex(parent_item->children[row]); return ItemToIndex(parent_item->children[row]);
} }
template<typename T> template<typename T>

View File

@ -417,7 +417,6 @@ void StyleHelper::drawCornerImage(const QImage &img, QPainter *painter, const QR
painter->drawImage(QRectF(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img, QRectF(size.width() - rightDIP, size.height() - bottomDIP, rightDIP, bottomDIP)); painter->drawImage(QRectF(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img, QRectF(size.width() - rightDIP, size.height() - bottomDIP, rightDIP, bottomDIP));
} }
} }
} }
// Tints an image with tintColor, while preserving alpha and lightness // Tints an image with tintColor, while preserving alpha and lightness
@ -485,7 +484,6 @@ QList<int> StyleHelper::availableImageResolutions(const QString &fileName) {
} }
} }
return result; return result;
} }
} // namespace Utils } // namespace Utils

View File

@ -41,8 +41,7 @@ QT_END_NAMESPACE
// Helper class holding all custom color values // Helper class holding all custom color values
namespace Utils { namespace Utils {
class StyleHelper class StyleHelper {
{
public: public:
static const unsigned int DEFAULT_BASE_COLOR = 0x666666; static const unsigned int DEFAULT_BASE_COLOR = 0x666666;
static const int progressFadeAnimationDuration = 600; static const int progressFadeAnimationDuration = 600;

View File

@ -831,7 +831,6 @@ QString UnicodeToAscii(QString unicode) {
return ret; return ret;
#endif // _MSC_VER #endif // _MSC_VER
} }
QString MacAddress() { QString MacAddress() {
@ -1010,7 +1009,6 @@ HRGN toHRGN(const QRegion &region) {
return resultRgn; return resultRgn;
# endif // Qt 6 # endif // Qt 6
} }
void enableBlurBehindWindow(QWindow *window, const QRegion &region) { void enableBlurBehindWindow(QWindow *window, const QRegion &region) {

View File

@ -94,7 +94,6 @@ ITaskbarList3 *Windows7ThumbBar::CreateTaskbarList() {
} }
return taskbar_list; return taskbar_list;
} }
void Windows7ThumbBar::SetupButton(const QAction *action, THUMBBUTTON *button) { void Windows7ThumbBar::SetupButton(const QAction *action, THUMBBUTTON *button) {
@ -188,7 +187,6 @@ void Windows7ThumbBar::ActionChanged() {
button->iId = i; button->iId = i;
SetupButton(action, button); SetupButton(action, button);
} }
HRESULT hr = taskbar_list->ThumbBarUpdateButtons(reinterpret_cast<HWND>(widget_->winId()), actions_.count(), buttons); HRESULT hr = taskbar_list->ThumbBarUpdateButtons(reinterpret_cast<HWND>(widget_->winId()), actions_.count(), buttons);

View File

@ -111,7 +111,10 @@ void SpotifyCoverProvider::Authenticate() {
bool success = false; bool success = false;
forever { forever {
server_->set_port(port); server_->set_port(port);
if (server_->Listen()) { success = true; break; } if (server_->Listen()) {
success = true;
break;
}
++port; ++port;
if (port > port_max) break; if (port > port_max) break;
} }

View File

@ -50,7 +50,9 @@ class TidalCoverProvider : public JsonCoverProvider {
void CancelSearch(const int id) override; void CancelSearch(const int id) override;
bool IsAuthenticated() const override { return service_ && service_->authenticated(); } bool IsAuthenticated() const override { return service_ && service_->authenticated(); }
void Deauthenticate() override { if (service_) service_->Logout(); } void Deauthenticate() override {
if (service_) service_->Logout();
}
private slots: private slots:
void HandleSearchReply(QNetworkReply *reply, const int id); void HandleSearchReply(QNetworkReply *reply, const int id);

View File

@ -70,7 +70,6 @@ bool GioLister::DeviceInfo::is_suitable() const {
if (filesystem_type.isEmpty()) return true; if (filesystem_type.isEmpty()) return true;
return filesystem_type != "udf" && filesystem_type != "smb" && filesystem_type != "cifs" && filesystem_type != "ssh" && filesystem_type != "isofs"; return filesystem_type != "udf" && filesystem_type != "smb" && filesystem_type != "cifs" && filesystem_type != "ssh" && filesystem_type != "isofs";
} }
template<typename T, typename F> template<typename T, typename F>

View File

@ -94,14 +94,12 @@ bool Engine::Base::Play(const QUrl &stream_url, const QUrl &original_url, const
} }
return Play(offset_nanosec); return Play(offset_nanosec);
} }
void Engine::Base::SetVolume(const uint value) { void Engine::Base::SetVolume(const uint value) {
volume_ = value; volume_ = value;
SetVolumeSW(MakeVolumeLogarithmic(value)); SetVolumeSW(MakeVolumeLogarithmic(value));
} }
uint Engine::Base::MakeVolumeLogarithmic(const uint volume) { uint Engine::Base::MakeVolumeLogarithmic(const uint volume) {

View File

@ -384,7 +384,6 @@ bool Equalizer::Params::operator==(const Equalizer::Params &other) const {
if (gain[i] != other.gain[i]) return false; if (gain[i] != other.gain[i]) return false;
} }
return true; return true;
} }
bool Equalizer::Params::operator!=(const Equalizer::Params &other) const { bool Equalizer::Params::operator!=(const Equalizer::Params &other) const {

View File

@ -170,19 +170,16 @@ GlobalShortcutsManager::Shortcut GlobalShortcutsManager::AddShortcut(const QStri
bool GlobalShortcutsManager::IsKdeAvailable() { bool GlobalShortcutsManager::IsKdeAvailable() {
return GlobalShortcutsBackendKDE::IsKDEAvailable(); return GlobalShortcutsBackendKDE::IsKDEAvailable();
} }
bool GlobalShortcutsManager::IsGnomeAvailable() { bool GlobalShortcutsManager::IsGnomeAvailable() {
return GlobalShortcutsBackendGnome::IsGnomeAvailable(); return GlobalShortcutsBackendGnome::IsGnomeAvailable();
} }
bool GlobalShortcutsManager::IsMateAvailable() { bool GlobalShortcutsManager::IsMateAvailable() {
return GlobalShortcutsBackendMate::IsMateAvailable(); return GlobalShortcutsBackendMate::IsMateAvailable();
} }
#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS) #endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS)
@ -192,7 +189,6 @@ bool GlobalShortcutsManager::IsMateAvailable() {
bool GlobalShortcutsManager::IsX11Available() { bool GlobalShortcutsManager::IsX11Available() {
return GlobalShortcutsBackendX11::IsX11Available(); return GlobalShortcutsBackendX11::IsX11Available();
} }
#endif // HAVE_X11_GLOBALSHORTCUTS #endif // HAVE_X11_GLOBALSHORTCUTS

View File

@ -2168,7 +2168,6 @@ void Playlist::RemoveDeletedSongs() {
} }
removeRows(rows_to_remove); removeRows(rows_to_remove);
} }
namespace { namespace {

View File

@ -716,14 +716,12 @@ void QobuzService::SendSearch() {
search_request_->Search(search_id_, search_text_); search_request_->Search(search_id_, search_text_);
search_request_->Process(); search_request_->Process();
} }
void QobuzService::SearchResultsReceived(const int id, const SongMap &songs, const QString &error) { void QobuzService::SearchResultsReceived(const int id, const SongMap &songs, const QString &error) {
search_request_.reset(); search_request_.reset();
emit SearchResults(id, songs, error); emit SearchResults(id, songs, error);
} }
uint QobuzService::GetStreamURL(const QUrl &url, QString &error) { uint QobuzService::GetStreamURL(const QUrl &url, QString &error) {

View File

@ -193,7 +193,6 @@ void ScrobblingAPI20::Authenticate(const bool https) {
default: default:
break; break;
} }
} }
void ScrobblingAPI20::RedirectArrived() { void ScrobblingAPI20::RedirectArrived() {
@ -533,12 +532,13 @@ void ScrobblingAPI20::Scrobble(const Song &song) {
if (app_->scrobbler()->IsOffline()) return; if (app_->scrobbler()->IsOffline()) return;
if (!IsAuthenticated()) { if (!IsAuthenticated()) {
if (app_->scrobbler()->ShowErrorDialog()) { emit ErrorMessage(tr("Scrobbler %1 is not authenticated!").arg(name_)); } if (app_->scrobbler()->ShowErrorDialog()) {
emit ErrorMessage(tr("Scrobbler %1 is not authenticated!").arg(name_));
}
return; return;
} }
StartSubmit(true); StartSubmit(true);
} }
void ScrobblingAPI20::StartSubmit(const bool initial) { void ScrobblingAPI20::StartSubmit(const bool initial) {
@ -1016,8 +1016,9 @@ void ScrobblingAPI20::Error(const QString &error, const QVariant &debug) {
qLog(Error) << name_ << error; qLog(Error) << name_ << error;
if (debug.isValid()) qLog(Debug) << debug; if (debug.isValid()) qLog(Debug) << debug;
if (app_->scrobbler()->ShowErrorDialog()) { emit ErrorMessage(tr("Scrobbler %1 error: %2").arg(name_, error)); } if (app_->scrobbler()->ShowErrorDialog()) {
emit ErrorMessage(tr("Scrobbler %1 error: %2").arg(name_, error));
}
} }
QString ScrobblingAPI20::ErrorString(const ScrobbleErrorCode error) { QString ScrobblingAPI20::ErrorString(const ScrobbleErrorCode error) {

View File

@ -247,7 +247,6 @@ void SmartPlaylistsViewContainer::DeleteSmartPlaylistFromButton() {
if (ui_->view->selectionModel()->selectedIndexes().count() == 0) return; if (ui_->view->selectionModel()->selectedIndexes().count() == 0) return;
DeleteSmartPlaylist(ui_->view->selectionModel()->selectedIndexes().first()); DeleteSmartPlaylist(ui_->view->selectionModel()->selectedIndexes().first());
} }
void SmartPlaylistsViewContainer::NewSmartPlaylistFinished() { void SmartPlaylistsViewContainer::NewSmartPlaylistFinished() {
@ -256,7 +255,6 @@ void SmartPlaylistsViewContainer::NewSmartPlaylistFinished() {
if (!wizard) return; if (!wizard) return;
QObject::disconnect(wizard, &SmartPlaylistWizard::accepted, this, &SmartPlaylistsViewContainer::NewSmartPlaylistFinished); QObject::disconnect(wizard, &SmartPlaylistWizard::accepted, this, &SmartPlaylistsViewContainer::NewSmartPlaylistFinished);
model_->AddGenerator(wizard->CreateGenerator()); model_->AddGenerator(wizard->CreateGenerator());
} }
void SmartPlaylistsViewContainer::EditSmartPlaylistFinished() { void SmartPlaylistsViewContainer::EditSmartPlaylistFinished() {

View File

@ -38,7 +38,6 @@ BusyIndicator::BusyIndicator(const QString &text, QWidget *parent)
label_(nullptr) { label_(nullptr) {
Init(text); Init(text);
} }
BusyIndicator::BusyIndicator(QWidget *parent) BusyIndicator::BusyIndicator(QWidget *parent)
@ -47,7 +46,6 @@ BusyIndicator::BusyIndicator(QWidget *parent)
label_(nullptr) { label_(nullptr) {
Init(QString()); Init(QString());
} }
void BusyIndicator::Init(const QString &text) { void BusyIndicator::Init(const QString &text) {

View File

@ -346,7 +346,6 @@ class FancyTabBar : public QTabBar { // clazy:exclude=missing-qobject-macro
} }
} }
} }
}; };
class TabData : public QObject { // clazy:exclude=missing-qobject-macro class TabData : public QObject { // clazy:exclude=missing-qobject-macro

View File

@ -203,7 +203,6 @@ TextEdit::TextEdit(QWidget *parent)
QObject::connect(reset_button_, &QToolButton::clicked, this, &TextEdit::Reset); QObject::connect(reset_button_, &QToolButton::clicked, this, &TextEdit::Reset);
QObject::connect(this, &TextEdit::textChanged, [this]() { viewport()->update(); }); // To clear the hint QObject::connect(this, &TextEdit::textChanged, [this]() { viewport()->update(); }); // To clear the hint
} }
void TextEdit::paintEvent(QPaintEvent *e) { void TextEdit::paintEvent(QPaintEvent *e) {
@ -222,7 +221,6 @@ SpinBox::SpinBox(QWidget *parent)
ExtendedEditor(this, 14, false) { ExtendedEditor(this, 14, false) {
QObject::connect(reset_button_, &QToolButton::clicked, this, &SpinBox::Reset); QObject::connect(reset_button_, &QToolButton::clicked, this, &SpinBox::Reset);
} }
void SpinBox::paintEvent(QPaintEvent *e) { void SpinBox::paintEvent(QPaintEvent *e) {
@ -239,7 +237,6 @@ CheckBox::CheckBox(QWidget *parent)
: QCheckBox(parent), ExtendedEditor(this, 14, false) { : QCheckBox(parent), ExtendedEditor(this, 14, false) {
QObject::connect(reset_button_, &QToolButton::clicked, this, &CheckBox::Reset); QObject::connect(reset_button_, &QToolButton::clicked, this, &CheckBox::Reset);
} }
void CheckBox::paintEvent(QPaintEvent *e) { void CheckBox::paintEvent(QPaintEvent *e) {
@ -258,7 +255,6 @@ QString SpinBox::textFromValue(int val) const {
return "-"; return "-";
} }
return QSpinBox::textFromValue(val); return QSpinBox::textFromValue(val);
} }
RatingBox::RatingBox(QWidget *parent) RatingBox::RatingBox(QWidget *parent)
@ -267,5 +263,4 @@ RatingBox::RatingBox(QWidget *parent)
clear_button_->hide(); clear_button_->hide();
reset_button_->hide(); reset_button_->hide();
} }

View File

@ -318,7 +318,9 @@ void PlayingWidget::SetImage(const QImage &image) {
DrawContents(&p); DrawContents(&p);
p.end(); p.end();
} }
else { pixmap_previous_track_ = QPixmap(); } else {
pixmap_previous_track_ = QPixmap();
}
image_original_ = image; image_original_ = image;
UpdateDetailsText(); UpdateDetailsText();

View File

@ -80,7 +80,6 @@ QRect RatingPainter::Contents(const QRect rect) {
const int x = rect.x() + (rect.width() - width) / 2; const int x = rect.x() + (rect.width() - width) / 2;
return QRect(x, rect.y(), width, rect.height()); return QRect(x, rect.y(), width, rect.height());
} }
float RatingPainter::RatingForPos(const QPoint pos, const QRect rect) { float RatingPainter::RatingForPos(const QPoint pos, const QRect rect) {