From 341dc7326f075a2ae454dfe4548686ae0a7d01d4 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 18 Sep 2020 15:15:19 +0100 Subject: [PATCH] Reformat all C++ --- ext/clementine-spotifyblob/main.cpp | 6 +- ext/clementine-spotifyblob/mediapipeline.cpp | 5 +- .../spotify_utilities.mm | 12 +- ext/clementine-spotifyblob/spotifyclient.cpp | 11 +- ext/clementine-tagreader/main.cpp | 8 +- ext/clementine-tagreader/tagreaderworker.cpp | 12 +- ext/libclementine-common/core/logging.cpp | 22 +- .../core/messagehandler.cpp | 5 +- .../core/scoped_nsautorelease_pool.mm | 4 +- ext/libclementine-tagreader/cloudstream.cpp | 8 +- ext/libclementine-tagreader/fmpsparser.cpp | 3 +- ext/libclementine-tagreader/gmereader.cpp | 8 +- src/analyzers/analyzerbase.cpp | 11 +- src/analyzers/analyzerbase.h | 11 +- src/analyzers/analyzercontainer.cpp | 20 +- src/analyzers/analyzercontainer.h | 4 +- src/analyzers/baranalyzer.cpp | 16 +- src/analyzers/baranalyzer.h | 2 +- src/analyzers/blockanalyzer.cpp | 7 +- src/analyzers/blockanalyzer.h | 3 +- src/analyzers/boomanalyzer.cpp | 3 +- src/analyzers/fht.cpp | 5 +- src/analyzers/fht.h | 10 +- src/analyzers/glanalyzer.cpp | 11 +- src/analyzers/glanalyzer2.cpp | 17 +- src/analyzers/glanalyzer2.h | 5 +- src/analyzers/glanalyzer3.cpp | 18 +- src/analyzers/glanalyzer3.h | 7 +- src/analyzers/rainbowanalyzer.cpp | 3 +- src/analyzers/rainbowanalyzer.h | 33 +- src/analyzers/turbine.cpp | 6 +- src/core/application.cpp | 8 +- src/core/application.h | 5 +- src/core/cachedlist.h | 3 +- src/core/commandlineoptions.cpp | 18 +- src/core/commandlineoptions.h | 2 +- src/core/crashreporting.cpp | 24 +- src/core/crashreporting.h | 3 +- src/core/database.cpp | 57 +- src/core/database.h | 4 +- src/core/deletefiles.cpp | 2 +- src/core/deletefiles.h | 3 +- src/core/filesystemmusicstorage.cpp | 5 +- src/core/globalshortcuts.cpp | 14 +- src/core/globalshortcuts.h | 2 +- src/core/gnomeglobalshortcutbackend.cpp | 5 +- .../kglobalaccelglobalshortcutbackend.cpp | 3 +- src/core/kglobalaccelglobalshortcutbackend.h | 6 +- src/core/mac_delegate.h | 14 +- src/core/mac_startup.mm | 72 +-- src/core/mac_utilities.h | 6 +- src/core/macfslistener.mm | 21 +- src/core/macglobalshortcutbackend.h | 5 +- src/core/macglobalshortcutbackend.mm | 39 +- src/core/mergedproxymodel.cpp | 36 +- src/core/mergedproxymodel.h | 3 +- src/core/metatypes.cpp | 1 + src/core/mpris.cpp | 1 + src/core/mpris2.cpp | 12 +- src/core/mpris2.h | 2 +- src/core/multisortfilterproxy.cpp | 3 +- src/core/musicstorage.h | 5 +- src/core/network.cpp | 2 +- src/core/networkproxyfactory.cpp | 6 +- src/core/networkproxyfactory.h | 6 +- src/core/organise.cpp | 20 +- src/core/organise.h | 8 +- src/core/organiseformat.h | 2 +- src/core/player.cpp | 10 +- src/core/player.h | 5 +- src/core/qtfslistener.h | 4 +- src/core/qxtglobalshortcutbackend.cpp | 7 +- src/core/scopedtransaction.cpp | 3 +- src/core/settingsprovider.h | 2 +- src/core/signalchecker.cpp | 2 +- src/core/simpletreeitem.h | 6 +- src/core/song.cpp | 3 +- src/core/songloader.cpp | 14 +- src/core/songloader.h | 9 +- src/core/stylesheetloader.cpp | 5 +- src/core/stylesheetloader.h | 6 +- src/core/tagreaderclient.cpp | 3 +- src/core/tagreaderclient.h | 8 +- src/core/thread.h | 1 + src/core/ubuntuunityhack.cpp | 13 +- src/core/utilities.cpp | 21 +- src/core/utilities.h | 5 +- src/covers/albumcoverexporter.cpp | 2 +- src/covers/albumcoverexporter.h | 8 +- src/covers/albumcoverfetcher.cpp | 3 +- src/covers/albumcoverfetcher.h | 4 +- src/covers/albumcoverfetchersearch.cpp | 17 +- src/covers/albumcoverfetchersearch.h | 4 +- src/covers/albumcoverloader.cpp | 9 +- src/covers/albumcoverloader.h | 13 +- src/covers/coverexportrunnable.cpp | 9 +- src/covers/coverexportrunnable.h | 6 +- src/covers/coverprovider.h | 4 +- src/covers/coverproviders.cpp | 3 +- src/covers/coversearchstatisticsdialog.cpp | 5 +- src/covers/currentartloader.cpp | 4 +- src/covers/currentartloader.h | 3 +- src/covers/discogscoverprovider.cpp | 4 +- src/covers/kittenloader.h | 4 +- src/covers/lastfmcoverprovider.cpp | 2 +- src/covers/lastfmcoverprovider.h | 6 +- src/covers/musicbrainzcoverprovider.cpp | 5 +- src/covers/musicbrainzcoverprovider.h | 4 +- src/dbus/metatypes.h | 2 +- src/devices/cddadevice.cpp | 20 +- src/devices/cddadevice.h | 2 +- src/devices/cddasongloader.cpp | 37 +- src/devices/cddasongloader.h | 10 +- src/devices/connecteddevice.cpp | 9 +- src/devices/connecteddevice.h | 5 +- src/devices/devicedatabasebackend.cpp | 14 +- src/devices/deviceinfo.cpp | 10 +- src/devices/deviceinfo.h | 3 +- src/devices/devicekitlister.cpp | 7 +- src/devices/devicekitlister.h | 3 +- src/devices/devicelister.cpp | 5 +- src/devices/devicelister.h | 2 +- src/devices/devicemanager.cpp | 13 +- src/devices/devicemanager.h | 11 +- src/devices/deviceproperties.cpp | 9 +- src/devices/devicestatefiltermodel.h | 2 +- src/devices/deviceview.cpp | 57 +- src/devices/deviceviewcontainer.cpp | 11 +- src/devices/filesystemdevice.cpp | 13 +- src/devices/giolister.cpp | 34 +- src/devices/giolister.h | 2 +- src/devices/gpoddevice.cpp | 15 +- src/devices/gpoddevice.h | 6 +- src/devices/gpodloader.cpp | 11 +- src/devices/gpodloader.h | 7 +- src/devices/macdevicelister.h | 8 +- src/devices/macdevicelister.mm | 266 ++++---- src/devices/mtpconnection.cpp | 5 +- src/devices/mtpconnection.h | 4 +- src/devices/mtpdevice.cpp | 15 +- src/devices/mtpdevice.h | 3 +- src/devices/mtploader.cpp | 2 +- src/devices/mtploader.h | 5 +- src/devices/udisks2lister.h | 3 +- src/engines/alsadevicefinder.cpp | 8 +- src/engines/devicefinder.cpp | 9 +- src/engines/devicefinder.h | 8 +- src/engines/directsounddevicefinder.cpp | 16 +- src/engines/directsounddevicefinder.h | 12 +- src/engines/engine_fwd.h | 2 +- src/engines/enginebase.cpp | 6 +- src/engines/enginebase.h | 7 +- src/engines/gstelementdeleter.h | 4 +- src/engines/gstengine.cpp | 36 +- src/engines/gstengine.h | 5 +- src/engines/gstenginepipeline.cpp | 21 +- src/engines/gstenginepipeline.h | 7 +- src/engines/osxdevicefinder.cpp | 39 +- src/engines/osxdevicefinder.h | 8 +- src/engines/pulsedevicefinder.cpp | 37 +- src/engines/pulsedevicefinder.h | 14 +- .../digitallyimportedsearchprovider.cpp | 1 + src/globalsearch/globalsearch.cpp | 24 +- src/globalsearch/globalsearch.h | 4 +- src/globalsearch/globalsearchitemdelegate.cpp | 1 + src/globalsearch/globalsearchmodel.cpp | 17 +- src/globalsearch/globalsearchmodel.h | 14 +- src/globalsearch/globalsearchsettingspage.cpp | 13 +- src/globalsearch/globalsearchsettingspage.h | 4 +- src/globalsearch/globalsearchsortmodel.cpp | 5 +- src/globalsearch/globalsearchview.cpp | 21 +- src/globalsearch/globalsearchview.h | 12 +- src/globalsearch/librarysearchprovider.cpp | 5 +- src/globalsearch/savedradiosearchprovider.cpp | 5 +- src/globalsearch/searchprovider.h | 2 +- .../searchproviderstatuswidget.cpp | 11 +- src/globalsearch/searchproviderstatuswidget.h | 3 +- src/globalsearch/simplesearchprovider.cpp | 1 + src/globalsearch/spotifysearchprovider.cpp | 2 +- src/globalsearch/suggestionwidget.cpp | 5 +- src/globalsearch/suggestionwidget.h | 2 +- src/globalsearch/urlsearchprovider.cpp | 5 +- src/globalsearch/urlsearchprovider.h | 4 +- src/internet/box/boxservice.cpp | 26 +- src/internet/box/boxservice.h | 4 +- src/internet/box/boxsettingspage.cpp | 4 +- src/internet/box/boxsettingspage.h | 4 +- src/internet/core/cloudfilesearchprovider.cpp | 1 + src/internet/core/cloudfileservice.cpp | 8 +- src/internet/core/cloudfileservice.h | 8 +- src/internet/core/geolocator.cpp | 12 +- src/internet/core/internetmimedata.h | 4 +- src/internet/core/internetmodel.cpp | 5 +- src/internet/core/internetplaylistitem.cpp | 6 +- src/internet/core/internetplaylistitem.h | 4 +- src/internet/core/internetservice.h | 4 +- .../core/internetshowsettingspage.cpp | 11 +- src/internet/core/internetshowsettingspage.h | 4 +- src/internet/core/internetsongmimedata.h | 3 +- src/internet/core/internetview.cpp | 2 +- src/internet/core/internetviewcontainer.cpp | 6 +- src/internet/core/internetviewcontainer.h | 2 +- src/internet/core/oauthenticator.cpp | 12 +- src/internet/core/searchboxwidget.cpp | 2 +- .../digitally/digitallyimportedclient.cpp | 24 +- .../digitally/digitallyimportedclient.h | 3 +- .../digitallyimportedservicebase.cpp | 3 +- .../digitallyimportedsettingspage.cpp | 4 +- .../digitally/digitallyimportedurlhandler.cpp | 4 +- src/internet/dropbox/dropboxservice.cpp | 12 +- src/internet/dropbox/dropboxservice.h | 5 +- src/internet/dropbox/dropboxsettingspage.cpp | 10 +- src/internet/dropbox/dropboxsettingspage.h | 4 +- src/internet/dropbox/dropboxurlhandler.h | 7 +- .../googledrive/googledriveclient.cpp | 13 +- .../googledrive/googledriveservice.cpp | 31 +- src/internet/googledrive/googledriveservice.h | 2 +- .../googledrive/googledrivesettingspage.cpp | 6 +- .../googledrive/googledrivesettingspage.h | 4 +- .../googledrive/googledriveurlhandler.h | 7 +- src/internet/icecast/icecastbackend.cpp | 16 +- src/internet/icecast/icecastbackend.h | 4 +- src/internet/icecast/icecastfilterwidget.cpp | 2 +- src/internet/icecast/icecastfilterwidget.h | 4 +- src/internet/icecast/icecastitem.h | 6 +- src/internet/icecast/icecastmodel.cpp | 3 +- src/internet/icecast/icecastservice.cpp | 10 +- src/internet/icecast/icecastservice.h | 5 +- .../intergalacticfm/intergalacticfmservice.h | 4 +- .../intergalacticfmurlhandler.cpp | 4 +- src/internet/internetradio/savedradio.cpp | 30 +- src/internet/internetradio/savedradio.h | 2 +- .../jamendo/jamendodynamicplaylist.cpp | 5 +- src/internet/jamendo/jamendoservice.cpp | 12 +- src/internet/jamendo/jamendoservice.h | 3 +- src/internet/lastfm/fixlastfm.h | 2 +- src/internet/lastfm/lastfmcompat.cpp | 6 +- src/internet/lastfm/lastfmcompat.h | 11 +- src/internet/lastfm/lastfmservice.cpp | 28 +- src/internet/lastfm/lastfmservice.h | 5 +- src/internet/lastfm/lastfmsettingspage.cpp | 6 +- .../magnatune/magnatunedownloaddialog.cpp | 16 +- .../magnatune/magnatunedownloaddialog.h | 6 +- .../magnatune/magnatuneplaylistitem.cpp | 1 + src/internet/magnatune/magnatuneservice.cpp | 45 +- src/internet/magnatune/magnatuneservice.h | 3 +- .../magnatune/magnatunesettingspage.cpp | 10 +- .../magnatune/magnatuneurlhandler.cpp | 3 +- src/internet/magnatune/magnatuneurlhandler.h | 4 +- src/internet/podcasts/addpodcastbyurl.cpp | 6 +- src/internet/podcasts/addpodcastdialog.cpp | 36 +- src/internet/podcasts/addpodcastdialog.h | 4 +- src/internet/podcasts/addpodcastpage.cpp | 1 + src/internet/podcasts/episodeinfowidget.cpp | 5 +- src/internet/podcasts/episodeinfowidget.h | 4 +- src/internet/podcasts/fixedopmlpage.cpp | 2 +- src/internet/podcasts/fixedopmlpage.h | 4 +- src/internet/podcasts/gpoddersearchpage.cpp | 6 +- src/internet/podcasts/gpoddersearchpage.h | 4 +- src/internet/podcasts/gpoddersync.cpp | 6 +- src/internet/podcasts/gpoddersync.h | 4 +- src/internet/podcasts/gpoddertoptagsmodel.cpp | 3 +- src/internet/podcasts/gpoddertoptagsmodel.h | 2 +- src/internet/podcasts/gpoddertoptagspage.cpp | 2 +- src/internet/podcasts/gpoddertoptagspage.h | 4 +- src/internet/podcasts/itunessearchpage.cpp | 13 +- src/internet/podcasts/podcast.cpp | 3 +- src/internet/podcasts/podcast.h | 4 +- src/internet/podcasts/podcastbackend.cpp | 63 +- src/internet/podcasts/podcastdeleter.cpp | 2 +- src/internet/podcasts/podcastdeleter.h | 8 +- src/internet/podcasts/podcastdiscoverymodel.h | 4 +- src/internet/podcasts/podcastdownloader.cpp | 25 +- src/internet/podcasts/podcastdownloader.h | 12 +- src/internet/podcasts/podcastepisode.cpp | 10 +- src/internet/podcasts/podcastepisode.h | 4 +- src/internet/podcasts/podcastinfodialog.cpp | 8 +- src/internet/podcasts/podcastinfowidget.cpp | 3 +- src/internet/podcasts/podcastinfowidget.h | 6 +- src/internet/podcasts/podcastparser.cpp | 24 +- src/internet/podcasts/podcastservice.cpp | 31 +- src/internet/podcasts/podcastservice.h | 10 +- src/internet/podcasts/podcastservicemodel.cpp | 3 +- src/internet/podcasts/podcastsettingspage.cpp | 4 +- src/internet/podcasts/podcasturlloader.cpp | 2 +- src/internet/seafile/seafileservice.cpp | 21 +- src/internet/seafile/seafileservice.h | 7 +- src/internet/seafile/seafilesettingspage.cpp | 6 +- src/internet/seafile/seafilesettingspage.h | 4 +- src/internet/seafile/seafiletree.cpp | 6 +- src/internet/seafile/seafiletree.h | 6 +- src/internet/seafile/seafileurlhandler.h | 7 +- src/internet/skydrive/skydriveservice.cpp | 18 +- src/internet/skydrive/skydriveservice.h | 4 +- .../skydrive/skydrivesettingspage.cpp | 6 +- src/internet/skydrive/skydrivesettingspage.h | 4 +- src/internet/skydrive/skydriveurlhandler.h | 7 +- src/internet/somafm/somafmservice.cpp | 23 +- src/internet/somafm/somafmservice.h | 2 +- src/internet/somafm/somafmurlhandler.cpp | 4 +- .../spotify/spotifyblobdownloader.cpp | 34 +- src/internet/spotify/spotifyblobdownloader.h | 2 +- src/internet/spotify/spotifyserver.cpp | 1 - src/internet/spotify/spotifyserver.h | 8 +- src/internet/spotify/spotifyservice.cpp | 10 +- src/internet/spotify/spotifyservice.h | 6 +- src/internet/spotify/spotifysettingspage.cpp | 6 +- .../subsonic/subsonicdynamicplaylist.cpp | 10 +- .../subsonic/subsonicdynamicplaylist.h | 12 +- src/internet/subsonic/subsonicservice.cpp | 65 +- src/internet/subsonic/subsonicservice.h | 8 +- .../subsonic/subsonicsettingspage.cpp | 2 +- src/internet/subsonic/subsonicsettingspage.h | 2 +- src/internet/subsonic/subsonicurlhandler.cpp | 3 +- src/internet/subsonic/subsonicurlhandler.h | 4 +- src/library/directory.h | 2 +- src/library/groupbydialog.cpp | 17 +- src/library/groupbydialog.h | 3 +- src/library/library.cpp | 14 +- src/library/library.h | 3 +- src/library/librarybackend.cpp | 178 +++--- src/library/librarybackend.h | 6 +- src/library/librarydirectorymodel.cpp | 5 +- src/library/librarydirectorymodel.h | 5 +- src/library/libraryfilterwidget.cpp | 23 +- src/library/libraryfilterwidget.h | 5 +- src/library/libraryitem.h | 2 +- src/library/librarymodel.cpp | 28 +- src/library/librarymodel.h | 13 +- src/library/libraryplaylistitem.cpp | 3 +- src/library/libraryplaylistitem.h | 2 +- src/library/libraryquery.cpp | 9 +- src/library/libraryquery.h | 4 +- src/library/librarysettingspage.cpp | 38 +- src/library/libraryview.cpp | 44 +- src/library/libraryview.h | 5 +- src/library/libraryviewcontainer.cpp | 3 +- src/library/librarywatcher.cpp | 38 +- src/library/librarywatcher.h | 6 +- src/library/savedgroupingmanager.cpp | 13 +- src/library/sqlrow.cpp | 3 +- src/mac/SBSystemPreferences.h | 99 ++- src/main.cpp | 58 +- src/moodbar/moodbarbuilder.cpp | 3 +- src/moodbar/moodbarbuilder.h | 2 +- src/moodbar/moodbarcontroller.cpp | 7 +- src/moodbar/moodbarcontroller.h | 2 +- src/moodbar/moodbaritemdelegate.cpp | 19 +- src/moodbar/moodbaritemdelegate.h | 4 +- src/moodbar/moodbarloader.cpp | 7 +- src/moodbar/moodbarpipeline.cpp | 10 +- src/moodbar/moodbarpipeline.h | 7 +- src/moodbar/moodbarproxystyle.cpp | 11 +- src/moodbar/moodbarproxystyle.h | 4 +- src/moodbar/moodbarrenderer.h | 2 +- src/musicbrainz/acoustidclient.cpp | 19 +- src/musicbrainz/acoustidclient.h | 2 +- src/musicbrainz/chromaprinter.cpp | 14 +- src/musicbrainz/chromaprinter.h | 2 +- src/musicbrainz/musicbrainzclient.cpp | 19 +- src/musicbrainz/musicbrainzclient.h | 13 +- src/musicbrainz/tagfetcher.cpp | 10 +- src/musicbrainz/tagfetcher.h | 8 +- src/networkremote/bonjour.mm | 22 +- src/networkremote/incomingdataparser.cpp | 20 +- src/networkremote/networkremote.cpp | 2 +- src/networkremote/networkremote.h | 3 +- src/networkremote/networkremotehelper.h | 2 +- src/networkremote/outgoingdatacreator.cpp | 18 +- src/networkremote/outgoingdatacreator.h | 24 +- src/networkremote/remoteclient.cpp | 9 +- src/networkremote/remoteclient.h | 7 +- src/networkremote/songsender.h | 8 +- src/networkremote/tinysvcmdns.cpp | 1 - src/networkremote/tinysvcmdns.h | 3 +- src/playlist/dbplaylistitem.cpp | 4 +- src/playlist/dynamicplaylistcontrols.cpp | 1 + src/playlist/dynamicplaylistcontrols.h | 2 +- src/playlist/playlist.cpp | 28 +- src/playlist/playlist.h | 8 +- src/playlist/playlistbackend.cpp | 29 +- src/playlist/playlistcontainer.cpp | 30 +- src/playlist/playlistcontainer.h | 4 +- src/playlist/playlistdelegates.cpp | 12 +- src/playlist/playlistdelegates.h | 10 +- src/playlist/playlistfilter.cpp | 3 +- src/playlist/playlistfilter.h | 3 +- src/playlist/playlistfilterparser.cpp | 5 +- src/playlist/playlistheader.cpp | 9 +- src/playlist/playlistheader.h | 3 +- src/playlist/playlistitem.cpp | 21 +- src/playlist/playlistitem.h | 3 +- src/playlist/playlistitemmimedata.h | 2 +- src/playlist/playlistlistcontainer.cpp | 100 +-- src/playlist/playlistlistcontainer.h | 7 +- src/playlist/playlistlistmodel.cpp | 6 +- src/playlist/playlistlistmodel.h | 3 +- src/playlist/playlistmanager.cpp | 27 +- src/playlist/playlistmanager.h | 2 +- src/playlist/playlistsaveoptionsdialog.cpp | 6 +- src/playlist/playlistsequence.cpp | 17 +- src/playlist/playlistsequence.h | 5 +- src/playlist/playlisttabbar.cpp | 19 +- src/playlist/playlisttabbar.h | 2 +- src/playlist/playlistundocommands.cpp | 3 +- src/playlist/playlistundocommands.h | 8 +- src/playlist/playlistview.cpp | 66 +- src/playlist/playlistview.h | 5 +- src/playlist/queue.cpp | 3 +- src/playlist/queue.h | 4 +- src/playlist/queuemanager.cpp | 14 +- src/playlist/songloaderinserter.cpp | 15 +- src/playlist/songplaylistitem.cpp | 10 +- src/playlist/songplaylistitem.h | 2 +- src/playlistparsers/asxiniparser.cpp | 3 +- src/playlistparsers/asxparser.cpp | 3 +- src/playlistparsers/cueparser.cpp | 19 +- src/playlistparsers/cueparser.h | 9 +- src/playlistparsers/m3uparser.cpp | 8 +- src/playlistparsers/m3uparser.h | 1 - src/playlistparsers/parserbase.cpp | 5 +- src/playlistparsers/parserbase.h | 2 +- src/playlistparsers/playlistparser.cpp | 14 +- src/playlistparsers/plsparser.cpp | 5 +- src/playlistparsers/wplparser.cpp | 5 +- src/playlistparsers/xmlparser.h | 4 +- src/playlistparsers/xspfparser.cpp | 8 +- src/playlistparsers/xspfparser.h | 4 +- src/ripper/ripcddialog.cpp | 7 +- src/ripper/ripcddialog.h | 3 +- src/ripper/ripper.cpp | 2 +- src/ripper/ripper.h | 3 +- src/smartplaylists/generator.cpp | 9 +- src/smartplaylists/generator.h | 8 +- src/smartplaylists/generator_fwd.h | 2 +- src/smartplaylists/generatorinserter.cpp | 2 +- src/smartplaylists/generatorinserter.h | 5 +- src/smartplaylists/generatormimedata.h | 4 +- src/smartplaylists/querygenerator.cpp | 9 +- src/smartplaylists/querygenerator.h | 2 +- src/smartplaylists/querywizardplugin.cpp | 11 +- src/smartplaylists/querywizardplugin.h | 6 +- src/smartplaylists/search.cpp | 7 +- src/smartplaylists/search.h | 14 +- src/smartplaylists/searchpreview.cpp | 9 +- src/smartplaylists/searchpreview.h | 8 +- src/smartplaylists/searchterm.cpp | 24 +- src/smartplaylists/searchterm.h | 10 +- src/smartplaylists/searchtermwidget.cpp | 32 +- src/smartplaylists/searchtermwidget.h | 12 +- src/smartplaylists/wizard.cpp | 11 +- src/smartplaylists/wizard.h | 6 +- src/songinfo/artistbiography.cpp | 50 +- src/songinfo/artistinfoview.cpp | 2 +- src/songinfo/collapsibleinfoheader.h | 2 +- src/songinfo/collapsibleinfopane.cpp | 3 +- src/songinfo/collapsibleinfopane.h | 2 +- src/songinfo/lastfmtrackinfoprovider.cpp | 6 +- src/songinfo/songinfobase.cpp | 3 +- src/songinfo/songinfobase.h | 4 +- src/songinfo/songinfofetcher.cpp | 5 +- src/songinfo/songinfofetcher.h | 4 +- src/songinfo/songinfoprovider.h | 2 +- src/songinfo/songinfosettingspage.cpp | 15 +- src/songinfo/songinfotextview.h | 2 +- src/songinfo/songinfoview.cpp | 5 +- src/songinfo/songkickconcerts.cpp | 9 +- src/songinfo/songkickconcerts.h | 3 +- src/songinfo/songkickconcertwidget.cpp | 14 +- src/songinfo/spotifyimages.cpp | 10 +- src/songinfo/streamdiscoverer.cpp | 5 +- src/songinfo/streamdiscoverer.h | 2 +- src/songinfo/taglyricsinfoprovider.cpp | 3 +- src/songinfo/tagwidget.cpp | 9 +- src/songinfo/tagwidget.h | 15 +- src/songinfo/ultimatelyricsprovider.cpp | 9 +- src/songinfo/ultimatelyricsreader.cpp | 24 +- src/songinfo/ultimatelyricsreader.h | 4 +- src/transcoder/transcodedialog.cpp | 29 +- src/transcoder/transcoder.cpp | 37 +- src/transcoder/transcoder.h | 9 +- src/transcoder/transcoderoptionsaac.cpp | 3 +- src/transcoder/transcoderoptionsdialog.cpp | 8 +- src/transcoder/transcoderoptionsdialog.h | 2 +- src/transcoder/transcoderoptionsflac.cpp | 3 +- src/transcoder/transcoderoptionsmp3.cpp | 3 +- src/transcoder/transcoderoptionsopus.cpp | 3 +- src/transcoder/transcoderoptionsspeex.cpp | 3 +- src/transcoder/transcoderoptionsvorbis.cpp | 3 +- src/transcoder/transcoderoptionswma.cpp | 3 +- src/transcoder/transcodersettingspage.cpp | 3 +- src/ui/about.cpp | 11 +- src/ui/addstreamdialog.cpp | 9 +- src/ui/albumcoverchoicecontroller.cpp | 28 +- src/ui/albumcoverexport.cpp | 8 +- src/ui/albumcovermanager.cpp | 56 +- src/ui/albumcovermanager.h | 7 +- src/ui/albumcovermanagerlist.cpp | 7 +- src/ui/albumcoversearcher.cpp | 22 +- src/ui/appearancesettingspage.cpp | 11 +- src/ui/appearancesettingspage.h | 3 +- src/ui/backgroundstreamssettingspage.cpp | 18 +- src/ui/behavioursettingspage.cpp | 28 +- src/ui/behavioursettingspage.h | 4 +- src/ui/coverfromurldialog.cpp | 7 +- src/ui/dbusscreensaver.h | 4 +- src/ui/edittagdialog.cpp | 63 +- src/ui/edittagdialog.h | 4 +- src/ui/equalizer.cpp | 7 +- src/ui/equalizer.h | 4 +- src/ui/flowlayout.cpp | 4 +- src/ui/globalshortcutgrabber.cpp | 5 +- src/ui/globalshortcutgrabber.mm | 11 +- src/ui/globalshortcutssettingspage.cpp | 15 +- src/ui/globalshortcutssettingspage.h | 3 +- src/ui/iconloader.cpp | 100 +-- src/ui/iconloader.h | 7 +- src/ui/lovedialog.cpp | 13 +- src/ui/lovedialog.h | 2 +- src/ui/macscreensaver.h | 4 +- src/ui/macsystemtrayicon.mm | 60 +- src/ui/mainwindow.cpp | 62 +- src/ui/mainwindow.h | 5 +- src/ui/networkproxysettingspage.cpp | 7 +- src/ui/networkremotesettingspage.cpp | 5 +- src/ui/notificationssettingspage.cpp | 27 +- src/ui/organisedialog.cpp | 17 +- src/ui/organisedialog.h | 6 +- src/ui/organiseerrordialog.cpp | 6 +- src/ui/organiseerrordialog.h | 5 +- src/ui/playbacksettingspage.cpp | 7 +- src/ui/qtsystemtrayicon.cpp | 12 +- src/ui/qtsystemtrayicon.h | 4 +- src/ui/screensaver.cpp | 6 +- src/ui/settingsdialog.cpp | 4 +- src/ui/settingspage.cpp | 3 +- src/ui/standarditemiconloader.cpp | 8 +- src/ui/standarditemiconloader.h | 7 +- src/ui/streamdetailsdialog.cpp | 3 +- src/ui/streamdetailsdialog.h | 3 +- src/ui/systemtrayicon.cpp | 8 +- src/ui/systemtrayicon.h | 2 +- src/ui/trackselectiondialog.cpp | 2 +- src/ui/trackselectiondialog.h | 3 +- src/ui/windows7thumbbar.cpp | 21 +- src/ui/windowsscreensaver.h | 4 +- src/visualisations/projectmpresetmodel.cpp | 5 +- src/visualisations/projectmpresetmodel.h | 4 +- src/visualisations/projectmvisualisation.cpp | 12 +- src/visualisations/projectmvisualisation.h | 10 +- src/visualisations/visualisationcontainer.cpp | 19 +- src/visualisations/visualisationcontainer.h | 2 +- src/visualisations/visualisationoverlay.cpp | 17 +- src/visualisations/visualisationoverlay.h | 4 +- src/visualisations/visualisationselector.cpp | 7 +- src/widgets/autoexpandingtreeview.cpp | 3 +- src/widgets/autoexpandingtreeview.h | 2 +- src/widgets/clickablelabel.h | 2 +- src/widgets/didyoumean.cpp | 4 +- src/widgets/didyoumean.h | 2 +- src/widgets/equalizerslider.cpp | 3 +- src/widgets/equalizerslider.h | 2 +- src/widgets/errordialog.cpp | 3 +- src/widgets/fancytabwidget.cpp | 591 +++++++++--------- src/widgets/fancytabwidget.h | 94 +-- src/widgets/favoritewidget.cpp | 8 +- src/widgets/favoritewidget.h | 4 +- src/widgets/fileview.cpp | 15 +- src/widgets/fileview.h | 9 +- src/widgets/fileviewlist.cpp | 23 +- src/widgets/fileviewlist.h | 2 +- src/widgets/freespacebar.cpp | 3 +- src/widgets/groupediconview.cpp | 14 +- src/widgets/groupediconview.h | 7 +- src/widgets/lineedit.cpp | 5 +- src/widgets/lineedit.h | 28 +- src/widgets/loginstatewidget.cpp | 17 +- src/widgets/loginstatewidget.h | 2 +- src/widgets/multiloadingindicator.cpp | 10 +- src/widgets/multiloadingindicator.h | 2 +- src/widgets/nowplayingwidget.cpp | 9 +- src/widgets/nowplayingwidget.h | 5 +- src/widgets/osd.cpp | 10 +- src/widgets/osd.h | 5 +- src/widgets/osd_mac.mm | 11 +- src/widgets/osd_win.cpp | 6 +- src/widgets/osd_x11.cpp | 9 +- src/widgets/osdpretty.cpp | 11 +- src/widgets/osdpretty.h | 5 +- src/widgets/prettyimage.cpp | 1 - src/widgets/prettyimage.h | 2 +- src/widgets/prettyimageview.cpp | 3 +- src/widgets/ratingwidget.h | 2 +- src/widgets/renametablineedit.h | 2 +- src/widgets/sliderwidget.cpp | 42 +- src/widgets/sliderwidget.h | 6 +- src/widgets/stickyslider.h | 4 +- src/widgets/stretchheaderview.cpp | 4 +- src/widgets/stretchheaderview.h | 2 +- src/widgets/stylehelper.cpp | 15 +- src/widgets/trackslider.cpp | 9 +- src/widgets/trackslider.h | 2 +- src/widgets/tracksliderpopup.cpp | 3 +- src/widgets/tracksliderslider.cpp | 11 +- src/widgets/tracksliderslider.h | 4 +- src/widgets/widgetfadehelper.cpp | 5 +- src/wiimotedev/shortcuts.cpp | 4 +- src/wiimotedev/shortcuts.h | 7 +- src/wiimotedev/wiimotesettingspage.cpp | 23 +- src/wiimotedev/wiimotesettingspage.h | 6 +- src/wiimotedev/wiimoteshortcutgrabber.cpp | 5 +- src/wiimotedev/wiimoteshortcutgrabber.h | 7 +- 612 files changed, 3599 insertions(+), 3527 deletions(-) diff --git a/ext/clementine-spotifyblob/main.cpp b/ext/clementine-spotifyblob/main.cpp index cce0d106c..1c40520b6 100644 --- a/ext/clementine-spotifyblob/main.cpp +++ b/ext/clementine-spotifyblob/main.cpp @@ -18,13 +18,13 @@ // it is used by the Spotify blob which links against libspotify and is not GPL // compatible. +#include + #include #include -#include - -#include "spotifyclient.h" #include "core/logging.h" +#include "spotifyclient.h" int main(int argc, char** argv) { QCoreApplication a(argc, argv); diff --git a/ext/clementine-spotifyblob/mediapipeline.cpp b/ext/clementine-spotifyblob/mediapipeline.cpp index 5bb9ac6cb..58b3c388c 100644 --- a/ext/clementine-spotifyblob/mediapipeline.cpp +++ b/ext/clementine-spotifyblob/mediapipeline.cpp @@ -19,11 +19,12 @@ // compatible. #include "mediapipeline.h" -#include "core/logging.h" -#include "core/timeconstants.h" #include +#include "core/logging.h" +#include "core/timeconstants.h" + MediaPipeline::MediaPipeline(int port, quint64 length_msec) : port_(port), length_msec_(length_msec), diff --git a/ext/clementine-spotifyblob/spotify_utilities.mm b/ext/clementine-spotifyblob/spotify_utilities.mm index ffde37e9a..b88ebcefb 100644 --- a/ext/clementine-spotifyblob/spotify_utilities.mm +++ b/ext/clementine-spotifyblob/spotify_utilities.mm @@ -11,8 +11,7 @@ namespace utilities { QString GetUserDataDirectory() { ScopedNSAutoreleasePool pool; - NSArray* paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, - NSUserDomainMask, YES); + NSArray* paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); QString ret; if ([paths count] > 0) { NSString* user_path = [paths objectAtIndex:0]; @@ -25,8 +24,8 @@ QString GetUserDataDirectory() { QString GetSettingsDirectory() { ScopedNSAutoreleasePool pool; - NSArray* paths = NSSearchPathForDirectoriesInDomains( - NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSArray* paths = + NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); NSString* ret; if ([paths count] > 0) { ret = [paths objectAtIndex:0]; @@ -36,10 +35,7 @@ QString GetSettingsDirectory() { ret = [ret stringByAppendingString:@"/Clementine/spotify-settings"]; NSFileManager* file_manager = [NSFileManager defaultManager]; - [file_manager createDirectoryAtPath:ret - withIntermediateDirectories:YES - attributes:nil - error:nil]; + [file_manager createDirectoryAtPath:ret withIntermediateDirectories:YES attributes:nil error:nil]; QString path = QString::fromUtf8([ret UTF8String]); return path; diff --git a/ext/clementine-spotifyblob/spotifyclient.cpp b/ext/clementine-spotifyblob/spotifyclient.cpp index ef2e9dc63..367ec9319 100644 --- a/ext/clementine-spotifyblob/spotifyclient.cpp +++ b/ext/clementine-spotifyblob/spotifyclient.cpp @@ -20,22 +20,21 @@ #include "spotifyclient.h" -#include -#include - #include #include #include #include #include +#include +#include #include "core/arraysize.h" #include "core/logging.h" #include "core/timeconstants.h" #include "mediapipeline.h" +#include "spotify_utilities.h" #include "spotifykey.h" #include "spotifymessages.pb.h" -#include "spotify_utilities.h" const int SpotifyClient::kSpotifyImageIDSize = 20; const int SpotifyClient::kWaveHeaderSize = 44; @@ -622,8 +621,8 @@ void SpotifyClient::AddTracksToPlaylist( } // Get the tracks we want to add - std::unique_ptr tracks_array( - new sp_track* [req.track_uri_size()]); + std::unique_ptr tracks_array( + new sp_track*[req.track_uri_size()]); for (int i = 0; i < req.track_uri_size(); ++i) { sp_link* track_link = sp_link_create_from_string(req.track_uri(i).c_str()); sp_track* track = sp_link_as_track(track_link); diff --git a/ext/clementine-tagreader/main.cpp b/ext/clementine-tagreader/main.cpp index f9953b19d..fcf39f0c9 100644 --- a/ext/clementine-tagreader/main.cpp +++ b/ext/clementine-tagreader/main.cpp @@ -15,16 +15,16 @@ along with Clementine. If not, see . */ -#include "tagreaderworker.h" -#include "core/logging.h" +#include #include #include #include #include - #include -#include + +#include "core/logging.h" +#include "tagreaderworker.h" int main(int argc, char** argv) { QCoreApplication a(argc, argv); diff --git a/ext/clementine-tagreader/tagreaderworker.cpp b/ext/clementine-tagreader/tagreaderworker.cpp index e4b0b2c9b..235aa3f11 100644 --- a/ext/clementine-tagreader/tagreaderworker.cpp +++ b/ext/clementine-tagreader/tagreaderworker.cpp @@ -71,12 +71,12 @@ void TagReaderWorker::MessageArrived(const pb::tagreader::Message& message) { const pb::tagreader::ReadCloudFileRequest& req = message.read_cloud_file_request(); if (!tag_reader_.ReadCloudFile( - QUrl::fromEncoded(QByteArray(req.download_url().data(), - req.download_url().size())), - QStringFromStdString(req.title()), req.size(), - QStringFromStdString(req.mime_type()), - QStringFromStdString(req.authorisation_header()), - reply.mutable_read_cloud_file_response()->mutable_metadata())) { + QUrl::fromEncoded(QByteArray(req.download_url().data(), + req.download_url().size())), + QStringFromStdString(req.title()), req.size(), + QStringFromStdString(req.mime_type()), + QStringFromStdString(req.authorisation_header()), + reply.mutable_read_cloud_file_response()->mutable_metadata())) { reply.mutable_read_cloud_file_response()->clear_metadata(); } #endif diff --git a/ext/libclementine-common/core/logging.cpp b/ext/libclementine-common/core/logging.cpp index 1a1269ac5..8012c0c95 100644 --- a/ext/libclementine-common/core/logging.cpp +++ b/ext/libclementine-common/core/logging.cpp @@ -18,24 +18,23 @@ // it is used by the Spotify blob which links against libspotify and is not GPL // compatible. -#include - #include + +#include #ifdef Q_OS_UNIX #include #endif -#include -#include +#include #include #include #include #include -#include #include - -#include +#include +#include +#include #include "logging.h" @@ -117,9 +116,12 @@ class LoggedDebug : public DebugBase { LoggedDebug(QtMsgType t) : DebugBase(t) { nospace() << kMessageHandlerMagic; } }; -static void MessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message) { - if (strncmp(kMessageHandlerMagic, message.toLocal8Bit().data(), kMessageHandlerMagicLength) == 0) { - fprintf(stderr, "%s\n", message.toLocal8Bit().data() + kMessageHandlerMagicLength); +static void MessageHandler(QtMsgType type, const QMessageLogContext& context, + const QString& message) { + if (strncmp(kMessageHandlerMagic, message.toLocal8Bit().data(), + kMessageHandlerMagicLength) == 0) { + fprintf(stderr, "%s\n", + message.toLocal8Bit().data() + kMessageHandlerMagicLength); return; } diff --git a/ext/libclementine-common/core/messagehandler.cpp b/ext/libclementine-common/core/messagehandler.cpp index 065964d5f..1393e7a09 100644 --- a/ext/libclementine-common/core/messagehandler.cpp +++ b/ext/libclementine-common/core/messagehandler.cpp @@ -19,11 +19,12 @@ // compatible. #include "messagehandler.h" -#include "core/logging.h" #include -#include #include +#include + +#include "core/logging.h" _MessageHandlerBase::_MessageHandlerBase(QIODevice* device, QObject* parent) : QObject(parent), diff --git a/ext/libclementine-common/core/scoped_nsautorelease_pool.mm b/ext/libclementine-common/core/scoped_nsautorelease_pool.mm index d37a7bea9..3c96b21f4 100644 --- a/ext/libclementine-common/core/scoped_nsautorelease_pool.mm +++ b/ext/libclementine-common/core/scoped_nsautorelease_pool.mm @@ -11,9 +11,7 @@ ScopedNSAutoreleasePool::ScopedNSAutoreleasePool() Q_ASSERT(autorelease_pool_); } -ScopedNSAutoreleasePool::~ScopedNSAutoreleasePool() { - [autorelease_pool_ drain]; -} +ScopedNSAutoreleasePool::~ScopedNSAutoreleasePool() { [autorelease_pool_ drain]; } // Cycle the internal pool, allowing everything there to get cleaned up and // start anew. diff --git a/ext/libclementine-tagreader/cloudstream.cpp b/ext/libclementine-tagreader/cloudstream.cpp index c5f8cb54f..a6e61420a 100644 --- a/ext/libclementine-tagreader/cloudstream.cpp +++ b/ext/libclementine-tagreader/cloudstream.cpp @@ -17,20 +17,20 @@ #include "cloudstream.h" +#include +#include + #include #include #include #include -#include -#include - #include "core/logging.h" namespace { static const int kTaglibPrefixCacheBytes = 64 * 1024; // Should be enough. static const int kTaglibSuffixCacheBytes = 8 * 1024; -} +} // namespace CloudStream::CloudStream(const QUrl& url, const QString& filename, const long length, const QString& auth) diff --git a/ext/libclementine-tagreader/fmpsparser.cpp b/ext/libclementine-tagreader/fmpsparser.cpp index 857aa979e..8ab24bb46 100644 --- a/ext/libclementine-tagreader/fmpsparser.cpp +++ b/ext/libclementine-tagreader/fmpsparser.cpp @@ -17,10 +17,9 @@ #include "fmpsparser.h" -#include - #include #include +#include using std::placeholders::_1; using std::placeholders::_2; diff --git a/ext/libclementine-tagreader/gmereader.cpp b/ext/libclementine-tagreader/gmereader.cpp index c4d407b82..382add16d 100644 --- a/ext/libclementine-tagreader/gmereader.cpp +++ b/ext/libclementine-tagreader/gmereader.cpp @@ -1,10 +1,8 @@ -#include "core/logging.h" -#include "core/timeconstants.h" #include "gmereader.h" -#include "tagreader.h" #include #include + #include #include #include @@ -12,6 +10,10 @@ #include #include +#include "core/logging.h" +#include "core/timeconstants.h" +#include "tagreader.h" + bool GME::IsSupportedFormat(const QFileInfo& file_info) { return (file_info.completeSuffix().endsWith("spc") || file_info.completeSuffix().endsWith("vgm")); diff --git a/src/analyzers/analyzerbase.cpp b/src/analyzers/analyzerbase.cpp index f8827f3e0..2f3c74e48 100644 --- a/src/analyzers/analyzerbase.cpp +++ b/src/analyzers/analyzerbase.cpp @@ -20,19 +20,18 @@ */ /* Original Author: Max Howell 2003 -*/ + */ #include "analyzerbase.h" +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include - #include "core/arraysize.h" // INSTRUCTIONS Base2D diff --git a/src/analyzers/analyzerbase.h b/src/analyzers/analyzerbase.h index e66ed0c1f..521660e26 100644 --- a/src/analyzers/analyzerbase.h +++ b/src/analyzers/analyzerbase.h @@ -21,7 +21,7 @@ */ /* Original Author: Max Howell 2004 -*/ + */ #ifndef ANALYZERS_ANALYZERBASE_H_ #define ANALYZERS_ANALYZERBASE_H_ @@ -32,14 +32,15 @@ #include #endif -#include "fht.h" -#include "engines/engine_fwd.h" -#include "engines/enginebase.h" -#include #include +#include #include #include +#include "engines/engine_fwd.h" +#include "engines/enginebase.h" +#include "fht.h" + #ifdef HAVE_OPENGL #include #ifdef Q_OS_MACX diff --git a/src/analyzers/analyzercontainer.cpp b/src/analyzers/analyzercontainer.cpp index 6dd2751b1..951d31663 100644 --- a/src/analyzers/analyzercontainer.cpp +++ b/src/analyzers/analyzercontainer.cpp @@ -21,13 +21,6 @@ */ #include "analyzercontainer.h" -#include "baranalyzer.h" -#include "blockanalyzer.h" -#include "boomanalyzer.h" -#include "sonogram.h" -#include "rainbowanalyzer.h" -#include "turbine.h" -#include "core/logging.h" #include #include @@ -35,6 +28,14 @@ #include #include +#include "baranalyzer.h" +#include "blockanalyzer.h" +#include "boomanalyzer.h" +#include "core/logging.h" +#include "rainbowanalyzer.h" +#include "sonogram.h" +#include "turbine.h" + const char* AnalyzerContainer::kSettingsGroup = "Analyzer"; const char* AnalyzerContainer::kSettingsFramerate = "framerate"; @@ -155,8 +156,7 @@ void AnalyzerContainer::TogglePsychedelicColors() { } void AnalyzerContainer::ChangeAnalyzer(int id) { - QObject* instance = - analyzer_types_[id]->newInstance(Q_ARG(QWidget*, this)); + QObject* instance = analyzer_types_[id]->newInstance(Q_ARG(QWidget*, this)); if (!instance) { qLog(Warning) << "Couldn't initialise a new" @@ -225,7 +225,7 @@ void AnalyzerContainer::Load() { } void AnalyzerContainer::SaveFramerate(int framerate) { - // For now, framerate is common for all analyzers. + // For now, framerate is common for all analyzers. // Maybe each analyzer should have its own framerate? current_framerate_ = framerate; QSettings s; diff --git a/src/analyzers/analyzercontainer.h b/src/analyzers/analyzercontainer.h index f3443584c..487e44f3d 100644 --- a/src/analyzers/analyzercontainer.h +++ b/src/analyzers/analyzercontainer.h @@ -23,8 +23,8 @@ #ifndef ANALYZERS_ANALYZERCONTAINER_H_ #define ANALYZERS_ANALYZERCONTAINER_H_ -#include #include +#include #include "analyzerbase.h" #include "engines/engine_fwd.h" @@ -40,7 +40,7 @@ class AnalyzerContainer : public QWidget { static const char* kSettingsGroup; static const char* kSettingsFramerate; -signals: + signals: void WheelEvent(int delta); protected: diff --git a/src/analyzers/baranalyzer.cpp b/src/analyzers/baranalyzer.cpp index e73803c8d..7657683aa 100644 --- a/src/analyzers/baranalyzer.cpp +++ b/src/analyzers/baranalyzer.cpp @@ -21,12 +21,13 @@ */ /* Original Author: Mark Kretschmann 2003 -*/ + */ #include "baranalyzer.h" -#include -#include + #include +#include +#include using Analyzer::Scope; @@ -158,12 +159,11 @@ void BarAnalyzer::analyze(QPainter& p, const Scope& s, bool new_frame) { // 3. fall downwards at a constant pace /*if ( change > max_up_ ) //anything too much greater than 2 gives "jitter" - //add some dynamics - makes the value slightly closer to what it was last time - y2 = ( barVector_[i] + max_up_ ); + //add some dynamics - makes the value slightly closer to what it was + last time y2 = ( barVector_[i] + max_up_ ); //y2 = ( barVector_[i] * 2 + y2 ) / 3; - else*/ if (change < - max_down_) - y2 = barVector_[i] + max_down_; + else*/ + if (change < max_down_) y2 = barVector_[i] + max_down_; if (static_cast(y2) > roofVector_[i]) { roofVector_[i] = static_cast(y2); diff --git a/src/analyzers/baranalyzer.h b/src/analyzers/baranalyzer.h index 37159a47e..570d1a9be 100644 --- a/src/analyzers/baranalyzer.h +++ b/src/analyzers/baranalyzer.h @@ -22,7 +22,7 @@ /* Original Author: Max Howell 2003-2005 * Original Author: Mark Kretschmann 2005 -*/ + */ #ifndef ANALYZERS_BARANALYZER_H_ #define ANALYZERS_BARANALYZER_H_ diff --git a/src/analyzers/blockanalyzer.cpp b/src/analyzers/blockanalyzer.cpp index e29364355..1dbbe41f7 100644 --- a/src/analyzers/blockanalyzer.cpp +++ b/src/analyzers/blockanalyzer.cpp @@ -26,12 +26,11 @@ #include "blockanalyzer.h" -#include - #include -#include -#include #include +#include +#include +#include const uint BlockAnalyzer::kHeight = 2; const uint BlockAnalyzer::kWidth = 4; diff --git a/src/analyzers/blockanalyzer.h b/src/analyzers/blockanalyzer.h index 1c13db9d3..d6c84da42 100644 --- a/src/analyzers/blockanalyzer.h +++ b/src/analyzers/blockanalyzer.h @@ -25,9 +25,10 @@ #ifndef ANALYZERS_BLOCKANALYZER_H_ #define ANALYZERS_BLOCKANALYZER_H_ -#include "analyzerbase.h" #include +#include "analyzerbase.h" + class QResizeEvent; class QMouseEvent; class QPalette; diff --git a/src/analyzers/boomanalyzer.cpp b/src/analyzers/boomanalyzer.cpp index cad03d817..a00db064b 100644 --- a/src/analyzers/boomanalyzer.cpp +++ b/src/analyzers/boomanalyzer.cpp @@ -23,8 +23,9 @@ */ #include "boomanalyzer.h" -#include + #include +#include using Analyzer::Scope; diff --git a/src/analyzers/fht.cpp b/src/analyzers/fht.cpp index b01258f54..cb557d5bf 100644 --- a/src/analyzers/fht.cpp +++ b/src/analyzers/fht.cpp @@ -18,10 +18,11 @@ */ /* Original Author: Melchior FRANZ 2004 -*/ + */ + +#include "fht.h" #include -#include "fht.h" FHT::FHT(int n) : num_((n < 3) ? 0 : 1 << n), exp2_((n < 3) ? -1 : n) { if (n > 3) { diff --git a/src/analyzers/fht.h b/src/analyzers/fht.h index 1e94f580b..61c674f3e 100644 --- a/src/analyzers/fht.h +++ b/src/analyzers/fht.h @@ -18,7 +18,7 @@ */ /* Original Author: Melchior FRANZ 2004 -*/ + */ #ifndef ANALYZERS_FHT_H_ #define ANALYZERS_FHT_H_ @@ -59,10 +59,10 @@ class FHT { public: /** - * Prepare transform for data sets with @f$2^n@f$ numbers, whereby @f$n@f$ - * should be at least 3. Values of more than 3 need a trigonometry table. - * @see makeCasTable() - */ + * Prepare transform for data sets with @f$2^n@f$ numbers, whereby @f$n@f$ + * should be at least 3. Values of more than 3 need a trigonometry table. + * @see makeCasTable() + */ FHT(int); ~FHT(); diff --git a/src/analyzers/glanalyzer.cpp b/src/analyzers/glanalyzer.cpp index 4a863ddba..cebc9c04b 100644 --- a/src/analyzers/glanalyzer.cpp +++ b/src/analyzers/glanalyzer.cpp @@ -25,10 +25,12 @@ #ifdef HAVE_QGLWIDGET -#include -#include "glanalyzer.h" #include +#include + +#include "glanalyzer.h" + GLAnalyzer::GLAnalyzer(QWidget* parent) : Analyzer::Base3D(parent, 15), m_oldy(32, -10.0f), m_peaks(32) {} @@ -75,8 +77,9 @@ void GLAnalyzer::analyze(const Scope& s) { // Calculating new vertical position (y) depending on the data passed by // amarok - y = static_cast(s[i + offset] * mfactor); // This make it kinda dynamically - // resize depending on the data + y = static_cast(s[i + offset] * + mfactor); // This make it kinda dynamically + // resize depending on the data // Some basic bounds checking if (y > 30) diff --git a/src/analyzers/glanalyzer2.cpp b/src/analyzers/glanalyzer2.cpp index 16538bab9..92a3314b8 100644 --- a/src/analyzers/glanalyzer2.cpp +++ b/src/analyzers/glanalyzer2.cpp @@ -25,14 +25,16 @@ #ifdef HAVE_QGLWIDGET -#include -#include -#include "glanalyzer2.h" #include #include #include #include +#include +#include + +#include "glanalyzer2.h" + GLAnalyzer2::GLAnalyzer2(QWidget* parent) : Analyzer::Base3D(parent, 15) { // initialize openGL context before managing GL calls makeCurrent(); @@ -77,7 +79,8 @@ void GLAnalyzer2::resizeGL(int w, int h) { glOrtho(-10.0f, 10.0f, -10.0f, 10.0f, -5.0f, 5.0f); // Get the aspect ratio of the screen to draw 'cicular' particles - float ratio = static_cast(w) / static_cast(h), eqPixH = 60, eqPixW = 80; + float ratio = static_cast(w) / static_cast(h), eqPixH = 60, + eqPixW = 80; if (ratio >= (4.0 / 3.0)) { unitX = 10.0 / (eqPixH * ratio); unitY = 10.0 / eqPixH; @@ -89,7 +92,8 @@ void GLAnalyzer2::resizeGL(int w, int h) { // Get current timestamp. timeval tv; gettimeofday(&tv, nullptr); - show.timeStamp = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; + show.timeStamp = static_cast(tv.tv_sec) + + static_cast(tv.tv_usec) / 1000000.0; } void GLAnalyzer2::paused() { analyze(Scope()); } @@ -133,7 +137,8 @@ void GLAnalyzer2::paintGL() { // Compute the dT since the last call to paintGL and update timings timeval tv; gettimeofday(&tv, nullptr); - double currentTime = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; + double currentTime = static_cast(tv.tv_sec) + + static_cast(tv.tv_usec) / 1000000.0; show.dT = currentTime - show.timeStamp; show.timeStamp = currentTime; diff --git a/src/analyzers/glanalyzer2.h b/src/analyzers/glanalyzer2.h index 70a285ac5..4d4f0b9e1 100644 --- a/src/analyzers/glanalyzer2.h +++ b/src/analyzers/glanalyzer2.h @@ -27,9 +27,10 @@ #include #ifdef HAVE_QGLWIDGET -#include "analyzerbase.h" -#include #include +#include + +#include "analyzerbase.h" class GLAnalyzer2 : public Analyzer::Base3D { public: diff --git a/src/analyzers/glanalyzer3.cpp b/src/analyzers/glanalyzer3.cpp index f4788cdf3..aa78567af 100644 --- a/src/analyzers/glanalyzer3.cpp +++ b/src/analyzers/glanalyzer3.cpp @@ -25,14 +25,16 @@ #ifdef HAVE_QGLWIDGET -#include -#include -#include "glanalyzer3.h" #include #include #include #include +#include +#include + +#include "glanalyzer3.h" + #ifndef HAVE_FABSF inline float fabsf(float f) { return f < 0.f ? -f : f; } #endif @@ -47,7 +49,7 @@ class Ball { vy(0.0), vz(0.0), mass(0.01 + drand48() / 10.0), - color((float[3]) { 0.0, drand48()*0.5, 0.7 + drand48() * 0.3 }) {} + color((float[3]){0.0, drand48() * 0.5, 0.7 + drand48() * 0.3}) {} float x, y, z, vx, vy, vz, mass; float color[3]; @@ -69,7 +71,7 @@ class Ball { class Paddle { public: explicit Paddle(float xPos) - : onLeft(xPos < 0), mass(1.0), X(xPos), x(xPos), vx(0.0) {} + : onLeft(xPos < 0), mass(1.0), X(xPos), x(xPos), vx(0.0) {} void updatePhysics(float dT) { x += vx * dT; // posision @@ -175,7 +177,8 @@ void GLAnalyzer3::resizeGL(int w, int h) { // Get current timestamp. timeval tv; gettimeofday(&tv, nullptr); - show.timeStamp = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; + show.timeStamp = static_cast(tv.tv_sec) + + static_cast(tv.tv_usec) / 1000000.0; } void GLAnalyzer3::paused() { analyze(Scope()); } @@ -184,7 +187,8 @@ void GLAnalyzer3::analyze(const Scope& s) { // compute the dTime since the last call timeval tv; gettimeofday(&tv, nullptr); - double currentTime = static_cast(tv.tv_sec) + static_cast(tv.tv_usec) / 1000000.0; + double currentTime = static_cast(tv.tv_sec) + + static_cast(tv.tv_usec) / 1000000.0; show.dT = currentTime - show.timeStamp; show.timeStamp = currentTime; diff --git a/src/analyzers/glanalyzer3.h b/src/analyzers/glanalyzer3.h index 5e23098c5..46d6a4509 100644 --- a/src/analyzers/glanalyzer3.h +++ b/src/analyzers/glanalyzer3.h @@ -27,9 +27,10 @@ #ifndef ANALYZERS_GLANALYZER3_H_ #define ANALYZERS_GLANALYZER3_H_ -#include "analyzerbase.h" -#include #include +#include + +#include "analyzerbase.h" class QWidget; class Ball; @@ -68,7 +69,7 @@ class GLAnalyzer3 : public Analyzer::Base3D { static const int NUMBER_OF_BALLS = 16; QPtrList balls; - Paddle* leftPaddle, *rightPaddle; + Paddle *leftPaddle, *rightPaddle; float unitX, unitY; GLuint ballTexture; GLuint gridTexture; diff --git a/src/analyzers/rainbowanalyzer.cpp b/src/analyzers/rainbowanalyzer.cpp index 7cb0b44c2..9bf639521 100644 --- a/src/analyzers/rainbowanalyzer.cpp +++ b/src/analyzers/rainbowanalyzer.cpp @@ -23,12 +23,11 @@ #include "rainbowanalyzer.h" -#include - #include #include #include #include +#include #include "core/arraysize.h" #include "core/logging.h" diff --git a/src/analyzers/rainbowanalyzer.h b/src/analyzers/rainbowanalyzer.h index 511ba33de..ee7780eb0 100644 --- a/src/analyzers/rainbowanalyzer.h +++ b/src/analyzers/rainbowanalyzer.h @@ -24,21 +24,18 @@ #ifndef ANALYZERS_RAINBOWANALYZER_H_ #define ANALYZERS_RAINBOWANALYZER_H_ -#include "analyzerbase.h" - #include #include #include +#include "analyzerbase.h" + namespace Rainbow { class RainbowAnalyzer : public Analyzer::Base { Q_OBJECT public: - enum RainbowType { - Nyancat = 0, - Dash = 1 - }; + enum RainbowType { Nyancat = 0, Dash = 1 }; RainbowAnalyzer(const RainbowType& rbtype, QWidget* parent); @@ -66,25 +63,25 @@ class RainbowAnalyzer : public Analyzer::Base { static RainbowType rainbowtype; inline QRect SourceRect(RainbowType rainbowtype) const { - return QRect(0, kHeight[rainbowtype] * frame_, - kWidth[rainbowtype], kHeight[rainbowtype]); + return QRect(0, kHeight[rainbowtype] * frame_, kWidth[rainbowtype], + kHeight[rainbowtype]); } inline QRect SleepingSourceRect(RainbowType rainbowtype) const { - return QRect(0, kHeight[rainbowtype] * kFrameCount[rainbowtype], + return QRect(0, kHeight[rainbowtype] * kFrameCount[rainbowtype], kWidth[rainbowtype], kSleepingHeight[rainbowtype]); } inline QRect DestRect(RainbowType rainbowtype) const { - return QRect(width() - kWidth[rainbowtype], (height() - - kHeight[rainbowtype]) / 2, kWidth[rainbowtype], + return QRect(width() - kWidth[rainbowtype], + (height() - kHeight[rainbowtype]) / 2, kWidth[rainbowtype], kHeight[rainbowtype]); } inline QRect SleepingDestRect(RainbowType rainbowtype) const { - return QRect(width() - kWidth[rainbowtype], (height() - - kSleepingHeight[rainbowtype]) / 2, kWidth[rainbowtype], - kSleepingHeight[rainbowtype]); + return QRect(width() - kWidth[rainbowtype], + (height() - kSleepingHeight[rainbowtype]) / 2, + kWidth[rainbowtype], kSleepingHeight[rainbowtype]); } private: @@ -102,7 +99,7 @@ class RainbowAnalyzer : public Analyzer::Base { // The y positions of each point on the rainbow. float history_[kHistorySize * kRainbowBands]; - // A cache of the last frame's rainbow, + // A cache of the last frame's rainbow, // so it can be used in the next frame. QPixmap buffer_[2]; int current_buffer_; @@ -114,7 +111,7 @@ class RainbowAnalyzer : public Analyzer::Base { // X spacing between each point in the polyline. int px_per_frame_; - // Amount the buffer_ is shifted to the left (off the edge of the widget) + // Amount the buffer_ is shifted to the left (off the edge of the widget) // to make the rainbow extend from 0 to available_rainbow_width_. int x_offset_; @@ -126,7 +123,7 @@ class NyanCatAnalyzer : public RainbowAnalyzer { public: Q_INVOKABLE NyanCatAnalyzer(QWidget* parent); - + static const char* kName; }; @@ -138,6 +135,6 @@ class RainbowDashAnalyzer : public RainbowAnalyzer { static const char* kName; }; -} +} // namespace Rainbow #endif // ANALYZERS_RAINBOWANALYZER_H_ diff --git a/src/analyzers/turbine.cpp b/src/analyzers/turbine.cpp index bd6b6b4a4..abc79d869 100644 --- a/src/analyzers/turbine.cpp +++ b/src/analyzers/turbine.cpp @@ -24,11 +24,11 @@ * Original Author: Max Howell 2003 */ -#include -#include - #include "turbine.h" +#include +#include + using Analyzer::Scope; const char* TurbineAnalyzer::kName = diff --git a/src/core/application.cpp b/src/core/application.cpp index 2e062ee54..1d6a0367c 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -20,11 +20,11 @@ along with Clementine. If not, see . */ +#include "application.h" + #include #include -#include "application.h" - #include "config.h" #include "core/appearance.h" #include "core/database.h" @@ -107,9 +107,9 @@ class ApplicationImpl { // Initialize the repository of cover providers. cover_providers->AddProvider(new MusicbrainzCoverProvider); cover_providers->AddProvider(new DiscogsCoverProvider); - #ifdef HAVE_LIBLASTFM +#ifdef HAVE_LIBLASTFM cover_providers->AddProvider(new LastFmCoverProvider(app)); - #endif +#endif return cover_providers; }), task_manager_([=]() { return new TaskManager(app); }), diff --git a/src/core/application.h b/src/core/application.h index 0f7ffd5f2..38eba66f0 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -22,9 +22,8 @@ #ifndef CORE_APPLICATION_H_ #define CORE_APPLICATION_H_ -#include - #include +#include #include "ui/settingsdialog.h" @@ -115,7 +114,7 @@ class Application : public QObject { void ReloadSettings(); void OpenSettingsDialogAtPage(SettingsDialog::Page page); -signals: + signals: void ErrorAdded(const QString& message); void SettingsChanged(); void SaveSettings(QSettings* settings); diff --git a/src/core/cachedlist.h b/src/core/cachedlist.h index 9d7fad6b9..233c63c53 100644 --- a/src/core/cachedlist.h +++ b/src/core/cachedlist.h @@ -20,10 +20,9 @@ #ifndef CORE_CACHEDLIST_H_ #define CORE_CACHEDLIST_H_ -#include - #include #include +#include template class CachedList { diff --git a/src/core/commandlineoptions.cpp b/src/core/commandlineoptions.cpp index 0919789e5..17855d64e 100644 --- a/src/core/commandlineoptions.cpp +++ b/src/core/commandlineoptions.cpp @@ -21,18 +21,19 @@ along with Clementine. If not, see . */ -#include "config.h" #include "commandlineoptions.h" -#include "version.h" -#include "core/logging.h" -#include #include -#include #include #include #include +#include +#include + +#include "config.h" +#include "core/logging.h" +#include "version.h" const char* CommandlineOptions::kHelpText = "%1: clementine [%2] [%3]\n" @@ -143,7 +144,8 @@ bool CommandlineOptions::Parse() { // Parse the arguments bool ok = false; forever { - int c = getopt_long(argc_, argv_, "xhptusqrfv:c:alk:oyg:", kOptions, nullptr); + int c = + getopt_long(argc_, argv_, "xhptusqrfv:c:alk:oyg:", kOptions, nullptr); // End of the options if (c == -1) break; @@ -182,7 +184,7 @@ bool CommandlineOptions::Parse() { tr("Equivalent to --log-levels *:1"), tr("Equivalent to --log-levels *:3"), tr("Comma separated list of class:level, level is 0-3")) - .arg(tr("Print out version information"), + .arg(tr("Print out version information"), tr("Delete the currently playing song")); std::cout << translated_help_text.toLocal8Bit().constData(); @@ -346,7 +348,7 @@ QString CommandlineOptions::tr(const char* source_text) { QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a) { s << qint32(a.player_action_) << qint32(a.url_list_action_) << a.set_volume_ << a.volume_modifier_ << a.seek_to_ << a.seek_by_ << a.play_track_at_ - << a.show_osd_ << a.urls_ << a.log_levels_ << a.toggle_pretty_osd_ + << a.show_osd_ << a.urls_ << a.log_levels_ << a.toggle_pretty_osd_ << a.delete_current_track_; return s; diff --git a/src/core/commandlineoptions.h b/src/core/commandlineoptions.h index b18f139fc..c2e01011b 100644 --- a/src/core/commandlineoptions.h +++ b/src/core/commandlineoptions.h @@ -24,9 +24,9 @@ #ifndef CORE_COMMANDLINEOPTIONS_H_ #define CORE_COMMANDLINEOPTIONS_H_ +#include #include #include -#include class CommandlineOptions { friend QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a); diff --git a/src/core/crashreporting.cpp b/src/core/crashreporting.cpp index 89a654cec..b9218a85c 100644 --- a/src/core/crashreporting.cpp +++ b/src/core/crashreporting.cpp @@ -17,21 +17,22 @@ along with Clementine. If not, see . */ -#include "config.h" #include "crashreporting.h" -#include "core/logging.h" #include #include #include #include #include -#include #include +#include #include #include #include +#include "config.h" +#include "core/logging.h" + #if defined(HAVE_BREAKPAD) and defined(Q_OS_LINUX) #include "client/linux/handler/exception_handler.h" #include "third_party/lss/linux_syscall_support.h" @@ -111,13 +112,14 @@ bool CrashSender::Start() { } // No tr() here. - QMessageBox prompt(QMessageBox::Critical, "Clementine has crashed!", - QString( - "A crash report has been created and saved to '%1'. " - "With your permission " - "it can be automatically sent to our server so the " - "developers can find " - "out what happened.").arg(path_)); + QMessageBox prompt( + QMessageBox::Critical, "Clementine has crashed!", + QString("A crash report has been created and saved to '%1'. " + "With your permission " + "it can be automatically sent to our server so the " + "developers can find " + "out what happened.") + .arg(path_)); prompt.addButton("Don't send", QMessageBox::RejectRole); prompt.addButton("Send crash report", QMessageBox::AcceptRole); if (prompt.exec() == QDialog::Rejected) { @@ -195,7 +197,7 @@ void CrashSender::UploadProgress(qint64 bytes) { progress_->setValue(bytes); } namespace google_breakpad { class ExceptionHandler {}; -} +} // namespace google_breakpad CrashReporting::CrashReporting() {} diff --git a/src/core/crashreporting.h b/src/core/crashreporting.h index c9df41b14..7a80fc0e8 100644 --- a/src/core/crashreporting.h +++ b/src/core/crashreporting.h @@ -20,9 +20,8 @@ #ifndef CORE_CRASHREPORTING_H_ #define CORE_CRASHREPORTING_H_ -#include - #include +#include class QFile; class QNetworkAccessManager; diff --git a/src/core/database.cpp b/src/core/database.cpp index 49fe64697..6b178be7c 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -23,15 +23,7 @@ along with Clementine. If not, see . */ -#include "config.h" #include "database.h" -#include "scopedtransaction.h" -#include "utilities.h" -#include "core/application.h" -#include "core/logging.h" -#include "core/taskmanager.h" - -#include #include @@ -41,10 +33,18 @@ #include #include #include -#include #include #include #include +#include +#include + +#include "config.h" +#include "core/application.h" +#include "core/logging.h" +#include "core/taskmanager.h" +#include "scopedtransaction.h" +#include "utilities.h" const char* Database::kDatabaseFilename = "clementine.db"; const int Database::kSchemaVersion = 51; @@ -241,8 +241,10 @@ QSqlDatabase Database::Connect() { } } - const QString connection_id = QString("%1_thread_%2").arg(connection_id_).arg( - reinterpret_cast(QThread::currentThread())); + const QString connection_id = + QString("%1_thread_%2") + .arg(connection_id_) + .arg(reinterpret_cast(QThread::currentThread())); // Try to find an existing connection for this thread QSqlDatabase db = QSqlDatabase::database(connection_id); @@ -266,17 +268,20 @@ QSqlDatabase Database::Connect() { if (!sFTSTokenizer) StaticInit(); { - #ifdef SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER - // In case sqlite>=3.12 is compiled without -DSQLITE_ENABLE_FTS3_TOKENIZER (generally a good idea - // due to security reasons) the fts3 support should be enabled explicitly. - // see https://github.com/clementine-player/Clementine/issues/5297 + // In case sqlite>=3.12 is compiled without -DSQLITE_ENABLE_FTS3_TOKENIZER + // (generally a good idea due to security reasons) the fts3 support should + // be enabled explicitly. see + // https://github.com/clementine-player/Clementine/issues/5297 // - // See https://www.sqlite.org/fts3.html#custom_application_defined_tokenizers + // See + // https://www.sqlite.org/fts3.html#custom_application_defined_tokenizers QVariant v = db.driver()->handle(); if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) { sqlite3* handle = *static_cast(v.data()); - if (!handle || sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, nullptr) != SQLITE_OK) { + if (!handle || + sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, + nullptr) != SQLITE_OK) { qLog(Fatal) << "Failed to enable FTS3 tokenizer"; } } @@ -289,7 +294,8 @@ QSqlDatabase Database::Connect() { ":pointer", QByteArray(reinterpret_cast(&sFTSTokenizer), sizeof(&sFTSTokenizer))); if (!set_fts_tokenizer.exec()) { - qLog(Warning) << "Couldn't register FTS3 tokenizer : " << set_fts_tokenizer.lastError(); + qLog(Warning) << "Couldn't register FTS3 tokenizer : " + << set_fts_tokenizer.lastError(); } // Implicit invocation of ~QSqlQuery() when leaving the scope // to release any remaining database locks! @@ -330,9 +336,9 @@ QSqlDatabase Database::Connect() { continue; // Find out if there are any tables in this database QSqlQuery q(db); - q.prepare(QString( - "SELECT ROWID FROM %1.sqlite_master" - " WHERE type='table'").arg(key)); + q.prepare(QString("SELECT ROWID FROM %1.sqlite_master" + " WHERE type='table'") + .arg(key)); if (!q.exec() || !q.next()) { q.finish(); ExecSchemaCommandsFromFile(db, attached_databases_[key].schema_, 0); @@ -473,7 +479,8 @@ void Database::UrlEncodeFilenameColumn(const QString& table, QSqlDatabase& db) { QSqlQuery select(db); select.prepare(QString("SELECT ROWID, filename FROM %1").arg(table)); QSqlQuery update(db); - update.prepare(QString("UPDATE %1 SET filename=:filename WHERE ROWID=:id").arg(table)); + update.prepare( + QString("UPDATE %1 SET filename=:filename WHERE ROWID=:id").arg(table)); select.exec(); if (CheckErrors(select)) return; while (select.next()) { @@ -568,9 +575,9 @@ QStringList Database::SongsTables(QSqlDatabase& db, int schema_version) const { // look for the tables in attached dbs for (const QString& key : attached_databases_.keys()) { QSqlQuery q(db); - q.prepare(QString( - "SELECT NAME FROM %1.sqlite_master" - " WHERE type='table' AND name='songs' OR name LIKE '%songs'") + q.prepare( + QString("SELECT NAME FROM %1.sqlite_master" + " WHERE type='table' AND name='songs' OR name LIKE '%songs'") .arg(key)); if (q.exec()) { while (q.next()) { diff --git a/src/core/database.h b/src/core/database.h index 690979af4..b209eafa4 100644 --- a/src/core/database.h +++ b/src/core/database.h @@ -24,6 +24,8 @@ #ifndef CORE_DATABASE_H_ #define CORE_DATABASE_H_ +#include + #include #include #include @@ -31,8 +33,6 @@ #include #include -#include - #include "gtest/gtest_prod.h" extern "C" { diff --git a/src/core/deletefiles.cpp b/src/core/deletefiles.cpp index 43310b9ea..f99ebf1a3 100644 --- a/src/core/deletefiles.cpp +++ b/src/core/deletefiles.cpp @@ -20,8 +20,8 @@ #include "deletefiles.h" #include -#include #include +#include #include #include "musicstorage.h" diff --git a/src/core/deletefiles.h b/src/core/deletefiles.h index b41218b9a..b2aab501e 100644 --- a/src/core/deletefiles.h +++ b/src/core/deletefiles.h @@ -20,9 +20,8 @@ #ifndef CORE_DELETEFILES_H_ #define CORE_DELETEFILES_H_ -#include - #include +#include #include "song.h" diff --git a/src/core/filesystemmusicstorage.cpp b/src/core/filesystemmusicstorage.cpp index f1a931626..6d31cc994 100644 --- a/src/core/filesystemmusicstorage.cpp +++ b/src/core/filesystemmusicstorage.cpp @@ -21,13 +21,14 @@ */ #include "filesystemmusicstorage.h" -#include "core/logging.h" -#include "core/utilities.h" #include #include #include +#include "core/logging.h" +#include "core/utilities.h" + FilesystemMusicStorage::FilesystemMusicStorage(const QString& root) : root_(root) {} diff --git a/src/core/globalshortcuts.cpp b/src/core/globalshortcuts.cpp index b1c87c5f8..672c43940 100644 --- a/src/core/globalshortcuts.cpp +++ b/src/core/globalshortcuts.cpp @@ -19,19 +19,19 @@ along with Clementine. If not, see . */ -#include "config.h" #include "globalshortcuts.h" -#include "gnomeglobalshortcutbackend.h" -#include "kglobalaccelglobalshortcutbackend.h" -#include "macglobalshortcutbackend.h" -#include "qxtglobalshortcutbackend.h" - -#include "mac_startup.h" #include #include #include +#include "config.h" +#include "gnomeglobalshortcutbackend.h" +#include "kglobalaccelglobalshortcutbackend.h" +#include "mac_startup.h" +#include "macglobalshortcutbackend.h" +#include "qxtglobalshortcutbackend.h" + #ifdef HAVE_DBUS #include #endif diff --git a/src/core/globalshortcuts.h b/src/core/globalshortcuts.h index c811f71e6..10bb11e57 100644 --- a/src/core/globalshortcuts.h +++ b/src/core/globalshortcuts.h @@ -59,7 +59,7 @@ class GlobalShortcuts : public QWidget { void Unregister(); void Register(); -signals: + signals: void Play(); void Pause(); void PlayPause(); diff --git a/src/core/gnomeglobalshortcutbackend.cpp b/src/core/gnomeglobalshortcutbackend.cpp index ffc82aeff..1a51da575 100644 --- a/src/core/gnomeglobalshortcutbackend.cpp +++ b/src/core/gnomeglobalshortcutbackend.cpp @@ -17,11 +17,12 @@ along with Clementine. If not, see . */ +#include "gnomeglobalshortcutbackend.h" + #include "config.h" #include "core/closure.h" #include "core/logging.h" #include "globalshortcuts.h" -#include "gnomeglobalshortcutbackend.h" #ifdef HAVE_DBUS #include @@ -111,7 +112,7 @@ void GnomeGlobalShortcutBackend::DoUnregister() { #ifdef HAVE_DBUS // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( - kGsdService)) + kGsdService)) return; if (!interface_ || !is_connected_) return; diff --git a/src/core/kglobalaccelglobalshortcutbackend.cpp b/src/core/kglobalaccelglobalshortcutbackend.cpp index fcb40d665..d0733ee22 100644 --- a/src/core/kglobalaccelglobalshortcutbackend.cpp +++ b/src/core/kglobalaccelglobalshortcutbackend.cpp @@ -1,9 +1,10 @@ -#include "core/logging.h" #include "kglobalaccelglobalshortcutbackend.h" #include #include +#include "core/logging.h" + #ifdef HAVE_DBUS #include diff --git a/src/core/kglobalaccelglobalshortcutbackend.h b/src/core/kglobalaccelglobalshortcutbackend.h index 8f687df84..98908e86c 100644 --- a/src/core/kglobalaccelglobalshortcutbackend.h +++ b/src/core/kglobalaccelglobalshortcutbackend.h @@ -1,13 +1,13 @@ #ifndef CORE_KGLOBALACCELGLOBALSHORTCUTBACKEND_H_ #define CORE_KGLOBALACCELGLOBALSHORTCUTBACKEND_H_ +#include +#include + #include "config.h" #include "globalshortcutbackend.h" #include "globalshortcuts.h" -#include -#include - class QAction; class OrgKdeKGlobalAccelInterface; diff --git a/src/core/mac_delegate.h b/src/core/mac_delegate.h index b3127d121..a1c88a173 100644 --- a/src/core/mac_delegate.h +++ b/src/core/mac_delegate.h @@ -29,7 +29,7 @@ class PlatformInterface; @class SPMediaKeyTap; -@interface AppDelegate : NSObject { +@interface AppDelegate : NSObject { PlatformInterface* application_handler_; NSMenu* dock_menu_; MacGlobalShortcutBackend* shortcut_handler_; @@ -43,20 +43,16 @@ class PlatformInterface; - (id)initWithHandler:(PlatformInterface*)handler; // NSApplicationDelegate -- (BOOL)applicationShouldHandleReopen:(NSApplication*)app - hasVisibleWindows:(BOOL)flag; +- (BOOL)applicationShouldHandleReopen:(NSApplication*)app hasVisibleWindows:(BOOL)flag; - (NSMenu*)applicationDockMenu:(NSApplication*)sender; - (void)applicationDidFinishLaunching:(NSNotification*)aNotification; -- (NSApplicationTerminateReply)applicationShouldTerminate: - (NSApplication*)sender; +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; // NSUserNotificationCenterDelegate -- (BOOL)userNotificationCenter:(id)center - shouldPresentNotification:(id)notification; +- (BOOL)userNotificationCenter:(id)center shouldPresentNotification:(id)notification; - (void)setDockMenu:(NSMenu*)menu; - (MacGlobalShortcutBackend*)shortcut_handler; - (void)setShortcutHandler:(MacGlobalShortcutBackend*)backend; -- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap - receivedMediaKeyEvent:(NSEvent*)event; +- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event; @end diff --git a/src/core/mac_startup.mm b/src/core/mac_startup.mm index cb3f4e214..a837bb1e4 100644 --- a/src/core/mac_startup.mm +++ b/src/core/mac_startup.mm @@ -41,15 +41,15 @@ #import "3rdparty/SPMediaKeyTap/SPMediaKeyTap.h" #include "config.h" +#include "core/logging.h" +#include "core/scoped_cftyperef.h" +#include "core/scoped_nsautorelease_pool.h" #include "globalshortcuts.h" #include "mac_delegate.h" #include "mac_startup.h" #include "mac_utilities.h" #include "macglobalshortcutbackend.h" #include "utilities.h" -#include "core/logging.h" -#include "core/scoped_cftyperef.h" -#include "core/scoped_nsautorelease_pool.h" #ifdef HAVE_SPARKLE #import @@ -127,16 +127,15 @@ static BreakpadRef InitBreakpad() { // Register defaults for the whitelist of apps that want to use media keys [[NSUserDefaults standardUserDefaults] - registerDefaults: - [NSDictionary - dictionaryWithObjectsAndKeys: - [SPMediaKeyTap defaultMediaKeyUserBundleIdentifiers], - kMediaKeyUsingBundleIdentifiersDefaultsKey, nil]]; + registerDefaults:[NSDictionary + dictionaryWithObjectsAndKeys:[SPMediaKeyTap + defaultMediaKeyUserBundleIdentifiers], + kMediaKeyUsingBundleIdentifiersDefaultsKey, + nil]]; return self; } -- (BOOL)applicationShouldHandleReopen:(NSApplication*)app - hasVisibleWindows:(BOOL)flag { +- (BOOL)applicationShouldHandleReopen:(NSApplication*)app hasVisibleWindows:(BOOL)flag { if (application_handler_) { application_handler_->Activate(); } @@ -163,10 +162,9 @@ static BreakpadRef InitBreakpad() { key_tap_ = [[SPMediaKeyTap alloc] initWithDelegate:self]; if ([SPMediaKeyTap usesGlobalMediaKeyTap] && ![[NSProcessInfo processInfo] - isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){ - .majorVersion = 10, - .minorVersion = 12, - .patchVersion = 0}]) { + isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = 10, + .minorVersion = 12, + .patchVersion = 0}]) { [key_tap_ startWatchingMediaKeys]; } else { qLog(Warning) << "Media key monitoring disabled"; @@ -185,16 +183,13 @@ static BreakpadRef InitBreakpad() { - (void)application:(NSApplication*)app openFiles:(NSArray*)filenames { qLog(Debug) << "Wants to open:" << filenames; - [filenames - enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL* stop) { - [self application:app openFile:(NSString*)object]; - }]; + [filenames enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL* stop) { + [self application:app openFile:(NSString*)object]; + }]; } -- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap - receivedMediaKeyEvent:(NSEvent*)event { - NSAssert([event type] == NSSystemDefined && - [event subtype] == SPSystemDefinedEventMediaKeys, +- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event { + NSAssert([event type] == NSSystemDefined && [event subtype] == SPSystemDefinedEventMediaKeys, @"Unexpected NSEvent in mediaKeyTap:receivedMediaKeyEvent:"); int key_code = (([event data1] & 0xFFFF0000) >> 16); @@ -211,16 +206,14 @@ static BreakpadRef InitBreakpad() { } } -- (NSApplicationTerminateReply)applicationShouldTerminate: - (NSApplication*)sender { +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender { #ifdef HAVE_BREAKPAD BreakpadRelease(breakpad_); #endif return NSTerminateNow; } -- (BOOL)userNotificationCenter:(id)center - shouldPresentNotification:(id)notification { +- (BOOL)userNotificationCenter:(id)center shouldPresentNotification:(id)notification { // Always show notifications, even if Clementine is in the foreground. return YES; } @@ -257,14 +250,12 @@ static BreakpadRef InitBreakpad() { [delegate_ setShortcutHandler:shortcut_handler_]; [self setDelegate:delegate_]; - [[NSUserNotificationCenter defaultUserNotificationCenter] - setDelegate:delegate_]; + [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:delegate_]; } - (void)sendEvent:(NSEvent*)event { // If event tap is not installed, handle events that reach the app instead - BOOL shouldHandleMediaKeyEventLocally = - ![SPMediaKeyTap usesGlobalMediaKeyTap]; + BOOL shouldHandleMediaKeyEventLocally = ![SPMediaKeyTap usesGlobalMediaKeyTap]; if (shouldHandleMediaKeyEventLocally && [event type] == NSSystemDefined && [event subtype] == SPSystemDefinedEventMediaKeys) { @@ -288,13 +279,9 @@ void MacMain() { #endif } -void SetShortcutHandler(MacGlobalShortcutBackend* handler) { - [NSApp SetShortcutHandler:handler]; -} +void SetShortcutHandler(MacGlobalShortcutBackend* handler) { [NSApp SetShortcutHandler:handler]; } -void SetApplicationHandler(PlatformInterface* handler) { - [NSApp SetApplicationHandler:handler]; -} +void SetApplicationHandler(PlatformInterface* handler) { [NSApp SetApplicationHandler:handler]; } void CheckForUpdates() { #ifdef HAVE_SPARKLE @@ -303,12 +290,10 @@ void CheckForUpdates() { } QString GetBundlePath() { - ScopedCFTypeRef app_url( - CFBundleCopyBundleURL(CFBundleGetMainBundle())); + ScopedCFTypeRef app_url(CFBundleCopyBundleURL(CFBundleGetMainBundle())); ScopedCFTypeRef mac_path( CFURLCopyFileSystemPath(app_url.get(), kCFURLPOSIXPathStyle)); - const char* path = - CFStringGetCStringPtr(mac_path.get(), CFStringGetSystemEncoding()); + const char* path = CFStringGetCStringPtr(mac_path.get(), CFStringGetSystemEncoding()); QString bundle_path = QString::fromUtf8(path); return bundle_path; } @@ -320,8 +305,8 @@ QString GetResourcesPath() { QString GetApplicationSupportPath() { ScopedNSAutoreleasePool pool; - NSArray* paths = NSSearchPathForDirectoriesInDomains( - NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSArray* paths = + NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); QString ret; if ([paths count] > 0) { NSString* user_path = [paths objectAtIndex:0]; @@ -334,8 +319,7 @@ QString GetApplicationSupportPath() { QString GetMusicDirectory() { ScopedNSAutoreleasePool pool; - NSArray* paths = NSSearchPathForDirectoriesInDomains(NSMusicDirectory, - NSUserDomainMask, YES); + NSArray* paths = NSSearchPathForDirectoriesInDomains(NSMusicDirectory, NSUserDomainMask, YES); QString ret; if ([paths count] > 0) { NSString* user_path = [paths objectAtIndex:0]; diff --git a/src/core/mac_utilities.h b/src/core/mac_utilities.h index 13befb14e..7051709a9 100644 --- a/src/core/mac_utilities.h +++ b/src/core/mac_utilities.h @@ -16,10 +16,10 @@ along with Clementine. If not, see . */ -#include - #include +#include + #ifdef __OBJC__ @class NSEvent; #else @@ -31,4 +31,4 @@ namespace mac { QKeySequence KeySequenceFromNSEvent(NSEvent* event); void DumpDictionary(CFDictionaryRef dict); float GetDevicePixelRatio(QWidget* widget); -} +} // namespace mac diff --git a/src/core/macfslistener.mm b/src/core/macfslistener.mm index a3a27cb95..0d882e811 100644 --- a/src/core/macfslistener.mm +++ b/src/core/macfslistener.mm @@ -28,7 +28,10 @@ #include "core/scoped_nsobject.h" MacFSListener::MacFSListener(QObject* parent) - : FileSystemWatcherInterface(parent), run_loop_(nullptr), stream_(nullptr), update_timer_(new QTimer(this)) { + : FileSystemWatcherInterface(parent), + run_loop_(nullptr), + stream_(nullptr), + update_timer_(new QTimer(this)) { update_timer_->setSingleShot(true); update_timer_->setInterval(2000); connect(update_timer_, SIGNAL(timeout()), SLOT(UpdateStream())); @@ -36,10 +39,10 @@ MacFSListener::MacFSListener(QObject* parent) void MacFSListener::Init() { run_loop_ = CFRunLoopGetCurrent(); } -void MacFSListener::EventStreamCallback( - ConstFSEventStreamRef stream, void* user_data, size_t num_events, - void* event_paths, const FSEventStreamEventFlags event_flags[], - const FSEventStreamEventId event_ids[]) { +void MacFSListener::EventStreamCallback(ConstFSEventStreamRef stream, void* user_data, + size_t num_events, void* event_paths, + const FSEventStreamEventFlags event_flags[], + const FSEventStreamEventId event_ids[]) { MacFSListener* me = reinterpret_cast(user_data); char** paths = reinterpret_cast(event_paths); for (int i = 0; i < num_events; ++i) { @@ -97,10 +100,10 @@ void MacFSListener::UpdateStream() { context.info = this; CFAbsoluteTime latency = 1.0; - stream_ = FSEventStreamCreate(nullptr, &EventStreamCallback, &context, // Copied - reinterpret_cast(array.get()), - kFSEventStreamEventIdSinceNow, latency, - kFSEventStreamCreateFlagNone); + stream_ = + FSEventStreamCreate(nullptr, &EventStreamCallback, &context, // Copied + reinterpret_cast(array.get()), kFSEventStreamEventIdSinceNow, + latency, kFSEventStreamCreateFlagNone); FSEventStreamScheduleWithRunLoop(stream_, run_loop_, kCFRunLoopDefaultMode); FSEventStreamStart(stream_); diff --git a/src/core/macglobalshortcutbackend.h b/src/core/macglobalshortcutbackend.h index 298cb2c54..62c99dc16 100644 --- a/src/core/macglobalshortcutbackend.h +++ b/src/core/macglobalshortcutbackend.h @@ -20,13 +20,12 @@ #ifndef CORE_MACGLOBALSHORTCUTBACKEND_H_ #define CORE_MACGLOBALSHORTCUTBACKEND_H_ +#include +#include #include #include "globalshortcutbackend.h" -#include -#include - class MacGlobalShortcutBackendPrivate; class QAction; diff --git a/src/core/macglobalshortcutbackend.mm b/src/core/macglobalshortcutbackend.mm index a86a63761..c26a1230e 100644 --- a/src/core/macglobalshortcutbackend.mm +++ b/src/core/macglobalshortcutbackend.mm @@ -22,9 +22,9 @@ #include #include +#include #include #include -#include #include #include @@ -47,19 +47,16 @@ class MacGlobalShortcutBackendPrivate : boost::noncopyable { : global_monitor_(nil), local_monitor_(nil), backend_(backend) {} bool Register() { - global_monitor_ = - [NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask - handler:^(NSEvent* event) { - HandleKeyEvent(event); - }]; + global_monitor_ = [NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask + handler:^(NSEvent* event) { + HandleKeyEvent(event); + }]; local_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent* event) { - // Filter event if we handle - // it as a global shortcut. - return HandleKeyEvent(event) - ? nil - : event; + // Filter event if we handle + // it as a global shortcut. + return HandleKeyEvent(event) ? nil : event; }]; return true; } @@ -81,8 +78,7 @@ class MacGlobalShortcutBackendPrivate : boost::noncopyable { }; MacGlobalShortcutBackend::MacGlobalShortcutBackend(GlobalShortcuts* parent) - : GlobalShortcutBackend(parent), - p_(new MacGlobalShortcutBackendPrivate(this)) {} + : GlobalShortcutBackend(parent), p_(new MacGlobalShortcutBackendPrivate(this)) {} MacGlobalShortcutBackend::~MacGlobalShortcutBackend() {} @@ -90,8 +86,7 @@ bool MacGlobalShortcutBackend::DoRegister() { // Always enable media keys. mac::SetShortcutHandler(this); - for (const GlobalShortcuts::Shortcut& shortcut : - manager_->shortcuts().values()) { + for (const GlobalShortcuts::Shortcut& shortcut : manager_->shortcuts().values()) { shortcuts_[shortcut.action->shortcut()] = shortcut.action; } return p_->Register(); @@ -130,21 +125,21 @@ bool MacGlobalShortcutBackend::KeyPressed(const QKeySequence& sequence) { bool MacGlobalShortcutBackend::IsAccessibilityEnabled() const { bool accessibilityEnabled; - try{ + try { accessibilityEnabled = AXAPIEnabled(); - }catch(...){ - NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES}; + } catch (...) { + NSDictionary* options = @{(id)kAXTrustedCheckOptionPrompt : @YES}; accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options); } return accessibilityEnabled; } void MacGlobalShortcutBackend::ShowAccessibilityDialog() { - NSArray* paths = NSSearchPathForDirectoriesInDomains( - NSPreferencePanesDirectory, NSSystemDomainMask, YES); + NSArray* paths = + NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSSystemDomainMask, YES); if ([paths count] == 1) { - SBSystemPreferencesApplication* system_prefs = [SBApplication - applicationWithBundleIdentifier:@"com.apple.systempreferences"]; + SBSystemPreferencesApplication* system_prefs = + [SBApplication applicationWithBundleIdentifier:@"com.apple.systempreferences"]; [system_prefs activate]; SBElementArray* panes = [system_prefs panes]; diff --git a/src/core/mergedproxymodel.cpp b/src/core/mergedproxymodel.cpp index 703df79c4..14c706eac 100644 --- a/src/core/mergedproxymodel.cpp +++ b/src/core/mergedproxymodel.cpp @@ -19,21 +19,21 @@ */ #include "mergedproxymodel.h" -#include "core/logging.h" #include - #include #include +#include "core/logging.h" + // boost::multi_index still relies on these being in the global namespace. using std::placeholders::_1; using std::placeholders::_2; -#include -#include #include +#include #include +#include using boost::multi_index::hashed_unique; using boost::multi_index::identity; @@ -48,8 +48,8 @@ std::size_t hash_value(const QModelIndex& index) { return qHash(index); } namespace { struct Mapping { - explicit Mapping(const QModelIndex& _source_index) : - source_index(_source_index) {} + explicit Mapping(const QModelIndex& _source_index) + : source_index(_source_index) {} QModelIndex source_index; }; @@ -65,8 +65,8 @@ class MergedProxyModelPrivate { Mapping*, indexed_by< hashed_unique, - member >, - ordered_unique, identity > > > + member>, + ordered_unique, identity>>> MappingContainer; public: @@ -264,8 +264,8 @@ void MergedProxyModel::RowsRemoved(const QModelIndex&, int, int) { endRemoveRows(); } -QModelIndex MergedProxyModel::mapToSource(const QModelIndex& proxy_index) - const { +QModelIndex MergedProxyModel::mapToSource( + const QModelIndex& proxy_index) const { if (!proxy_index.isValid()) return QModelIndex(); Mapping* mapping = static_cast(proxy_index.internalPointer()); @@ -277,8 +277,8 @@ QModelIndex MergedProxyModel::mapToSource(const QModelIndex& proxy_index) return mapping->source_index; } -QModelIndex MergedProxyModel::mapFromSource(const QModelIndex& source_index) - const { +QModelIndex MergedProxyModel::mapFromSource( + const QModelIndex& source_index) const { if (!source_index.isValid()) return QModelIndex(); if (source_index.model() == resetting_model_) return QModelIndex(); @@ -376,8 +376,8 @@ QVariant MergedProxyModel::data(const QModelIndex& proxyIndex, int role) const { return source_index.model()->data(source_index, role); } -QMap MergedProxyModel::itemData(const QModelIndex& proxy_index) - const { +QMap MergedProxyModel::itemData( + const QModelIndex& proxy_index) const { QModelIndex source_index = mapToSource(proxy_index); if (!source_index.isValid()) return sourceModel()->itemData(QModelIndex()); @@ -442,8 +442,8 @@ bool MergedProxyModel::dropMimeData(const QMimeData* data, return sourceModel()->dropMimeData(data, action, row, column, parent); } -QModelIndex MergedProxyModel::FindSourceParent(const QModelIndex& proxy_index) - const { +QModelIndex MergedProxyModel::FindSourceParent( + const QModelIndex& proxy_index) const { if (!proxy_index.isValid()) return QModelIndex(); QModelIndex source_index = mapToSource(proxy_index); @@ -468,8 +468,8 @@ void MergedProxyModel::fetchMore(const QModelIndex& parent) { GetModel(source_index)->fetchMore(source_index); } -QAbstractItemModel* MergedProxyModel::GetModel(const QModelIndex& source_index) - const { +QAbstractItemModel* MergedProxyModel::GetModel( + const QModelIndex& source_index) const { // This is essentially const_cast(source_index.model()), // but without the const_cast const QAbstractItemModel* const_model = source_index.model(); diff --git a/src/core/mergedproxymodel.h b/src/core/mergedproxymodel.h index fbde1e6cf..51c76ee28 100644 --- a/src/core/mergedproxymodel.h +++ b/src/core/mergedproxymodel.h @@ -20,9 +20,8 @@ #ifndef CORE_MERGEDPROXYMODEL_H_ #define CORE_MERGEDPROXYMODEL_H_ -#include - #include +#include std::size_t hash_value(const QModelIndex& index); diff --git a/src/core/metatypes.cpp b/src/core/metatypes.cpp index e6584568a..232b4feb2 100644 --- a/src/core/metatypes.cpp +++ b/src/core/metatypes.cpp @@ -45,6 +45,7 @@ #ifdef HAVE_DBUS #include + #include "core/mpris2.h" #include "dbus/metatypes.h" #endif diff --git a/src/core/mpris.cpp b/src/core/mpris.cpp index b1db6b206..9c9cc5e7c 100644 --- a/src/core/mpris.cpp +++ b/src/core/mpris.cpp @@ -18,6 +18,7 @@ */ #include "mpris.h" + #include "mpris2.h" namespace mpris { diff --git a/src/core/mpris2.cpp b/src/core/mpris2.cpp index 7056d5bcb..9cb7a7887 100644 --- a/src/core/mpris2.cpp +++ b/src/core/mpris2.cpp @@ -23,20 +23,19 @@ #include "mpris2.h" -#include - #include #include #include +#include #include "config.h" #include "core/application.h" #include "core/logging.h" -#include "core/mpris_common.h" #include "core/mpris2_player.h" #include "core/mpris2_playlists.h" #include "core/mpris2_root.h" #include "core/mpris2_tracklist.h" +#include "core/mpris_common.h" #include "core/player.h" #include "core/timeconstants.h" #include "covers/currentartloader.h" @@ -207,8 +206,9 @@ QString Mpris2::DesktopEntryAbsolutePath() const { xdg_data_dirs.append("/usr/share/"); for (const QString& directory : xdg_data_dirs) { - QString path = QString("%1/applications/%2.desktop").arg( - directory, QApplication::applicationName().toLower()); + QString path = + QString("%1/applications/%2.desktop") + .arg(directory, QApplication::applicationName().toLower()); if (QFile::exists(path)) return path; } return QString(); @@ -506,7 +506,7 @@ QDBusObjectPath MakePlaylistPath(int id) { return QDBusObjectPath( QString("/org/clementineplayer/clementine/PlaylistId/%1").arg(id)); } -} +} // namespace MaybePlaylist Mpris2::ActivePlaylist() const { MaybePlaylist maybe_playlist; diff --git a/src/core/mpris2.h b/src/core/mpris2.h index e2e91a4c8..acfb3d8f7 100644 --- a/src/core/mpris2.h +++ b/src/core/mpris2.h @@ -177,7 +177,7 @@ class Mpris2 : public QObject { QList GetPlaylists(quint32 index, quint32 max_count, const QString& order, bool reverse_order); -signals: + signals: // Player void Seeked(qlonglong position); diff --git a/src/core/multisortfilterproxy.cpp b/src/core/multisortfilterproxy.cpp index ac861e111..7bec53dce 100644 --- a/src/core/multisortfilterproxy.cpp +++ b/src/core/multisortfilterproxy.cpp @@ -18,12 +18,13 @@ */ #include "multisortfilterproxy.h" -#include "core/logging.h" #include #include #include +#include "core/logging.h" + MultiSortFilterProxy::MultiSortFilterProxy(QObject* parent) : QSortFilterProxyModel(parent) {} diff --git a/src/core/musicstorage.h b/src/core/musicstorage.h index bf47ab1f5..dabd69f67 100644 --- a/src/core/musicstorage.h +++ b/src/core/musicstorage.h @@ -20,12 +20,11 @@ #ifndef CORE_MUSICSTORAGE_H_ #define CORE_MUSICSTORAGE_H_ -#include "song.h" - +#include #include #include -#include +#include "song.h" class MusicStorage { public: diff --git a/src/core/network.cpp b/src/core/network.cpp index 7f29dec41..652d7d834 100644 --- a/src/core/network.cpp +++ b/src/core/network.cpp @@ -17,7 +17,6 @@ along with Clementine. If not, see . */ -#include "core/logging.h" #include "network.h" #include @@ -27,6 +26,7 @@ #include #include "core/closure.h" +#include "core/logging.h" #include "utilities.h" QMutex ThreadSafeNetworkDiskCache::sMutex; diff --git a/src/core/networkproxyfactory.cpp b/src/core/networkproxyfactory.cpp index f352af029..4f140094e 100644 --- a/src/core/networkproxyfactory.cpp +++ b/src/core/networkproxyfactory.cpp @@ -17,16 +17,16 @@ along with Clementine. If not, see . */ - #include "networkproxyfactory.h" -#include "core/logging.h" + +#include #include #include #include #include -#include +#include "core/logging.h" NetworkProxyFactory* NetworkProxyFactory::sInstance = nullptr; const char* NetworkProxyFactory::kSettingsGroup = "Proxy"; diff --git a/src/core/networkproxyfactory.h b/src/core/networkproxyfactory.h index ba304a08c..56a28f550 100644 --- a/src/core/networkproxyfactory.h +++ b/src/core/networkproxyfactory.h @@ -27,7 +27,11 @@ class NetworkProxyFactory : public QNetworkProxyFactory { public: // These values are persisted - enum Mode { Mode_System = 0, Mode_Direct = 1, Mode_Manual = 2, }; + enum Mode { + Mode_System = 0, + Mode_Direct = 1, + Mode_Manual = 2, + }; static NetworkProxyFactory* Instance(); static const char* kSettingsGroup; diff --git a/src/core/organise.cpp b/src/core/organise.cpp index 699728354..ddd251d22 100644 --- a/src/core/organise.cpp +++ b/src/core/organise.cpp @@ -21,19 +21,18 @@ #include "organise.h" -#include - #include #include -#include #include +#include #include +#include -#include "musicstorage.h" -#include "taskmanager.h" #include "core/logging.h" #include "core/tagreaderclient.h" #include "core/utilities.h" +#include "musicstorage.h" +#include "taskmanager.h" using std::placeholders::_1; @@ -43,8 +42,8 @@ const int Organise::kTranscodeProgressInterval = 500; Organise::Organise(TaskManager* task_manager, std::shared_ptr destination, const OrganiseFormat& format, bool copy, bool overwrite, - bool mark_as_listened, - const NewSongInfoList& songs_info, bool eject_after) + bool mark_as_listened, const NewSongInfoList& songs_info, + bool eject_after) : thread_(nullptr), task_manager_(task_manager), transcoder_(new Transcoder(this)), @@ -203,8 +202,8 @@ void Organise::ProcessSomeFiles() { if (job.remove_original_) { // Notify other aspects of system that song has been invalidated QString root = destination_->LocalPath(); - QFileInfo new_file = QFileInfo( - root + "/" + task.song_info_.new_filename_); + QFileInfo new_file = + QFileInfo(root + "/" + task.song_info_.new_filename_); emit SongPathChanged(song, new_file); } if (job.mark_as_listened_) { @@ -288,7 +287,8 @@ void Organise::UpdateProgress() { task_manager_->SetTaskProgress(task_id_, progress, total); } -void Organise::FileTranscoded(const QString& input, const QString& output, bool success) { +void Organise::FileTranscoded(const QString& input, const QString& output, + bool success) { qLog(Info) << "File finished" << input << success; transcode_progress_timer_.stop(); diff --git a/src/core/organise.h b/src/core/organise.h index 3f3dba110..1f0033c0d 100644 --- a/src/core/organise.h +++ b/src/core/organise.h @@ -22,12 +22,11 @@ #ifndef CORE_ORGANISE_H_ #define CORE_ORGANISE_H_ -#include - -#include #include +#include #include #include +#include #include "organiseformat.h" #include "transcoder/transcoder.h" @@ -68,7 +67,8 @@ class Organise : public QObject { private slots: void ProcessSomeFiles(); - void FileTranscoded(const QString& input, const QString& output, bool success); + void FileTranscoded(const QString& input, const QString& output, + bool success); private: void SetSongProgress(float progress, bool transcoded = false); diff --git a/src/core/organiseformat.h b/src/core/organiseformat.h index 4fd95f61c..d65ce79d0 100644 --- a/src/core/organiseformat.h +++ b/src/core/organiseformat.h @@ -21,8 +21,8 @@ #define CORE_ORGANISEFORMAT_H_ #include -#include #include +#include #include "core/song.h" diff --git a/src/core/player.cpp b/src/core/player.cpp index 2e1a91a6a..172616aa6 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -27,12 +27,11 @@ #include "player.h" -#include - #include #include -#include #include +#include +#include #include "config.h" #include "core/application.h" @@ -114,7 +113,8 @@ void Player::ReloadSettings() { void Player::HandleLoadResult(const UrlHandler::LoadResult& result) { // Might've been an async load, so check we're still on the same item - shared_ptr item = app_->playlist_manager()->active()->current_item(); + shared_ptr item = + app_->playlist_manager()->active()->current_item(); if (!item) { loading_async_ = QUrl(); return; @@ -624,7 +624,7 @@ void Player::InvalidSongRequested(const QUrl& url) { emit SongChangeRequestProcessed(url, false); // ... and now when our listeners have completed their processing of the // current item we can change the current item by skipping to the next song - + QSettings s; s.beginGroup(kSettingsGroup); diff --git a/src/core/player.h b/src/core/player.h index 7dd141965..608cf7c15 100644 --- a/src/core/player.h +++ b/src/core/player.h @@ -27,11 +27,10 @@ #ifndef CORE_PLAYER_H_ #define CORE_PLAYER_H_ -#include - #include #include #include +#include #include "config.h" #include "core/song.h" @@ -92,7 +91,7 @@ class PlayerInterface : public QObject { virtual void Play() = 0; virtual void ShowOSD() = 0; -signals: + signals: void Playing(); void Paused(); void Stopped(); diff --git a/src/core/qtfslistener.h b/src/core/qtfslistener.h index eeed5ad4d..805f99b5f 100644 --- a/src/core/qtfslistener.h +++ b/src/core/qtfslistener.h @@ -20,10 +20,10 @@ #ifndef CORE_QTFSLISTENER_H_ #define CORE_QTFSLISTENER_H_ -#include "filesystemwatcherinterface.h" - #include +#include "filesystemwatcherinterface.h" + class QtFSListener : public FileSystemWatcherInterface { Q_OBJECT public: diff --git a/src/core/qxtglobalshortcutbackend.cpp b/src/core/qxtglobalshortcutbackend.cpp index 6c87860e2..1acd08a10 100644 --- a/src/core/qxtglobalshortcutbackend.cpp +++ b/src/core/qxtglobalshortcutbackend.cpp @@ -17,15 +17,16 @@ along with Clementine. If not, see . */ -#include "globalshortcuts.h" #include "qxtglobalshortcutbackend.h" -#include "qxtglobalshortcut.h" -#include "core/logging.h" #include #include #include +#include "core/logging.h" +#include "globalshortcuts.h" +#include "qxtglobalshortcut.h" + QxtGlobalShortcutBackend::QxtGlobalShortcutBackend(GlobalShortcuts* parent) : GlobalShortcutBackend(parent) {} diff --git a/src/core/scopedtransaction.cpp b/src/core/scopedtransaction.cpp index 72d98583b..c5db1745d 100644 --- a/src/core/scopedtransaction.cpp +++ b/src/core/scopedtransaction.cpp @@ -18,11 +18,12 @@ */ #include "scopedtransaction.h" -#include "core/logging.h" #include #include +#include "core/logging.h" + ScopedTransaction::ScopedTransaction(QSqlDatabase* db) : db_(db), pending_(true) { db->transaction(); diff --git a/src/core/settingsprovider.h b/src/core/settingsprovider.h index 1ed6b14db..d410376ca 100644 --- a/src/core/settingsprovider.h +++ b/src/core/settingsprovider.h @@ -19,8 +19,8 @@ #ifndef CORE_SETTINGSPROVIDER_H_ #define CORE_SETTINGSPROVIDER_H_ -#include #include +#include class SettingsProvider { public: diff --git a/src/core/signalchecker.cpp b/src/core/signalchecker.cpp index 2b0505638..5139464fa 100644 --- a/src/core/signalchecker.cpp +++ b/src/core/signalchecker.cpp @@ -22,7 +22,7 @@ #include "core/logging.h" gulong CheckedGConnect(gpointer source, const char* signal, GCallback callback, - gpointer data, const int callback_param_count) { + gpointer data, const int callback_param_count) { guint signal_id = 0; GQuark detail = 0; diff --git a/src/core/simpletreeitem.h b/src/core/simpletreeitem.h index 6f43610cb..742b9cab0 100644 --- a/src/core/simpletreeitem.h +++ b/src/core/simpletreeitem.h @@ -20,10 +20,10 @@ #ifndef CORE_SIMPLETREEITEM_H_ #define CORE_SIMPLETREEITEM_H_ -#include "simpletreemodel.h" - -#include #include +#include + +#include "simpletreemodel.h" template class SimpleTreeItem { diff --git a/src/core/song.cpp b/src/core/song.cpp index 31d630ec8..f5037afc3 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -28,8 +28,6 @@ #include "song.h" -#include - #include #include #include @@ -41,6 +39,7 @@ #include #include #include +#include #ifdef HAVE_LIBLASTFM #include "internet/lastfm/fixlastfm.h" diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index f8879cb92..c9de0e2d7 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -22,27 +22,26 @@ #include "songloader.h" -#include -#include - #include #include #include #include #include #include +#include +#include #include "config.h" #include "core/logging.h" #include "core/player.h" -#include "core/utilities.h" #include "core/signalchecker.h" #include "core/song.h" #include "core/tagreaderclient.h" #include "core/timeconstants.h" +#include "core/utilities.h" #include "core/waitforsignal.h" -#include "internet/lastfm/fixlastfm.h" #include "internet/core/internetmodel.h" +#include "internet/lastfm/fixlastfm.h" #include "internet/podcasts/podcastparser.h" #include "internet/podcasts/podcastservice.h" #include "internet/podcasts/podcasturlloader.h" @@ -55,6 +54,7 @@ #ifdef HAVE_AUDIOCD #include + #include "devices/cddasongloader.h" #endif @@ -404,8 +404,8 @@ SongLoader::Result SongLoader::LoadRemote() { // Create the source element automatically based on the URL GstElement* source = gst_element_make_from_uri( - GST_URI_SRC, Utilities::GetUriForGstreamer(url_).constData(), - nullptr, nullptr); + GST_URI_SRC, Utilities::GetUriForGstreamer(url_).constData(), nullptr, + nullptr); if (!source) { qLog(Warning) << "Couldn't create gstreamer source element for" << url_.toString(); diff --git a/src/core/songloader.h b/src/core/songloader.h index 0f32378e4..f75f724bc 100644 --- a/src/core/songloader.h +++ b/src/core/songloader.h @@ -23,18 +23,17 @@ #ifndef CORE_SONGLOADER_H_ #define CORE_SONGLOADER_H_ -#include -#include - #include #include #include #include +#include +#include -#include "song.h" #include "core/tagreaderclient.h" #include "musicbrainz/musicbrainzclient.h" +#include "song.h" class CueParser; class LibraryBackendInterface; @@ -79,7 +78,7 @@ class SongLoader : public QObject { void LoadMetadataBlocking(); Result LoadAudioCD(); -signals: + signals: void AudioCDTracksLoaded(); void LoadAudioCDFinished(bool success); void LoadRemoteFinished(); diff --git a/src/core/stylesheetloader.cpp b/src/core/stylesheetloader.cpp index 953f90e9c..f89874b47 100644 --- a/src/core/stylesheetloader.cpp +++ b/src/core/stylesheetloader.cpp @@ -18,10 +18,11 @@ */ #include "stylesheetloader.h" -#include "core/logging.h" -#include #include +#include + +#include "core/logging.h" StyleSheetLoader::StyleSheetLoader(QObject* parent) : QObject(parent) {} diff --git a/src/core/stylesheetloader.h b/src/core/stylesheetloader.h index 3e5d71b9b..f0c7601bc 100644 --- a/src/core/stylesheetloader.h +++ b/src/core/stylesheetloader.h @@ -19,10 +19,10 @@ #ifndef CORE_STYLESHEETLOADER_H_ #define CORE_STYLESHEETLOADER_H_ -#include -#include -#include #include +#include +#include +#include class StyleSheetLoader : public QObject { public: diff --git a/src/core/tagreaderclient.cpp b/src/core/tagreaderclient.cpp index 56a7f6e0e..521ce1824 100644 --- a/src/core/tagreaderclient.cpp +++ b/src/core/tagreaderclient.cpp @@ -18,7 +18,6 @@ along with Clementine. If not, see . */ -#include "player.h" #include "tagreaderclient.h" #include @@ -28,6 +27,8 @@ #include #include +#include "player.h" + const char* TagReaderClient::kWorkerExecutableName = "clementine-tagreader"; TagReaderClient* TagReaderClient::sInstance = nullptr; diff --git a/src/core/tagreaderclient.h b/src/core/tagreaderclient.h index 3e04b17aa..5571f5d56 100644 --- a/src/core/tagreaderclient.h +++ b/src/core/tagreaderclient.h @@ -21,12 +21,12 @@ #ifndef CORE_TAGREADERCLIENT_H_ #define CORE_TAGREADERCLIENT_H_ -#include "song.h" -#include "tagreadermessages.pb.h" +#include + #include "core/messagehandler.h" #include "core/workerpool.h" - -#include +#include "song.h" +#include "tagreadermessages.pb.h" class QLocalServer; class QProcess; diff --git a/src/core/thread.h b/src/core/thread.h index b3eef438f..7a69a6bde 100644 --- a/src/core/thread.h +++ b/src/core/thread.h @@ -19,6 +19,7 @@ #define CORE_THREAD_H_ #include + #include "core/utilities.h" // Improve QThread by adding a SetIoPriority function diff --git a/src/core/ubuntuunityhack.cpp b/src/core/ubuntuunityhack.cpp index 68daae811..f6077bcf3 100644 --- a/src/core/ubuntuunityhack.cpp +++ b/src/core/ubuntuunityhack.cpp @@ -18,11 +18,12 @@ */ #include "ubuntuunityhack.h" -#include "core/logging.h" #include #include +#include "core/logging.h" + const char* UbuntuUnityHack::kGSettingsFileName = "gsettings"; const char* UbuntuUnityHack::kUnityPanel = "com.canonical.Unity.Panel"; const char* UbuntuUnityHack::kUnitySystrayWhitelist = "systray-whitelist"; @@ -43,8 +44,8 @@ UbuntuUnityHack::UbuntuUnityHack(QObject* parent) : QObject(parent) { QProcess* get = new QProcess(this); connect(get, SIGNAL(finished(int)), SLOT(GetFinished(int))); connect(get, SIGNAL(error(QProcess::ProcessError)), SLOT(GetError())); - get->start(kGSettingsFileName, QStringList() << "get" << kUnityPanel - << kUnitySystrayWhitelist); + get->start(kGSettingsFileName, + QStringList() << "get" << kUnityPanel << kUnitySystrayWhitelist); } void UbuntuUnityHack::GetError() { @@ -85,9 +86,9 @@ void UbuntuUnityHack::GetFinished(int exit_code) { QProcess* set = new QProcess(this); connect(set, SIGNAL(finished(int)), set, SLOT(deleteLater())); - set->start(kGSettingsFileName, QStringList() << "set" << kUnityPanel - << kUnitySystrayWhitelist - << whitelist); + set->start(kGSettingsFileName, QStringList() + << "set" << kUnityPanel + << kUnitySystrayWhitelist << whitelist); qLog(Info) << "Clementine has added itself to the Unity system tray" << "whitelist, but this won't take effect until the next time" diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 03a79664f..ddbdb53d2 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -28,8 +28,6 @@ #include -#include - #include #include #include @@ -40,41 +38,44 @@ #include #include #include -#include #include -#include #include #include #include +#include +#include +#include +#include "config.h" #include "core/application.h" #include "core/logging.h" -#include "config.h" #include "timeconstants.h" #if defined(Q_OS_UNIX) #include #elif defined(Q_OS_WIN32) #include + #include #endif #ifdef Q_OS_LINUX -#include #include +#include #endif #ifdef Q_OS_DARWIN #include #endif #ifdef Q_OS_DARWIN +#include + +#include "CoreServices/CoreServices.h" +#include "IOKit/ps/IOPSKeys.h" +#include "IOKit/ps/IOPowerSources.h" #include "core/mac_startup.h" #include "core/mac_utilities.h" #include "core/scoped_cftyperef.h" -#include "CoreServices/CoreServices.h" -#include "IOKit/ps/IOPowerSources.h" -#include "IOKit/ps/IOPSKeys.h" -#include #endif namespace Utilities { diff --git a/src/core/utilities.h b/src/core/utilities.h index aee3a4a4b..b3b95c58f 100644 --- a/src/core/utilities.h +++ b/src/core/utilities.h @@ -23,15 +23,14 @@ #ifndef CORE_UTILITIES_H_ #define CORE_UTILITIES_H_ -#include - #include +#include #include #include -#include #include #include #include +#include class QIODevice; class QMouseEvent; diff --git a/src/covers/albumcoverexporter.cpp b/src/covers/albumcoverexporter.cpp index 991151494..77214a685 100644 --- a/src/covers/albumcoverexporter.cpp +++ b/src/covers/albumcoverexporter.cpp @@ -22,8 +22,8 @@ #include #include -#include "coverexportrunnable.h" #include "core/song.h" +#include "coverexportrunnable.h" const int AlbumCoverExporter::kMaxConcurrentRequests = 3; diff --git a/src/covers/albumcoverexporter.h b/src/covers/albumcoverexporter.h index fff902fe2..17492fc56 100644 --- a/src/covers/albumcoverexporter.h +++ b/src/covers/albumcoverexporter.h @@ -19,14 +19,14 @@ #ifndef COVERS_ALBUMCOVEREXPORTER_H_ #define COVERS_ALBUMCOVEREXPORTER_H_ -#include "coverexportrunnable.h" -#include "core/song.h" -#include "ui/albumcoverexport.h" - #include #include #include +#include "core/song.h" +#include "coverexportrunnable.h" +#include "ui/albumcoverexport.h" + class QThreadPool; class AlbumCoverExporter : public QObject { diff --git a/src/covers/albumcoverfetcher.cpp b/src/covers/albumcoverfetcher.cpp index 3c409bb64..ca43325ae 100644 --- a/src/covers/albumcoverfetcher.cpp +++ b/src/covers/albumcoverfetcher.cpp @@ -90,7 +90,8 @@ void AlbumCoverFetcher::StartRequests() { return; } - while (!queued_requests_.isEmpty() && active_requests_.size() < kMaxConcurrentRequests) { + while (!queued_requests_.isEmpty() && + active_requests_.size() < kMaxConcurrentRequests) { CoverSearchRequest request = queued_requests_.dequeue(); // search objects are this fetcher's children so worst case scenario - they diff --git a/src/covers/albumcoverfetcher.h b/src/covers/albumcoverfetcher.h index b68f05b83..296e4cde4 100644 --- a/src/covers/albumcoverfetcher.h +++ b/src/covers/albumcoverfetcher.h @@ -21,8 +21,6 @@ #ifndef COVERS_ALBUMCOVERFETCHER_H_ #define COVERS_ALBUMCOVERFETCHER_H_ -#include "coversearchstatistics.h" - #include #include #include @@ -32,6 +30,8 @@ #include #include +#include "coversearchstatistics.h" + class QNetworkReply; class QString; diff --git a/src/covers/albumcoverfetchersearch.cpp b/src/covers/albumcoverfetchersearch.cpp index 1e3237207..43260c111 100644 --- a/src/covers/albumcoverfetchersearch.cpp +++ b/src/covers/albumcoverfetchersearch.cpp @@ -20,20 +20,19 @@ #include "albumcoverfetchersearch.h" -#include -#include - #include #include #include #include +#include +#include #include "albumcoverfetcher.h" -#include "coverprovider.h" -#include "coverproviders.h" #include "core/closure.h" #include "core/logging.h" #include "core/network.h" +#include "coverprovider.h" +#include "coverproviders.h" const int AlbumCoverFetcherSearch::kSearchTimeoutMs = 10000; const int AlbumCoverFetcherSearch::kImageLoadTimeoutMs = 2500; @@ -224,11 +223,13 @@ float AlbumCoverFetcherSearch::ScoreImage(const QImage& image) const { // A 500x500px image scores 1.0, bigger scores higher const float size_score = - std::sqrt(static_cast(image.width() * image.height())) / kTargetSize; + std::sqrt(static_cast(image.width() * image.height())) / + kTargetSize; // A 1:1 image scores 1.0, anything else scores less - const float aspect_score = 1.0 - static_cast(image.height() - image.width()) / - std::max(image.height(), image.width()); + const float aspect_score = + 1.0 - static_cast(image.height() - image.width()) / + std::max(image.height(), image.width()); return size_score + aspect_score; } diff --git a/src/covers/albumcoverfetchersearch.h b/src/covers/albumcoverfetchersearch.h index 8f79fce58..de838b669 100644 --- a/src/covers/albumcoverfetchersearch.h +++ b/src/covers/albumcoverfetchersearch.h @@ -21,11 +21,11 @@ #ifndef COVERS_ALBUMCOVERFETCHERSEARCH_H_ #define COVERS_ALBUMCOVERFETCHERSEARCH_H_ -#include "albumcoverfetcher.h" - #include #include +#include "albumcoverfetcher.h" + class CoverProvider; class CoverProviders; class NetworkTimeouts; diff --git a/src/covers/albumcoverloader.cpp b/src/covers/albumcoverloader.cpp index 5b7525656..d53f7dfde 100644 --- a/src/covers/albumcoverloader.cpp +++ b/src/covers/albumcoverloader.cpp @@ -21,11 +21,11 @@ #include "albumcoverloader.h" -#include -#include #include -#include +#include #include +#include +#include #include "config.h" #include "core/closure.h" @@ -205,7 +205,8 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage( } #endif else if (filename.isEmpty()) { - // Avoid "QFSFileEngine::open: No file name specified" messages if we know that the filename is empty + // Avoid "QFSFileEngine::open: No file name specified" messages if we know + // that the filename is empty return TryLoadResult(false, false, task.options.default_output_image_); } diff --git a/src/covers/albumcoverloader.h b/src/covers/albumcoverloader.h index c5fae6b4c..0fea77fec 100644 --- a/src/covers/albumcoverloader.h +++ b/src/covers/albumcoverloader.h @@ -21,16 +21,16 @@ #ifndef COVERS_ALBUMCOVERLOADER_H_ #define COVERS_ALBUMCOVERLOADER_H_ -#include "albumcoverloaderoptions.h" -#include "config.h" -#include "core/song.h" - #include #include #include #include #include +#include "albumcoverloaderoptions.h" +#include "config.h" +#include "core/song.h" + class NetworkAccessManager; class QNetworkReply; @@ -72,7 +72,10 @@ class AlbumCoverLoader : public QObject { #endif protected: - enum State { State_TryingManual, State_TryingAuto, }; + enum State { + State_TryingManual, + State_TryingAuto, + }; struct Task { Task() : redirects(0) {} diff --git a/src/covers/coverexportrunnable.cpp b/src/covers/coverexportrunnable.cpp index 2dc9a3959..1a471343a 100644 --- a/src/covers/coverexportrunnable.cpp +++ b/src/covers/coverexportrunnable.cpp @@ -114,21 +114,24 @@ void CoverExportRunnable::ProcessAndExportCover() { (cover_path == Song::kEmbeddedCover ? "jpg" : extension); // If the file exists, do not override! - if (dialog_result_.overwrite_ == AlbumCoverExport::OverwriteMode_None && QFile::exists(new_file)) { + if (dialog_result_.overwrite_ == AlbumCoverExport::OverwriteMode_None && + QFile::exists(new_file)) { EmitCoverSkipped(); return; } // we're handling overwrite as remove + copy so we need to delete the old file // first - if (QFile::exists(new_file) && dialog_result_.overwrite_ != AlbumCoverExport::OverwriteMode_None) { + if (QFile::exists(new_file) && + dialog_result_.overwrite_ != AlbumCoverExport::OverwriteMode_None) { // if the mode is "overwrite smaller" then skip the cover if a bigger one // is already available in the folder if (dialog_result_.overwrite_ == AlbumCoverExport::OverwriteMode_Smaller) { QImage existing; existing.load(new_file); - if (existing.isNull() || existing.size().height() >= cover.size().height() || + if (existing.isNull() || + existing.size().height() >= cover.size().height() || existing.size().width() >= cover.size().width()) { EmitCoverSkipped(); return; diff --git a/src/covers/coverexportrunnable.h b/src/covers/coverexportrunnable.h index 7f9e3a637..d7aff4058 100644 --- a/src/covers/coverexportrunnable.h +++ b/src/covers/coverexportrunnable.h @@ -20,12 +20,12 @@ #ifndef COVERS_COVEREXPORTRUNNABLE_H_ #define COVERS_COVEREXPORTRUNNABLE_H_ -#include "core/song.h" -#include "ui/albumcoverexport.h" - #include #include +#include "core/song.h" +#include "ui/albumcoverexport.h" + class AlbumCoverExporter; class CoverExportRunnable : public QObject, public QRunnable { diff --git a/src/covers/coverprovider.h b/src/covers/coverprovider.h index 040eaa201..19349bea9 100644 --- a/src/covers/coverprovider.h +++ b/src/covers/coverprovider.h @@ -21,11 +21,11 @@ #ifndef COVERS_COVERPROVIDER_H_ #define COVERS_COVERPROVIDER_H_ +#include + #include "albumcoverfetcher.h" #include "coverproviders.h" -#include - class QNetworkReply; // Each implementation of this interface downloads covers from one online diff --git a/src/covers/coverproviders.cpp b/src/covers/coverproviders.cpp index c78acf571..e975bcb8f 100644 --- a/src/covers/coverproviders.cpp +++ b/src/covers/coverproviders.cpp @@ -19,9 +19,10 @@ */ #include "coverproviders.h" + #include "config.h" -#include "coverprovider.h" #include "core/logging.h" +#include "coverprovider.h" CoverProviders::CoverProviders(QObject* parent) : QObject(parent) {} diff --git a/src/covers/coversearchstatisticsdialog.cpp b/src/covers/coversearchstatisticsdialog.cpp index d447504e9..7d61bd642 100644 --- a/src/covers/coversearchstatisticsdialog.cpp +++ b/src/covers/coversearchstatisticsdialog.cpp @@ -18,11 +18,12 @@ */ #include "coversearchstatisticsdialog.h" -#include "ui_coversearchstatisticsdialog.h" -#include "core/utilities.h" #include +#include "core/utilities.h" +#include "ui_coversearchstatisticsdialog.h" + CoverSearchStatisticsDialog::CoverSearchStatisticsDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_CoverSearchStatisticsDialog) { ui_->setupUi(this); diff --git a/src/covers/currentartloader.cpp b/src/covers/currentartloader.cpp index ab43fad46..9b178970e 100644 --- a/src/covers/currentartloader.cpp +++ b/src/covers/currentartloader.cpp @@ -36,8 +36,8 @@ CurrentArtLoader::CurrentArtLoader(Application* app, QObject* parent) options_.scale_output_image_ = false; options_.pad_output_image_ = false; QIcon nocover = IconLoader::Load("nocover", IconLoader::Other); - options_.default_output_image_ = nocover.pixmap(nocover.availableSizes() - .last()).toImage(); + options_.default_output_image_ = + nocover.pixmap(nocover.availableSizes().last()).toImage(); connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)), SLOT(TempArtLoaded(quint64, QImage))); diff --git a/src/covers/currentartloader.h b/src/covers/currentartloader.h index f72cbacce..4262ce980 100644 --- a/src/covers/currentartloader.h +++ b/src/covers/currentartloader.h @@ -20,9 +20,8 @@ #ifndef COVERS_CURRENTARTLOADER_H_ #define COVERS_CURRENTARTLOADER_H_ -#include - #include +#include #include "core/song.h" #include "covers/albumcoverloaderoptions.h" diff --git a/src/covers/discogscoverprovider.cpp b/src/covers/discogscoverprovider.cpp index 95e00fe28..7d8f013b7 100644 --- a/src/covers/discogscoverprovider.cpp +++ b/src/covers/discogscoverprovider.cpp @@ -16,6 +16,8 @@ along with Clementine. If not, see . */ +#include "discogscoverprovider.h" + #include #include #include @@ -28,8 +30,6 @@ #include #include -#include "discogscoverprovider.h" - #include "core/closure.h" #include "core/logging.h" #include "core/network.h" diff --git a/src/covers/kittenloader.h b/src/covers/kittenloader.h index 9cf08785e..3f4197c94 100644 --- a/src/covers/kittenloader.h +++ b/src/covers/kittenloader.h @@ -20,11 +20,11 @@ #ifndef COVERS_KITTENLOADER_H_ #define COVERS_KITTENLOADER_H_ -#include "albumcoverloader.h" - #include #include +#include "albumcoverloader.h" + class QNetworkReply; class KittenLoader : public AlbumCoverLoader { diff --git a/src/covers/lastfmcoverprovider.cpp b/src/covers/lastfmcoverprovider.cpp index d0ee14d91..5dad187bd 100644 --- a/src/covers/lastfmcoverprovider.cpp +++ b/src/covers/lastfmcoverprovider.cpp @@ -24,8 +24,8 @@ #include #include "albumcoverfetcher.h" -#include "coverprovider.h" #include "core/closure.h" +#include "coverprovider.h" #include "internet/lastfm/lastfmcompat.h" LastFmCoverProvider::LastFmCoverProvider(QObject* parent) diff --git a/src/covers/lastfmcoverprovider.h b/src/covers/lastfmcoverprovider.h index c5b3044f8..6f499f569 100644 --- a/src/covers/lastfmcoverprovider.h +++ b/src/covers/lastfmcoverprovider.h @@ -21,12 +21,12 @@ #ifndef COVERS_LASTFMCOVERPROVIDER_H_ #define COVERS_LASTFMCOVERPROVIDER_H_ -#include "albumcoverfetcher.h" -#include "coverprovider.h" - #include #include +#include "albumcoverfetcher.h" +#include "coverprovider.h" + class QNetworkReply; // A built-in cover provider which fetches covers from last.fm. diff --git a/src/covers/musicbrainzcoverprovider.cpp b/src/covers/musicbrainzcoverprovider.cpp index 73d945e38..1c7f7b71c 100644 --- a/src/covers/musicbrainzcoverprovider.cpp +++ b/src/covers/musicbrainzcoverprovider.cpp @@ -18,12 +18,11 @@ #include "musicbrainzcoverprovider.h" +#include +#include #include #include -#include -#include - #include "core/closure.h" #include "core/network.h" diff --git a/src/covers/musicbrainzcoverprovider.h b/src/covers/musicbrainzcoverprovider.h index ca75411e5..3aeac464b 100644 --- a/src/covers/musicbrainzcoverprovider.h +++ b/src/covers/musicbrainzcoverprovider.h @@ -19,10 +19,10 @@ #ifndef COVERS_MUSICBRAINZCOVERPROVIDER_H_ #define COVERS_MUSICBRAINZCOVERPROVIDER_H_ -#include "coverprovider.h" - #include +#include "coverprovider.h" + class QNetworkAccessManager; class QNetworkReply; diff --git a/src/dbus/metatypes.h b/src/dbus/metatypes.h index 3ec6de1d3..b293bb33f 100644 --- a/src/dbus/metatypes.h +++ b/src/dbus/metatypes.h @@ -18,8 +18,8 @@ #ifndef DBUS_METATYPES_H_ #define DBUS_METATYPES_H_ -#include #include +#include Q_DECLARE_METATYPE(QList) diff --git a/src/devices/cddadevice.cpp b/src/devices/cddadevice.cpp index 91bd77a5d..c0a5a20e0 100644 --- a/src/devices/cddadevice.cpp +++ b/src/devices/cddadevice.cpp @@ -15,27 +15,27 @@ along with Clementine. If not, see . */ +#include "cddadevice.h" + #include #include "library/librarybackend.h" #include "library/librarymodel.h" -#include "cddadevice.h" - CddaDevice::CddaDevice(const QUrl& url, DeviceLister* lister, const QString& unique_id, DeviceManager* manager, Application* app, int database_id, bool first_time) : ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), cdda_song_loader_(url) { - connect(&cdda_song_loader_, SIGNAL(SongsLoaded(SongList)), - this, SLOT(SongsLoaded(SongList))); - connect(&cdda_song_loader_, SIGNAL(SongsDurationLoaded(SongList)), - this, SLOT(SongsLoaded(SongList))); - connect(&cdda_song_loader_, SIGNAL(SongsMetadataLoaded(SongList)), - this, SLOT(SongsLoaded(SongList))); - connect(this, SIGNAL(SongsDiscovered(SongList)), - model_, SLOT(SongsDiscovered(SongList))); + connect(&cdda_song_loader_, SIGNAL(SongsLoaded(SongList)), this, + SLOT(SongsLoaded(SongList))); + connect(&cdda_song_loader_, SIGNAL(SongsDurationLoaded(SongList)), this, + SLOT(SongsLoaded(SongList))); + connect(&cdda_song_loader_, SIGNAL(SongsMetadataLoaded(SongList)), this, + SLOT(SongsLoaded(SongList))); + connect(this, SIGNAL(SongsDiscovered(SongList)), model_, + SLOT(SongsDiscovered(SongList))); } CddaDevice::~CddaDevice() {} diff --git a/src/devices/cddadevice.h b/src/devices/cddadevice.h index 5ebfdb916..ceff2fbd2 100644 --- a/src/devices/cddadevice.h +++ b/src/devices/cddadevice.h @@ -56,7 +56,7 @@ class CddaDevice : public ConnectedDevice { return str; } -signals: + signals: void SongsDiscovered(const SongList& songs); private slots: diff --git a/src/devices/cddasongloader.cpp b/src/devices/cddasongloader.cpp index cb43b3e74..2566396d6 100644 --- a/src/devices/cddasongloader.cpp +++ b/src/devices/cddasongloader.cpp @@ -15,16 +15,16 @@ along with Clementine. If not, see . */ -#include +#include "cddasongloader.h" #include #include -#include "core/logging.h" -#include "core/timeconstants.h" +#include #include "cddadevice.h" -#include "cddasongloader.h" +#include "core/logging.h" +#include "core/timeconstants.h" CddaSongLoader::CddaSongLoader(const QUrl& url, QObject* parent) : QObject(parent), url_(url), cdda_(nullptr), cdio_(nullptr) { @@ -66,11 +66,12 @@ void CddaSongLoader::LoadSongsFromCdda() { } if (!url_.isEmpty()) { - g_object_set(cdda_, "device", g_strdup(url_.path().toLocal8Bit().constData()), - nullptr); + g_object_set(cdda_, "device", + g_strdup(url_.path().toLocal8Bit().constData()), nullptr); } - if (g_object_class_find_property (G_OBJECT_GET_CLASS (cdda_), "paranoia-mode")) { - g_object_set (cdda_, "paranoia-mode", 0, NULL); + if (g_object_class_find_property(G_OBJECT_GET_CLASS(cdda_), + "paranoia-mode")) { + g_object_set(cdda_, "paranoia-mode", 0, NULL); } // Change the element's state to ready and paused, to be able to query it @@ -101,8 +102,7 @@ void CddaSongLoader::LoadSongsFromCdda() { song.set_id(track_number); song.set_valid(true); song.set_filetype(Song::Type_Cdda); - song.set_url( - GetUrlFromTrack(track_number)); + song.set_url(GetUrlFromTrack(track_number)); song.set_title(QString("Track %1").arg(track_number)); song.set_track(track_number); songs << song; @@ -112,9 +112,9 @@ void CddaSongLoader::LoadSongsFromCdda() { gst_tag_register_musicbrainz_tags(); GstElement* pipeline = gst_pipeline_new("pipeline"); - GstElement* sink = gst_element_factory_make ("fakesink", NULL); - gst_bin_add_many (GST_BIN (pipeline), cdda_, sink, NULL); - gst_element_link (cdda_, sink); + GstElement* sink = gst_element_factory_make("fakesink", NULL); + gst_bin_add_many(GST_BIN(pipeline), cdda_, sink, NULL); + gst_element_link(cdda_, sink); gst_element_set_state(pipeline, GST_STATE_READY); gst_element_set_state(pipeline, GST_STATE_PAUSED); @@ -126,7 +126,8 @@ void CddaSongLoader::LoadSongsFromCdda() { GST_ELEMENT_BUS(pipeline), 2 * GST_SECOND, (GstMessageType)(GST_MESSAGE_TOC | GST_MESSAGE_TAG)))) { if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TOC) { - if (msg_toc) gst_message_unref(msg_toc); // Shouldn't happen, but just in case + if (msg_toc) + gst_message_unref(msg_toc); // Shouldn't happen, but just in case msg_toc = msg; } else if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TAG) { if (msg_tag) gst_message_unref(msg_tag); @@ -137,16 +138,16 @@ void CddaSongLoader::LoadSongsFromCdda() { // Handle TOC message: get tracks duration if (msg_toc) { GstToc* toc; - gst_message_parse_toc (msg_toc, &toc, nullptr); + gst_message_parse_toc(msg_toc, &toc, nullptr); if (toc) { GList* entries = gst_toc_get_entries(toc); - if (entries && songs.size() <= g_list_length (entries)) { + if (entries && songs.size() <= g_list_length(entries)) { int i = 0; for (GList* node = entries; node != nullptr; node = node->next) { - GstTocEntry *entry = static_cast(node->data); + GstTocEntry* entry = static_cast(node->data); quint64 duration = 0; gint64 start, stop; - if (gst_toc_entry_get_start_stop_times (entry, &start, &stop)) + if (gst_toc_entry_get_start_stop_times(entry, &start, &stop)) duration = stop - start; songs[i++].set_length_nanosec(duration); } diff --git a/src/devices/cddasongloader.h b/src/devices/cddasongloader.h index e809a9817..46933e013 100644 --- a/src/devices/cddasongloader.h +++ b/src/devices/cddasongloader.h @@ -37,12 +37,12 @@ class CddaSongLoader : public QObject { public: CddaSongLoader( // Url of the CD device. Will use the default device if empty - const QUrl& url = QUrl(), - QObject* parent = nullptr); + const QUrl& url = QUrl(), QObject* parent = nullptr); ~CddaSongLoader(); // Load songs. - // Signals declared below will be emitted anytime new information will be available. + // Signals declared below will be emitted anytime new information will be + // available. void LoadSongs(); bool HasChanged(); @@ -55,7 +55,7 @@ class CddaSongLoader : public QObject { private slots: void LoadAudioCDTags(const QString& musicbrainz_discid) const; void AudioCDTagsLoaded(const QString& artist, const QString& album, - const MusicBrainzClient::ResultList& results); + const MusicBrainzClient::ResultList& results); private: QUrl GetUrlFromTrack(int track_number) const; @@ -67,4 +67,4 @@ class CddaSongLoader : public QObject { QMutex mutex_load_; }; -#endif // CDDASONGLOADER_H +#endif // CDDASONGLOADER_H diff --git a/src/devices/connecteddevice.cpp b/src/devices/connecteddevice.cpp index 45f54cb52..8ea584e1d 100644 --- a/src/devices/connecteddevice.cpp +++ b/src/devices/connecteddevice.cpp @@ -16,17 +16,18 @@ */ #include "connecteddevice.h" -#include "devicelister.h" -#include "devicemanager.h" + +#include + #include "core/application.h" #include "core/database.h" #include "core/logging.h" +#include "devicelister.h" +#include "devicemanager.h" #include "library/library.h" #include "library/librarybackend.h" #include "library/librarymodel.h" -#include - ConnectedDevice::ConnectedDevice(const QUrl& url, DeviceLister* lister, const QString& unique_id, DeviceManager* manager, Application* app, diff --git a/src/devices/connecteddevice.h b/src/devices/connecteddevice.h index 8f406d5d6..d18f9c2cd 100644 --- a/src/devices/connecteddevice.h +++ b/src/devices/connecteddevice.h @@ -18,11 +18,10 @@ #ifndef CONNECTEDDEVICE_H #define CONNECTEDDEVICE_H -#include - #include #include #include +#include #include "core/musicstorage.h" #include "core/song.h" @@ -65,7 +64,7 @@ class ConnectedDevice : public QObject, virtual void Eject(); -signals: + signals: void TaskStarted(int id); void SongCountUpdated(int count); void ConnectFinished(const QString& id, bool success); diff --git a/src/devices/devicedatabasebackend.cpp b/src/devices/devicedatabasebackend.cpp index 308805507..dc23e41d0 100644 --- a/src/devices/devicedatabasebackend.cpp +++ b/src/devices/devicedatabasebackend.cpp @@ -16,13 +16,14 @@ */ #include "devicedatabasebackend.h" -#include "core/database.h" -#include "core/scopedtransaction.h" #include #include #include +#include "core/database.h" +#include "core/scopedtransaction.h" + const int DeviceDatabaseBackend::kDeviceSchemaVersion = 0; DeviceDatabaseBackend::DeviceDatabaseBackend(QObject* parent) @@ -37,7 +38,8 @@ DeviceDatabaseBackend::DeviceList DeviceDatabaseBackend::GetAllDevices() { DeviceList ret; QSqlQuery q(db); - q.prepare("SELECT ROWID, unique_id, friendly_name, size, icon," + q.prepare( + "SELECT ROWID, unique_id, friendly_name, size, icon," " transcode_mode, transcode_format" " FROM devices"); q.exec(); @@ -65,7 +67,8 @@ int DeviceDatabaseBackend::AddDevice(const Device& device) { // Insert the device into the devices table QSqlQuery q(db); - q.prepare("INSERT INTO devices (" + q.prepare( + "INSERT INTO devices (" " unique_id, friendly_name, size, icon," " transcode_mode, transcode_format)" " VALUES (:unique_id, :friendly_name, :size, :icon," @@ -125,7 +128,8 @@ void DeviceDatabaseBackend::SetDeviceOptions(int id, QSqlDatabase db(db_->Connect()); QSqlQuery q(db); - q.prepare("UPDATE devices" + q.prepare( + "UPDATE devices" " SET friendly_name=:friendly_name," " icon=:icon_name," " transcode_mode=:transcode_mode," diff --git a/src/devices/deviceinfo.cpp b/src/devices/deviceinfo.cpp index 85b148b43..a053cf6dd 100644 --- a/src/devices/deviceinfo.cpp +++ b/src/devices/deviceinfo.cpp @@ -15,24 +15,22 @@ along with Clementine. If not, see . */ -#include "devicemanager.h" - -#include +#include "deviceinfo.h" #include #include #include #include #include +#include #include "config.h" #include "core/logging.h" #include "core/simpletreemodel.h" -#include "ui/iconloader.h" - #include "devicedatabasebackend.h" -#include "deviceinfo.h" #include "devicelister.h" +#include "devicemanager.h" +#include "ui/iconloader.h" DeviceDatabaseBackend::Device DeviceInfo::SaveToDb() const { DeviceDatabaseBackend::Device ret; diff --git a/src/devices/deviceinfo.h b/src/devices/deviceinfo.h index e7e4a4a56..8405bc1e6 100644 --- a/src/devices/deviceinfo.h +++ b/src/devices/deviceinfo.h @@ -18,12 +18,11 @@ #ifndef DEVICEINFO_H #define DEVICEINFO_H -#include - #include #include #include #include +#include #include "core/musicstorage.h" #include "core/simpletreeitem.h" diff --git a/src/devices/devicekitlister.cpp b/src/devices/devicekitlister.cpp index 550f36400..2a5792c3b 100644 --- a/src/devices/devicekitlister.cpp +++ b/src/devices/devicekitlister.cpp @@ -15,13 +15,14 @@ along with Clementine. If not, see . */ -#include "config.h" #include "devicekitlister.h" -#include "filesystemdevice.h" + +#include "config.h" #include "core/logging.h" #include "core/utilities.h" #include "dbus/udisks.h" #include "dbus/udisksdevice.h" +#include "filesystemdevice.h" #ifdef HAVE_LIBGPOD #include "gpoddevice.h" @@ -47,7 +48,7 @@ void DeviceKitLister::Init() { "/org/freedesktop/UDisks", QDBusConnection::systemBus())); // Get all the devices currently attached - QDBusPendingReply > reply = + QDBusPendingReply> reply = interface_->EnumerateDevices(); reply.waitForFinished(); diff --git a/src/devices/devicekitlister.h b/src/devices/devicekitlister.h index 0fcbcbcd5..176761e19 100644 --- a/src/devices/devicekitlister.h +++ b/src/devices/devicekitlister.h @@ -18,10 +18,9 @@ #ifndef DEVICEKITLISTER_H #define DEVICEKITLISTER_H -#include - #include #include +#include #include "devicelister.h" diff --git a/src/devices/devicelister.cpp b/src/devices/devicelister.cpp index fb0985f0a..900eaf793 100644 --- a/src/devices/devicelister.cpp +++ b/src/devices/devicelister.cpp @@ -15,7 +15,6 @@ along with Clementine. If not, see . */ -#include "config.h" #include "devicelister.h" #include @@ -24,6 +23,8 @@ #include #include +#include "config.h" + #ifdef HAVE_LIBGPOD #include #endif @@ -151,7 +152,7 @@ QString GetIpodModel(Itdb_IpodModel model) { } #endif -} +} // namespace QUrl DeviceLister::MakeUrlFromLocalPath(const QString& path) const { if (IsIpod(path)) { diff --git a/src/devices/devicelister.h b/src/devices/devicelister.h index ee0f7a3d3..f8283a471 100644 --- a/src/devices/devicelister.h +++ b/src/devices/devicelister.h @@ -68,7 +68,7 @@ class DeviceLister : public QObject { virtual void UpdateDeviceFreeSpace(const QString& id) = 0; virtual void ShutDown() {} -signals: + signals: void DeviceAdded(const QString& id); void DeviceRemoved(const QString& id); void DeviceChanged(const QString& id); diff --git a/src/devices/devicemanager.cpp b/src/devices/devicemanager.cpp index c9cdf745a..8801edcd5 100644 --- a/src/devices/devicemanager.cpp +++ b/src/devices/devicemanager.cpp @@ -17,8 +17,6 @@ #include "devicemanager.h" -#include - #include #include #include @@ -27,6 +25,7 @@ #include #include #include +#include #include "config.h" #include "core/application.h" @@ -519,8 +518,9 @@ std::shared_ptr DeviceManager::Connect(DeviceInfo* info) { nullptr, tr("This device will not work properly"), tr("This is an MTP device, but you compiled Clementine without " "libmtp support.") + - " " + tr("If you continue, this device will work slowly and " - "songs copied to it may not work."), + " " + + tr("If you continue, this device will work slowly and " + "songs copied to it may not work."), QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) return ret; } @@ -530,8 +530,9 @@ std::shared_ptr DeviceManager::Connect(DeviceInfo* info) { nullptr, tr("This device will not work properly"), tr("This is an iPod, but you compiled Clementine without libgpod " "support.") + - " " + tr("If you continue, this device will work slowly and " - "songs copied to it may not work."), + " " + + tr("If you continue, this device will work slowly and " + "songs copied to it may not work."), QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) return ret; } diff --git a/src/devices/devicemanager.h b/src/devices/devicemanager.h index 4dd52542c..4cf16e703 100644 --- a/src/devices/devicemanager.h +++ b/src/devices/devicemanager.h @@ -18,15 +18,13 @@ #ifndef DEVICEMANAGER_H #define DEVICEMANAGER_H -#include "devicedatabasebackend.h" - -#include - #include #include #include +#include #include "core/simpletreemodel.h" +#include "devicedatabasebackend.h" #include "deviceinfo.h" #include "library/librarymodel.h" @@ -123,13 +121,12 @@ class DeviceManager : public SimpleTreeModel { void LazyPopulate(DeviceInfo* item, bool signal); private: - void AddLister(DeviceLister* lister); template void AddDeviceClass(); - DeviceDatabaseBackend::Device InfoToDatabaseDevice(const DeviceInfo& info) - const; + DeviceDatabaseBackend::Device InfoToDatabaseDevice( + const DeviceInfo& info) const; private: Application* app_; diff --git a/src/devices/deviceproperties.cpp b/src/devices/deviceproperties.cpp index 4ffcd3439..65eba4f95 100644 --- a/src/devices/deviceproperties.cpp +++ b/src/devices/deviceproperties.cpp @@ -17,19 +17,18 @@ #include "deviceproperties.h" +#include +#include #include #include -#include -#include - #include "connecteddevice.h" +#include "core/utilities.h" #include "devicelister.h" #include "devicemanager.h" -#include "ui_deviceproperties.h" -#include "core/utilities.h" #include "transcoder/transcoder.h" #include "ui/iconloader.h" +#include "ui_deviceproperties.h" DeviceProperties::DeviceProperties(QWidget* parent) : QDialog(parent), diff --git a/src/devices/devicestatefiltermodel.h b/src/devices/devicestatefiltermodel.h index 33a3ab2f9..70cbb71e2 100644 --- a/src/devices/devicestatefiltermodel.h +++ b/src/devices/devicestatefiltermodel.h @@ -31,7 +31,7 @@ class DeviceStateFilterModel : public QSortFilterProxyModel { void setSourceModel(QAbstractItemModel* sourceModel); -signals: + signals: void IsEmptyChanged(bool is_empty); protected: diff --git a/src/devices/deviceview.cpp b/src/devices/deviceview.cpp index 76b4222f8..832ec19bf 100644 --- a/src/devices/deviceview.cpp +++ b/src/devices/deviceview.cpp @@ -17,8 +17,6 @@ #include "deviceview.h" -#include - #include #include #include @@ -26,15 +24,16 @@ #include #include #include +#include #include "connecteddevice.h" -#include "devicelister.h" -#include "devicemanager.h" -#include "deviceproperties.h" #include "core/application.h" #include "core/deletefiles.h" #include "core/mergedproxymodel.h" #include "core/mimedata.h" +#include "devicelister.h" +#include "devicemanager.h" +#include "deviceproperties.h" #include "library/librarydirectorymodel.h" #include "library/librarymodel.h" #include "library/libraryview.h" @@ -196,18 +195,16 @@ void DeviceView::contextMenuEvent(QContextMenuEvent* e) { library_menu_ = new QMenu(this); // Device menu - eject_action_ = device_menu_->addAction(IconLoader::Load("media-eject", - IconLoader::Base), - tr("Safely remove device"), this, - SLOT(Unmount())); - forget_action_ = - device_menu_->addAction(IconLoader::Load("list-remove", IconLoader::Base), - tr("Forget device"), this, SLOT(Forget())); + eject_action_ = device_menu_->addAction( + IconLoader::Load("media-eject", IconLoader::Base), + tr("Safely remove device"), this, SLOT(Unmount())); + forget_action_ = device_menu_->addAction( + IconLoader::Load("list-remove", IconLoader::Base), tr("Forget device"), + this, SLOT(Forget())); device_menu_->addSeparator(); - properties_action_ = device_menu_->addAction(IconLoader::Load("configure", - IconLoader::Base), - tr("Device properties..."), - this, SLOT(Properties())); + properties_action_ = device_menu_->addAction( + IconLoader::Load("configure", IconLoader::Base), + tr("Device properties..."), this, SLOT(Properties())); // Library menu add_to_playlist_action_ = library_menu_->addAction( @@ -217,17 +214,15 @@ void DeviceView::contextMenuEvent(QContextMenuEvent* e) { IconLoader::Load("media-playback-start", IconLoader::Base), tr("Replace current playlist"), this, SLOT(Load())); open_in_new_playlist_ = library_menu_->addAction( - IconLoader::Load("document-new", IconLoader::Base), + IconLoader::Load("document-new", IconLoader::Base), tr("Open in new playlist"), this, SLOT(OpenInNewPlaylist())); library_menu_->addSeparator(); - organise_action_ = library_menu_->addAction(IconLoader::Load("edit-copy", - IconLoader::Base), - tr("Copy to library..."), this, - SLOT(Organise())); - delete_action_ = library_menu_->addAction(IconLoader::Load("edit-delete", - IconLoader::Base), - tr("Delete from device..."), this, - SLOT(Delete())); + organise_action_ = library_menu_->addAction( + IconLoader::Load("edit-copy", IconLoader::Base), + tr("Copy to library..."), this, SLOT(Organise())); + delete_action_ = library_menu_->addAction( + IconLoader::Load("edit-delete", IconLoader::Base), + tr("Delete from device..."), this, SLOT(Delete())); } menu_index_ = currentIndex(); @@ -260,24 +255,24 @@ void DeviceView::contextMenuEvent(QContextMenuEvent* e) { } } -QModelIndex DeviceView::MapToDevice(const QModelIndex& merged_model_index) - const { +QModelIndex DeviceView::MapToDevice( + const QModelIndex& merged_model_index) const { QModelIndex sort_model_index = merged_model_->mapToSource(merged_model_index); if (sort_model_index.model() != sort_model_) return QModelIndex(); return sort_model_->mapToSource(sort_model_index); } -QModelIndex DeviceView::FindParentDevice(const QModelIndex& merged_model_index) - const { +QModelIndex DeviceView::FindParentDevice( + const QModelIndex& merged_model_index) const { QModelIndex index = merged_model_->FindSourceParent(merged_model_index); if (index.model() != sort_model_) return QModelIndex(); return sort_model_->mapToSource(index); } -QModelIndex DeviceView::MapToLibrary(const QModelIndex& merged_model_index) - const { +QModelIndex DeviceView::MapToLibrary( + const QModelIndex& merged_model_index) const { QModelIndex sort_model_index = merged_model_->mapToSource(merged_model_index); if (const QSortFilterProxyModel* sort_model = qobject_cast( diff --git a/src/devices/deviceviewcontainer.cpp b/src/devices/deviceviewcontainer.cpp index 08229c804..fba3525d3 100644 --- a/src/devices/deviceviewcontainer.cpp +++ b/src/devices/deviceviewcontainer.cpp @@ -16,8 +16,9 @@ */ #include "deviceviewcontainer.h" -#include "ui_deviceviewcontainer.h" + #include "ui/iconloader.h" +#include "ui_deviceviewcontainer.h" DeviceViewContainer::DeviceViewContainer(QWidget* parent) : QWidget(parent), ui_(new Ui::DeviceViewContainer), loaded_icons_(false) { @@ -40,10 +41,10 @@ void DeviceViewContainer::showEvent(QShowEvent* e) { if (!loaded_icons_) { loaded_icons_ = true; - ui_->close_frame_button->setIcon(IconLoader::Load("edit-delete", - IconLoader::Base)); - ui_->warning_icon->setPixmap(IconLoader::Load("dialog-warning", - IconLoader::Base).pixmap(22)); + ui_->close_frame_button->setIcon( + IconLoader::Load("edit-delete", IconLoader::Base)); + ui_->warning_icon->setPixmap( + IconLoader::Load("dialog-warning", IconLoader::Base).pixmap(22)); } QWidget::showEvent(e); diff --git a/src/devices/filesystemdevice.cpp b/src/devices/filesystemdevice.cpp index 40e660c9f..b1f447774 100644 --- a/src/devices/filesystemdevice.cpp +++ b/src/devices/filesystemdevice.cpp @@ -15,17 +15,18 @@ along with Clementine. If not, see . */ -#include "devicelister.h" -#include "devicemanager.h" #include "filesystemdevice.h" -#include "core/application.h" -#include "library/librarybackend.h" -#include "library/librarymodel.h" -#include "library/librarywatcher.h" #include #include +#include "core/application.h" +#include "devicelister.h" +#include "devicemanager.h" +#include "library/librarybackend.h" +#include "library/librarymodel.h" +#include "library/librarywatcher.h" + FilesystemDevice::FilesystemDevice(const QUrl& url, DeviceLister* lister, const QString& unique_id, DeviceManager* manager, Application* app, diff --git a/src/devices/giolister.cpp b/src/devices/giolister.cpp index 3c7b859dc..d50ede0d9 100644 --- a/src/devices/giolister.cpp +++ b/src/devices/giolister.cpp @@ -15,17 +15,16 @@ along with Clementine. If not, see . */ -#include "config.h" - -#include -#include +#include "giolister.h" #include #include #include #include +#include +#include -#include "giolister.h" +#include "config.h" #include "core/logging.h" #include "core/signalchecker.h" @@ -35,8 +34,9 @@ using std::placeholders::_3; QString GioLister::DeviceInfo::unique_id() const { if (mount) - return QString("Gio/%1/%2/%3").arg(mount_uuid, filesystem_type).arg( - filesystem_size); + return QString("Gio/%1/%2/%3") + .arg(mount_uuid, filesystem_type) + .arg(filesystem_size); return QString("Gio/unmounted/%1").arg((qulonglong)volume.get()); } @@ -106,11 +106,16 @@ void GioLister::Init() { g_list_free(mounts); // Connect signals from the monitor - signals_.append(CHECKED_GCONNECT(monitor_, "volume-added", &VolumeAddedCallback, this)); - signals_.append(CHECKED_GCONNECT(monitor_, "volume-removed", &VolumeRemovedCallback, this)); - signals_.append(CHECKED_GCONNECT(monitor_, "mount-added", &MountAddedCallback, this)); - signals_.append(CHECKED_GCONNECT(monitor_, "mount-changed", &MountChangedCallback, this)); - signals_.append(CHECKED_GCONNECT(monitor_, "mount-removed", &MountRemovedCallback, this)); + signals_.append( + CHECKED_GCONNECT(monitor_, "volume-added", &VolumeAddedCallback, this)); + signals_.append(CHECKED_GCONNECT(monitor_, "volume-removed", + &VolumeRemovedCallback, this)); + signals_.append( + CHECKED_GCONNECT(monitor_, "mount-added", &MountAddedCallback, this)); + signals_.append( + CHECKED_GCONNECT(monitor_, "mount-changed", &MountChangedCallback, this)); + signals_.append( + CHECKED_GCONNECT(monitor_, "mount-removed", &MountRemovedCallback, this)); } GioLister::~GioLister() { @@ -406,8 +411,9 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) { // Query the filesystem info for size, free space, and type error = nullptr; GFileInfo* info = g_file_query_filesystem_info( - root, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE - "," G_FILE_ATTRIBUTE_FILESYSTEM_FREE "," G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, + root, + G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "," G_FILE_ATTRIBUTE_FILESYSTEM_FREE + "," G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, nullptr, &error); if (error) { qLog(Warning) << QString::fromLocal8Bit(error->message); diff --git a/src/devices/giolister.h b/src/devices/giolister.h index e6a011b95..947b4d04d 100644 --- a/src/devices/giolister.h +++ b/src/devices/giolister.h @@ -18,8 +18,8 @@ #ifndef GIOLISTER_H #define GIOLISTER_H -#include "devicelister.h" #include "core/scopedgobject.h" +#include "devicelister.h" // Work around compile issue with glib >= 2.25 #ifdef signals diff --git a/src/devices/gpoddevice.cpp b/src/devices/gpoddevice.cpp index c5aa2f7a4..ae2abc3b3 100644 --- a/src/devices/gpoddevice.cpp +++ b/src/devices/gpoddevice.cpp @@ -15,20 +15,21 @@ along with Clementine. If not, see . */ -#include "devicemanager.h" #include "gpoddevice.h" -#include "gpodloader.h" -#include "core/logging.h" -#include "core/application.h" -#include "library/librarybackend.h" -#include "library/librarymodel.h" + +#include #include #include #include #include -#include +#include "core/application.h" +#include "core/logging.h" +#include "devicemanager.h" +#include "gpodloader.h" +#include "library/librarybackend.h" +#include "library/librarymodel.h" GPodDevice::GPodDevice(const QUrl& url, DeviceLister* lister, const QString& unique_id, DeviceManager* manager, diff --git a/src/devices/gpoddevice.h b/src/devices/gpoddevice.h index e2c6eb0e6..7e37f0f97 100644 --- a/src/devices/gpoddevice.h +++ b/src/devices/gpoddevice.h @@ -18,13 +18,13 @@ #ifndef GPODDEVICE_H #define GPODDEVICE_H -#include "connecteddevice.h" -#include "core/musicstorage.h" +#include #include #include -#include +#include "connecteddevice.h" +#include "core/musicstorage.h" class GPodLoader; diff --git a/src/devices/gpodloader.cpp b/src/devices/gpodloader.cpp index c5a59f372..38d079b04 100644 --- a/src/devices/gpodloader.cpp +++ b/src/devices/gpodloader.cpp @@ -15,18 +15,19 @@ along with Clementine. If not, see . */ -#include "connecteddevice.h" #include "gpodloader.h" -#include "core/logging.h" -#include "core/song.h" -#include "core/taskmanager.h" -#include "library/librarybackend.h" #include #include #include +#include "connecteddevice.h" +#include "core/logging.h" +#include "core/song.h" +#include "core/taskmanager.h" +#include "library/librarybackend.h" + GPodLoader::GPodLoader(const QString& mount_point, TaskManager* task_manager, std::shared_ptr backend, std::shared_ptr device) diff --git a/src/devices/gpodloader.h b/src/devices/gpodloader.h index c6419aebd..663254cc8 100644 --- a/src/devices/gpodloader.h +++ b/src/devices/gpodloader.h @@ -18,11 +18,10 @@ #ifndef GPODLOADER_H #define GPODLOADER_H -#include +#include #include - -#include +#include #include "core/song.h" @@ -45,7 +44,7 @@ class GPodLoader : public QObject { public slots: void LoadDatabase(); -signals: + signals: void Error(const QString& message); void TaskStarted(int task_id); void LoadFinished(Itdb_iTunesDB* db); diff --git a/src/devices/macdevicelister.h b/src/devices/macdevicelister.h index 8fdb7411e..d24221a9a 100644 --- a/src/devices/macdevicelister.h +++ b/src/devices/macdevicelister.h @@ -1,15 +1,15 @@ #ifndef MACDEVICELISTER_H #define MACDEVICELISTER_H -#include "devicelister.h" +#include +#include +#include #include #include #include -#include -#include -#include +#include "devicelister.h" class MacDeviceLister : public DeviceLister { Q_OBJECT diff --git a/src/devices/macdevicelister.mm b/src/devices/macdevicelister.mm index baf863bc0..15c7e54cc 100644 --- a/src/devices/macdevicelister.mm +++ b/src/devices/macdevicelister.mm @@ -15,21 +15,21 @@ along with Clementine. If not, see . */ -#include "config.h" #include "macdevicelister.h" -#include "mtpconnection.h" +#include "config.h" #include "core/logging.h" #include "core/scoped_cftyperef.h" #include "core/scoped_nsautorelease_pool.h" #include "core/scoped_nsobject.h" +#include "mtpconnection.h" #include #include -#include #include -#include -#include +#include #include +#include +#include #import #import @@ -42,11 +42,11 @@ #include +#include #include #include #include #include -#include #include #ifndef kUSBSerialNumberString @@ -98,9 +98,7 @@ class ScopedIOObject { QSet MacDeviceLister::sMTPDeviceList; -uint qHash(const MacDeviceLister::MTPDevice& d) { - return qHash(d.vendor_id) ^ qHash(d.product_id); -} +uint qHash(const MacDeviceLister::MTPDevice& d) { return qHash(d.vendor_id) ^ qHash(d.product_id); } MacDeviceLister::MacDeviceLister() {} @@ -142,41 +140,37 @@ void MacDeviceLister::Init() { // Register for disk mounts/unmounts. loop_session_ = DASessionCreate(kCFAllocatorDefault); - DARegisterDiskAppearedCallback( - loop_session_, kDADiskDescriptionMatchVolumeMountable, &DiskAddedCallback, - reinterpret_cast(this)); + DARegisterDiskAppearedCallback(loop_session_, kDADiskDescriptionMatchVolumeMountable, + &DiskAddedCallback, reinterpret_cast(this)); DARegisterDiskDisappearedCallback(loop_session_, nullptr, &DiskRemovedCallback, reinterpret_cast(this)); DASessionScheduleWithRunLoop(loop_session_, run_loop_, kCFRunLoopDefaultMode); // Register for USB device connection/disconnection. - IONotificationPortRef notification_port = - IONotificationPortCreate(kIOMasterPortDefault); - CFMutableDictionaryRef matching_dict = - IOServiceMatching(kIOUSBDeviceClassName); + IONotificationPortRef notification_port = IONotificationPortCreate(kIOMasterPortDefault); + CFMutableDictionaryRef matching_dict = IOServiceMatching(kIOUSBDeviceClassName); // IOServiceAddMatchingNotification decreases reference count. CFRetain(matching_dict); io_iterator_t it; - kern_return_t err = IOServiceAddMatchingNotification( - notification_port, kIOFirstMatchNotification, matching_dict, - &USBDeviceAddedCallback, reinterpret_cast(this), &it); + kern_return_t err = + IOServiceAddMatchingNotification(notification_port, kIOFirstMatchNotification, matching_dict, + &USBDeviceAddedCallback, reinterpret_cast(this), &it); if (err == KERN_SUCCESS) { USBDeviceAddedCallback(this, it); } else { qLog(Warning) << "Could not add notification on USB device connection"; } - err = IOServiceAddMatchingNotification( - notification_port, kIOTerminatedNotification, matching_dict, - &USBDeviceRemovedCallback, reinterpret_cast(this), &it); + err = IOServiceAddMatchingNotification(notification_port, kIOTerminatedNotification, + matching_dict, &USBDeviceRemovedCallback, + reinterpret_cast(this), &it); if (err == KERN_SUCCESS) { USBDeviceRemovedCallback(this, it); } else { qLog(Warning) << "Could not add notification USB device removal"; } - CFRunLoopSourceRef io_source = - IONotificationPortGetRunLoopSource(notification_port); + CFRunLoopSourceRef io_source = IONotificationPortGetRunLoopSource(notification_port); CFRunLoopAddSource(run_loop_, io_source, kCFRunLoopDefaultMode); CFRunLoopRun(); @@ -190,12 +184,11 @@ namespace { // Caller is responsible for calling CFRelease(). CFTypeRef GetUSBRegistryEntry(io_object_t device, CFStringRef key) { io_iterator_t it; - if (IORegistryEntryGetParentIterator(device, kIOServicePlane, &it) == - KERN_SUCCESS) { + if (IORegistryEntryGetParentIterator(device, kIOServicePlane, &it) == KERN_SUCCESS) { io_object_t next; while ((next = IOIteratorNext(it))) { - CFTypeRef registry_entry = (CFStringRef)IORegistryEntryCreateCFProperty( - next, key, kCFAllocatorDefault, 0); + CFTypeRef registry_entry = + (CFStringRef)IORegistryEntryCreateCFProperty(next, key, kCFAllocatorDefault, 0); if (registry_entry) { IOObjectRelease(next); IOObjectRelease(it); @@ -218,8 +211,7 @@ CFTypeRef GetUSBRegistryEntry(io_object_t device, CFStringRef key) { } QString GetUSBRegistryEntryString(io_object_t device, CFStringRef key) { - ScopedCFTypeRef registry_string( - (CFStringRef)GetUSBRegistryEntry(device, key)); + ScopedCFTypeRef registry_string((CFStringRef)GetUSBRegistryEntry(device, key)); if (registry_string) { return QString::fromUtf8([(NSString*)registry_string.get() UTF8String]); } @@ -229,15 +221,14 @@ QString GetUSBRegistryEntryString(io_object_t device, CFStringRef key) { NSObject* GetPropertyForDevice(io_object_t device, CFStringRef key) { CFMutableDictionaryRef properties; - kern_return_t ret = IORegistryEntryCreateCFProperties(device, &properties, - kCFAllocatorDefault, 0); + kern_return_t ret = + IORegistryEntryCreateCFProperties(device, &properties, kCFAllocatorDefault, 0); if (ret != KERN_SUCCESS) { return nil; } - scoped_nsobject dict( - (NSDictionary*)properties); // Takes ownership. + scoped_nsobject dict((NSDictionary*)properties); // Takes ownership. NSObject* prop = [dict objectForKey:(NSString*)key]; if (prop) { // The dictionary goes out of scope so we should retain this object. @@ -255,9 +246,9 @@ NSObject* GetPropertyForDevice(io_object_t device, CFStringRef key) { } int GetUSBDeviceClass(io_object_t device) { - ScopedCFTypeRef interface_class(IORegistryEntrySearchCFProperty( - device, kIOServicePlane, CFSTR(kUSBInterfaceClass), kCFAllocatorDefault, - kIORegistryIterateRecursively)); + ScopedCFTypeRef interface_class( + IORegistryEntrySearchCFProperty(device, kIOServicePlane, CFSTR(kUSBInterfaceClass), + kCFAllocatorDefault, kIORegistryIterateRecursively)); NSNumber* number = (NSNumber*)interface_class.get(); if (number) { int ret = [number unsignedShortValue]; @@ -270,14 +261,11 @@ QString GetIconForDevice(io_object_t device) { scoped_nsobject media_icon( (NSDictionary*)GetPropertyForDevice(device, CFSTR("IOMediaIcon"))); if (media_icon) { - NSString* bundle = - (NSString*)[media_icon objectForKey:@"CFBundleIdentifier"]; - NSString* file = - (NSString*)[media_icon objectForKey:@"IOBundleResourceFile"]; + NSString* bundle = (NSString*)[media_icon objectForKey:@"CFBundleIdentifier"]; + NSString* file = (NSString*)[media_icon objectForKey:@"IOBundleResourceFile"]; scoped_nsobject bundle_url( - (NSURL*)KextManagerCreateURLForBundleIdentifier(kCFAllocatorDefault, - (CFStringRef)bundle)); + (NSURL*)KextManagerCreateURLForBundleIdentifier(kCFAllocatorDefault, (CFStringRef)bundle)); QString path = QString::fromUtf8([[bundle_url path] UTF8String]); path += "/Contents/Resources/"; @@ -289,8 +277,7 @@ QString GetIconForDevice(io_object_t device) { } QString GetSerialForDevice(io_object_t device) { - QString serial = - GetUSBRegistryEntryString(device, CFSTR(kUSBSerialNumberString)); + QString serial = GetUSBRegistryEntryString(device, CFSTR(kUSBSerialNumberString)); if (!serial.isEmpty()) { return "USB/" + serial; } @@ -305,8 +292,8 @@ QString GetSerialForMTPDevice(io_object_t device) { QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) { ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); - ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); + ScopedCFTypeRef disk( + DADiskCreateFromBSDName(kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); ScopedIOObject device(DADiskCopyIOMedia(disk.get())); QString ret = GetUSBRegistryEntryString(device.get(), property); @@ -318,8 +305,7 @@ quint64 MacDeviceLister::GetFreeSpace(const QUrl& url) { QMutexLocker l(&libmtp_mutex_); MtpConnection connection(url); if (!connection.is_valid()) { - qLog(Warning) - << "Error connecting to MTP device, couldn't get device free space"; + qLog(Warning) << "Error connecting to MTP device, couldn't get device free space"; return -1; } LIBMTP_devicestorage_t* storage = connection.device()->storage; @@ -335,8 +321,7 @@ quint64 MacDeviceLister::GetCapacity(const QUrl& url) { QMutexLocker l(&libmtp_mutex_); MtpConnection connection(url); if (!connection.is_valid()) { - qLog(Warning) - << "Error connecting to MTP device, couldn't get device capacity"; + qLog(Warning) << "Error connecting to MTP device, couldn't get device capacity"; return -1; } LIBMTP_devicestorage_t* storage = connection.device()->storage; @@ -351,11 +336,9 @@ quint64 MacDeviceLister::GetCapacity(const QUrl& url) { void MacDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) { MacDeviceLister* me = reinterpret_cast(context); - scoped_nsobject properties( - (NSDictionary*)DADiskCopyDescription(disk)); + scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk)); - NSString* kind = - [properties objectForKey:(NSString*)kDADiskDescriptionMediaKindKey]; + NSString* kind = [properties objectForKey:(NSString*)kDADiskDescriptionMediaKindKey]; #ifdef HAVE_AUDIOCD if (kind && strcmp([kind UTF8String], kIOCDMediaClass) == 0) { // CD inserted. @@ -366,26 +349,22 @@ void MacDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) { } #endif - NSURL* volume_path = [[properties - objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]; + NSURL* volume_path = [[properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]; if (volume_path) { ScopedIOObject device(DADiskCopyIOMedia(disk)); ScopedCFTypeRef class_name(IOObjectCopyClass(device.get())); - if (class_name && CFStringCompare(class_name.get(), CFSTR(kIOMediaClass), - 0) == kCFCompareEqualTo) { - QString vendor = - GetUSBRegistryEntryString(device.get(), CFSTR(kUSBVendorString)); - QString product = - GetUSBRegistryEntryString(device.get(), CFSTR(kUSBProductString)); + if (class_name && + CFStringCompare(class_name.get(), CFSTR(kIOMediaClass), 0) == kCFCompareEqualTo) { + QString vendor = GetUSBRegistryEntryString(device.get(), CFSTR(kUSBVendorString)); + QString product = GetUSBRegistryEntryString(device.get(), CFSTR(kUSBProductString)); CFMutableDictionaryRef cf_properties; - kern_return_t ret = IORegistryEntryCreateCFProperties( - device.get(), &cf_properties, kCFAllocatorDefault, 0); + kern_return_t ret = + IORegistryEntryCreateCFProperties(device.get(), &cf_properties, kCFAllocatorDefault, 0); if (ret == KERN_SUCCESS) { - scoped_nsobject dict( - (NSDictionary*)cf_properties); // Takes ownership. + scoped_nsobject dict((NSDictionary*)cf_properties); // Takes ownership. if ([[dict objectForKey:@"Removable"] intValue] == 1) { QString serial = GetSerialForDevice(device.get()); if (!serial.isEmpty()) { @@ -419,9 +398,9 @@ void MacDeviceLister::DiskRemovedCallback(DADiskRef disk, void* context) { } } -bool DeviceRequest(IOUSBDeviceInterface** dev, quint8 direction, quint8 type, - quint8 recipient, quint8 request_code, quint16 value, - quint16 index, quint16 length, QByteArray* data) { +bool DeviceRequest(IOUSBDeviceInterface** dev, quint8 direction, quint8 type, quint8 recipient, + quint8 request_code, quint16 value, quint16 index, quint16 length, + QByteArray* data) { IOUSBDevRequest req; req.bmRequestType = USBmakebmRequestType(direction, type, recipient); req.bRequest = request_code; @@ -464,16 +443,11 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { BOOST_SCOPE_EXIT((object)) { IOObjectRelease(object); } BOOST_SCOPE_EXIT_END - if (CFStringCompare(class_name.get(), CFSTR(kIOUSBDeviceClassName), 0) == - kCFCompareEqualTo) { - NSString* vendor = - (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); - NSString* product = - (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); - NSNumber* vendor_id = - (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); - NSNumber* product_id = - (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); + if (CFStringCompare(class_name.get(), CFSTR(kIOUSBDeviceClassName), 0) == kCFCompareEqualTo) { + NSString* vendor = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); + NSString* product = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); + NSNumber* vendor_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); + NSNumber* product_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); int interface_class = GetUSBDeviceClass(object); qLog(Debug) << "Interface class:" << interface_class; @@ -489,21 +463,18 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { device.bus = -1; device.address = -1; - if (device.vendor_id == - kAppleVendorID || // I think we can safely skip Apple products. + if (device.vendor_id == kAppleVendorID || // I think we can safely skip Apple products. // Blacklist ilok2 as this probe may be breaking it. (device.vendor_id == 0x088e && device.product_id == 0x5036) || // Blacklist eLicenser (device.vendor_id == 0x0819 && device.product_id == 0x0101) || // Skip HID devices, printers and hubs. interface_class == kUSBHIDInterfaceClass || - interface_class == kUSBPrintingInterfaceClass || - interface_class == kUSBHubClass) { + interface_class == kUSBPrintingInterfaceClass || interface_class == kUSBHubClass) { continue; } - NSNumber* addr = - (NSNumber*)GetPropertyForDevice(object, CFSTR("USB Address")); + NSNumber* addr = (NSNumber*)GetPropertyForDevice(object, CFSTR("USB Address")); int bus = GetBusNumber(object); if (!addr || bus == -1) { // Failed to get bus or address number. @@ -524,16 +495,16 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { IOCFPlugInInterface** plugin_interface = nullptr; SInt32 score; kern_return_t err = IOCreatePlugInInterfaceForService( - object, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, - &plugin_interface, &score); + object, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugin_interface, &score); if (err != KERN_SUCCESS) { continue; } IOUSBDeviceInterface** dev = nullptr; - HRESULT result = (*plugin_interface)->QueryInterface( - plugin_interface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), - (LPVOID*)&dev); + HRESULT result = + (*plugin_interface) + ->QueryInterface(plugin_interface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), + (LPVOID*)&dev); (*plugin_interface)->Release(plugin_interface); @@ -556,28 +527,25 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { // Request the string descriptor at 0xee. // This is a magic string that indicates whether this device supports MTP. QByteArray data; - bool ret = DeviceRequest(dev, kUSBIn, kUSBStandard, kUSBDevice, - kUSBRqGetDescriptor, + bool ret = DeviceRequest(dev, kUSBIn, kUSBStandard, kUSBDevice, kUSBRqGetDescriptor, (kUSBStringDesc << 8) | 0xee, 0x0409, 2, &data); if (!ret) continue; UInt8 string_len = data[0]; - ret = DeviceRequest(dev, kUSBIn, kUSBStandard, kUSBDevice, - kUSBRqGetDescriptor, (kUSBStringDesc << 8) | 0xee, - 0x0409, string_len, &data); + ret = DeviceRequest(dev, kUSBIn, kUSBStandard, kUSBDevice, kUSBRqGetDescriptor, + (kUSBStringDesc << 8) | 0xee, 0x0409, string_len, &data); if (!ret) continue; // The device actually returned something. That's a good sign. // Because this was designed by MS, the characters are in UTF-16 (LE?). - QString str = QString::fromUtf16( - reinterpret_cast(data.data() + 2), (data.size() / 2) - 2); + QString str = + QString::fromUtf16(reinterpret_cast(data.data() + 2), (data.size() / 2) - 2); if (str.startsWith("MSFT100")) { // We got the OS descriptor! char vendor_code = data[16]; - ret = DeviceRequest(dev, kUSBIn, kUSBVendor, kUSBDevice, vendor_code, 0, - 4, 256, &data); + ret = DeviceRequest(dev, kUSBIn, kUSBVendor, kUSBDevice, vendor_code, 0, 4, 256, &data); if (!ret || data.at(0) != 0x28) continue; if (QString::fromLatin1(data.data() + 0x12, 3) != "MTP") { @@ -585,8 +553,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { continue; } - ret = DeviceRequest(dev, kUSBIn, kUSBVendor, kUSBDevice, vendor_code, 0, - 5, 256, &data); + ret = DeviceRequest(dev, kUSBIn, kUSBVendor, kUSBDevice, vendor_code, 0, 5, 256, &data); if (!ret || data.at(0) != 0x28) { continue; } @@ -610,16 +577,11 @@ void MacDeviceLister::USBDeviceRemovedCallback(void* refcon, io_iterator_t it) { BOOST_SCOPE_EXIT((object)) { IOObjectRelease(object); } BOOST_SCOPE_EXIT_END - if (CFStringCompare(class_name.get(), CFSTR(kIOUSBDeviceClassName), 0) == - kCFCompareEqualTo) { - NSString* vendor = - (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); - NSString* product = - (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); - NSNumber* vendor_id = - (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); - NSNumber* product_id = - (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); + if (CFStringCompare(class_name.get(), CFSTR(kIOUSBDeviceClassName), 0) == kCFCompareEqualTo) { + NSString* vendor = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); + NSString* product = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); + NSNumber* vendor_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); + NSNumber* product_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); QString serial = GetSerialForMTPDevice(object); MTPDevice device; @@ -641,8 +603,7 @@ void MacDeviceLister::RemovedMTPDevice(const QString& serial) { } } -void MacDeviceLister::FoundMTPDevice(const MTPDevice& device, - const QString& serial) { +void MacDeviceLister::FoundMTPDevice(const MTPDevice& device, const QString& serial) { qLog(Debug) << "New MTP device detected!" << device.bus << device.address; mtp_devices_[serial] = device; QList urls = MakeDeviceUrls(serial); @@ -668,27 +629,23 @@ QString MacDeviceLister::MakeFriendlyName(const QString& serial) { } } - QString bsd_name = - IsCDDevice(serial) ? *cd_devices_.find(serial) : current_devices_[serial]; + QString bsd_name = IsCDDevice(serial) ? *cd_devices_.find(serial) : current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); - ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); + ScopedCFTypeRef disk( + DADiskCreateFromBSDName(kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); if (IsCDDevice(serial)) { - scoped_nsobject properties( - (NSDictionary*)DADiskCopyDescription(disk.get())); - NSString* device_name = (NSString*)[properties.get() - objectForKey:(NSString*)kDADiskDescriptionMediaNameKey]; + scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk.get())); + NSString* device_name = + (NSString*)[properties.get() objectForKey:(NSString*)kDADiskDescriptionMediaNameKey]; return QString::fromUtf8([device_name UTF8String]); } ScopedIOObject device(DADiskCopyIOMedia(disk)); - QString vendor = - GetUSBRegistryEntryString(device.get(), CFSTR(kUSBVendorString)); - QString product = - GetUSBRegistryEntryString(device.get(), CFSTR(kUSBProductString)); + QString vendor = GetUSBRegistryEntryString(device.get(), CFSTR(kUSBVendorString)); + QString product = GetUSBRegistryEntryString(device.get(), CFSTR(kUSBProductString)); if (vendor.isEmpty()) { return product; @@ -718,13 +675,12 @@ QList MacDeviceLister::MakeDeviceUrls(const QString& serial) { QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); - ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); + ScopedCFTypeRef disk( + DADiskCreateFromBSDName(kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); - scoped_nsobject properties( - (NSDictionary*)DADiskCopyDescription(disk.get())); - scoped_nsobject volume_path([[properties - objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]); + scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk.get())); + scoped_nsobject volume_path( + [[properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]); QString path = QString::fromUtf8([[volume_path path] UTF8String]); QUrl ret = MakeUrlFromLocalPath(path); @@ -747,16 +703,15 @@ QVariantList MacDeviceLister::DeviceIcons(const QString& serial) { QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); - ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); + ScopedCFTypeRef disk( + DADiskCreateFromBSDName(kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); ScopedIOObject device(DADiskCopyIOMedia(disk.get())); QString icon = GetIconForDevice(device.get()); - scoped_nsobject properties( - (NSDictionary*)DADiskCopyDescription(disk)); - scoped_nsobject volume_path([[properties - objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]); + scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk)); + scoped_nsobject volume_path( + [[properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]); QString path = QString::fromUtf8([[volume_path path] UTF8String]); @@ -790,8 +745,8 @@ quint64 MacDeviceLister::DeviceCapacity(const QString& serial) { } QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); - ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); + ScopedCFTypeRef disk( + DADiskCreateFromBSDName(kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); io_object_t device = DADiskCopyIOMedia(disk); @@ -811,46 +766,37 @@ quint64 MacDeviceLister::DeviceFreeSpace(const QString& serial) { } QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); - ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); + ScopedCFTypeRef disk( + DADiskCreateFromBSDName(kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); - scoped_nsobject properties( - (NSDictionary*)DADiskCopyDescription(disk)); - scoped_nsobject volume_path([[properties - objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]); + scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk)); + scoped_nsobject volume_path( + [[properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]); NSNumber* value = nil; NSError* error = nil; - if ([volume_path getResourceValue:&value - forKey:NSURLVolumeAvailableCapacityKey - error:&error] && + if ([volume_path getResourceValue:&value forKey:NSURLVolumeAvailableCapacityKey error:&error] && value) { return [value unsignedLongLongValue]; } return 0; } -QVariantMap MacDeviceLister::DeviceHardwareInfo(const QString& serial) { - return QVariantMap(); -} +QVariantMap MacDeviceLister::DeviceHardwareInfo(const QString& serial) { return QVariantMap(); } -bool MacDeviceLister::AskForScan(const QString& serial) const { - return !IsCDDevice(serial); -} +bool MacDeviceLister::AskForScan(const QString& serial) const { return !IsCDDevice(serial); } void MacDeviceLister::UnmountDevice(const QString& serial) { if (IsMTPSerial(serial)) return; QString bsd_name = current_devices_[serial]; - ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, loop_session_, bsd_name.toLatin1().constData())); + ScopedCFTypeRef disk( + DADiskCreateFromBSDName(kCFAllocatorDefault, loop_session_, bsd_name.toLatin1().constData())); DADiskUnmount(disk, kDADiskUnmountOptionDefault, &DiskUnmountCallback, this); } -void MacDeviceLister::DiskUnmountCallback(DADiskRef disk, - DADissenterRef dissenter, - void* context) { +void MacDeviceLister::DiskUnmountCallback(DADiskRef disk, DADissenterRef dissenter, void* context) { if (dissenter) { qLog(Warning) << "Another app blocked the unmount"; } else { diff --git a/src/devices/mtpconnection.cpp b/src/devices/mtpconnection.cpp index 7b13dfba1..8397808f9 100644 --- a/src/devices/mtpconnection.cpp +++ b/src/devices/mtpconnection.cpp @@ -16,11 +16,12 @@ */ #include "mtpconnection.h" -#include "core/logging.h" #include -#include #include +#include + +#include "core/logging.h" MtpConnection::MtpConnection(const QUrl& url) : device_(nullptr) { QString hostname = url.host(); diff --git a/src/devices/mtpconnection.h b/src/devices/mtpconnection.h index 5235f9d12..06ecce102 100644 --- a/src/devices/mtpconnection.h +++ b/src/devices/mtpconnection.h @@ -18,10 +18,10 @@ #ifndef MTPCONNECTION_H #define MTPCONNECTION_H -#include - #include +#include + class MtpConnection { public: MtpConnection(const QUrl& url); diff --git a/src/devices/mtpdevice.cpp b/src/devices/mtpdevice.cpp index 9a8d2afe4..f49c781c5 100644 --- a/src/devices/mtpdevice.cpp +++ b/src/devices/mtpdevice.cpp @@ -15,20 +15,21 @@ along with Clementine. If not, see . */ -#include "devicemanager.h" -#include "mtpconnection.h" #include "mtpdevice.h" -#include "mtploader.h" -#include "core/application.h" -#include "core/logging.h" -#include "library/librarybackend.h" -#include "library/librarymodel.h" #include #include #include +#include "core/application.h" +#include "core/logging.h" +#include "devicemanager.h" +#include "library/librarybackend.h" +#include "library/librarymodel.h" +#include "mtpconnection.h" +#include "mtploader.h" + bool MtpDevice::sInitialisedLibMTP = false; MtpDevice::MtpDevice(const QUrl& url, DeviceLister* lister, diff --git a/src/devices/mtpdevice.h b/src/devices/mtpdevice.h index e3ee81c6d..23cb2591a 100644 --- a/src/devices/mtpdevice.h +++ b/src/devices/mtpdevice.h @@ -18,10 +18,9 @@ #ifndef MTPDEVICE_H #define MTPDEVICE_H -#include - #include #include +#include #include "connecteddevice.h" diff --git a/src/devices/mtploader.cpp b/src/devices/mtploader.cpp index 611ed1db0..d80bdfdd3 100644 --- a/src/devices/mtploader.cpp +++ b/src/devices/mtploader.cpp @@ -20,10 +20,10 @@ #include #include "connecteddevice.h" -#include "mtpconnection.h" #include "core/song.h" #include "core/taskmanager.h" #include "library/librarybackend.h" +#include "mtpconnection.h" MtpLoader::MtpLoader(const QUrl& url, TaskManager* task_manager, std::shared_ptr backend, diff --git a/src/devices/mtploader.h b/src/devices/mtploader.h index 448c3b01c..7c770c326 100644 --- a/src/devices/mtploader.h +++ b/src/devices/mtploader.h @@ -18,10 +18,9 @@ #ifndef MTPLOADER_H #define MTPLOADER_H -#include - #include #include +#include class ConnectedDevice; class LibraryBackend; @@ -39,7 +38,7 @@ class MtpLoader : public QObject { public slots: void LoadDatabase(); -signals: + signals: void Error(const QString& message); void TaskStarted(int task_id); void LoadFinished(bool success); diff --git a/src/devices/udisks2lister.h b/src/devices/udisks2lister.h index 49519d7d6..6ae350506 100644 --- a/src/devices/udisks2lister.h +++ b/src/devices/udisks2lister.h @@ -18,12 +18,11 @@ #ifndef UDISKS2LISTER_H #define UDISKS2LISTER_H -#include - #include #include #include #include +#include #include "dbus/metatypes.h" #include "devicelister.h" diff --git a/src/engines/alsadevicefinder.cpp b/src/engines/alsadevicefinder.cpp index 929676d8f..4448c5bc3 100644 --- a/src/engines/alsadevicefinder.cpp +++ b/src/engines/alsadevicefinder.cpp @@ -15,18 +15,18 @@ along with Clementine. If not, see . */ +#include "alsadevicefinder.h" + #include +#include #include #include -#include #include #include #include +#include -#include - -#include "alsadevicefinder.h" #include "devicefinder.h" AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsasink") {} diff --git a/src/engines/devicefinder.cpp b/src/engines/devicefinder.cpp index 4dda6abea..0d2d268a5 100644 --- a/src/engines/devicefinder.cpp +++ b/src/engines/devicefinder.cpp @@ -1,16 +1,16 @@ /* This file is part of Clementine. Copyright 2014, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ @@ -18,8 +18,7 @@ #include "devicefinder.h" DeviceFinder::DeviceFinder(const QString& gstreamer_sink) - : gstreamer_sink_(gstreamer_sink) { -} + : gstreamer_sink_(gstreamer_sink) {} QString DeviceFinder::GuessIconName(const QString& description) { QString description_lower = description.toLower(); diff --git a/src/engines/devicefinder.h b/src/engines/devicefinder.h index fe2ff671f..66918f008 100644 --- a/src/engines/devicefinder.h +++ b/src/engines/devicefinder.h @@ -1,16 +1,16 @@ /* This file is part of Clementine. Copyright 2014, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ @@ -57,4 +57,4 @@ class DeviceFinder { QString gstreamer_sink_; }; -#endif // DEVICEFINDER_H +#endif // DEVICEFINDER_H diff --git a/src/engines/directsounddevicefinder.cpp b/src/engines/directsounddevicefinder.cpp index 9a1d62e25..727aa1300 100644 --- a/src/engines/directsounddevicefinder.cpp +++ b/src/engines/directsounddevicefinder.cpp @@ -1,16 +1,16 @@ /* This file is part of Clementine. Copyright 2014, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ @@ -19,15 +19,14 @@ #undef INTERFACE #endif +#include "directsounddevicefinder.h" + #include #include -#include "directsounddevicefinder.h" - DirectSoundDeviceFinder::DirectSoundDeviceFinder() - : DeviceFinder("directsoundsink") { -} + : DeviceFinder("directsoundsink") {} QList DirectSoundDeviceFinder::ListDevices() { State state; @@ -35,8 +34,7 @@ QList DirectSoundDeviceFinder::ListDevices() { return state.devices; } -BOOL DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, - LPCSTR description, +BOOL DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, LPCSTR description, LPCSTR module, LPVOID state_voidptr) { State* state = reinterpret_cast(state_voidptr); diff --git a/src/engines/directsounddevicefinder.h b/src/engines/directsounddevicefinder.h index 1f46c414a..f8ce8e449 100644 --- a/src/engines/directsounddevicefinder.h +++ b/src/engines/directsounddevicefinder.h @@ -1,16 +1,16 @@ /* This file is part of Clementine. Copyright 2014, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ @@ -34,10 +34,8 @@ class DirectSoundDeviceFinder : public DeviceFinder { QList devices; }; - static BOOL EnumerateCallback(LPGUID guid, - LPCSTR description, - LPCSTR module, + static BOOL EnumerateCallback(LPGUID guid, LPCSTR description, LPCSTR module, LPVOID state_voidptr) __attribute__((stdcall)); }; -#endif // DIRECTSOUNDDEVICEFINDER_H +#endif // DIRECTSOUNDDEVICEFINDER_H diff --git a/src/engines/engine_fwd.h b/src/engines/engine_fwd.h index 92699448b..a2b341453 100644 --- a/src/engines/engine_fwd.h +++ b/src/engines/engine_fwd.h @@ -33,7 +33,7 @@ enum TrackChangeType { SameAlbum = 0x10, }; Q_DECLARE_FLAGS(TrackChangeFlags, TrackChangeType) -} +} // namespace Engine typedef Engine::Base EngineBase; diff --git a/src/engines/enginebase.cpp b/src/engines/enginebase.cpp index 514e99b3c..bc6884c2e 100644 --- a/src/engines/enginebase.cpp +++ b/src/engines/enginebase.cpp @@ -20,11 +20,11 @@ // License: See COPYING #include "enginebase.h" -#include "core/timeconstants.h" - -#include #include +#include + +#include "core/timeconstants.h" const char* Engine::Base::kSettingsGroup = "Player"; diff --git a/src/engines/enginebase.h b/src/engines/enginebase.h index e5b291d69..9e0983060 100644 --- a/src/engines/enginebase.h +++ b/src/engines/enginebase.h @@ -25,11 +25,10 @@ #include #include -#include - #include #include #include +#include #include "engine_fwd.h" #include "playbackrequest.h" @@ -105,7 +104,7 @@ class Base : public QObject { } virtual void SetStereoBalance(float value) {} -signals: + signals: // Emitted when crossfading is enabled and the track is crossfade_duration_ // away from finishing void TrackAboutToEnd(); @@ -172,6 +171,6 @@ struct SimpleMetaBundle { QString tracknr; }; -} // namespace +} // namespace Engine #endif diff --git a/src/engines/gstelementdeleter.h b/src/engines/gstelementdeleter.h index 00b548c49..1e694b4a0 100644 --- a/src/engines/gstelementdeleter.h +++ b/src/engines/gstelementdeleter.h @@ -18,10 +18,10 @@ #ifndef GSTBINDELETER_H #define GSTBINDELETER_H -#include - #include +#include + class GstElementDeleter : public QObject { Q_OBJECT diff --git a/src/engines/gstengine.cpp b/src/engines/gstengine.cpp index 5c740dcbc..932115978 100644 --- a/src/engines/gstengine.cpp +++ b/src/engines/gstengine.cpp @@ -21,34 +21,32 @@ #include "gstengine.h" +#include +#include #include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - #include "config.h" -#include "devicefinder.h" -#include "gstenginepipeline.h" #include "core/closure.h" #include "core/logging.h" #include "core/taskmanager.h" #include "core/timeconstants.h" #include "core/utilities.h" +#include "devicefinder.h" +#include "gstenginepipeline.h" #ifdef HAVE_MOODBAR #include "gst/moodbar/plugin.h" @@ -761,10 +759,10 @@ GstElement* GstEngine::CreateElement(const QString& factoryName, factoryName.toLatin1().constData(), name.toLatin1().constData()); if (!element) { - emit Error(QString( - "GStreamer could not create the element: %1. " - "Please make sure that you have installed all necessary " - "GStreamer plugins (e.g. OGG and MP3)").arg(factoryName)); + emit Error(QString("GStreamer could not create the element: %1. " + "Please make sure that you have installed all necessary " + "GStreamer plugins (e.g. OGG and MP3)") + .arg(factoryName)); if (bin) gst_object_unref(GST_OBJECT(bin)); return nullptr; } diff --git a/src/engines/gstengine.h b/src/engines/gstengine.h index a1b182e3b..cd3cd822b 100644 --- a/src/engines/gstengine.h +++ b/src/engines/gstengine.h @@ -22,8 +22,6 @@ #ifndef AMAROK_GSTENGINE_H #define AMAROK_GSTENGINE_H -#include - #include #include @@ -32,10 +30,11 @@ #include #include #include +#include #include "bufferconsumer.h" -#include "enginebase.h" #include "core/timeconstants.h" +#include "enginebase.h" class QTimer; class QTimerEvent; diff --git a/src/engines/gstenginepipeline.cpp b/src/engines/gstenginepipeline.cpp index 5e74c2772..471da8217 100644 --- a/src/engines/gstenginepipeline.cpp +++ b/src/engines/gstenginepipeline.cpp @@ -15,25 +15,23 @@ along with Clementine. If not, see . */ -#include "config.h" - -#include +#include "gstenginepipeline.h" #include #include #include #include +#include #include "bufferconsumer.h" #include "config.h" -#include "gstelementdeleter.h" -#include "gstengine.h" -#include "gstenginepipeline.h" #include "core/concurrentrun.h" #include "core/logging.h" #include "core/mac_startup.h" #include "core/signalchecker.h" #include "core/utilities.h" +#include "gstelementdeleter.h" +#include "gstengine.h" #ifdef HAVE_AUDIOCD #include "devices/cddadevice.h" #endif @@ -669,7 +667,7 @@ void GstEnginePipeline::StreamStatusMessageReceived(GstMessage* msg) { } void GstEnginePipeline::TaskEnterCallback(GstTask*, GThread*, gpointer) { -// Bump the priority of the thread only on OS X + // Bump the priority of the thread only on OS X #ifdef Q_OS_DARWIN sched_param param; @@ -743,7 +741,7 @@ QPair ParseAkamaiTag(const QString& tag) { } bool IsAkamaiTag(const QString& tag) { return tag.contains("- text=\""); } -} +} // namespace void GstEnginePipeline::TagMessageReceived(GstMessage* msg) { GstTagList* taglist = nullptr; @@ -867,9 +865,10 @@ void GstEnginePipeline::NewPadCallback(GstElement*, GstPad* pad, // Add a probe to the pad so we can update last_decodebin_segment_. gst_pad_add_probe( - pad, static_cast(GST_PAD_PROBE_TYPE_BUFFER | - GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | - GST_PAD_PROBE_TYPE_EVENT_FLUSH), + pad, + static_cast(GST_PAD_PROBE_TYPE_BUFFER | + GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | + GST_PAD_PROBE_TYPE_EVENT_FLUSH), DecodebinProbe, instance, nullptr); instance->pipeline_is_connected_ = true; diff --git a/src/engines/gstenginepipeline.h b/src/engines/gstenginepipeline.h index cdcb894bf..2c4d717e8 100644 --- a/src/engines/gstenginepipeline.h +++ b/src/engines/gstenginepipeline.h @@ -18,7 +18,7 @@ #ifndef GSTENGINEPIPELINE_H #define GSTENGINEPIPELINE_H -#include +#include #include #include @@ -27,8 +27,7 @@ #include #include #include - -#include +#include #include "engine_fwd.h" #include "playbackrequest.h" @@ -110,7 +109,7 @@ class GstEnginePipeline : public QObject { public slots: void SetVolumeModifier(qreal mod); -signals: + signals: void EndOfStreamReached(int pipeline_id, bool has_next_track); void MetadataFound(int pipeline_id, const Engine::SimpleMetaBundle& bundle); // This indicates an error, delegated from GStreamer, in the pipeline. diff --git a/src/engines/osxdevicefinder.cpp b/src/engines/osxdevicefinder.cpp index 4a430f0d1..256f1f788 100644 --- a/src/engines/osxdevicefinder.cpp +++ b/src/engines/osxdevicefinder.cpp @@ -1,25 +1,26 @@ /* This file is part of Clementine. Copyright 2014, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ -#include +#include "osxdevicefinder.h" #include -#include "osxdevicefinder.h" +#include + #include "core/logging.h" #include "core/scoped_cftyperef.h" @@ -30,8 +31,8 @@ std::unique_ptr GetProperty(const AudioDeviceID& device_id, const AudioObjectPropertyAddress& address, UInt32* size_bytes_out = nullptr) { UInt32 size_bytes = 0; - OSStatus status = AudioObjectGetPropertyDataSize( - device_id, &address, 0, NULL, &size_bytes); + OSStatus status = + AudioObjectGetPropertyDataSize(device_id, &address, 0, NULL, &size_bytes); if (status != kAudioHardwareNoError) { qLog(Warning) << "AudioObjectGetPropertyDataSize failed:" << status; return std::unique_ptr(); @@ -39,11 +40,7 @@ std::unique_ptr GetProperty(const AudioDeviceID& device_id, std::unique_ptr ret(reinterpret_cast(malloc(size_bytes))); - status = AudioObjectGetPropertyData(device_id, - &address, - 0, - NULL, - &size_bytes, + status = AudioObjectGetPropertyData(device_id, &address, 0, NULL, &size_bytes, ret.get()); if (status != kAudioHardwareNoError) { qLog(Warning) << "AudioObjectGetPropertyData failed:" << status; @@ -59,24 +56,18 @@ std::unique_ptr GetProperty(const AudioDeviceID& device_id, } // namespace - -OsxDeviceFinder::OsxDeviceFinder() - : DeviceFinder("osxaudiosink") { -} +OsxDeviceFinder::OsxDeviceFinder() : DeviceFinder("osxaudiosink") {} QList OsxDeviceFinder::ListDevices() { QList ret; - AudioObjectPropertyAddress address = { - kAudioHardwarePropertyDevices, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; + AudioObjectPropertyAddress address = {kAudioHardwarePropertyDevices, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster}; UInt32 device_size_bytes = 0; - std::unique_ptr devices = - GetProperty( - kAudioObjectSystemObject, address, &device_size_bytes); + std::unique_ptr devices = GetProperty( + kAudioObjectSystemObject, address, &device_size_bytes); if (!devices.get()) { return ret; } diff --git a/src/engines/osxdevicefinder.h b/src/engines/osxdevicefinder.h index 92a8a0eb7..c678e84af 100644 --- a/src/engines/osxdevicefinder.h +++ b/src/engines/osxdevicefinder.h @@ -1,16 +1,16 @@ /* This file is part of Clementine. Copyright 2014, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ @@ -28,4 +28,4 @@ class OsxDeviceFinder : public DeviceFinder { virtual QList ListDevices(); }; -#endif // OSXDEVICEFINDER_H +#endif // OSXDEVICEFINDER_H diff --git a/src/engines/pulsedevicefinder.cpp b/src/engines/pulsedevicefinder.cpp index 4874150a7..34d0582db 100644 --- a/src/engines/pulsedevicefinder.cpp +++ b/src/engines/pulsedevicefinder.cpp @@ -15,14 +15,12 @@ along with Clementine. If not, see . */ -#include "core/logging.h" #include "engines/pulsedevicefinder.h" +#include "core/logging.h" + PulseDeviceFinder::PulseDeviceFinder() - : DeviceFinder("pulsesink"), - mainloop_(nullptr), - context_(nullptr) { -} + : DeviceFinder("pulsesink"), mainloop_(nullptr), context_(nullptr) {} bool PulseDeviceFinder::Initialise() { mainloop_ = pa_mainloop_new(); @@ -84,17 +82,17 @@ retry: } switch (pa_context_get_state(context_)) { - case PA_CONTEXT_READY: - break; - case PA_CONTEXT_FAILED: - case PA_CONTEXT_TERMINATED: - // Maybe pulseaudio died. Try reconnecting. - if (Reconnect()) { - goto retry; - } - return state.devices; - default: - return state.devices; + case PA_CONTEXT_READY: + break; + case PA_CONTEXT_FAILED: + case PA_CONTEXT_TERMINATED: + // Maybe pulseaudio died. Try reconnecting. + if (Reconnect()) { + goto retry; + } + return state.devices; + default: + return state.devices; } pa_mainloop_iterate(mainloop_, true, nullptr); @@ -102,8 +100,7 @@ retry: } void PulseDeviceFinder::GetSinkInfoCallback(pa_context* c, - const pa_sink_info* info, - int eol, + const pa_sink_info* info, int eol, void* state_voidptr) { ListDevicesState* state = reinterpret_cast(state_voidptr); @@ -111,8 +108,8 @@ void PulseDeviceFinder::GetSinkInfoCallback(pa_context* c, Device dev; dev.device_property_value = QString::fromUtf8(info->name); dev.description = QString::fromUtf8(info->description); - dev.icon_name = QString::fromUtf8( - pa_proplist_gets(info->proplist, "device.icon_name")); + dev.icon_name = + QString::fromUtf8(pa_proplist_gets(info->proplist, "device.icon_name")); state->devices.append(dev); } diff --git a/src/engines/pulsedevicefinder.h b/src/engines/pulsedevicefinder.h index 31c0560df..69c3675ba 100644 --- a/src/engines/pulsedevicefinder.h +++ b/src/engines/pulsedevicefinder.h @@ -1,16 +1,16 @@ /* This file is part of Clementine. Copyright 2014, David Sansome - + Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ @@ -44,13 +44,11 @@ class PulseDeviceFinder : public DeviceFinder { bool Reconnect(); - static void GetSinkInfoCallback(pa_context* c, - const pa_sink_info* info, - int eol, - void* state_voidptr); + static void GetSinkInfoCallback(pa_context* c, const pa_sink_info* info, + int eol, void* state_voidptr); pa_mainloop* mainloop_; pa_context* context_; }; -#endif // PULSEDEVICEFINDER_H +#endif // PULSEDEVICEFINDER_H diff --git a/src/globalsearch/digitallyimportedsearchprovider.cpp b/src/globalsearch/digitallyimportedsearchprovider.cpp index 2abb20f59..44fd98fd1 100644 --- a/src/globalsearch/digitallyimportedsearchprovider.cpp +++ b/src/globalsearch/digitallyimportedsearchprovider.cpp @@ -16,6 +16,7 @@ */ #include "digitallyimportedsearchprovider.h" + #include "core/logging.h" DigitallyImportedSearchProvider::DigitallyImportedSearchProvider( diff --git a/src/globalsearch/globalsearch.cpp b/src/globalsearch/globalsearch.cpp index 7cb672149..cc7da18ec 100644 --- a/src/globalsearch/globalsearch.cpp +++ b/src/globalsearch/globalsearch.cpp @@ -15,20 +15,20 @@ along with Clementine. If not, see . */ -#include "librarysearchprovider.h" #include "globalsearch.h" -#include "urlsearchprovider.h" -#include "core/application.h" -#include "core/logging.h" -#include "covers/albumcoverloader.h" #include #include #include #include - #include +#include "core/application.h" +#include "core/logging.h" +#include "covers/albumcoverloader.h" +#include "librarysearchprovider.h" +#include "urlsearchprovider.h" + const int GlobalSearch::kDelayedSearchTimeoutMs = 200; const char* GlobalSearch::kSettingsGroup = "GlobalSearch"; const int GlobalSearch::kMaxResultsPerEmission = 500; @@ -44,8 +44,8 @@ GlobalSearch::GlobalSearch(Application* app, QObject* parent) connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)), SLOT(AlbumArtLoaded(quint64, QImage))); - connect(this, SIGNAL(SearchAsyncSig(int,QString)), - this, SLOT(DoSearchAsync(int,QString))); + connect(this, SIGNAL(SearchAsyncSig(int, QString)), this, + SLOT(DoSearchAsync(int, QString))); ConnectProvider(url_provider_); } @@ -141,8 +141,8 @@ void GlobalSearch::timerEvent(QTimerEvent* e) { QObject::timerEvent(e); } -QString GlobalSearch::PixmapCacheKey(const SearchProvider::Result& result) - const { +QString GlobalSearch::PixmapCacheKey( + const SearchProvider::Result& result) const { return "globalsearch:" % QString::number(qulonglong(result.provider_)) % "," % result.metadata_.url().toString(); } @@ -318,8 +318,8 @@ bool GlobalSearch::SetProviderEnabled(const SearchProvider* const_provider, return true; } -bool GlobalSearch::is_provider_enabled(const SearchProvider* const_provider) - const { +bool GlobalSearch::is_provider_enabled( + const SearchProvider* const_provider) const { SearchProvider* provider = const_cast(const_provider); if (!providers_.contains(provider)) return false; diff --git a/src/globalsearch/globalsearch.h b/src/globalsearch/globalsearch.h index 4d7a8f54f..60d29bc20 100644 --- a/src/globalsearch/globalsearch.h +++ b/src/globalsearch/globalsearch.h @@ -21,8 +21,8 @@ #include #include -#include "searchprovider.h" #include "covers/albumcoverloaderoptions.h" +#include "searchprovider.h" class AlbumCoverLoader; class Application; @@ -65,7 +65,7 @@ class GlobalSearch : public QObject { void ReloadSettings(); -signals: + signals: void SearchAsyncSig(int id, const QString& query); void ResultsAvailable(int id, const SearchProvider::ResultList& results); void ProviderSearchFinished(int id, const SearchProvider* provider); diff --git a/src/globalsearch/globalsearchitemdelegate.cpp b/src/globalsearch/globalsearchitemdelegate.cpp index b8a6f02fa..21cff6561 100644 --- a/src/globalsearch/globalsearchitemdelegate.cpp +++ b/src/globalsearch/globalsearchitemdelegate.cpp @@ -16,6 +16,7 @@ */ #include "globalsearchitemdelegate.h" + #include "globalsearchview.h" GlobalSearchItemDelegate::GlobalSearchItemDelegate(GlobalSearchView* view) diff --git a/src/globalsearch/globalsearchmodel.cpp b/src/globalsearch/globalsearchmodel.cpp index 699f92d77..1ad9768bb 100644 --- a/src/globalsearch/globalsearchmodel.cpp +++ b/src/globalsearch/globalsearchmodel.cpp @@ -15,13 +15,14 @@ along with Clementine. If not, see . */ -#include "globalsearch.h" #include "globalsearchmodel.h" -#include "core/mimedata.h" -#include "ui/iconloader.h" #include +#include "core/mimedata.h" +#include "globalsearch.h" +#include "ui/iconloader.h" + GlobalSearchModel::GlobalSearchModel(GlobalSearch* engine, QObject* parent) : QStandardItemModel(parent), engine_(engine), @@ -34,10 +35,10 @@ GlobalSearchModel::GlobalSearchModel(GlobalSearch* engine, QObject* parent) group_by_[2] = LibraryModel::GroupBy_None; QIcon nocover = IconLoader::Load("nocover", IconLoader::Other); - no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()).scaled( - LibraryModel::kPrettyCoverSize, - LibraryModel::kPrettyCoverSize, - Qt::KeepAspectRatio, Qt::SmoothTransformation); + no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()) + .scaled(LibraryModel::kPrettyCoverSize, + LibraryModel::kPrettyCoverSize, + Qt::KeepAspectRatio, Qt::SmoothTransformation); } void GlobalSearchModel::AddResults(const SearchProvider::ResultList& results) { @@ -305,7 +306,7 @@ void GatherResults(const QStandardItem* parent, GatherResults(parent->child(i), results); } } -} +} // namespace void GlobalSearchModel::SetGroupBy(const LibraryModel::Grouping& grouping, bool regroup_now) { diff --git a/src/globalsearch/globalsearchmodel.h b/src/globalsearch/globalsearchmodel.h index d0765f70d..cc737729a 100644 --- a/src/globalsearch/globalsearchmodel.h +++ b/src/globalsearch/globalsearchmodel.h @@ -18,11 +18,11 @@ #ifndef GLOBALSEARCHMODEL_H #define GLOBALSEARCHMODEL_H -#include "searchprovider.h" -#include "library/librarymodel.h" - #include +#include "library/librarymodel.h" +#include "searchprovider.h" + class GlobalSearch; class QSortFilterProxyModel; @@ -54,10 +54,10 @@ class GlobalSearchModel : public QStandardItemModel { void Clear(); - SearchProvider::ResultList GetChildResults(const QModelIndexList& indexes) - const; - SearchProvider::ResultList GetChildResults(const QList& items) - const; + SearchProvider::ResultList GetChildResults( + const QModelIndexList& indexes) const; + SearchProvider::ResultList GetChildResults( + const QList& items) const; // QAbstractItemModel QMimeData* mimeData(const QModelIndexList& indexes) const; diff --git a/src/globalsearch/globalsearchsettingspage.cpp b/src/globalsearch/globalsearchsettingspage.cpp index 8b4c9b25e..4a3926613 100644 --- a/src/globalsearch/globalsearchsettingspage.cpp +++ b/src/globalsearch/globalsearchsettingspage.cpp @@ -15,24 +15,25 @@ along with Clementine. If not, see . */ -#include "globalsearch.h" #include "globalsearchsettingspage.h" + +#include +#include + #include "core/logging.h" +#include "globalsearch.h" #include "ui/iconloader.h" #include "ui/settingsdialog.h" #include "ui_globalsearchsettingspage.h" -#include - -#include - GlobalSearchSettingsPage::GlobalSearchSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui::GlobalSearchSettingsPage) { ui_->setupUi(this); setWindowIcon(IconLoader::Load("search", IconLoader::Base)); ui_->sources->header()->setSectionResizeMode(0, QHeaderView::Stretch); - ui_->sources->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); + ui_->sources->header()->setSectionResizeMode(1, + QHeaderView::ResizeToContents); warning_icon_ = IconLoader::Load("dialog-warning", IconLoader::Base); diff --git a/src/globalsearch/globalsearchsettingspage.h b/src/globalsearch/globalsearchsettingspage.h index d656a9646..ff804c266 100644 --- a/src/globalsearch/globalsearchsettingspage.h +++ b/src/globalsearch/globalsearchsettingspage.h @@ -18,11 +18,11 @@ #ifndef GLOBALSEARCHSETTINGSPAGE_H #define GLOBALSEARCHSETTINGSPAGE_H -#include "ui/settingspage.h" - #include #include +#include "ui/settingspage.h" + class GlobalSearch; class SearchProvider; class Ui_GlobalSearchSettingsPage; diff --git a/src/globalsearch/globalsearchsortmodel.cpp b/src/globalsearch/globalsearchsortmodel.cpp index 9a19899f4..d5cbda7dd 100644 --- a/src/globalsearch/globalsearchsortmodel.cpp +++ b/src/globalsearch/globalsearchsortmodel.cpp @@ -15,10 +15,11 @@ along with Clementine. If not, see . */ -#include "globalsearchmodel.h" #include "globalsearchsortmodel.h" -#include "searchprovider.h" + #include "core/logging.h" +#include "globalsearchmodel.h" +#include "searchprovider.h" GlobalSearchSortModel::GlobalSearchSortModel(QObject* parent) : QSortFilterProxyModel(parent) {} diff --git a/src/globalsearch/globalsearchview.cpp b/src/globalsearch/globalsearchview.cpp index bfc5af27e..45e4f5d61 100644 --- a/src/globalsearch/globalsearchview.cpp +++ b/src/globalsearch/globalsearchview.cpp @@ -21,27 +21,26 @@ #include #include #include - #include #include -#include "globalsearch.h" -#include "globalsearchitemdelegate.h" -#include "globalsearchmodel.h" -#include "globalsearchsortmodel.h" -#include "searchprovider.h" -#include "searchproviderstatuswidget.h" -#include "suggestionwidget.h" -#include "ui_globalsearchview.h" #include "core/application.h" #include "core/logging.h" #include "core/mimedata.h" #include "core/timeconstants.h" +#include "globalsearch.h" +#include "globalsearchitemdelegate.h" +#include "globalsearchmodel.h" +#include "globalsearchsortmodel.h" #include "internet/core/internetsongmimedata.h" +#include "library/groupbydialog.h" #include "library/libraryfilterwidget.h" #include "library/librarymodel.h" -#include "library/groupbydialog.h" #include "playlist/songmimedata.h" +#include "searchprovider.h" +#include "searchproviderstatuswidget.h" +#include "suggestionwidget.h" +#include "ui_globalsearchview.h" using std::placeholders::_1; using std::placeholders::_2; @@ -184,7 +183,7 @@ bool CompareProvider(const QStringList& provider_order, SearchProvider* left, } return left_index < right_index; } -} +} // namespace void GlobalSearchView::ReloadSettings() { const bool old_show_suggestions = show_suggestions_; diff --git a/src/globalsearch/globalsearchview.h b/src/globalsearch/globalsearchview.h index 2b530256b..513598f4e 100644 --- a/src/globalsearch/globalsearchview.h +++ b/src/globalsearch/globalsearchview.h @@ -18,13 +18,13 @@ #ifndef GLOBALSEARCHVIEW_H #define GLOBALSEARCHVIEW_H -#include "searchprovider.h" -#include "library/librarymodel.h" -#include "ui/settingsdialog.h" -#include "playlist/playlistmanager.h" - #include +#include "library/librarymodel.h" +#include "playlist/playlistmanager.h" +#include "searchprovider.h" +#include "ui/settingsdialog.h" + class Application; class GlobalSearchModel; class GroupByDialog; @@ -65,7 +65,7 @@ class GlobalSearchView : public QWidget { void FocusSearchField(); void OpenSettingsDialog(); -signals: + signals: void AddToPlaylist(QMimeData* data); private slots: diff --git a/src/globalsearch/librarysearchprovider.cpp b/src/globalsearch/librarysearchprovider.cpp index d1b3e787c..7e04ed496 100644 --- a/src/globalsearch/librarysearchprovider.cpp +++ b/src/globalsearch/librarysearchprovider.cpp @@ -16,6 +16,9 @@ */ #include "librarysearchprovider.h" + +#include + #include "core/logging.h" #include "covers/albumcoverloader.h" #include "library/librarybackend.h" @@ -23,8 +26,6 @@ #include "library/sqlrow.h" #include "playlist/songmimedata.h" -#include - LibrarySearchProvider::LibrarySearchProvider(LibraryBackendInterface* backend, const QString& name, const QString& id, diff --git a/src/globalsearch/savedradiosearchprovider.cpp b/src/globalsearch/savedradiosearchprovider.cpp index c571eb72e..3139eef4e 100644 --- a/src/globalsearch/savedradiosearchprovider.cpp +++ b/src/globalsearch/savedradiosearchprovider.cpp @@ -16,6 +16,7 @@ */ #include "savedradiosearchprovider.h" + #include "core/mimedata.h" #include "ui/iconloader.h" @@ -24,8 +25,8 @@ SavedRadioSearchProvider::SavedRadioSearchProvider(SavedRadio* service, QObject* parent) : SimpleSearchProvider(app, parent), service_(service) { Init(tr("Your radio streams"), "savedradio", - IconLoader::Load("document-open-remote", IconLoader::Base), - MimeDataContainsUrlsOnly); + IconLoader::Load("document-open-remote", IconLoader::Base), + MimeDataContainsUrlsOnly); set_max_suggestion_count(3); diff --git a/src/globalsearch/searchprovider.h b/src/globalsearch/searchprovider.h index b154c47cc..aecb49672 100644 --- a/src/globalsearch/searchprovider.h +++ b/src/globalsearch/searchprovider.h @@ -150,7 +150,7 @@ class SearchProvider : public QObject { static QImage ScaleAndPad(const QImage& image); -signals: + signals: void ResultsAvailable(int id, const SearchProvider::ResultList& results); void SearchFinished(int id); diff --git a/src/globalsearch/searchproviderstatuswidget.cpp b/src/globalsearch/searchproviderstatuswidget.cpp index 8bb25738d..3e22733e6 100644 --- a/src/globalsearch/searchproviderstatuswidget.cpp +++ b/src/globalsearch/searchproviderstatuswidget.cpp @@ -15,15 +15,16 @@ along with Clementine. If not, see . */ -#include "globalsearch.h" -#include "searchprovider.h" #include "searchproviderstatuswidget.h" -#include "ui_searchproviderstatuswidget.h" -#include "core/application.h" -#include "ui/iconloader.h" #include +#include "core/application.h" +#include "globalsearch.h" +#include "searchprovider.h" +#include "ui/iconloader.h" +#include "ui_searchproviderstatuswidget.h" + SearchProviderStatusWidget::SearchProviderStatusWidget( const QIcon& warning_icon, GlobalSearch* engine, SearchProvider* provider, QWidget* parent) diff --git a/src/globalsearch/searchproviderstatuswidget.h b/src/globalsearch/searchproviderstatuswidget.h index 16946715a..0eebc328b 100644 --- a/src/globalsearch/searchproviderstatuswidget.h +++ b/src/globalsearch/searchproviderstatuswidget.h @@ -27,7 +27,8 @@ class Ui_SearchProviderStatusWidget; class SearchProviderStatusWidget : public QWidget { public: SearchProviderStatusWidget(const QIcon& warning_icon, GlobalSearch* engine, - SearchProvider* provider, QWidget* parent = nullptr); + SearchProvider* provider, + QWidget* parent = nullptr); ~SearchProviderStatusWidget(); bool eventFilter(QObject* object, QEvent* event); diff --git a/src/globalsearch/simplesearchprovider.cpp b/src/globalsearch/simplesearchprovider.cpp index ff7784848..d8ffeab3d 100644 --- a/src/globalsearch/simplesearchprovider.cpp +++ b/src/globalsearch/simplesearchprovider.cpp @@ -16,6 +16,7 @@ */ #include "simplesearchprovider.h" + #include "core/logging.h" #include "playlist/songmimedata.h" diff --git a/src/globalsearch/spotifysearchprovider.cpp b/src/globalsearch/spotifysearchprovider.cpp index 75936fa2c..4a6f4df2c 100644 --- a/src/globalsearch/spotifysearchprovider.cpp +++ b/src/globalsearch/spotifysearchprovider.cpp @@ -29,7 +29,7 @@ namespace { const int kSearchSongLimit = 5; const int kSearchAlbumLimit = 20; -} +} // namespace SpotifySearchProvider::SpotifySearchProvider(Application* app, QObject* parent) : SearchProvider(app, parent), server_(nullptr), service_(nullptr) { diff --git a/src/globalsearch/suggestionwidget.cpp b/src/globalsearch/suggestionwidget.cpp index cfcc232fa..3967eab46 100644 --- a/src/globalsearch/suggestionwidget.cpp +++ b/src/globalsearch/suggestionwidget.cpp @@ -16,11 +16,12 @@ */ #include "suggestionwidget.h" -#include "ui_suggestionwidget.h" -#include "ui/iconloader.h" #include +#include "ui/iconloader.h" +#include "ui_suggestionwidget.h" + SuggestionWidget::SuggestionWidget(const QIcon& search_icon, QWidget* parent) : QWidget(parent), ui_(new Ui_SuggestionWidget) { ui_->setupUi(this); diff --git a/src/globalsearch/suggestionwidget.h b/src/globalsearch/suggestionwidget.h index 0b8e329e7..71eebf464 100644 --- a/src/globalsearch/suggestionwidget.h +++ b/src/globalsearch/suggestionwidget.h @@ -34,7 +34,7 @@ class SuggestionWidget : public QWidget { public slots: void SetText(const QString& text); -signals: + signals: void SuggestionClicked(const QString& query); private: diff --git a/src/globalsearch/urlsearchprovider.cpp b/src/globalsearch/urlsearchprovider.cpp index 806583159..20b36d301 100644 --- a/src/globalsearch/urlsearchprovider.cpp +++ b/src/globalsearch/urlsearchprovider.cpp @@ -16,12 +16,13 @@ */ #include "urlsearchprovider.h" -#include "core/mimedata.h" -#include "ui/iconloader.h" #include #include +#include "core/mimedata.h" +#include "ui/iconloader.h" + const char* UrlSearchProvider::kUrlRegex = "^[a-zA-Z][a-zA-Z0-9+-.]*://"; UrlSearchProvider::UrlSearchProvider(Application* app, QObject* parent) diff --git a/src/globalsearch/urlsearchprovider.h b/src/globalsearch/urlsearchprovider.h index 0f982dcc0..65295c45c 100644 --- a/src/globalsearch/urlsearchprovider.h +++ b/src/globalsearch/urlsearchprovider.h @@ -18,10 +18,10 @@ #ifndef URLSEARCHPROVIDER_H #define URLSEARCHPROVIDER_H -#include "searchprovider.h" - #include +#include "searchprovider.h" + class UrlSearchProvider : public SearchProvider { public: UrlSearchProvider(Application* app, QObject* parent); diff --git a/src/internet/box/boxservice.cpp b/src/internet/box/boxservice.cpp index 5d7fb1406..f6b07b642 100644 --- a/src/internet/box/boxservice.cpp +++ b/src/internet/box/boxservice.cpp @@ -18,9 +18,9 @@ #include "boxservice.h" +#include #include #include -#include #include #include "core/application.h" @@ -53,7 +53,7 @@ static const char* kEvents = "https://api.box.com/2.0/events"; BoxService::BoxService(Application* app, InternetModel* parent) : CloudFileService(app, parent, kServiceName, kSettingsGroup, - IconLoader::Load("box", IconLoader::Provider), + IconLoader::Load("box", IconLoader::Provider), SettingsDialog::Page_Box) { app->player()->RegisterUrlHandler(new BoxUrlHandler(this, this)); } @@ -126,7 +126,8 @@ void BoxService::AddAuthorizationHeader(QNetworkRequest* request) const { void BoxService::FetchUserInfoFinished(QNetworkReply* reply) { reply->deleteLater(); - QJsonObject json_response = QJsonDocument::fromJson(reply->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromJson(reply->readAll()).object(); QString name = json_response["name"].toString(); if (!name.isEmpty()) { @@ -175,7 +176,8 @@ void BoxService::InitialiseEventsCursor() { void BoxService::InitialiseEventsFinished(QNetworkReply* reply) { reply->deleteLater(); - QJsonObject json_response = QJsonDocument::fromJson(reply->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromJson(reply->readAll()).object(); if (json_response.contains("next_stream_position")) { QSettings s; s.beginGroup(kSettingsGroup); @@ -193,7 +195,7 @@ void BoxService::FetchRecursiveFolderItems(const int folder_id, << "modified_at" << "name"; QString fields_list = fields.join(","); - QUrlQuery url_query (url); + QUrlQuery url_query(url); url_query.addQueryItem("fields", fields_list); url_query.addQueryItem("limit", "1000"); // Maximum according to API docs. url_query.addQueryItem("offset", QString::number(offset)); @@ -210,7 +212,8 @@ void BoxService::FetchFolderItemsFinished(QNetworkReply* reply, const int folder_id) { reply->deleteLater(); - QJsonObject json_response = QJsonDocument::fromJson(reply->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromJson(reply->readAll()).object(); QJsonArray entries = json_response["entries"].toArray(); const int total_entries = json_response["total_count"].toInt(); @@ -230,7 +233,7 @@ void BoxService::FetchFolderItemsFinished(QNetworkReply* reply, } } -void BoxService::MaybeAddFileEntry(const QJsonObject &entry) { +void BoxService::MaybeAddFileEntry(const QJsonObject& entry) { QString mime_type = GuessMimeTypeForFile(entry["name"].toString()); QUrl url; url.setScheme("box"); @@ -238,8 +241,10 @@ void BoxService::MaybeAddFileEntry(const QJsonObject &entry) { Song song; song.set_url(url); - song.set_ctime(QDateTime::fromString(entry["created_at"].toString()).toTime_t()); - song.set_mtime(QDateTime::fromString(entry["modified_at"].toString()).toTime_t()); + song.set_ctime( + QDateTime::fromString(entry["created_at"].toString()).toTime_t()); + song.set_mtime( + QDateTime::fromString(entry["modified_at"].toString()).toTime_t()); song.set_filesize(entry["size"].toInt()); song.set_title(entry["name"].toString()); @@ -288,7 +293,8 @@ void BoxService::UpdateFilesFromCursor(const QString& cursor) { void BoxService::FetchEventsFinished(QNetworkReply* reply) { // TODO(John Maguire): Page through events. reply->deleteLater(); - QJsonObject json_response = QJsonDocument::fromJson(reply->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromJson(reply->readAll()).object(); QSettings s; s.beginGroup(kSettingsGroup); diff --git a/src/internet/box/boxservice.h b/src/internet/box/boxservice.h index a7fd990aa..15cd20580 100644 --- a/src/internet/box/boxservice.h +++ b/src/internet/box/boxservice.h @@ -19,10 +19,10 @@ #ifndef INTERNET_BOX_BOXSERVICE_H_ #define INTERNET_BOX_BOXSERVICE_H_ -#include "internet/core/cloudfileservice.h" - #include +#include "internet/core/cloudfileservice.h" + class OAuthenticator; class QNetworkReply; class QNetworkRequest; diff --git a/src/internet/box/boxsettingspage.cpp b/src/internet/box/boxsettingspage.cpp index 361394b5a..55e7e1a71 100644 --- a/src/internet/box/boxsettingspage.cpp +++ b/src/internet/box/boxsettingspage.cpp @@ -20,12 +20,12 @@ #include -#include "ui_boxsettingspage.h" #include "core/application.h" #include "internet/box/boxservice.h" #include "internet/core/internetmodel.h" -#include "ui/settingsdialog.h" #include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_boxsettingspage.h" BoxSettingsPage::BoxSettingsPage(SettingsDialog* parent) : SettingsPage(parent), diff --git a/src/internet/box/boxsettingspage.h b/src/internet/box/boxsettingspage.h index b7a85c558..72063979d 100644 --- a/src/internet/box/boxsettingspage.h +++ b/src/internet/box/boxsettingspage.h @@ -19,11 +19,11 @@ #ifndef INTERNET_BOX_BOXSETTINGSPAGE_H_ #define INTERNET_BOX_BOXSETTINGSPAGE_H_ -#include "ui/settingspage.h" - #include #include +#include "ui/settingspage.h" + class BoxService; class Ui_BoxSettingsPage; diff --git a/src/internet/core/cloudfilesearchprovider.cpp b/src/internet/core/cloudfilesearchprovider.cpp index d1950afdd..389ca4dcd 100644 --- a/src/internet/core/cloudfilesearchprovider.cpp +++ b/src/internet/core/cloudfilesearchprovider.cpp @@ -17,6 +17,7 @@ */ #include "internet/core/cloudfilesearchprovider.h" + #include "internet/core/cloudfileservice.h" #include "internet/core/internetmodel.h" diff --git a/src/internet/core/cloudfileservice.cpp b/src/internet/core/cloudfileservice.cpp index c762bedf5..fcb411b3c 100644 --- a/src/internet/core/cloudfileservice.cpp +++ b/src/internet/core/cloudfileservice.cpp @@ -99,12 +99,12 @@ void CloudFileService::ShowContextMenu(const QPoint& global_pos) { if (!context_menu_) { context_menu_.reset(new QMenu); context_menu_->addActions(GetPlaylistActions()); - context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), - tr("Cover Manager"), this, + context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), + tr("Cover Manager"), this, SLOT(ShowCoverManager())); context_menu_->addSeparator(); - context_menu_->addAction(IconLoader::Load("configure", IconLoader::Base), - tr("Configure..."), this, + context_menu_->addAction(IconLoader::Load("configure", IconLoader::Base), + tr("Configure..."), this, SLOT(ShowSettingsDialog())); } context_menu_->popup(global_pos); diff --git a/src/internet/core/cloudfileservice.h b/src/internet/core/cloudfileservice.h index ad128511f..b2f58b13d 100644 --- a/src/internet/core/cloudfileservice.h +++ b/src/internet/core/cloudfileservice.h @@ -20,13 +20,11 @@ #ifndef INTERNET_CORE_CLOUDFILESERVICE_H_ #define INTERNET_CORE_CLOUDFILESERVICE_H_ -#include "internet/core/internetservice.h" - +#include #include -#include - #include "core/tagreaderclient.h" +#include "internet/core/internetservice.h" #include "ui/albumcovermanager.h" class UrlHandler; @@ -52,7 +50,7 @@ class CloudFileService : public InternetService { virtual bool has_credentials() const = 0; bool is_indexing() const { return indexing_task_id_ != -1; } -signals: + signals: void AllIndexingTasksFinished(); public slots: diff --git a/src/internet/core/geolocator.cpp b/src/internet/core/geolocator.cpp index b4ac30852..877356f17 100644 --- a/src/internet/core/geolocator.cpp +++ b/src/internet/core/geolocator.cpp @@ -19,13 +19,12 @@ #include "geolocator.h" -#include -#include - -#include -#include #include #include +#include +#include +#include +#include #include "core/closure.h" #include "core/logging.h" @@ -99,7 +98,8 @@ void Geolocator::RequestFinished(QNetworkReply* reply) { } QJsonParseError error; - QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll(), &error); + QJsonDocument json_document = + QJsonDocument::fromJson(reply->readAll(), &error); if (error.error != QJsonParseError::NoError) { emit Finished(LatLng()); return; diff --git a/src/internet/core/internetmimedata.h b/src/internet/core/internetmimedata.h index b9257c825..cbb384522 100644 --- a/src/internet/core/internetmimedata.h +++ b/src/internet/core/internetmimedata.h @@ -21,11 +21,11 @@ #ifndef INTERNET_CORE_INTERNETMIMEDATA_H_ #define INTERNET_CORE_INTERNETMIMEDATA_H_ -#include "core/mimedata.h" - #include #include +#include "core/mimedata.h" + class InternetModel; class InternetMimeData : public MimeData { diff --git a/src/internet/core/internetmodel.cpp b/src/internet/core/internetmodel.cpp index db0ba4a74..2015ae1b6 100644 --- a/src/internet/core/internetmodel.cpp +++ b/src/internet/core/internetmodel.cpp @@ -249,9 +249,8 @@ QStringList InternetModel::mimeTypes() const { QMimeData* InternetModel::mimeData(const QModelIndexList& indexes) const { // Special case for when the user double clicked on a special item. - if (indexes.count() == 1 && - indexes[0].data(Role_PlayBehaviour).toInt() == - PlayBehaviour_DoubleClickAction) { + if (indexes.count() == 1 && indexes[0].data(Role_PlayBehaviour).toInt() == + PlayBehaviour_DoubleClickAction) { InternetModel::ServiceForIndex(indexes[0]) ->ItemDoubleClicked(itemFromIndex(indexes[0])); return nullptr; diff --git a/src/internet/core/internetplaylistitem.cpp b/src/internet/core/internetplaylistitem.cpp index 08b62a94d..c6cca3483 100644 --- a/src/internet/core/internetplaylistitem.cpp +++ b/src/internet/core/internetplaylistitem.cpp @@ -21,13 +21,13 @@ #include "internet/core/internetplaylistitem.h" -#include #include +#include #include -#include "internet/core/internetservice.h" -#include "internet/core/internetmodel.h" #include "core/settingsprovider.h" +#include "internet/core/internetmodel.h" +#include "internet/core/internetservice.h" #include "library/sqlrow.h" #include "playlist/playlistbackend.h" diff --git a/src/internet/core/internetplaylistitem.h b/src/internet/core/internetplaylistitem.h index 320f2eece..875ae0aa5 100644 --- a/src/internet/core/internetplaylistitem.h +++ b/src/internet/core/internetplaylistitem.h @@ -22,11 +22,11 @@ #ifndef INTERNET_CORE_INTERNETPLAYLISTITEM_H_ #define INTERNET_CORE_INTERNETPLAYLISTITEM_H_ +#include + #include "core/song.h" #include "playlist/playlistitem.h" -#include - class InternetService; class InternetPlaylistItem : public PlaylistItem { diff --git a/src/internet/core/internetservice.h b/src/internet/core/internetservice.h index b66ecd2e6..e455f6342 100644 --- a/src/internet/core/internetservice.h +++ b/src/internet/core/internetservice.h @@ -24,8 +24,8 @@ #define INTERNET_CORE_INTERNETSERVICE_H_ #include -#include #include +#include #include #include "core/lazy.h" @@ -87,7 +87,7 @@ class InternetService : public QObject { virtual QString Icon() { return QString(); } -signals: + signals: void StreamError(const QString& message); void StreamMetadataFound(const QUrl& original_url, const Song& song); diff --git a/src/internet/core/internetshowsettingspage.cpp b/src/internet/core/internetshowsettingspage.cpp index e8f0d33f9..e305ce469 100644 --- a/src/internet/core/internetshowsettingspage.cpp +++ b/src/internet/core/internetshowsettingspage.cpp @@ -18,13 +18,13 @@ #include "internetshowsettingspage.h" +#include + #include "core/application.h" +#include "internet/core/internetmodel.h" +#include "internet/core/internetservice.h" #include "ui/iconloader.h" #include "ui/settingsdialog.h" -#include "internet/core/internetservice.h" -#include "internet/core/internetmodel.h" - -#include InternetShowSettingsPage::InternetShowSettingsPage(SettingsDialog* parent) : SettingsPage(parent), ui_(new Ui::InternetShowSettingsPage) { @@ -32,7 +32,8 @@ InternetShowSettingsPage::InternetShowSettingsPage(SettingsDialog* parent) setWindowIcon(IconLoader::Load("internet-services", IconLoader::Base)); ui_->sources->header()->setSectionResizeMode(0, QHeaderView::Stretch); - ui_->sources->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); + ui_->sources->header()->setSectionResizeMode(1, + QHeaderView::ResizeToContents); } void InternetShowSettingsPage::Load() { diff --git a/src/internet/core/internetshowsettingspage.h b/src/internet/core/internetshowsettingspage.h index 12cce64ae..7d2603d74 100644 --- a/src/internet/core/internetshowsettingspage.h +++ b/src/internet/core/internetshowsettingspage.h @@ -19,11 +19,11 @@ #ifndef INTERNET_CORE_INTERNETSHOWSETTINGSPAGE_H_ #define INTERNET_CORE_INTERNETSHOWSETTINGSPAGE_H_ +#include + #include "ui/settingspage.h" #include "ui_internetshowsettingspage.h" -#include - class QTreeWidgetItem; class Ui_InternetShowSettingsPage; diff --git a/src/internet/core/internetsongmimedata.h b/src/internet/core/internetsongmimedata.h index 9e11f7796..8b2249222 100644 --- a/src/internet/core/internetsongmimedata.h +++ b/src/internet/core/internetsongmimedata.h @@ -29,7 +29,8 @@ class InternetSongMimeData : public MimeData { Q_OBJECT public: - explicit InternetSongMimeData(InternetService* _service) : service(_service) {} + explicit InternetSongMimeData(InternetService* _service) + : service(_service) {} InternetService* service; SongList songs; diff --git a/src/internet/core/internetview.cpp b/src/internet/core/internetview.cpp index c1967aecf..2704ee83f 100644 --- a/src/internet/core/internetview.cpp +++ b/src/internet/core/internetview.cpp @@ -23,8 +23,8 @@ #include -#include "internet/core/internetmodel.h" #include "core/mergedproxymodel.h" +#include "internet/core/internetmodel.h" #include "library/libraryview.h" InternetView::InternetView(QWidget* parent) : AutoExpandingTreeView(parent) { diff --git a/src/internet/core/internetviewcontainer.cpp b/src/internet/core/internetviewcontainer.cpp index 46f2d53b2..a22719df0 100644 --- a/src/internet/core/internetviewcontainer.cpp +++ b/src/internet/core/internetviewcontainer.cpp @@ -19,17 +19,17 @@ */ #include "internetviewcontainer.h" -#include "ui_internetviewcontainer.h" #include #include #include -#include "internet/core/internetmodel.h" -#include "internet/core/internetservice.h" #include "core/application.h" #include "core/mergedproxymodel.h" #include "globalsearch/globalsearch.h" +#include "internet/core/internetmodel.h" +#include "internet/core/internetservice.h" +#include "ui_internetviewcontainer.h" const int InternetViewContainer::kAnimationDuration = 500; diff --git a/src/internet/core/internetviewcontainer.h b/src/internet/core/internetviewcontainer.h index a820f71c4..ec02f7da9 100644 --- a/src/internet/core/internetviewcontainer.h +++ b/src/internet/core/internetviewcontainer.h @@ -20,8 +20,8 @@ #ifndef INTERNET_CORE_INTERNETVIEWCONTAINER_H_ #define INTERNET_CORE_INTERNETVIEWCONTAINER_H_ -#include #include +#include class Application; class InternetService; diff --git a/src/internet/core/oauthenticator.cpp b/src/internet/core/oauthenticator.cpp index 3f7cae01a..59a71ef46 100644 --- a/src/internet/core/oauthenticator.cpp +++ b/src/internet/core/oauthenticator.cpp @@ -21,13 +21,13 @@ #include "internet/core/oauthenticator.h" #include +#include +#include +#include #include #include #include #include -#include -#include -#include #include "core/closure.h" #include "core/logging.h" @@ -87,7 +87,8 @@ void OAuthenticator::StartAuthorisation(const QString& oauth_endpoint, void OAuthenticator::RedirectArrived(LocalRedirectServer* server, QUrl url) { server->deleteLater(); QUrl request_url = server->request_url(); - RequestAccessToken(QUrlQuery(request_url).queryItemValue("code").toUtf8(), url); + RequestAccessToken(QUrlQuery(request_url).queryItemValue("code").toUtf8(), + url); } QByteArray OAuthenticator::ParseHttpRequest(const QByteArray& request) const { @@ -138,7 +139,8 @@ void OAuthenticator::FetchAccessTokenFinished(QNetworkReply* reply) { } QJsonParseError error; - QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll(), &error); + QJsonDocument json_document = + QJsonDocument::fromJson(reply->readAll(), &error); if (error.error != QJsonParseError::NoError) { qLog(Error) << "Failed to parse oauth reply"; diff --git a/src/internet/core/searchboxwidget.cpp b/src/internet/core/searchboxwidget.cpp index 62a95599a..40b602ddc 100644 --- a/src/internet/core/searchboxwidget.cpp +++ b/src/internet/core/searchboxwidget.cpp @@ -19,13 +19,13 @@ */ #include "internet/core/searchboxwidget.h" -#include "ui_searchboxwidget.h" #include #include #include "internet/core/internetservice.h" #include "ui/iconloader.h" +#include "ui_searchboxwidget.h" #include "widgets/didyoumean.h" SearchBoxWidget::SearchBoxWidget(InternetService* service) diff --git a/src/internet/digitally/digitallyimportedclient.cpp b/src/internet/digitally/digitallyimportedclient.cpp index f34640880..858545e34 100644 --- a/src/internet/digitally/digitallyimportedclient.cpp +++ b/src/internet/digitally/digitallyimportedclient.cpp @@ -19,11 +19,11 @@ #include "digitallyimportedclient.h" -#include -#include +#include #include #include -#include +#include +#include #include "core/logging.h" #include "core/network.h" @@ -50,11 +50,11 @@ DigitallyImportedClient::DigitallyImportedClient(const QString& service_name, void DigitallyImportedClient::SetAuthorisationHeader( QNetworkRequest* req) const { - req->setRawHeader("Authorization", "Basic " + - QString("%1:%2") - .arg(kApiUsername, kApiPassword) - .toLatin1() - .toBase64()); + req->setRawHeader("Authorization", + "Basic " + QString("%1:%2") + .arg(kApiUsername, kApiPassword) + .toLatin1() + .toBase64()); } QNetworkReply* DigitallyImportedClient::Auth(const QString& username, @@ -83,7 +83,8 @@ DigitallyImportedClient::AuthReply DigitallyImportedClient::ParseAuthReply( return ret; } - QJsonObject json_root_object = QJsonDocument::fromJson(reply->readAll()).object(); + QJsonObject json_root_object = + QJsonDocument::fromJson(reply->readAll()).object(); if (!json_root_object.contains("subscriptions")) { return ret; @@ -123,13 +124,14 @@ DigitallyImportedClient::ChannelList DigitallyImportedClient::ParseChannelList( QNetworkReply* reply) const { ChannelList ret; - QJsonObject json_root_object = QJsonDocument::fromJson(reply->readAll()).object(); + QJsonObject json_root_object = + QJsonDocument::fromJson(reply->readAll()).object(); if (!json_root_object.contains("channel_filters")) return ret; QJsonArray json_filters = json_root_object["channel_filters"].toArray(); - for (const QJsonValue & filter: json_filters) { + for (const QJsonValue& filter : json_filters) { // Find the filter called "All" QJsonObject json_filter = filter.toObject(); if (json_filter["name"].toString() != "All") continue; diff --git a/src/internet/digitally/digitallyimportedclient.h b/src/internet/digitally/digitallyimportedclient.h index e090242fd..c05a8c94e 100644 --- a/src/internet/digitally/digitallyimportedclient.h +++ b/src/internet/digitally/digitallyimportedclient.h @@ -33,7 +33,8 @@ class DigitallyImportedClient : public QObject { Q_OBJECT public: - explicit DigitallyImportedClient(const QString& service_name, QObject* parent = nullptr); + explicit DigitallyImportedClient(const QString& service_name, + QObject* parent = nullptr); static const char* kApiUsername; static const char* kApiPassword; diff --git a/src/internet/digitally/digitallyimportedservicebase.cpp b/src/internet/digitally/digitallyimportedservicebase.cpp index 4e0457da1..9626f2f42 100644 --- a/src/internet/digitally/digitallyimportedservicebase.cpp +++ b/src/internet/digitally/digitallyimportedservicebase.cpp @@ -20,12 +20,11 @@ #include "digitallyimportedservicebase.h" -#include - #include #include #include #include +#include #include "core/application.h" #include "core/closure.h" diff --git a/src/internet/digitally/digitallyimportedsettingspage.cpp b/src/internet/digitally/digitallyimportedsettingspage.cpp index aba71baf4..54519ece8 100644 --- a/src/internet/digitally/digitallyimportedsettingspage.cpp +++ b/src/internet/digitally/digitallyimportedsettingspage.cpp @@ -18,16 +18,16 @@ */ #include "digitallyimportedsettingspage.h" -#include "ui_digitallyimportedsettingspage.h" #include #include #include +#include "core/closure.h" #include "digitallyimportedclient.h" #include "digitallyimportedservicebase.h" -#include "core/closure.h" #include "ui/iconloader.h" +#include "ui_digitallyimportedsettingspage.h" DigitallyImportedSettingsPage::DigitallyImportedSettingsPage( SettingsDialog* dialog) diff --git a/src/internet/digitally/digitallyimportedurlhandler.cpp b/src/internet/digitally/digitallyimportedurlhandler.cpp index 75ec0b6f9..a98c0a5b8 100644 --- a/src/internet/digitally/digitallyimportedurlhandler.cpp +++ b/src/internet/digitally/digitallyimportedurlhandler.cpp @@ -20,11 +20,11 @@ #include "digitallyimportedurlhandler.h" -#include "digitallyimportedservicebase.h" -#include "internet/core/internetmodel.h" #include "core/application.h" #include "core/logging.h" #include "core/taskmanager.h" +#include "digitallyimportedservicebase.h" +#include "internet/core/internetmodel.h" #include "playlistparsers/playlistparser.h" #include "ui/iconloader.h" diff --git a/src/internet/dropbox/dropboxservice.cpp b/src/internet/dropbox/dropboxservice.cpp index bb2805099..839746d22 100644 --- a/src/internet/dropbox/dropboxservice.cpp +++ b/src/internet/dropbox/dropboxservice.cpp @@ -20,10 +20,10 @@ #include "dropboxservice.h" #include -#include +#include #include #include -#include +#include #include "core/application.h" #include "core/logging.h" @@ -182,7 +182,8 @@ void DropboxService::RequestFileListFinished(QNetworkReply* reply) { } } - if (json_response.contains("has_more") && json_response["has_more"].toBool()) { + if (json_response.contains("has_more") && + json_response["has_more"].toBool()) { QSettings s; s.beginGroup(kSettingsGroup); s.setValue("cursor", json_response["cursor"].toVariant()); @@ -261,8 +262,9 @@ void DropboxService::FetchContentUrlFinished(QNetworkReply* reply, Song song; song.set_url(url); song.set_etag(data["rev"].toString()); - song.set_mtime(QDateTime::fromString(data["server_modified"].toString(), - Qt::ISODate).toTime_t()); + song.set_mtime( + QDateTime::fromString(data["server_modified"].toString(), Qt::ISODate) + .toTime_t()); song.set_title(info.fileName()); song.set_filesize(data["size"].toInt()); song.set_ctime(0); diff --git a/src/internet/dropbox/dropboxservice.h b/src/internet/dropbox/dropboxservice.h index 32dad38d2..e40ce7623 100644 --- a/src/internet/dropbox/dropboxservice.h +++ b/src/internet/dropbox/dropboxservice.h @@ -19,9 +19,8 @@ #ifndef INTERNET_DROPBOX_DROPBOXSERVICE_H_ #define INTERNET_DROPBOX_DROPBOXSERVICE_H_ -#include "internet/core/cloudfileservice.h" - #include "core/tagreaderclient.h" +#include "internet/core/cloudfileservice.h" class NetworkAccessManager; class OAuthenticator; @@ -40,7 +39,7 @@ class DropboxService : public CloudFileService { QUrl GetStreamingUrlFromSongId(const QUrl& url); -signals: + signals: void Connected(); public slots: diff --git a/src/internet/dropbox/dropboxsettingspage.cpp b/src/internet/dropbox/dropboxsettingspage.cpp index 603c7108f..03409756d 100644 --- a/src/internet/dropbox/dropboxsettingspage.cpp +++ b/src/internet/dropbox/dropboxsettingspage.cpp @@ -17,14 +17,14 @@ */ #include "dropboxsettingspage.h" -#include "ui_dropboxsettingspage.h" #include "core/application.h" +#include "internet/core/internetmodel.h" #include "internet/core/oauthenticator.h" #include "internet/dropbox/dropboxservice.h" -#include "internet/core/internetmodel.h" -#include "ui/settingsdialog.h" #include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_dropboxsettingspage.h" namespace { static const char* kOAuthEndpoint = @@ -34,7 +34,7 @@ static const char* kOAuthClientSecret = "pg7y68h5efap8r6"; static const char* kOAuthTokenEndpoint = "https://api.dropboxapi.com/1/oauth2/token"; static const char* kOAuthScope = ""; -} +} // namespace DropboxSettingsPage::DropboxSettingsPage(SettingsDialog* parent) : SettingsPage(parent), @@ -42,7 +42,7 @@ DropboxSettingsPage::DropboxSettingsPage(SettingsDialog* parent) service_(dialog()->app()->internet_model()->Service()) { ui_->setupUi(this); setWindowIcon(IconLoader::Load("dropbox", IconLoader::Provider)); - + ui_->login_state->AddCredentialGroup(ui_->login_container); connect(ui_->login_button, SIGNAL(clicked()), SLOT(LoginClicked())); diff --git a/src/internet/dropbox/dropboxsettingspage.h b/src/internet/dropbox/dropboxsettingspage.h index 5a6a1f225..9d8ce7178 100644 --- a/src/internet/dropbox/dropboxsettingspage.h +++ b/src/internet/dropbox/dropboxsettingspage.h @@ -19,11 +19,11 @@ #ifndef INTERNET_DROPBOX_DROPBOXSETTINGSPAGE_H_ #define INTERNET_DROPBOX_DROPBOXSETTINGSPAGE_H_ -#include "ui/settingspage.h" - #include #include +#include "ui/settingspage.h" + class DropboxService; class Ui_DropboxSettingsPage; diff --git a/src/internet/dropbox/dropboxurlhandler.h b/src/internet/dropbox/dropboxurlhandler.h index 95928b103..dd01718d7 100644 --- a/src/internet/dropbox/dropboxurlhandler.h +++ b/src/internet/dropbox/dropboxurlhandler.h @@ -27,10 +27,13 @@ class DropboxService; class DropboxUrlHandler : public UrlHandler { Q_OBJECT public: - explicit DropboxUrlHandler(DropboxService* service, QObject* parent = nullptr); + explicit DropboxUrlHandler(DropboxService* service, + QObject* parent = nullptr); QString scheme() const { return "dropbox"; } - QIcon icon() const { return IconLoader::Load("dropbox", IconLoader::Provider); } + QIcon icon() const { + return IconLoader::Load("dropbox", IconLoader::Provider); + } LoadResult StartLoading(const QUrl& url); private: diff --git a/src/internet/googledrive/googledriveclient.cpp b/src/internet/googledrive/googledriveclient.cpp index c91434ae0..33283d92e 100644 --- a/src/internet/googledrive/googledriveclient.cpp +++ b/src/internet/googledrive/googledriveclient.cpp @@ -19,17 +19,17 @@ #include "googledriveclient.h" -#include -#include +#include #include #include -#include +#include #include +#include -#include "internet/core/oauthenticator.h" #include "core/closure.h" #include "core/logging.h" #include "core/network.h" +#include "internet/core/oauthenticator.h" using namespace google_drive; @@ -211,7 +211,8 @@ void Client::ListChangesFinished(ListChangesResponse* response, QJsonParseError error; QJsonDocument document = QJsonDocument::fromJson(reply->readAll(), &error); - // TODO(John Maguire): Put this on a separate thread as the response could be large. + // TODO(John Maguire): Put this on a separate thread as the response could be + // large. if (error.error != QJsonParseError::NoError) { qLog(Error) << "Failed to fetch changes" << response->cursor(); emit response->Finished(); @@ -226,7 +227,7 @@ void Client::ListChangesFinished(ListChangesResponse* response, // Emit the FilesFound signal for the files in the response. FileList files; QList files_deleted; - for (const QJsonValue & v : json_result["items"].toArray()) { + for (const QJsonValue& v : json_result["items"].toArray()) { QJsonObject change = v.toObject(); if (change["deleted"].toBool() || change["file"].toObject()["labels"].toObject()["trashed"].toBool()) { diff --git a/src/internet/googledrive/googledriveservice.cpp b/src/internet/googledrive/googledriveservice.cpp index 00d05440f..645f137ce 100644 --- a/src/internet/googledrive/googledriveservice.cpp +++ b/src/internet/googledrive/googledriveservice.cpp @@ -34,16 +34,16 @@ #include "core/mergedproxymodel.h" #include "core/player.h" #include "core/timeconstants.h" -#include "ui/albumcovermanager.h" #include "globalsearch/globalsearch.h" #include "globalsearch/librarysearchprovider.h" -#include "library/librarybackend.h" -#include "library/librarymodel.h" -#include "playlist/playlist.h" -#include "ui/iconloader.h" #include "googledriveclient.h" #include "googledriveurlhandler.h" #include "internet/core/internetmodel.h" +#include "library/librarybackend.h" +#include "library/librarymodel.h" +#include "playlist/playlist.h" +#include "ui/albumcovermanager.h" +#include "ui/iconloader.h" const char* GoogleDriveService::kServiceName = "Google Drive"; const char* GoogleDriveService::kSettingsGroup = "GoogleDrive"; @@ -52,7 +52,7 @@ namespace { static const char* kDriveEditFileUrl = "https://docs.google.com/file/d/%1/edit"; static const char* kServiceId = "google_drive"; -} +} // namespace GoogleDriveService::GoogleDriveService(Application* app, InternetModel* parent) : CloudFileService(app, parent, kServiceName, kServiceId, @@ -217,22 +217,21 @@ void GoogleDriveService::ShowContextMenu(const QPoint& global_pos) { context_menu_.reset(new QMenu); context_menu_->addActions(GetPlaylistActions()); open_in_drive_action_ = context_menu_->addAction( - IconLoader::Load("googledrive", IconLoader::Provider), + IconLoader::Load("googledrive", IconLoader::Provider), tr("Open in Google Drive"), this, SLOT(OpenWithDrive())); context_menu_->addSeparator(); - update_action_ = context_menu_->addAction(IconLoader::Load("view-refresh", - IconLoader::Base), - tr("Check for updates"), this, - SLOT(CheckForUpdates())); + update_action_ = context_menu_->addAction( + IconLoader::Load("view-refresh", IconLoader::Base), + tr("Check for updates"), this, SLOT(CheckForUpdates())); full_rescan_action_ = context_menu_->addAction( - IconLoader::Load("view-refresh", IconLoader::Base), + IconLoader::Load("view-refresh", IconLoader::Base), tr("Do a full rescan..."), this, SLOT(ConfirmFullRescan())); context_menu_->addSeparator(); - context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), - tr("Cover Manager"), this, + context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), + tr("Cover Manager"), this, SLOT(ShowCoverManager())); - context_menu_->addAction(IconLoader::Load("configure", IconLoader::Base), - tr("Configure..."), this, + context_menu_->addAction(IconLoader::Load("configure", IconLoader::Base), + tr("Configure..."), this, SLOT(ShowSettingsDialog())); } diff --git a/src/internet/googledrive/googledriveservice.h b/src/internet/googledrive/googledriveservice.h index 6050a71c4..8cde6bb44 100644 --- a/src/internet/googledrive/googledriveservice.h +++ b/src/internet/googledrive/googledriveservice.h @@ -28,7 +28,7 @@ class ConnectResponse; class File; class ListFilesResponse; class ListChangesResponse; -} +} // namespace google_drive class GoogleDriveService : public CloudFileService { Q_OBJECT diff --git a/src/internet/googledrive/googledrivesettingspage.cpp b/src/internet/googledrive/googledrivesettingspage.cpp index 36bac70ba..45abaa2ee 100644 --- a/src/internet/googledrive/googledrivesettingspage.cpp +++ b/src/internet/googledrive/googledrivesettingspage.cpp @@ -18,16 +18,16 @@ */ #include "googledrivesettingspage.h" -#include "ui_googledrivesettingspage.h" #include +#include "core/application.h" #include "googledriveclient.h" #include "googledriveservice.h" -#include "core/application.h" #include "internet/core/internetmodel.h" -#include "ui/settingsdialog.h" #include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_googledrivesettingspage.h" GoogleDriveSettingsPage::GoogleDriveSettingsPage(SettingsDialog* parent) : SettingsPage(parent), diff --git a/src/internet/googledrive/googledrivesettingspage.h b/src/internet/googledrive/googledrivesettingspage.h index 8cd4b3871..f4e7b0196 100644 --- a/src/internet/googledrive/googledrivesettingspage.h +++ b/src/internet/googledrive/googledrivesettingspage.h @@ -20,11 +20,11 @@ #ifndef INTERNET_GOOGLEDRIVE_GOOGLEDRIVESETTINGSPAGE_H_ #define INTERNET_GOOGLEDRIVE_GOOGLEDRIVESETTINGSPAGE_H_ -#include "ui/settingspage.h" - #include #include +#include "ui/settingspage.h" + class GoogleDriveService; class Ui_GoogleDriveSettingsPage; diff --git a/src/internet/googledrive/googledriveurlhandler.h b/src/internet/googledrive/googledriveurlhandler.h index 81faedfed..77f519ea3 100644 --- a/src/internet/googledrive/googledriveurlhandler.h +++ b/src/internet/googledrive/googledriveurlhandler.h @@ -28,10 +28,13 @@ class GoogleDriveUrlHandler : public UrlHandler { Q_OBJECT public: - explicit GoogleDriveUrlHandler(GoogleDriveService* service, QObject* parent = nullptr); + explicit GoogleDriveUrlHandler(GoogleDriveService* service, + QObject* parent = nullptr); QString scheme() const { return "googledrive"; } - QIcon icon() const { return IconLoader::Load("googledrive", IconLoader::Provider); } + QIcon icon() const { + return IconLoader::Load("googledrive", IconLoader::Provider); + } LoadResult StartLoading(const QUrl& url); private: diff --git a/src/internet/icecast/icecastbackend.cpp b/src/internet/icecast/icecastbackend.cpp index 2c9f1bbe7..932781440 100644 --- a/src/internet/icecast/icecastbackend.cpp +++ b/src/internet/icecast/icecastbackend.cpp @@ -69,7 +69,8 @@ QStringList IcecastBackend::GetGenresByPopularity(const QString& filter) { "SELECT genre, COUNT(*) AS count FROM %1 " " %2" " GROUP BY genre" - " ORDER BY count DESC").arg(kTableName, where); + " ORDER BY count DESC") + .arg(kTableName, where); QSqlQuery q(db); q.prepare(sql); if (!filter.isEmpty()) { @@ -106,7 +107,8 @@ IcecastBackend::StationList IcecastBackend::GetStations(const QString& filter, QString sql = QString( "SELECT name, url, mime_type, bitrate, channels," " samplerate, genre" - " FROM %1").arg(kTableName); + " FROM %1") + .arg(kTableName); if (!where_clauses.isEmpty()) { sql += " WHERE " + where_clauses.join(" AND "); @@ -155,11 +157,11 @@ void IcecastBackend::ClearAndAddStations(const StationList& stations) { q.exec(); if (db_->CheckErrors(q)) return; - q.prepare(QString( - "INSERT INTO %1 (name, url, mime_type, bitrate," - " channels, samplerate, genre)" - " VALUES (:name, :url, :mime_type, :bitrate," - " :channels, :samplerate, :genre)").arg(kTableName)); + q.prepare(QString("INSERT INTO %1 (name, url, mime_type, bitrate," + " channels, samplerate, genre)" + " VALUES (:name, :url, :mime_type, :bitrate," + " :channels, :samplerate, :genre)") + .arg(kTableName)); // Add these ones for (const Station& station : stations) { diff --git a/src/internet/icecast/icecastbackend.h b/src/internet/icecast/icecastbackend.h index 81f619c4e..b9f45de3c 100644 --- a/src/internet/icecast/icecastbackend.h +++ b/src/internet/icecast/icecastbackend.h @@ -20,11 +20,11 @@ #ifndef INTERNET_ICECAST_ICECASTBACKEND_H_ #define INTERNET_ICECAST_ICECASTBACKEND_H_ -#include "core/song.h" - #include #include +#include "core/song.h" + class Database; class IcecastBackend : public QObject { diff --git a/src/internet/icecast/icecastfilterwidget.cpp b/src/internet/icecast/icecastfilterwidget.cpp index 6d7bbb4c3..67c059fd0 100644 --- a/src/internet/icecast/icecastfilterwidget.cpp +++ b/src/internet/icecast/icecastfilterwidget.cpp @@ -24,8 +24,8 @@ #include #include "icecastmodel.h" -#include "ui_icecastfilterwidget.h" #include "ui/iconloader.h" +#include "ui_icecastfilterwidget.h" const char* IcecastFilterWidget::kSettingsGroup = "Icecast"; diff --git a/src/internet/icecast/icecastfilterwidget.h b/src/internet/icecast/icecastfilterwidget.h index f48e16c1d..e9826944f 100644 --- a/src/internet/icecast/icecastfilterwidget.h +++ b/src/internet/icecast/icecastfilterwidget.h @@ -20,10 +20,10 @@ #ifndef INTERNET_ICECAST_ICECASTFILTERWIDGET_H_ #define INTERNET_ICECAST_ICECASTFILTERWIDGET_H_ -#include "icecastmodel.h" - #include +#include "icecastmodel.h" + class LineEditInterface; class Ui_IcecastFilterWidget; diff --git a/src/internet/icecast/icecastitem.h b/src/internet/icecast/icecastitem.h index cfb6ce65f..66e0d9ad1 100644 --- a/src/internet/icecast/icecastitem.h +++ b/src/internet/icecast/icecastitem.h @@ -20,8 +20,8 @@ #ifndef INTERNET_ICECAST_ICECASTITEM_H_ #define INTERNET_ICECAST_ICECASTITEM_H_ -#include "icecastbackend.h" #include "core/simpletreeitem.h" +#include "icecastbackend.h" class IcecastItem : public SimpleTreeItem { public: @@ -33,9 +33,9 @@ class IcecastItem : public SimpleTreeItem { }; explicit IcecastItem(SimpleTreeModel* model) - : SimpleTreeItem(Type_Root, model) {} + : SimpleTreeItem(Type_Root, model) {} explicit IcecastItem(Type type, IcecastItem* parent = nullptr) - : SimpleTreeItem(type, parent) {} + : SimpleTreeItem(type, parent) {} IcecastBackend::Station station; }; diff --git a/src/internet/icecast/icecastmodel.cpp b/src/internet/icecast/icecastmodel.cpp index 7a54c7cff..9ffe25b5e 100644 --- a/src/internet/icecast/icecastmodel.cpp +++ b/src/internet/icecast/icecastmodel.cpp @@ -18,8 +18,9 @@ along with Clementine. If not, see . */ -#include "icecastbackend.h" #include "icecastmodel.h" + +#include "icecastbackend.h" #include "playlist/songmimedata.h" #include "ui/iconloader.h" diff --git a/src/internet/icecast/icecastservice.cpp b/src/internet/icecast/icecastservice.cpp index 3dcc746e5..d6a5cc6a4 100644 --- a/src/internet/icecast/icecastservice.cpp +++ b/src/internet/icecast/icecastservice.cpp @@ -21,14 +21,13 @@ #include "internet/icecast/icecastservice.h" -#include - #include #include #include #include #include #include +#include #include "core/application.h" #include "core/closure.h" @@ -134,9 +133,10 @@ void IcecastService::DownloadDirectoryFinished(QNetworkReply* reply, QFuture future = QtConcurrent::run(this, &IcecastService::ParseDirectory, reply); - NewClosure(future, this, SLOT(ParseDirectoryFinished( - QFuture, int)), - future, task_id); + NewClosure( + future, this, + SLOT(ParseDirectoryFinished(QFuture, int)), + future, task_id); } namespace { diff --git a/src/internet/icecast/icecastservice.h b/src/internet/icecast/icecastservice.h index 0249afa4a..5004c8ade 100644 --- a/src/internet/icecast/icecastservice.h +++ b/src/internet/icecast/icecastservice.h @@ -21,12 +21,11 @@ #ifndef INTERNET_ICECAST_ICECASTSERVICE_H_ #define INTERNET_ICECAST_ICECASTSERVICE_H_ -#include "internet/core/internetservice.h" - -#include #include +#include #include "icecastbackend.h" +#include "internet/core/internetservice.h" class IcecastFilterWidget; class IcecastModel; diff --git a/src/internet/intergalacticfm/intergalacticfmservice.h b/src/internet/intergalacticfm/intergalacticfmservice.h index f5fb9db04..f6c4f62f0 100644 --- a/src/internet/intergalacticfm/intergalacticfmservice.h +++ b/src/internet/intergalacticfm/intergalacticfmservice.h @@ -22,8 +22,8 @@ #include -#include "internet/core/internetservice.h" #include "core/cachedlist.h" +#include "internet/core/internetservice.h" class IntergalacticFMUrlHandler; @@ -71,7 +71,7 @@ class IntergalacticFMServiceBase : public InternetService { bool IsStreamListStale() const { return streams_.IsStale(); } StreamList Streams(); -signals: + signals: void StreamsChanged(); private slots: diff --git a/src/internet/intergalacticfm/intergalacticfmurlhandler.cpp b/src/internet/intergalacticfm/intergalacticfmurlhandler.cpp index 3c76656fb..99dc63e48 100644 --- a/src/internet/intergalacticfm/intergalacticfmurlhandler.cpp +++ b/src/internet/intergalacticfm/intergalacticfmurlhandler.cpp @@ -25,11 +25,11 @@ #include #include -#include "internet/core/internetmodel.h" -#include "intergalacticfmservice.h" #include "core/application.h" #include "core/logging.h" #include "core/taskmanager.h" +#include "intergalacticfmservice.h" +#include "internet/core/internetmodel.h" #include "playlistparsers/playlistparser.h" IntergalacticFMUrlHandler::IntergalacticFMUrlHandler( diff --git a/src/internet/internetradio/savedradio.cpp b/src/internet/internetradio/savedradio.cpp index 122d8ce96..279e51875 100644 --- a/src/internet/internetradio/savedradio.cpp +++ b/src/internet/internetradio/savedradio.cpp @@ -22,14 +22,14 @@ #include "savedradio.h" -#include #include +#include -#include "internet/core/internetmodel.h" #include "core/application.h" #include "core/mimedata.h" #include "globalsearch/globalsearch.h" #include "globalsearch/savedradiosearchprovider.h" +#include "internet/core/internetmodel.h" #include "ui/addstreamdialog.h" #include "ui/iconloader.h" @@ -49,8 +49,9 @@ SavedRadio::SavedRadio(Application* app, InternetModel* parent) SavedRadio::~SavedRadio() { delete context_menu_; } QStandardItem* SavedRadio::CreateRootItem() { - root_ = new QStandardItem(IconLoader::Load("document-open-remote", - IconLoader::Base), tr("Your radio streams")); + root_ = new QStandardItem( + IconLoader::Load("document-open-remote", IconLoader::Base), + tr("Your radio streams")); root_->setData(true, InternetModel::Role_CanLazyLoad); return root_; } @@ -104,15 +105,15 @@ void SavedRadio::ShowContextMenu(const QPoint& global_pos) { context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); remove_action_ = context_menu_->addAction( - IconLoader::Load("list-remove", IconLoader::Base), tr("Remove"), - this, SLOT(Remove())); - edit_action_ = context_menu_->addAction(IconLoader::Load("edit-rename", - IconLoader::Base), tr("Edit..."), - this, SLOT(Edit())); + IconLoader::Load("list-remove", IconLoader::Base), tr("Remove"), this, + SLOT(Remove())); + edit_action_ = context_menu_->addAction( + IconLoader::Load("edit-rename", IconLoader::Base), tr("Edit..."), this, + SLOT(Edit())); context_menu_->addSeparator(); - context_menu_->addAction(IconLoader::Load("document-open-remote", - IconLoader::Base), tr("Add another stream..."), - this, SIGNAL(ShowAddStreamDialog())); + context_menu_->addAction( + IconLoader::Load("document-open-remote", IconLoader::Base), + tr("Add another stream..."), this, SIGNAL(ShowAddStreamDialog())); } const bool is_root = @@ -164,9 +165,8 @@ void SavedRadio::Edit() { } void SavedRadio::AddStreamToList(const Stream& stream, QStandardItem* parent) { - QStandardItem* s = - new QStandardItem(IconLoader::Load("icon_radio", IconLoader::Lastfm), - stream.name_); + QStandardItem* s = new QStandardItem( + IconLoader::Load("icon_radio", IconLoader::Lastfm), stream.name_); s->setData(stream.url_, InternetModel::Role_Url); s->setData(InternetModel::PlayBehaviour_UseSongLoader, InternetModel::Role_PlayBehaviour); diff --git a/src/internet/internetradio/savedradio.h b/src/internet/internetradio/savedradio.h index 3191918f2..9ff193f9d 100644 --- a/src/internet/internetradio/savedradio.h +++ b/src/internet/internetradio/savedradio.h @@ -42,7 +42,7 @@ class SavedRadio : public InternetService { struct Stream { explicit Stream(const QUrl& url, const QString& name = QString()) - : url_(url), name_(name) {} + : url_(url), name_(name) {} // For QList::contains bool operator==(const Stream& other) const { return url_ == other.url_; } diff --git a/src/internet/jamendo/jamendodynamicplaylist.cpp b/src/internet/jamendo/jamendodynamicplaylist.cpp index 4424a978a..33f7d947a 100644 --- a/src/internet/jamendo/jamendodynamicplaylist.cpp +++ b/src/internet/jamendo/jamendodynamicplaylist.cpp @@ -21,8 +21,8 @@ #include "jamendodynamicplaylist.h" #include -#include #include +#include #include "core/logging.h" #include "core/network.h" @@ -30,7 +30,6 @@ #include "jamendoservice.h" #include "library/librarybackend.h" - const char* JamendoDynamicPlaylist::kUrl = "http://api.jamendo.com/get2/id/track/plain/"; @@ -129,7 +128,7 @@ void JamendoDynamicPlaylist::Fetch() { // with QNetworkManager. QNetworkAccessManager network(this); QNetworkRequest req(url); - QNetworkReply *reply = network.get(req); + QNetworkReply* reply = network.get(req); // Wait for the reply { diff --git a/src/internet/jamendo/jamendoservice.cpp b/src/internet/jamendo/jamendoservice.cpp index 87765865d..37e3ecf09 100644 --- a/src/internet/jamendo/jamendoservice.cpp +++ b/src/internet/jamendo/jamendoservice.cpp @@ -28,13 +28,9 @@ #include #include #include -#include #include -#include "qtiocompressor.h" +#include -#include "jamendodynamicplaylist.h" -#include "jamendoplaylistitem.h" -#include "internet/core/internetmodel.h" #include "core/application.h" #include "core/database.h" #include "core/logging.h" @@ -45,9 +41,13 @@ #include "core/timeconstants.h" #include "globalsearch/globalsearch.h" #include "globalsearch/librarysearchprovider.h" +#include "internet/core/internetmodel.h" +#include "jamendodynamicplaylist.h" +#include "jamendoplaylistitem.h" #include "library/librarybackend.h" #include "library/libraryfilterwidget.h" #include "library/librarymodel.h" +#include "qtiocompressor.h" #include "smartplaylists/generator.h" #include "smartplaylists/querygenerator.h" #include "ui/iconloader.h" @@ -287,7 +287,7 @@ void JamendoService::InsertTrackIds(const TrackIdList& ids) const { QSqlQuery insert(db); insert.prepare(QString("INSERT INTO %1 (%2) VALUES (:id)") - .arg(kTrackIdsTable, kTrackIdsColumn)); + .arg(kTrackIdsTable, kTrackIdsColumn)); for (int id : ids) { insert.bindValue(":id", id); diff --git a/src/internet/jamendo/jamendoservice.h b/src/internet/jamendo/jamendoservice.h index 72c65b1e6..99da054a8 100644 --- a/src/internet/jamendo/jamendoservice.h +++ b/src/internet/jamendo/jamendoservice.h @@ -22,11 +22,10 @@ #ifndef INTERNET_JAMENDO_JAMENDOSERVICE_H_ #define INTERNET_JAMENDO_JAMENDOSERVICE_H_ -#include "internet/core/internetservice.h" - #include #include "core/song.h" +#include "internet/core/internetservice.h" class LibraryBackend; class LibraryFilterWidget; diff --git a/src/internet/lastfm/fixlastfm.h b/src/internet/lastfm/fixlastfm.h index 6fb9fbe0e..eac4db02c 100644 --- a/src/internet/lastfm/fixlastfm.h +++ b/src/internet/lastfm/fixlastfm.h @@ -23,8 +23,8 @@ // Include this before to fix a compile error in release mode #ifdef QT_NO_DEBUG_OUTPUT -#include #include +#include // Stub this out so lastfm/Track still compiles QDebug& operator<<(QDebug&, const QUrl&); #endif diff --git a/src/internet/lastfm/lastfmcompat.cpp b/src/internet/lastfm/lastfmcompat.cpp index 2a06c59b8..02b2dc424 100644 --- a/src/internet/lastfm/lastfmcompat.cpp +++ b/src/internet/lastfm/lastfmcompat.cpp @@ -18,6 +18,7 @@ */ #include "lastfmcompat.h" + #include "core/logging.h" namespace lastfm { @@ -32,9 +33,8 @@ bool ParseQuery(const QByteArray& data, XmlQuery* query, const bool ret = query->parse(data); if (connection_problems) { - *connection_problems = - !ret && - query->parseError().enumValue() == lastfm::ws::MalformedResponse; + *connection_problems = !ret && query->parseError().enumValue() == + lastfm::ws::MalformedResponse; } return ret; diff --git a/src/internet/lastfm/lastfmcompat.h b/src/internet/lastfm/lastfmcompat.h index c0681869f..1553d6587 100644 --- a/src/internet/lastfm/lastfmcompat.h +++ b/src/internet/lastfm/lastfmcompat.h @@ -25,19 +25,20 @@ #ifdef HAVE_LIBLASTFM1 #include -#include #include #include #include -#include #include -#else -#include #include +#include +#else +#include +#include + +#include #include #include #include -#include #include #endif diff --git a/src/internet/lastfm/lastfmservice.cpp b/src/internet/lastfm/lastfmservice.cpp index 414443e4d..523647383 100644 --- a/src/internet/lastfm/lastfmservice.cpp +++ b/src/internet/lastfm/lastfmservice.cpp @@ -30,16 +30,15 @@ #include #undef QT_USE_QSTRINGBUILDER -#include "lastfmservice.h" - -#include - #include #include #include #include #include #include +#include + +#include "lastfmservice.h" #ifdef HAVE_LIBLASTFM1 #include @@ -47,7 +46,6 @@ #include #endif -#include "lastfmcompat.h" #include "core/application.h" #include "core/closure.h" #include "core/logging.h" @@ -55,11 +53,12 @@ #include "core/player.h" #include "core/song.h" #include "core/taskmanager.h" +#include "covers/coverproviders.h" +#include "covers/lastfmcoverprovider.h" #include "internet/core/internetmodel.h" #include "internet/core/internetplaylistitem.h" #include "internet/core/localredirectserver.h" -#include "covers/coverproviders.h" -#include "covers/lastfmcoverprovider.h" +#include "lastfmcompat.h" #include "ui/iconloader.h" #include "ui/settingsdialog.h" @@ -140,7 +139,8 @@ QByteArray SignApiRequest(QList> params) { to_sign += p.second; } to_sign += LastFMService::kSecret; - return QCryptographicHash::hash(to_sign.toUtf8(), QCryptographicHash::Md5).toHex(); + return QCryptographicHash::hash(to_sign.toUtf8(), QCryptographicHash::Md5) + .toHex(); } } // namespace @@ -166,15 +166,21 @@ void LastFMService::Authenticate() { session_url_query.addQueryItem("api_key", kApiKey); session_url_query.addQueryItem("method", "auth.getSession"); session_url_query.addQueryItem("token", token); - session_url_query.addQueryItem("api_sig", SignApiRequest(session_url_query.queryItems())); + session_url_query.addQueryItem( + "api_sig", SignApiRequest(session_url_query.queryItems())); session_url.setQuery(session_url_query); QNetworkReply* reply = network_->get(QNetworkRequest(session_url)); - NewClosure(reply, SIGNAL(finished()), this, SLOT(AuthenticateReplyFinished(QNetworkReply*)), reply); + NewClosure(reply, SIGNAL(finished()), this, + SLOT(AuthenticateReplyFinished(QNetworkReply*)), reply); }); if (!QDesktopServices::openUrl(url)) { - QMessageBox box(QMessageBox::NoIcon, tr("Last.fm Authentication"), tr("Please open this URL in your browser: %1").arg(url.toString()), QMessageBox::Ok); + QMessageBox box( + QMessageBox::NoIcon, tr("Last.fm Authentication"), + tr("Please open this URL in your browser: %1") + .arg(url.toString()), + QMessageBox::Ok); box.setTextFormat(Qt::RichText); qLog(Debug) << "Last.fm authentication URL: " << url.toString(); box.exec(); diff --git a/src/internet/lastfm/lastfmservice.h b/src/internet/lastfm/lastfmservice.h index 2d526fc71..520087a22 100644 --- a/src/internet/lastfm/lastfmservice.h +++ b/src/internet/lastfm/lastfmservice.h @@ -32,9 +32,8 @@ class Track; #include uint qHash(const lastfm::Track& track); -#include "lastfmcompat.h" - #include "internet/core/scrobbler.h" +#include "lastfmcompat.h" class Application; class LastFMUrlHandler; @@ -82,7 +81,7 @@ class LastFMService : public Scrobbler { void ShowConfig(); void ToggleScrobbling(); -signals: + signals: void AuthenticationComplete(bool success); void ScrobblingEnabledChanged(bool value); void ButtonVisibilityChanged(bool value); diff --git a/src/internet/lastfm/lastfmsettingspage.cpp b/src/internet/lastfm/lastfmsettingspage.cpp index e01757721..a8a9c2e97 100644 --- a/src/internet/lastfm/lastfmsettingspage.cpp +++ b/src/internet/lastfm/lastfmsettingspage.cpp @@ -20,7 +20,6 @@ */ #include "lastfmsettingspage.h" -#include "ui_lastfmsettingspage.h" #include @@ -28,10 +27,11 @@ #include #include -#include "lastfmservice.h" -#include "internet/core/internetmodel.h" #include "core/application.h" +#include "internet/core/internetmodel.h" +#include "lastfmservice.h" #include "ui/iconloader.h" +#include "ui_lastfmsettingspage.h" LastFMSettingsPage::LastFMSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), diff --git a/src/internet/magnatune/magnatunedownloaddialog.cpp b/src/internet/magnatune/magnatunedownloaddialog.cpp index d112bd811..7cde3bc4c 100644 --- a/src/internet/magnatune/magnatunedownloaddialog.cpp +++ b/src/internet/magnatune/magnatunedownloaddialog.cpp @@ -19,8 +19,6 @@ #include "magnatunedownloaddialog.h" -#include - #include #include #include @@ -30,16 +28,17 @@ #include #include #include -#include #include +#include +#include -#include "magnatuneservice.h" -#include "internet/core/internetmodel.h" -#include "ui_magnatunedownloaddialog.h" #include "core/logging.h" #include "core/network.h" #include "core/utilities.h" +#include "internet/core/internetmodel.h" +#include "magnatuneservice.h" #include "ui/iconloader.h" +#include "ui_magnatunedownloaddialog.h" #include "widgets/progressitemdelegate.h" MagnatuneDownloadDialog::MagnatuneDownloadDialog(MagnatuneService* service, @@ -153,8 +152,9 @@ void MagnatuneDownloadDialog::Error(QNetworkReply::NetworkError e) { QMetaEnum error_enum = QNetworkReply::staticMetaObject.enumerator( QNetworkReply::staticMetaObject.indexOfEnumerator("NetworkError")); - QString message = tr("Unable to download %1 (%2)").arg(url.toString()).arg( - error_enum.valueToKey(e)); + QString message = tr("Unable to download %1 (%2)") + .arg(url.toString()) + .arg(error_enum.valueToKey(e)); ShowError(message); } diff --git a/src/internet/magnatune/magnatunedownloaddialog.h b/src/internet/magnatune/magnatunedownloaddialog.h index dc4a5f9ff..f97dfb290 100644 --- a/src/internet/magnatune/magnatunedownloaddialog.h +++ b/src/internet/magnatune/magnatunedownloaddialog.h @@ -20,11 +20,10 @@ #ifndef INTERNET_MAGNATUNE_MAGNATUNEDOWNLOADDIALOG_H_ #define INTERNET_MAGNATUNE_MAGNATUNEDOWNLOADDIALOG_H_ -#include - #include #include #include +#include #include "core/song.h" @@ -38,7 +37,8 @@ class MagnatuneDownloadDialog : public QDialog { Q_OBJECT public: - explicit MagnatuneDownloadDialog(MagnatuneService* service, QWidget* parent = nullptr); + explicit MagnatuneDownloadDialog(MagnatuneService* service, + QWidget* parent = nullptr); ~MagnatuneDownloadDialog(); void Show(const SongList& songs); diff --git a/src/internet/magnatune/magnatuneplaylistitem.cpp b/src/internet/magnatune/magnatuneplaylistitem.cpp index 03856cf46..571d49e71 100644 --- a/src/internet/magnatune/magnatuneplaylistitem.cpp +++ b/src/internet/magnatune/magnatuneplaylistitem.cpp @@ -18,6 +18,7 @@ */ #include "magnatuneplaylistitem.h" + #include "internet/core/internetmodel.h" MagnatunePlaylistItem::MagnatunePlaylistItem(const QString& type) diff --git a/src/internet/magnatune/magnatuneservice.cpp b/src/internet/magnatune/magnatuneservice.cpp index 6237ace08..3d7c24064 100644 --- a/src/internet/magnatune/magnatuneservice.cpp +++ b/src/internet/magnatune/magnatuneservice.cpp @@ -23,25 +23,17 @@ #include "magnatuneservice.h" -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include #include - +#include +#include #include -#include "qtiocompressor.h" - - -#include "magnatunedownloaddialog.h" -#include "magnatuneplaylistitem.h" -#include "magnatuneurlhandler.h" -#include "internet/core/internetmodel.h" #include "core/application.h" #include "core/database.h" #include "core/logging.h" @@ -53,9 +45,14 @@ #include "core/timeconstants.h" #include "globalsearch/globalsearch.h" #include "globalsearch/librarysearchprovider.h" -#include "library/librarymodel.h" +#include "internet/core/internetmodel.h" #include "library/librarybackend.h" #include "library/libraryfilterwidget.h" +#include "library/librarymodel.h" +#include "magnatunedownloaddialog.h" +#include "magnatuneplaylistitem.h" +#include "magnatuneurlhandler.h" +#include "qtiocompressor.h" #include "ui/iconloader.h" #include "ui/settingsdialog.h" @@ -123,7 +120,7 @@ void MagnatuneService::ReloadSettings() { } QStandardItem* MagnatuneService::CreateRootItem() { - root_ = new QStandardItem(IconLoader::Load("magnatune", IconLoader::Provider), + root_ = new QStandardItem(IconLoader::Load("magnatune", IconLoader::Provider), kServiceName); root_->setData(true, InternetModel::Role_CanLazyLoad); return root_; @@ -247,7 +244,8 @@ Song MagnatuneService::ReadTrack(QXmlStreamReader& reader) { return song; } -// TODO(David Sansome): Replace with readElementText(SkipChildElements) in Qt 4.6 +// TODO(David Sansome): Replace with readElementText(SkipChildElements) in +// Qt 4.6 QString MagnatuneService::ReadElementText(QXmlStreamReader& reader) { int level = 1; QString ret; @@ -277,10 +275,9 @@ void MagnatuneService::EnsureMenuCreated() { context_menu_ = new QMenu; context_menu_->addActions(GetPlaylistActions()); - download_ = context_menu_->addAction(IconLoader::Load("download", - IconLoader::Base), - tr("Download this album"), this, - SLOT(Download())); + download_ = context_menu_->addAction( + IconLoader::Load("download", IconLoader::Base), tr("Download this album"), + this, SLOT(Download())); context_menu_->addSeparator(); context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), tr("Open %1 in browser").arg("magnatune.com"), this, @@ -289,8 +286,8 @@ void MagnatuneService::EnsureMenuCreated() { tr("Refresh catalogue"), this, SLOT(ReloadDatabase())); QAction* config_action = context_menu_->addAction( - IconLoader::Load("configure", IconLoader::Base), tr("Configure Magnatune..."), - this, SLOT(ShowConfig())); + IconLoader::Load("configure", IconLoader::Base), + tr("Configure Magnatune..."), this, SLOT(ShowConfig())); library_filter_ = new LibraryFilterWidget(0); library_filter_->SetSettingsGroup(kSettingsGroup); diff --git a/src/internet/magnatune/magnatuneservice.h b/src/internet/magnatune/magnatuneservice.h index 21a730a6b..33fbafdd3 100644 --- a/src/internet/magnatune/magnatuneservice.h +++ b/src/internet/magnatune/magnatuneservice.h @@ -20,9 +20,8 @@ #ifndef INTERNET_MAGNATUNE_MAGNATUNESERVICE_H_ #define INTERNET_MAGNATUNE_MAGNATUNESERVICE_H_ -#include - #include +#include #include "internet/core/internetservice.h" diff --git a/src/internet/magnatune/magnatunesettingspage.cpp b/src/internet/magnatune/magnatunesettingspage.cpp index 470404080..5ec20db63 100644 --- a/src/internet/magnatune/magnatunesettingspage.cpp +++ b/src/internet/magnatune/magnatunesettingspage.cpp @@ -28,10 +28,10 @@ #include #include "core/network.h" -#include "magnatuneservice.h" #include "internet/core/internetmodel.h" -#include "ui_magnatunesettingspage.h" +#include "magnatuneservice.h" #include "ui/iconloader.h" +#include "ui_magnatunesettingspage.h" MagnatuneSettingsPage::MagnatuneSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), @@ -140,9 +140,9 @@ void MagnatuneSettingsPage::Load() { ui_->password->setText(s.value("password").toString()); ui_->format->setCurrentIndex( s.value("format", MagnatuneService::Format_Ogg).toInt()); - logged_in_ = - s.value("logged_in", !ui_->username->text().isEmpty() && - !ui_->password->text().isEmpty()).toBool(); + logged_in_ = s.value("logged_in", !ui_->username->text().isEmpty() && + !ui_->password->text().isEmpty()) + .toBool(); UpdateLoginState(); } diff --git a/src/internet/magnatune/magnatuneurlhandler.cpp b/src/internet/magnatune/magnatuneurlhandler.cpp index f281ecb38..1d19f7d94 100644 --- a/src/internet/magnatune/magnatuneurlhandler.cpp +++ b/src/internet/magnatune/magnatuneurlhandler.cpp @@ -17,9 +17,10 @@ along with Clementine. If not, see . */ -#include "magnatuneservice.h" #include "magnatuneurlhandler.h" +#include "magnatuneservice.h" + MagnatuneUrlHandler::MagnatuneUrlHandler(MagnatuneService* service, QObject* parent) : UrlHandler(parent), service_(service) {} diff --git a/src/internet/magnatune/magnatuneurlhandler.h b/src/internet/magnatune/magnatuneurlhandler.h index 47eab5a6c..c7fcb5707 100644 --- a/src/internet/magnatune/magnatuneurlhandler.h +++ b/src/internet/magnatune/magnatuneurlhandler.h @@ -30,7 +30,9 @@ class MagnatuneUrlHandler : public UrlHandler { MagnatuneUrlHandler(MagnatuneService* service, QObject* parent); QString scheme() const { return "magnatune"; } - QIcon icon() const { return IconLoader::Load("magnatune", IconLoader::Provider); } + QIcon icon() const { + return IconLoader::Load("magnatune", IconLoader::Provider); + } LoadResult StartLoading(const QUrl& url); private: diff --git a/src/internet/podcasts/addpodcastbyurl.cpp b/src/internet/podcasts/addpodcastbyurl.cpp index 131ed65d6..29ff1db32 100644 --- a/src/internet/podcasts/addpodcastbyurl.cpp +++ b/src/internet/podcasts/addpodcastbyurl.cpp @@ -20,14 +20,14 @@ #include "addpodcastbyurl.h" #include -#include #include +#include +#include "core/closure.h" #include "podcastdiscoverymodel.h" #include "podcasturlloader.h" -#include "ui_addpodcastbyurl.h" -#include "core/closure.h" #include "ui/iconloader.h" +#include "ui_addpodcastbyurl.h" AddPodcastByUrl::AddPodcastByUrl(Application* app, QWidget* parent) : AddPodcastPage(app, parent), diff --git a/src/internet/podcasts/addpodcastdialog.cpp b/src/internet/podcasts/addpodcastdialog.cpp index e5e428612..a07dc60f4 100644 --- a/src/internet/podcasts/addpodcastdialog.cpp +++ b/src/internet/podcasts/addpodcastdialog.cpp @@ -24,22 +24,21 @@ #include #include "addpodcastbyurl.h" +#include "core/application.h" #include "fixedopmlpage.h" #include "gpoddersearchpage.h" #include "gpoddertoptagspage.h" #include "itunessearchpage.h" #include "podcastbackend.h" #include "podcastdiscoverymodel.h" -#include "ui_addpodcastdialog.h" -#include "core/application.h" #include "ui/iconloader.h" +#include "ui_addpodcastdialog.h" #include "widgets/widgetfadehelper.h" const char* AddPodcastDialog::kBbcOpmlUrl = "http://www.bbc.co.uk/podcasts.opml"; -const char* AddPodcastDialog::kCbcOpmlUrl = - "http://cbc.ca/podcasts.opml"; +const char* AddPodcastDialog::kCbcOpmlUrl = "http://cbc.ca/podcasts.opml"; AddPodcastDialog::AddPodcastDialog(Application* app, QWidget* parent) : QDialog(parent), @@ -61,30 +60,29 @@ AddPodcastDialog::AddPodcastDialog(Application* app, QWidget* parent) SLOT(PodcastDoubleClicked(QModelIndex))); // Create Add and Remove Podcast buttons - add_button_ = - new QPushButton(IconLoader::Load("list-add", IconLoader::Base), - tr("Add Podcast"), this); + add_button_ = new QPushButton(IconLoader::Load("list-add", IconLoader::Base), + tr("Add Podcast"), this); add_button_->setEnabled(false); connect(add_button_, SIGNAL(clicked()), SLOT(AddPodcast())); ui_->button_box->addButton(add_button_, QDialogButtonBox::ActionRole); remove_button_ = - new QPushButton(IconLoader::Load("list-remove", IconLoader::Base), - tr("Unsubscribe"), this); + new QPushButton(IconLoader::Load("list-remove", IconLoader::Base), + tr("Unsubscribe"), this); remove_button_->setEnabled(false); connect(remove_button_, SIGNAL(clicked()), SLOT(RemovePodcast())); ui_->button_box->addButton(remove_button_, QDialogButtonBox::ActionRole); - QPushButton* settings_button = new QPushButton( - IconLoader::Load("configure", IconLoader::Base), - tr("Configure podcasts..."), this); + QPushButton* settings_button = + new QPushButton(IconLoader::Load("configure", IconLoader::Base), + tr("Configure podcasts..."), this); connect(settings_button, SIGNAL(clicked()), SLOT(OpenSettingsPage())); ui_->button_box->addButton(settings_button, QDialogButtonBox::ResetRole); // Create an Open OPML file button - QPushButton* open_opml_button = new QPushButton( - IconLoader::Load("document-open", IconLoader::Base), - tr("Open OPML file..."), this); + QPushButton* open_opml_button = + new QPushButton(IconLoader::Load("document-open", IconLoader::Base), + tr("Open OPML file..."), this); connect(open_opml_button, SIGNAL(clicked()), this, SLOT(OpenOPMLFile())); ui_->button_box->addButton(open_opml_button, QDialogButtonBox::ResetRole); @@ -92,11 +90,11 @@ AddPodcastDialog::AddPodcastDialog(Application* app, QWidget* parent) by_url_page_ = new AddPodcastByUrl(app, this); AddPage(by_url_page_); AddPage(new FixedOpmlPage(QUrl(kBbcOpmlUrl), tr("BBC Podcasts"), - IconLoader::Load("bbc", IconLoader::Provider), - app, this)); + IconLoader::Load("bbc", IconLoader::Provider), app, + this)); AddPage(new FixedOpmlPage(QUrl(kCbcOpmlUrl), tr("CBC Podcasts"), - IconLoader::Load("cbc", IconLoader::Provider), - app, this)); + IconLoader::Load("cbc", IconLoader::Provider), app, + this)); AddPage(new GPodderTopTagsPage(app, this)); AddPage(new GPodderSearchPage(app, this)); AddPage(new ITunesSearchPage(app, this)); diff --git a/src/internet/podcasts/addpodcastdialog.h b/src/internet/podcasts/addpodcastdialog.h index bd92ab574..02d8b022d 100644 --- a/src/internet/podcasts/addpodcastdialog.h +++ b/src/internet/podcasts/addpodcastdialog.h @@ -20,10 +20,10 @@ #ifndef INTERNET_PODCASTS_ADDPODCASTDIALOG_H_ #define INTERNET_PODCASTS_ADDPODCASTDIALOG_H_ -#include "podcast.h" - #include +#include "podcast.h" + class AddPodcastByUrl; class AddPodcastPage; class Application; diff --git a/src/internet/podcasts/addpodcastpage.cpp b/src/internet/podcasts/addpodcastpage.cpp index 5cb3b02df..a3d889028 100644 --- a/src/internet/podcasts/addpodcastpage.cpp +++ b/src/internet/podcasts/addpodcastpage.cpp @@ -18,6 +18,7 @@ */ #include "addpodcastpage.h" + #include "podcastdiscoverymodel.h" AddPodcastPage::AddPodcastPage(Application* app, QWidget* parent) diff --git a/src/internet/podcasts/episodeinfowidget.cpp b/src/internet/podcasts/episodeinfowidget.cpp index 7cf8bde12..67c1af85b 100644 --- a/src/internet/podcasts/episodeinfowidget.cpp +++ b/src/internet/podcasts/episodeinfowidget.cpp @@ -15,12 +15,13 @@ along with Clementine. If not, see . */ -#include "core/utilities.h" #include "episodeinfowidget.h" -#include "ui_episodeinfowidget.h" #include +#include "core/utilities.h" +#include "ui_episodeinfowidget.h" + EpisodeInfoWidget::EpisodeInfoWidget(QWidget* parent) : QWidget(parent), ui_(new Ui_EpisodeInfoWidget), app_(nullptr) { ui_->setupUi(this); diff --git a/src/internet/podcasts/episodeinfowidget.h b/src/internet/podcasts/episodeinfowidget.h index b228ad4ec..1ec51693d 100644 --- a/src/internet/podcasts/episodeinfowidget.h +++ b/src/internet/podcasts/episodeinfowidget.h @@ -18,10 +18,10 @@ #ifndef INTERNET_PODCASTS_EPISODEINFOWIDGET_H_ #define INTERNET_PODCASTS_EPISODEINFOWIDGET_H_ -#include "podcastepisode.h" - #include +#include "podcastepisode.h" + class Application; class Ui_EpisodeInfoWidget; diff --git a/src/internet/podcasts/fixedopmlpage.cpp b/src/internet/podcasts/fixedopmlpage.cpp index 66802b7c2..a6c0ff39a 100644 --- a/src/internet/podcasts/fixedopmlpage.cpp +++ b/src/internet/podcasts/fixedopmlpage.cpp @@ -21,9 +21,9 @@ #include +#include "core/closure.h" #include "podcastdiscoverymodel.h" #include "podcasturlloader.h" -#include "core/closure.h" FixedOpmlPage::FixedOpmlPage(const QUrl& opml_url, const QString& title, const QIcon& icon, Application* app, diff --git a/src/internet/podcasts/fixedopmlpage.h b/src/internet/podcasts/fixedopmlpage.h index 6c8ec24ec..be531d7c1 100644 --- a/src/internet/podcasts/fixedopmlpage.h +++ b/src/internet/podcasts/fixedopmlpage.h @@ -20,10 +20,10 @@ #ifndef INTERNET_PODCASTS_FIXEDOPMLPAGE_H_ #define INTERNET_PODCASTS_FIXEDOPMLPAGE_H_ -#include "addpodcastpage.h" - #include +#include "addpodcastpage.h" + class PodcastUrlLoader; class PodcastUrlLoaderReply; diff --git a/src/internet/podcasts/gpoddersearchpage.cpp b/src/internet/podcasts/gpoddersearchpage.cpp index 5f453c056..95dc88385 100644 --- a/src/internet/podcasts/gpoddersearchpage.cpp +++ b/src/internet/podcasts/gpoddersearchpage.cpp @@ -21,12 +21,12 @@ #include -#include "podcast.h" -#include "podcastdiscoverymodel.h" -#include "ui_gpoddersearchpage.h" #include "core/closure.h" #include "core/network.h" +#include "podcast.h" +#include "podcastdiscoverymodel.h" #include "ui/iconloader.h" +#include "ui_gpoddersearchpage.h" GPodderSearchPage::GPodderSearchPage(Application* app, QWidget* parent) : AddPodcastPage(app, parent), diff --git a/src/internet/podcasts/gpoddersearchpage.h b/src/internet/podcasts/gpoddersearchpage.h index 1e2d2a773..6f7a9e6ff 100644 --- a/src/internet/podcasts/gpoddersearchpage.h +++ b/src/internet/podcasts/gpoddersearchpage.h @@ -20,10 +20,10 @@ #ifndef INTERNET_PODCASTS_GPODDERSEARCHPAGE_H_ #define INTERNET_PODCASTS_GPODDERSEARCHPAGE_H_ -#include "addpodcastpage.h" - #include +#include "addpodcastpage.h" + class QNetworkAccessManager; class Ui_GPodderSearchPage; diff --git a/src/internet/podcasts/gpoddersync.cpp b/src/internet/podcasts/gpoddersync.cpp index 79730d7fe..d345c3a7f 100644 --- a/src/internet/podcasts/gpoddersync.cpp +++ b/src/internet/podcasts/gpoddersync.cpp @@ -26,19 +26,19 @@ #include #include -#include "podcastbackend.h" -#include "podcasturlloader.h" #include "core/application.h" #include "core/closure.h" #include "core/logging.h" #include "core/network.h" #include "core/timeconstants.h" #include "core/utilities.h" +#include "podcastbackend.h" +#include "podcasturlloader.h" const char* GPodderSync::kSettingsGroup = "Podcasts"; const int GPodderSync::kFlushUpdateQueueDelay = 30 * kMsecPerSec; // 30 seconds const int GPodderSync::kGetUpdatesInterval = - 30 * 60 * kMsecPerSec; // 30 minutes + 30 * 60 * kMsecPerSec; // 30 minutes const int GPodderSync::kRequestTimeout = 30 * kMsecPerSec; // 30 seconds GPodderSync::GPodderSync(Application* app, QObject* parent) diff --git a/src/internet/podcasts/gpoddersync.h b/src/internet/podcasts/gpoddersync.h index b81595450..d5bfdfd9b 100644 --- a/src/internet/podcasts/gpoddersync.h +++ b/src/internet/podcasts/gpoddersync.h @@ -20,7 +20,7 @@ #ifndef INTERNET_PODCASTS_GPODDERSYNC_H_ #define INTERNET_PODCASTS_GPODDERSYNC_H_ -#include "podcastepisode.h" +#include #include #include @@ -29,7 +29,7 @@ #include #include -#include +#include "podcastepisode.h" class Application; class Podcast; diff --git a/src/internet/podcasts/gpoddertoptagsmodel.cpp b/src/internet/podcasts/gpoddertoptagsmodel.cpp index 6fc4b7139..de730d801 100644 --- a/src/internet/podcasts/gpoddertoptagsmodel.cpp +++ b/src/internet/podcasts/gpoddertoptagsmodel.cpp @@ -20,11 +20,12 @@ #include "gpoddertoptagsmodel.h" #include + #include +#include "core/closure.h" #include "gpoddertoptagspage.h" #include "podcast.h" -#include "core/closure.h" GPodderTopTagsModel::GPodderTopTagsModel(mygpo::ApiRequest* api, Application* app, QObject* parent) diff --git a/src/internet/podcasts/gpoddertoptagsmodel.h b/src/internet/podcasts/gpoddertoptagsmodel.h index 8a1907fa9..e1246bc9d 100644 --- a/src/internet/podcasts/gpoddertoptagsmodel.h +++ b/src/internet/podcasts/gpoddertoptagsmodel.h @@ -25,7 +25,7 @@ namespace mygpo { class ApiRequest; class PodcastList; -} +} // namespace mygpo class GPodderTopTagsModel : public PodcastDiscoveryModel { Q_OBJECT diff --git a/src/internet/podcasts/gpoddertoptagspage.cpp b/src/internet/podcasts/gpoddertoptagspage.cpp index 506a46d37..fb834dc07 100644 --- a/src/internet/podcasts/gpoddertoptagspage.cpp +++ b/src/internet/podcasts/gpoddertoptagspage.cpp @@ -21,9 +21,9 @@ #include -#include "gpoddertoptagsmodel.h" #include "core/closure.h" #include "core/network.h" +#include "gpoddertoptagsmodel.h" #include "ui/iconloader.h" const int GPodderTopTagsPage::kMaxTagCount = 100; diff --git a/src/internet/podcasts/gpoddertoptagspage.h b/src/internet/podcasts/gpoddertoptagspage.h index 9248cdb94..d4990d0d9 100644 --- a/src/internet/podcasts/gpoddertoptagspage.h +++ b/src/internet/podcasts/gpoddertoptagspage.h @@ -20,10 +20,10 @@ #ifndef INTERNET_PODCASTS_GPODDERTOPTAGSPAGE_H_ #define INTERNET_PODCASTS_GPODDERTOPTAGSPAGE_H_ -#include - #include +#include + #include "addpodcastpage.h" class QNetworkAccessManager; diff --git a/src/internet/podcasts/itunessearchpage.cpp b/src/internet/podcasts/itunessearchpage.cpp index ef4ab5573..b8d39604e 100644 --- a/src/internet/podcasts/itunessearchpage.cpp +++ b/src/internet/podcasts/itunessearchpage.cpp @@ -19,20 +19,20 @@ #include "itunessearchpage.h" -#include -#include -#include +#include #include #include #include -#include +#include +#include +#include #include "core/closure.h" #include "core/network.h" #include "podcast.h" #include "podcastdiscoverymodel.h" -#include "ui_itunessearchpage.h" #include "ui/iconloader.h" +#include "ui_itunessearchpage.h" const char* ITunesSearchPage::kUrlBase = "http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/" @@ -76,7 +76,8 @@ void ITunesSearchPage::SearchFinished(QNetworkReply* reply) { } QJsonParseError error; - QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll(), &error); + QJsonDocument json_document = + QJsonDocument::fromJson(reply->readAll(), &error); if (error.error != QJsonParseError::NoError) { QMessageBox::warning( diff --git a/src/internet/podcasts/podcast.cpp b/src/internet/podcasts/podcast.cpp index bae36f761..1cb80f7c7 100644 --- a/src/internet/podcasts/podcast.cpp +++ b/src/internet/podcasts/podcast.cpp @@ -19,9 +19,10 @@ #include "podcast.h" +#include + #include #include -#include #include "core/utilities.h" diff --git a/src/internet/podcasts/podcast.h b/src/internet/podcasts/podcast.h index 1a9c066ed..32b02841f 100644 --- a/src/internet/podcasts/podcast.h +++ b/src/internet/podcasts/podcast.h @@ -20,13 +20,13 @@ #ifndef INTERNET_PODCASTS_PODCAST_H_ #define INTERNET_PODCASTS_PODCAST_H_ -#include "podcastepisode.h" - #include #include #include #include +#include "podcastepisode.h" + namespace mygpo { class Podcast; } diff --git a/src/internet/podcasts/podcastbackend.cpp b/src/internet/podcasts/podcastbackend.cpp index e43c603d4..e9c00d35a 100644 --- a/src/internet/podcasts/podcastbackend.cpp +++ b/src/internet/podcasts/podcastbackend.cpp @@ -49,9 +49,9 @@ void PodcastBackend::Subscribe(Podcast* podcast) { // Insert the podcast. QSqlQuery q(db); q.prepare("INSERT INTO podcasts (" + Podcast::kColumnSpec + - ")" - " VALUES (" + - Podcast::kBindSpec + ")"); + ")" + " VALUES (" + + Podcast::kBindSpec + ")"); podcast->BindToQuery(&q); q.exec(); @@ -107,9 +107,9 @@ void PodcastBackend::AddEpisodes(PodcastEpisodeList* episodes, QSqlDatabase* db) { QSqlQuery q(*db); q.prepare("INSERT INTO podcast_episodes (" + PodcastEpisode::kColumnSpec + - ")" - " VALUES (" + - PodcastEpisode::kBindSpec + ")"); + ")" + " VALUES (" + + PodcastEpisode::kBindSpec + ")"); for (auto it = episodes->begin(); it != episodes->end(); ++it) { it->BindToQuery(&q); @@ -138,7 +138,8 @@ void PodcastBackend::UpdateEpisodes(const PodcastEpisodeList& episodes) { ScopedTransaction t(&db); QSqlQuery q(db); - q.prepare("UPDATE podcast_episodes" + q.prepare( + "UPDATE podcast_episodes" " SET listened = :listened," " listened_date = :listened_date," " downloaded = :downloaded," @@ -188,8 +189,8 @@ Podcast PodcastBackend::GetSubscriptionById(int id) { QSqlQuery q(db); q.prepare("SELECT ROWID, " + Podcast::kColumnSpec + - " FROM podcasts" - " WHERE ROWID = :id"); + " FROM podcasts" + " WHERE ROWID = :id"); q.bindValue(":id", id); q.exec(); if (!db_->CheckErrors(q) && q.next()) { @@ -207,8 +208,8 @@ Podcast PodcastBackend::GetSubscriptionByUrl(const QUrl& url) { QSqlQuery q(db); q.prepare("SELECT ROWID, " + Podcast::kColumnSpec + - " FROM podcasts" - " WHERE url = :url"); + " FROM podcasts" + " WHERE url = :url"); q.bindValue(":url", url.toEncoded()); q.exec(); if (!db_->CheckErrors(q) && q.next()) { @@ -226,9 +227,9 @@ PodcastEpisodeList PodcastBackend::GetEpisodes(int podcast_id) { QSqlQuery q(db); q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + - " FROM podcast_episodes" - " WHERE podcast_id = :id" - " ORDER BY publication_date DESC"); + " FROM podcast_episodes" + " WHERE podcast_id = :id" + " ORDER BY publication_date DESC"); q.bindValue(":id", podcast_id); q.exec(); if (db_->CheckErrors(q)) return ret; @@ -250,8 +251,8 @@ PodcastEpisode PodcastBackend::GetEpisodeById(int id) { QSqlQuery q(db); q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + - " FROM podcast_episodes" - " WHERE ROWID = :id"); + " FROM podcast_episodes" + " WHERE ROWID = :id"); q.bindValue(":id", id); q.exec(); if (!db_->CheckErrors(q) && q.next()) { @@ -269,8 +270,8 @@ PodcastEpisode PodcastBackend::GetEpisodeByUrl(const QUrl& url) { QSqlQuery q(db); q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + - " FROM podcast_episodes" - " WHERE url = :url"); + " FROM podcast_episodes" + " WHERE url = :url"); q.bindValue(":url", url.toEncoded()); q.exec(); if (!db_->CheckErrors(q) && q.next()) { @@ -288,9 +289,9 @@ PodcastEpisode PodcastBackend::GetEpisodeByUrlOrLocalUrl(const QUrl& url) { QSqlQuery q(db); q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + - " FROM podcast_episodes" - " WHERE url = :url" - " OR local_url = :url"); + " FROM podcast_episodes" + " WHERE url = :url" + " OR local_url = :url"); q.bindValue(":url", url.toEncoded()); q.exec(); if (!db_->CheckErrors(q) && q.next()) { @@ -309,9 +310,9 @@ PodcastEpisodeList PodcastBackend::GetOldDownloadedEpisodes( QSqlQuery q(db); q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + - " FROM podcast_episodes" - " WHERE downloaded = 'true'" - " AND listened_date <= :max_listened_date"); + " FROM podcast_episodes" + " WHERE downloaded = 'true'" + " AND listened_date <= :max_listened_date"); q.bindValue(":max_listened_date", max_listened_date.toTime_t()); q.exec(); if (db_->CheckErrors(q)) return ret; @@ -333,10 +334,10 @@ PodcastEpisode PodcastBackend::GetOldestDownloadedListenedEpisode() { QSqlQuery q(db); q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + - " FROM podcast_episodes" - " WHERE downloaded = 'true'" - " AND listened = 'true'" - " ORDER BY listened_date ASC"); + " FROM podcast_episodes" + " WHERE downloaded = 'true'" + " AND listened = 'true'" + " ORDER BY listened_date ASC"); q.exec(); if (db_->CheckErrors(q)) return ret; q.next(); @@ -353,9 +354,9 @@ PodcastEpisodeList PodcastBackend::GetNewDownloadedEpisodes() { QSqlQuery q(db); q.prepare("SELECT ROWID, " + PodcastEpisode::kColumnSpec + - " FROM podcast_episodes" - " WHERE downloaded = 'true'" - " AND listened = 'false'"); + " FROM podcast_episodes" + " WHERE downloaded = 'true'" + " AND listened = 'false'"); q.exec(); if (db_->CheckErrors(q)) return ret; diff --git a/src/internet/podcasts/podcastdeleter.cpp b/src/internet/podcasts/podcastdeleter.cpp index 5c3132985..bc9d9ac63 100644 --- a/src/internet/podcasts/podcastdeleter.cpp +++ b/src/internet/podcasts/podcastdeleter.cpp @@ -104,7 +104,7 @@ void PodcastDeleter::AutoDelete() { timeout_ms = QDateTime::currentDateTime().toMSecsSinceEpoch(); timeout_ms -= oldest_episode_time.toMSecsSinceEpoch(); timeout_ms = (delete_after_secs_ * kMsecPerSec) - timeout_ms; - qLog(Info) << "Timeout for autodelete set to:" << timeout_ms <<"ms"; + qLog(Info) << "Timeout for autodelete set to:" << timeout_ms << "ms"; if (timeout_ms >= 0) { auto_delete_timer_->setInterval(timeout_ms); } else { diff --git a/src/internet/podcasts/podcastdeleter.h b/src/internet/podcasts/podcastdeleter.h index 48dd74ca4..fac03b81e 100644 --- a/src/internet/podcasts/podcastdeleter.h +++ b/src/internet/podcasts/podcastdeleter.h @@ -18,10 +18,6 @@ #ifndef INTERNET_PODCASTS_PODCASTDELETER_H_ #define INTERNET_PODCASTS_PODCASTDELETER_H_ -#include "core/network.h" -#include "podcast.h" -#include "podcastepisode.h" - #include #include #include @@ -29,6 +25,10 @@ #include #include +#include "core/network.h" +#include "podcast.h" +#include "podcastepisode.h" + #ifdef Q_OS_WIN #include #else diff --git a/src/internet/podcasts/podcastdiscoverymodel.h b/src/internet/podcasts/podcastdiscoverymodel.h index 01dae3236..ca8f6961c 100644 --- a/src/internet/podcasts/podcastdiscoverymodel.h +++ b/src/internet/podcasts/podcastdiscoverymodel.h @@ -20,10 +20,10 @@ #ifndef INTERNET_PODCASTS_PODCASTDISCOVERYMODEL_H_ #define INTERNET_PODCASTS_PODCASTDISCOVERYMODEL_H_ -#include "covers/albumcoverloaderoptions.h" - #include +#include "covers/albumcoverloaderoptions.h" + class Application; class OpmlContainer; class OpmlFeed; diff --git a/src/internet/podcasts/podcastdownloader.cpp b/src/internet/podcasts/podcastdownloader.cpp index 021a22dcc..8f36f3930 100644 --- a/src/internet/podcasts/podcastdownloader.cpp +++ b/src/internet/podcasts/podcastdownloader.cpp @@ -147,8 +147,8 @@ void PodcastDownloader::ReloadSettings() { download_dir_ = s.value("download_dir", DefaultDownloadDir()).toString(); } -QString PodcastDownloader::FilenameForEpisode(const QString& directory, - const PodcastEpisode& episode) const { +QString PodcastDownloader::FilenameForEpisode( + const QString& directory, const PodcastEpisode& episode) const { const QString file_extension = QFileInfo(episode.url().path()).suffix(); int count = 0; @@ -166,8 +166,9 @@ QString PodcastDownloader::FilenameForEpisode(const QString& directory, filename = QString("%1/%2.%3").arg(directory, base_filename, file_extension); } else { - filename = QString("%1/%2 (%3).%4").arg( - directory, base_filename, QString::number(count), file_extension); + filename = QString("%1/%2 (%3).%4") + .arg(directory, base_filename, QString::number(count), + file_extension); } if (!QFile::exists(filename)) { @@ -209,10 +210,11 @@ void PodcastDownloader::DownloadEpisode(const PodcastEpisode& episode) { list_tasks_ << task; qLog(Info) << "Downloading" << task->episode().url() << "to" << filepath; connect(task, SIGNAL(finished(Task*)), SLOT(ReplyFinished(Task*))); - connect(task, SIGNAL(ProgressChanged(const PodcastEpisode&, - PodcastDownload::State, int)), - SIGNAL(ProgressChanged(const PodcastEpisode&, - PodcastDownload::State, int))); + connect(task, + SIGNAL(ProgressChanged(const PodcastEpisode&, PodcastDownload::State, + int)), + SIGNAL(ProgressChanged(const PodcastEpisode&, PodcastDownload::State, + int))); } void PodcastDownloader::ReplyFinished(Task* task) { @@ -220,8 +222,8 @@ void PodcastDownloader::ReplyFinished(Task* task) { delete task; } -QString PodcastDownloader::SanitiseFilenameComponent(const QString& text) - const { +QString PodcastDownloader::SanitiseFilenameComponent( + const QString& text) const { return QString(text) .replace(disallowed_filename_characters_, " ") .simplified(); @@ -239,7 +241,8 @@ void PodcastDownloader::EpisodesAdded(const PodcastEpisodeList& episodes) { } } -PodcastEpisodeList PodcastDownloader::EpisodesDownloading(const PodcastEpisodeList& episodes) { +PodcastEpisodeList PodcastDownloader::EpisodesDownloading( + const PodcastEpisodeList& episodes) { PodcastEpisodeList ret; for (Task* tas : list_tasks_) { for (PodcastEpisode episode : episodes) { diff --git a/src/internet/podcasts/podcastdownloader.h b/src/internet/podcasts/podcastdownloader.h index 5db4a5ddb..39226a4a3 100644 --- a/src/internet/podcasts/podcastdownloader.h +++ b/src/internet/podcasts/podcastdownloader.h @@ -20,17 +20,17 @@ #ifndef INTERNET_PODCASTS_PODCASTDOWNLOADER_H_ #define INTERNET_PODCASTS_PODCASTDOWNLOADER_H_ -#include "core/network.h" -#include "podcast.h" -#include "podcastepisode.h" - -#include #include #include #include #include #include #include +#include + +#include "core/network.h" +#include "podcast.h" +#include "podcastepisode.h" #ifdef Q_OS_WIN #include @@ -44,7 +44,7 @@ class PodcastBackend; class QNetworkAccessManager; namespace PodcastDownload { - enum State { NotDownloading, Queued, Downloading, Finished }; +enum State { NotDownloading, Queued, Downloading, Finished }; } class Task : public QObject { diff --git a/src/internet/podcasts/podcastepisode.cpp b/src/internet/podcasts/podcastepisode.cpp index 55e6cadaa..1f81fa158 100644 --- a/src/internet/podcasts/podcastepisode.cpp +++ b/src/internet/podcasts/podcastepisode.cpp @@ -24,10 +24,10 @@ #include #include -#include "podcast.h" #include "core/logging.h" #include "core/timeconstants.h" #include "core/utilities.h" +#include "podcast.h" const QStringList PodcastEpisode::kColumns = QStringList() << "podcast_id" << "title" @@ -147,10 +147,10 @@ void PodcastEpisode::InitFromQuery(const QSqlQuery& query) { d->url_ = QUrl::fromEncoded(query.value(7).toByteArray()); d->listened_ = query.value(8).toBool(); - // After setting QDateTime to invalid state, it's saved into database as time_t, - // when this number std::numeric_limits::max() (4294967295) is read back - // from database, it creates a valid QDateTime. - // So to make it behave consistently, this change is needed. + // After setting QDateTime to invalid state, it's saved into database as + // time_t, when this number std::numeric_limits::max() + // (4294967295) is read back from database, it creates a valid QDateTime. So + // to make it behave consistently, this change is needed. if (query.value(9).toUInt() == std::numeric_limits::max()) { d->listened_date_ = QDateTime(); } else { diff --git a/src/internet/podcasts/podcastepisode.h b/src/internet/podcasts/podcastepisode.h index 49b0345cc..79ca6b982 100644 --- a/src/internet/podcasts/podcastepisode.h +++ b/src/internet/podcasts/podcastepisode.h @@ -20,13 +20,13 @@ #ifndef INTERNET_PODCASTS_PODCASTEPISODE_H_ #define INTERNET_PODCASTS_PODCASTEPISODE_H_ -#include "core/song.h" - #include #include #include #include +#include "core/song.h" + class Podcast; class PodcastEpisode { diff --git a/src/internet/podcasts/podcastinfodialog.cpp b/src/internet/podcasts/podcastinfodialog.cpp index ae398a6b6..a8298f26b 100644 --- a/src/internet/podcasts/podcastinfodialog.cpp +++ b/src/internet/podcasts/podcastinfodialog.cpp @@ -20,17 +20,13 @@ #include "ui_podcastinfodialog.h" PodcastInfoDialog::PodcastInfoDialog(Application* app, QWidget* parent) - : QDialog(parent), - app_(app), - ui_(new Ui_PodcastInfoDialog) { + : QDialog(parent), app_(app), ui_(new Ui_PodcastInfoDialog) { ui_->setupUi(this); ui_->podcast_details->SetApplication(app); ui_->episode_details->SetApplication(app); } -PodcastInfoDialog::~PodcastInfoDialog() { - delete ui_; -} +PodcastInfoDialog::~PodcastInfoDialog() { delete ui_; } void PodcastInfoDialog::ShowPodcast(const Podcast& podcast) { ui_->episode_info_scroll_area->hide(); diff --git a/src/internet/podcasts/podcastinfowidget.cpp b/src/internet/podcasts/podcastinfowidget.cpp index d1c365854..6ef96f780 100644 --- a/src/internet/podcasts/podcastinfowidget.cpp +++ b/src/internet/podcasts/podcastinfowidget.cpp @@ -18,9 +18,10 @@ */ #include "podcastinfowidget.h" -#include "ui_podcastinfowidget.h" + #include "core/application.h" #include "covers/albumcoverloader.h" +#include "ui_podcastinfowidget.h" PodcastInfoWidget::PodcastInfoWidget(QWidget* parent) : QWidget(parent), diff --git a/src/internet/podcasts/podcastinfowidget.h b/src/internet/podcasts/podcastinfowidget.h index 34a4e28f6..7c9c62d68 100644 --- a/src/internet/podcasts/podcastinfowidget.h +++ b/src/internet/podcasts/podcastinfowidget.h @@ -20,11 +20,11 @@ #ifndef INTERNET_PODCASTS_PODCASTINFOWIDGET_H_ #define INTERNET_PODCASTS_PODCASTINFOWIDGET_H_ -#include "podcast.h" -#include "covers/albumcoverloaderoptions.h" - #include +#include "covers/albumcoverloaderoptions.h" +#include "podcast.h" + class Application; class Ui_PodcastInfoWidget; diff --git a/src/internet/podcasts/podcastparser.cpp b/src/internet/podcasts/podcastparser.cpp index a5da1626a..59452c0f7 100644 --- a/src/internet/podcasts/podcastparser.cpp +++ b/src/internet/podcasts/podcastparser.cpp @@ -114,7 +114,8 @@ void PodcastParser::ParseChannel(QXmlStreamReader* reader, Podcast* ret) const { if (name == "title") { ret->set_title(reader->readElementText()); } else if (name == "link" && lower_namespace.isEmpty()) { - ret->set_link(QUrl::fromEncoded(reader->readElementText().toLatin1())); + ret->set_link( + QUrl::fromEncoded(reader->readElementText().toLatin1())); } else if (name == "description") { ret->set_description(reader->readElementText()); } else if (name == "owner" && lower_namespace == kItunesNamespace) { @@ -215,8 +216,11 @@ void PodcastParser::ParseItem(QXmlStreamReader* reader, Podcast* ret) const { if (!episode.publication_date().isValid()) { qLog(Error) << "Unable to parse date:" << date << "Please submit it to " - << "https://github.com/clementine-player/Clementine/issues/new?title=" - + QUrl::toPercentEncoding(QString("[podcast] Unable to parse date: %1").arg(date)); + << "https://github.com/clementine-player/Clementine/" + "issues/new?title=" + + QUrl::toPercentEncoding( + QString("[podcast] Unable to parse date: %1") + .arg(date)); } } else if (name == "duration" && lower_namespace == kItunesNamespace) { // http://www.apple.com/itunes/podcasts/specs.html @@ -229,15 +233,17 @@ void PodcastParser::ParseItem(QXmlStreamReader* reader, Podcast* ret) const { } } else if (name == "enclosure") { const QString type = reader->attributes().value("type").toString(); - const QUrl url = QUrl::fromEncoded(reader->attributes().value("url").toString().toLatin1()); + const QUrl url = QUrl::fromEncoded( + reader->attributes().value("url").toString().toLatin1()); if (type.startsWith("audio/") || type.startsWith("x-audio/")) { episode.set_url(url); } - // If the URL doesn't have a type, see if it's one of the obvious types - else if (type.isEmpty() && ( - url.path().endsWith(".mp3", Qt::CaseInsensitive) || - url.path().endsWith(".m4a", Qt::CaseInsensitive) || - url.path().endsWith(".wav", Qt::CaseInsensitive))) { + // If the URL doesn't have a type, see if it's one of the obvious + // types + else if (type.isEmpty() && + (url.path().endsWith(".mp3", Qt::CaseInsensitive) || + url.path().endsWith(".m4a", Qt::CaseInsensitive) || + url.path().endsWith(".wav", Qt::CaseInsensitive))) { episode.set_url(url); } Utilities::ConsumeCurrentElement(reader); diff --git a/src/internet/podcasts/podcastservice.cpp b/src/internet/podcasts/podcastservice.cpp index cfe88b38e..8b67d679a 100644 --- a/src/internet/podcasts/podcastservice.cpp +++ b/src/internet/podcasts/podcastservice.cpp @@ -26,7 +26,6 @@ #include #include "addpodcastdialog.h" -#include "podcastinfodialog.h" #include "core/application.h" #include "core/logging.h" #include "core/mergedproxymodel.h" @@ -34,12 +33,13 @@ #include "devices/devicestatefiltermodel.h" #include "devices/deviceview.h" #include "internet/core/internetmodel.h" +#include "internet/podcasts/podcastservicemodel.h" #include "library/libraryview.h" #include "opmlcontainer.h" #include "podcastbackend.h" #include "podcastdeleter.h" #include "podcastdownloader.h" -#include "internet/podcasts/podcastservicemodel.h" +#include "podcastinfodialog.h" #include "podcastupdater.h" #include "ui/iconloader.h" #include "ui/organisedialog.h" @@ -226,7 +226,8 @@ void PodcastService::PopulatePodcastList(QStandardItem* parent) { // Do this here since the downloader won't be created yet in the ctor. connect(app_->podcast_downloader(), SIGNAL(ProgressChanged(PodcastEpisode, PodcastDownload::State, int)), - SLOT(DownloadProgressChanged(PodcastEpisode, PodcastDownload::State, int))); + SLOT(DownloadProgressChanged(PodcastEpisode, PodcastDownload::State, + int))); if (default_icon_.isNull()) { default_icon_ = IconLoader::Load("podcast", IconLoader::Provider); @@ -345,7 +346,8 @@ void PodcastService::UpdatePodcastText(QStandardItem* item, case PodcastDownload::Finished: case PodcastDownload::NotDownloading: if (podcast.ImageUrlSmall().isValid()) { - icon_loader_->LoadIcon(podcast.ImageUrlSmall().toString(), QString(), item); + icon_loader_->LoadIcon(podcast.ImageUrlSmall().toString(), QString(), + item); } else { item->setIcon(default_icon_); } @@ -431,21 +433,18 @@ void PodcastService::ShowContextMenu(const QPoint& global_pos) { download_selected_action_ = context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), "", this, SLOT(DownloadSelectedEpisode())); - info_selected_action_ = - context_menu_->addAction(IconLoader::Load("about-info", - IconLoader::Base), - tr("Podcast information"), this, - SLOT(PodcastInfo())); + info_selected_action_ = context_menu_->addAction( + IconLoader::Load("about-info", IconLoader::Base), + tr("Podcast information"), this, SLOT(PodcastInfo())); delete_downloaded_action_ = context_menu_->addAction( IconLoader::Load("edit-delete", IconLoader::Base), tr("Delete downloaded data"), this, SLOT(DeleteDownloadedData())); copy_to_device_ = context_menu_->addAction( IconLoader::Load("multimedia-player-ipod-mini-blue", IconLoader::Base), tr("Copy to device..."), this, SLOT(CopyToDevice())); - cancel_download_ = context_menu_->addAction(IconLoader::Load("cancel", - IconLoader::Base), - tr("Cancel download"), this, - SLOT(CancelDownload())); + cancel_download_ = context_menu_->addAction( + IconLoader::Load("cancel", IconLoader::Base), tr("Cancel download"), + this, SLOT(CancelDownload())); remove_selected_action_ = context_menu_->addAction( IconLoader::Load("list-remove", IconLoader::Base), tr("Unsubscribe"), this, SLOT(RemoveSelectedPodcast())); @@ -520,7 +519,8 @@ void PodcastService::ShowContextMenu(const QPoint& global_pos) { if (explicitly_selected_podcasts_.isEmpty()) { set_new_action_->setEnabled(listened); - set_listened_action_->setEnabled(!listened || !episode.listened_date().isValid()); + set_listened_action_->setEnabled(!listened || + !episode.listened_date().isValid()); } } else { download_selected_action_->setEnabled(episodes); @@ -734,7 +734,8 @@ void PodcastService::DownloadProgressChanged(const PodcastEpisode& episode, PodcastDownload::State state, int percent) { QStandardItem* item = episodes_by_database_id_[episode.database_id()]; - QStandardItem* item2 = podcasts_by_database_id_[episode.podcast_database_id()]; + QStandardItem* item2 = + podcasts_by_database_id_[episode.podcast_database_id()]; if (!item || !item2) return; UpdateEpisodeText(item, state, percent); diff --git a/src/internet/podcasts/podcastservice.h b/src/internet/podcasts/podcastservice.h index e6b3c6fbe..c2322af7e 100644 --- a/src/internet/podcasts/podcastservice.h +++ b/src/internet/podcasts/podcastservice.h @@ -21,13 +21,13 @@ #ifndef INTERNET_PODCASTS_PODCASTSERVICE_H_ #define INTERNET_PODCASTS_PODCASTSERVICE_H_ -#include "podcastdeleter.h" -#include "podcastdownloader.h" +#include +#include + #include "internet/core/internetmodel.h" #include "internet/core/internetservice.h" - -#include -#include +#include "podcastdeleter.h" +#include "podcastdownloader.h" class AddPodcastDialog; class PodcastInfoDialog; diff --git a/src/internet/podcasts/podcastservicemodel.cpp b/src/internet/podcasts/podcastservicemodel.cpp index 747488616..dc2989c4e 100644 --- a/src/internet/podcasts/podcastservicemodel.cpp +++ b/src/internet/podcasts/podcastservicemodel.cpp @@ -17,8 +17,9 @@ along with Clementine. If not, see . */ -#include "internet/podcasts/podcastservice.h" #include "internet/podcasts/podcastservicemodel.h" + +#include "internet/podcasts/podcastservice.h" #include "playlist/songmimedata.h" PodcastServiceModel::PodcastServiceModel(QObject* parent) diff --git a/src/internet/podcasts/podcastsettingspage.cpp b/src/internet/podcasts/podcastsettingspage.cpp index 1bd41ac06..b390add87 100644 --- a/src/internet/podcasts/podcastsettingspage.cpp +++ b/src/internet/podcasts/podcastsettingspage.cpp @@ -18,7 +18,6 @@ */ #include "internet/podcasts/podcastsettingspage.h" -#include "ui_podcastsettingspage.h" #include #include @@ -29,8 +28,9 @@ #include "library/librarydirectorymodel.h" #include "library/librarymodel.h" #include "podcastdownloader.h" -#include "ui/settingsdialog.h" #include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_podcastsettingspage.h" const char* PodcastSettingsPage::kSettingsGroup = "Podcasts"; diff --git a/src/internet/podcasts/podcasturlloader.cpp b/src/internet/podcasts/podcasturlloader.cpp index c08265fd6..f05d0d7cc 100644 --- a/src/internet/podcasts/podcasturlloader.cpp +++ b/src/internet/podcasts/podcasturlloader.cpp @@ -22,11 +22,11 @@ #include #include -#include "podcastparser.h" #include "core/closure.h" #include "core/logging.h" #include "core/network.h" #include "core/utilities.h" +#include "podcastparser.h" const int PodcastUrlLoader::kMaxRedirects = 5; diff --git a/src/internet/seafile/seafileservice.cpp b/src/internet/seafile/seafileservice.cpp index 28a17d8fa..fe828b12a 100644 --- a/src/internet/seafile/seafileservice.cpp +++ b/src/internet/seafile/seafileservice.cpp @@ -20,21 +20,20 @@ #include "seafileservice.h" -#include - -#include -#include +#include #include #include -#include +#include +#include +#include #include "core/application.h" -#include "core/taskmanager.h" #include "core/player.h" +#include "core/taskmanager.h" #include "core/waitforsignal.h" +#include "internet/core/oauthenticator.h" #include "internet/seafile/seafileurlhandler.h" #include "library/librarybackend.h" -#include "internet/core/oauthenticator.h" #include "ui/iconloader.h" const char* SeafileService::kServiceName = "Seafile"; @@ -115,7 +114,8 @@ bool SeafileService::GetToken(const QString& mail, const QString& password, QNetworkRequest request(url); AddAuthorizationHeader(&request); - QNetworkReply* reply = network_->post(request, url_query.toString().toLatin1()); + QNetworkReply* reply = + network_->post(request, url_query.toString().toLatin1()); WaitForSignal(reply, SIGNAL(finished())); if (!CheckReply(&reply)) { @@ -125,7 +125,8 @@ bool SeafileService::GetToken(const QString& mail, const QString& password, reply->deleteLater(); - QJsonObject json_response = QJsonDocument::fromJson(reply->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromJson(reply->readAll()).object(); // Because the server responds "token" access_token_ = json_response["token"].toString().replace("\"", ""); @@ -169,7 +170,7 @@ void SeafileService::GetLibrariesFinished(QNetworkReply* reply) { QJsonArray json_repos = QJsonDocument::fromJson(data).array(); - for (const QJsonValue & json_repo: json_repos) { + for (const QJsonValue& json_repo : json_repos) { QJsonObject repo = json_repo.toObject(); QString repo_name = repo["name"].toString(), repo_id = repo["id"].toString(); diff --git a/src/internet/seafile/seafileservice.h b/src/internet/seafile/seafileservice.h index 1fe893708..6b4b1e5e9 100644 --- a/src/internet/seafile/seafileservice.h +++ b/src/internet/seafile/seafileservice.h @@ -40,16 +40,15 @@ * - Add ssl certificate exception (for people who generate their own *certificate on their Seafile server * - Stop Tagreader when user changes the library -*/ + */ #ifndef INTERNET_SEAFILE_SEAFILESERVICE_H_ #define INTERNET_SEAFILE_SEAFILESERVICE_H_ -#include "internet/core/cloudfileservice.h" - #include #include +#include "internet/core/cloudfileservice.h" #include "seafiletree.h" class QNetworkReply; @@ -82,7 +81,7 @@ class SeafileService : public CloudFileService { void ForgetCredentials(); void ChangeLibrary(const QString& new_library); -signals: + signals: void Connected(); // QMap, key : library's id, value : library's name void GetLibrariesFinishedSignal(QMap); diff --git a/src/internet/seafile/seafilesettingspage.cpp b/src/internet/seafile/seafilesettingspage.cpp index 88a5fae15..bbd8c31af 100644 --- a/src/internet/seafile/seafilesettingspage.cpp +++ b/src/internet/seafile/seafilesettingspage.cpp @@ -25,12 +25,12 @@ #include #include -#include "seafileservice.h" -#include "internet/core/internetmodel.h" #include "core/logging.h" #include "core/network.h" -#include "ui_seafilesettingspage.h" +#include "internet/core/internetmodel.h" +#include "seafileservice.h" #include "ui/iconloader.h" +#include "ui_seafilesettingspage.h" SeafileSettingsPage::SeafileSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), diff --git a/src/internet/seafile/seafilesettingspage.h b/src/internet/seafile/seafilesettingspage.h index 3285ae695..554d4ddaf 100644 --- a/src/internet/seafile/seafilesettingspage.h +++ b/src/internet/seafile/seafilesettingspage.h @@ -19,11 +19,11 @@ #ifndef INTERNET_SEAFILE_SEAFILESETTINGSPAGE_H_ #define INTERNET_SEAFILE_SEAFILESETTINGSPAGE_H_ -#include "ui/settingspage.h" - #include #include +#include "ui/settingspage.h" + class Ui_SeafileSettingsPage; class SeafileService; diff --git a/src/internet/seafile/seafiletree.cpp b/src/internet/seafile/seafiletree.cpp index f611b011f..3c6e0c059 100644 --- a/src/internet/seafile/seafiletree.cpp +++ b/src/internet/seafile/seafiletree.cpp @@ -18,9 +18,9 @@ #include "seafiletree.h" -#include -#include #include +#include +#include #include "core/logging.h" @@ -203,7 +203,7 @@ QList> SeafileTree::GetRecursiveFilesOfDir( if (item->entry().is_file()) { files.append(qMakePair(path, item->entry())); - // Get files of the dir + // Get files of the dir } else { for (TreeItem* child_item : item->children()) { if (child_item->entry().is_file()) { diff --git a/src/internet/seafile/seafiletree.h b/src/internet/seafile/seafiletree.h index 1c38e9249..ccba25639 100644 --- a/src/internet/seafile/seafiletree.h +++ b/src/internet/seafile/seafiletree.h @@ -18,15 +18,15 @@ /* Contacts (for explanations, congratulations, insults) : * - -*/ + */ #ifndef INTERNET_SEAFILE_SEAFILETREE_H_ #define INTERNET_SEAFILE_SEAFILETREE_H_ -#include -#include #include +#include #include +#include #include "internet/core/cloudfileservice.h" diff --git a/src/internet/seafile/seafileurlhandler.h b/src/internet/seafile/seafileurlhandler.h index 02aec04a1..17d83c2df 100644 --- a/src/internet/seafile/seafileurlhandler.h +++ b/src/internet/seafile/seafileurlhandler.h @@ -27,10 +27,13 @@ class SeafileService; class SeafileUrlHandler : public UrlHandler { Q_OBJECT public: - explicit SeafileUrlHandler(SeafileService* service, QObject* parent = nullptr); + explicit SeafileUrlHandler(SeafileService* service, + QObject* parent = nullptr); QString scheme() const { return "seafile"; } - QIcon icon() const { return IconLoader::Load("seafile", IconLoader::Provider); } + QIcon icon() const { + return IconLoader::Load("seafile", IconLoader::Provider); + } LoadResult StartLoading(const QUrl& url); private: diff --git a/src/internet/skydrive/skydriveservice.cpp b/src/internet/skydrive/skydriveservice.cpp index 091665037..5dfc12a9d 100644 --- a/src/internet/skydrive/skydriveservice.cpp +++ b/src/internet/skydrive/skydriveservice.cpp @@ -19,11 +19,10 @@ #include "skydriveservice.h" +#include #include #include -#include #include - #include #include "core/application.h" @@ -111,7 +110,8 @@ void SkydriveService::AddAuthorizationHeader(QNetworkRequest* request) { void SkydriveService::FetchUserInfoFinished(QNetworkReply* reply) { reply->deleteLater(); - QJsonObject json_response = QJsonDocument::fromBinaryData(reply->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromBinaryData(reply->readAll()).object(); QString name = json_response["name"].toString(); if (!name.isEmpty()) { @@ -137,7 +137,8 @@ void SkydriveService::ListFiles(const QString& folder) { void SkydriveService::ListFilesFinished(QNetworkReply* reply) { reply->deleteLater(); - QJsonObject json_response = QJsonDocument::fromBinaryData(reply->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromBinaryData(reply->readAll()).object(); QJsonArray files = json_response["data"].toArray(); for (const QJsonValue& f : files) { @@ -152,8 +153,10 @@ void SkydriveService::ListFilesFinished(QNetworkReply* reply) { Song song; song.set_url(url); - song.set_ctime(QDateTime::fromString(file["created_time"].toString()).toTime_t()); - song.set_mtime(QDateTime::fromString(file["updated_time"].toString()).toTime_t()); + song.set_ctime( + QDateTime::fromString(file["created_time"].toString()).toTime_t()); + song.set_mtime( + QDateTime::fromString(file["updated_time"].toString()).toTime_t()); song.set_comment(file["description"].toString()); song.set_filesize(file["size"].toInt()); song.set_title(file["name"].toString()); @@ -176,7 +179,8 @@ QUrl SkydriveService::GetStreamingUrlFromSongId(const QString& file_id) { std::unique_ptr reply(network_->get(request)); WaitForSignal(reply.get(), SIGNAL(finished())); - QJsonObject json_response = QJsonDocument::fromBinaryData(reply.get()->readAll()).object(); + QJsonObject json_response = + QJsonDocument::fromBinaryData(reply.get()->readAll()).object(); return QUrl(json_response["source"].toString()); } diff --git a/src/internet/skydrive/skydriveservice.h b/src/internet/skydrive/skydriveservice.h index 9cd7cbbbf..2f8ed7fa8 100644 --- a/src/internet/skydrive/skydriveservice.h +++ b/src/internet/skydrive/skydriveservice.h @@ -20,10 +20,10 @@ #ifndef INTERNET_SKYDRIVE_SKYDRIVESERVICE_H_ #define INTERNET_SKYDRIVE_SKYDRIVESERVICE_H_ -#include "internet/core/cloudfileservice.h" - #include +#include "internet/core/cloudfileservice.h" + class OAuthenticator; class QNetworkRequest; class QNetworkReply; diff --git a/src/internet/skydrive/skydrivesettingspage.cpp b/src/internet/skydrive/skydrivesettingspage.cpp index 487d8451b..23a8a50c7 100644 --- a/src/internet/skydrive/skydrivesettingspage.cpp +++ b/src/internet/skydrive/skydrivesettingspage.cpp @@ -20,12 +20,12 @@ #include -#include "ui_skydrivesettingspage.h" #include "core/application.h" -#include "internet/skydrive/skydriveservice.h" #include "internet/core/internetmodel.h" -#include "ui/settingsdialog.h" +#include "internet/skydrive/skydriveservice.h" #include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_skydrivesettingspage.h" SkydriveSettingsPage::SkydriveSettingsPage(SettingsDialog* parent) : SettingsPage(parent), diff --git a/src/internet/skydrive/skydrivesettingspage.h b/src/internet/skydrive/skydrivesettingspage.h index 6a524f47d..fd519d1f0 100644 --- a/src/internet/skydrive/skydrivesettingspage.h +++ b/src/internet/skydrive/skydrivesettingspage.h @@ -19,11 +19,11 @@ #ifndef INTERNET_SKYDRIVE_SKYDRIVESETTINGSPAGE_H_ #define INTERNET_SKYDRIVE_SKYDRIVESETTINGSPAGE_H_ -#include "ui/settingspage.h" - #include #include +#include "ui/settingspage.h" + class SkydriveService; class Ui_SkydriveSettingsPage; diff --git a/src/internet/skydrive/skydriveurlhandler.h b/src/internet/skydrive/skydriveurlhandler.h index cc56aca10..95cd4c1d9 100644 --- a/src/internet/skydrive/skydriveurlhandler.h +++ b/src/internet/skydrive/skydriveurlhandler.h @@ -28,10 +28,13 @@ class SkydriveUrlHandler : public UrlHandler { Q_OBJECT public: - explicit SkydriveUrlHandler(SkydriveService* service, QObject* parent = nullptr); + explicit SkydriveUrlHandler(SkydriveService* service, + QObject* parent = nullptr); QString scheme() const { return "skydrive"; } - QIcon icon() const { return IconLoader::Load("skydrive", IconLoader::Provider); } + QIcon icon() const { + return IconLoader::Load("skydrive", IconLoader::Provider); + } LoadResult StartLoading(const QUrl& url); private: diff --git a/src/internet/somafm/somafmservice.cpp b/src/internet/somafm/somafmservice.cpp index efb3251bd..ac3ba2808 100644 --- a/src/internet/somafm/somafmservice.cpp +++ b/src/internet/somafm/somafmservice.cpp @@ -24,13 +24,11 @@ #include #include #include -#include #include +#include #include #include -#include "somafmurlhandler.h" -#include "internet/core/internetmodel.h" #include "core/application.h" #include "core/closure.h" #include "core/logging.h" @@ -40,6 +38,8 @@ #include "core/utilities.h" #include "globalsearch/globalsearch.h" #include "globalsearch/somafmsearchprovider.h" +#include "internet/core/internetmodel.h" +#include "somafmurlhandler.h" #include "ui/iconloader.h" const int SomaFMServiceBase::kStreamsCacheDurationSecs = @@ -103,11 +103,11 @@ void SomaFMServiceBase::ShowContextMenu(const QPoint& global_pos) { this, SLOT(Homepage())); if (!donate_page_url_.isEmpty()) { - context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), + context_menu_->addAction(IconLoader::Load("download", IconLoader::Base), tr("Donate"), this, SLOT(Donate())); } - context_menu_->addAction(IconLoader::Load("view-refresh", IconLoader::Base), + context_menu_->addAction(IconLoader::Load("view-refresh", IconLoader::Base), tr("Refresh channels"), this, SLOT(ForceRefreshStreams())); } @@ -232,9 +232,8 @@ void SomaFMServiceBase::PopulateStreams() { if (root_->hasChildren()) root_->removeRows(0, root_->rowCount()); for (const Stream& stream : streams_) { - QStandardItem* item = - new QStandardItem(IconLoader::Load("icon_radio", IconLoader::Lastfm), - QString()); + QStandardItem* item = new QStandardItem( + IconLoader::Load("icon_radio", IconLoader::Lastfm), QString()); item->setText(stream.title_); item->setData(QVariant::fromValue(stream.ToSong(name_)), InternetModel::Role_SongMetadata); @@ -262,7 +261,7 @@ void SomaFMServiceBase::ReloadSettings() { } SomaFMService::SomaFMService(Application* app, InternetModel* parent) - : SomaFMServiceBase( - app, parent, "SomaFM", QUrl("https://somafm.com/channels.xml"), - QUrl("https://somafm.com"), QUrl(), IconLoader::Load("somafm", - IconLoader::Provider)) {} + : SomaFMServiceBase(app, parent, "SomaFM", + QUrl("https://somafm.com/channels.xml"), + QUrl("https://somafm.com"), QUrl(), + IconLoader::Load("somafm", IconLoader::Provider)) {} diff --git a/src/internet/somafm/somafmservice.h b/src/internet/somafm/somafmservice.h index 1692af404..43e1aecd0 100644 --- a/src/internet/somafm/somafmservice.h +++ b/src/internet/somafm/somafmservice.h @@ -22,8 +22,8 @@ #include -#include "internet/core/internetservice.h" #include "core/cachedlist.h" +#include "internet/core/internetservice.h" class SomaFMUrlHandler; diff --git a/src/internet/somafm/somafmurlhandler.cpp b/src/internet/somafm/somafmurlhandler.cpp index 27f7a64f8..f0459e4ca 100644 --- a/src/internet/somafm/somafmurlhandler.cpp +++ b/src/internet/somafm/somafmurlhandler.cpp @@ -25,12 +25,12 @@ #include #include -#include "internet/core/internetmodel.h" -#include "somafmservice.h" #include "core/application.h" #include "core/logging.h" #include "core/taskmanager.h" +#include "internet/core/internetmodel.h" #include "playlistparsers/playlistparser.h" +#include "somafmservice.h" SomaFMUrlHandler::SomaFMUrlHandler(Application* app, SomaFMServiceBase* service, QObject* parent) diff --git a/src/internet/spotify/spotifyblobdownloader.cpp b/src/internet/spotify/spotifyblobdownloader.cpp index 2afb2ed74..6cf540c6b 100644 --- a/src/internet/spotify/spotifyblobdownloader.cpp +++ b/src/internet/spotify/spotifyblobdownloader.cpp @@ -19,13 +19,6 @@ #include "spotifyblobdownloader.h" -#include "config.h" -#include "spotifyservice.h" -#include "core/arraysize.h" -#include "core/logging.h" -#include "core/network.h" -#include "core/utilities.h" - #include #include #include @@ -35,6 +28,13 @@ #include #include +#include "config.h" +#include "core/arraysize.h" +#include "core/logging.h" +#include "core/network.h" +#include "core/utilities.h" +#include "spotifyservice.h" + #ifdef Q_OS_UNIX #include #endif @@ -45,7 +45,7 @@ // Compatibility with cryptocpp >= 6.0.0 namespace CryptoPP { - typedef unsigned char byte; +typedef unsigned char byte; } #endif // HAVE_CRYPTOPP @@ -200,8 +200,9 @@ bool SpotifyBlobDownloader::CheckSignature( try { CryptoPP::ByteQueue bytes; - bytes.Put(reinterpret_cast(public_key_data.constData()), - public_key_data.size()); + bytes.Put( + reinterpret_cast(public_key_data.constData()), + public_key_data.size()); bytes.MessageEnd(); CryptoPP::RSA::PublicKey public_key; @@ -214,12 +215,13 @@ bool SpotifyBlobDownloader::CheckSignature( QString actual_filename = signature_filename; actual_filename.remove(kSignatureSuffix); - const bool result = verifier.VerifyMessage( - reinterpret_cast(file_data[actual_filename].constData()), - file_data[actual_filename].size(), - reinterpret_cast( - file_data[signature_filename].constData()), - file_data[signature_filename].size()); + const bool result = + verifier.VerifyMessage(reinterpret_cast( + file_data[actual_filename].constData()), + file_data[actual_filename].size(), + reinterpret_cast( + file_data[signature_filename].constData()), + file_data[signature_filename].size()); qLog(Debug) << "Verifying" << actual_filename << "against" << signature_filename << result; if (!result) { diff --git a/src/internet/spotify/spotifyblobdownloader.h b/src/internet/spotify/spotifyblobdownloader.h index c51ea4f13..d565f62fa 100644 --- a/src/internet/spotify/spotifyblobdownloader.h +++ b/src/internet/spotify/spotifyblobdownloader.h @@ -41,7 +41,7 @@ class SpotifyBlobDownloader : public QObject { void Start(); -signals: + signals: void Finished(); private slots: diff --git a/src/internet/spotify/spotifyserver.cpp b/src/internet/spotify/spotifyserver.cpp index a593b512f..126163bb0 100644 --- a/src/internet/spotify/spotifyserver.cpp +++ b/src/internet/spotify/spotifyserver.cpp @@ -28,7 +28,6 @@ #include "core/closure.h" #include "core/logging.h" - #include "spotifymessages.pb.h" SpotifyServer::SpotifyServer(QObject* parent) diff --git a/src/internet/spotify/spotifyserver.h b/src/internet/spotify/spotifyserver.h index fa1e9c881..168cb9bad 100644 --- a/src/internet/spotify/spotifyserver.h +++ b/src/internet/spotify/spotifyserver.h @@ -22,12 +22,12 @@ #ifndef INTERNET_SPOTIFY_SPOTIFYSERVER_H_ #define INTERNET_SPOTIFY_SPOTIFYSERVER_H_ -#include "spotifymessages.pb.h" -#include "core/messagehandler.h" - #include #include +#include "core/messagehandler.h" +#include "spotifymessages.pb.h" + class QTcpServer; class QTcpSocket; @@ -67,7 +67,7 @@ class SpotifyServer : public AbstractMessageHandler { void StartPlayback(const QString& uri, quint16 port); void Seek(qint64 offset_nsec); -signals: + signals: void LoginCompleted(bool success, const QString& error, pb::spotify::LoginResponse_Error error_code); void PlaylistsUpdated(const pb::spotify::Playlists& playlists); diff --git a/src/internet/spotify/spotifyservice.cpp b/src/internet/spotify/spotifyservice.cpp index f4b6ecc5a..365a747dc 100644 --- a/src/internet/spotify/spotifyservice.cpp +++ b/src/internet/spotify/spotifyservice.cpp @@ -35,9 +35,6 @@ #include "blobversion.h" #include "config.h" -#include "internet/core/internetmodel.h" -#include "internet/core/searchboxwidget.h" -#include "spotifyserver.h" #include "core/application.h" #include "core/database.h" #include "core/logging.h" @@ -48,9 +45,12 @@ #include "core/utilities.h" #include "globalsearch/globalsearch.h" #include "globalsearch/spotifysearchprovider.h" +#include "internet/core/internetmodel.h" +#include "internet/core/searchboxwidget.h" #include "playlist/playlist.h" #include "playlist/playlistcontainer.h" #include "playlist/playlistmanager.h" +#include "spotifyserver.h" #include "ui/iconloader.h" #include "widgets/didyoumean.h" @@ -91,8 +91,8 @@ SpotifyService::SpotifyService(Application* app, InternetModel* parent) // Look for one distributed alongside clementine first, then check in the // user's home directory for any that have been downloaded. #if defined(Q_OS_MACOS) && defined(USE_BUNDLE) - system_blob_path_ = QCoreApplication::applicationDirPath() + - "/" + USE_BUNDLE_DIR + "/clementine-spotifyblob"; + system_blob_path_ = QCoreApplication::applicationDirPath() + "/" + + USE_BUNDLE_DIR + "/clementine-spotifyblob"; #else system_blob_path_ = QCoreApplication::applicationDirPath() + "/clementine-spotifyblob" CMAKE_EXECUTABLE_SUFFIX; diff --git a/src/internet/spotify/spotifyservice.h b/src/internet/spotify/spotifyservice.h index de33fc4d1..cd372d69e 100644 --- a/src/internet/spotify/spotifyservice.h +++ b/src/internet/spotify/spotifyservice.h @@ -22,13 +22,13 @@ #ifndef INTERNET_SPOTIFY_SPOTIFYSERVICE_H_ #define INTERNET_SPOTIFY_SPOTIFYSERVICE_H_ +#include +#include + #include "internet/core/internetmodel.h" #include "internet/core/internetservice.h" #include "spotifymessages.pb.h" -#include -#include - class Playlist; class SearchBoxWidget; class SpotifyServer; diff --git a/src/internet/spotify/spotifysettingspage.cpp b/src/internet/spotify/spotifysettingspage.cpp index 51ec5a92c..5bd566736 100644 --- a/src/internet/spotify/spotifysettingspage.cpp +++ b/src/internet/spotify/spotifysettingspage.cpp @@ -19,7 +19,6 @@ */ #include "spotifysettingspage.h" -#include "ui_spotifysettingspage.h" #include #include @@ -28,11 +27,12 @@ #include #include "config.h" +#include "core/network.h" +#include "internet/core/internetmodel.h" #include "spotifymessages.pb.h" #include "spotifyservice.h" -#include "internet/core/internetmodel.h" -#include "core/network.h" #include "ui/iconloader.h" +#include "ui_spotifysettingspage.h" SpotifySettingsPage::SpotifySettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), diff --git a/src/internet/subsonic/subsonicdynamicplaylist.cpp b/src/internet/subsonic/subsonicdynamicplaylist.cpp index b2ff73850..d504d4e51 100644 --- a/src/internet/subsonic/subsonicdynamicplaylist.cpp +++ b/src/internet/subsonic/subsonicdynamicplaylist.cpp @@ -16,12 +16,12 @@ */ #include "subsonicdynamicplaylist.h" -#include "subsonicservice.h" #include #include #include #include +#include #include "core/application.h" #include "core/logging.h" @@ -30,8 +30,7 @@ #include "core/timeconstants.h" #include "core/waitforsignal.h" #include "internet/core/internetplaylistitem.h" - -#include +#include "subsonicservice.h" // 500 limit per subsonic api const int SubsonicDynamicPlaylist::kMaxCount = 500; @@ -40,13 +39,12 @@ const int SubsonicDynamicPlaylist::kDefaultSongCount = 20; const int SubsonicDynamicPlaylist::kDefaultOffset = 0; SubsonicDynamicPlaylist::SubsonicDynamicPlaylist() - : type_(QueryType_Album), stat_(QueryStat_Newest), offset_(kDefaultOffset) { + : type_(QueryType_Album), stat_(QueryStat_Newest), offset_(kDefaultOffset) { service_ = InternetModel::Service(); } SubsonicDynamicPlaylist::SubsonicDynamicPlaylist(const QString& name, - QueryType type, - QueryStat stat) + QueryType type, QueryStat stat) : type_(type), stat_(stat), offset_(kDefaultOffset) { set_name(name); service_ = InternetModel::Service(); diff --git a/src/internet/subsonic/subsonicdynamicplaylist.h b/src/internet/subsonic/subsonicdynamicplaylist.h index c3eb93254..77fe94b84 100644 --- a/src/internet/subsonic/subsonicdynamicplaylist.h +++ b/src/internet/subsonic/subsonicdynamicplaylist.h @@ -18,11 +18,11 @@ #ifndef INTERNET_SUBSONIC_SUBSONICDYNAMICPLAYLIST_H_ #define INTERNET_SUBSONIC_SUBSONICDYNAMICPLAYLIST_H_ -#include "smartplaylists/generator.h" - #include #include +#include "smartplaylists/generator.h" + class SubsonicService; class SubsonicDynamicPlaylist : public smart_playlists::Generator { @@ -43,8 +43,8 @@ class SubsonicDynamicPlaylist : public smart_playlists::Generator { }; enum QueryType { - QueryType_Album = 0, - QueryType_Song = 1, + QueryType_Album = 0, + QueryType_Song = 1, }; SubsonicDynamicPlaylist(); @@ -68,8 +68,8 @@ class SubsonicDynamicPlaylist : public smart_playlists::Generator { static const int kDefaultOffset; private: - void GetAlbum(PlaylistItemList& list, QString id, QNetworkAccessManager& network, - const bool usesslv3); + void GetAlbum(PlaylistItemList& list, QString id, + QNetworkAccessManager& network, const bool usesslv3); // need our own one since we run in a different thread from service QNetworkReply* Send(QNetworkAccessManager& network, const QUrl& url, const bool usesslv3); diff --git a/src/internet/subsonic/subsonicservice.cpp b/src/internet/subsonic/subsonicservice.cpp index b8457f41b..790a7cba2 100644 --- a/src/internet/subsonic/subsonicservice.cpp +++ b/src/internet/subsonic/subsonicservice.cpp @@ -28,8 +28,8 @@ #include #include #include -#include #include +#include #include "core/application.h" #include "core/closure.h" @@ -43,8 +43,8 @@ #include "globalsearch/globalsearch.h" #include "globalsearch/librarysearchprovider.h" #include "internet/core/internetmodel.h" -#include "internet/subsonic/subsonicurlhandler.h" #include "internet/subsonic/subsonicdynamicplaylist.h" +#include "internet/subsonic/subsonicurlhandler.h" #include "library/librarybackend.h" #include "library/libraryfilterwidget.h" #include "smartplaylists/generator.h" @@ -95,37 +95,32 @@ SubsonicService::SubsonicService(Application* app, InternetModel* parent) library_model_->set_show_various_artists(false); library_model_->set_show_smart_playlists(true); library_model_->set_default_smart_playlists( - LibraryModel::DefaultGenerators() - << (LibraryModel::GeneratorList() - << GeneratorPtr(new SubsonicDynamicPlaylist( - tr("Newest Albums"), - SubsonicDynamicPlaylist::QueryType_Album, - SubsonicDynamicPlaylist::QueryStat_Newest)) - << GeneratorPtr(new SubsonicDynamicPlaylist( - tr("Random Albums"), - SubsonicDynamicPlaylist::QueryType_Album, - SubsonicDynamicPlaylist::QueryStat_Random)) - << GeneratorPtr(new SubsonicDynamicPlaylist( - tr("Frequently Played Albums"), - SubsonicDynamicPlaylist::QueryType_Album, - SubsonicDynamicPlaylist::QueryStat_Frequent)) - << GeneratorPtr(new SubsonicDynamicPlaylist( - tr("Top Rated Albums"), - SubsonicDynamicPlaylist::QueryType_Album, - SubsonicDynamicPlaylist::QueryStat_Highest)) - << GeneratorPtr(new SubsonicDynamicPlaylist( - tr("Recently Played Albums"), - SubsonicDynamicPlaylist::QueryType_Album, - SubsonicDynamicPlaylist::QueryStat_Recent)) - << GeneratorPtr(new SubsonicDynamicPlaylist( - tr("Starred Albums"), - SubsonicDynamicPlaylist::QueryType_Album, - SubsonicDynamicPlaylist::QueryStat_Starred)) - << GeneratorPtr(new SubsonicDynamicPlaylist( - tr("Random Songs"), - SubsonicDynamicPlaylist::QueryType_Song, - SubsonicDynamicPlaylist::QueryStat_Random)) - )); + LibraryModel::DefaultGenerators() + << (LibraryModel::GeneratorList() + << GeneratorPtr(new SubsonicDynamicPlaylist( + tr("Newest Albums"), SubsonicDynamicPlaylist::QueryType_Album, + SubsonicDynamicPlaylist::QueryStat_Newest)) + << GeneratorPtr(new SubsonicDynamicPlaylist( + tr("Random Albums"), SubsonicDynamicPlaylist::QueryType_Album, + SubsonicDynamicPlaylist::QueryStat_Random)) + << GeneratorPtr(new SubsonicDynamicPlaylist( + tr("Frequently Played Albums"), + SubsonicDynamicPlaylist::QueryType_Album, + SubsonicDynamicPlaylist::QueryStat_Frequent)) + << GeneratorPtr(new SubsonicDynamicPlaylist( + tr("Top Rated Albums"), + SubsonicDynamicPlaylist::QueryType_Album, + SubsonicDynamicPlaylist::QueryStat_Highest)) + << GeneratorPtr(new SubsonicDynamicPlaylist( + tr("Recently Played Albums"), + SubsonicDynamicPlaylist::QueryType_Album, + SubsonicDynamicPlaylist::QueryStat_Recent)) + << GeneratorPtr(new SubsonicDynamicPlaylist( + tr("Starred Albums"), SubsonicDynamicPlaylist::QueryType_Album, + SubsonicDynamicPlaylist::QueryStat_Starred)) + << GeneratorPtr(new SubsonicDynamicPlaylist( + tr("Random Songs"), SubsonicDynamicPlaylist::QueryType_Song, + SubsonicDynamicPlaylist::QueryStat_Random)))); library_filter_ = new LibraryFilterWidget(0); library_filter_->SetSettingsGroup(kSettingsGroup); @@ -149,8 +144,8 @@ SubsonicService::SubsonicService(Application* app, InternetModel* parent) tr("Refresh catalogue"), this, SLOT(ReloadDatabase())); QAction* config_action = context_menu_->addAction( - IconLoader::Load("configure", IconLoader::Base), tr("Configure Subsonic..."), - this, SLOT(ShowConfig())); + IconLoader::Load("configure", IconLoader::Base), + tr("Configure Subsonic..."), this, SLOT(ShowConfig())); context_menu_->addSeparator(); context_menu_->addMenu(library_filter_->menu()); diff --git a/src/internet/subsonic/subsonicservice.h b/src/internet/subsonic/subsonicservice.h index b7a2d0915..6468f90cd 100644 --- a/src/internet/subsonic/subsonicservice.h +++ b/src/internet/subsonic/subsonicservice.h @@ -22,9 +22,8 @@ #ifndef INTERNET_SUBSONIC_SUBSONICSERVICE_H_ #define INTERNET_SUBSONIC_SUBSONICSERVICE_H_ -#include - #include +#include #include "internet/core/internetmodel.h" #include "internet/core/internetservice.h" @@ -130,8 +129,7 @@ class SubsonicService : public InternetService { static const int kMaxRedirects; static const int kCoverArtSize; - -signals: + signals: void LoginStateChanged(SubsonicService::LoginState newstate); private: @@ -192,7 +190,7 @@ class SubsonicLibraryScanner : public QObject { static const int kConcurrentRequests; static const int kCoverArtSize; -signals: + signals: void ScanFinished(); private slots: diff --git a/src/internet/subsonic/subsonicsettingspage.cpp b/src/internet/subsonic/subsonicsettingspage.cpp index 9c5fb41d5..6c202aac4 100644 --- a/src/internet/subsonic/subsonicsettingspage.cpp +++ b/src/internet/subsonic/subsonicsettingspage.cpp @@ -19,13 +19,13 @@ */ #include "subsonicsettingspage.h" -#include "ui_subsonicsettingspage.h" #include #include "core/logging.h" #include "internet/core/internetmodel.h" #include "ui/iconloader.h" +#include "ui_subsonicsettingspage.h" SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), diff --git a/src/internet/subsonic/subsonicsettingspage.h b/src/internet/subsonic/subsonicsettingspage.h index 836f8191c..5b77467f2 100644 --- a/src/internet/subsonic/subsonicsettingspage.h +++ b/src/internet/subsonic/subsonicsettingspage.h @@ -20,8 +20,8 @@ #ifndef INTERNET_SUBSONIC_SUBSONICSETTINGSPAGE_H_ #define INTERNET_SUBSONIC_SUBSONICSETTINGSPAGE_H_ -#include "ui/settingspage.h" #include "subsonicservice.h" +#include "ui/settingspage.h" class Ui_SubsonicSettingsPage; diff --git a/src/internet/subsonic/subsonicurlhandler.cpp b/src/internet/subsonic/subsonicurlhandler.cpp index f3a33faac..06932af9a 100644 --- a/src/internet/subsonic/subsonicurlhandler.cpp +++ b/src/internet/subsonic/subsonicurlhandler.cpp @@ -17,10 +17,11 @@ along with Clementine. If not, see . */ +#include "subsonicurlhandler.h" + #include #include "subsonicservice.h" -#include "subsonicurlhandler.h" SubsonicUrlHandler::SubsonicUrlHandler(SubsonicService* service, QObject* parent) diff --git a/src/internet/subsonic/subsonicurlhandler.h b/src/internet/subsonic/subsonicurlhandler.h index 290a6b4b9..c7eb69069 100644 --- a/src/internet/subsonic/subsonicurlhandler.h +++ b/src/internet/subsonic/subsonicurlhandler.h @@ -32,7 +32,9 @@ class SubsonicUrlHandler : public UrlHandler { SubsonicUrlHandler(SubsonicService* service, QObject* parent); QString scheme() const { return "subsonic"; } - QIcon icon() const { return IconLoader::Load("subsonic", IconLoader::Provider); } + QIcon icon() const { + return IconLoader::Load("subsonic", IconLoader::Provider); + } LoadResult StartLoading(const QUrl& url); // LoadResult LoadNext(const QUrl& url); diff --git a/src/library/directory.h b/src/library/directory.h index fcc44feed..cc28650d5 100644 --- a/src/library/directory.h +++ b/src/library/directory.h @@ -19,8 +19,8 @@ #define DIRECTORY_H #include -#include #include +#include class QSqlQuery; diff --git a/src/library/groupbydialog.cpp b/src/library/groupbydialog.cpp index e5f711b34..c494943e7 100644 --- a/src/library/groupbydialog.cpp +++ b/src/library/groupbydialog.cpp @@ -16,25 +16,25 @@ */ #include "groupbydialog.h" -#include "ui_groupbydialog.h" #include - #include +#include "ui_groupbydialog.h" + // boost::multi_index still relies on these being in the global namespace. using std::placeholders::_1; using std::placeholders::_2; -#include #include #include +#include using boost::multi_index_container; using boost::multi_index::indexed_by; +using boost::multi_index::member; using boost::multi_index::ordered_unique; using boost::multi_index::tag; -using boost::multi_index::member; namespace { @@ -56,10 +56,11 @@ class GroupByDialogPrivate { Mapping, indexed_by< ordered_unique, - member >, - ordered_unique, - member > > > MappingContainer; + member>, + ordered_unique< + tag, + member>>> + MappingContainer; public: MappingContainer mapping_; diff --git a/src/library/groupbydialog.h b/src/library/groupbydialog.h index e1b3e8e3d..58fcaf412 100644 --- a/src/library/groupbydialog.h +++ b/src/library/groupbydialog.h @@ -19,7 +19,6 @@ #define GROUPBYDIALOG_H #include - #include #include "librarymodel.h" @@ -38,7 +37,7 @@ class GroupByDialog : public QDialog { void LibraryGroupingChanged(const LibraryModel::Grouping& g); void accept(); -signals: + signals: void Accepted(const LibraryModel::Grouping& g); private slots: diff --git a/src/library/library.cpp b/src/library/library.cpp index c4705dddb..da4a829fb 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -68,15 +68,17 @@ Library::Library(Application* app, QObject* parent) Search::Sort_Random, SearchTerm::Field_Title, 50))) << GeneratorPtr(new QueryGenerator( QT_TRANSLATE_NOOP("Library", "Ever played"), - Search(Search::Type_And, Search::TermList() << SearchTerm( - SearchTerm::Field_PlayCount, - SearchTerm::Op_GreaterThan, 0), + Search(Search::Type_And, + Search::TermList() + << SearchTerm(SearchTerm::Field_PlayCount, + SearchTerm::Op_GreaterThan, 0), Search::Sort_Random, SearchTerm::Field_Title))) << GeneratorPtr(new QueryGenerator( QT_TRANSLATE_NOOP("Library", "Never played"), - Search(Search::Type_And, Search::TermList() << SearchTerm( - SearchTerm::Field_PlayCount, - SearchTerm::Op_Equals, 0), + Search(Search::Type_And, + Search::TermList() + << SearchTerm(SearchTerm::Field_PlayCount, + SearchTerm::Op_Equals, 0), Search::Sort_Random, SearchTerm::Field_Title))) << GeneratorPtr(new QueryGenerator( QT_TRANSLATE_NOOP("Library", "Last played"), diff --git a/src/library/library.h b/src/library/library.h index 056b0d088..90c55d735 100644 --- a/src/library/library.h +++ b/src/library/library.h @@ -18,11 +18,10 @@ #ifndef LIBRARY_H #define LIBRARY_H -#include - #include #include #include +#include #include "core/song.h" diff --git a/src/library/librarybackend.cpp b/src/library/librarybackend.cpp index 9b23ce01a..a40dca910 100644 --- a/src/library/librarybackend.cpp +++ b/src/library/librarybackend.cpp @@ -16,14 +16,6 @@ */ #include "librarybackend.h" -#include "libraryquery.h" -#include "sqlrow.h" -#include "core/application.h" -#include "core/database.h" -#include "core/scopedtransaction.h" -#include "core/tagreaderclient.h" -#include "core/utilities.h" -#include "smartplaylists/search.h" #include #include @@ -33,6 +25,15 @@ #include #include +#include "core/application.h" +#include "core/database.h" +#include "core/scopedtransaction.h" +#include "core/tagreaderclient.h" +#include "core/utilities.h" +#include "libraryquery.h" +#include "smartplaylists/search.h" +#include "sqlrow.h" + const char* LibraryBackend::kSettingsGroup = "LibraryBackend"; const char* LibraryBackend::kNewScoreSql = @@ -117,7 +118,8 @@ void LibraryBackend::ChangeDirPath(int id, const QString& old_path, // Do the dirs table QSqlQuery q(db); - q.prepare(QString("UPDATE %1 SET path=:path WHERE ROWID=:id").arg(dirs_table_)); + q.prepare( + QString("UPDATE %1 SET path=:path WHERE ROWID=:id").arg(dirs_table_)); q.bindValue(":path", new_path); q.bindValue(":id", id); q.exec(); @@ -130,11 +132,10 @@ void LibraryBackend::ChangeDirPath(int id, const QString& old_path, // Do the subdirs table q = QSqlQuery(db); - q.prepare(QString( - "UPDATE %1 SET path=:path || substr(path, %2)" + q.prepare(QString("UPDATE %1 SET path=:path || substr(path, %2)" " WHERE directory=:id") - .arg(subdirs_table_) - .arg(path_len)); + .arg(subdirs_table_) + .arg(path_len)); q.bindValue(":path", new_url); q.bindValue(":id", id); q.exec(); @@ -142,11 +143,10 @@ void LibraryBackend::ChangeDirPath(int id, const QString& old_path, // Do the songs table q = QSqlQuery(db); - q.prepare(QString( - "UPDATE %1 SET filename=:path || substr(filename, %2)" + q.prepare(QString("UPDATE %1 SET filename=:path || substr(filename, %2)" " WHERE directory=:id") - .arg(songs_table_) - .arg(path_len)); + .arg(songs_table_) + .arg(path_len)); q.bindValue(":path", new_url); q.bindValue(":id", id); q.exec(); @@ -184,9 +184,9 @@ SubdirectoryList LibraryBackend::SubdirsInDirectory(int id) { SubdirectoryList LibraryBackend::SubdirsInDirectory(int id, QSqlDatabase& db) { QSqlQuery q(db); - q.prepare(QString( - "SELECT path, mtime FROM %1" - " WHERE directory = :dir").arg(subdirs_table_)); + q.prepare(QString("SELECT path, mtime FROM %1" + " WHERE directory = :dir") + .arg(subdirs_table_)); q.bindValue(":dir", id); q.exec(); if (db_->CheckErrors(q)) return SubdirectoryList(); @@ -209,7 +209,7 @@ void LibraryBackend::UpdateTotalSongCount() { QSqlQuery q(db); q.prepare(QString("SELECT COUNT(*) FROM %1 WHERE unavailable = 0") - .arg(songs_table_)); + .arg(songs_table_)); q.exec(); if (db_->CheckErrors(q)) return; if (!q.next()) return; @@ -231,9 +231,9 @@ void LibraryBackend::AddDirectory(const QString& path) { QSqlDatabase db(db_->Connect()); QSqlQuery q(db); - q.prepare(QString( - "INSERT INTO %1 (path, subdirs)" - " VALUES (:path, 1)").arg(dirs_table_)); + q.prepare(QString("INSERT INTO %1 (path, subdirs)" + " VALUES (:path, 1)") + .arg(dirs_table_)); q.bindValue(":path", db_path); q.exec(); if (db_->CheckErrors(q)) return; @@ -256,7 +256,8 @@ void LibraryBackend::RemoveDirectory(int dir_id) { // Delete the subdirs that were in this directory QSqlQuery q(db); - q.prepare(QString("DELETE FROM %1 WHERE directory = :id").arg(subdirs_table_)); + q.prepare( + QString("DELETE FROM %1 WHERE directory = :id").arg(subdirs_table_)); q.bindValue(":id", dir_id); q.exec(); if (db_->CheckErrors(q)) return; @@ -278,9 +279,9 @@ SongList LibraryBackend::FindSongsInDirectory(int id) { QSqlDatabase db(db_->Connect()); QSqlQuery q(db); - q.prepare( - QString("SELECT ROWID, " + Song::kColumnSpec + - " FROM %1 WHERE directory = :directory").arg(songs_table_)); + q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + + " FROM %1 WHERE directory = :directory") + .arg(songs_table_)); q.bindValue(":directory", id); q.exec(); if (db_->CheckErrors(q)) return SongList(); @@ -308,21 +309,21 @@ void LibraryBackend::AddOrUpdateSubdirs(const SubdirectoryList& subdirs) { QMutexLocker l(db_->Mutex()); QSqlDatabase db(db_->Connect()); QSqlQuery find_query(db); - find_query.prepare(QString( - "SELECT ROWID FROM %1" - " WHERE directory = :id AND path = :path").arg(subdirs_table_)); + find_query.prepare(QString("SELECT ROWID FROM %1" + " WHERE directory = :id AND path = :path") + .arg(subdirs_table_)); QSqlQuery add_query(db); - add_query.prepare(QString( - "INSERT INTO %1 (directory, path, mtime)" - " VALUES (:id, :path, :mtime)").arg(subdirs_table_)); + add_query.prepare(QString("INSERT INTO %1 (directory, path, mtime)" + " VALUES (:id, :path, :mtime)") + .arg(subdirs_table_)); QSqlQuery update_query(db); - update_query.prepare(QString( - "UPDATE %1 SET mtime = :mtime" - " WHERE directory = :id AND path = :path").arg(subdirs_table_)); + update_query.prepare(QString("UPDATE %1 SET mtime = :mtime" + " WHERE directory = :id AND path = :path") + .arg(subdirs_table_)); QSqlQuery delete_query(db); - delete_query.prepare(QString( - "DELETE FROM %1" - " WHERE directory = :id AND path = :path").arg(subdirs_table_)); + delete_query.prepare(QString("DELETE FROM %1" + " WHERE directory = :id AND path = :path") + .arg(subdirs_table_)); ScopedTransaction transaction(&db); for (const Subdirectory& subdir : subdirs) { @@ -362,23 +363,29 @@ void LibraryBackend::AddOrUpdateSongs(const SongList& songs) { QSqlDatabase db(db_->Connect()); QSqlQuery check_dir(db); - check_dir.prepare(QString("SELECT ROWID FROM %1 WHERE ROWID = :id").arg(dirs_table_)); + check_dir.prepare( + QString("SELECT ROWID FROM %1 WHERE ROWID = :id").arg(dirs_table_)); QSqlQuery add_song(db); add_song.prepare(QString("INSERT INTO %1 (" + Song::kColumnSpec + - ")" - " VALUES (" + - Song::kBindSpec + ")").arg(songs_table_)); + ")" + " VALUES (" + + Song::kBindSpec + ")") + .arg(songs_table_)); QSqlQuery update_song(db); - update_song.prepare(QString("UPDATE %1 SET " + Song::kUpdateSpec + - " WHERE ROWID = :id").arg(songs_table_)); + update_song.prepare( + QString("UPDATE %1 SET " + Song::kUpdateSpec + " WHERE ROWID = :id") + .arg(songs_table_)); QSqlQuery add_song_fts(db); - add_song_fts.prepare(QString("INSERT INTO %1 (ROWID, " + Song::kFtsColumnSpec + - ")" - " VALUES (:id, " + - Song::kFtsBindSpec + ")").arg(fts_table_)); + add_song_fts.prepare(QString("INSERT INTO %1 (ROWID, " + + Song::kFtsColumnSpec + + ")" + " VALUES (:id, " + + Song::kFtsBindSpec + ")") + .arg(fts_table_)); QSqlQuery update_song_fts(db); - update_song_fts.prepare(QString("UPDATE %1 SET " + Song::kFtsUpdateSpec + - " WHERE ROWID = :id").arg(fts_table_)); + update_song_fts.prepare( + QString("UPDATE %1 SET " + Song::kFtsUpdateSpec + " WHERE ROWID = :id") + .arg(fts_table_)); ScopedTransaction transaction(&db); @@ -453,7 +460,7 @@ void LibraryBackend::UpdateMTimesOnly(const SongList& songs) { QSqlQuery q(db); q.prepare(QString("UPDATE %1 SET mtime = :mtime WHERE ROWID = :id") - .arg(songs_table_)); + .arg(songs_table_)); ScopedTransaction transaction(&db); for (const Song& song : songs) { @@ -472,7 +479,8 @@ void LibraryBackend::DeleteSongs(const SongList& songs) { QSqlQuery remove(db); remove.prepare(QString("DELETE FROM %1 WHERE ROWID = :id").arg(songs_table_)); QSqlQuery remove_fts(db); - remove_fts.prepare(QString("DELETE FROM %1 WHERE ROWID = :id").arg(fts_table_)); + remove_fts.prepare( + QString("DELETE FROM %1 WHERE ROWID = :id").arg(fts_table_)); ScopedTransaction transaction(&db); for (const Song& song : songs) { @@ -498,8 +506,8 @@ void LibraryBackend::MarkSongsUnavailable(const SongList& songs, QSqlQuery remove(db); remove.prepare(QString("UPDATE %1 SET unavailable = %2 WHERE ROWID = :id") - .arg(songs_table_) - .arg(int(unavailable))); + .arg(songs_table_) + .arg(int(unavailable))); ScopedTransaction transaction(&db); for (const Song& song : songs) { @@ -646,7 +654,7 @@ SongList LibraryBackend::GetSongsByForeignId(const QStringList& ids, QSqlQuery q(db); q.prepare( - QString( + QString( "SELECT %2.ROWID, " + Song::kColumnSpec + ", %2.%3" " FROM %2, %1" @@ -678,8 +686,9 @@ SongList LibraryBackend::GetSongsById(const QStringList& ids, QSqlQuery q(db); q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + - " FROM %1" - " WHERE ROWID IN (%2)").arg(songs_table_, in)); + " FROM %1" + " WHERE ROWID IN (%2)") + .arg(songs_table_, in)); q.exec(); if (db_->CheckErrors(q)) return SongList(); @@ -755,10 +764,9 @@ void LibraryBackend::UpdateCompilations() { // directory QSqlQuery q(db); - q.prepare( - QString( - "SELECT effective_albumartist, album, filename, sampler " - "FROM %1 WHERE unavailable = 0 ORDER BY album").arg(songs_table_)); + q.prepare(QString("SELECT effective_albumartist, album, filename, sampler " + "FROM %1 WHERE unavailable = 0 ORDER BY album") + .arg(songs_table_)); q.exec(); if (db_->CheckErrors(q)) return; @@ -980,10 +988,9 @@ void LibraryBackend::UpdateManualAlbumArt(const QString& artist, } // Update the songs - QString sql( - QString( - "UPDATE %1 SET art_manual = :art" - " WHERE album = :album AND unavailable = 0").arg(songs_table_)); + QString sql(QString("UPDATE %1 SET art_manual = :art" + " WHERE album = :album AND unavailable = 0") + .arg(songs_table_)); if (!albumartist.isNull() && !albumartist.isEmpty()) { sql += " AND albumartist = :albumartist"; } else if (!artist.isNull()) { @@ -1047,7 +1054,8 @@ void LibraryBackend::ForceCompilation(const QString& album, " forced_compilation_off = :forced_compilation_off," " effective_compilation = ((compilation OR sampler OR " ":forced_compilation_on) AND NOT :forced_compilation_off) + 0" - " WHERE album = :album AND unavailable = 0").arg(songs_table_)); + " WHERE album = :album AND unavailable = 0") + .arg(songs_table_)); if (!artist.isEmpty()) sql += " AND artist = :artist"; QSqlQuery q(db); @@ -1118,12 +1126,11 @@ void LibraryBackend::IncrementPlayCount(int id) { QSqlDatabase db(db_->Connect()); QSqlQuery q(db); - q.prepare(QString( - "UPDATE %1 SET playcount = playcount + 1," - " lastplayed = :now," - " score = " + - QString(kNewScoreSql).arg("1.0") + - " WHERE ROWID = :id").arg(songs_table_)); + q.prepare(QString("UPDATE %1 SET playcount = playcount + 1," + " lastplayed = :now," + " score = " + + QString(kNewScoreSql).arg("1.0") + " WHERE ROWID = :id") + .arg(songs_table_)); q.bindValue(":now", QDateTime::currentDateTime().toTime_t()); q.bindValue(":id", id); q.exec(); @@ -1141,11 +1148,10 @@ void LibraryBackend::IncrementSkipCount(int id, float progress) { QSqlDatabase db(db_->Connect()); QSqlQuery q(db); - q.prepare(QString( - "UPDATE %1 SET skipcount = skipcount + 1," - " score = " + - QString(kNewScoreSql).arg(progress) + - " WHERE ROWID = :id").arg(songs_table_)); + q.prepare(QString("UPDATE %1 SET skipcount = skipcount + 1," + " score = " + + QString(kNewScoreSql).arg(progress) + " WHERE ROWID = :id") + .arg(songs_table_)); q.bindValue(":id", id); q.exec(); if (db_->CheckErrors(q)) return; @@ -1161,10 +1167,10 @@ void LibraryBackend::ResetStatistics(int id) { QSqlDatabase db(db_->Connect()); QSqlQuery q(db); - q.prepare(QString( - "UPDATE %1 SET playcount = 0, skipcount = 0," - " lastplayed = -1, score = 0" - " WHERE ROWID = :id").arg(songs_table_)); + q.prepare(QString("UPDATE %1 SET playcount = 0, skipcount = 0," + " lastplayed = -1, score = 0" + " WHERE ROWID = :id") + .arg(songs_table_)); q.bindValue(":id", id); q.exec(); if (db_->CheckErrors(q)) return; @@ -1194,9 +1200,9 @@ void LibraryBackend::UpdateSongsRating(const QList& id_list, } QString ids = id_str_list.join(","); QSqlQuery q(db); - q.prepare(QString( - "UPDATE %1 SET rating = :rating" - " WHERE ROWID IN (%2)").arg(songs_table_, ids)); + q.prepare(QString("UPDATE %1 SET rating = :rating" + " WHERE ROWID IN (%2)") + .arg(songs_table_, ids)); q.bindValue(":rating", rating); q.exec(); if (db_->CheckErrors(q)) return; diff --git a/src/library/librarybackend.h b/src/library/librarybackend.h index 8bce999cf..1f965eafe 100644 --- a/src/library/librarybackend.h +++ b/src/library/librarybackend.h @@ -18,14 +18,14 @@ #ifndef LIBRARYBACKEND_H #define LIBRARYBACKEND_H +#include #include #include #include -#include +#include "core/song.h" #include "directory.h" #include "libraryquery.h" -#include "core/song.h" class Database; @@ -223,7 +223,7 @@ class LibraryBackend : public LibraryBackendInterface { // Tells the library model that a song path has changed void SongPathChanged(const Song& song, const QFileInfo& new_file); -signals: + signals: void DirectoryDiscovered(const Directory& dir, const SubdirectoryList& subdirs); void DirectoryDeleted(int dir_id); diff --git a/src/library/librarydirectorymodel.cpp b/src/library/librarydirectorymodel.cpp index 34d72c09d..4bba7339f 100644 --- a/src/library/librarydirectorymodel.cpp +++ b/src/library/librarydirectorymodel.cpp @@ -16,11 +16,12 @@ */ #include "librarydirectorymodel.h" -#include "librarybackend.h" + #include "core/application.h" #include "core/filesystemmusicstorage.h" #include "core/musicstorage.h" #include "core/utilities.h" +#include "librarybackend.h" #include "ui/iconloader.h" LibraryDirectoryModel::LibraryDirectoryModel( @@ -49,7 +50,7 @@ void LibraryDirectoryModel::DirectoryDiscovered(const Directory& dir) { item->setData(dir.id, kIdRole); item->setIcon(dir_icon_); storage_ << std::shared_ptr( - new FilesystemMusicStorage(dir.path)); + new FilesystemMusicStorage(dir.path)); appendRow(item); } diff --git a/src/library/librarydirectorymodel.h b/src/library/librarydirectorymodel.h index 3bbde3a0b..85d6ac7be 100644 --- a/src/library/librarydirectorymodel.h +++ b/src/library/librarydirectorymodel.h @@ -18,10 +18,9 @@ #ifndef LIBRARYDIRECTORYMODEL_H #define LIBRARYDIRECTORYMODEL_H -#include - #include #include +#include #include "directory.h" @@ -52,7 +51,7 @@ class LibraryDirectoryModel : public QStandardItemModel { QIcon dir_icon_; std::shared_ptr backend_; - QList > storage_; + QList> storage_; }; #endif // LIBRARYDIRECTORYMODEL_H diff --git a/src/library/libraryfilterwidget.cpp b/src/library/libraryfilterwidget.cpp index 80accce71..db9afdd4e 100644 --- a/src/library/libraryfilterwidget.cpp +++ b/src/library/libraryfilterwidget.cpp @@ -16,13 +16,6 @@ */ #include "libraryfilterwidget.h" -#include "librarymodel.h" -#include "libraryquery.h" -#include "groupbydialog.h" -#include "ui_libraryfilterwidget.h" -#include "core/song.h" -#include "ui/iconloader.h" -#include "ui/settingsdialog.h" #include #include @@ -32,6 +25,14 @@ #include #include +#include "core/song.h" +#include "groupbydialog.h" +#include "librarymodel.h" +#include "libraryquery.h" +#include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_libraryfilterwidget.h" + LibraryFilterWidget::LibraryFilterWidget(QWidget* parent) : QWidget(parent), ui_(new Ui_LibraryFilterWidget), @@ -132,10 +133,10 @@ QActionGroup* LibraryFilterWidget::CreateGroupByActions(QObject* parent) { CreateGroupByAction(tr("Group by Artist/Album"), parent, LibraryModel::Grouping(LibraryModel::GroupBy_Artist, LibraryModel::GroupBy_Album))); - ret->addAction( - CreateGroupByAction(tr("Group by Album artist/Album"), parent, - LibraryModel::Grouping(LibraryModel::GroupBy_AlbumArtist, - LibraryModel::GroupBy_Album))); + ret->addAction(CreateGroupByAction( + tr("Group by Album artist/Album"), parent, + LibraryModel::Grouping(LibraryModel::GroupBy_AlbumArtist, + LibraryModel::GroupBy_Album))); ret->addAction(CreateGroupByAction( tr("Group by Artist/Year - Album"), parent, LibraryModel::Grouping(LibraryModel::GroupBy_Artist, diff --git a/src/library/libraryfilterwidget.h b/src/library/libraryfilterwidget.h index c5c1b2f66..836d3a5a6 100644 --- a/src/library/libraryfilterwidget.h +++ b/src/library/libraryfilterwidget.h @@ -18,10 +18,9 @@ #ifndef LIBRARYFILTERWIDGET_H #define LIBRARYFILTERWIDGET_H -#include - #include #include +#include #include "librarymodel.h" #include "savedgroupingmanager.h" @@ -74,7 +73,7 @@ class LibraryFilterWidget : public QWidget { void SetQueryMode(QueryOptions::QueryMode view); void FocusOnFilter(QKeyEvent* e); -signals: + signals: void UpPressed(); void DownPressed(); void ReturnPressed(); diff --git a/src/library/libraryitem.h b/src/library/libraryitem.h index 9461d83eb..a41095951 100644 --- a/src/library/libraryitem.h +++ b/src/library/libraryitem.h @@ -18,8 +18,8 @@ #ifndef LIBRARYITEM_H #define LIBRARYITEM_H -#include #include +#include #include "core/simpletreeitem.h" #include "core/song.h" diff --git a/src/library/librarymodel.cpp b/src/library/librarymodel.cpp index 580bfd458..68579d90f 100644 --- a/src/library/librarymodel.cpp +++ b/src/library/librarymodel.cpp @@ -17,9 +17,6 @@ #include "librarymodel.h" -#include -#include - #include #include #include @@ -30,21 +27,23 @@ #include #include #include +#include +#include -#include "librarybackend.h" -#include "libraryitem.h" -#include "libraryview.h" -#include "sqlrow.h" #include "core/application.h" #include "core/database.h" #include "core/logging.h" #include "core/taskmanager.h" #include "core/utilities.h" #include "covers/albumcoverloader.h" +#include "librarybackend.h" +#include "libraryitem.h" +#include "libraryview.h" #include "playlist/songmimedata.h" #include "smartplaylists/generator.h" #include "smartplaylists/generatormimedata.h" #include "smartplaylists/querygenerator.h" +#include "sqlrow.h" #include "ui/iconloader.h" using std::placeholders::_1; @@ -108,10 +107,9 @@ LibraryModel::LibraryModel(std::shared_ptr backend, icon_cache_->setMaximumCacheSize(LibraryModel::kIconCacheSize); QIcon nocover = IconLoader::Load("nocover", IconLoader::Other); - no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()).scaled( - kPrettyCoverSize, kPrettyCoverSize, - Qt::KeepAspectRatio, - Qt::SmoothTransformation); + no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()) + .scaled(kPrettyCoverSize, kPrettyCoverSize, + Qt::KeepAspectRatio, Qt::SmoothTransformation); connect(backend_.get(), SIGNAL(SongsDiscovered(SongList)), SLOT(SongsDiscovered(SongList))); @@ -388,8 +386,8 @@ QString LibraryModel::DividerDisplayText(GroupBy type, return QString::number(key.toInt()); // To remove leading 0s case GroupBy_None: - // fallthrough - ; + // fallthrough + ; } qLog(Error) << "Unknown GroupBy type" << type << "for divider key" << key; return QString(); @@ -653,8 +651,8 @@ QVariant LibraryModel::data(const LibraryItem* item, int role) const { case Role_Editable: if (!item->lazy_loaded) { - const_cast(this) - ->LazyPopulate(const_cast(item), true); + const_cast(this)->LazyPopulate( + const_cast(item), true); } if (item->type == LibraryItem::Type_Container) { diff --git a/src/library/librarymodel.h b/src/library/librarymodel.h index 2268b1241..b45ce0239 100644 --- a/src/library/librarymodel.h +++ b/src/library/librarymodel.h @@ -18,23 +18,22 @@ #ifndef LIBRARYMODEL_H #define LIBRARYMODEL_H -#include - #include #include #include #include +#include -#include "libraryitem.h" -#include "libraryquery.h" -#include "librarywatcher.h" -#include "sqlrow.h" #include "core/simpletreemodel.h" #include "core/song.h" #include "covers/albumcoverloaderoptions.h" #include "engines/engine_fwd.h" +#include "libraryitem.h" +#include "libraryquery.h" +#include "librarywatcher.h" #include "playlist/playlistmanager.h" #include "smartplaylists/generator_fwd.h" +#include "sqlrow.h" class Application; class AlbumCoverLoader; @@ -175,7 +174,7 @@ class LibraryModel : public SimpleTreeModel { static QString SortTextForNumber(int year); static QString SortTextForSong(const Song& song); -signals: + signals: void TotalSongCountUpdated(int count); void GroupingChanged(const LibraryModel::Grouping& g); diff --git a/src/library/libraryplaylistitem.cpp b/src/library/libraryplaylistitem.cpp index 57eccf174..a5d556a7a 100644 --- a/src/library/libraryplaylistitem.cpp +++ b/src/library/libraryplaylistitem.cpp @@ -16,10 +16,11 @@ */ #include "libraryplaylistitem.h" -#include "core/tagreaderclient.h" #include +#include "core/tagreaderclient.h" + LibraryPlaylistItem::LibraryPlaylistItem(const QString& type) : DbPlaylistItem(type) {} diff --git a/src/library/libraryplaylistitem.h b/src/library/libraryplaylistitem.h index de9ca0008..b27763455 100644 --- a/src/library/libraryplaylistitem.h +++ b/src/library/libraryplaylistitem.h @@ -27,7 +27,7 @@ class LibraryPlaylistItem : public DbPlaylistItem { LibraryPlaylistItem(const Song& song); static bool IsTypeSupported(const QString& type); - + bool InitFromQuery(const SqlRow& query); void Reload(); diff --git a/src/library/libraryquery.cpp b/src/library/libraryquery.cpp index fea6d0d6c..66798c97a 100644 --- a/src/library/libraryquery.cpp +++ b/src/library/libraryquery.cpp @@ -16,11 +16,12 @@ */ #include "libraryquery.h" -#include "core/song.h" -#include #include #include +#include + +#include "core/song.h" QueryOptions::QueryOptions() : max_age_(-1), query_mode_(QueryMode_All) {} @@ -220,8 +221,8 @@ void LibraryQuery::AddCompilationRequirement(bool compilation) { // which gives very poor performance. See // https://github.com/clementine-player/Clementine/pull/4285 for // more details. - where_clauses_ << QString("+effective_compilation = %1") - .arg(compilation ? 1 : 0); + where_clauses_ + << QString("+effective_compilation = %1").arg(compilation ? 1 : 0); } QSqlQuery LibraryQuery::Exec(QSqlDatabase db, const QString& songs_table, diff --git a/src/library/libraryquery.h b/src/library/libraryquery.h index ccab5a118..ead5227b9 100644 --- a/src/library/libraryquery.h +++ b/src/library/libraryquery.h @@ -18,10 +18,10 @@ #ifndef LIBRARYQUERY_H #define LIBRARYQUERY_H -#include -#include #include +#include #include +#include #include class Song; diff --git a/src/library/librarysettingspage.cpp b/src/library/librarysettingspage.cpp index afb73df41..91a86149b 100644 --- a/src/library/librarysettingspage.cpp +++ b/src/library/librarysettingspage.cpp @@ -17,24 +17,24 @@ #include "librarysettingspage.h" -#include "librarybackend.h" -#include "librarydirectorymodel.h" -#include "librarymodel.h" -#include "libraryview.h" -#include "librarywatcher.h" -#include "ui_librarysettingspage.h" -#include "core/application.h" -#include "core/utilities.h" -#include "playlist/playlistdelegates.h" -#include "ui/iconloader.h" -#include "ui/settingsdialog.h" - #include #include #include #include #include +#include "core/application.h" +#include "core/utilities.h" +#include "librarybackend.h" +#include "librarydirectorymodel.h" +#include "librarymodel.h" +#include "libraryview.h" +#include "librarywatcher.h" +#include "playlist/playlistdelegates.h" +#include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_librarysettingspage.h" + const char* LibrarySettingsPage::kSettingsGroup = "LibraryConfig"; LibrarySettingsPage::LibrarySettingsPage(SettingsDialog* dialog) @@ -60,10 +60,10 @@ void LibrarySettingsPage::Add() { QSettings settings; settings.beginGroup(kSettingsGroup); - QString path( - settings.value("last_path", Utilities::GetConfigPath( - Utilities::Path_DefaultMusicLibrary)) - .toString()); + QString path(settings + .value("last_path", Utilities::GetConfigPath( + Utilities::Path_DefaultMusicLibrary)) + .toString()); path = QFileDialog::getExistingDirectory(this, tr("Add directory..."), path); if (!path.isNull()) { @@ -134,9 +134,9 @@ void LibrarySettingsPage::Load() { ui_->startup_scan->setChecked(s.value("startup_scan", true).toBool()); ui_->monitor->setChecked(s.value("monitor", true).toBool()); - QStringList filters = - s.value("cover_art_patterns", QStringList() << "front" - << "cover").toStringList(); + QStringList filters = s.value("cover_art_patterns", QStringList() << "front" + << "cover") + .toStringList(); ui_->cover_art_patterns->setText(filters.join(",")); s.endGroup(); diff --git a/src/library/libraryview.cpp b/src/library/libraryview.cpp index 14948ccaf..2153fee3d 100644 --- a/src/library/libraryview.cpp +++ b/src/library/libraryview.cpp @@ -17,22 +17,17 @@ #include "libraryview.h" -#include #include #include #include #include +#include #include #include #include #include #include -#include "librarydirectorymodel.h" -#include "libraryfilterwidget.h" -#include "librarymodel.h" -#include "libraryitem.h" -#include "librarybackend.h" #include "core/application.h" #include "core/deletefiles.h" #include "core/logging.h" @@ -41,6 +36,11 @@ #include "core/utilities.h" #include "devices/devicemanager.h" #include "devices/devicestatefiltermodel.h" +#include "librarybackend.h" +#include "librarydirectorymodel.h" +#include "libraryfilterwidget.h" +#include "libraryitem.h" +#include "librarymodel.h" #include "smartplaylists/wizard.h" #include "ui/iconloader.h" #include "ui/organisedialog.h" @@ -193,10 +193,9 @@ LibraryView::~LibraryView() {} void LibraryView::SaveFocus() { QModelIndex current = currentIndex(); QVariant type = model()->data(current, LibraryModel::Role_Type); - if (!type.isValid() || - !(type.toInt() == LibraryItem::Type_Song || - type.toInt() == LibraryItem::Type_Container || - type.toInt() == LibraryItem::Type_Divider)) { + if (!type.isValid() || !(type.toInt() == LibraryItem::Type_Song || + type.toInt() == LibraryItem::Type_Container || + type.toInt() == LibraryItem::Type_Divider)) { return; } @@ -219,10 +218,10 @@ void LibraryView::SaveFocus() { case LibraryItem::Type_Container: case LibraryItem::Type_Divider: { - QString text = - model()->data(current, LibraryModel::Role_Key).toString(); + QString text = model()->data(current, LibraryModel::Role_Key).toString(); last_selected_container_ = text; - last_selected_text_ = model()->data(current, LibraryModel::Role_DisplayText).toString(); + last_selected_text_ = + model()->data(current, LibraryModel::Role_DisplayText).toString(); break; } @@ -236,9 +235,8 @@ void LibraryView::SaveFocus() { void LibraryView::SaveContainerPath(const QModelIndex& child) { QModelIndex current = model()->parent(child); QVariant type = model()->data(current, LibraryModel::Role_Type); - if (!type.isValid() || - !(type.toInt() == LibraryItem::Type_Container || - type.toInt() == LibraryItem::Type_Divider)) { + if (!type.isValid() || !(type.toInt() == LibraryItem::Type_Container || + type.toInt() == LibraryItem::Type_Divider)) { return; } @@ -266,8 +264,9 @@ bool LibraryView::RestoreLevelFocus(const QModelIndex& parent) { switch (type.toInt()) { case LibraryItem::Type_Song: if (!last_selected_song_.url().isEmpty()) { - QModelIndex index = qobject_cast(model()) - ->mapToSource(current); + QModelIndex index = + qobject_cast(model())->mapToSource( + current); SongList songs = app_->library_model()->GetChildSongs(index); for (const Song& song : songs) { if (song == last_selected_song_) { @@ -452,8 +451,9 @@ void LibraryView::contextMenuEvent(QContextMenuEvent* e) { context_menu_index_ = indexAt(e->pos()); if (!context_menu_index_.isValid()) return; - context_menu_index_ = qobject_cast(model()) - ->mapToSource(context_menu_index_); + context_menu_index_ = + qobject_cast(model())->mapToSource( + context_menu_index_); QModelIndexList selected_indexes = qobject_cast(model()) @@ -659,8 +659,8 @@ SongList LibraryView::GetSelectedSongs() const { void LibraryView::Organise() { if (!organise_dialog_) - organise_dialog_.reset(new OrganiseDialog(app_->task_manager(), - app_->library_backend())); + organise_dialog_.reset( + new OrganiseDialog(app_->task_manager(), app_->library_backend())); organise_dialog_->SetDestinationModel(app_->directory_model()); organise_dialog_->SetCopy(false); diff --git a/src/library/libraryview.h b/src/library/libraryview.h index 46945cb2d..d079b7f06 100644 --- a/src/library/libraryview.h +++ b/src/library/libraryview.h @@ -18,9 +18,8 @@ #ifndef LIBRARYVIEW_H #define LIBRARYVIEW_H -#include - #include +#include #include "core/song.h" #include "ui/edittagdialog.h" @@ -79,7 +78,7 @@ class LibraryView : public AutoExpandingTreeView { void SaveFocus(); void RestoreFocus(); -signals: + signals: void ShowConfigDialog(); protected: diff --git a/src/library/libraryviewcontainer.cpp b/src/library/libraryviewcontainer.cpp index f58f3e459..01e8b8a97 100644 --- a/src/library/libraryviewcontainer.cpp +++ b/src/library/libraryviewcontainer.cpp @@ -16,8 +16,9 @@ */ #include "libraryviewcontainer.h" -#include "ui_libraryviewcontainer.h" + #include "globalsearch/globalsearch.h" +#include "ui_libraryviewcontainer.h" LibraryViewContainer::LibraryViewContainer(QWidget* parent) : QWidget(parent), ui_(new Ui_LibraryViewContainer) { diff --git a/src/library/librarywatcher.cpp b/src/library/librarywatcher.cpp index 0c1d4d2bb..c1d2b281f 100644 --- a/src/library/librarywatcher.cpp +++ b/src/library/librarywatcher.cpp @@ -17,13 +17,8 @@ #include "librarywatcher.h" -#include "librarybackend.h" -#include "core/filesystemwatcherinterface.h" -#include "core/logging.h" -#include "core/tagreaderclient.h" -#include "core/taskmanager.h" -#include "core/utilities.h" -#include "playlistparsers/cueparser.h" +#include +#include #include #include @@ -35,8 +30,13 @@ #include #include -#include -#include +#include "core/filesystemwatcherinterface.h" +#include "core/logging.h" +#include "core/tagreaderclient.h" +#include "core/taskmanager.h" +#include "core/utilities.h" +#include "librarybackend.h" +#include "playlistparsers/cueparser.h" // This is defined by one of the windows headers that is included by taglib. #ifdef RemoveDirectory @@ -44,9 +44,9 @@ #endif namespace { -static const char *kNoMediaFile = ".nomedia"; -static const char *kNoMusicFile = ".nomusic"; -} +static const char* kNoMediaFile = ".nomedia"; +static const char* kNoMusicFile = ".nomusic"; +} // namespace static const int kUnfilteredImageLimit = 10; @@ -263,7 +263,7 @@ void LibraryWatcher::ScanSubdirectory(const QString& path, ScanTransaction* t, bool force_noincremental) { QFileInfo path_info(path); - QDir path_dir(path); + QDir path_dir(path); // Do not scan symlinked dirs that are already in collection if (path_info.isSymLink()) { @@ -277,8 +277,7 @@ void LibraryWatcher::ScanSubdirectory(const QString& path, } // Do not scan directories containing a .nomedia or .nomusic file - if (path_dir.exists(kNoMediaFile) || - path_dir.exists(kNoMusicFile)) { + if (path_dir.exists(kNoMediaFile) || path_dir.exists(kNoMusicFile)) { t->AddToProgress(1); return; } @@ -550,7 +549,8 @@ SongList LibraryWatcher::ScanNewFile(const QString& file, const QString& path, // valid and we don't want invalid media getting into library! QString file_nfd = file.normalized(QString::NormalizationForm_D); for (const Song& cue_song : cue_parser_->Load(&cue, matching_cue, path)) { - if (cue_song.url().toLocalFile().normalized(QString::NormalizationForm_D) == file_nfd) { + if (cue_song.url().toLocalFile().normalized( + QString::NormalizationForm_D) == file_nfd) { if (TagReaderClient::Instance()->IsMediaFileBlocking(file)) { song_list << cue_song; } @@ -824,9 +824,9 @@ void LibraryWatcher::ReloadSettings() { monitor_ = s.value("monitor", true).toBool(); best_image_filters_.clear(); - QStringList filters = - s.value("cover_art_patterns", QStringList() << "front" - << "cover").toStringList(); + QStringList filters = s.value("cover_art_patterns", QStringList() << "front" + << "cover") + .toStringList(); for (const QString& filter : filters) { QString s = filter.trimmed(); if (!s.isEmpty()) best_image_filters_ << s; diff --git a/src/library/librarywatcher.h b/src/library/librarywatcher.h index 92f18d4d9..49b9e14fb 100644 --- a/src/library/librarywatcher.h +++ b/src/library/librarywatcher.h @@ -18,15 +18,15 @@ #ifndef LIBRARYWATCHER_H #define LIBRARYWATCHER_H -#include "directory.h" -#include "core/song.h" - #include #include #include #include #include +#include "core/song.h" +#include "directory.h" + class QFileSystemWatcher; class QTimer; diff --git a/src/library/savedgroupingmanager.cpp b/src/library/savedgroupingmanager.cpp index 6ae69e077..836ea652d 100644 --- a/src/library/savedgroupingmanager.cpp +++ b/src/library/savedgroupingmanager.cpp @@ -15,17 +15,18 @@ along with Clementine. If not, see . */ -#include "libraryfilterwidget.h" -#include "librarymodel.h" #include "savedgroupingmanager.h" -#include "ui_savedgroupingmanager.h" -#include "ui/iconloader.h" #include #include #include #include +#include "libraryfilterwidget.h" +#include "librarymodel.h" +#include "ui/iconloader.h" +#include "ui_savedgroupingmanager.h" + SavedGroupingManager::SavedGroupingManager(QWidget* parent) : QDialog(parent), ui_(new Ui_SavedGroupingManager), @@ -100,7 +101,9 @@ QString SavedGroupingManager::GroupByToString(const LibraryModel::GroupBy& g) { case LibraryModel::GroupBy_OriginalYear: { return tr("Original year"); } - default: { return tr("Unknown"); } + default: { + return tr("Unknown"); + } } } diff --git a/src/library/sqlrow.cpp b/src/library/sqlrow.cpp index a573dfa03..a1b477f69 100644 --- a/src/library/sqlrow.cpp +++ b/src/library/sqlrow.cpp @@ -15,12 +15,13 @@ along with Clementine. If not, see . */ -#include "libraryquery.h" #include "sqlrow.h" #include #include +#include "libraryquery.h" + SqlRow::SqlRow(const QSqlQuery& query) { Init(query); } SqlRow::SqlRow(const LibraryQuery& query) { Init(query); } diff --git a/src/mac/SBSystemPreferences.h b/src/mac/SBSystemPreferences.h index 387d30025..f16371ba9 100644 --- a/src/mac/SBSystemPreferences.h +++ b/src/mac/SBSystemPreferences.h @@ -9,15 +9,13 @@ #import #import -@class SBSystemPreferencesApplication, SBSystemPreferencesDocument, - SBSystemPreferencesWindow, SBSystemPreferencesPane, - SBSystemPreferencesAnchor; +@class SBSystemPreferencesApplication, SBSystemPreferencesDocument, SBSystemPreferencesWindow, + SBSystemPreferencesPane, SBSystemPreferencesAnchor; enum SBSystemPreferencesSaveOptions { SBSystemPreferencesSaveOptionsYes = 'yes ' /* Save the file. */, SBSystemPreferencesSaveOptionsNo = 'no ' /* Do not save the file. */, - SBSystemPreferencesSaveOptionsAsk = - 'ask ' /* Ask the user whether or not to save the file. */ + SBSystemPreferencesSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */ }; typedef enum SBSystemPreferencesSaveOptions SBSystemPreferencesSaveOptions; @@ -27,8 +25,7 @@ enum SBSystemPreferencesPrintingErrorHandling { SBSystemPreferencesPrintingErrorHandlingDetailed = 'lwdt' /* print a detailed report of PostScript errors */ }; -typedef enum SBSystemPreferencesPrintingErrorHandling - SBSystemPreferencesPrintingErrorHandling; +typedef enum SBSystemPreferencesPrintingErrorHandling SBSystemPreferencesPrintingErrorHandling; /* * Standard Suite @@ -40,18 +37,16 @@ typedef enum SBSystemPreferencesPrintingErrorHandling - (SBElementArray*)documents; - (SBElementArray*)windows; -@property(copy, readonly) NSString* name; // The name of the application. -@property(readonly) BOOL frontmost; // Is this the active application? -@property(copy, readonly) - NSString* version; // The version number of the application. +@property(copy, readonly) NSString* name; // The name of the application. +@property(readonly) BOOL frontmost; // Is this the active application? +@property(copy, readonly) NSString* version; // The version number of the application. - (id)open:(id)x; // Open a document. - (void)print:(id)x withProperties:(NSDictionary*)withProperties - printDialog:(BOOL)printDialog; // Print a document. -- (void)quitSaving: - (SBSystemPreferencesSaveOptions)saving; // Quit the application. -- (BOOL)exists:(id)x; // Verify that an object exists. + printDialog:(BOOL)printDialog; // Print a document. +- (void)quitSaving:(SBSystemPreferencesSaveOptions)saving; // Quit the application. +- (BOOL)exists:(id)x; // Verify that an object exists. @end @@ -59,17 +54,16 @@ typedef enum SBSystemPreferencesPrintingErrorHandling @interface SBSystemPreferencesDocument : SBObject @property(copy, readonly) NSString* name; // Its name. -@property(readonly) BOOL modified; // Has it been modified since the last save? -@property(copy, readonly) NSURL* file; // Its location on disk, if it has one. +@property(readonly) BOOL modified; // Has it been modified since the last save? +@property(copy, readonly) NSURL* file; // Its location on disk, if it has one. - (void)closeSaving:(SBSystemPreferencesSaveOptions)saving savingIn:(NSURL*)savingIn; // Close a document. - (void)saveIn:(NSURL*)in_ as:(id)as; // Save a document. - (void)printWithProperties:(NSDictionary*)withProperties printDialog:(BOOL)printDialog; // Print a document. -- (void) delete; // Delete an object. -- (void)duplicateTo:(SBObject*)to - withProperties:(NSDictionary*)withProperties; // Copy an object. +- (void)delete; // Delete an object. +- (void)duplicateTo:(SBObject*)to withProperties:(NSDictionary*)withProperties; // Copy an object. - (void)moveTo:(SBObject*)to; // Move an object to a new location. @end @@ -78,17 +72,16 @@ typedef enum SBSystemPreferencesPrintingErrorHandling @interface SBSystemPreferencesWindow : SBObject @property(copy, readonly) NSString* name; // The title of the window. -- (NSInteger)id; // The unique identifier of the window. -@property NSInteger index; // The index of the window, ordered front to back. -@property NSRect bounds; // The bounding rectangle of the window. -@property(readonly) BOOL closeable; // Does the window have a close button? -@property(readonly) - BOOL miniaturizable; // Does the window have a minimize button? -@property BOOL miniaturized; // Is the window minimized right now? -@property(readonly) BOOL resizable; // Can the window be resized? -@property BOOL visible; // Is the window visible right now? -@property(readonly) BOOL zoomable; // Does the window have a zoom button? -@property BOOL zoomed; // Is the window zoomed right now? +- (NSInteger)id; // The unique identifier of the window. +@property NSInteger index; // The index of the window, ordered front to back. +@property NSRect bounds; // The bounding rectangle of the window. +@property(readonly) BOOL closeable; // Does the window have a close button? +@property(readonly) BOOL miniaturizable; // Does the window have a minimize button? +@property BOOL miniaturized; // Is the window minimized right now? +@property(readonly) BOOL resizable; // Can the window be resized? +@property BOOL visible; // Is the window visible right now? +@property(readonly) BOOL zoomable; // Does the window have a zoom button? +@property BOOL zoomed; // Is the window zoomed right now? @property(copy, readonly) SBSystemPreferencesDocument* document; // The document whose contents are displayed in the window. @@ -97,9 +90,8 @@ typedef enum SBSystemPreferencesPrintingErrorHandling - (void)saveIn:(NSURL*)in_ as:(id)as; // Save a document. - (void)printWithProperties:(NSDictionary*)withProperties printDialog:(BOOL)printDialog; // Print a document. -- (void) delete; // Delete an object. -- (void)duplicateTo:(SBObject*)to - withProperties:(NSDictionary*)withProperties; // Copy an object. +- (void)delete; // Delete an object. +- (void)duplicateTo:(SBObject*)to withProperties:(NSDictionary*)withProperties; // Copy an object. - (void)moveTo:(SBObject*)to; // Move an object to a new location. @end @@ -113,10 +105,9 @@ typedef enum SBSystemPreferencesPrintingErrorHandling - (SBElementArray*)panes; -@property(copy) - SBSystemPreferencesPane* currentPane; // the currently selected pane -@property(copy, readonly) SBSystemPreferencesWindow* - preferencesWindow; // the main preferences window +@property(copy) SBSystemPreferencesPane* currentPane; // the currently selected pane +@property(copy, readonly) + SBSystemPreferencesWindow* preferencesWindow; // the main preferences window @property BOOL showAll; // Is SystemPrefs in show all view. (Setting to false // will do nothing) @@ -129,43 +120,39 @@ typedef enum SBSystemPreferencesPrintingErrorHandling - (NSString*)id; // locale independent name of the preference pane; can refer // to a pane using the expression: pane id "" -@property(copy, readonly) - NSString* localizedName; // localized name of the preference pane -@property(copy, readonly) NSString* name; // name of the preference pane as it - // appears in the title bar; can - // refer to a pane using the - // expression: pane "" +@property(copy, readonly) NSString* localizedName; // localized name of the preference pane +@property(copy, readonly) NSString* name; // name of the preference pane as it + // appears in the title bar; can + // refer to a pane using the + // expression: pane "" - (void)closeSaving:(SBSystemPreferencesSaveOptions)saving savingIn:(NSURL*)savingIn; // Close a document. - (void)saveIn:(NSURL*)in_ as:(id)as; // Save a document. - (void)printWithProperties:(NSDictionary*)withProperties printDialog:(BOOL)printDialog; // Print a document. -- (void) delete; // Delete an object. -- (void)duplicateTo:(SBObject*)to - withProperties:(NSDictionary*)withProperties; // Copy an object. +- (void)delete; // Delete an object. +- (void)duplicateTo:(SBObject*)to withProperties:(NSDictionary*)withProperties; // Copy an object. - (void)moveTo:(SBObject*)to; // Move an object to a new location. -- (id)reveal; // Reveals an anchor within a preference pane or preference pane - // itself +- (id)reveal; // Reveals an anchor within a preference pane or preference pane + // itself @end // an anchor within a preference pane @interface SBSystemPreferencesAnchor : SBObject -@property(copy, readonly) - NSString* name; // name of the anchor within a preference pane +@property(copy, readonly) NSString* name; // name of the anchor within a preference pane - (void)closeSaving:(SBSystemPreferencesSaveOptions)saving savingIn:(NSURL*)savingIn; // Close a document. - (void)saveIn:(NSURL*)in_ as:(id)as; // Save a document. - (void)printWithProperties:(NSDictionary*)withProperties printDialog:(BOOL)printDialog; // Print a document. -- (void) delete; // Delete an object. -- (void)duplicateTo:(SBObject*)to - withProperties:(NSDictionary*)withProperties; // Copy an object. +- (void)delete; // Delete an object. +- (void)duplicateTo:(SBObject*)to withProperties:(NSDictionary*)withProperties; // Copy an object. - (void)moveTo:(SBObject*)to; // Move an object to a new location. -- (id)reveal; // Reveals an anchor within a preference pane or preference pane - // itself +- (id)reveal; // Reveals an anchor within a preference pane or preference pane + // itself @end diff --git a/src/main.cpp b/src/main.cpp index 6b59169d3..ec1e1f03f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,29 +15,33 @@ along with Clementine. If not, see . */ +#include #include -#include - #ifdef Q_OS_WIN32 -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -# endif -# include -# include +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#include + +#include #endif // Q_OS_WIN32 #ifdef Q_OS_UNIX #include #endif // Q_OS_UNIX +#include +#include +#include + #include #include #include #include -#include #include #include +#include #include #include #include @@ -59,22 +63,16 @@ #include "core/ubuntuunityhack.h" #include "core/utilities.h" #include "engines/enginebase.h" +#include "qtsingleapplication.h" +#include "qtsinglecoreapplication.h" #include "smartplaylists/generator.h" +#include "tagreadermessages.pb.h" #include "ui/iconloader.h" #include "ui/mainwindow.h" #include "ui/systemtrayicon.h" #include "version.h" #include "widgets/osd.h" -#include "tagreadermessages.pb.h" - -#include "qtsingleapplication.h" -#include "qtsinglecoreapplication.h" - -#include -#include -#include - #ifdef Q_OS_DARWIN #include #include @@ -87,11 +85,12 @@ class LastFMService; #endif #ifdef HAVE_DBUS -#include "core/mpris.h" -#include "core/mpris2.h" #include #include +#include "core/mpris.h" +#include "core/mpris2.h" + QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image); const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image); #endif @@ -151,10 +150,10 @@ void SetGstreamerEnvironment() { // On windows and mac we bundle the gstreamer plugins with clementine #ifdef USE_BUNDLE #if defined(Q_OS_DARWIN) - scanner_path = - QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gst-plugin-scanner"; - plugin_path = - QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gstreamer"; + scanner_path = QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + + "/gst-plugin-scanner"; + plugin_path = QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + + "/gstreamer"; #elif defined(Q_OS_WIN32) plugin_path = QCoreApplication::applicationDirPath() + "/gstreamer-plugins"; #endif @@ -178,8 +177,8 @@ void SetGstreamerEnvironment() { } #if defined(Q_OS_DARWIN) && defined(USE_BUNDLE) - SetEnv("GIO_EXTRA_MODULES", - QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gio-modules"); + SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/" + + USE_BUNDLE_DIR + "/gio-modules"); #endif SetEnv("PULSE_PROP_media.role", "music"); @@ -346,9 +345,12 @@ int main(int argc, char* argv[]) { } #if defined(Q_OS_DARWIN) && defined(USE_BUNDLE) - qLog(Debug) << "Looking for resources in" + QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR; - QCoreApplication::setLibraryPaths( - QStringList() << QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR); + qLog(Debug) << "Looking for resources in" + + QCoreApplication::applicationDirPath() + "/" + + USE_BUNDLE_DIR; + QCoreApplication::setLibraryPaths(QStringList() + << QCoreApplication::applicationDirPath() + + "/" + USE_BUNDLE_DIR); #endif a.setQuitOnLastWindowClosed(false); diff --git a/src/moodbar/moodbarbuilder.cpp b/src/moodbar/moodbarbuilder.cpp index bcd5d6dce..0e4475d0b 100644 --- a/src/moodbar/moodbarbuilder.cpp +++ b/src/moodbar/moodbarbuilder.cpp @@ -16,10 +16,11 @@ */ #include "moodbarbuilder.h" -#include "core/arraysize.h" #include +#include "core/arraysize.h" + namespace { static const int sBarkBands[] = { diff --git a/src/moodbar/moodbarbuilder.h b/src/moodbar/moodbarbuilder.h index c718ff6cc..c93b6dbc8 100644 --- a/src/moodbar/moodbarbuilder.h +++ b/src/moodbar/moodbarbuilder.h @@ -47,4 +47,4 @@ class MoodbarBuilder { QList frames_; }; -#endif // MOODBARBUILDER_H +#endif // MOODBARBUILDER_H diff --git a/src/moodbar/moodbarcontroller.cpp b/src/moodbar/moodbarcontroller.cpp index 45f5c29fb..64411c966 100644 --- a/src/moodbar/moodbarcontroller.cpp +++ b/src/moodbar/moodbarcontroller.cpp @@ -16,12 +16,13 @@ */ #include "moodbarcontroller.h" -#include "moodbarloader.h" -#include "moodbarpipeline.h" + #include "core/application.h" #include "core/closure.h" #include "core/logging.h" #include "core/player.h" +#include "moodbarloader.h" +#include "moodbarpipeline.h" #include "playlist/playlistmanager.h" MoodbarController::MoodbarController(Application* app, QObject* parent) @@ -70,7 +71,7 @@ void MoodbarController::AsyncLoadComplete(MoodbarPipeline* pipeline, return; } // Did we stop the song? - switch(app_->player()->GetState()) { + switch (app_->player()->GetState()) { case Engine::Error: case Engine::Empty: case Engine::Idle: diff --git a/src/moodbar/moodbarcontroller.h b/src/moodbar/moodbarcontroller.h index c3b672088..f8c4b6132 100644 --- a/src/moodbar/moodbarcontroller.h +++ b/src/moodbar/moodbarcontroller.h @@ -32,7 +32,7 @@ class MoodbarController : public QObject { public: MoodbarController(Application* app, QObject* parent = nullptr); -signals: + signals: void CurrentMoodbarDataChanged(const QByteArray& data); private slots: diff --git a/src/moodbar/moodbaritemdelegate.cpp b/src/moodbar/moodbaritemdelegate.cpp index f17b4a466..2fe6a8797 100644 --- a/src/moodbar/moodbaritemdelegate.cpp +++ b/src/moodbar/moodbaritemdelegate.cpp @@ -16,13 +16,6 @@ */ #include "moodbaritemdelegate.h" -#include "moodbarloader.h" -#include "moodbarpipeline.h" -#include "moodbarrenderer.h" -#include "core/application.h" -#include "core/closure.h" -#include "playlist/playlist.h" -#include "playlist/playlistview.h" #include #include @@ -30,6 +23,14 @@ #include #include +#include "core/application.h" +#include "core/closure.h" +#include "moodbarloader.h" +#include "moodbarpipeline.h" +#include "moodbarrenderer.h" +#include "playlist/playlist.h" +#include "playlist/playlistview.h" + MoodbarItemDelegate::Data::Data() : state_(State_None) {} MoodbarItemDelegate::MoodbarItemDelegate(Application* app, PlaylistView* view, @@ -58,8 +59,8 @@ void MoodbarItemDelegate::ReloadSettings() { void MoodbarItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { - QPixmap pixmap = const_cast(this) - ->PixmapForIndex(index, option.rect.size()); + QPixmap pixmap = const_cast(this)->PixmapForIndex( + index, option.rect.size()); drawBackground(painter, option, index); diff --git a/src/moodbar/moodbaritemdelegate.h b/src/moodbar/moodbaritemdelegate.h index b73205549..60e6bb6d7 100644 --- a/src/moodbar/moodbaritemdelegate.h +++ b/src/moodbar/moodbaritemdelegate.h @@ -18,13 +18,13 @@ #ifndef MOODBARITEMDELEGATE_H #define MOODBARITEMDELEGATE_H -#include "moodbarrenderer.h" - #include #include #include #include +#include "moodbarrenderer.h" + class Application; class MoodbarPipeline; class PlaylistView; diff --git a/src/moodbar/moodbarloader.cpp b/src/moodbar/moodbarloader.cpp index 6bc23d8ee..e172a486c 100644 --- a/src/moodbar/moodbarloader.cpp +++ b/src/moodbar/moodbarloader.cpp @@ -17,21 +17,20 @@ #include "moodbarloader.h" -#include - #include #include #include #include -#include #include +#include #include +#include -#include "moodbarpipeline.h" #include "core/application.h" #include "core/closure.h" #include "core/logging.h" #include "core/utilities.h" +#include "moodbarpipeline.h" #ifdef Q_OS_WIN32 #include diff --git a/src/moodbar/moodbarpipeline.cpp b/src/moodbar/moodbarpipeline.cpp index ac62f3ef8..78dcd2a09 100644 --- a/src/moodbar/moodbarpipeline.cpp +++ b/src/moodbar/moodbarpipeline.cpp @@ -25,9 +25,8 @@ #include "core/signalchecker.h" #include "core/timeconstants.h" #include "core/utilities.h" -#include "moodbar/moodbarbuilder.h" - #include "gst/moodbar/gstfastspectrum.h" +#include "moodbar/moodbarbuilder.h" bool MoodbarPipeline::sIsAvailable = false; const int MoodbarPipeline::kBands = 128; @@ -108,8 +107,9 @@ void MoodbarPipeline::Start() { g_object_set(spectrum, "bands", kBands, nullptr); GstFastSpectrum* fast_spectrum = GST_FASTSPECTRUM(spectrum); - fast_spectrum->output_callback = [this]( - double* magnitudes, int size) { builder_->AddFrame(magnitudes, size); }; + fast_spectrum->output_callback = [this](double* magnitudes, int size) { + builder_->AddFrame(magnitudes, size); + }; // Connect signals CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this); @@ -206,7 +206,7 @@ void MoodbarPipeline::Cleanup() { GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline_)); gst_bus_set_sync_handler(bus, nullptr, nullptr, nullptr); gst_object_unref(bus); - + gst_element_set_state(pipeline_, GST_STATE_NULL); gst_object_unref(pipeline_); pipeline_ = nullptr; diff --git a/src/moodbar/moodbarpipeline.h b/src/moodbar/moodbarpipeline.h index 629781d64..c80c6c702 100644 --- a/src/moodbar/moodbarpipeline.h +++ b/src/moodbar/moodbarpipeline.h @@ -18,12 +18,11 @@ #ifndef MOODBARPIPELINE_H #define MOODBARPIPELINE_H +#include +#include + #include #include - -#include -#include - #include class MoodbarBuilder; diff --git a/src/moodbar/moodbarproxystyle.cpp b/src/moodbar/moodbarproxystyle.cpp index 25a6fec25..1376c19da 100644 --- a/src/moodbar/moodbarproxystyle.cpp +++ b/src/moodbar/moodbarproxystyle.cpp @@ -16,8 +16,6 @@ */ #include "moodbarproxystyle.h" -#include "core/application.h" -#include "core/logging.h" #include #include @@ -29,6 +27,9 @@ #include #include +#include "core/application.h" +#include "core/logging.h" + const int MoodbarProxyStyle::kMarginSize = 3; const int MoodbarProxyStyle::kBorderSize = 1; const int MoodbarProxyStyle::kArrowWidth = 17; @@ -166,9 +167,9 @@ void MoodbarProxyStyle::drawComplexControl(ComplexControl control, return; } - const_cast(this) - ->Render(control, qstyleoption_cast(option), - painter, widget); + const_cast(this)->Render( + control, qstyleoption_cast(option), painter, + widget); } void MoodbarProxyStyle::Render(ComplexControl control, diff --git a/src/moodbar/moodbarproxystyle.h b/src/moodbar/moodbarproxystyle.h index f309e5a4c..df50a7aaa 100644 --- a/src/moodbar/moodbarproxystyle.h +++ b/src/moodbar/moodbarproxystyle.h @@ -18,10 +18,10 @@ #ifndef MOODBARPROXYSTYLE_H #define MOODBARPROXYSTYLE_H -#include "moodbarrenderer.h" - #include +#include "moodbarrenderer.h" + class Application; class QActionGroup; diff --git a/src/moodbar/moodbarrenderer.h b/src/moodbar/moodbarrenderer.h index d91c04bcb..e57ad15ea 100644 --- a/src/moodbar/moodbarrenderer.h +++ b/src/moodbar/moodbarrenderer.h @@ -19,8 +19,8 @@ #define MOODBARRENDERER_H #include -#include #include +#include #include class QPalette; diff --git a/src/musicbrainz/acoustidclient.cpp b/src/musicbrainz/acoustidclient.cpp index 203394a3c..dd4170c6b 100644 --- a/src/musicbrainz/acoustidclient.cpp +++ b/src/musicbrainz/acoustidclient.cpp @@ -17,16 +17,15 @@ #include "acoustidclient.h" -#include - #include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include +#include #include "core/closure.h" #include "core/logging.h" @@ -78,8 +77,7 @@ void AcoustidClient::CancelAll() { namespace { // Struct used when extracting results in RequestFinished struct IdSource { - IdSource(const QString& id, int source) - : id_(id), nb_sources_(source) {} + IdSource(const QString& id, int source) : id_(id), nb_sources_(source) {} bool operator<(const IdSource& other) const { // We want the items with more sources to be at the beginning of the list @@ -89,7 +87,7 @@ struct IdSource { QString id_; int nb_sources_; }; -} +} // namespace void AcoustidClient::RequestFinished(QNetworkReply* reply, int request_id) { reply->deleteLater(); @@ -102,7 +100,8 @@ void AcoustidClient::RequestFinished(QNetworkReply* reply, int request_id) { } QJsonParseError error; - QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll(), &error); + QJsonDocument json_document = + QJsonDocument::fromJson(reply->readAll(), &error); if (error.error != QJsonParseError::NoError) { emit Finished(request_id, QStringList()); diff --git a/src/musicbrainz/acoustidclient.h b/src/musicbrainz/acoustidclient.h index 1e68431f5..582681799 100644 --- a/src/musicbrainz/acoustidclient.h +++ b/src/musicbrainz/acoustidclient.h @@ -55,7 +55,7 @@ class AcoustidClient : public QObject { // requests. void CancelAll(); -signals: + signals: void Finished(int id, const QStringList& mbid_list); private slots: diff --git a/src/musicbrainz/chromaprinter.cpp b/src/musicbrainz/chromaprinter.cpp index 235193858..499c323ee 100644 --- a/src/musicbrainz/chromaprinter.cpp +++ b/src/musicbrainz/chromaprinter.cpp @@ -17,6 +17,8 @@ #include "chromaprinter.h" +#include + #include #include #include @@ -24,8 +26,6 @@ #include #include -#include - #include "core/logging.h" #include "core/signalchecker.h" @@ -147,18 +147,18 @@ QString Chromaprinter::CreateFingerprint() { ChromaprintContext* chromaprint = chromaprint_new(CHROMAPRINT_ALGORITHM_DEFAULT); chromaprint_start(chromaprint, kDecodeRate, kDecodeChannels); - chromaprint_feed(chromaprint, reinterpret_cast(data.data()), + chromaprint_feed(chromaprint, reinterpret_cast(data.data()), data.size() / 2); chromaprint_finish(chromaprint); int size = 0; #if CHROMAPRINT_VERSION_MAJOR >= 1 && CHROMAPRINT_VERSION_MINOR >= 4 - u_int32_t *fprint = nullptr; - char *encoded = nullptr; + u_int32_t* fprint = nullptr; + char* encoded = nullptr; #else - void *fprint = nullptr; - void *encoded = nullptr; + void* fprint = nullptr; + void* encoded = nullptr; #endif int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size); diff --git a/src/musicbrainz/chromaprinter.h b/src/musicbrainz/chromaprinter.h index d0f336949..19cd074b3 100644 --- a/src/musicbrainz/chromaprinter.h +++ b/src/musicbrainz/chromaprinter.h @@ -18,8 +18,8 @@ #ifndef CHROMAPRINTER_H #define CHROMAPRINTER_H -#include #include +#include #include #include diff --git a/src/musicbrainz/musicbrainzclient.cpp b/src/musicbrainz/musicbrainzclient.cpp index ab920b0fc..f5467b857 100644 --- a/src/musicbrainz/musicbrainzclient.cpp +++ b/src/musicbrainz/musicbrainzclient.cpp @@ -17,13 +17,12 @@ #include "musicbrainzclient.h" -#include - #include #include #include -#include #include +#include +#include #include "core/closure.h" #include "core/logging.h" @@ -110,9 +109,10 @@ void MusicBrainzClient::DiscIdRequestFinished(const QString& discid, if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) { - qLog(Error) << "Error:" - << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) - .toInt() << "http status code received"; + qLog(Error) + << "Error:" + << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() + << "http status code received"; qLog(Error) << reply->readAll(); emit Finished(artist, album, ret); return; @@ -203,9 +203,10 @@ void MusicBrainzClient::RequestFinished(QNetworkReply* reply, int id, } pending_results_[id] << PendingResults(request_number, res); } else { - qLog(Error) << "Error:" - << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) - .toInt() << "http status code received"; + qLog(Error) + << "Error:" + << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() + << "http status code received"; qLog(Error) << reply->readAll(); } diff --git a/src/musicbrainz/musicbrainzclient.h b/src/musicbrainz/musicbrainzclient.h index 6627d8ae4..0e776aa93 100644 --- a/src/musicbrainz/musicbrainzclient.h +++ b/src/musicbrainz/musicbrainzclient.h @@ -89,7 +89,7 @@ class MusicBrainzClient : public QObject { // requests. void CancelAll(); -signals: + signals: // Finished signal emitted when fechting songs tags void Finished(int id, const MusicBrainzClient::ResultList& result); // Finished signal emitted when fechting album's songs tags using DiscId @@ -104,13 +104,9 @@ signals: private: // Used as parameter for UniqueResults - enum UniqueResultsSortOption { - SortResults = 0, - KeepOriginalOrder - }; + enum UniqueResultsSortOption { SortResults = 0, KeepOriginalOrder }; struct Release { - enum Status { Status_Unknown = 0, Status_PseudoRelease, @@ -157,7 +153,7 @@ signals: struct PendingResults { PendingResults(int sort_id, const ResultList& results) - : sort_id_(sort_id), results_(results) {} + : sort_id_(sort_id), results_(results) {} bool operator<(const PendingResults& other) const { return sort_id_ < other.sort_id_; @@ -174,8 +170,7 @@ signals: static void ParseArtist(QXmlStreamReader* reader, QString* artist); static Release ParseRelease(QXmlStreamReader* reader); static ResultList UniqueResults(const ResultList& results, - UniqueResultsSortOption opt = SortResults); - + UniqueResultsSortOption opt = SortResults); private: static const char* kTrackUrl; diff --git a/src/musicbrainz/tagfetcher.cpp b/src/musicbrainz/tagfetcher.cpp index 900a47b14..b7ddf9a7b 100644 --- a/src/musicbrainz/tagfetcher.cpp +++ b/src/musicbrainz/tagfetcher.cpp @@ -17,16 +17,16 @@ #include "tagfetcher.h" -#include "acoustidclient.h" -#include "chromaprinter.h" -#include "musicbrainzclient.h" -#include "core/timeconstants.h" - #include #include #include #include +#include "acoustidclient.h" +#include "chromaprinter.h" +#include "core/timeconstants.h" +#include "musicbrainzclient.h" + TagFetcher::TagFetcher(QObject* parent) : QObject(parent), fingerprint_watcher_(nullptr), diff --git a/src/musicbrainz/tagfetcher.h b/src/musicbrainz/tagfetcher.h index a066b18e7..b53bf957d 100644 --- a/src/musicbrainz/tagfetcher.h +++ b/src/musicbrainz/tagfetcher.h @@ -18,12 +18,12 @@ #ifndef TAGFETCHER_H #define TAGFETCHER_H -#include "musicbrainzclient.h" -#include "core/song.h" - #include #include +#include "core/song.h" +#include "musicbrainzclient.h" + class AcoustidClient; class TagFetcher : public QObject { @@ -40,7 +40,7 @@ class TagFetcher : public QObject { public slots: void Cancel(); -signals: + signals: void Progress(const Song& original_song, const QString& stage); void ResultAvailable(const Song& original_song, const SongList& songs_guessed); diff --git a/src/networkremote/bonjour.mm b/src/networkremote/bonjour.mm index 12407acfa..ed974affa 100644 --- a/src/networkremote/bonjour.mm +++ b/src/networkremote/bonjour.mm @@ -6,12 +6,11 @@ #include "core/logging.h" #include "core/scoped_nsautorelease_pool.h" -@interface NetServicePublicationDelegate : NSObject { +@interface NetServicePublicationDelegate : NSObject { } - (void)netServiceWillPublish:(NSNetService*)netService; -- (void)netService:(NSNetService*)netService - didNotPublish:(NSDictionary*)errorDict; +- (void)netService:(NSNetService*)netService didNotPublish:(NSDictionary*)errorDict; - (void)netServiceDidStop:(NSNetService*)netService; @end @@ -22,8 +21,7 @@ qLog(Debug) << "Publishing:" << [[netService name] UTF8String]; } -- (void)netService:(NSNetService*)netServie - didNotPublish:(NSDictionary*)errorDict { +- (void)netService:(NSNetService*)netServie didNotPublish:(NSDictionary*)errorDict { qLog(Debug) << "Failed to publish remote service with Bonjour"; NSLog(@"%@", errorDict); } @@ -45,14 +43,14 @@ Bonjour::Bonjour() : delegate_([[NetServicePublicationDelegate alloc] init]) {} Bonjour::~Bonjour() { [delegate_ release]; } -void Bonjour::PublishInternal(const QString& domain, const QString& type, - const QByteArray& name, quint16 port) { +void Bonjour::PublishInternal(const QString& domain, const QString& type, const QByteArray& name, + quint16 port) { ScopedNSAutoreleasePool pool; - NSNetService* service = [[NSNetService alloc] - initWithDomain:NSStringFromQString(domain) - type:NSStringFromQString(type) - name:[NSString stringWithUTF8String:name.constData()] - port:port]; + NSNetService* service = + [[NSNetService alloc] initWithDomain:NSStringFromQString(domain) + type:NSStringFromQString(type) + name:[NSString stringWithUTF8String:name.constData()] + port:port]; if (service) { [service setDelegate:delegate_]; [service publish]; diff --git a/src/networkremote/incomingdataparser.cpp b/src/networkremote/incomingdataparser.cpp index 61f559474..883b65683 100644 --- a/src/networkremote/incomingdataparser.cpp +++ b/src/networkremote/incomingdataparser.cpp @@ -23,9 +23,9 @@ #include "core/timeconstants.h" #include "engines/enginebase.h" #include "internet/core/internetmodel.h" +#include "playlist/playlist.h" #include "playlist/playlistmanager.h" #include "playlist/playlistsequence.h" -#include "playlist/playlist.h" #ifdef HAVE_LIBLASTFM #include "internet/lastfm/lastfmservice.h" @@ -180,7 +180,8 @@ void IncomingDataParser::Parse(const pb::remote::Message& msg) { client->song_sender()->SendSongs(msg.request_download_songs()); break; case pb::remote::SONG_OFFER_RESPONSE: - client->song_sender()->ResponseSongOffer(msg.response_song_offer().accepted()); + client->song_sender()->ResponseSongOffer( + msg.response_song_offer().accepted()); break; case pb::remote::GET_LIBRARY: emit SendLibrary(client); @@ -304,7 +305,8 @@ void IncomingDataParser::RemoveSongs(const pb::remote::Message& msg) { emit RemoveSongs(request.playlist_id(), songs); } -void IncomingDataParser::ClientConnect(const pb::remote::Message& msg, RemoteClient* client) { +void IncomingDataParser::ClientConnect(const pb::remote::Message& msg, + RemoteClient* client) { // Always sned the Clementine infos emit SendClementineInfo(); @@ -341,17 +343,17 @@ void IncomingDataParser::RateSong(const pb::remote::Message& msg) { emit RateCurrentSong(rating); } -void IncomingDataParser::GlobalSearch(RemoteClient *client, const pb::remote::Message &msg) { +void IncomingDataParser::GlobalSearch(RemoteClient* client, + const pb::remote::Message& msg) { emit DoGlobalSearch(QStringFromStdString(msg.request_global_search().query()), client); } -Song IncomingDataParser::CreateSongFromProtobuf(const pb::remote::SongMetadata& pb){ +Song IncomingDataParser::CreateSongFromProtobuf( + const pb::remote::SongMetadata& pb) { Song song; - song.Init(QStringFromStdString(pb.title()), - QStringFromStdString(pb.artist()), - QStringFromStdString(pb.album()), - pb.length() * kNsecPerSec); + song.Init(QStringFromStdString(pb.title()), QStringFromStdString(pb.artist()), + QStringFromStdString(pb.album()), pb.length() * kNsecPerSec); song.set_albumartist(QStringFromStdString(pb.albumartist())); song.set_genre(QStringFromStdString(pb.genre())); diff --git a/src/networkremote/networkremote.cpp b/src/networkremote/networkremote.cpp index 95abc6ad4..90b2ef3a8 100644 --- a/src/networkremote/networkremote.cpp +++ b/src/networkremote/networkremote.cpp @@ -18,9 +18,9 @@ #include "networkremote.h" #include -#include #include #include +#include #include #include "core/logging.h" diff --git a/src/networkremote/networkremote.h b/src/networkremote/networkremote.h index 9f550f02d..5cbd009cc 100644 --- a/src/networkremote/networkremote.h +++ b/src/networkremote/networkremote.h @@ -1,10 +1,9 @@ #ifndef NETWORKREMOTE_H #define NETWORKREMOTE_H -#include - #include #include +#include class Application; class IncomingDataParser; diff --git a/src/networkremote/networkremotehelper.h b/src/networkremote/networkremotehelper.h index 8bb36efee..b81f19d36 100644 --- a/src/networkremote/networkremotehelper.h +++ b/src/networkremote/networkremotehelper.h @@ -18,7 +18,7 @@ class NetworkRemoteHelper : public QObject { private slots: void StartServer(); -signals: + signals: void SetupServerSig(); void StartServerSig(); void ReloadSettingsSig(); diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index f968dc55a..23b8fc4cc 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -17,20 +17,19 @@ #include "outgoingdatacreator.h" +#include +#include #include -#include "networkremote.h" +#include "core/database.h" #include "core/logging.h" #include "core/timeconstants.h" #include "core/utilities.h" #include "globalsearch/librarysearchprovider.h" #include "library/librarybackend.h" +#include "networkremote.h" #include "ui/iconloader.h" -#include -#include -#include "core/database.h" - const quint32 OutgoingDataCreator::kFileChunkSize = 100000; // in Bytes OutgoingDataCreator::OutgoingDataCreator(Application* app) @@ -60,7 +59,7 @@ void OutgoingDataCreator::SetClients(QList* clients) { // Parse the ultimate lyrics xml file ultimate_reader_->SetThread(this->thread()); ProviderList provider_list = - ultimate_reader_->Parse(":lyrics/ultimate_providers.xml"); + ultimate_reader_->Parse(":lyrics/ultimate_providers.xml"); // Set up the lyrics parser connect(fetcher_, SIGNAL(ResultReady(int, SongInfoFetcher::Result)), @@ -382,7 +381,7 @@ void OutgoingDataCreator::CreateSong(const Song& song, const QImage& art, DataCommaSizeFromQString(song.art_automatic())); song_metadata->set_art_manual(DataCommaSizeFromQString(song.art_manual())); song_metadata->set_type( - static_cast< ::pb::remote::SongMetadata_Type>(song.filetype())); + static_cast<::pb::remote::SongMetadata_Type>(song.filetype())); // Append coverart if (!art.isNull()) { @@ -605,9 +604,8 @@ void OutgoingDataCreator::SendLibrary(RemoteClient* client) { app_->database()->AttachDatabaseOnDbConnection("songs_export", adb, db); // Copy the content of the song table to this temporary database - QSqlQuery q(QString( - "create table songs_export.songs as SELECT * FROM songs " - "where unavailable = 0;"), + QSqlQuery q(QString("create table songs_export.songs as SELECT * FROM songs " + "where unavailable = 0;"), db); if (app_->database()->CheckErrors(q)) return; diff --git a/src/networkremote/outgoingdatacreator.h b/src/networkremote/outgoingdatacreator.h index 18c1ac820..a261e21fb 100644 --- a/src/networkremote/outgoingdatacreator.h +++ b/src/networkremote/outgoingdatacreator.h @@ -1,23 +1,24 @@ #ifndef OUTGOINGDATACREATOR_H #define OUTGOINGDATACREATOR_H -#include - -#include #include #include -#include #include #include +#include +#include +#include -#include "core/player.h" #include "core/application.h" -#include "engines/enginebase.h" +#include "core/player.h" #include "engines/engine_fwd.h" +#include "engines/enginebase.h" #include "globalsearch/globalsearch.h" #include "playlist/playlist.h" -#include "playlist/playlistmanager.h" #include "playlist/playlistbackend.h" +#include "playlist/playlistmanager.h" +#include "remoteclient.h" +#include "remotecontrolmessages.pb.h" #include "songinfo/collapsibleinfopane.h" #include "songinfo/songinfofetcher.h" #include "songinfo/songinfoprovider.h" @@ -25,8 +26,6 @@ #include "songinfo/ultimatelyricslyric.h" #include "songinfo/ultimatelyricsprovider.h" #include "songinfo/ultimatelyricsreader.h" -#include "remotecontrolmessages.pb.h" -#include "remoteclient.h" typedef QList ProviderList; @@ -34,10 +33,9 @@ struct GlobalSearchRequest { int id_; QString query_; RemoteClient* client_; - GlobalSearchRequest() - : id_(-1), client_(nullptr) {} + GlobalSearchRequest() : id_(-1), client_(nullptr) {} GlobalSearchRequest(int i, const QString& q, RemoteClient* c) - : id_(i), query_(q), client_(c) {} + : id_(i), query_(q), client_(c) {} }; class OutgoingDataCreator : public QObject { @@ -51,7 +49,7 @@ class OutgoingDataCreator : public QObject { void SetClients(QList* clients); static void CreateSong(const Song& song, const QImage& art, const int index, - pb::remote::SongMetadata* song_metadata); + pb::remote::SongMetadata* song_metadata); public slots: void SendClementineInfo(); diff --git a/src/networkremote/remoteclient.cpp b/src/networkremote/remoteclient.cpp index 6971096f0..5f9f3628a 100644 --- a/src/networkremote/remoteclient.cpp +++ b/src/networkremote/remoteclient.cpp @@ -15,14 +15,14 @@ along with Clementine. If not, see . */ -#include "core/logging.h" - #include "remoteclient.h" -#include "networkremote.h" #include #include +#include "core/logging.h" +#include "networkremote.h" + RemoteClient::RemoteClient(Application* app, QTcpSocket* client) : app_(app), downloader_(false), @@ -64,7 +64,8 @@ void RemoteClient::setDownloader(bool downloader) { downloader_ = downloader; } void RemoteClient::IncomingData() { while (client_->bytesAvailable()) { if (!reading_protobuf_) { - // If we have less than 4 byte, we cannot read the length. Wait for more data + // If we have less than 4 byte, we cannot read the length. Wait for more + // data if (client_->bytesAvailable() < 4) { break; } diff --git a/src/networkremote/remoteclient.h b/src/networkremote/remoteclient.h index 8370b8632..a35e8bec4 100644 --- a/src/networkremote/remoteclient.h +++ b/src/networkremote/remoteclient.h @@ -2,13 +2,12 @@ #define REMOTECLIENT_H #include -#include #include - -#include "songsender.h" +#include #include "core/application.h" #include "remotecontrolmessages.pb.h" +#include "songsender.h" class RemoteClient : public QObject { Q_OBJECT @@ -28,7 +27,7 @@ class RemoteClient : public QObject { private slots: void IncomingData(); -signals: + signals: void Parse(const pb::remote::Message& msg); private: diff --git a/src/networkremote/songsender.h b/src/networkremote/songsender.h index 5b1254cde..4ea059501 100644 --- a/src/networkremote/songsender.h +++ b/src/networkremote/songsender.h @@ -5,9 +5,8 @@ #include #include -#include "remotecontrolmessages.pb.h" - #include "core/song.h" +#include "remotecontrolmessages.pb.h" #include "transcoder/transcoder.h" class Application; @@ -19,7 +18,7 @@ struct DownloadItem { int song_no_; int song_count_; DownloadItem(Song s, int no, int count) - : song_(s), song_no_(no), song_count_(count) {} + : song_(s), song_no_(no), song_count_(count) {} }; class SongSender : public QObject { @@ -35,7 +34,8 @@ class SongSender : public QObject { void ResponseSongOffer(bool accepted); private slots: - void TranscodeJobComplete(const QString& input, const QString& output, bool success); + void TranscodeJobComplete(const QString& input, const QString& output, + bool success); void StartTransfer(); private: diff --git a/src/networkremote/tinysvcmdns.cpp b/src/networkremote/tinysvcmdns.cpp index b4e70b858..822aba76a 100644 --- a/src/networkremote/tinysvcmdns.cpp +++ b/src/networkremote/tinysvcmdns.cpp @@ -68,7 +68,6 @@ TinySVCMDNS::~TinySVCMDNS() { void TinySVCMDNS::PublishInternal(const QString& domain, const QString& type, const QByteArray& name, quint16 port) { - // Some pointless text, so tinymDNS publishes the service correctly. const char* txt[] = {"cat=nyan", nullptr}; diff --git a/src/networkremote/tinysvcmdns.h b/src/networkremote/tinysvcmdns.h index a7dc16cb9..6e92f3182 100644 --- a/src/networkremote/tinysvcmdns.h +++ b/src/networkremote/tinysvcmdns.h @@ -1,9 +1,10 @@ #ifndef TINYSVCMDNS_H #define TINYSVCMDNS_H -#include "zeroconf.h" #include +#include "zeroconf.h" + struct mdnsd; class TinySVCMDNS : public Zeroconf { diff --git a/src/playlist/dbplaylistitem.cpp b/src/playlist/dbplaylistitem.cpp index a746a88ae..148701c29 100644 --- a/src/playlist/dbplaylistitem.cpp +++ b/src/playlist/dbplaylistitem.cpp @@ -17,10 +17,10 @@ */ #include "dbplaylistitem.h" + #include "core/tagreaderclient.h" -DbPlaylistItem::DbPlaylistItem(const QString& type) - : PlaylistItem(type) {} +DbPlaylistItem::DbPlaylistItem(const QString& type) : PlaylistItem(type) {} DbPlaylistItem::DbPlaylistItem(const QString& type, const Song& song) : PlaylistItem(type), song_(song) {} diff --git a/src/playlist/dynamicplaylistcontrols.cpp b/src/playlist/dynamicplaylistcontrols.cpp index 8c2a30bcd..6b8765fc3 100644 --- a/src/playlist/dynamicplaylistcontrols.cpp +++ b/src/playlist/dynamicplaylistcontrols.cpp @@ -16,6 +16,7 @@ */ #include "dynamicplaylistcontrols.h" + #include "ui_dynamicplaylistcontrols.h" DynamicPlaylistControls::DynamicPlaylistControls(QWidget* parent) diff --git a/src/playlist/dynamicplaylistcontrols.h b/src/playlist/dynamicplaylistcontrols.h index e1212563e..64b129dde 100644 --- a/src/playlist/dynamicplaylistcontrols.h +++ b/src/playlist/dynamicplaylistcontrols.h @@ -29,7 +29,7 @@ class DynamicPlaylistControls : public QWidget { DynamicPlaylistControls(QWidget* parent = nullptr); ~DynamicPlaylistControls(); -signals: + signals: void Expand(); void Repopulate(); void TurnOff(); diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index ba9b5bde2..c4c20ec2a 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -17,11 +17,6 @@ #include "playlist.h" -#include -#include -#include -#include - #include #include #include @@ -34,6 +29,10 @@ #include #include #include +#include +#include +#include +#include #include "core/application.h" #include "core/closure.h" @@ -67,10 +66,10 @@ #include "songmimedata.h" #include "songplaylistitem.h" -using std::placeholders::_1; -using std::placeholders::_2; using std::shared_ptr; using std::unordered_map; +using std::placeholders::_1; +using std::placeholders::_2; using smart_playlists::Generator; using smart_playlists::GeneratorInserter; @@ -450,9 +449,10 @@ void Playlist::SongSaveComplete(TagReaderReply* reply, NewClosure(future, this, SLOT(ItemReloadComplete(QPersistentModelIndex)), index); } else { - emit Error(tr("An error occurred writing metadata to '%1'").arg( - QString::fromStdString( - reply->request_message().save_file_request().filename()))); + emit Error( + tr("An error occurred writing metadata to '%1'") + .arg(QString::fromStdString( + reply->request_message().save_file_request().filename()))); } } reply->deleteLater(); @@ -525,7 +525,8 @@ int Playlist::NextVirtualIndex(int i, bool ignore_repeat_track) const { } Song this_song = item_at(virtual_items_[j])->Metadata(); if (((last_song.is_compilation() && this_song.is_compilation()) || - last_song.effective_albumartist() == this_song.effective_albumartist()) && + last_song.effective_albumartist() == + this_song.effective_albumartist()) && last_song.album() == this_song.album() && FilterContainsVirtualIndex(j)) { return j; // Found one @@ -1388,7 +1389,8 @@ QString Playlist::column_name(Column column) { case Column_Year: return tr("Year"); case Column_OriginalYear: - return tr("Year - original"); //: Done like this so sorts beside "Year" when editing smart playlists + return tr("Year - original"); //: Done like this so sorts beside "Year" + // when editing smart playlists case Column_Genre: return tr("Genre"); case Column_AlbumArtist: @@ -2048,7 +2050,7 @@ bool AlbumShuffleComparator(const QMap& album_key_positions, if (left_pos == right_pos) return left < right; return left_pos < right_pos; } -} +} // namespace void Playlist::ReshuffleIndices() { if (!playlist_sequence_) { diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index 2757ea657..833f311cd 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -21,10 +21,10 @@ #include #include +#include "core/song.h" +#include "core/tagreaderclient.h" #include "playlistitem.h" #include "playlistsequence.h" -#include "core/tagreaderclient.h" -#include "core/song.h" #include "smartplaylists/generator_fwd.h" class LibraryBackend; @@ -46,7 +46,7 @@ class MoveItems; class ReOrderItems; class SortItems; class ShuffleItems; -} +} // namespace PlaylistUndoCommands typedef QMap ColumnAlignmentMap; Q_DECLARE_METATYPE(Qt::Alignment) @@ -357,7 +357,7 @@ class Playlist : public QAbstractListModel { // undoable. void RemoveItemsWithoutUndo(const QList& indices); -signals: + signals: void RestoreFinished(); void CurrentSongChanged(const Song& metadata); void EditingFinished(const QModelIndex& index); diff --git a/src/playlist/playlistbackend.cpp b/src/playlist/playlistbackend.cpp index bb5d065a5..01596e804 100644 --- a/src/playlist/playlistbackend.cpp +++ b/src/playlist/playlistbackend.cpp @@ -17,14 +17,13 @@ #include "playlistbackend.h" -#include -#include - #include #include #include #include #include +#include +#include #include "core/application.h" #include "core/database.h" @@ -37,8 +36,8 @@ #include "playlistparsers/cueparser.h" #include "smartplaylists/generator.h" -using std::placeholders::_1; using std::shared_ptr; +using std::placeholders::_1; using smart_playlists::GeneratorPtr; @@ -79,12 +78,13 @@ PlaylistBackend::PlaylistList PlaylistBackend::GetPlaylists( } QSqlQuery q(db); - q.prepare("SELECT ROWID, name, last_played, dynamic_playlist_type," + q.prepare( + "SELECT ROWID, name, last_played, dynamic_playlist_type," " dynamic_playlist_data, dynamic_playlist_backend," " special_type, ui_path, is_favorite" " FROM playlists" " " + - condition + " ORDER BY ui_order"); + condition + " ORDER BY ui_order"); q.exec(); if (db_->CheckErrors(q)) return ret; @@ -110,7 +110,8 @@ PlaylistBackend::Playlist PlaylistBackend::GetPlaylist(int id) { QSqlDatabase db(db_->Connect()); QSqlQuery q(db); - q.prepare("SELECT ROWID, name, last_played, dynamic_playlist_type," + q.prepare( + "SELECT ROWID, name, last_played, dynamic_playlist_type," " dynamic_playlist_data, dynamic_playlist_backend," " special_type, ui_path, is_favorite" " FROM playlists" @@ -294,14 +295,16 @@ void PlaylistBackend::SavePlaylist(int playlist, const PlaylistItemList& items, QSqlQuery clear(db); clear.prepare("DELETE FROM playlist_items WHERE playlist = :playlist"); QSqlQuery insert(db); - insert.prepare("INSERT INTO playlist_items" + insert.prepare( + "INSERT INTO playlist_items" " (playlist, type, library_id, radio_service, " + - Song::kColumnSpec + - ")" - " VALUES (:playlist, :type, :library_id, :radio_service, " + - Song::kBindSpec + ")"); + Song::kColumnSpec + + ")" + " VALUES (:playlist, :type, :library_id, :radio_service, " + + Song::kBindSpec + ")"); QSqlQuery update(db); - update.prepare("UPDATE playlists SET " + update.prepare( + "UPDATE playlists SET " " last_played=:last_played," " dynamic_playlist_type=:dynamic_type," " dynamic_playlist_data=:dynamic_data," diff --git a/src/playlist/playlistcontainer.cpp b/src/playlist/playlistcontainer.cpp index ad43aee43..fe1a83d82 100644 --- a/src/playlist/playlistcontainer.cpp +++ b/src/playlist/playlistcontainer.cpp @@ -15,16 +15,7 @@ along with Clementine. If not, see . */ -#include "core/appearance.h" -#include "core/application.h" -#include "core/logging.h" -#include "core/player.h" -#include "core/timeconstants.h" #include "playlistcontainer.h" -#include "playlistmanager.h" -#include "playlistparsers/playlistparser.h" -#include "ui/iconloader.h" -#include "ui_playlistcontainer.h" #include #include @@ -38,6 +29,16 @@ #include #include +#include "core/appearance.h" +#include "core/application.h" +#include "core/logging.h" +#include "core/player.h" +#include "core/timeconstants.h" +#include "playlistmanager.h" +#include "playlistparsers/playlistparser.h" +#include "ui/iconloader.h" +#include "ui_playlistcontainer.h" + const char* PlaylistContainer::kSettingsGroup = "Playlist"; const int PlaylistContainer::kFilterDelayMs = 100; const int PlaylistContainer::kFilterDelayPlaylistSizeThreshold = 5000; @@ -114,9 +115,7 @@ PlaylistContainer::PlaylistContainer(QWidget* parent) ui_->filter->installEventFilter(this); } -PlaylistContainer::~PlaylistContainer() { - delete ui_; -} +PlaylistContainer::~PlaylistContainer() { delete ui_; } void PlaylistContainer::SetApplication(Application* app) { Q_ASSERT(app); @@ -398,10 +397,9 @@ void PlaylistContainer::UpdateNoMatchesLabel() { QString text; if (has_rows && !has_results) { - if (ui_->filter->text().trimmed().compare( - "the answer to life the universe " - "and everything", - Qt::CaseInsensitive) == 0) { + if (ui_->filter->text().trimmed().compare("the answer to life the universe " + "and everything", + Qt::CaseInsensitive) == 0) { text = "42"; } else { text = tr( diff --git a/src/playlist/playlistcontainer.h b/src/playlist/playlistcontainer.h index 76a6cded7..c0b9fdadd 100644 --- a/src/playlist/playlistcontainer.h +++ b/src/playlist/playlistcontainer.h @@ -18,8 +18,8 @@ #ifndef PLAYLISTCONTAINER_H #define PLAYLISTCONTAINER_H -#include #include +#include class Ui_PlaylistContainer; @@ -52,7 +52,7 @@ class PlaylistContainer : public QWidget { bool eventFilter(QObject* objectWatched, QEvent* event); -signals: + signals: void TabChanged(int id); void Rename(int id, const QString& new_name); diff --git a/src/playlist/playlistdelegates.cpp b/src/playlist/playlistdelegates.cpp index 238e71954..837f8152a 100644 --- a/src/playlist/playlistdelegates.cpp +++ b/src/playlist/playlistdelegates.cpp @@ -22,8 +22,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -31,13 +31,13 @@ #include #include -#include "queue.h" #include "core/logging.h" #include "core/player.h" #include "core/utilities.h" #include "library/librarybackend.h" -#include "widgets/trackslider.h" +#include "queue.h" #include "ui/iconloader.h" +#include "widgets/trackslider.h" #ifdef Q_OS_DARWIN #include "core/mac_utilities.h" @@ -283,8 +283,8 @@ QString DateItemDelegate::displayText(const QVariant& value, if (!ok || time == -1) return QString(); - return QDateTime::fromTime_t(time) - .toString(QLocale::system().dateTimeFormat(QLocale::ShortFormat)); + return QDateTime::fromTime_t(time).toString( + QLocale::system().dateTimeFormat(QLocale::ShortFormat)); } QString LastPlayedItemDelegate::displayText(const QVariant& value, @@ -321,7 +321,7 @@ void RatingItemDelegate::paint(QPainter* painter, const QModelIndex& index) const { // Draw the background option.widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, - painter, option.widget); + painter, option.widget); // Don't draw anything else if the user can't set the rating of this item if (!index.data(Playlist::Role_CanSetRating).toBool()) return; diff --git a/src/playlist/playlistdelegates.h b/src/playlist/playlistdelegates.h index 6314f2483..f5d0b3fe0 100644 --- a/src/playlist/playlistdelegates.h +++ b/src/playlist/playlistdelegates.h @@ -18,16 +18,16 @@ #ifndef PLAYLISTDELEGATES_H #define PLAYLISTDELEGATES_H -#include "playlist.h" -#include "library/library.h" -#include "widgets/ratingwidget.h" - #include #include #include #include #include +#include "library/library.h" +#include "playlist.h" +#include "widgets/ratingwidget.h" + class Player; class QueuedItemDelegate : public QStyledItemDelegate { @@ -64,7 +64,7 @@ class PlaylistDelegateBase : public QueuedItemDelegate { const QModelIndex& index) const; QStyleOptionViewItem Adjusted(const QStyleOptionViewItem& option, - const QModelIndex& index) const; + const QModelIndex& index) const; static const int kMinHeight; diff --git a/src/playlist/playlistfilter.cpp b/src/playlist/playlistfilter.cpp index 45af43311..d34c6c97c 100644 --- a/src/playlist/playlistfilter.cpp +++ b/src/playlist/playlistfilter.cpp @@ -16,10 +16,11 @@ */ #include "playlistfilter.h" -#include "playlistfilterparser.h" #include +#include "playlistfilterparser.h" + PlaylistFilter::PlaylistFilter(QObject* parent) : QSortFilterProxyModel(parent), filter_tree_(new NopFilter), diff --git a/src/playlist/playlistfilter.h b/src/playlist/playlistfilter.h index fad98b423..fbc78ab78 100644 --- a/src/playlist/playlistfilter.h +++ b/src/playlist/playlistfilter.h @@ -19,12 +19,11 @@ #define PLAYLISTFILTER_H #include +#include #include #include "playlist.h" -#include - class FilterTree; class PlaylistFilter : public QSortFilterProxyModel { diff --git a/src/playlist/playlistfilterparser.cpp b/src/playlist/playlistfilterparser.cpp index 29823ff8b..15c4a9a2a 100644 --- a/src/playlist/playlistfilterparser.cpp +++ b/src/playlist/playlistfilterparser.cpp @@ -16,11 +16,12 @@ */ #include "playlistfilterparser.h" -#include "playlist.h" -#include "core/logging.h" #include +#include "core/logging.h" +#include "playlist.h" + class SearchTermComparator { public: virtual ~SearchTermComparator() {} diff --git a/src/playlist/playlistheader.cpp b/src/playlist/playlistheader.cpp index 31df0403e..79512c910 100644 --- a/src/playlist/playlistheader.cpp +++ b/src/playlist/playlistheader.cpp @@ -16,12 +16,13 @@ */ #include "playlistheader.h" -#include "playlistview.h" -#include #include #include #include +#include + +#include "playlistview.h" PlaylistHeader::PlaylistHeader(Qt::Orientation orientation, PlaylistView* view, QWidget* parent) @@ -31,7 +32,7 @@ PlaylistHeader::PlaylistHeader(Qt::Orientation orientation, PlaylistView* view, hide_action_ = menu_->addAction(tr("&Hide..."), this, SLOT(HideCurrent())); stretch_action_ = menu_->addAction(tr("&Stretch columns to fit window"), this, SLOT(ToggleStretchEnabled())); - rating_lock_ = menu_->addAction(tr("&Lock Rating"), this, + rating_lock_ = menu_->addAction(tr("&Lock Rating"), this, SLOT(ToggleRatingEditStatus())); rating_lock_->setCheckable(true); QSettings s; @@ -76,7 +77,7 @@ void PlaylistHeader::contextMenuEvent(QContextMenuEvent* e) { QString title( model()->headerData(menu_section_, Qt::Horizontal).toString()); hide_action_->setText(tr("&Hide %1").arg(title)); - + // show rating_lock action only for ratings section rating_lock_->setVisible(menu_section_ == Playlist::Column_Rating); diff --git a/src/playlist/playlistheader.h b/src/playlist/playlistheader.h index 296c9f720..e420a828a 100644 --- a/src/playlist/playlistheader.h +++ b/src/playlist/playlistheader.h @@ -35,7 +35,7 @@ class PlaylistHeader : public StretchHeaderView { void contextMenuEvent(QContextMenuEvent* e); void enterEvent(QEvent*); -signals: + signals: void SectionVisibilityChanged(int logical, bool visible); void SectionRatingLockStatusChanged(bool state); void MouseEntered(); @@ -61,7 +61,6 @@ signals: QAction* align_center_action_; QAction* align_right_action_; QList show_actions_; - }; #endif // PLAYLISTHEADER_H diff --git a/src/playlist/playlistitem.cpp b/src/playlist/playlistitem.cpp index ad3289853..5171cff2a 100644 --- a/src/playlist/playlistitem.cpp +++ b/src/playlist/playlistitem.cpp @@ -16,21 +16,22 @@ */ #include "playlistitem.h" -#include "songplaylistitem.h" -#include "core/logging.h" -#include "core/song.h" -#include "internet/jamendo/jamendoplaylistitem.h" -#include "internet/jamendo/jamendoservice.h" -#include "internet/magnatune/magnatuneplaylistitem.h" -#include "internet/magnatune/magnatuneservice.h" -#include "internet/core/internetplaylistitem.h" -#include "library/library.h" -#include "library/libraryplaylistitem.h" #include #include #include +#include "core/logging.h" +#include "core/song.h" +#include "internet/core/internetplaylistitem.h" +#include "internet/jamendo/jamendoplaylistitem.h" +#include "internet/jamendo/jamendoservice.h" +#include "internet/magnatune/magnatuneplaylistitem.h" +#include "internet/magnatune/magnatuneservice.h" +#include "library/library.h" +#include "library/libraryplaylistitem.h" +#include "songplaylistitem.h" + PlaylistItem::~PlaylistItem() {} PlaylistItem* PlaylistItem::NewFromType(const QString& type) { diff --git a/src/playlist/playlistitem.h b/src/playlist/playlistitem.h index fa3da96e6..c9bd8c5ed 100644 --- a/src/playlist/playlistitem.h +++ b/src/playlist/playlistitem.h @@ -18,13 +18,12 @@ #ifndef PLAYLISTITEM_H #define PLAYLISTITEM_H -#include - #include #include #include #include #include +#include #include "core/song.h" diff --git a/src/playlist/playlistitemmimedata.h b/src/playlist/playlistitemmimedata.h index 2be3b59d3..fb8abfc35 100644 --- a/src/playlist/playlistitemmimedata.h +++ b/src/playlist/playlistitemmimedata.h @@ -18,8 +18,8 @@ #ifndef PLAYLISTITEMMIMEDATA_H #define PLAYLISTITEMMIMEDATA_H -#include "playlistitem.h" #include "core/mimedata.h" +#include "playlistitem.h" class PlaylistItemMimeData : public MimeData { Q_OBJECT diff --git a/src/playlist/playlistlistcontainer.cpp b/src/playlist/playlistlistcontainer.cpp index a8da3da01..77ef82cee 100644 --- a/src/playlist/playlistlistcontainer.cpp +++ b/src/playlist/playlistlistcontainer.cpp @@ -15,15 +15,7 @@ along with Clementine. If not, see . */ -#include "playlist.h" #include "playlistlistcontainer.h" -#include "playlistlistmodel.h" -#include "playlistmanager.h" -#include "ui_playlistlistcontainer.h" -#include "core/application.h" -#include "core/logging.h" -#include "core/player.h" -#include "ui/iconloader.h" #include #include @@ -32,9 +24,17 @@ #include #include #include - #include +#include "core/application.h" +#include "core/logging.h" +#include "core/player.h" +#include "playlist.h" +#include "playlistlistmodel.h" +#include "playlistmanager.h" +#include "ui/iconloader.h" +#include "ui_playlistlistcontainer.h" + /* This filter proxy will: - Accept all ancestors if at least a single child matches - Accept all children if at least a single ancestor matches @@ -60,12 +60,12 @@ class PlaylistListFilterProxyModel : public QSortFilterProxyModel { QList expandList; - void setFilterRegExp(const QRegExp & regExp) { + void setFilterRegExp(const QRegExp& regExp) { expandList.clear(); QSortFilterProxyModel::setFilterRegExp(regExp); } - void refreshExpanded(QTreeView *tree) { + void refreshExpanded(QTreeView* tree) { tree->collapseAll(); // The call to setExpanded causes expendList to be appended via // the filterAcceptsRow overload. Since QList's implementation is an array, @@ -74,44 +74,44 @@ class PlaylistListFilterProxyModel : public QSortFilterProxyModel { // indexing is safe and efficient. for (int i = 0; i < expandList.count(); i++) { const QModelIndex& sourceIndex = expandList[i]; - QModelIndex mappedIndex = mapFromSource( sourceIndex ); - tree->setExpanded( mappedIndex, true ); + QModelIndex mappedIndex = mapFromSource(sourceIndex); + tree->setExpanded(mappedIndex, true); } } // Depth first search of all the items - bool hasAcceptedChildren(int source_row, const QModelIndex &source_parent) const { - QModelIndex item = sourceModel()->index(source_row,0,source_parent); + bool hasAcceptedChildren(int source_row, + const QModelIndex& source_parent) const { + QModelIndex item = sourceModel()->index(source_row, 0, source_parent); if (!item.isValid()) { return false; } - //check if there are children + // check if there are children int childCount = item.model()->rowCount(item); - if (childCount == 0) - return false; + if (childCount == 0) return false; for (int i = 0; i < childCount; ++i) { - if (filterAcceptsRowItself(i, item)) - return true; + if (filterAcceptsRowItself(i, item)) return true; - if (hasAcceptedChildren(i, item)) - return true; + if (hasAcceptedChildren(i, item)) return true; } return false; } - bool filterAcceptsRowItself(int source_row, const QModelIndex &source_parent) const { - bool rv = QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); - if(rv) { - if(sourceModel()->hasIndex(source_row,0,source_parent)) { - QModelIndex idx = sourceModel()->index(source_row,0,source_parent); + bool filterAcceptsRowItself(int source_row, + const QModelIndex& source_parent) const { + bool rv = + QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); + if (rv) { + if (sourceModel()->hasIndex(source_row, 0, source_parent)) { + QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); // Bit of a hack to get around the const in this function - auto * me = const_cast(this); + auto* me = const_cast(this); QModelIndex pidx = sourceModel()->parent(idx); - while(pidx.isValid()) { + while (pidx.isValid()) { me->expandList.append(pidx); pidx = sourceModel()->parent(pidx); } @@ -120,20 +120,20 @@ class PlaylistListFilterProxyModel : public QSortFilterProxyModel { return rv; } - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { + bool filterAcceptsRow(int source_row, + const QModelIndex& source_parent) const { if (filterAcceptsRowItself(source_row, source_parent)) { return true; } - //accept if any of the parents is accepted on it's own merits + // accept if any of the parents is accepted on it's own merits QModelIndex parent = source_parent; while (parent.isValid()) { - if (filterAcceptsRowItself(parent.row(), parent.parent())) - return true; + if (filterAcceptsRowItself(parent.row(), parent.parent())) return true; parent = parent.parent(); } - //accept if any of the children is accepted on it's own merits + // accept if any of the children is accepted on it's own merits return hasAcceptedChildren(source_row, source_parent); } }; @@ -180,7 +180,8 @@ PlaylistListContainer::PlaylistListContainer(QWidget* parent) model_->invisibleRootItem()->setData(PlaylistListModel::Type_Folder, PlaylistListModel::Role_Type); - connect(ui_->search, SIGNAL(textChanged(QString)), SLOT(SearchTextEdited(QString))); + connect(ui_->search, SIGNAL(textChanged(QString)), + SLOT(SearchTextEdited(QString))); } PlaylistListContainer::~PlaylistListContainer() { delete ui_; } @@ -195,7 +196,8 @@ void PlaylistListContainer::showEvent(QShowEvent* e) { action_new_folder_->setIcon(IconLoader::Load("folder-new", IconLoader::Base)); action_remove_->setIcon(IconLoader::Load("edit-delete", IconLoader::Base)); - action_save_playlist_->setIcon(IconLoader::Load("document-save", IconLoader::Base)); + action_save_playlist_->setIcon( + IconLoader::Load("document-save", IconLoader::Base)); model_->SetIcons(IconLoader::Load("view-media-playlist", IconLoader::Base), IconLoader::Load("folder", IconLoader::Base)); @@ -252,7 +254,7 @@ void PlaylistListContainer::SetApplication(Application* app) { // Get all playlists, even ones that are hidden in the UI. for (const PlaylistBackend::Playlist& p : app->playlist_backend()->GetAllFavoritePlaylists()) { - AddPlaylist(p.id,p.name,true,&p.ui_path); + AddPlaylist(p.id, p.name, true, &p.ui_path); } } @@ -269,7 +271,7 @@ void PlaylistListContainer::NewFolderClicked() { } void PlaylistListContainer::AddPlaylist(int id, const QString& name, - bool favorite, const QString *ui_path) { + bool favorite, const QString* ui_path) { if (!favorite) { return; } @@ -280,7 +282,7 @@ void PlaylistListContainer::AddPlaylist(int id, const QString& name, return; } - if(ui_path == nullptr) + if (ui_path == nullptr) ui_path = &app_->playlist_manager()->playlist(id)->ui_path(); QStandardItem* playlist_item = model_->NewPlaylist(name, id); @@ -291,7 +293,6 @@ void PlaylistListContainer::AddPlaylist(int id, const QString& name, track_item->setDragEnabled(false); playlist_item->appendRow(track_item); } - } void PlaylistListContainer::PlaylistRenamed(int id, const QString& new_name) { @@ -367,16 +368,16 @@ void PlaylistListContainer::CurrentChanged(Playlist* new_playlist) { } void PlaylistListContainer::SearchTextEdited(const QString& text) { - QRegExp regexp(text); - regexp.setCaseSensitivity(Qt::CaseInsensitive); + QRegExp regexp(text); + regexp.setCaseSensitivity(Qt::CaseInsensitive); - proxy_->setFilterRegExp(regexp); + proxy_->setFilterRegExp(regexp); - if(regexp.isEmpty()) { - ui_->tree->collapseAll(); - } else { - proxy_->refreshExpanded(ui_->tree); - } + if (regexp.isEmpty()) { + ui_->tree->collapseAll(); + } else { + proxy_->refreshExpanded(ui_->tree); + } } void PlaylistListContainer::PlaylistPathChanged(int id, @@ -428,7 +429,8 @@ void PlaylistListContainer::DeleteClicked() { const int button = QMessageBox::question( this, tr("Remove playlists"), tr("You are about to remove %1 playlists from your favorites, are you " - "sure?").arg(ids.count()), + "sure?") + .arg(ids.count()), QMessageBox::Yes, QMessageBox::Cancel); if (button != QMessageBox::Yes) { diff --git a/src/playlist/playlistlistcontainer.h b/src/playlist/playlistlistcontainer.h index 5003914e3..ec11271f8 100644 --- a/src/playlist/playlistlistcontainer.h +++ b/src/playlist/playlistlistcontainer.h @@ -18,10 +18,10 @@ #ifndef PLAYLISTLISTCONTAINER_H #define PLAYLISTLISTCONTAINER_H -#include "playlistbackend.h" - #include +#include "playlistbackend.h" + class QMenu; class QSortFilterProxyModel; class QStandardItemModel; @@ -59,7 +59,8 @@ class PlaylistListContainer : public QWidget { // From the PlaylistManager void PlaylistRenamed(int id, const QString& new_name); // Add playlist if favorite == true - void AddPlaylist(int id, const QString& name, bool favorite, const QString *ui_path = nullptr); + void AddPlaylist(int id, const QString& name, bool favorite, + const QString* ui_path = nullptr); void RemovePlaylist(int id); void SavePlaylist(); void PlaylistFavoriteStateChanged(int id, bool favorite); diff --git a/src/playlist/playlistlistmodel.cpp b/src/playlist/playlistlistmodel.cpp index 478630c50..bf3884d04 100644 --- a/src/playlist/playlistlistmodel.cpp +++ b/src/playlist/playlistlistmodel.cpp @@ -1,8 +1,9 @@ #include "playlistlistmodel.h" -#include "core/logging.h" #include +#include "core/logging.h" + PlaylistListModel::PlaylistListModel(QObject* parent) : QStandardItemModel(parent), dropping_rows_(false) { connect(this, SIGNAL(dataChanged(QModelIndex, QModelIndex)), @@ -184,7 +185,8 @@ QStandardItem* PlaylistListModel::NewTrack(const Song& song) const { ret->setData(PlaylistListModel::Type_Track, PlaylistListModel::Role_Type); ret->setData(song.id(), PlaylistListModel::Role_TrackId); ret->setIcon(track_icon_); - ret->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable); + ret->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | + Qt::ItemIsSelectable); return ret; } diff --git a/src/playlist/playlistlistmodel.h b/src/playlist/playlistlistmodel.h index 590586fd3..5d0b49da0 100644 --- a/src/playlist/playlistlistmodel.h +++ b/src/playlist/playlistlistmodel.h @@ -2,6 +2,7 @@ #define PLAYLISTLISTMODEL_H #include + #include "core/song.h" class PlaylistListModel : public QStandardItemModel { Q_OBJECT @@ -48,7 +49,7 @@ class PlaylistListModel : public QStandardItemModel { // QStandardItemModel bool setData(const QModelIndex& index, const QVariant& value, int role); -signals: + signals: void PlaylistPathChanged(int id, const QString& new_path); void PlaylistRenamed(int id, const QString& new_name); diff --git a/src/playlist/playlistmanager.cpp b/src/playlist/playlistmanager.cpp index 5a7719267..9f59e2326 100644 --- a/src/playlist/playlistmanager.cpp +++ b/src/playlist/playlistmanager.cpp @@ -15,6 +15,15 @@ along with Clementine. If not, see . */ +#include "playlistmanager.h" + +#include +#include +#include +#include +#include +#include + #include "core/application.h" #include "core/logging.h" #include "core/player.h" @@ -24,20 +33,12 @@ #include "library/libraryplaylistitem.h" #include "playlistbackend.h" #include "playlistcontainer.h" -#include "playlistmanager.h" #include "playlistparsers/playlistparser.h" #include "playlistsaveoptionsdialog.h" #include "playlistview.h" #include "queue.h" #include "smartplaylists/generator.h" -#include -#include -#include -#include -#include -#include - using smart_playlists::GeneratorPtr; PlaylistManager::PlaylistManager(Application* app, QObject* parent) @@ -185,8 +186,9 @@ void PlaylistManager::Save(int id, const QString& filename, // from the left side bar and the playlist isn't loaded. QFuture> future = QtConcurrent::run( playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id); - NewClosure(future, this, SLOT(ItemsLoadedForSavePlaylist( - QFuture, QString, Playlist::Path)), + NewClosure(future, this, + SLOT(ItemsLoadedForSavePlaylist(QFuture, QString, + Playlist::Path)), future, filename, path_type); } } @@ -201,8 +203,9 @@ void PlaylistManager::SaveWithUI(int id, const QString& playlist_name) { QSettings settings; settings.beginGroup(Playlist::kSettingsGroup); QString filename = settings.value("last_save_playlist").toString(); - QString extension = settings.value("last_save_extension", - parser()->default_extension()).toString(); + QString extension = + settings.value("last_save_extension", parser()->default_extension()) + .toString(); QString filter = settings.value("last_save_filter", parser()->default_filter()).toString(); diff --git a/src/playlist/playlistmanager.h b/src/playlist/playlistmanager.h index e674393d1..c7fc795af 100644 --- a/src/playlist/playlistmanager.h +++ b/src/playlist/playlistmanager.h @@ -111,7 +111,7 @@ class PlaylistManagerInterface : public QObject { virtual void PlaySmartPlaylist(smart_playlists::GeneratorPtr generator, bool as_new, bool clear) = 0; -signals: + signals: void PlaylistManagerInitialized(); void PlaylistAdded(int id, const QString& name, bool favorite); diff --git a/src/playlist/playlistsaveoptionsdialog.cpp b/src/playlist/playlistsaveoptionsdialog.cpp index 69a4f4a94..54624d687 100644 --- a/src/playlist/playlistsaveoptionsdialog.cpp +++ b/src/playlist/playlistsaveoptionsdialog.cpp @@ -17,11 +17,11 @@ #include "playlistsaveoptionsdialog.h" -#include "ui_playlistsaveoptionsdialog.h" -#include "playlistparsers/parserbase.h" - #include +#include "playlistparsers/parserbase.h" +#include "ui_playlistsaveoptionsdialog.h" + const char* PlaylistSaveOptionsDialog::kSettingsGroup = "PlaylistSaveOptionsDialog"; diff --git a/src/playlist/playlistsequence.cpp b/src/playlist/playlistsequence.cpp index 447a2fe9b..35759bb3b 100644 --- a/src/playlist/playlistsequence.cpp +++ b/src/playlist/playlistsequence.cpp @@ -16,14 +16,15 @@ */ #include "playlistsequence.h" -#include "ui_playlistsequence.h" -#include "ui/iconloader.h" -#include #include +#include +#include #include #include -#include + +#include "ui/iconloader.h" +#include "ui_playlistsequence.h" const char* PlaylistSequence::kSettingsGroup = "PlaylistSequence"; @@ -40,10 +41,10 @@ PlaylistSequence::PlaylistSequence(QWidget* parent, SettingsProvider* settings) ui_->setupUi(this); // Icons - ui_->repeat->setIcon( - AddDesaturatedIcon(IconLoader::Load("media-playlist-repeat", IconLoader::Base))); - ui_->shuffle->setIcon( - AddDesaturatedIcon(IconLoader::Load("media-playlist-shuffle", IconLoader::Base))); + ui_->repeat->setIcon(AddDesaturatedIcon( + IconLoader::Load("media-playlist-repeat", IconLoader::Base))); + ui_->shuffle->setIcon(AddDesaturatedIcon( + IconLoader::Load("media-playlist-shuffle", IconLoader::Base))); // Remove arrow indicators ui_->repeat->setStyleSheet("QToolButton::menu-indicator { image: none; }"); diff --git a/src/playlist/playlistsequence.h b/src/playlist/playlistsequence.h index 855504d50..b440e2e5b 100644 --- a/src/playlist/playlistsequence.h +++ b/src/playlist/playlistsequence.h @@ -18,9 +18,8 @@ #ifndef PLAYLISTSEQUENCE_H #define PLAYLISTSEQUENCE_H -#include - #include +#include #include "core/settingsprovider.h" @@ -65,7 +64,7 @@ class PlaylistSequence : public QWidget { void CycleRepeatMode(); void SetUsingDynamicPlaylist(bool dynamic); -signals: + signals: void RepeatModeChanged(PlaylistSequence::RepeatMode mode); void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode); diff --git a/src/playlist/playlisttabbar.cpp b/src/playlist/playlisttabbar.cpp index ba7a674eb..a3c6c5187 100644 --- a/src/playlist/playlisttabbar.cpp +++ b/src/playlist/playlisttabbar.cpp @@ -15,16 +15,7 @@ along with Clementine. If not, see . */ -#include "playlist.h" -#include "playlistmanager.h" #include "playlisttabbar.h" -#include "playlistview.h" -#include "songmimedata.h" -#include "core/logging.h" -#include "internet/core/internetmimedata.h" -#include "ui/iconloader.h" -#include "widgets/renametablineedit.h" -#include "widgets/favoritewidget.h" #include #include @@ -36,6 +27,16 @@ #include #include +#include "core/logging.h" +#include "internet/core/internetmimedata.h" +#include "playlist.h" +#include "playlistmanager.h" +#include "playlistview.h" +#include "songmimedata.h" +#include "ui/iconloader.h" +#include "widgets/favoritewidget.h" +#include "widgets/renametablineedit.h" + const char* PlaylistTabBar::kSettingsGroup = "PlaylistTabBar"; PlaylistTabBar::PlaylistTabBar(QWidget* parent) diff --git a/src/playlist/playlisttabbar.h b/src/playlist/playlisttabbar.h index 98cb74b93..433c92307 100644 --- a/src/playlist/playlisttabbar.h +++ b/src/playlist/playlisttabbar.h @@ -53,7 +53,7 @@ class PlaylistTabBar : public QTabBar { void RemoveTab(int id); void InsertTab(int id, int index, const QString& text, bool favorite); -signals: + signals: void CurrentIdChanged(int id); void Rename(int id, const QString& name); void Close(int id); diff --git a/src/playlist/playlistundocommands.cpp b/src/playlist/playlistundocommands.cpp index 38d876c1b..e7cc539a1 100644 --- a/src/playlist/playlistundocommands.cpp +++ b/src/playlist/playlistundocommands.cpp @@ -16,6 +16,7 @@ */ #include "playlistundocommands.h" + #include "playlist.h" namespace PlaylistUndoCommands { @@ -110,4 +111,4 @@ ShuffleItems::ShuffleItems(Playlist* playlist, setText(tr("shuffle songs")); } -} // namespace +} // namespace PlaylistUndoCommands diff --git a/src/playlist/playlistundocommands.h b/src/playlist/playlistundocommands.h index 4b5e70a52..d34d7ddc0 100644 --- a/src/playlist/playlistundocommands.h +++ b/src/playlist/playlistundocommands.h @@ -18,15 +18,17 @@ #ifndef PLAYLISTUNDOCOMMANDS_H #define PLAYLISTUNDOCOMMANDS_H -#include #include +#include #include "playlistitem.h" class Playlist; namespace PlaylistUndoCommands { -enum Types { Type_RemoveItems = 0, }; +enum Types { + Type_RemoveItems = 0, +}; class Base : public QUndoCommand { Q_DECLARE_TR_FUNCTIONS(PlaylistUndoCommands) @@ -118,6 +120,6 @@ class ShuffleItems : public ReOrderItems { public: ShuffleItems(Playlist* playlist, const PlaylistItemList& new_items); }; -} // namespace +} // namespace PlaylistUndoCommands #endif // PLAYLISTUNDOCOMMANDS_H diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 5d27e1555..050c7a985 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -15,35 +15,36 @@ along with Clementine. If not, see . */ -#include "config.h" -#include "dynamicplaylistcontrols.h" -#include "playlist.h" -#include "playlistdelegates.h" -#include "playlistheader.h" #include "playlistview.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" #include "core/application.h" #include "core/logging.h" #include "core/player.h" #include "covers/currentartloader.h" -#include "ui/qt_blurimage.h" +#include "dynamicplaylistcontrols.h" +#include "playlist.h" +#include "playlistdelegates.h" +#include "playlistheader.h" #include "ui/iconloader.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include +#include "ui/qt_blurimage.h" #ifdef HAVE_MOODBAR #include "moodbar/moodbaritemdelegate.h" @@ -198,9 +199,7 @@ PlaylistView::PlaylistView(QWidget* parent) fade_animation_->setDirection(QTimeLine::Backward); // 1.0 -> 0.0 } -PlaylistView::~PlaylistView() { - delete style_; -} +PlaylistView::~PlaylistView() { delete style_; } void PlaylistView::SetApplication(Application* app) { Q_ASSERT(app); @@ -554,8 +553,8 @@ void PlaylistView::drawRow(QPainter* painter, painter->drawPixmap(opt.rect, cached_current_row_); } else { if (whole_region) { - const_cast(this) - ->UpdateCachedCurrentRowPixmap(opt, index); + const_cast(this)->UpdateCachedCurrentRowPixmap(opt, + index); painter->drawPixmap(opt.rect, cached_current_row_); } else { QTreeView::drawRow(painter, opt, index); @@ -637,8 +636,7 @@ void PlaylistView::keyPressEvent(QKeyEvent* event) { event->accept(); } else if (event->modifiers() != Qt::ControlModifier // Ctrl+Space selects // the item - && - event->key() == Qt::Key_Space) { + && event->key() == Qt::Key_Space) { emit PlayPause(); event->accept(); } else if (event->key() == Qt::Key_Left) { @@ -649,7 +647,7 @@ void PlaylistView::keyPressEvent(QKeyEvent* event) { event->accept(); } else if (event->modifiers() == Qt::NoModifier // No modifier keys currently pressed... - // ... and key pressed is something related to text + // ... and key pressed is something related to text && ((event->key() >= Qt::Key_Exclam && event->key() <= Qt::Key_Z) || event->key() == Qt::Key_Backspace || @@ -1037,9 +1035,9 @@ void PlaylistView::paintEvent(QPaintEvent* event) { if (model()->rowCount() == 0) drop_pos = 1; else - drop_pos = 1 + - visualRect(model()->index(model()->rowCount() - 1, - first_column)).bottom(); + drop_pos = 1 + visualRect(model()->index(model()->rowCount() - 1, + first_column)) + .bottom(); break; } diff --git a/src/playlist/playlistview.h b/src/playlist/playlistview.h index b4ed06eaf..c3ab2ed88 100644 --- a/src/playlist/playlistview.h +++ b/src/playlist/playlistview.h @@ -18,11 +18,10 @@ #ifndef PLAYLISTVIEW_H #define PLAYLISTVIEW_H -#include - #include #include #include +#include #include "playlist.h" @@ -107,7 +106,7 @@ class PlaylistView : public QTreeView { const QImage& cover_art); void PlayerStopped(); -signals: + signals: void PlayItem(const QModelIndex& index); void PlayPause(); void RightClicked(const QPoint& global_pos, const QModelIndex& index); diff --git a/src/playlist/queue.cpp b/src/playlist/queue.cpp index c633f38cc..6e22ae222 100644 --- a/src/playlist/queue.cpp +++ b/src/playlist/queue.cpp @@ -17,11 +17,10 @@ #include "queue.h" -#include - #include #include #include +#include #include "core/utilities.h" diff --git a/src/playlist/queue.h b/src/playlist/queue.h index 73271b1d4..d2d2a0f7d 100644 --- a/src/playlist/queue.h +++ b/src/playlist/queue.h @@ -18,10 +18,10 @@ #ifndef QUEUE_H #define QUEUE_H -#include "playlist.h" - #include +#include "playlist.h" + class Queue : public QAbstractProxyModel { Q_OBJECT diff --git a/src/playlist/queuemanager.cpp b/src/playlist/queuemanager.cpp index 277c099c8..1ef0e4571 100644 --- a/src/playlist/queuemanager.cpp +++ b/src/playlist/queuemanager.cpp @@ -15,18 +15,18 @@ along with Clementine. If not, see . */ +#include "queuemanager.h" + +#include +#include +#include + #include "playlist.h" #include "playlistdelegates.h" #include "playlistmanager.h" #include "queue.h" -#include "queuemanager.h" -#include "ui_queuemanager.h" #include "ui/iconloader.h" - -#include - -#include -#include +#include "ui_queuemanager.h" QueueManager::QueueManager(QWidget* parent) : QDialog(parent), diff --git a/src/playlist/songloaderinserter.cpp b/src/playlist/songloaderinserter.cpp index ffa83e59a..8f597d9e9 100644 --- a/src/playlist/songloaderinserter.cpp +++ b/src/playlist/songloaderinserter.cpp @@ -15,13 +15,14 @@ along with Clementine. If not, see . */ +#include "songloaderinserter.h" + #include -#include "playlist.h" -#include "songloaderinserter.h" #include "core/logging.h" #include "core/songloader.h" #include "core/taskmanager.h" +#include "playlist.h" SongLoaderInserter::SongLoaderInserter(TaskManager* task_manager, LibraryBackendInterface* library, @@ -89,16 +90,18 @@ void SongLoaderInserter::LoadAudioCD(Playlist* destination, int row, enqueue_next_ = enqueue_next; SongLoader* loader = new SongLoader(library_, player_, this); - NewClosure(loader, SIGNAL(AudioCDTracksLoaded()), - this, SLOT(AudioCDTracksLoaded(SongLoader*)), loader); - connect(loader, SIGNAL(LoadAudioCDFinished(bool)), SLOT(AudioCDTagsLoaded(bool))); + NewClosure(loader, SIGNAL(AudioCDTracksLoaded()), this, + SLOT(AudioCDTracksLoaded(SongLoader*)), loader); + connect(loader, SIGNAL(LoadAudioCDFinished(bool)), + SLOT(AudioCDTagsLoaded(bool))); qLog(Info) << "Loading audio CD..."; SongLoader::Result ret = loader->LoadAudioCD(); if (ret == SongLoader::Error) { emit Error(tr("Error while loading audio CD")); delete loader; } - // Songs will be loaded later: see AudioCDTracksLoaded and AudioCDTagsLoaded slots + // Songs will be loaded later: see AudioCDTracksLoaded and AudioCDTagsLoaded + // slots } void SongLoaderInserter::DestinationDestroyed() { destination_ = nullptr; } diff --git a/src/playlist/songplaylistitem.cpp b/src/playlist/songplaylistitem.cpp index 137326b15..0b599b6ab 100644 --- a/src/playlist/songplaylistitem.cpp +++ b/src/playlist/songplaylistitem.cpp @@ -15,15 +15,15 @@ along with Clementine. If not, see . */ -#include "playlistbackend.h" #include "songplaylistitem.h" -#include "core/tagreaderclient.h" -#include "library/sqlrow.h" - -#include #include #include +#include + +#include "core/tagreaderclient.h" +#include "library/sqlrow.h" +#include "playlistbackend.h" SongPlaylistItem::SongPlaylistItem(const QString& type) : PlaylistItem(type) {} diff --git a/src/playlist/songplaylistitem.h b/src/playlist/songplaylistitem.h index f2315a84c..27908f3f1 100644 --- a/src/playlist/songplaylistitem.h +++ b/src/playlist/songplaylistitem.h @@ -18,8 +18,8 @@ #ifndef SONGPLAYLISTITEM_H #define SONGPLAYLISTITEM_H -#include "playlistitem.h" #include "core/song.h" +#include "playlistitem.h" class SongPlaylistItem : public PlaylistItem { public: diff --git a/src/playlistparsers/asxiniparser.cpp b/src/playlistparsers/asxiniparser.cpp index d52220ed5..af5cdecbd 100644 --- a/src/playlistparsers/asxiniparser.cpp +++ b/src/playlistparsers/asxiniparser.cpp @@ -16,11 +16,12 @@ */ #include "asxiniparser.h" -#include "core/logging.h" #include #include +#include "core/logging.h" + AsxIniParser::AsxIniParser(LibraryBackendInterface* library, QObject* parent) : ParserBase(library, parent) {} diff --git a/src/playlistparsers/asxparser.cpp b/src/playlistparsers/asxparser.cpp index 505ce758e..9f31568b3 100644 --- a/src/playlistparsers/asxparser.cpp +++ b/src/playlistparsers/asxparser.cpp @@ -16,7 +16,6 @@ */ #include "asxparser.h" -#include "core/utilities.h" #include #include @@ -27,6 +26,8 @@ #include #include +#include "core/utilities.h" + ASXParser::ASXParser(LibraryBackendInterface* library, QObject* parent) : XMLParser(library, parent) {} diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index b6fa02319..c460297c6 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -16,18 +16,19 @@ */ #include "cueparser.h" -#include "core/logging.h" -#include "core/timeconstants.h" #include #include #include -#include #include +#include #include #include #include +#include "core/logging.h" +#include "core/timeconstants.h" + const char* CueParser::kFileLineRegExp = "(\\S+)\\s+(?:\"([^\"]+)\"|(\\S+))\\s*(?:\"([^\"]+)\"|(\\S+))?"; const char* CueParser::kIndexRegExp = "(\\d{2,3}):(\\d{2}):(\\d{2})"; @@ -120,12 +121,12 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, // REM DATE } else if (line_value.toLower() == kDate) { date = splitted[2]; - + // REM DISC } else if (line_value.toLower() == kDisc) { disc = splitted[2]; } - + // end of the header -> go into the track mode } else if (line_name == kTrack) { files++; @@ -174,8 +175,8 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, if (valid_file && !index.isEmpty() && (track_type.isEmpty() || track_type == kAudioTrackType)) { entries.append(CueEntry(file, index, title, artist, album_artist, - album, composer, album_composer, genre, - date, disc)); + album, composer, album_composer, genre, date, + disc)); } // clear the state @@ -298,7 +299,7 @@ bool CueParser::UpdateSong(const CueEntry& entry, const QString& next_index, song->set_genre(entry.genre); song->set_year(entry.date.toInt()); song->set_disc(entry.disc.toInt()); - + return true; } @@ -324,7 +325,7 @@ bool CueParser::UpdateLastSong(const CueEntry& entry, Song* song) const { song->set_year(entry.date.toInt()); song->set_composer(entry.PrettyComposer()); song->set_disc(entry.disc.toInt()); - + // we don't do anything with the end here because it's already set to // the end of the media file (if it exists) song->set_beginning_nanosec(beginning); diff --git a/src/playlistparsers/cueparser.h b/src/playlistparsers/cueparser.h index 33187136f..600ddf6e3 100644 --- a/src/playlistparsers/cueparser.h +++ b/src/playlistparsers/cueparser.h @@ -18,10 +18,10 @@ #ifndef CUEPARSER_H #define CUEPARSER_H -#include "parserbase.h" - #include +#include "parserbase.h" + // This parser will try to detect the real encoding of a .cue file but there's // a great chance it will fail so it's probably best to assume that the parser // is UTF compatible only. @@ -43,7 +43,7 @@ class CueParser : public ParserBase { static const char* kGenre; static const char* kDate; static const char* kDisc; - + CueParser(LibraryBackendInterface* library, QObject* parent = nullptr); QString name() const { return "CUE"; } @@ -85,7 +85,8 @@ class CueParser : public ParserBase { CueEntry(QString& file, QString& index, QString& title, QString& artist, QString& album_artist, QString& album, QString& composer, - QString& album_composer, QString& genre, QString& date, QString& disc) { + QString& album_composer, QString& genre, QString& date, + QString& disc) { this->file = file; this->index = index; this->title = title; diff --git a/src/playlistparsers/m3uparser.cpp b/src/playlistparsers/m3uparser.cpp index a716830b5..11bc0172e 100644 --- a/src/playlistparsers/m3uparser.cpp +++ b/src/playlistparsers/m3uparser.cpp @@ -16,14 +16,14 @@ */ #include "m3uparser.h" -#include "core/logging.h" -#include "core/timeconstants.h" - -#include "playlist/playlist.h" #include #include +#include "core/logging.h" +#include "core/timeconstants.h" +#include "playlist/playlist.h" + M3UParser::M3UParser(LibraryBackendInterface* library, QObject* parent) : ParserBase(library, parent) {} diff --git a/src/playlistparsers/m3uparser.h b/src/playlistparsers/m3uparser.h index 887a24cad..e8af2020f 100644 --- a/src/playlistparsers/m3uparser.h +++ b/src/playlistparsers/m3uparser.h @@ -21,7 +21,6 @@ #include #include "gtest/gtest_prod.h" - #include "parserbase.h" class M3UParser : public ParserBase { diff --git a/src/playlistparsers/parserbase.cpp b/src/playlistparsers/parserbase.cpp index 3dbd2e134..c8a3942ef 100644 --- a/src/playlistparsers/parserbase.cpp +++ b/src/playlistparsers/parserbase.cpp @@ -16,14 +16,15 @@ */ #include "parserbase.h" + +#include + #include "core/tagreaderclient.h" #include "library/librarybackend.h" #include "library/libraryquery.h" #include "library/sqlrow.h" #include "playlist/playlist.h" -#include - ParserBase::ParserBase(LibraryBackendInterface* library, QObject* parent) : QObject(parent), library_(library) {} diff --git a/src/playlistparsers/parserbase.h b/src/playlistparsers/parserbase.h index f5fc297ce..476bc6d54 100644 --- a/src/playlistparsers/parserbase.h +++ b/src/playlistparsers/parserbase.h @@ -18,8 +18,8 @@ #ifndef PARSERBASE_H #define PARSERBASE_H -#include #include +#include #include "core/song.h" #include "playlist/playlist.h" diff --git a/src/playlistparsers/playlistparser.cpp b/src/playlistparsers/playlistparser.cpp index cc48062e1..6241bc91c 100644 --- a/src/playlistparsers/playlistparser.cpp +++ b/src/playlistparsers/playlistparser.cpp @@ -15,19 +15,19 @@ along with Clementine. If not, see . */ -#include "asxparser.h" +#include "playlistparser.h" + +#include +#include + #include "asxiniparser.h" +#include "asxparser.h" +#include "core/logging.h" #include "cueparser.h" #include "m3uparser.h" -#include "playlistparser.h" #include "plsparser.h" #include "wplparser.h" #include "xspfparser.h" -#include "core/logging.h" - -#include - -#include const int PlaylistParser::kMagicSize = 512; diff --git a/src/playlistparsers/plsparser.cpp b/src/playlistparsers/plsparser.cpp index 0d7016ac7..e7a3bdd1f 100644 --- a/src/playlistparsers/plsparser.cpp +++ b/src/playlistparsers/plsparser.cpp @@ -16,12 +16,13 @@ */ #include "plsparser.h" -#include "core/logging.h" -#include "core/timeconstants.h" #include #include +#include "core/logging.h" +#include "core/timeconstants.h" + PLSParser::PLSParser(LibraryBackendInterface* library, QObject* parent) : ParserBase(library, parent) {} diff --git a/src/playlistparsers/wplparser.cpp b/src/playlistparsers/wplparser.cpp index f11156528..ec6fcd539 100644 --- a/src/playlistparsers/wplparser.cpp +++ b/src/playlistparsers/wplparser.cpp @@ -16,11 +16,12 @@ */ #include "wplparser.h" -#include "core/utilities.h" -#include "version.h" #include +#include "core/utilities.h" +#include "version.h" + WplParser::WplParser(LibraryBackendInterface* library, QObject* parent) : XMLParser(library, parent) {} diff --git a/src/playlistparsers/xmlparser.h b/src/playlistparsers/xmlparser.h index 72f419ed0..7ef8a015b 100644 --- a/src/playlistparsers/xmlparser.h +++ b/src/playlistparsers/xmlparser.h @@ -18,11 +18,11 @@ #ifndef XMLPARSER_H #define XMLPARSER_H -#include "parserbase.h" - #include #include +#include "parserbase.h" + class QDomDocument; class QDomNode; diff --git a/src/playlistparsers/xspfparser.cpp b/src/playlistparsers/xspfparser.cpp index c796d64b9..9520c2d4b 100644 --- a/src/playlistparsers/xspfparser.cpp +++ b/src/playlistparsers/xspfparser.cpp @@ -16,10 +16,6 @@ */ #include "xspfparser.h" -#include "core/timeconstants.h" -#include "core/utilities.h" - -#include "playlist/playlist.h" #include #include @@ -28,6 +24,10 @@ #include #include +#include "core/timeconstants.h" +#include "core/utilities.h" +#include "playlist/playlist.h" + XSPFParser::XSPFParser(LibraryBackendInterface* library, QObject* parent) : XMLParser(library, parent) {} diff --git a/src/playlistparsers/xspfparser.h b/src/playlistparsers/xspfparser.h index 4ddc1eb54..b43a621dc 100644 --- a/src/playlistparsers/xspfparser.h +++ b/src/playlistparsers/xspfparser.h @@ -18,10 +18,10 @@ #ifndef XSPFPARSER_H #define XSPFPARSER_H -#include "xmlparser.h" - #include +#include "xmlparser.h" + class QDomDocument; class QDomNode; diff --git a/src/ripper/ripcddialog.cpp b/src/ripper/ripcddialog.cpp index 522becfb2..6387bb919 100644 --- a/src/ripper/ripcddialog.cpp +++ b/src/ripper/ripcddialog.cpp @@ -17,8 +17,6 @@ #include "ripper/ripcddialog.h" -#include - #include #include #include @@ -27,6 +25,7 @@ #include #include #include +#include #include "config.h" #include "core/logging.h" @@ -67,8 +66,8 @@ RipCDDialog::RipCDDialog(QWidget* parent) kCheckboxColumn, QHeaderView::ResizeToContents); ui_->tableWidget->horizontalHeader()->setSectionResizeMode( kTrackNumberColumn, QHeaderView::ResizeToContents); - ui_->tableWidget->horizontalHeader()->setSectionResizeMode(kTrackTitleColumn, - QHeaderView::Stretch); + ui_->tableWidget->horizontalHeader()->setSectionResizeMode( + kTrackTitleColumn, QHeaderView::Stretch); // Add a rip button rip_button_ = ui_->button_box->addButton(tr("Start ripping"), diff --git a/src/ripper/ripcddialog.h b/src/ripper/ripcddialog.h index d294c1083..a290f068d 100644 --- a/src/ripper/ripcddialog.h +++ b/src/ripper/ripcddialog.h @@ -18,10 +18,9 @@ #ifndef SRC_RIPPER_RIPCDDIALOG_H_ #define SRC_RIPPER_RIPCDDIALOG_H_ -#include - #include #include +#include #include "core/song.h" #include "core/tagreaderclient.h" diff --git a/src/ripper/ripper.cpp b/src/ripper/ripper.cpp index 240e452a8..4151d776f 100644 --- a/src/ripper/ripper.cpp +++ b/src/ripper/ripper.cpp @@ -24,8 +24,8 @@ #include "core/closure.h" #include "core/logging.h" #include "core/tagreaderclient.h" -#include "transcoder/transcoder.h" #include "core/utilities.h" +#include "transcoder/transcoder.h" // winspool.h defines this :( #ifdef AddJob diff --git a/src/ripper/ripper.h b/src/ripper/ripper.h index 74ce752f6..2a356ff05 100644 --- a/src/ripper/ripper.h +++ b/src/ripper/ripper.h @@ -19,6 +19,7 @@ #define SRC_RIPPER_RIPPER_H_ #include + #include #include @@ -64,7 +65,7 @@ class Ripper : public QObject { // Returns true if the cd media has changed. bool MediaChanged() const; -signals: + signals: void Finished(); void Cancelled(); void ProgressInterval(int min, int max); diff --git a/src/smartplaylists/generator.cpp b/src/smartplaylists/generator.cpp index c3c7c4b75..edfa2b991 100644 --- a/src/smartplaylists/generator.cpp +++ b/src/smartplaylists/generator.cpp @@ -16,12 +16,13 @@ */ #include "generator.h" -#include "querygenerator.h" + +#include + #include "core/logging.h" #include "internet/jamendo/jamendodynamicplaylist.h" #include "internet/subsonic/subsonicdynamicplaylist.h" - -#include +#include "querygenerator.h" namespace smart_playlists { @@ -44,4 +45,4 @@ GeneratorPtr Generator::Create(const QString& type) { return GeneratorPtr(); } -} // namespace +} // namespace smart_playlists diff --git a/src/smartplaylists/generator.h b/src/smartplaylists/generator.h index 52df8ac76..755a25b15 100644 --- a/src/smartplaylists/generator.h +++ b/src/smartplaylists/generator.h @@ -18,10 +18,10 @@ #ifndef PLAYLISTGENERATOR_H #define PLAYLISTGENERATOR_H -#include "playlist/playlistitem.h" - #include +#include "playlist/playlistitem.h" + class LibraryBackend; namespace smart_playlists { @@ -73,7 +73,7 @@ class Generator : public QObject, virtual int GetDynamicHistory() { return kDefaultDynamicHistory; } virtual int GetDynamicFuture() { return kDefaultDynamicFuture; } -signals: + signals: void Error(const QString& message); protected: @@ -83,7 +83,7 @@ signals: QString name_; }; -} // namespace +} // namespace smart_playlists #include "generator_fwd.h" diff --git a/src/smartplaylists/generator_fwd.h b/src/smartplaylists/generator_fwd.h index 732168ccb..99229c937 100644 --- a/src/smartplaylists/generator_fwd.h +++ b/src/smartplaylists/generator_fwd.h @@ -26,6 +26,6 @@ class Generator; typedef std::shared_ptr GeneratorPtr; -} // namespace +} // namespace smart_playlists #endif // PLAYLISTGENERATOR_FWD_H diff --git a/src/smartplaylists/generatorinserter.cpp b/src/smartplaylists/generatorinserter.cpp index ddc2d7adc..104461419 100644 --- a/src/smartplaylists/generatorinserter.cpp +++ b/src/smartplaylists/generatorinserter.cpp @@ -77,4 +77,4 @@ void GeneratorInserter::Finished(QFuture future) { deleteLater(); } -} // namespace +} // namespace smart_playlists diff --git a/src/smartplaylists/generatorinserter.h b/src/smartplaylists/generatorinserter.h index c96370105..c8b835de9 100644 --- a/src/smartplaylists/generatorinserter.h +++ b/src/smartplaylists/generatorinserter.h @@ -18,11 +18,10 @@ #ifndef PLAYLISTGENERATORINSERTER_H #define PLAYLISTGENERATORINSERTER_H -#include "generator_fwd.h" - #include #include +#include "generator_fwd.h" #include "playlist/playlist.h" class LibraryBackend; @@ -63,6 +62,6 @@ class GeneratorInserter : public QObject { bool is_dynamic_; }; -} // namespace +} // namespace smart_playlists #endif // PLAYLISTGENERATORINSERTER_H diff --git a/src/smartplaylists/generatormimedata.h b/src/smartplaylists/generatormimedata.h index 7232b7b1f..a15e3cd4e 100644 --- a/src/smartplaylists/generatormimedata.h +++ b/src/smartplaylists/generatormimedata.h @@ -20,8 +20,8 @@ #include -#include "generator_fwd.h" #include "core/mimedata.h" +#include "generator_fwd.h" namespace smart_playlists { @@ -34,6 +34,6 @@ class GeneratorMimeData : public MimeData { GeneratorPtr generator_; }; -} // namespace +} // namespace smart_playlists #endif // GENERATORMIMEDATA_H diff --git a/src/smartplaylists/querygenerator.cpp b/src/smartplaylists/querygenerator.cpp index 4506a8f7c..6751e994c 100644 --- a/src/smartplaylists/querygenerator.cpp +++ b/src/smartplaylists/querygenerator.cpp @@ -16,10 +16,11 @@ */ #include "querygenerator.h" -#include "library/librarybackend.h" #include +#include "library/librarybackend.h" + namespace smart_playlists { QueryGenerator::QueryGenerator() : dynamic_(false), current_pos_(0) {} @@ -72,8 +73,8 @@ PlaylistItemList QueryGenerator::GenerateMore(int count) { SongList songs = backend_->FindSongs(search_copy); PlaylistItemList items; for (const Song& song : songs) { - items << PlaylistItemPtr(PlaylistItem::NewFromSongsTable( - backend_->songs_table(), song)); + items << PlaylistItemPtr( + PlaylistItem::NewFromSongsTable(backend_->songs_table(), song)); previous_ids_ << song.id(); if (previous_ids_.count() > GetDynamicFuture() + GetDynamicHistory()) @@ -82,4 +83,4 @@ PlaylistItemList QueryGenerator::GenerateMore(int count) { return items; } -} // namespace +} // namespace smart_playlists diff --git a/src/smartplaylists/querygenerator.h b/src/smartplaylists/querygenerator.h index 0dc633e3f..dcf398705 100644 --- a/src/smartplaylists/querygenerator.h +++ b/src/smartplaylists/querygenerator.h @@ -51,6 +51,6 @@ class QueryGenerator : public Generator { int current_pos_; }; -} // namespace +} // namespace smart_playlists #endif // QUERYPLAYLISTGENERATOR_H diff --git a/src/smartplaylists/querywizardplugin.cpp b/src/smartplaylists/querywizardplugin.cpp index fa66bf03e..2c24f45f8 100644 --- a/src/smartplaylists/querywizardplugin.cpp +++ b/src/smartplaylists/querywizardplugin.cpp @@ -15,16 +15,17 @@ along with Clementine. If not, see . */ -#include "querygenerator.h" #include "querywizardplugin.h" -#include "searchtermwidget.h" -#include "ui_querysearchpage.h" -#include "ui_querysortpage.h" -#include "core/logging.h" #include #include +#include "core/logging.h" +#include "querygenerator.h" +#include "searchtermwidget.h" +#include "ui_querysearchpage.h" +#include "ui_querysortpage.h" + namespace smart_playlists { class QueryWizardPlugin::SearchPage : public QWizardPage { diff --git a/src/smartplaylists/querywizardplugin.h b/src/smartplaylists/querywizardplugin.h index f1bdb216e..a141bdc2d 100644 --- a/src/smartplaylists/querywizardplugin.h +++ b/src/smartplaylists/querywizardplugin.h @@ -18,13 +18,11 @@ #ifndef QUERYWIZARDPLUGIN_H #define QUERYWIZARDPLUGIN_H -#include "wizardplugin.h" - +#include #include -#include - #include "search.h" +#include "wizardplugin.h" class Ui_SmartPlaylistQuerySearchPage; class Ui_SmartPlaylistQuerySortPage; diff --git a/src/smartplaylists/search.cpp b/src/smartplaylists/search.cpp index cde48d7f8..e13dfd583 100644 --- a/src/smartplaylists/search.cpp +++ b/src/smartplaylists/search.cpp @@ -16,11 +16,12 @@ */ #include "search.h" -#include "core/logging.h" -#include "core/song.h" #include +#include "core/logging.h" +#include "core/song.h" + namespace smart_playlists { Search::Search() { Reset(); } @@ -106,7 +107,7 @@ bool Search::operator==(const Search& other) const { limit_ == other.limit_; } -} // namespace +} // namespace smart_playlists QDataStream& operator<<(QDataStream& s, const smart_playlists::Search& search) { s << search.terms_; diff --git a/src/smartplaylists/search.h b/src/smartplaylists/search.h index 7c99fb5b6..2e589eb83 100644 --- a/src/smartplaylists/search.h +++ b/src/smartplaylists/search.h @@ -28,10 +28,18 @@ class Search { typedef QList TermList; // These values are persisted, so add to the end of the enum only - enum SearchType { Type_And = 0, Type_Or, Type_All, }; + enum SearchType { + Type_And = 0, + Type_Or, + Type_All, + }; // These values are persisted, so add to the end of the enum only - enum SortType { Sort_Random = 0, Sort_FieldAsc, Sort_FieldDesc, }; + enum SortType { + Sort_Random = 0, + Sort_FieldAsc, + Sort_FieldDesc, + }; Search(); Search(SearchType type, TermList terms, SortType sort_type, @@ -55,7 +63,7 @@ class Search { QString ToSql(const QString& songs_table) const; }; -} // namespace +} // namespace smart_playlists QDataStream& operator<<(QDataStream& s, const smart_playlists::Search& search); QDataStream& operator>>(QDataStream& s, smart_playlists::Search& search); diff --git a/src/smartplaylists/searchpreview.cpp b/src/smartplaylists/searchpreview.cpp index fad36bd45..4747c67e2 100644 --- a/src/smartplaylists/searchpreview.cpp +++ b/src/smartplaylists/searchpreview.cpp @@ -16,14 +16,13 @@ */ #include "searchpreview.h" -#include "ui_searchpreview.h" - -#include #include +#include -#include "querygenerator.h" #include "playlist/playlist.h" +#include "querygenerator.h" +#include "ui_searchpreview.h" namespace smart_playlists { @@ -127,4 +126,4 @@ void SearchPreview::SearchFinished(QFuture future) { ui_->count_label->show(); } -} // namespace +} // namespace smart_playlists diff --git a/src/smartplaylists/searchpreview.h b/src/smartplaylists/searchpreview.h index 4e1b9516c..cdc51d045 100644 --- a/src/smartplaylists/searchpreview.h +++ b/src/smartplaylists/searchpreview.h @@ -18,12 +18,12 @@ #ifndef SMARTPLAYLISTSEARCHPREVIEW_H #define SMARTPLAYLISTSEARCHPREVIEW_H -#include "search.h" -#include "smartplaylists/generator_fwd.h" - #include #include +#include "search.h" +#include "smartplaylists/generator_fwd.h" + class Application; class LibraryBackend; class Playlist; @@ -64,6 +64,6 @@ class SearchPreview : public QWidget { GeneratorPtr generator_; }; -} // namespace +} // namespace smart_playlists #endif // SMARTPLAYLISTSEARCHPREVIEW_H diff --git a/src/smartplaylists/searchterm.cpp b/src/smartplaylists/searchterm.cpp index 9e3675c0a..8795a6cc1 100644 --- a/src/smartplaylists/searchterm.cpp +++ b/src/smartplaylists/searchterm.cpp @@ -16,10 +16,11 @@ */ #include "searchterm.h" -#include "playlist/playlist.h" #include +#include "playlist/playlist.h" + namespace smart_playlists { SearchTerm::SearchTerm() : field_(Field_Title), operator_(Op_Equals) {} @@ -147,7 +148,8 @@ bool SearchTerm::is_valid() const { switch (TypeOf(field_)) { case Type_Text: - if (operator_ == SearchTerm::Op_Empty || operator_ == SearchTerm::Op_NotEmpty) { + if (operator_ == SearchTerm::Op_Empty || + operator_ == SearchTerm::Op_NotEmpty) { return true; } // Empty fields should be possible. @@ -207,16 +209,16 @@ SearchTerm::Type SearchTerm::TypeOf(Field field) { OperatorList SearchTerm::OperatorsForType(Type type) { switch (type) { case Type_Text: - return OperatorList() << Op_Contains << Op_NotContains << Op_Equals - << Op_NotEquals << Op_Empty << Op_NotEmpty - << Op_StartsWith << Op_EndsWith; + return OperatorList() + << Op_Contains << Op_NotContains << Op_Equals << Op_NotEquals + << Op_Empty << Op_NotEmpty << Op_StartsWith << Op_EndsWith; case Type_Date: - return OperatorList() << Op_Equals << Op_NotEquals << Op_GreaterThan - << Op_LessThan << Op_NumericDate - << Op_NumericDateNot << Op_RelativeDate; + return OperatorList() + << Op_Equals << Op_NotEquals << Op_GreaterThan << Op_LessThan + << Op_NumericDate << Op_NumericDateNot << Op_RelativeDate; default: - return OperatorList() << Op_Equals << Op_NotEquals << Op_GreaterThan - << Op_LessThan; + return OperatorList() + << Op_Equals << Op_NotEquals << Op_GreaterThan << Op_LessThan; } } @@ -427,7 +429,7 @@ QString SearchTerm::DateName(DateType date, bool forQuery) { return QString(); } -} // namespace +} // namespace smart_playlists QDataStream& operator<<(QDataStream& s, const smart_playlists::SearchTerm& term) { diff --git a/src/smartplaylists/searchterm.h b/src/smartplaylists/searchterm.h index c3b031a70..8e18e4c1e 100644 --- a/src/smartplaylists/searchterm.h +++ b/src/smartplaylists/searchterm.h @@ -96,7 +96,13 @@ class SearchTerm { }; // These values are persisted, so add to the end of the enum only - enum DateType { Date_Hour = 0, Date_Day, Date_Week, Date_Month, Date_Year, }; + enum DateType { + Date_Hour = 0, + Date_Day, + Date_Week, + Date_Month, + Date_Year, + }; SearchTerm(); SearchTerm(Field field, Operator op, const QVariant& value); @@ -125,7 +131,7 @@ class SearchTerm { typedef QList OperatorList; -} // namespace +} // namespace smart_playlists QDataStream& operator<<(QDataStream& s, const smart_playlists::SearchTerm& term); diff --git a/src/smartplaylists/searchtermwidget.cpp b/src/smartplaylists/searchtermwidget.cpp index 1dc4f9875..f5dcd87ed 100644 --- a/src/smartplaylists/searchtermwidget.cpp +++ b/src/smartplaylists/searchtermwidget.cpp @@ -15,21 +15,22 @@ along with Clementine. If not, see . */ -#include "searchterm.h" #include "searchtermwidget.h" -#include "ui_searchtermwidget.h" -#include "core/utilities.h" -#include "playlist/playlist.h" -#include "playlist/playlistdelegates.h" -#include "ui/iconloader.h" #include +#include #include #include #include #include #include -#include + +#include "core/utilities.h" +#include "playlist/playlist.h" +#include "playlist/playlistdelegates.h" +#include "searchterm.h" +#include "ui/iconloader.h" +#include "ui_searchtermwidget.h" // Exported by QtGui void qt_blurImage(QPainter* p, QImage& blurImage, qreal radius, bool quality, @@ -150,8 +151,7 @@ void SearchTermWidget::FieldChanged(int index) { // Show the correct value editor QWidget* page = nullptr; SearchTerm::Operator op = static_cast( - ui_->op->itemData(ui_->op->currentIndex()).toInt() - ); + ui_->op->itemData(ui_->op->currentIndex()).toInt()); switch (type) { case SearchTerm::Type_Time: page = ui_->page_time; @@ -198,9 +198,8 @@ void SearchTermWidget::FieldChanged(int index) { void SearchTermWidget::OpChanged(int index) { // Determine the currently selected operator SearchTerm::Operator op = static_cast( - // This uses the operators’s index in the combobox to get its enum value - ui_->op->itemData(ui_->op->currentIndex()).toInt() - ); + // This uses the operators’s index in the combobox to get its enum value + ui_->op->itemData(ui_->op->currentIndex()).toInt()); // We need to change the page only in the following case if ((ui_->value_stack->currentWidget() == ui_->page_text) || @@ -213,10 +212,11 @@ void SearchTermWidget::OpChanged(int index) { } ui_->value_stack->setCurrentWidget(page); } else if ((ui_->value_stack->currentWidget() == ui_->page_date) || - (ui_->value_stack->currentWidget() == ui_->page_date_numeric) || - (ui_->value_stack->currentWidget() == ui_->page_date_relative)) { + (ui_->value_stack->currentWidget() == ui_->page_date_numeric) || + (ui_->value_stack->currentWidget() == ui_->page_date_relative)) { QWidget* page = nullptr; - if (op == SearchTerm::Op_NumericDate || op == SearchTerm::Op_NumericDateNot) { + if (op == SearchTerm::Op_NumericDate || + op == SearchTerm::Op_NumericDateNot) { page = ui_->page_date_numeric; } else if (op == SearchTerm::Op_RelativeDate) { page = ui_->page_date_relative; @@ -455,4 +455,4 @@ void SearchTermWidget::Overlay::keyReleaseEvent(QKeyEvent* e) { if (e->key() == Qt::Key_Space) emit parent_->Clicked(); } -} // namespace +} // namespace smart_playlists diff --git a/src/smartplaylists/searchtermwidget.h b/src/smartplaylists/searchtermwidget.h index 8538c660f..90a431afd 100644 --- a/src/smartplaylists/searchtermwidget.h +++ b/src/smartplaylists/searchtermwidget.h @@ -18,11 +18,11 @@ #ifndef SMARTPLAYLISTSEARCHTERMWIDGET_H #define SMARTPLAYLISTSEARCHTERMWIDGET_H -#include "searchterm.h" - #include #include +#include "searchterm.h" + class LibraryBackend; class Ui_SmartPlaylistSearchTermWidget; @@ -32,8 +32,8 @@ namespace smart_playlists { class SearchTermWidget : public QWidget { Q_OBJECT - Q_PROPERTY(float overlay_opacity READ overlay_opacity WRITE - set_overlay_opacity) + Q_PROPERTY( + float overlay_opacity READ overlay_opacity WRITE set_overlay_opacity) public: SearchTermWidget(LibraryBackend* library, QWidget* parent); @@ -47,7 +47,7 @@ class SearchTermWidget : public QWidget { void SetTerm(const SearchTerm& term); SearchTerm Term() const; -signals: + signals: void Clicked(); void RemoveClicked(); @@ -80,6 +80,6 @@ signals: SearchTerm::Type current_field_type_; }; -} // namespace +} // namespace smart_playlists #endif // SMARTPLAYLISTSEARCHTERMWIDGET_H diff --git a/src/smartplaylists/wizard.cpp b/src/smartplaylists/wizard.cpp index ab327a885..45a449b92 100644 --- a/src/smartplaylists/wizard.cpp +++ b/src/smartplaylists/wizard.cpp @@ -15,16 +15,17 @@ along with Clementine. If not, see . */ -#include "core/logging.h" -#include "querywizardplugin.h" -#include "ui_wizardfinishpage.h" #include "wizard.h" -#include "wizardplugin.h" #include #include #include +#include "core/logging.h" +#include "querywizardplugin.h" +#include "ui_wizardfinishpage.h" +#include "wizardplugin.h" + namespace smart_playlists { class Wizard::TypePage : public QWizardPage { @@ -164,4 +165,4 @@ void Wizard::initializePage(int id) { QWizard::initializePage(id); } -} // namespace +} // namespace smart_playlists diff --git a/src/smartplaylists/wizard.h b/src/smartplaylists/wizard.h index e4f753a07..67c44783f 100644 --- a/src/smartplaylists/wizard.h +++ b/src/smartplaylists/wizard.h @@ -18,10 +18,10 @@ #ifndef SMARTPLAYLISTWIZARD_H #define SMARTPLAYLISTWIZARD_H -#include "generator_fwd.h" - #include +#include "generator_fwd.h" + class Application; class LibraryBackend; class Ui_SmartPlaylistWizardFinishPage; @@ -63,6 +63,6 @@ class Wizard : public QWizard { QList plugins_; }; -} // namespace +} // namespace smart_playlists #endif // SMARTPLAYLISTWIZARD_H diff --git a/src/songinfo/artistbiography.cpp b/src/songinfo/artistbiography.cpp index e5a0b693a..efb878f20 100644 --- a/src/songinfo/artistbiography.cpp +++ b/src/songinfo/artistbiography.cpp @@ -17,11 +17,11 @@ #include "artistbiography.h" -#include -#include #include +#include #include #include +#include #include #include @@ -254,27 +254,29 @@ void ArtistBiography::FetchWikipediaArticle(int id, qLog(Debug) << "Article url:" << url; - NewClosure(reply, SIGNAL(finished()), [this, id, reply, wikipedia_url, - wiki_title, latch]() { - reply->deleteLater(); + NewClosure( + reply, SIGNAL(finished()), + [this, id, reply, wikipedia_url, wiki_title, latch]() { + reply->deleteLater(); - QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll()); - QJsonObject json = json_document.object(); - QString html = ExtractExtract(json); + QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll()); + QJsonObject json = json_document.object(); + QString html = ExtractExtract(json); - CollapsibleInfoPane::Data data; - data.id_ = wikipedia_url; - data.title_ = tr("Biography"); - data.type_ = CollapsibleInfoPane::Data::Type_Biography; - data.icon_ = IconLoader::Load("wikipedia", IconLoader::Provider); + CollapsibleInfoPane::Data data; + data.id_ = wikipedia_url; + data.title_ = tr("Biography"); + data.type_ = CollapsibleInfoPane::Data::Type_Biography; + data.icon_ = IconLoader::Load("wikipedia", IconLoader::Provider); - QString text; - text += "

" + - tr("Open in your browser") + "

"; + QString text; + text += "

" + + tr("Open in your browser") + "

"; - text += html; + text += html; - text += tr("

This article uses material from the Wikipedia article " + text += + tr("

This article uses material from the Wikipedia article " "%2, which is released under the Creative Commons Attribution-Share-Alike " @@ -282,10 +284,10 @@ void ArtistBiography::FetchWikipediaArticle(int id, .arg(wikipedia_url) .arg(wiki_title); - SongInfoTextView* editor = new SongInfoTextView; - editor->SetHtml(text); - data.contents_ = editor; - emit InfoReady(id, data); - latch->CountDown(); - }); + SongInfoTextView* editor = new SongInfoTextView; + editor->SetHtml(text); + data.contents_ = editor; + emit InfoReady(id, data); + latch->CountDown(); + }); } diff --git a/src/songinfo/artistinfoview.cpp b/src/songinfo/artistinfoview.cpp index af1f5d0c4..8a1f77582 100644 --- a/src/songinfo/artistinfoview.cpp +++ b/src/songinfo/artistinfoview.cpp @@ -20,8 +20,8 @@ #include "songinfo/artistbiography.h" #include "songinfo/songinfofetcher.h" #include "songinfo/songkickconcerts.h" -#include "widgets/prettyimageview.h" #include "songinfo/spotifyimages.h" +#include "widgets/prettyimageview.h" ArtistInfoView::ArtistInfoView(QWidget* parent) : SongInfoBase(parent) { fetcher_->AddProvider(new SongkickConcerts); diff --git a/src/songinfo/collapsibleinfoheader.h b/src/songinfo/collapsibleinfoheader.h index b317c02c8..9947daa85 100644 --- a/src/songinfo/collapsibleinfoheader.h +++ b/src/songinfo/collapsibleinfoheader.h @@ -46,7 +46,7 @@ class CollapsibleInfoHeader : public QWidget { void SetTitle(const QString& title); void SetIcon(const QIcon& icon); -signals: + signals: void Expanded(); void Collapsed(); void ExpandedToggled(bool expanded); diff --git a/src/songinfo/collapsibleinfopane.cpp b/src/songinfo/collapsibleinfopane.cpp index c76613b76..a803274b4 100644 --- a/src/songinfo/collapsibleinfopane.cpp +++ b/src/songinfo/collapsibleinfopane.cpp @@ -15,11 +15,12 @@ along with Clementine. If not, see . */ -#include "collapsibleinfoheader.h" #include "collapsibleinfopane.h" #include +#include "collapsibleinfoheader.h" + CollapsibleInfoPane::CollapsibleInfoPane(const Data& data, QWidget* parent) : QWidget(parent), data_(data), header_(new CollapsibleInfoHeader(this)) { QVBoxLayout* layout = new QVBoxLayout(this); diff --git a/src/songinfo/collapsibleinfopane.h b/src/songinfo/collapsibleinfopane.h index 1445cc5ba..239d4177c 100644 --- a/src/songinfo/collapsibleinfopane.h +++ b/src/songinfo/collapsibleinfopane.h @@ -59,7 +59,7 @@ class CollapsibleInfoPane : public QWidget { void Expand(); void Collapse(); -signals: + signals: void Toggled(bool expanded); private slots: diff --git a/src/songinfo/lastfmtrackinfoprovider.cpp b/src/songinfo/lastfmtrackinfoprovider.cpp index d3460c6e4..3157f340b 100644 --- a/src/songinfo/lastfmtrackinfoprovider.cpp +++ b/src/songinfo/lastfmtrackinfoprovider.cpp @@ -16,10 +16,11 @@ */ #include "lastfmtrackinfoprovider.h" + +#include "internet/lastfm/lastfmcompat.h" #include "songinfotextview.h" #include "songplaystats.h" #include "tagwidget.h" -#include "internet/lastfm/lastfmcompat.h" #include "ui/iconloader.h" void LastfmTrackInfoProvider::FetchInfo(int id, const Song& metadata) { @@ -82,7 +83,8 @@ void LastfmTrackInfoProvider::GetPlayCounts(int id, const lastfm::XmlQuery& q) { if (myplaycount != -1) { if (love) - widget->AddItem(IconLoader::Load("love", IconLoader::Lastfm), tr("You love this track")); + widget->AddItem(IconLoader::Load("love", IconLoader::Lastfm), + tr("You love this track")); widget->AddItem(IconLoader::Load("icon_user", IconLoader::Lastfm), tr("Your scrobbles: %1").arg(myplaycount)); } diff --git a/src/songinfo/songinfobase.cpp b/src/songinfo/songinfobase.cpp index 1f28919a3..0f371c07d 100644 --- a/src/songinfo/songinfobase.cpp +++ b/src/songinfo/songinfobase.cpp @@ -16,7 +16,6 @@ */ #include "songinfobase.h" -#include "core/network.h" #include #include @@ -25,6 +24,8 @@ #include #include +#include "core/network.h" + const char* SongInfoBase::kSettingsGroup = "SongInfo"; SongInfoBase::SongInfoBase(QWidget* parent) diff --git a/src/songinfo/songinfobase.h b/src/songinfo/songinfobase.h index 13f0f4cc9..5fcf0afcc 100644 --- a/src/songinfo/songinfobase.h +++ b/src/songinfo/songinfobase.h @@ -21,10 +21,10 @@ #include #include "collapsibleinfopane.h" -#include "songinfofetcher.h" #include "core/song.h" #include "playlist/playlistitem.h" #include "smartplaylists/generator_fwd.h" +#include "songinfofetcher.h" #include "widgets/widgetfadehelper.h" class CollapsibleInfoPane; @@ -47,7 +47,7 @@ class SongInfoBase : public QWidget { void SongFinished(); virtual void ReloadSettings(); -signals: + signals: void ShowSettingsDialog(); void DoGlobalSearch(const QString& query); diff --git a/src/songinfo/songinfofetcher.cpp b/src/songinfo/songinfofetcher.cpp index fe5b8dea4..daaf3c262 100644 --- a/src/songinfo/songinfofetcher.cpp +++ b/src/songinfo/songinfofetcher.cpp @@ -16,11 +16,12 @@ */ #include "songinfofetcher.h" -#include "songinfoprovider.h" -#include "core/logging.h" #include +#include "core/logging.h" +#include "songinfoprovider.h" + SongInfoFetcher::SongInfoFetcher(QObject* parent) : QObject(parent), timeout_duration_(kDefaultTimeoutDuration), diff --git a/src/songinfo/songinfofetcher.h b/src/songinfo/songinfofetcher.h index 440252022..b87e12e79 100644 --- a/src/songinfo/songinfofetcher.h +++ b/src/songinfo/songinfofetcher.h @@ -45,7 +45,7 @@ class SongInfoFetcher : public QObject { QList providers() const { return providers_; } -signals: + signals: void InfoResultReady(int id, const CollapsibleInfoPane::Data& data); void ResultReady(int id, const SongInfoFetcher::Result& result); @@ -59,7 +59,7 @@ signals: QList providers_; QMap results_; - QMap > waiting_for_; + QMap> waiting_for_; QMap timeout_timers_; int timeout_duration_; diff --git a/src/songinfo/songinfoprovider.h b/src/songinfo/songinfoprovider.h index c241296a0..3b32bb005 100644 --- a/src/songinfo/songinfoprovider.h +++ b/src/songinfo/songinfoprovider.h @@ -38,7 +38,7 @@ class SongInfoProvider : public QObject { bool is_enabled() const { return enabled_; } void set_enabled(bool enabled) { enabled_ = enabled; } -signals: + signals: void ImageReady(int id, const QUrl& url); void InfoReady(int id, const CollapsibleInfoPane::Data& data); void Finished(int id); diff --git a/src/songinfo/songinfosettingspage.cpp b/src/songinfo/songinfosettingspage.cpp index 24edc2b08..677e8ffbe 100644 --- a/src/songinfo/songinfosettingspage.cpp +++ b/src/songinfo/songinfosettingspage.cpp @@ -15,18 +15,19 @@ along with Clementine. If not, see . */ -#include "songinfofetcher.h" #include "songinfosettingspage.h" -#include "songinfotextview.h" -#include "songinfoview.h" -#include "ultimatelyricsprovider.h" -#include "ui_songinfosettingspage.h" -#include "ui/iconloader.h" -#include "ui/settingsdialog.h" #include #include +#include "songinfofetcher.h" +#include "songinfotextview.h" +#include "songinfoview.h" +#include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_songinfosettingspage.h" +#include "ultimatelyricsprovider.h" + SongInfoSettingsPage::SongInfoSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_SongInfoSettingsPage) { ui_->setupUi(this); diff --git a/src/songinfo/songinfotextview.h b/src/songinfo/songinfotextview.h index c858c8e0a..c2ae283d6 100644 --- a/src/songinfo/songinfotextview.h +++ b/src/songinfo/songinfotextview.h @@ -38,7 +38,7 @@ class SongInfoTextView : public QTextBrowser { void ReloadSettings(); void SetHtml(const QString& html); -signals: + signals: void ShowSettingsDialog(); protected: diff --git a/src/songinfo/songinfoview.cpp b/src/songinfo/songinfoview.cpp index 8a05abf8c..383968f97 100644 --- a/src/songinfo/songinfoview.cpp +++ b/src/songinfo/songinfoview.cpp @@ -17,11 +17,10 @@ #include "songinfo/songinfoview.h" -#include - #include #include #include +#include #include "config.h" #include "core/closure.h" @@ -151,7 +150,7 @@ bool CompareLyricProviders(const UltimateLyricsProvider* a, if (!a->is_enabled() && b->is_enabled()) return false; return a->relevance() > b->relevance(); } -} +} // namespace QList SongInfoView::lyric_providers() const { QList ret; diff --git a/src/songinfo/songkickconcerts.cpp b/src/songinfo/songkickconcerts.cpp index 4870eecc2..47505daeb 100644 --- a/src/songinfo/songkickconcerts.cpp +++ b/src/songinfo/songkickconcerts.cpp @@ -18,13 +18,13 @@ #include "songkickconcerts.h" #include -#include -#include +#include #include #include -#include #include #include +#include +#include #include "core/logging.h" #include "songkickconcertwidget.h" @@ -124,7 +124,8 @@ void SongkickConcerts::CalendarRequestFinished(QNetworkReply* reply, int id) { } QJsonParseError error; - QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll(), &error); + QJsonDocument json_document = + QJsonDocument::fromJson(reply->readAll(), &error); if (error.error != QJsonParseError::NoError) { qLog(Error) << "Error parsing Songkick calendar reply:" diff --git a/src/songinfo/songkickconcerts.h b/src/songinfo/songkickconcerts.h index 66cd484a5..1e9f78245 100644 --- a/src/songinfo/songkickconcerts.h +++ b/src/songinfo/songkickconcerts.h @@ -18,11 +18,10 @@ #ifndef SONGKICKCONCERTS_H #define SONGKICKCONCERTS_H -#include "songinfoprovider.h" - #include "core/network.h" #include "core/override.h" #include "internet/core/geolocator.h" +#include "songinfoprovider.h" class QNetworkReply; class SongInfoTextView; diff --git a/src/songinfo/songkickconcertwidget.cpp b/src/songinfo/songkickconcertwidget.cpp index 21655f1f0..d0a7f45ff 100644 --- a/src/songinfo/songkickconcertwidget.cpp +++ b/src/songinfo/songkickconcertwidget.cpp @@ -23,12 +23,12 @@ #include #include -#include "songinfotextview.h" -#include "ui_songkickconcertwidget.h" #include "core/closure.h" #include "core/logging.h" #include "core/network.h" #include "core/utilities.h" +#include "songinfotextview.h" +#include "ui_songkickconcertwidget.h" const int SongKickConcertWidget::kStaticMapWidth = 100; const int SongKickConcertWidget::kStaticMapHeight = 100; @@ -58,8 +58,8 @@ void SongKickConcertWidget::ReloadSettings() { void SongKickConcertWidget::Init(const QString& title, const QString& url, const QString& date, const QString& location) { - ui_->title->setText( - QString("%2").arg(url.toHtmlEscaped(), title.toHtmlEscaped())); + ui_->title->setText(QString("%2") + .arg(url.toHtmlEscaped(), title.toHtmlEscaped())); if (!location.isEmpty()) { ui_->location->setText(location); @@ -105,9 +105,9 @@ void SongKickConcertWidget::SetMap(const QString& lat, const QString& lng, map_url_.setQuery(map_url_query); // Request the static map image - const QUrl url(QString(kStaticMapUrl).arg(QString::number(kStaticMapWidth), - QString::number(kStaticMapHeight), - lat, lng)); + const QUrl url(QString(kStaticMapUrl) + .arg(QString::number(kStaticMapWidth), + QString::number(kStaticMapHeight), lat, lng)); QNetworkReply* reply = network_->get(QNetworkRequest(url)); NewClosure(reply, SIGNAL(finished()), this, SLOT(MapLoaded(QNetworkReply*)), reply); diff --git a/src/songinfo/spotifyimages.cpp b/src/songinfo/spotifyimages.cpp index 8ab671e91..485601466 100644 --- a/src/songinfo/spotifyimages.cpp +++ b/src/songinfo/spotifyimages.cpp @@ -1,13 +1,12 @@ #include "spotifyimages.h" -#include - -#include #include #include #include +#include #include #include +#include #include "core/closure.h" #include "core/logging.h" @@ -42,7 +41,8 @@ void SpotifyImages::FetchInfo(int id, const Song& metadata) { reply->deleteLater(); QJsonParseError error; - QJsonDocument json_document = QJsonDocument::fromJson(reply->readAll(), &error); + QJsonDocument json_document = + QJsonDocument::fromJson(reply->readAll(), &error); if (error.error != QJsonParseError::NoError) { emit Finished(id); return; @@ -50,7 +50,7 @@ void SpotifyImages::FetchInfo(int id, const Song& metadata) { QJsonArray results = json_document.array(); QList> image_candidates; - for (const QJsonValue &v : results) { + for (const QJsonValue& v : results) { QJsonObject image = v.toObject(); QUrl url = image["url"].toVariant().toUrl(); int height = image["height"].toInt(); diff --git a/src/songinfo/streamdiscoverer.cpp b/src/songinfo/streamdiscoverer.cpp index 812034b30..36f9cdfd8 100644 --- a/src/songinfo/streamdiscoverer.cpp +++ b/src/songinfo/streamdiscoverer.cpp @@ -1,12 +1,13 @@ #include "streamdiscoverer.h" #include + +#include + #include "core/logging.h" #include "core/signalchecker.h" #include "core/waitforsignal.h" -#include - const int StreamDiscoverer::kDiscoveryTimeoutS = 10; StreamDiscoverer::StreamDiscoverer() : QObject(nullptr) { diff --git a/src/songinfo/streamdiscoverer.h b/src/songinfo/streamdiscoverer.h index e5016269e..05ce0ca1d 100644 --- a/src/songinfo/streamdiscoverer.h +++ b/src/songinfo/streamdiscoverer.h @@ -26,7 +26,7 @@ class StreamDiscoverer : public QObject { void Discover(const QString& url); -signals: + signals: void DiscoverFinished(); void DataReady(const StreamDetails& data); void Error(const QString& message); diff --git a/src/songinfo/taglyricsinfoprovider.cpp b/src/songinfo/taglyricsinfoprovider.cpp index 9b76cac46..714e4ccfc 100644 --- a/src/songinfo/taglyricsinfoprovider.cpp +++ b/src/songinfo/taglyricsinfoprovider.cpp @@ -15,9 +15,10 @@ along with Clementine. If not, see . */ -#include "songinfotextview.h" #include "taglyricsinfoprovider.h" + #include "core/logging.h" +#include "songinfotextview.h" void TagLyricsInfoProvider::FetchInfo(int id, const Song& metadata) { QString lyrics; diff --git a/src/songinfo/tagwidget.cpp b/src/songinfo/tagwidget.cpp index 951265d65..c24133056 100644 --- a/src/songinfo/tagwidget.cpp +++ b/src/songinfo/tagwidget.cpp @@ -16,9 +16,13 @@ */ #include "tagwidget.h" -#include "internet/lastfm/lastfmservice.h" + +#include +#include + #include "internet/core/internetmimedata.h" #include "internet/core/internetmodel.h" +#include "internet/lastfm/lastfmservice.h" #include "playlist/playlistitemmimedata.h" #include "smartplaylists/generator.h" #include "smartplaylists/generatormimedata.h" @@ -26,9 +30,6 @@ #include "ui/flowlayout.h" #include "ui/iconloader.h" -#include -#include - const int TagWidgetTag::kIconSize = 16; const int TagWidgetTag::kIconTextSpacing = 8; const int TagWidgetTag::kHPadding = 6; diff --git a/src/songinfo/tagwidget.h b/src/songinfo/tagwidget.h index 3b0c34a7c..eba0bca20 100644 --- a/src/songinfo/tagwidget.h +++ b/src/songinfo/tagwidget.h @@ -18,12 +18,12 @@ #ifndef TAGWIDGET_H #define TAGWIDGET_H -#include "playlist/playlistitem.h" -#include "smartplaylists/generator_fwd.h" - #include #include +#include "playlist/playlistitem.h" +#include "smartplaylists/generator_fwd.h" + class QMenu; class QPropertyAnimation; @@ -46,7 +46,7 @@ class TagWidgetTag : public QWidget { QSize sizeHint() const; QString text() const { return text_; } -signals: + signals: void Clicked(); protected: @@ -68,7 +68,10 @@ class TagWidget : public QWidget { Q_OBJECT public: - enum Type { Type_Tags, Type_Artists, }; + enum Type { + Type_Tags, + Type_Artists, + }; TagWidget(Type type, QWidget* parent = nullptr); @@ -77,7 +80,7 @@ class TagWidget : public QWidget { int count() const { return tags_.count(); } -signals: + signals: void AddToPlaylist(QMimeData* data); void DoGlobalSearch(const QString& query); diff --git a/src/songinfo/ultimatelyricsprovider.cpp b/src/songinfo/ultimatelyricsprovider.cpp index 459a64549..59031c951 100644 --- a/src/songinfo/ultimatelyricsprovider.cpp +++ b/src/songinfo/ultimatelyricsprovider.cpp @@ -15,17 +15,18 @@ along with Clementine. If not, see . */ -#include "songinfotextview.h" -#include "ultimatelyricslyric.h" #include "ultimatelyricsprovider.h" -#include "core/logging.h" -#include "core/network.h" #include #include #include #include +#include "core/logging.h" +#include "core/network.h" +#include "songinfotextview.h" +#include "ultimatelyricslyric.h" + const int UltimateLyricsProvider::kRedirectLimit = 5; UltimateLyricsProvider::UltimateLyricsProvider() diff --git a/src/songinfo/ultimatelyricsreader.cpp b/src/songinfo/ultimatelyricsreader.cpp index c7ca0612b..58a4cac7c 100644 --- a/src/songinfo/ultimatelyricsreader.cpp +++ b/src/songinfo/ultimatelyricsreader.cpp @@ -15,21 +15,22 @@ along with Clementine. If not, see . */ -#include "ultimatelyricsprovider.h" #include "ultimatelyricsreader.h" -#include "core/logging.h" #include #include #include +#include "core/logging.h" +#include "ultimatelyricsprovider.h" + UltimateLyricsReader::UltimateLyricsReader(QObject* parent) : QObject(parent), thread_(qApp->thread()) {} void UltimateLyricsReader::SetThread(QThread* thread) { thread_ = thread; } -QList UltimateLyricsReader::Parse(const QString& filename) - const { +QList UltimateLyricsReader::Parse( + const QString& filename) const { QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { qLog(Warning) << "Error opening" << filename; @@ -39,8 +40,8 @@ QList UltimateLyricsReader::Parse(const QString& filename) return ParseDevice(&file); } -QList UltimateLyricsReader::ParseDevice(QIODevice* device) - const { +QList UltimateLyricsReader::ParseDevice( + QIODevice* device) const { QList ret; QXmlStreamReader reader(device); @@ -59,8 +60,8 @@ QList UltimateLyricsReader::ParseDevice(QIODevice* device) return ret; } -SongInfoProvider* UltimateLyricsReader::ParseProvider(QXmlStreamReader* reader) - const { +SongInfoProvider* UltimateLyricsReader::ParseProvider( + QXmlStreamReader* reader) const { QXmlStreamAttributes attributes = reader->attributes(); UltimateLyricsProvider* scraper = new UltimateLyricsProvider; @@ -113,8 +114,7 @@ UltimateLyricsProvider::Rule UltimateLyricsReader::ParseRule( QString()); else if (attr.hasAttribute("begin")) ret << UltimateLyricsProvider::RuleItem( - attr.value("begin").toString(), - attr.value("end").toString()); + attr.value("begin").toString(), attr.value("end").toString()); } reader->skipCurrentElement(); } @@ -122,8 +122,8 @@ UltimateLyricsProvider::Rule UltimateLyricsReader::ParseRule( return ret; } -QString UltimateLyricsReader::ParseInvalidIndicator(QXmlStreamReader* reader) - const { +QString UltimateLyricsReader::ParseInvalidIndicator( + QXmlStreamReader* reader) const { QString ret = reader->attributes().value("value").toString(); reader->skipCurrentElement(); return ret; diff --git a/src/songinfo/ultimatelyricsreader.h b/src/songinfo/ultimatelyricsreader.h index cfa8cfb14..c36dd279e 100644 --- a/src/songinfo/ultimatelyricsreader.h +++ b/src/songinfo/ultimatelyricsreader.h @@ -18,11 +18,11 @@ #ifndef ULTIMATELYRICSREADER_H #define ULTIMATELYRICSREADER_H -#include "ultimatelyricsprovider.h" - #include #include +#include "ultimatelyricsprovider.h" + class QIODevice; class QThread; diff --git a/src/transcoder/transcodedialog.cpp b/src/transcoder/transcodedialog.cpp index cbec3d16f..9e6d1db65 100644 --- a/src/transcoder/transcodedialog.cpp +++ b/src/transcoder/transcodedialog.cpp @@ -16,21 +16,21 @@ */ #include "transcodedialog.h" -#include "transcoder.h" -#include "transcoderoptionsdialog.h" -#include "ui_transcodedialog.h" -#include "ui_transcodelogdialog.h" -#include "ui/iconloader.h" -#include "ui/mainwindow.h" -#include "widgets/fileview.h" +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include "transcoder.h" +#include "transcoderoptionsdialog.h" +#include "ui/iconloader.h" +#include "ui/mainwindow.h" +#include "ui_transcodedialog.h" +#include "ui_transcodelogdialog.h" +#include "widgets/fileview.h" // winspool.h defines this :( #ifdef AddJob @@ -224,8 +224,9 @@ void TranscodeDialog::AllJobsComplete() { SetWorking(false); } void TranscodeDialog::Add() { QStringList filenames = QFileDialog::getOpenFileNames( this, tr("Add files to transcode"), last_add_dir_, - QString("%1 (%2);;%3").arg(tr("Music"), FileView::kFileFilter, - tr(MainWindow::kAllFilesFilterSpec))); + QString("%1 (%2);;%3") + .arg(tr("Music"), FileView::kFileFilter, + tr(MainWindow::kAllFilesFilterSpec))); if (filenames.isEmpty()) return; diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index e070ea591..0109aa0d7 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -17,15 +17,14 @@ #include "transcoder.h" -#include -#include - #include #include #include #include #include #include +#include +#include #include "core/logging.h" #include "core/signalchecker.h" @@ -104,7 +103,8 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type, GstElementFactory* factory = GST_ELEMENT_FACTORY(p->data); // Is this the right type of plugin? - if (QString(gst_element_factory_get_klass(factory)).contains(element_type)) { + if (QString(gst_element_factory_get_klass(factory)) + .contains(element_type)) { const GList* const templates = gst_element_factory_get_static_pad_templates(factory); for (const GList* p = templates; p; p = g_list_next(p)) { @@ -292,9 +292,10 @@ void Transcoder::AddJob(const QString& input, const TranscoderPreset& preset, // Never overwrite existing files if (QFile::exists(job.output)) { for (int i = 0;; ++i) { - QString new_filename = - QString("%1.%2.%3").arg(job.output.section('.', 0, -2)).arg(i).arg( - preset.extension_); + QString new_filename = QString("%1.%2.%3") + .arg(job.output.section('.', 0, -2)) + .arg(i) + .arg(preset.extension_); if (!QFile::exists(new_filename)) { job.output = new_filename; break; @@ -305,7 +306,8 @@ void Transcoder::AddJob(const QString& input, const TranscoderPreset& preset, queued_jobs_ << job; } -void Transcoder::AddTemporaryJob(const QString &input, const TranscoderPreset &preset) { +void Transcoder::AddTemporaryJob(const QString& input, + const TranscoderPreset& preset) { Job job; job.input = input; job.output = Utilities::GetTemporaryFileName(); @@ -344,8 +346,7 @@ Transcoder::StartJobStatus Transcoder::MaybeStartNextJob() { return FailedToStart; } -void Transcoder::NewPadCallback(GstElement*, GstPad* pad, - gpointer data) { +void Transcoder::NewPadCallback(GstElement*, GstPad* pad, gpointer data) { JobState* state = reinterpret_cast(data); GstPad* const audiopad = gst_element_get_static_pad(state->convert_element_, "sink"); @@ -388,8 +389,9 @@ void Transcoder::JobState::ReportError(GstMessage* msg) { g_error_free(error); free(debugs); - emit parent_->LogLine(tr("Error processing %1: %2").arg( - QDir::toNativeSeparators(job_.input), message)); + emit parent_->LogLine( + tr("Error processing %1: %2") + .arg(QDir::toNativeSeparators(job_.input), message)); } bool Transcoder::StartJob(const Job& job) { @@ -418,13 +420,15 @@ bool Transcoder::StartJob(const Job& job) { if (!codec && !job.preset.codec_mimetype_.isEmpty()) { LogLine(tr("Couldn't find an encoder for %1, check you have the correct " - "GStreamer plugins installed").arg(job.preset.codec_mimetype_)); + "GStreamer plugins installed") + .arg(job.preset.codec_mimetype_)); return false; } if (!muxer && !job.preset.muxer_mimetype_.isEmpty()) { LogLine(tr("Couldn't find a muxer for %1, check you have the correct " - "GStreamer plugins installed").arg(job.preset.muxer_mimetype_)); + "GStreamer plugins installed") + .arg(job.preset.muxer_mimetype_)); return false; } @@ -517,8 +521,9 @@ void Transcoder::Cancel() { // Remove event handlers from the gstreamer pipeline so they don't get // called after the pipeline is shutting down - gst_bus_set_sync_handler(gst_pipeline_get_bus( - GST_PIPELINE(state->pipeline_)), nullptr, nullptr, nullptr); + gst_bus_set_sync_handler( + gst_pipeline_get_bus(GST_PIPELINE(state->pipeline_)), nullptr, nullptr, + nullptr); // Stop the pipeline if (gst_element_set_state(state->pipeline_, GST_STATE_NULL) == diff --git a/src/transcoder/transcoder.h b/src/transcoder/transcoder.h index 921ac8a1f..7aed7ee35 100644 --- a/src/transcoder/transcoder.h +++ b/src/transcoder/transcoder.h @@ -18,14 +18,13 @@ #ifndef TRANSCODER_H #define TRANSCODER_H -#include - #include -#include -#include #include #include +#include +#include +#include #include "core/song.h" @@ -67,7 +66,7 @@ class Transcoder : public QObject { void Start(); void Cancel(); -signals: + signals: void JobComplete(const QString& input, const QString& output, bool success); void LogLine(const QString& message); void AllJobsComplete(); diff --git a/src/transcoder/transcoderoptionsaac.cpp b/src/transcoder/transcoderoptionsaac.cpp index 628bd84f8..5bec562ab 100644 --- a/src/transcoder/transcoderoptionsaac.cpp +++ b/src/transcoder/transcoderoptionsaac.cpp @@ -16,10 +16,11 @@ */ #include "transcoderoptionsaac.h" -#include "ui_transcoderoptionsaac.h" #include +#include "ui_transcoderoptionsaac.h" + const char* TranscoderOptionsAAC::kSettingsGroup = "Transcoder/faac"; TranscoderOptionsAAC::TranscoderOptionsAAC(QWidget* parent) diff --git a/src/transcoder/transcoderoptionsdialog.cpp b/src/transcoder/transcoderoptionsdialog.cpp index d57a54521..0ad9a3462 100644 --- a/src/transcoder/transcoderoptionsdialog.cpp +++ b/src/transcoder/transcoderoptionsdialog.cpp @@ -15,13 +15,14 @@ along with Clementine. If not, see . */ -#include "transcoderoptionsaac.h" #include "transcoderoptionsdialog.h" + +#include "transcoderoptionsaac.h" #include "transcoderoptionsflac.h" #include "transcoderoptionsmp3.h" +#include "transcoderoptionsopus.h" #include "transcoderoptionsspeex.h" #include "transcoderoptionsvorbis.h" -#include "transcoderoptionsopus.h" #include "transcoderoptionswma.h" #include "ui_transcoderoptionsdialog.h" @@ -80,7 +81,8 @@ void TranscoderOptionsDialog::accept() { QDialog::accept(); } -void TranscoderOptionsDialog::set_settings_postfix(const QString &settings_postfix) { +void TranscoderOptionsDialog::set_settings_postfix( + const QString& settings_postfix) { if (options_) { options_->settings_postfix_ = settings_postfix; } diff --git a/src/transcoder/transcoderoptionsdialog.h b/src/transcoder/transcoderoptionsdialog.h index 5bb65ceca..8a3408e51 100644 --- a/src/transcoder/transcoderoptionsdialog.h +++ b/src/transcoder/transcoderoptionsdialog.h @@ -20,8 +20,8 @@ #include -#include "transcoderoptionsinterface.h" #include "core/song.h" +#include "transcoderoptionsinterface.h" class Ui_TranscoderOptionsDialog; diff --git a/src/transcoder/transcoderoptionsflac.cpp b/src/transcoder/transcoderoptionsflac.cpp index 38446f0e2..9de8aed68 100644 --- a/src/transcoder/transcoderoptionsflac.cpp +++ b/src/transcoder/transcoderoptionsflac.cpp @@ -16,10 +16,11 @@ */ #include "transcoderoptionsflac.h" -#include "ui_transcoderoptionsflac.h" #include +#include "ui_transcoderoptionsflac.h" + const char* TranscoderOptionsFlac::kSettingsGroup = "Transcoder/flacenc"; TranscoderOptionsFlac::TranscoderOptionsFlac(QWidget* parent) diff --git a/src/transcoder/transcoderoptionsmp3.cpp b/src/transcoder/transcoderoptionsmp3.cpp index 0376ddacd..a52451100 100644 --- a/src/transcoder/transcoderoptionsmp3.cpp +++ b/src/transcoder/transcoderoptionsmp3.cpp @@ -16,10 +16,11 @@ */ #include "transcoderoptionsmp3.h" -#include "ui_transcoderoptionsmp3.h" #include +#include "ui_transcoderoptionsmp3.h" + const char* TranscoderOptionsMP3::kSettingsGroup = "Transcoder/lamemp3enc"; TranscoderOptionsMP3::TranscoderOptionsMP3(QWidget* parent) diff --git a/src/transcoder/transcoderoptionsopus.cpp b/src/transcoder/transcoderoptionsopus.cpp index 7d0b6bc27..2dbf4bcb3 100644 --- a/src/transcoder/transcoderoptionsopus.cpp +++ b/src/transcoder/transcoderoptionsopus.cpp @@ -16,10 +16,11 @@ */ #include "transcoderoptionsopus.h" -#include "ui_transcoderoptionsopus.h" #include +#include "ui_transcoderoptionsopus.h" + // TODO: Add more options than only bitrate as soon as gst doesn't crash // anymore while using the cbr parmameter (like cbr=false) diff --git a/src/transcoder/transcoderoptionsspeex.cpp b/src/transcoder/transcoderoptionsspeex.cpp index da956f00a..e89f6619f 100644 --- a/src/transcoder/transcoderoptionsspeex.cpp +++ b/src/transcoder/transcoderoptionsspeex.cpp @@ -16,10 +16,11 @@ */ #include "transcoderoptionsspeex.h" -#include "ui_transcoderoptionsspeex.h" #include +#include "ui_transcoderoptionsspeex.h" + const char* TranscoderOptionsSpeex::kSettingsGroup = "Transcoder/speexenc"; TranscoderOptionsSpeex::TranscoderOptionsSpeex(QWidget* parent) diff --git a/src/transcoder/transcoderoptionsvorbis.cpp b/src/transcoder/transcoderoptionsvorbis.cpp index 94f4faa75..6d7b300db 100644 --- a/src/transcoder/transcoderoptionsvorbis.cpp +++ b/src/transcoder/transcoderoptionsvorbis.cpp @@ -16,10 +16,11 @@ */ #include "transcoderoptionsvorbis.h" -#include "ui_transcoderoptionsvorbis.h" #include +#include "ui_transcoderoptionsvorbis.h" + const char* TranscoderOptionsVorbis::kSettingsGroup = "Transcoder/vorbisenc"; TranscoderOptionsVorbis::TranscoderOptionsVorbis(QWidget* parent) diff --git a/src/transcoder/transcoderoptionswma.cpp b/src/transcoder/transcoderoptionswma.cpp index 208c3d321..29e5cada1 100644 --- a/src/transcoder/transcoderoptionswma.cpp +++ b/src/transcoder/transcoderoptionswma.cpp @@ -16,10 +16,11 @@ */ #include "transcoderoptionswma.h" -#include "ui_transcoderoptionswma.h" #include +#include "ui_transcoderoptionswma.h" + const char* TranscoderOptionsWma::kSettingsGroup = "Transcoder/ffenc_wmav2"; TranscoderOptionsWma::TranscoderOptionsWma(QWidget* parent) diff --git a/src/transcoder/transcodersettingspage.cpp b/src/transcoder/transcodersettingspage.cpp index 0183fe18c..a57713910 100644 --- a/src/transcoder/transcodersettingspage.cpp +++ b/src/transcoder/transcodersettingspage.cpp @@ -16,8 +16,9 @@ */ #include "transcodersettingspage.h" -#include "ui_transcodersettingspage.h" + #include "ui/iconloader.h" +#include "ui_transcodersettingspage.h" TranscoderSettingsPage::TranscoderSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_TranscoderSettingsPage) { diff --git a/src/ui/about.cpp b/src/ui/about.cpp index 0314a380f..fe37d5063 100644 --- a/src/ui/about.cpp +++ b/src/ui/about.cpp @@ -16,13 +16,13 @@ */ #include "about.h" -#include "config.h" -#include "ui_about.h" - -#include #include #include +#include + +#include "config.h" +#include "ui_about.h" const char* About::kUrl = "http://www.clementine-player.org/"; @@ -70,7 +70,8 @@ About::About(QWidget* parent) : QDialog(parent) { QString About::MakeHtml() const { QString ret = QString( "

%2

" - "

%3:").arg(kUrl, kUrl, tr("Authors")); + "

%3:") + .arg(kUrl, kUrl, tr("Authors")); for (const Person& person : authors_) { ret += "
" + MakeHtml(person); diff --git a/src/ui/addstreamdialog.cpp b/src/ui/addstreamdialog.cpp index d5a06e83e..c71ffccee 100644 --- a/src/ui/addstreamdialog.cpp +++ b/src/ui/addstreamdialog.cpp @@ -16,15 +16,16 @@ */ #include "addstreamdialog.h" -#include "ui_addstreamdialog.h" -#include "internet/core/internetmodel.h" -#include "internet/internetradio/savedradio.h" +#include #include #include -#include #include +#include "internet/core/internetmodel.h" +#include "internet/internetradio/savedradio.h" +#include "ui_addstreamdialog.h" + const char* AddStreamDialog::kSettingsGroup = "AddStreamDialog"; AddStreamDialog::AddStreamDialog(QWidget* parent) diff --git a/src/ui/albumcoverchoicecontroller.cpp b/src/ui/albumcoverchoicecontroller.cpp index 97cb1dd1b..bd210118a 100644 --- a/src/ui/albumcoverchoicecontroller.cpp +++ b/src/ui/albumcoverchoicecontroller.cpp @@ -16,18 +16,7 @@ along with Clementine. If not, see . */ -#include "core/application.h" -#include "core/logging.h" -#include "core/utilities.h" -#include "covers/albumcoverfetcher.h" -#include "covers/albumcoverloader.h" -#include "covers/currentartloader.h" -#include "library/librarybackend.h" #include "ui/albumcoverchoicecontroller.h" -#include "ui/albumcovermanager.h" -#include "ui/albumcoversearcher.h" -#include "ui/coverfromurldialog.h" -#include "ui/iconloader.h" #include #include @@ -43,6 +32,18 @@ #include #include +#include "core/application.h" +#include "core/logging.h" +#include "core/utilities.h" +#include "covers/albumcoverfetcher.h" +#include "covers/albumcoverloader.h" +#include "covers/currentartloader.h" +#include "library/librarybackend.h" +#include "ui/albumcovermanager.h" +#include "ui/albumcoversearcher.h" +#include "ui/coverfromurldialog.h" +#include "ui/iconloader.h" + const char* AlbumCoverChoiceController::kLoadImageFileFilter = QT_TR_NOOP( "Images (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm)"); const char* AlbumCoverChoiceController::kSaveImageFileFilter = @@ -127,8 +128,9 @@ QString AlbumCoverChoiceController::LoadCoverFromFile(Song* song) { void AlbumCoverChoiceController::SaveCoverToFile(const Song& song, const QImage& image) { QString initial_file_name = - "/" + (song.effective_album().isEmpty() ? tr("Unknown") - : song.effective_album()) + + "/" + + (song.effective_album().isEmpty() ? tr("Unknown") + : song.effective_album()) + ".jpg"; QString save_filename = QFileDialog::getSaveFileName( diff --git a/src/ui/albumcoverexport.cpp b/src/ui/albumcoverexport.cpp index bd73e3219..e1f0d3a33 100644 --- a/src/ui/albumcoverexport.cpp +++ b/src/ui/albumcoverexport.cpp @@ -16,10 +16,11 @@ */ #include "albumcoverexport.h" -#include "ui_albumcoverexport.h" #include +#include "ui_albumcoverexport.h" + const char* AlbumCoverExport::kSettingsGroup = "AlbumCoverExport"; AlbumCoverExport::AlbumCoverExport(QWidget* parent) @@ -42,8 +43,9 @@ AlbumCoverExport::DialogResult AlbumCoverExport::Exec() { s.value("overwrite", OverwriteMode_None).toInt() == OverwriteMode_None); ui_->overwriteAll->setChecked( s.value("overwrite", OverwriteMode_All).toInt() == OverwriteMode_All); - ui_->overwriteSmaller->setChecked(s.value("overwrite", OverwriteMode_Smaller) - .toInt() == OverwriteMode_Smaller); + ui_->overwriteSmaller->setChecked( + s.value("overwrite", OverwriteMode_Smaller).toInt() == + OverwriteMode_Smaller); ui_->forceSize->setChecked(s.value("forceSize", false).toBool()); ui_->width->setText(s.value("width", "").toString()); ui_->height->setText(s.value("height", "").toString()); diff --git a/src/ui/albumcovermanager.cpp b/src/ui/albumcovermanager.cpp index 3a0ff4b97..f7e297230 100644 --- a/src/ui/albumcovermanager.cpp +++ b/src/ui/albumcovermanager.cpp @@ -16,30 +16,8 @@ */ #include "albumcovermanager.h" -#include "albumcoversearcher.h" -#include "iconloader.h" -#include "ui_albumcovermanager.h" -#include "core/application.h" -#include "core/logging.h" -#include "core/utilities.h" -#include "covers/albumcoverexporter.h" -#include "covers/albumcoverfetcher.h" -#include "covers/albumcoverloader.h" -#include "covers/coverproviders.h" -#include "covers/coversearchstatisticsdialog.h" -#include "library/librarybackend.h" -#include "library/libraryquery.h" -#include "library/sqlrow.h" -#include "playlist/songmimedata.h" -#include "widgets/forcescrollperpixel.h" -#include "ui/albumcoverchoicecontroller.h" -#include "ui/albumcoverexport.h" -#include "ui/iconloader.h" - -#include #include -#include #include #include #include @@ -50,9 +28,31 @@ #include #include #include +#include #include #include #include +#include + +#include "albumcoversearcher.h" +#include "core/application.h" +#include "core/logging.h" +#include "core/utilities.h" +#include "covers/albumcoverexporter.h" +#include "covers/albumcoverfetcher.h" +#include "covers/albumcoverloader.h" +#include "covers/coverproviders.h" +#include "covers/coversearchstatisticsdialog.h" +#include "iconloader.h" +#include "library/librarybackend.h" +#include "library/libraryquery.h" +#include "library/sqlrow.h" +#include "playlist/songmimedata.h" +#include "ui/albumcoverchoicecontroller.h" +#include "ui/albumcoverexport.h" +#include "ui/iconloader.h" +#include "ui_albumcovermanager.h" +#include "widgets/forcescrollperpixel.h" const char* AlbumCoverManager::kSettingsGroup = "CoverManager"; @@ -415,8 +415,9 @@ bool AlbumCoverManager::ShouldHide(const QListWidgetItem& item, bool in_text = item.text().contains(s, Qt::CaseInsensitive); bool in_artist = item.data(Role_ArtistName).toString().contains(s, Qt::CaseInsensitive); - bool in_albumartist = item.data(Role_AlbumArtistName).toString().contains( - s, Qt::CaseInsensitive); + bool in_albumartist = item.data(Role_AlbumArtistName) + .toString() + .contains(s, Qt::CaseInsensitive); if (!in_text && !in_artist && !in_albumartist) { return true; } @@ -471,9 +472,10 @@ void AlbumCoverManager::UpdateStatusText() { .arg(fetch_statistics_.missing_images_); if (fetch_statistics_.bytes_transferred_) { - message += ", " + - tr("%1 transferred").arg( - Utilities::PrettySize(fetch_statistics_.bytes_transferred_)); + message += + ", " + + tr("%1 transferred") + .arg(Utilities::PrettySize(fetch_statistics_.bytes_transferred_)); } statusBar()->showMessage(message); diff --git a/src/ui/albumcovermanager.h b/src/ui/albumcovermanager.h index d763c096d..a4f88c4e7 100644 --- a/src/ui/albumcovermanager.h +++ b/src/ui/albumcovermanager.h @@ -18,15 +18,14 @@ #ifndef ALBUMCOVERMANAGER_H #define ALBUMCOVERMANAGER_H -#include #include +#include #include -#include "gtest/gtest_prod.h" - #include "core/song.h" #include "covers/albumcoverloaderoptions.h" #include "covers/coversearchstatistics.h" +#include "gtest/gtest_prod.h" class AlbumCoverChoiceController; class AlbumCoverExport; @@ -67,7 +66,7 @@ class AlbumCoverManager : public QMainWindow { SongList GetSongsInAlbums(const QModelIndexList& indexes) const; SongMimeData* GetMimeDataForAlbums(const QModelIndexList& indexes) const; -signals: + signals: void AddToPlaylist(QMimeData* data); protected: diff --git a/src/ui/albumcovermanagerlist.cpp b/src/ui/albumcovermanagerlist.cpp index 8d49b3249..1f70cf8e1 100644 --- a/src/ui/albumcovermanagerlist.cpp +++ b/src/ui/albumcovermanagerlist.cpp @@ -17,10 +17,9 @@ #include "albumcovermanagerlist.h" -#include - #include #include +#include #include "albumcovermanager.h" #include "library/librarybackend.h" @@ -29,8 +28,8 @@ AlbumCoverManagerList::AlbumCoverManagerList(QWidget* parent) : QListWidget(parent), manager_(nullptr) {} -QMimeData* AlbumCoverManagerList::mimeData(const QList items) - const { +QMimeData* AlbumCoverManagerList::mimeData( + const QList items) const { // Get songs SongList songs; for (QListWidgetItem* item : items) { diff --git a/src/ui/albumcoversearcher.cpp b/src/ui/albumcoversearcher.cpp index f46fa5383..e6771eca5 100644 --- a/src/ui/albumcoversearcher.cpp +++ b/src/ui/albumcoversearcher.cpp @@ -16,20 +16,21 @@ */ #include "albumcoversearcher.h" -#include "ui_albumcoversearcher.h" -#include "core/application.h" -#include "core/logging.h" -#include "core/utilities.h" -#include "covers/albumcoverfetcher.h" -#include "covers/albumcoverloader.h" -#include "widgets/forcescrollperpixel.h" -#include "widgets/groupediconview.h" #include #include #include #include +#include "core/application.h" +#include "core/logging.h" +#include "core/utilities.h" +#include "covers/albumcoverfetcher.h" +#include "covers/albumcoverloader.h" +#include "ui_albumcoversearcher.h" +#include "widgets/forcescrollperpixel.h" +#include "widgets/groupediconview.h" + const int SizeOverlayDelegate::kMargin = 4; const int SizeOverlayDelegate::kPaddingX = 3; const int SizeOverlayDelegate::kPaddingY = 1; @@ -123,8 +124,9 @@ AlbumCoverSearcher::~AlbumCoverSearcher() { delete ui_; } void AlbumCoverSearcher::Init(AlbumCoverFetcher* fetcher) { fetcher_ = fetcher; - connect(fetcher_, SIGNAL(SearchFinished(quint64, CoverSearchResults, - CoverSearchStatistics)), + connect(fetcher_, + SIGNAL(SearchFinished(quint64, CoverSearchResults, + CoverSearchStatistics)), SLOT(SearchFinished(quint64, CoverSearchResults))); } diff --git a/src/ui/appearancesettingspage.cpp b/src/ui/appearancesettingspage.cpp index 8cffb45cb..9f99f2026 100644 --- a/src/ui/appearancesettingspage.cpp +++ b/src/ui/appearancesettingspage.cpp @@ -24,15 +24,15 @@ #include #include "config.h" -#include "iconloader.h" -#include "mainwindow.h" -#include "settingsdialog.h" -#include "ui_appearancesettingspage.h" #include "core/appearance.h" #include "core/application.h" #include "core/logging.h" +#include "iconloader.h" +#include "mainwindow.h" #include "playlist/playlistview.h" +#include "settingsdialog.h" #include "ui/albumcoverchoicecontroller.h" +#include "ui_appearancesettingspage.h" #ifdef HAVE_MOODBAR #include "moodbar/moodbarrenderer.h" @@ -109,7 +109,8 @@ void AppearanceSettingsPage::Load() { InitColorSelectorsColors(); ui_->b_use_sys_icons->setChecked(s.value("b_use_sys_icons", false).toBool()); - ui_->b_hide_filter_toolbar->setChecked(s.value("b_hide_filter_toolbar",false).toBool()); + ui_->b_hide_filter_toolbar->setChecked( + s.value("b_hide_filter_toolbar", false).toBool()); s.endGroup(); // Playlist settings diff --git a/src/ui/appearancesettingspage.h b/src/ui/appearancesettingspage.h index f3c0f1b0d..0eb7cfde1 100644 --- a/src/ui/appearancesettingspage.h +++ b/src/ui/appearancesettingspage.h @@ -18,9 +18,8 @@ #ifndef APPEARANCESETTINGSPAGE_H #define APPEARANCESETTINGSPAGE_H -#include "settingspage.h" - #include "playlist/playlistview.h" +#include "settingspage.h" class QWidget; diff --git a/src/ui/backgroundstreamssettingspage.cpp b/src/ui/backgroundstreamssettingspage.cpp index bca2e9def..3053bb257 100644 --- a/src/ui/backgroundstreamssettingspage.cpp +++ b/src/ui/backgroundstreamssettingspage.cpp @@ -16,19 +16,21 @@ */ #include "backgroundstreamssettingspage.h" -#include "iconloader.h" -#include "settingsdialog.h" -#include "ui_backgroundstreamssettingspage.h" -#include "core/backgroundstreams.h" #include #include +#include "core/backgroundstreams.h" +#include "iconloader.h" +#include "settingsdialog.h" +#include "ui_backgroundstreamssettingspage.h" + BackgroundStreamsSettingsPage::BackgroundStreamsSettingsPage( SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_BackgroundStreamsSettingsPage) { ui_->setupUi(this); - setWindowIcon(IconLoader::Load("weather-showers-scattered", IconLoader::Base)); + setWindowIcon( + IconLoader::Load("weather-showers-scattered", IconLoader::Base)); for (const QString& name : dialog->background_streams()->streams()) { AddStream(name); @@ -47,7 +49,7 @@ void BackgroundStreamsSettingsPage::AddStream(const QString& name) { BackgroundStreams* streams = dialog()->background_streams(); QGroupBox* box = new QGroupBox(tr(name.toUtf8())); - QLabel *label = new QLabel(box); + QLabel* label = new QLabel(box); QSlider* slider = new QSlider(Qt::Horizontal, box); QCheckBox* check = new QCheckBox(box); QHBoxLayout* hbox_layout = new QHBoxLayout(box); @@ -58,8 +60,8 @@ void BackgroundStreamsSettingsPage::AddStream(const QString& name) { QVBoxLayout* streams_layout = qobject_cast(layout()); streams_layout->insertWidget(streams_layout->count() - 1, box); - label->setPixmap(QPixmap(IconLoader::Load("audio-volume-medium", - IconLoader::Base).pixmap(32))); + label->setPixmap(QPixmap( + IconLoader::Load("audio-volume-medium", IconLoader::Base).pixmap(32))); slider->setProperty("stream_name", name); check->setProperty("stream_name", name); diff --git a/src/ui/behavioursettingspage.cpp b/src/ui/behavioursettingspage.cpp index b32816891..5bbe4b145 100644 --- a/src/ui/behavioursettingspage.cpp +++ b/src/ui/behavioursettingspage.cpp @@ -16,16 +16,16 @@ */ #include "behavioursettingspage.h" -#include "mainwindow.h" -#include "core/player.h" -#include "ui_behavioursettingspage.h" -#include "playlist/playlist.h" -#include "playlist/playlisttabbar.h" - -#include #include #include +#include + +#include "core/player.h" +#include "mainwindow.h" +#include "playlist/playlist.h" +#include "playlist/playlisttabbar.h" +#include "ui_behavioursettingspage.h" namespace { bool LocaleAwareCompare(const QString& a, const QString& b) { @@ -151,7 +151,8 @@ void BehaviourSettingsPage::Load() { ui_->doubleclick_playlist_addmode->setCurrentIndex( ui_->doubleclick_playlist_addmode->findData( s.value("doubleclick_playlist_addmode", - MainWindow::PlaylistAddBehaviour_Play).toInt())); + MainWindow::PlaylistAddBehaviour_Play) + .toInt())); ui_->menu_playmode->setCurrentIndex(ui_->menu_playmode->findData( s.value("menu_playmode", MainWindow::PlayBehaviour_IfStopped).toInt())); @@ -250,12 +251,12 @@ void BehaviourSettingsPage::Save() { if (ui_->b_remember_->isChecked()) behaviour = MainWindow::Startup_Remember; MainWindow::AddBehaviour doubleclick_addmode = MainWindow::AddBehaviour( - ui_->doubleclick_addmode->itemData( - ui_->doubleclick_addmode->currentIndex()) + ui_->doubleclick_addmode + ->itemData(ui_->doubleclick_addmode->currentIndex()) .toInt()); MainWindow::PlayBehaviour doubleclick_playmode = MainWindow::PlayBehaviour( - ui_->doubleclick_playmode->itemData( - ui_->doubleclick_playmode->currentIndex()) + ui_->doubleclick_playmode + ->itemData(ui_->doubleclick_playmode->currentIndex()) .toInt()); MainWindow::PlaylistAddBehaviour doubleclick_playlist_addmode = MainWindow::PlaylistAddBehaviour( @@ -294,8 +295,7 @@ void BehaviourSettingsPage::Save() { s.endGroup(); s.beginGroup(Player::kSettingsGroup); - s.setValue("stop_play_if_fail", - ui_->stop_play_if_fail_->isChecked()); + s.setValue("stop_play_if_fail", ui_->stop_play_if_fail_->isChecked()); s.setValue("menu_previousmode", menu_previousmode); s.setValue("seek_step_sec", ui_->seek_step_sec->value()); s.setValue("max_numprocs_tagclients", ui_->max_numprocs_tagclients->value()); diff --git a/src/ui/behavioursettingspage.h b/src/ui/behavioursettingspage.h index 36be11880..f3e0d35ec 100644 --- a/src/ui/behavioursettingspage.h +++ b/src/ui/behavioursettingspage.h @@ -18,10 +18,10 @@ #ifndef BEHAVIOURSETTINGSPAGE_H #define BEHAVIOURSETTINGSPAGE_H -#include "settingspage.h" - #include +#include "settingspage.h" + class Ui_BehaviourSettingsPage; class BehaviourSettingsPage : public SettingsPage { diff --git a/src/ui/coverfromurldialog.cpp b/src/ui/coverfromurldialog.cpp index 8813a0efe..c091ab803 100644 --- a/src/ui/coverfromurldialog.cpp +++ b/src/ui/coverfromurldialog.cpp @@ -16,9 +16,6 @@ */ #include "coverfromurldialog.h" -#include "ui_coverfromurldialog.h" -#include "core/network.h" -#include "covers/albumcoverloader.h" #include #include @@ -27,6 +24,10 @@ #include #include +#include "core/network.h" +#include "covers/albumcoverloader.h" +#include "ui_coverfromurldialog.h" + CoverFromURLDialog::CoverFromURLDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_CoverFromURLDialog), diff --git a/src/ui/dbusscreensaver.h b/src/ui/dbusscreensaver.h index 4cae2a16c..a5080b14c 100644 --- a/src/ui/dbusscreensaver.h +++ b/src/ui/dbusscreensaver.h @@ -18,10 +18,10 @@ #ifndef DBUSSCREENSAVER_H #define DBUSSCREENSAVER_H -#include "screensaver.h" - #include +#include "screensaver.h" + class DBusScreensaver : public Screensaver { public: DBusScreensaver(const QString& service, const QString& path, diff --git a/src/ui/edittagdialog.cpp b/src/ui/edittagdialog.cpp index 0f7eab415..f94f2ff27 100644 --- a/src/ui/edittagdialog.cpp +++ b/src/ui/edittagdialog.cpp @@ -16,9 +16,6 @@ */ #include "ui/edittagdialog.h" -#include "ui_edittagdialog.h" - -#include #include #include @@ -30,6 +27,7 @@ #include #include #include +#include #include "core/application.h" #include "core/logging.h" @@ -37,14 +35,15 @@ #include "core/utilities.h" #include "covers/albumcoverloader.h" #include "covers/coverproviders.h" -#include "library/librarybackend.h" #include "library/library.h" +#include "library/librarybackend.h" #include "playlist/playlistdelegates.h" #include "ui/albumcoverchoicecontroller.h" #include "ui/albumcovermanager.h" #include "ui/coverfromurldialog.h" #include "ui/iconloader.h" #include "ui/trackselectiondialog.h" +#include "ui_edittagdialog.h" const char* EditTagDialog::kHintText = QT_TR_NOOP("(different across multiple songs)"); @@ -62,10 +61,9 @@ EditTagDialog::EditTagDialog(Application* app, QWidget* parent) cover_art_is_set_(false), results_dialog_(new TrackSelectionDialog(this)) { QIcon nocover = IconLoader::Load("nocover", IconLoader::Other); - cover_options_.default_output_image_ = - AlbumCoverLoader::ScaleAndPad(cover_options_, - nocover.pixmap(nocover.availableSizes().last()) - .toImage()); + cover_options_.default_output_image_ = AlbumCoverLoader::ScaleAndPad( + cover_options_, + nocover.pixmap(nocover.availableSizes().last()).toImage()); connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage, QImage)), @@ -86,8 +84,8 @@ EditTagDialog::EditTagDialog(Application* app, QWidget* parent) ui_->splitter->setSizes(QList() << 200 << width() - 200); ui_->loading_label->hide(); - ui_->fetch_tag->setIcon(IconLoader::Load("musicbrainz", - IconLoader::Provider)); + ui_->fetch_tag->setIcon( + IconLoader::Load("musicbrainz", IconLoader::Provider)); // An editable field is one that has a label as a buddy. The label is // important because it gets turned bold when the field is changed. @@ -184,16 +182,19 @@ EditTagDialog::EditTagDialog(Application* app, QWidget* parent) new QShortcut(QKeySequence::MoveToNextPage, next_button_, SLOT(click())); // Show the shortcuts as tooltips - previous_button_->setToolTip(QString("%1 (%2 / %3)").arg( - previous_button_->text(), - QKeySequence(QKeySequence::Back).toString(QKeySequence::NativeText), - QKeySequence(QKeySequence::MoveToPreviousPage) - .toString(QKeySequence::NativeText))); - next_button_->setToolTip(QString("%1 (%2 / %3)").arg( - next_button_->text(), - QKeySequence(QKeySequence::Forward).toString(QKeySequence::NativeText), - QKeySequence(QKeySequence::MoveToNextPage) - .toString(QKeySequence::NativeText))); + previous_button_->setToolTip( + QString("%1 (%2 / %3)") + .arg(previous_button_->text(), + QKeySequence(QKeySequence::Back) + .toString(QKeySequence::NativeText), + QKeySequence(QKeySequence::MoveToPreviousPage) + .toString(QKeySequence::NativeText))); + next_button_->setToolTip(QString("%1 (%2 / %3)") + .arg(next_button_->text(), + QKeySequence(QKeySequence::Forward) + .toString(QKeySequence::NativeText), + QKeySequence(QKeySequence::MoveToNextPage) + .toString(QKeySequence::NativeText))); new TagCompleter(app_->library_backend(), Playlist::Column_Artist, ui_->artist); @@ -403,7 +404,8 @@ void EditTagDialog::UpdateFieldValue(const FieldData& field, UpdateModifiedField(field, sel); } -void EditTagDialog::UpdateModifiedField(const FieldData& field, const QModelIndexList& sel) { +void EditTagDialog::UpdateModifiedField(const FieldData& field, + const QModelIndexList& sel) { const bool modified = IsValueModified(sel, field.id_); // Update the boldness @@ -445,7 +447,7 @@ void EditTagDialog::SelectionChanged() { } } -void EditTagDialog::UpdateUI(const QModelIndexList& sel){ +void EditTagDialog::UpdateUI(const QModelIndexList& sel) { ignore_edits_ = true; for (const FieldData& field : fields_) { InitFieldValue(field, sel); @@ -479,11 +481,14 @@ void EditTagDialog::UpdateSummaryTab(const Song& song) { summary += tr("Cover art manually unset").toHtmlEscaped(); art_is_set = false; } else if (!song.art_manual().isEmpty()) { - summary += tr("Cover art set from %1").arg(song.art_manual()).toHtmlEscaped(); + summary += + tr("Cover art set from %1").arg(song.art_manual()).toHtmlEscaped(); } else if (song.has_embedded_cover()) { summary += tr("Cover art from embedded image"); } else if (!song.art_automatic().isEmpty()) { - summary += tr("Cover art loaded automatically from %1").arg(song.art_automatic()).toHtmlEscaped(); + summary += tr("Cover art loaded automatically from %1") + .arg(song.art_automatic()) + .toHtmlEscaped(); } else { summary += tr("Cover art not set").toHtmlEscaped(); art_is_set = false; @@ -525,11 +530,11 @@ void EditTagDialog::UpdateStatisticsTab(const Song& song) { ui_->score->setText(QString::number(qMax(0, song.score()))); ui_->rating->set_rating(song.rating()); - ui_->lastplayed->setText( - song.lastplayed() <= 0 - ? tr("Never") - : QDateTime::fromTime_t(song.lastplayed()).toString( - QLocale::system().dateTimeFormat(QLocale::LongFormat))); + ui_->lastplayed->setText(song.lastplayed() <= 0 + ? tr("Never") + : QDateTime::fromTime_t(song.lastplayed()) + .toString(QLocale::system().dateTimeFormat( + QLocale::LongFormat))); } void EditTagDialog::ArtLoaded(quint64 id, const QImage& scaled, diff --git a/src/ui/edittagdialog.h b/src/ui/edittagdialog.h index 9cd35b4d8..b09020d0d 100644 --- a/src/ui/edittagdialog.h +++ b/src/ui/edittagdialog.h @@ -26,8 +26,8 @@ #include "covers/albumcoverloaderoptions.h" #include "musicbrainz/tagfetcher.h" #include "playlist/playlistitem.h" -#include "widgets/lineedit.h" #include "trackselectiondialog.h" +#include "widgets/lineedit.h" class Application; class AlbumCoverChoiceController; @@ -56,7 +56,7 @@ class EditTagDialog : public QDialog { void accept(); -signals: + signals: void Error(const QString& message); protected: diff --git a/src/ui/equalizer.cpp b/src/ui/equalizer.cpp index fcb845afe..30133399b 100644 --- a/src/ui/equalizer.cpp +++ b/src/ui/equalizer.cpp @@ -16,7 +16,6 @@ */ #include "equalizer.h" -#include "ui_equalizer.h" #include #include @@ -25,6 +24,7 @@ #include #include "ui/iconloader.h" +#include "ui_equalizer.h" #include "widgets/equalizerslider.h" // We probably don't need to translate these, right? @@ -39,7 +39,8 @@ Equalizer::Equalizer(QWidget* parent) // Icons ui_->preset_del->setIcon(IconLoader::Load("list-remove", IconLoader::Base)); - ui_->preset_save->setIcon(IconLoader::Load("document-save", IconLoader::Base)); + ui_->preset_save->setIcon( + IconLoader::Load("document-save", IconLoader::Base)); preamp_ = AddSlider(tr("Pre-amp")); @@ -165,7 +166,7 @@ void Equalizer::AddPreset(const QString& name, const Params& params) { if (ui_->preset->findText(name_displayed) == -1) { ui_->preset->addItem(name_displayed, // name to display (translated) QVariant(name) // original name - ); + ); } } diff --git a/src/ui/equalizer.h b/src/ui/equalizer.h index d0decf1cc..2f42ca290 100644 --- a/src/ui/equalizer.h +++ b/src/ui/equalizer.h @@ -19,8 +19,8 @@ #define EQUALIZER_H #include -#include #include +#include class EqualizerSlider; class Ui_Equalizer; @@ -54,7 +54,7 @@ class Equalizer : public QDialog { Params current_params() const; float stereo_balance() const; -signals: + signals: void EnabledChanged(bool enabled); void ParametersChanged(int preamp, const QList& band_gains); void StereoBalanceChanged(float balance); diff --git a/src/ui/flowlayout.cpp b/src/ui/flowlayout.cpp index 582ec92bd..f8108cb18 100644 --- a/src/ui/flowlayout.cpp +++ b/src/ui/flowlayout.cpp @@ -38,9 +38,9 @@ ** ****************************************************************************/ -#include - #include "flowlayout.h" + +#include //! [1] FlowLayout::FlowLayout(QWidget* parent, int margin, int hSpacing, int vSpacing) : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing) { diff --git a/src/ui/globalshortcutgrabber.cpp b/src/ui/globalshortcutgrabber.cpp index b7dbe5ecf..ec41afc4f 100644 --- a/src/ui/globalshortcutgrabber.cpp +++ b/src/ui/globalshortcutgrabber.cpp @@ -16,10 +16,11 @@ */ #include "globalshortcutgrabber.h" -#include "ui_globalshortcutgrabber.h" -#include #include +#include + +#include "ui_globalshortcutgrabber.h" GlobalShortcutGrabber::GlobalShortcutGrabber(QWidget* parent) : QDialog(parent), ui_(new Ui::GlobalShortcutGrabber) { diff --git a/src/ui/globalshortcutgrabber.mm b/src/ui/globalshortcutgrabber.mm index 873bf9ac7..85fe0161f 100644 --- a/src/ui/globalshortcutgrabber.mm +++ b/src/ui/globalshortcutgrabber.mm @@ -48,13 +48,10 @@ bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) { } void GlobalShortcutGrabber::SetupMacEventHandler() { - id monitor = - [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask - handler:^(NSEvent* event) { - return HandleMacEvent(event) - ? event - : nil; - }]; + id monitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask + handler:^(NSEvent* event) { + return HandleMacEvent(event) ? event : nil; + }]; wrapper_ = new MacMonitorWrapper(monitor); } diff --git a/src/ui/globalshortcutssettingspage.cpp b/src/ui/globalshortcutssettingspage.cpp index 26192346f..902b9fbc9 100644 --- a/src/ui/globalshortcutssettingspage.cpp +++ b/src/ui/globalshortcutssettingspage.cpp @@ -15,14 +15,7 @@ along with Clementine. If not, see . */ -#include "globalshortcutgrabber.h" #include "globalshortcutssettingspage.h" -#include "ui_globalshortcutssettingspage.h" -#include "core/globalshortcuts.h" -#include "core/logging.h" -#include "core/utilities.h" -#include "ui/iconloader.h" -#include "ui/settingsdialog.h" #include #include @@ -33,6 +26,14 @@ #include #include +#include "core/globalshortcuts.h" +#include "core/logging.h" +#include "core/utilities.h" +#include "globalshortcutgrabber.h" +#include "ui/iconloader.h" +#include "ui/settingsdialog.h" +#include "ui_globalshortcutssettingspage.h" + GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_GlobalShortcutsSettingsPage), diff --git a/src/ui/globalshortcutssettingspage.h b/src/ui/globalshortcutssettingspage.h index e6f620976..277230e68 100644 --- a/src/ui/globalshortcutssettingspage.h +++ b/src/ui/globalshortcutssettingspage.h @@ -18,10 +18,9 @@ #ifndef GLOBALSHORTCUTSSETTINGSPAGE_H #define GLOBALSHORTCUTSSETTINGSPAGE_H -#include - #include #include +#include #include "core/globalshortcuts.h" #include "ui/settingspage.h" diff --git a/src/ui/iconloader.cpp b/src/ui/iconloader.cpp index f69150414..8508e0291 100644 --- a/src/ui/iconloader.cpp +++ b/src/ui/iconloader.cpp @@ -17,14 +17,15 @@ */ #include "iconloader.h" + +#include +#include +#include + #include "core/appearance.h" #include "core/logging.h" #include "core/utilities.h" -#include -#include -#include - QList IconLoader::sizes_; QString IconLoader::custom_icon_path_; QList IconLoader::icon_sub_path_; @@ -35,7 +36,10 @@ void IconLoader::Init() { sizes_ << 22 << 32 << 48; custom_icon_path_ = Utilities::GetConfigPath(Utilities::Path_Icons); icon_sub_path_.clear(); - icon_sub_path_ << "/icons" << "/providers" << "/last.fm" << ""; + icon_sub_path_ << "/icons" + << "/providers" + << "/last.fm" + << ""; QSettings settings; settings.beginGroup(Appearance::kSettingsGroup); use_sys_icons_ = settings.value("b_use_sys_icons", false).toBool(); @@ -58,59 +62,59 @@ QIcon IconLoader::Load(const QString& name, const IconType& icontype) { // Set the icon load location based on IConType switch (icontype) { - case Base: - case Provider: { - const QString custom_icon_location = custom_icon_path_ - + icon_sub_path_.at(icontype); - if (QDir(custom_icon_location).exists()) { - // Try to load icons from the custom icon location initially - const QString locate(custom_icon_location + "/%1x%2/%3.png"); - for (int size : sizes_) { - QString filename_custom(locate.arg(size).arg(size).arg(name)); + case Base: + case Provider: { + const QString custom_icon_location = + custom_icon_path_ + icon_sub_path_.at(icontype); + if (QDir(custom_icon_location).exists()) { + // Try to load icons from the custom icon location initially + const QString locate(custom_icon_location + "/%1x%2/%3.png"); + for (int size : sizes_) { + QString filename_custom(locate.arg(size).arg(size).arg(name)); - if (QFile::exists(filename_custom)) ret.addFile(filename_custom, - QSize(size, size)); + if (QFile::exists(filename_custom)) + ret.addFile(filename_custom, QSize(size, size)); + } + if (!ret.isNull()) return ret; } - if (!ret.isNull()) return ret; + + // Otherwise use our fallback theme + const QString path(":" + icon_sub_path_.at(icontype) + "/%1x%2/%3.png"); + for (int size : sizes_) { + QString filename(path.arg(size).arg(size).arg(name)); + + if (QFile::exists(filename)) ret.addFile(filename, QSize(size, size)); + } + break; } - // Otherwise use our fallback theme - const QString path(":" + icon_sub_path_.at(icontype) + "/%1x%2/%3.png"); - for (int size : sizes_) { - QString filename(path.arg(size).arg(size).arg(name)); + case Lastfm: + case Other: { + // lastfm icons location + const QString custom_fm_other_icon_location = + custom_icon_path_ + icon_sub_path_.at(icontype); + if (QDir(custom_fm_other_icon_location).exists()) { + // Try to load icons from the custom icon location initially + const QString locate_file(custom_fm_other_icon_location + "/" + name + + ".png"); - if (QFile::exists(filename)) ret.addFile(filename, QSize(size, size)); - } - break; - } + if (QFile::exists(locate_file)) ret.addFile(locate_file); + if (!ret.isNull()) return ret; + } - case Lastfm: - case Other: { - // lastfm icons location - const QString custom_fm_other_icon_location = custom_icon_path_ - + icon_sub_path_.at(icontype); - if (QDir(custom_fm_other_icon_location).exists()) { - // Try to load icons from the custom icon location initially - const QString locate_file( - custom_fm_other_icon_location + "/" + name + ".png"); + // Otherwise use our fallback theme + const QString path_file(":" + icon_sub_path_.at(icontype) + "/" + name + + ".png"); - if (QFile::exists(locate_file)) ret.addFile(locate_file); - if (!ret.isNull()) return ret; + if (QFile::exists(path_file)) ret.addFile(path_file); + break; } - // Otherwise use our fallback theme - const QString path_file(":" + icon_sub_path_.at(icontype) - + "/" + name + ".png"); - - if (QFile::exists(path_file)) ret.addFile(path_file); - break; + default: + // Should never be reached + qLog(Warning) << "Couldn't recognize IconType" << name; } - - default: - // Should never be reached - qLog(Warning) << "Couldn't recognize IconType" << name; - } - // Load icon from system theme only if it hasn't been found + // Load icon from system theme only if it hasn't been found if (ret.isNull()) { ret = QIcon::fromTheme(name); if (!ret.isNull()) return ret; diff --git a/src/ui/iconloader.h b/src/ui/iconloader.h index f0c5fe54b..4fdfafa61 100644 --- a/src/ui/iconloader.h +++ b/src/ui/iconloader.h @@ -23,12 +23,7 @@ class IconLoader { public: - enum IconType { - Base = 0, - Provider = 1, - Lastfm = 2, - Other = 3 - }; + enum IconType { Base = 0, Provider = 1, Lastfm = 2, Other = 3 }; static void Init(); static QIcon Load(const QString& name, const IconType& icontype); diff --git a/src/ui/lovedialog.cpp b/src/ui/lovedialog.cpp index 2c0c965c1..030baaf62 100644 --- a/src/ui/lovedialog.cpp +++ b/src/ui/lovedialog.cpp @@ -16,7 +16,6 @@ */ #include "ui/lovedialog.h" -#include "ui_lovedialog.h" #include #include @@ -25,14 +24,12 @@ #include "core/logging.h" #include "core/utilities.h" #include "library/librarybackend.h" +#include "ui_lovedialog.h" const char* LoveDialog::kSettingsGroup = "LoveDialog"; LoveDialog::LoveDialog(Application* app, QWidget* parent) - : QDialog(parent), - ui_(new Ui_LoveDialog), - app_(app) -{ + : QDialog(parent), ui_(new Ui_LoveDialog), app_(app) { ui_->setupUi(this); connect(ui_->button_box, SIGNAL(clicked(QAbstractButton*)), @@ -44,7 +41,8 @@ LoveDialog::~LoveDialog() { delete ui_; } void LoveDialog::SetSong(const Song& song) { song_ = song; - QString summary = "" + song.PrettyTitleWithArtist().toHtmlEscaped() + ""; + QString summary = + "" + song.PrettyTitleWithArtist().toHtmlEscaped() + ""; ui_->summary->setText(summary); ui_->rating->set_rating(song.rating()); } @@ -68,7 +66,8 @@ void LoveDialog::showEvent(QShowEvent* e) { void LoveDialog::SongRated(float rating) { qLog(Debug) << "LoveDialog::SongRated: rating=" << rating; - qLog(Debug) << "LoveDialog::SongRated: isValid=" << song_.is_valid() << " id=" << song_.id(); + qLog(Debug) << "LoveDialog::SongRated: isValid=" << song_.is_valid() + << " id=" << song_.id(); if (!song_.is_valid() || song_.id() == -1) return; qLog(Debug) << "LoveDialog::SongRated: song is valid and id is good"; diff --git a/src/ui/lovedialog.h b/src/ui/lovedialog.h index e80daee0d..a3616ec14 100644 --- a/src/ui/lovedialog.h +++ b/src/ui/lovedialog.h @@ -39,7 +39,7 @@ class LoveDialog : public QDialog { void SetSong(const Song&); -signals: + signals: void Error(const QString& message); protected: diff --git a/src/ui/macscreensaver.h b/src/ui/macscreensaver.h index ac0251c3e..70ab3314f 100644 --- a/src/ui/macscreensaver.h +++ b/src/ui/macscreensaver.h @@ -18,10 +18,10 @@ #ifndef MACSCREENSAVER_H #define MACSCREENSAVER_H -#include "screensaver.h" - #include +#include "screensaver.h" + class MacScreensaver : public Screensaver { public: MacScreensaver(); diff --git a/src/ui/macsystemtrayicon.mm b/src/ui/macsystemtrayicon.mm index c2f309ab2..6b08a75f9 100644 --- a/src/ui/macsystemtrayicon.mm +++ b/src/ui/macsystemtrayicon.mm @@ -62,20 +62,16 @@ class MacSystemTrayIconPrivate { dock_menu_ = [[NSMenu alloc] initWithTitle:@"DockMenu"]; QString title = QT_TR_NOOP("Now Playing"); - NSString* t = - [[NSString alloc] initWithUTF8String:title.toUtf8().constData()]; - now_playing_ = - [[NSMenuItem alloc] initWithTitle:t action:nullptr keyEquivalent:@""]; + NSString* t = [[NSString alloc] initWithUTF8String:title.toUtf8().constData()]; + now_playing_ = [[NSMenuItem alloc] initWithTitle:t action:nullptr keyEquivalent:@""]; - now_playing_artist_ = - [[NSMenuItem alloc] initWithTitle:@"Nothing to see here" - action:nullptr - keyEquivalent:@""]; + now_playing_artist_ = [[NSMenuItem alloc] initWithTitle:@"Nothing to see here" + action:nullptr + keyEquivalent:@""]; - now_playing_title_ = - [[NSMenuItem alloc] initWithTitle:@"Nothing to see here" - action:nullptr - keyEquivalent:@""]; + now_playing_title_ = [[NSMenuItem alloc] initWithTitle:@"Nothing to see here" + action:nullptr + keyEquivalent:@""]; [dock_menu_ insertItem:now_playing_title_ atIndex:0]; [dock_menu_ insertItem:now_playing_artist_ atIndex:0]; @@ -83,7 +79,7 @@ class MacSystemTrayIconPrivate { // Don't look now. // This must be called after our custom NSApplicationDelegate has been set. - [(AppDelegate*)([NSApp delegate])setDockMenu:dock_menu_]; + [(AppDelegate*)([NSApp delegate]) setDockMenu:dock_menu_]; ClearNowPlaying(); } @@ -91,8 +87,7 @@ class MacSystemTrayIconPrivate { void AddMenuItem(QAction* action) { // Strip accelarators from name. QString text = action->text().remove("&"); - NSString* title = - [[NSString alloc] initWithUTF8String:text.toUtf8().constData()]; + NSString* title = [[NSString alloc] initWithUTF8String:text.toUtf8().constData()]; // Create an object that can receive user clicks and pass them on to the // QAction. Target* target = [[Target alloc] initWithQAction:action]; @@ -107,8 +102,7 @@ class MacSystemTrayIconPrivate { void ActionChanged(QAction* action) { NSMenuItem* item = actions_[action]; - NSString* title = [[NSString alloc] - initWithUTF8String:action->text().toUtf8().constData()]; + NSString* title = [[NSString alloc] initWithUTF8String:action->text().toUtf8().constData()]; [item setTitle:title]; } @@ -120,17 +114,11 @@ class MacSystemTrayIconPrivate { void ShowNowPlaying(const QString& artist, const QString& title) { ClearNowPlaying(); // Makes sure the order is consistent. [now_playing_artist_ - setTitle:[[NSString alloc] - initWithUTF8String:artist.toUtf8().constData()]]; - [now_playing_title_ - setTitle:[[NSString alloc] - initWithUTF8String:title.toUtf8().constData()]]; - title.isEmpty() ? HideItem(now_playing_title_) - : ShowItem(now_playing_title_); - artist.isEmpty() ? HideItem(now_playing_artist_) - : ShowItem(now_playing_artist_); - artist.isEmpty() && title.isEmpty() ? HideItem(now_playing_) - : ShowItem(now_playing_); + setTitle:[[NSString alloc] initWithUTF8String:artist.toUtf8().constData()]]; + [now_playing_title_ setTitle:[[NSString alloc] initWithUTF8String:title.toUtf8().constData()]]; + title.isEmpty() ? HideItem(now_playing_title_) : ShowItem(now_playing_title_); + artist.isEmpty() ? HideItem(now_playing_artist_) : ShowItem(now_playing_artist_); + artist.isEmpty() && title.isEmpty() ? HideItem(now_playing_) : ShowItem(now_playing_); } void ClearNowPlaying() { @@ -165,18 +153,17 @@ class MacSystemTrayIconPrivate { MacSystemTrayIcon::MacSystemTrayIcon(QObject* parent) : SystemTrayIcon(parent), - orange_icon_(QPixmap(":icon_large.png").scaled( - 128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)), - grey_icon_(QPixmap(":icon_large_grey.png").scaled( - 128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)) { + orange_icon_(QPixmap(":icon_large.png") + .scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)), + grey_icon_(QPixmap(":icon_large_grey.png") + .scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)) { QApplication::setWindowIcon(orange_icon_); } MacSystemTrayIcon::~MacSystemTrayIcon() {} -void MacSystemTrayIcon::SetupMenu(QAction* previous, QAction* play, - QAction* stop, QAction* stop_after, - QAction* next, QAction* mute, QAction* love, +void MacSystemTrayIcon::SetupMenu(QAction* previous, QAction* play, QAction* stop, + QAction* stop_after, QAction* next, QAction* mute, QAction* love, QAction* quit) { p_.reset(new MacSystemTrayIconPrivate()); SetupMenuItem(previous); @@ -207,7 +194,6 @@ void MacSystemTrayIcon::ActionChanged() { void MacSystemTrayIcon::ClearNowPlaying() { p_->ClearNowPlaying(); } -void MacSystemTrayIcon::SetNowPlaying(const Song& song, - const QString& image_path) { +void MacSystemTrayIcon::SetNowPlaying(const Song& song, const QString& image_path) { p_->ShowNowPlaying(song.artist(), song.PrettyTitle()); } diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index dbc352dd2..aff6cf2a1 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -16,10 +16,6 @@ */ #include "mainwindow.h" -#include "ui_mainwindow.h" - -#include -#include #include #include @@ -37,6 +33,8 @@ #include #include #include +#include +#include #include "core/appearance.h" #include "core/application.h" @@ -91,6 +89,7 @@ #include "playlist/queuemanager.h" #include "playlist/songplaylistitem.h" #include "playlistparsers/playlistparser.h" +#include "ui_mainwindow.h" #ifdef HAVE_AUDIOCD #include "ripper/ripcddialog.h" #endif @@ -105,9 +104,9 @@ #include "ui/albumcovermanager.h" #include "ui/console.h" #include "ui/edittagdialog.h" -#include "ui/lovedialog.h" #include "ui/equalizer.h" #include "ui/iconloader.h" +#include "ui/lovedialog.h" #include "ui/organisedialog.h" #include "ui/organiseerrordialog.h" #include "ui/qtsystemtrayicon.h" @@ -160,7 +159,7 @@ const char* MainWindow::kShowDebugConsoleKey = "CLEMENTINE_DEBUG_CONSOLE"; namespace { const int kTrackSliderUpdateTimeMs = 500; const int kTrackPositionUpdateTimeMs = 1000; -} +} // namespace MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, const CommandlineOptions& options, QWidget* parent) @@ -204,8 +203,8 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, }), equalizer_(new Equalizer), organise_dialog_([=]() { - OrganiseDialog* dialog = new OrganiseDialog(app->task_manager(), - app->library_backend()); + OrganiseDialog* dialog = + new OrganiseDialog(app->task_manager(), app->library_backend()); dialog->SetDestinationModel(app->directory_model()); return dialog; }), @@ -932,8 +931,8 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, // Load theme // This is tricky: we need to save the default/system palette now, before - // loading user preferred theme (which will override it), to be able to restore - // it later + // loading user preferred theme (which will override it), to be able to + // restore it later const_cast(Appearance::kDefaultPalette) = QApplication::palette(); app_->appearance()->LoadUserTheme(); StyleSheetLoader* css_loader = new StyleSheetLoader(this); @@ -1067,9 +1066,7 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, qLog(Debug) << "Started"; } -MainWindow::~MainWindow() { - delete ui_; -} +MainWindow::~MainWindow() { delete ui_; } void MainWindow::ReloadSettings() { #ifndef Q_OS_DARWIN @@ -1169,25 +1166,22 @@ void MainWindow::MediaPlaying() { return; } - const bool enable_play_pause = !(item->options() & - PlaylistItem::PauseDisabled); + const bool enable_play_pause = + !(item->options() & PlaylistItem::PauseDisabled); ui_->action_play_pause->setEnabled(enable_play_pause); - const bool can_seek = !(item->options() & - PlaylistItem::SeekDisabled); + const bool can_seek = !(item->options() & PlaylistItem::SeekDisabled); ui_->track_slider->SetCanSeek(can_seek); // Set the rate/love icon if (IsLastFmEnabled()) { ui_->action_love->setIcon(IconLoader::Load("love", IconLoader::Lastfm)); ui_->action_love->setEnabled(true); - } - else if (item->IsLocalLibraryItem()) { - ui_->action_love->setIcon(IconLoader::Load("rate-enabled", - IconLoader::Base)); + } else if (item->IsLocalLibraryItem()) { + ui_->action_love->setIcon( + IconLoader::Load("rate-enabled", IconLoader::Base)); ui_->action_love->setEnabled(true); - } - else { + } else { ui_->action_love->setEnabled(false); } @@ -1620,14 +1614,12 @@ void MainWindow::Love() { ui_->action_love->setEnabled(false); if (tray_icon_) tray_icon_->LastFMButtonLoveStateChanged(false); #endif - } - else if (item->IsLocalLibraryItem()) { + } else if (item->IsLocalLibraryItem()) { const Song& song = item->Metadata(); if (!song.is_valid() || song.id() == -1) return; love_dialog_->SetSong(song); love_dialog_->show(); - } - else { + } else { qLog(Warning) << "Love: unable to love or rate"; } } @@ -2138,9 +2130,9 @@ void MainWindow::AddFile() { // Show dialog QStringList file_names = QFileDialog::getOpenFileNames( this, tr("Add file"), directory, - QString("%1 (%2);;%3;;%4").arg(tr("Music"), FileView::kFileFilter, - parser.filters(), - tr(kAllFilesFilterSpec))); + QString("%1 (%2);;%3;;%4") + .arg(tr("Music"), FileView::kFileFilter, parser.filters(), + tr(kAllFilesFilterSpec))); if (file_names.isEmpty()) return; // Save last used directory @@ -2354,7 +2346,8 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions& options) { app_->player()->Next(); - DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage); + DeleteFiles* delete_files = + new DeleteFiles(app_->task_manager(), storage); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); delete_files->Start(url); @@ -2715,8 +2708,7 @@ EditTagDialog* MainWindow::CreateEditTagDialog() { LoveDialog* MainWindow::CreateLoveDialog() { LoveDialog* dialog = new LoveDialog(app_); - connect(dialog, SIGNAL(Error(QString)), - SLOT(ShowErrorDialog(QString))); + connect(dialog, SIGNAL(Error(QString)), SLOT(ShowErrorDialog(QString))); return dialog; } @@ -2968,8 +2960,8 @@ void MainWindow::SetToggleScrobblingIcon(bool value) { bool MainWindow::IsLastFmEnabled() { #ifdef HAVE_LIBLASTFM return ui_->action_toggle_scrobbling->isVisible() && - app_->scrobbler()->IsScrobblingEnabled() && - app_->scrobbler()->IsAuthenticated(); + app_->scrobbler()->IsScrobblingEnabled() && + app_->scrobbler()->IsAuthenticated(); #else return false; #endif diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index b0b37925c..2debc8ac0 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -18,11 +18,10 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include - #include #include #include +#include #include "config.h" #include "core/lazy.h" @@ -145,7 +144,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { void Activate(); bool LoadUrl(const QString& url); -signals: + signals: // Signals that stop playing after track was toggled. void StopAfterToggled(bool stop); diff --git a/src/ui/networkproxysettingspage.cpp b/src/ui/networkproxysettingspage.cpp index 57cb21b42..1a1124f3b 100644 --- a/src/ui/networkproxysettingspage.cpp +++ b/src/ui/networkproxysettingspage.cpp @@ -15,13 +15,14 @@ along with Clementine. If not, see . */ -#include "iconloader.h" #include "networkproxysettingspage.h" -#include "ui_networkproxysettingspage.h" -#include "core/networkproxyfactory.h" #include +#include "core/networkproxyfactory.h" +#include "iconloader.h" +#include "ui_networkproxysettingspage.h" + NetworkProxySettingsPage::NetworkProxySettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_NetworkProxySettingsPage) { ui_->setupUi(this); diff --git a/src/ui/networkremotesettingspage.cpp b/src/ui/networkremotesettingspage.cpp index c0b80f393..fafab44da 100644 --- a/src/ui/networkremotesettingspage.cpp +++ b/src/ui/networkremotesettingspage.cpp @@ -16,9 +16,6 @@ */ #include "networkremotesettingspage.h" -#include "ui_networkremotesettingspage.h" - -#include #include #include @@ -26,6 +23,7 @@ #include #include #include +#include #include "core/application.h" #include "networkremote/networkremote.h" @@ -34,6 +32,7 @@ #include "transcoder/transcoderoptionsdialog.h" #include "ui/iconloader.h" #include "ui/settingsdialog.h" +#include "ui_networkremotesettingspage.h" const char* NetworkRemoteSettingsPage::kPlayStoreUrl = "https://play.google.com/store/apps/details?id=de.qspool.clementineremote"; diff --git a/src/ui/notificationssettingspage.cpp b/src/ui/notificationssettingspage.cpp index c2fbde9bc..75733d33b 100644 --- a/src/ui/notificationssettingspage.cpp +++ b/src/ui/notificationssettingspage.cpp @@ -15,18 +15,19 @@ along with Clementine. If not, see . */ -#include "iconloader.h" #include "notificationssettingspage.h" -#include "settingsdialog.h" -#include "ui_notificationssettingspage.h" -#include "ui/iconloader.h" -#include "widgets/osdpretty.h" #include #include #include #include +#include "iconloader.h" +#include "settingsdialog.h" +#include "ui/iconloader.h" +#include "ui_notificationssettingspage.h" +#include "widgets/osdpretty.h" + NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_NotificationsSettingsPage), @@ -35,9 +36,9 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog) setWindowIcon(IconLoader::Load("help-hint", IconLoader::Base)); QIcon nocover = IconLoader::Load("nocover", IconLoader::Other); - pretty_popup_->SetMessage(tr("OSD Preview"), tr("Drag to reposition"), - nocover.pixmap(nocover.availableSizes().last()) - .toImage()); + pretty_popup_->SetMessage( + tr("OSD Preview"), tr("Drag to reposition"), + nocover.pixmap(nocover.availableSizes().last()).toImage()); ui_->notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue), Qt::DecorationRole); @@ -108,8 +109,10 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog) SLOT(PrepareNotificationPreview())); // Icons - ui_->notifications_exp_chooser1->setIcon(IconLoader::Load("list-add", IconLoader::Base)); - ui_->notifications_exp_chooser2->setIcon(IconLoader::Load("list-add", IconLoader::Base)); + ui_->notifications_exp_chooser1->setIcon( + IconLoader::Load("list-add", IconLoader::Base)); + ui_->notifications_exp_chooser2->setIcon( + IconLoader::Load("list-add", IconLoader::Base)); } NotificationsSettingsPage::~NotificationsSettingsPage() { @@ -139,7 +142,7 @@ void NotificationsSettingsPage::Load() { ui_->notifications_native->setChecked(true); break; } - // Fallthrough + // Fallthrough case OSD::Pretty: ui_->notifications_pretty->setChecked(true); @@ -150,7 +153,7 @@ void NotificationsSettingsPage::Load() { ui_->notifications_tray->setChecked(true); break; } - // Fallthrough + // Fallthrough case OSD::Disabled: default: diff --git a/src/ui/organisedialog.cpp b/src/ui/organisedialog.cpp index 4904786ff..1d8a9040c 100644 --- a/src/ui/organisedialog.cpp +++ b/src/ui/organisedialog.cpp @@ -16,10 +16,6 @@ */ #include "organisedialog.h" -#include "ui_organisedialog.h" - -#include -#include #include #include @@ -30,21 +26,24 @@ #include #include #include +#include +#include -#include "iconloader.h" -#include "organiseerrordialog.h" #include "core/musicstorage.h" #include "core/organise.h" #include "core/tagreaderclient.h" #include "core/utilities.h" +#include "iconloader.h" #include "library/librarybackend.h" +#include "organiseerrordialog.h" +#include "ui_organisedialog.h" const char* OrganiseDialog::kDefaultFormat = "%artist/%album{ (Disc %disc)}/{%track - }%title.%extension"; const char* OrganiseDialog::kSettingsGroup = "OrganiseDialog"; -OrganiseDialog::OrganiseDialog( - TaskManager* task_manager, LibraryBackend* backend, QWidget* parent) +OrganiseDialog::OrganiseDialog(TaskManager* task_manager, + LibraryBackend* backend, QWidget* parent) : QDialog(parent), ui_(new Ui_OrganiseDialog), task_manager_(task_manager), @@ -391,7 +390,7 @@ void OrganiseDialog::accept() { connect(organise, SIGNAL(FileCopied(int)), this, SIGNAL(FileCopied(int))); if (backend_ != nullptr) { connect(organise, SIGNAL(SongPathChanged(const Song&, const QFileInfo&)), - backend_, SLOT(SongPathChanged(const Song&, const QFileInfo&))); + backend_, SLOT(SongPathChanged(const Song&, const QFileInfo&))); } organise->Start(); diff --git a/src/ui/organisedialog.h b/src/ui/organisedialog.h index 5504c0ae4..aae147c1a 100644 --- a/src/ui/organisedialog.h +++ b/src/ui/organisedialog.h @@ -18,18 +18,16 @@ #ifndef ORGANISEDIALOG_H #define ORGANISEDIALOG_H -#include - #include #include #include #include - -#include "gtest/gtest_prod.h" +#include #include "core/organise.h" #include "core/organiseformat.h" #include "core/song.h" +#include "gtest/gtest_prod.h" #include "library/librarybackend.h" class LibraryWatcher; diff --git a/src/ui/organiseerrordialog.cpp b/src/ui/organiseerrordialog.cpp index e9755575f..762694988 100644 --- a/src/ui/organiseerrordialog.cpp +++ b/src/ui/organiseerrordialog.cpp @@ -16,11 +16,11 @@ */ #include "organiseerrordialog.h" -#include "ui_organiseerrordialog.h" - -#include #include +#include + +#include "ui_organiseerrordialog.h" OrganiseErrorDialog::OrganiseErrorDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_OrganiseErrorDialog) { diff --git a/src/ui/organiseerrordialog.h b/src/ui/organiseerrordialog.h index e250d683c..0ad4cb87d 100644 --- a/src/ui/organiseerrordialog.h +++ b/src/ui/organiseerrordialog.h @@ -31,7 +31,10 @@ class OrganiseErrorDialog : public QDialog { OrganiseErrorDialog(QWidget* parent = nullptr); ~OrganiseErrorDialog(); - enum OperationType { Type_Copy, Type_Delete, }; + enum OperationType { + Type_Copy, + Type_Delete, + }; void Show(OperationType type, const SongList& songs_with_errors); void Show(OperationType type, const QStringList& files_with_errors); diff --git a/src/ui/playbacksettingspage.cpp b/src/ui/playbacksettingspage.cpp index 621580e56..e793378ac 100644 --- a/src/ui/playbacksettingspage.cpp +++ b/src/ui/playbacksettingspage.cpp @@ -15,12 +15,13 @@ along with Clementine. If not, see . */ -#include "iconloader.h" #include "playbacksettingspage.h" + +#include "engines/gstengine.h" +#include "iconloader.h" +#include "playlist/playlist.h" #include "settingsdialog.h" #include "ui_playbacksettingspage.h" -#include "engines/gstengine.h" -#include "playlist/playlist.h" PlaybackSettingsPage::PlaybackSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_PlaybackSettingsPage) { diff --git a/src/ui/qtsystemtrayicon.cpp b/src/ui/qtsystemtrayicon.cpp index abe6b0035..b33be2d6e 100644 --- a/src/ui/qtsystemtrayicon.cpp +++ b/src/ui/qtsystemtrayicon.cpp @@ -15,19 +15,19 @@ along with Clementine. If not, see . */ -#include "iconloader.h" #include "qtsystemtrayicon.h" -#include "core/song.h" - #include -#include -#include -#include #include +#include +#include #include +#include #include +#include "core/song.h" +#include "iconloader.h" + QtSystemTrayIcon::QtSystemTrayIcon(QObject* parent) : SystemTrayIcon(parent), tray_(new QSystemTrayIcon(this)), diff --git a/src/ui/qtsystemtrayicon.h b/src/ui/qtsystemtrayicon.h index 05330665e..e0c5e36c1 100644 --- a/src/ui/qtsystemtrayicon.h +++ b/src/ui/qtsystemtrayicon.h @@ -18,11 +18,11 @@ #ifndef QTSYSTEMTRAYICON_H #define QTSYSTEMTRAYICON_H +#include + #include "mainwindow.h" #include "systemtrayicon.h" -#include - class QtSystemTrayIcon : public SystemTrayIcon { Q_OBJECT diff --git a/src/ui/screensaver.cpp b/src/ui/screensaver.cpp index af55ab8e1..9cf30fe1d 100644 --- a/src/ui/screensaver.cpp +++ b/src/ui/screensaver.cpp @@ -15,15 +15,17 @@ along with Clementine. If not, see . */ -#include "config.h" #include "screensaver.h" #include +#include "config.h" + #ifdef HAVE_DBUS -#include "dbusscreensaver.h" #include #include + +#include "dbusscreensaver.h" #endif #ifdef Q_OS_DARWIN diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index a67d8c694..88870c9bd 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -16,6 +16,7 @@ */ #include "settingsdialog.h" + #include "appearancesettingspage.h" #include "backgroundstreamssettingspage.h" #include "behavioursettingspage.h" @@ -44,11 +45,10 @@ #include "playlist/playlistview.h" #include "songinfo/songinfosettingspage.h" #include "transcoder/transcodersettingspage.h" +#include "ui_settingsdialog.h" #include "widgets/groupediconview.h" #include "widgets/osdpretty.h" -#include "ui_settingsdialog.h" - #ifdef HAVE_LIBLASTFM #include "internet/lastfm/lastfmsettingspage.h" #endif diff --git a/src/ui/settingspage.cpp b/src/ui/settingspage.cpp index f21affe32..f8e39e6c6 100644 --- a/src/ui/settingspage.cpp +++ b/src/ui/settingspage.cpp @@ -15,9 +15,10 @@ along with Clementine. If not, see . */ -#include "settingsdialog.h" #include "settingspage.h" + #include "core/logging.h" +#include "settingsdialog.h" SettingsPage::SettingsPage(SettingsDialog* dialog) : QWidget(dialog), maybe_changed_(false), dialog_(dialog) {} diff --git a/src/ui/standarditemiconloader.cpp b/src/ui/standarditemiconloader.cpp index c382e6837..2087a4b55 100644 --- a/src/ui/standarditemiconloader.cpp +++ b/src/ui/standarditemiconloader.cpp @@ -16,11 +16,12 @@ */ #include "standarditemiconloader.h" -#include "covers/albumcoverloader.h" -#include #include #include +#include + +#include "covers/albumcoverloader.h" StandardItemIconLoader::StandardItemIconLoader(AlbumCoverLoader* cover_loader, QObject* parent) @@ -60,7 +61,8 @@ void StandardItemIconLoader::LoadIcon(const Song& song, void StandardItemIconLoader::RowsAboutToBeRemoved(const QModelIndex& parent, int begin, int end) { - // For QStandardItemModel, the invisible root item does not have a valid index. + // For QStandardItemModel, the invisible root item does not have a valid + // index. bool is_top = !parent.isValid(); for (QMap::iterator it = pending_covers_.begin(); diff --git a/src/ui/standarditemiconloader.h b/src/ui/standarditemiconloader.h index eaae973de..a97001f67 100644 --- a/src/ui/standarditemiconloader.h +++ b/src/ui/standarditemiconloader.h @@ -18,11 +18,11 @@ #ifndef STANDARDITEMICONLOADER_H #define STANDARDITEMICONLOADER_H -#include "covers/albumcoverloaderoptions.h" - #include #include +#include "covers/albumcoverloaderoptions.h" + class AlbumCoverLoader; class Song; @@ -36,7 +36,8 @@ class StandardItemIconLoader : public QObject { Q_OBJECT public: - StandardItemIconLoader(AlbumCoverLoader* cover_loader, QObject* parent = nullptr); + StandardItemIconLoader(AlbumCoverLoader* cover_loader, + QObject* parent = nullptr); AlbumCoverLoaderOptions* options() { return &cover_options_; } diff --git a/src/ui/streamdetailsdialog.cpp b/src/ui/streamdetailsdialog.cpp index cab6b879f..451996715 100644 --- a/src/ui/streamdetailsdialog.cpp +++ b/src/ui/streamdetailsdialog.cpp @@ -1,8 +1,9 @@ #include "streamdetailsdialog.h" -#include "ui_streamdetailsdialog.h" #include +#include "ui_streamdetailsdialog.h" + StreamDetailsDialog::StreamDetailsDialog(QWidget* parent) : QDialog(parent), ui_(new Ui::StreamDetailsDialog) { ui_->setupUi(this); diff --git a/src/ui/streamdetailsdialog.h b/src/ui/streamdetailsdialog.h index 1e10a619c..28b6def6f 100644 --- a/src/ui/streamdetailsdialog.h +++ b/src/ui/streamdetailsdialog.h @@ -1,9 +1,8 @@ #ifndef STREAMDETAILSDIALOG_H #define STREAMDETAILSDIALOG_H -#include - #include +#include namespace Ui { class StreamDetailsDialog; diff --git a/src/ui/systemtrayicon.cpp b/src/ui/systemtrayicon.cpp index 7aaeb5e51..d7739c08c 100644 --- a/src/ui/systemtrayicon.cpp +++ b/src/ui/systemtrayicon.cpp @@ -15,8 +15,6 @@ along with Clementine. If not, see . */ -#include "macsystemtrayicon.h" -#include "qtsystemtrayicon.h" #include "systemtrayicon.h" #include @@ -26,14 +24,14 @@ #include #include #include - #include +#include "macsystemtrayicon.h" +#include "qtsystemtrayicon.h" #include "ui/iconloader.h" SystemTrayIcon::SystemTrayIcon(QObject* parent) - : QObject(parent), - percentage_(0) { + : QObject(parent), percentage_(0) { QIcon tiny_start = IconLoader::Load("tiny-start", IconLoader::Other); playing_icon_ = tiny_start.pixmap(tiny_start.availableSizes().last()); QIcon tiny_pause = IconLoader::Load("tiny-pause", IconLoader::Other); diff --git a/src/ui/systemtrayicon.h b/src/ui/systemtrayicon.h index d8bf0e1ba..815a67bea 100644 --- a/src/ui/systemtrayicon.h +++ b/src/ui/systemtrayicon.h @@ -60,7 +60,7 @@ class SystemTrayIcon : public QObject { virtual void LastFMButtonLoveStateChanged(bool value) {} virtual void MuteButtonStateChanged(bool value) {} -signals: + signals: void ChangeVolume(int delta); void SeekForward(); void SeekBackward(); diff --git a/src/ui/trackselectiondialog.cpp b/src/ui/trackselectiondialog.cpp index e49f4d846..fef7a9941 100644 --- a/src/ui/trackselectiondialog.cpp +++ b/src/ui/trackselectiondialog.cpp @@ -16,7 +16,6 @@ */ #include "ui/trackselectiondialog.h" -#include "ui_trackselectiondialog.h" #include #include @@ -28,6 +27,7 @@ #include "core/tagreaderclient.h" #include "ui/iconloader.h" +#include "ui_trackselectiondialog.h" TrackSelectionDialog::TrackSelectionDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_TrackSelectionDialog), save_on_close_(false) { diff --git a/src/ui/trackselectiondialog.h b/src/ui/trackselectiondialog.h index 43a199c9e..42c9d3539 100644 --- a/src/ui/trackselectiondialog.h +++ b/src/ui/trackselectiondialog.h @@ -21,7 +21,6 @@ #include #include "config.h" - #include "core/song.h" class Ui_TrackSelectionDialog; @@ -46,7 +45,7 @@ class TrackSelectionDialog : public QDialog { // QDialog void accept(); -signals: + signals: void Error(const QString& error); void SongChosen(const Song& original_song, const Song& new_metadata); diff --git a/src/ui/windows7thumbbar.cpp b/src/ui/windows7thumbbar.cpp index 50b2254d5..c877b3e94 100644 --- a/src/ui/windows7thumbbar.cpp +++ b/src/ui/windows7thumbbar.cpp @@ -16,18 +16,19 @@ */ #include "windows7thumbbar.h" -#include "core/logging.h" #include #include +#include "core/logging.h" + #ifdef Q_OS_WIN32 -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -# endif -# include -# include -# include +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#include +#include +#include #endif // Q_OS_WIN32 const int Windows7ThumbBar::kIconSize = 16; @@ -56,7 +57,7 @@ void Windows7ThumbBar::SetActions(const QList& actions) { #ifdef Q_OS_WIN32 -extern HICON qt_pixmapToWinHICON(const QPixmap &p); +extern HICON qt_pixmapToWinHICON(const QPixmap& p); static void SetupButton(const QAction* action, THUMBBUTTON* button) { if (action) { @@ -135,8 +136,8 @@ void Windows7ThumbBar::HandleWinEvent(MSG* msg) { } qLog(Debug) << "Adding buttons"; - hr = taskbar_list->ThumbBarAddButtons((HWND)widget_->winId(), actions_.count(), - buttons); + hr = taskbar_list->ThumbBarAddButtons((HWND)widget_->winId(), + actions_.count(), buttons); if (hr != S_OK) qLog(Debug) << "Failed to add buttons" << hex << DWORD(hr); for (int i = 0; i < actions_.count(); i++) { if (buttons[i].hIcon > 0) DestroyIcon(buttons[i].hIcon); diff --git a/src/ui/windowsscreensaver.h b/src/ui/windowsscreensaver.h index fc3bd8f07..be3cd753a 100644 --- a/src/ui/windowsscreensaver.h +++ b/src/ui/windowsscreensaver.h @@ -17,10 +17,10 @@ #ifndef WINDOWSSCREENSAVER_H #define WINDOWSSCREENSAVER_H -#include "screensaver.h" - #include +#include "screensaver.h" + class WindowsScreensaver : public Screensaver { public: WindowsScreensaver(); diff --git a/src/visualisations/projectmpresetmodel.cpp b/src/visualisations/projectmpresetmodel.cpp index a9cadfadd..67b049935 100644 --- a/src/visualisations/projectmpresetmodel.cpp +++ b/src/visualisations/projectmpresetmodel.cpp @@ -15,8 +15,9 @@ along with Clementine. If not, see . */ -#include "config.h" #include "projectmpresetmodel.h" + +#include "config.h" #include "projectmvisualisation.h" #ifdef USE_SYSTEM_PROJECTM @@ -25,8 +26,8 @@ #include "projectM.hpp" #endif -#include #include +#include ProjectMPresetModel::ProjectMPresetModel(ProjectMVisualisation* vis, QObject* parent) diff --git a/src/visualisations/projectmpresetmodel.h b/src/visualisations/projectmpresetmodel.h index efa42f334..edad106ba 100644 --- a/src/visualisations/projectmpresetmodel.h +++ b/src/visualisations/projectmpresetmodel.h @@ -30,7 +30,9 @@ class ProjectMPresetModel : public QAbstractItemModel { public: ProjectMPresetModel(ProjectMVisualisation* vis, QObject* parent = nullptr); - enum { Role_Url = Qt::UserRole, }; + enum { + Role_Url = Qt::UserRole, + }; void MarkSelected(const QString& path, bool selected); diff --git a/src/visualisations/projectmvisualisation.cpp b/src/visualisations/projectmvisualisation.cpp index 70d58f216..48d44de53 100644 --- a/src/visualisations/projectmvisualisation.cpp +++ b/src/visualisations/projectmvisualisation.cpp @@ -15,10 +15,7 @@ along with Clementine. If not, see . */ -#include "config.h" -#include "projectmpresetmodel.h" #include "projectmvisualisation.h" -#include "visualisationcontainer.h" #include #include @@ -30,8 +27,12 @@ #include #include #include -#include #include +#include + +#include "config.h" +#include "projectmpresetmodel.h" +#include "visualisationcontainer.h" #ifdef USE_SYSTEM_PROJECTM #include @@ -40,8 +41,9 @@ #endif #ifdef Q_OS_MAC -#include "core/mac_startup.h" #include + +#include "core/mac_startup.h" #else #include #endif diff --git a/src/visualisations/projectmvisualisation.h b/src/visualisations/projectmvisualisation.h index 918f0c77f..a0dd279d0 100644 --- a/src/visualisations/projectmvisualisation.h +++ b/src/visualisations/projectmvisualisation.h @@ -18,11 +18,10 @@ #ifndef PROJECTMVISUALISATION_H #define PROJECTMVISUALISATION_H -#include - -#include #include +#include #include +#include #include "engines/bufferconsumer.h" @@ -38,7 +37,10 @@ class ProjectMVisualisation : public QGraphicsScene, public BufferConsumer { ProjectMVisualisation(QObject* parent = nullptr); ~ProjectMVisualisation(); - enum Mode { Random = 0, FromList = 1, }; + enum Mode { + Random = 0, + FromList = 1, + }; QString preset_url() const; ProjectMPresetModel* preset_model() const { return preset_model_; } diff --git a/src/visualisations/visualisationcontainer.cpp b/src/visualisations/visualisationcontainer.cpp index f04edb16c..4dfd8a1cc 100644 --- a/src/visualisations/visualisationcontainer.cpp +++ b/src/visualisations/visualisationcontainer.cpp @@ -15,15 +15,7 @@ along with Clementine. If not, see . */ -#include "config.h" -#include "projectmvisualisation.h" #include "visualisationcontainer.h" -#include "visualisationoverlay.h" -#include "visualisationselector.h" -#include "engines/gstengine.h" -#include "core/logging.h" -#include "ui/iconloader.h" -#include "ui/screensaver.h" #include #include @@ -35,6 +27,15 @@ #include #include +#include "config.h" +#include "core/logging.h" +#include "engines/gstengine.h" +#include "projectmvisualisation.h" +#include "ui/iconloader.h" +#include "ui/screensaver.h" +#include "visualisationoverlay.h" +#include "visualisationselector.h" + // Framerates const int VisualisationContainer::kLowFramerate = 15; const int VisualisationContainer::kMediumFramerate = 25; @@ -98,7 +99,7 @@ void VisualisationContainer::Init() { selector_->SetVisualisation(vis_); // Settings menu - menu_->addAction(IconLoader::Load("view-fullscreen", IconLoader::Base), + menu_->addAction(IconLoader::Load("view-fullscreen", IconLoader::Base), tr("Toggle fullscreen"), this, SLOT(ToggleFullscreen())); QMenu* fps_menu = menu_->addMenu(tr("Framerate")); diff --git a/src/visualisations/visualisationcontainer.h b/src/visualisations/visualisationcontainer.h index 9aafa2e63..8acf6c31f 100644 --- a/src/visualisations/visualisationcontainer.h +++ b/src/visualisations/visualisationcontainer.h @@ -18,8 +18,8 @@ #ifndef VISUALISATIONCONTAINER_H #define VISUALISATIONCONTAINER_H -#include #include +#include #include "core/song.h" diff --git a/src/visualisations/visualisationoverlay.cpp b/src/visualisations/visualisationoverlay.cpp index a04106601..7446c5e4e 100644 --- a/src/visualisations/visualisationoverlay.cpp +++ b/src/visualisations/visualisationoverlay.cpp @@ -16,14 +16,15 @@ */ #include "visualisationoverlay.h" -#include "ui_visualisationoverlay.h" -#include "ui/iconloader.h" -#include -#include -#include -#include #include +#include +#include +#include +#include + +#include "ui/iconloader.h" +#include "ui_visualisationoverlay.h" const int VisualisationOverlay::kFadeDuration = 500; const int VisualisationOverlay::kFadeTimeout = 5000; @@ -47,8 +48,8 @@ VisualisationOverlay::VisualisationOverlay(QWidget* parent) VisualisationOverlay::~VisualisationOverlay() { delete ui_; } -QGraphicsProxyWidget* VisualisationOverlay::title(QGraphicsProxyWidget* proxy) - const { +QGraphicsProxyWidget* VisualisationOverlay::title( + QGraphicsProxyWidget* proxy) const { return proxy->createProxyForChildWidget(ui_->song_title); } diff --git a/src/visualisations/visualisationoverlay.h b/src/visualisations/visualisationoverlay.h index c6d05af9d..c74090bc0 100644 --- a/src/visualisations/visualisationoverlay.h +++ b/src/visualisations/visualisationoverlay.h @@ -18,8 +18,8 @@ #ifndef VISUALISATIONOVERLAY_H #define VISUALISATIONOVERLAY_H -#include #include +#include class Ui_VisualisationOverlay; @@ -44,7 +44,7 @@ class VisualisationOverlay : public QWidget { public slots: void SetVisible(bool visible); -signals: + signals: void OpacityChanged(qreal value); void ShowPopupMenu(const QPoint& pos); diff --git a/src/visualisations/visualisationselector.cpp b/src/visualisations/visualisationselector.cpp index beaeb9323..90fafad29 100644 --- a/src/visualisations/visualisationselector.cpp +++ b/src/visualisations/visualisationselector.cpp @@ -15,14 +15,15 @@ along with Clementine. If not, see . */ +#include "visualisationselector.h" + +#include + #include "config.h" #include "projectmpresetmodel.h" #include "projectmvisualisation.h" -#include "visualisationselector.h" #include "ui_visualisationselector.h" -#include - #ifdef USE_SYSTEM_PROJECTM #include #else diff --git a/src/widgets/autoexpandingtreeview.cpp b/src/widgets/autoexpandingtreeview.cpp index a784724b5..c1325a93f 100644 --- a/src/widgets/autoexpandingtreeview.cpp +++ b/src/widgets/autoexpandingtreeview.cpp @@ -16,11 +16,12 @@ */ #include "autoexpandingtreeview.h" -#include "core/mimedata.h" #include #include +#include "core/mimedata.h" + const int AutoExpandingTreeView::kRowsToShow = 50; AutoExpandingTreeView::AutoExpandingTreeView(QWidget* parent) diff --git a/src/widgets/autoexpandingtreeview.h b/src/widgets/autoexpandingtreeview.h index c38e9df03..35eb7799a 100644 --- a/src/widgets/autoexpandingtreeview.h +++ b/src/widgets/autoexpandingtreeview.h @@ -37,7 +37,7 @@ class AutoExpandingTreeView : public QTreeView { void UpAndFocus(); void DownAndFocus(); -signals: + signals: void AddToPlaylistSignal(QMimeData* data); void FocusOnFilterSignal(QKeyEvent* event); diff --git a/src/widgets/clickablelabel.h b/src/widgets/clickablelabel.h index 230225d61..97583f1ae 100644 --- a/src/widgets/clickablelabel.h +++ b/src/widgets/clickablelabel.h @@ -26,7 +26,7 @@ class ClickableLabel : public QLabel { public: ClickableLabel(QWidget* parent = nullptr); -signals: + signals: void Clicked(); protected: diff --git a/src/widgets/didyoumean.cpp b/src/widgets/didyoumean.cpp index f54738db9..de9aa6102 100644 --- a/src/widgets/didyoumean.cpp +++ b/src/widgets/didyoumean.cpp @@ -17,13 +17,13 @@ #include "didyoumean.h" -#include "core/logging.h" - #include #include #include #include +#include "core/logging.h" + const int DidYouMean::kPadding = 3; DidYouMean::DidYouMean(QWidget* buddy, QWidget* parent) diff --git a/src/widgets/didyoumean.h b/src/widgets/didyoumean.h index b73ec420c..40dc27b5c 100644 --- a/src/widgets/didyoumean.h +++ b/src/widgets/didyoumean.h @@ -34,7 +34,7 @@ class DidYouMean : public QWidget { void SetCorrection(const QString& correction); void Show(const QString& correction); -signals: + signals: void Accepted(const QString& correction); protected: diff --git a/src/widgets/equalizerslider.cpp b/src/widgets/equalizerslider.cpp index f21f36b6b..3043dce3a 100644 --- a/src/widgets/equalizerslider.cpp +++ b/src/widgets/equalizerslider.cpp @@ -16,10 +16,11 @@ */ #include "equalizerslider.h" -#include "ui_equalizerslider.h" #include +#include "ui_equalizerslider.h" + EqualizerSlider::EqualizerSlider(const QString& label, QWidget* parent) : QWidget(parent), ui_(new Ui_EqualizerSlider) { ui_->setupUi(this); diff --git a/src/widgets/equalizerslider.h b/src/widgets/equalizerslider.h index e9c6b80fd..11e6273bd 100644 --- a/src/widgets/equalizerslider.h +++ b/src/widgets/equalizerslider.h @@ -36,7 +36,7 @@ class EqualizerSlider : public QWidget { public slots: void onValueChanged(int value); -signals: + signals: void ValueChanged(int value); private: diff --git a/src/widgets/errordialog.cpp b/src/widgets/errordialog.cpp index ebebfb8a8..2a99fabd3 100644 --- a/src/widgets/errordialog.cpp +++ b/src/widgets/errordialog.cpp @@ -16,10 +16,11 @@ */ #include "errordialog.h" -#include "ui_errordialog.h" #include +#include "ui_errordialog.h" + ErrorDialog::ErrorDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_ErrorDialog) { ui_->setupUi(this); diff --git a/src/widgets/fancytabwidget.cpp b/src/widgets/fancytabwidget.cpp index e6024aecc..2278c60e0 100644 --- a/src/widgets/fancytabwidget.cpp +++ b/src/widgets/fancytabwidget.cpp @@ -15,278 +15,280 @@ along with Clementine. If not, see . */ - #include "fancytabwidget.h" -#include "stylehelper.h" -#include "core/logging.h" #include - #include #include #include -#include +#include #include +#include #include #include -#include -const QSize FancyTabWidget::IconSize_LargeSidebar = QSize(24,24); -const QSize FancyTabWidget::IconSize_SmallSidebar = QSize(22,22); +#include "core/logging.h" +#include "stylehelper.h" -const QSize FancyTabWidget::TabSize_LargeSidebar = QSize(70,47); +const QSize FancyTabWidget::IconSize_LargeSidebar = QSize(24, 24); +const QSize FancyTabWidget::IconSize_SmallSidebar = QSize(22, 22); -class FancyTabBar: public QTabBar { +const QSize FancyTabWidget::TabSize_LargeSidebar = QSize(70, 47); -private: - int mouseHoverTabIndex = -1; - QMap labelCache; +class FancyTabBar : public QTabBar { + private: + int mouseHoverTabIndex = -1; + QMap labelCache; -public: - explicit FancyTabBar(QWidget* parent=0) : QTabBar(parent) { - setMouseTracking(true); + public: + explicit FancyTabBar(QWidget* parent = 0) : QTabBar(parent) { + setMouseTracking(true); + } + + QSize sizeHint() const { + QSize size(QTabBar::sizeHint()); + + FancyTabWidget* tabWidget = (FancyTabWidget*)parentWidget(); + if (tabWidget->mode() == FancyTabWidget::Mode_Tabs || + tabWidget->mode() == FancyTabWidget::Mode_IconOnlyTabs) + return size; + + QSize tabSize(tabSizeHint(0)); + size.setWidth(tabSize.width()); + int guessHeight = tabSize.height() * count(); + if (guessHeight > size.height()) size.setHeight(guessHeight); + return size; + } + + int width() { return tabSizeHint(0).width(); } + + protected: + QSize tabSizeHint(int index) const { + FancyTabWidget* tabWidget = (FancyTabWidget*)parentWidget(); + QSize size = FancyTabWidget::TabSize_LargeSidebar; + + if (tabWidget->mode() != FancyTabWidget::Mode_LargeSidebar) { + size = QTabBar::tabSizeHint(index); } - QSize sizeHint() const { - QSize size(QTabBar::sizeHint()); + return size; + } - FancyTabWidget *tabWidget = (FancyTabWidget*) parentWidget(); - if(tabWidget->mode() == FancyTabWidget::Mode_Tabs || - tabWidget->mode() == FancyTabWidget::Mode_IconOnlyTabs) - return size; + void leaveEvent(QEvent* event) { + mouseHoverTabIndex = -1; + update(); + } - QSize tabSize(tabSizeHint(0)); - size.setWidth(tabSize.width()); - int guessHeight = tabSize.height()*count(); - if(guessHeight > size.height()) - size.setHeight(guessHeight); - return size; + void mouseMoveEvent(QMouseEvent* event) { + QPoint pos = event->pos(); + + mouseHoverTabIndex = tabAt(pos); + if (mouseHoverTabIndex > -1) update(); + QTabBar::mouseMoveEvent(event); + } + + void paintEvent(QPaintEvent* pe) { + FancyTabWidget* tabWidget = (FancyTabWidget*)parentWidget(); + + bool verticalTextTabs = false; + + if (tabWidget->mode() == FancyTabWidget::Mode_SmallSidebar) + verticalTextTabs = true; + + // Restore any label text that was hidden/cached for the IconOnlyTabs mode + if (labelCache.count() > 0 && + tabWidget->mode() != FancyTabWidget::Mode_IconOnlyTabs) { + for (int i = 0; i < count(); i++) { + setTabText(i, labelCache[tabWidget->widget(i)]); + } + labelCache.clear(); + } + if (tabWidget->mode() != FancyTabWidget::Mode_LargeSidebar && + tabWidget->mode() != FancyTabWidget::Mode_SmallSidebar) { + // Cache and hide label text for IconOnlyTabs mode + if (tabWidget->mode() == FancyTabWidget::Mode_IconOnlyTabs && + labelCache.count() == 0) { + for (int i = 0; i < count(); i++) { + labelCache[tabWidget->widget(i)] = tabText(i); + setTabText(i, ""); + } + } + QTabBar::paintEvent(pe); + return; } - int width() { - return tabSizeHint(0).width(); - } + QStylePainter p(this); -protected: - QSize tabSizeHint(int index) const { - FancyTabWidget *tabWidget = (FancyTabWidget*) parentWidget(); - QSize size = FancyTabWidget::TabSize_LargeSidebar; + for (int index = 0; index < count(); index++) { + const bool selected = tabWidget->currentIndex() == index; + ; - if(tabWidget->mode() != FancyTabWidget::Mode_LargeSidebar) { - size = QTabBar::tabSizeHint(index); + QRect tabrect = tabRect(index); + + QRect selectionRect = tabrect; + + if (selected) { + // Selection highlight + p.save(); + QLinearGradient grad(selectionRect.topLeft(), selectionRect.topRight()); + grad.setColorAt(0, QColor(255, 255, 255, 140)); + grad.setColorAt(1, QColor(255, 255, 255, 210)); + p.fillRect(selectionRect.adjusted(0, 0, 0, -1), grad); + p.restore(); + + // shadow lines + p.setPen(QColor(0, 0, 0, 110)); + p.drawLine(selectionRect.topLeft() + QPoint(1, -1), + selectionRect.topRight() - QPoint(0, 1)); + p.drawLine(selectionRect.bottomLeft(), selectionRect.bottomRight()); + p.setPen(QColor(0, 0, 0, 40)); + p.drawLine(selectionRect.topLeft(), selectionRect.bottomLeft()); + + // highlights + p.setPen(QColor(255, 255, 255, 50)); + p.drawLine(selectionRect.topLeft() + QPoint(0, -2), + selectionRect.topRight() - QPoint(0, 2)); + p.drawLine(selectionRect.bottomLeft() + QPoint(0, 1), + selectionRect.bottomRight() + QPoint(0, 1)); + p.setPen(QColor(255, 255, 255, 40)); + p.drawLine(selectionRect.topLeft() + QPoint(0, 0), + selectionRect.topRight()); + p.drawLine(selectionRect.topRight() + QPoint(0, 1), + selectionRect.bottomRight() - QPoint(0, 1)); + p.drawLine(selectionRect.bottomLeft() + QPoint(0, -1), + selectionRect.bottomRight() - QPoint(0, 1)); + } + + // Mouse hover effect + if (!selected && index == mouseHoverTabIndex && isTabEnabled(index)) { + p.save(); + QLinearGradient grad(selectionRect.topLeft(), selectionRect.topRight()); + grad.setColorAt(0, Qt::transparent); + grad.setColorAt(0.5, QColor(255, 255, 255, 40)); + grad.setColorAt(1, Qt::transparent); + p.fillRect(selectionRect, grad); + p.setPen(QPen(grad, 1.0)); + p.drawLine(selectionRect.topLeft(), selectionRect.topRight()); + p.drawLine(selectionRect.bottomRight(), selectionRect.bottomLeft()); + p.restore(); + } + + // Label (Icon and Text) + { + p.save(); + QTransform m; + int textFlags; + Qt::Alignment iconFlags; + + QRect tabrectText; + QRect tabrectLabel; + + if (verticalTextTabs) { + m = QTransform::fromTranslate(tabrect.left(), tabrect.bottom()); + m.rotate(-90); + textFlags = Qt::AlignLeft | Qt::AlignVCenter; + iconFlags = Qt::AlignLeft | Qt::AlignVCenter; + + tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size()); + + tabrectText = tabrectLabel; + tabrectText.translate(30, 0); + } else { + m = QTransform::fromTranslate(tabrect.left(), tabrect.top()); + textFlags = Qt::AlignHCenter | Qt::AlignBottom; + iconFlags = Qt::AlignHCenter | Qt::AlignTop; + + tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size()); + + tabrectText = tabrectLabel; + tabrectText.translate(0, -5); } - return size; - } + p.setTransform(m); - void leaveEvent(QEvent * event) { - mouseHoverTabIndex = -1; - update(); - } + QFont boldFont(p.font()); + boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + p.setFont(boldFont); - void mouseMoveEvent(QMouseEvent * event) { - QPoint pos = event->pos(); + // Text drop shadow color + p.setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110)); + p.translate(0, 3); + p.drawText(tabrectText, textFlags, tabText(index)); - mouseHoverTabIndex = tabAt(pos); - if(mouseHoverTabIndex > -1) - update(); - QTabBar::mouseMoveEvent(event); - } + // Text foreground color + p.translate(0, -1); + p.setPen(selected ? QColor(60, 60, 60) + : Utils::StyleHelper::panelTextColor()); + p.drawText(tabrectText, textFlags, tabText(index)); - void paintEvent(QPaintEvent *pe) { - FancyTabWidget *tabWidget = (FancyTabWidget*) parentWidget(); - - bool verticalTextTabs = false; - - if(tabWidget->mode() == FancyTabWidget::Mode_SmallSidebar) - verticalTextTabs = true; - - // Restore any label text that was hidden/cached for the IconOnlyTabs mode - if(labelCache.count() > 0 && tabWidget->mode() != FancyTabWidget::Mode_IconOnlyTabs) { - for(int i =0; i < count(); i++) { - setTabText(i,labelCache[tabWidget->widget(i)]); - } - labelCache.clear(); - } - if(tabWidget->mode() != FancyTabWidget::Mode_LargeSidebar && - tabWidget->mode() != FancyTabWidget::Mode_SmallSidebar) { - // Cache and hide label text for IconOnlyTabs mode - if(tabWidget->mode() == FancyTabWidget::Mode_IconOnlyTabs && labelCache.count() == 0) { - for(int i =0; i < count(); i++) { - labelCache[tabWidget->widget(i)] = tabText(i); - setTabText(i,""); - } - } - QTabBar::paintEvent(pe); - return; - } - - QStylePainter p(this); - - - for (int index = 0; index < count(); index++) { - const bool selected = tabWidget->currentIndex() == index;; - - QRect tabrect = tabRect(index); - - QRect selectionRect = tabrect; - - if(selected) { - // Selection highlight - p.save(); - QLinearGradient grad(selectionRect.topLeft(), selectionRect.topRight()); - grad.setColorAt(0, QColor(255, 255, 255, 140)); - grad.setColorAt(1, QColor(255, 255, 255, 210)); - p.fillRect(selectionRect.adjusted(0,0,0,-1), grad); - p.restore(); - - // shadow lines - p.setPen(QColor(0, 0, 0, 110)); - p.drawLine(selectionRect.topLeft() + QPoint(1, -1), selectionRect.topRight() - QPoint(0, 1)); - p.drawLine(selectionRect.bottomLeft(), selectionRect.bottomRight()); - p.setPen(QColor(0, 0, 0, 40)); - p.drawLine(selectionRect.topLeft(), selectionRect.bottomLeft()); - - // highlights - p.setPen(QColor(255, 255, 255, 50)); - p.drawLine(selectionRect.topLeft() + QPoint(0, -2), selectionRect.topRight() - QPoint(0, 2)); - p.drawLine(selectionRect.bottomLeft() + QPoint(0, 1), selectionRect.bottomRight() + QPoint(0, 1)); - p.setPen(QColor(255, 255, 255, 40)); - p.drawLine(selectionRect.topLeft() + QPoint(0, 0), selectionRect.topRight()); - p.drawLine(selectionRect.topRight() + QPoint(0, 1), selectionRect.bottomRight() - QPoint(0, 1)); - p.drawLine(selectionRect.bottomLeft() + QPoint(0, -1), selectionRect.bottomRight() - QPoint(0, 1)); - - } - - // Mouse hover effect - if(!selected && index == mouseHoverTabIndex && isTabEnabled(index)) - { - p.save(); - QLinearGradient grad(selectionRect.topLeft(), selectionRect.topRight()); - grad.setColorAt(0, Qt::transparent); - grad.setColorAt(0.5, QColor(255, 255, 255, 40)); - grad.setColorAt(1, Qt::transparent); - p.fillRect(selectionRect, grad); - p.setPen(QPen(grad, 1.0)); - p.drawLine(selectionRect.topLeft(), selectionRect.topRight()); - p.drawLine(selectionRect.bottomRight(), selectionRect.bottomLeft()); - p.restore(); - } - - // Label (Icon and Text) - { - p.save(); - QTransform m; - int textFlags; - Qt::Alignment iconFlags; - - QRect tabrectText; - QRect tabrectLabel; - - if (verticalTextTabs) { - m = QTransform::fromTranslate(tabrect.left(), tabrect.bottom()); - m.rotate(-90); - textFlags = Qt::AlignLeft | Qt::AlignVCenter ; - iconFlags = Qt::AlignLeft | Qt::AlignVCenter; - - tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size()); - - tabrectText = tabrectLabel; - tabrectText.translate(30,0); - } else { - m = QTransform::fromTranslate(tabrect.left(), tabrect.top()); - textFlags = Qt::AlignHCenter | Qt::AlignBottom ; - iconFlags = Qt::AlignHCenter | Qt::AlignTop; - - tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size()); - - tabrectText = tabrectLabel; - tabrectText.translate(0,-5); - } - - p.setTransform(m); - - QFont boldFont(p.font()); - boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); - boldFont.setBold(true); - p.setFont(boldFont); - - // Text drop shadow color - p.setPen(selected ? QColor(255,255,255,160) : QColor(0,0,0,110) ); - p.translate(0, 3); - p.drawText(tabrectText, textFlags, tabText(index)); - - // Text foreground color - p.translate(0, -1); - p.setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor()); - p.drawText(tabrectText, textFlags, tabText(index)); - - - // Draw the icon - QRect tabrectIcon; - const int PADDING = 5; - if(verticalTextTabs) { - tabrectIcon = tabrectLabel; - tabrectIcon.setSize(FancyTabWidget::IconSize_SmallSidebar); - tabrectIcon.translate(PADDING,PADDING); - } else { - tabrectIcon = tabrectLabel; - tabrectIcon.setSize(FancyTabWidget::IconSize_LargeSidebar); - // Center the icon - const int moveRight = (FancyTabWidget::TabSize_LargeSidebar.width() - - FancyTabWidget::IconSize_LargeSidebar.width() -1)/2; - tabrectIcon.translate(moveRight,PADDING); - } - tabIcon(index).paint(&p, tabrectIcon, iconFlags); - p.restore(); - } + // Draw the icon + QRect tabrectIcon; + const int PADDING = 5; + if (verticalTextTabs) { + tabrectIcon = tabrectLabel; + tabrectIcon.setSize(FancyTabWidget::IconSize_SmallSidebar); + tabrectIcon.translate(PADDING, PADDING); + } else { + tabrectIcon = tabrectLabel; + tabrectIcon.setSize(FancyTabWidget::IconSize_LargeSidebar); + // Center the icon + const int moveRight = + (FancyTabWidget::TabSize_LargeSidebar.width() - + FancyTabWidget::IconSize_LargeSidebar.width() - 1) / + 2; + tabrectIcon.translate(moveRight, PADDING); } + tabIcon(index).paint(&p, tabrectIcon, iconFlags); + p.restore(); + } } + } }; // Spacers are just disabled pages void FancyTabWidget::addSpacer() { - QWidget *spacer = new QWidget(); - const int index = addTab(spacer,QIcon(),QString()); - setTabEnabled(index,false); + QWidget* spacer = new QWidget(); + const int index = addTab(spacer, QIcon(), QString()); + setTabEnabled(index, false); } void FancyTabWidget::setBackgroundPixmap(const QPixmap& pixmap) { - background_pixmap_ = pixmap; - update(); + background_pixmap_ = pixmap; + update(); } void FancyTabWidget::setCurrentIndex(int index) { - QWidget* currentPage = widget(index); + QWidget* currentPage = widget(index); - QLayout *layout = currentPage->layout(); - if(bottom_widget_ != nullptr) - layout->addWidget(bottom_widget_); + QLayout* layout = currentPage->layout(); + if (bottom_widget_ != nullptr) layout->addWidget(bottom_widget_); - QTabWidget::setCurrentIndex(index); + QTabWidget::setCurrentIndex(index); } // Slot void FancyTabWidget::currentTabChanged(int index) { - QWidget* currentPage = currentWidget(); + QWidget* currentPage = currentWidget(); - QLayout *layout = currentPage->layout(); - if(bottom_widget_ != nullptr) - layout->addWidget(bottom_widget_); - emit CurrentChanged(index); + QLayout* layout = currentPage->layout(); + if (bottom_widget_ != nullptr) layout->addWidget(bottom_widget_); + emit CurrentChanged(index); } -FancyTabWidget::FancyTabWidget(QWidget* parent) : QTabWidget(parent), +FancyTabWidget::FancyTabWidget(QWidget* parent) + : QTabWidget(parent), menu_(nullptr), mode_(Mode_None), bottom_widget_(nullptr) { - FancyTabBar *tabBar = new FancyTabBar(this); + FancyTabBar* tabBar = new FancyTabBar(this); - setTabBar(tabBar); - setTabPosition(QTabWidget::West); - setMovable(true); + setTabBar(tabBar); + setTabPosition(QTabWidget::West); + setMovable(true); - connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); + connect(tabBar, SIGNAL(currentChanged(int)), this, + SLOT(currentTabChanged(int))); } void FancyTabWidget::loadSettings(const QSettings& settings) { @@ -312,103 +314,103 @@ void FancyTabWidget::saveSettings(QSettings* settings) { } } - void FancyTabWidget::addBottomWidget(QWidget* widget) { - bottom_widget_ = widget; + bottom_widget_ = widget; } -int FancyTabWidget::addTab(QWidget * page, const QIcon & icon, const QString & label) { - return insertTab(count(),page,icon,label); +int FancyTabWidget::addTab(QWidget* page, const QIcon& icon, + const QString& label) { + return insertTab(count(), page, icon, label); } -int FancyTabWidget::insertTab(int index, QWidget * page, const QIcon & icon, const QString & label) { - // In order to achieve the same effect as the "Bottom Widget" of the - // old Nokia based FancyTabWidget a VBoxLayout is used on each page - QVBoxLayout *layout = new QVBoxLayout(); - layout->setSpacing(0); - layout->setContentsMargins(0,0,0,0); - layout->addWidget(page); +int FancyTabWidget::insertTab(int index, QWidget* page, const QIcon& icon, + const QString& label) { + // In order to achieve the same effect as the "Bottom Widget" of the + // old Nokia based FancyTabWidget a VBoxLayout is used on each page + QVBoxLayout* layout = new QVBoxLayout(); + layout->setSpacing(0); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(page); - QWidget *newPage = new QWidget(); - newPage->setLayout(layout); + QWidget* newPage = new QWidget(); + newPage->setLayout(layout); - const int actualIndex = QTabWidget::insertTab(index,newPage,icon,label); + const int actualIndex = QTabWidget::insertTab(index, newPage, icon, label); - // Remember the original index. Needed to save order of tabs - tabBar()->setTabData(actualIndex,QVariant(actualIndex)); - return actualIndex; + // Remember the original index. Needed to save order of tabs + tabBar()->setTabData(actualIndex, QVariant(actualIndex)); + return actualIndex; } -void FancyTabWidget::paintEvent(QPaintEvent *pe) { - if(mode() != FancyTabWidget::Mode_LargeSidebar && - mode() != FancyTabWidget::Mode_SmallSidebar) { - QTabWidget::paintEvent(pe); - return; +void FancyTabWidget::paintEvent(QPaintEvent* pe) { + if (mode() != FancyTabWidget::Mode_LargeSidebar && + mode() != FancyTabWidget::Mode_SmallSidebar) { + QTabWidget::paintEvent(pe); + return; + } + QStylePainter p(this); + + // The brown color (Ubuntu) you see on the background gradient + QColor baseColor = StyleHelper::baseColor(); + + QRect backgroundRect = rect(); + backgroundRect.setWidth(((FancyTabBar*)tabBar())->width()); + p.fillRect(backgroundRect, baseColor); + + // Horizontal gradient over the sidebar from transparent to dark + Utils::StyleHelper::verticalGradient(&p, backgroundRect, backgroundRect, + false); + + // Draw the translucent png graphics over the gradient fill + { + if (!background_pixmap_.isNull()) { + QRect pixmap_rect(background_pixmap_.rect()); + pixmap_rect.moveTo(backgroundRect.topLeft()); + + while (pixmap_rect.top() < backgroundRect.bottom()) { + QRect source_rect(pixmap_rect.intersected(backgroundRect)); + source_rect.moveTo(0, 0); + p.drawPixmap(pixmap_rect.topLeft(), background_pixmap_, source_rect); + pixmap_rect.moveTop(pixmap_rect.bottom() - 10); + } } - QStylePainter p(this); + } - // The brown color (Ubuntu) you see on the background gradient - QColor baseColor = StyleHelper::baseColor(); - - QRect backgroundRect = rect(); - backgroundRect.setWidth(((FancyTabBar*)tabBar())->width()); - p.fillRect(backgroundRect,baseColor); - - // Horizontal gradient over the sidebar from transparent to dark - Utils::StyleHelper::verticalGradient(&p,backgroundRect,backgroundRect,false); - - // Draw the translucent png graphics over the gradient fill - { - if (!background_pixmap_.isNull()) { - QRect pixmap_rect(background_pixmap_.rect()); - pixmap_rect.moveTo(backgroundRect.topLeft()); - - while (pixmap_rect.top() < backgroundRect.bottom()) { - QRect source_rect(pixmap_rect.intersected(backgroundRect)); - source_rect.moveTo(0, 0); - p.drawPixmap(pixmap_rect.topLeft(), background_pixmap_,source_rect); - pixmap_rect.moveTop(pixmap_rect.bottom() - 10); - } - } - } - - // Shadow effect of the background - { - QColor light(255, 255, 255, 80); - p.setPen(light); - p.drawLine(backgroundRect.topRight() - QPoint(1, 0), backgroundRect.bottomRight() - QPoint(1, 0)); - QColor dark(0, 0, 0, 90); - p.setPen(dark); - p.drawLine(backgroundRect.topLeft(), backgroundRect.bottomLeft()); - - p.setPen(Utils::StyleHelper::borderColor()); - p.drawLine(backgroundRect.topRight(), backgroundRect.bottomRight()); - } + // Shadow effect of the background + { + QColor light(255, 255, 255, 80); + p.setPen(light); + p.drawLine(backgroundRect.topRight() - QPoint(1, 0), + backgroundRect.bottomRight() - QPoint(1, 0)); + QColor dark(0, 0, 0, 90); + p.setPen(dark); + p.drawLine(backgroundRect.topLeft(), backgroundRect.bottomLeft()); + p.setPen(Utils::StyleHelper::borderColor()); + p.drawLine(backgroundRect.topRight(), backgroundRect.bottomRight()); + } } -void FancyTabWidget::tabBarUpdateGeometry() { - tabBar()->updateGeometry(); -} +void FancyTabWidget::tabBarUpdateGeometry() { tabBar()->updateGeometry(); } void FancyTabWidget::SetMode(FancyTabWidget::Mode mode) { - mode_ = mode; + mode_ = mode; - if(mode == FancyTabWidget::Mode_Tabs || - mode == FancyTabWidget::Mode_IconOnlyTabs) { - setTabPosition(QTabWidget::North); - } else { - setTabPosition(QTabWidget::West); - } + if (mode == FancyTabWidget::Mode_Tabs || + mode == FancyTabWidget::Mode_IconOnlyTabs) { + setTabPosition(QTabWidget::North); + } else { + setTabPosition(QTabWidget::West); + } - tabBar()->updateGeometry(); - updateGeometry(); + tabBar()->updateGeometry(); + updateGeometry(); - // There appears to be a bug in QTabBar which causes tabSizeHint - // to be ignored thus the need for this second shot repaint - QTimer::singleShot(1,this,SLOT(tabBarUpdateGeometry())); + // There appears to be a bug in QTabBar which causes tabSizeHint + // to be ignored thus the need for this second shot repaint + QTimer::singleShot(1, this, SLOT(tabBarUpdateGeometry())); - emit ModeChanged(mode); + emit ModeChanged(mode); } void FancyTabWidget::addMenuItem(QActionGroup* group, const QString& text, @@ -420,7 +422,6 @@ void FancyTabWidget::addMenuItem(QActionGroup* group, const QString& text, if (mode == mode_) action->setChecked(true); } - void FancyTabWidget::contextMenuEvent(QContextMenuEvent* e) { if (!menu_) { menu_ = new QMenu(this); diff --git a/src/widgets/fancytabwidget.h b/src/widgets/fancytabwidget.h index d487e887f..e5d23efea 100644 --- a/src/widgets/fancytabwidget.h +++ b/src/widgets/fancytabwidget.h @@ -18,10 +18,9 @@ #ifndef FANCYTABWIDGET_H #define FANCYTABWIDGET_H -#include - #include #include +#include class QActionGroup; class QMenu; @@ -30,62 +29,63 @@ class QSettings; namespace Core { namespace Internal { - class FancyTabWidget : public QTabWidget { Q_OBJECT - public: - FancyTabWidget(QWidget* parent = 0); - int addTab(QWidget * page, const QIcon & icon, const QString & label); - int insertTab(int index, QWidget * page, const QIcon & icon, const QString & label); - void addBottomWidget(QWidget* widget); + public: + FancyTabWidget(QWidget* parent = 0); + int addTab(QWidget* page, const QIcon& icon, const QString& label); + int insertTab(int index, QWidget* page, const QIcon& icon, + const QString& label); + void addBottomWidget(QWidget* widget); - void setBackgroundPixmap(const QPixmap& pixmap); - void addSpacer(); + void setBackgroundPixmap(const QPixmap& pixmap); + void addSpacer(); - void loadSettings(const QSettings&); - void saveSettings(QSettings*); - // Values are persisted - only add to the end - enum Mode { - Mode_None = 0, - Mode_LargeSidebar, - Mode_SmallSidebar, - Mode_Tabs, - Mode_IconOnlyTabs, - Mode_PlainSidebar, - }; - - static const QSize TabSize_LargeSidebar; + void loadSettings(const QSettings&); + void saveSettings(QSettings*); + // Values are persisted - only add to the end + enum Mode { + Mode_None = 0, + Mode_LargeSidebar, + Mode_SmallSidebar, + Mode_Tabs, + Mode_IconOnlyTabs, + Mode_PlainSidebar, + }; - static const QSize IconSize_LargeSidebar; - static const QSize IconSize_SmallSidebar; - - Mode mode() { return mode_; } + static const QSize TabSize_LargeSidebar; - signals: - void ModeChanged(FancyTabWidget::Mode mode); - void CurrentChanged(int); + static const QSize IconSize_LargeSidebar; + static const QSize IconSize_SmallSidebar; - public slots: - void setCurrentIndex(int index); - void SetMode(Mode mode); - // Mapper mapped signal needs this convenience function - void SetMode(int mode) { SetMode(Mode(mode)); } + Mode mode() { return mode_; } - private slots: - void tabBarUpdateGeometry(); - void currentTabChanged(int); + signals: + void ModeChanged(FancyTabWidget::Mode mode); + void CurrentChanged(int); - protected: - void paintEvent(QPaintEvent *); - void contextMenuEvent(QContextMenuEvent* e); - private: - void addMenuItem(QActionGroup* group, const QString& text, Mode mode); + public slots: + void setCurrentIndex(int index); + void SetMode(Mode mode); + // Mapper mapped signal needs this convenience function + void SetMode(int mode) { SetMode(Mode(mode)); } - QPixmap background_pixmap_; - QMenu* menu_; - Mode mode_; - QWidget* bottom_widget_; + private slots: + void tabBarUpdateGeometry(); + void currentTabChanged(int); + + protected: + void paintEvent(QPaintEvent*); + void contextMenuEvent(QContextMenuEvent* e); + + private: + void addMenuItem(QActionGroup* group, const QString& text, Mode mode); + + QPixmap background_pixmap_; + QMenu* menu_; + Mode mode_; + QWidget* bottom_widget_; }; } // namespace Internal diff --git a/src/widgets/favoritewidget.cpp b/src/widgets/favoritewidget.cpp index c345dedfd..d6f70ed22 100644 --- a/src/widgets/favoritewidget.cpp +++ b/src/widgets/favoritewidget.cpp @@ -17,12 +17,12 @@ #include "favoritewidget.h" -#include +#include #include +#include #include #include #include -#include #include "core/logging.h" #include "ui/iconloader.h" @@ -30,9 +30,7 @@ const int FavoriteWidget::kStarSize = 16; FavoriteWidget::FavoriteWidget(int tab_index, bool favorite, QWidget* parent) - : QWidget(parent), - tab_index_(tab_index), - favorite_(favorite) { + : QWidget(parent), tab_index_(tab_index), favorite_(favorite) { QIcon star_on = IconLoader::Load("star-on", IconLoader::Other); on_ = star_on.pixmap(star_on.availableSizes().last()); QIcon star_off = IconLoader::Load("star-off", IconLoader::Other); diff --git a/src/widgets/favoritewidget.h b/src/widgets/favoritewidget.h index b98221a9a..034aeabe0 100644 --- a/src/widgets/favoritewidget.h +++ b/src/widgets/favoritewidget.h @@ -32,12 +32,12 @@ class FavoriteWidget : public QWidget { QSize sizeHint() const; -signals: + signals: void FavoriteStateChanged(int, bool); protected: void paintEvent(QPaintEvent* e); - void resizeEvent(QResizeEvent * e); + void resizeEvent(QResizeEvent* e); void mouseReleaseEvent(QMouseEvent* e); private: diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index 31b61a03d..cf1502df2 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -15,20 +15,21 @@ along with Clementine. If not, see . */ -#include "core/deletefiles.h" -#include "core/filesystemmusicstorage.h" -#include "core/mimedata.h" #include "fileview.h" -#include "ui/iconloader.h" -#include "ui/mainwindow.h" // for filter information -#include "ui/organiseerrordialog.h" -#include "ui_fileview.h" #include #include #include #include +#include "core/deletefiles.h" +#include "core/filesystemmusicstorage.h" +#include "core/mimedata.h" +#include "ui/iconloader.h" +#include "ui/mainwindow.h" // for filter information +#include "ui/organiseerrordialog.h" +#include "ui_fileview.h" + const char* FileView::kFileFilter = "*.mp3 *.ogg *.flac *.mpc *.m4a *.m4b *.aac *.wma " "*.mp4 *.spx *.wav *.m3u *.m3u8 *.pls *.xspf " diff --git a/src/widgets/fileview.h b/src/widgets/fileview.h index 608938366..5a9011f1b 100644 --- a/src/widgets/fileview.h +++ b/src/widgets/fileview.h @@ -18,12 +18,11 @@ #ifndef FILEVIEW_H #define FILEVIEW_H -#include - -#include +#include #include #include -#include +#include +#include #include "core/song.h" @@ -50,7 +49,7 @@ class FileView : public QWidget { void showEvent(QShowEvent*); void keyPressEvent(QKeyEvent* e); -signals: + signals: void PathChanged(const QString& path); void AddToPlaylist(QMimeData* data); diff --git a/src/widgets/fileviewlist.cpp b/src/widgets/fileviewlist.cpp index 8f49d0126..27870e4b8 100644 --- a/src/widgets/fileviewlist.cpp +++ b/src/widgets/fileviewlist.cpp @@ -16,15 +16,16 @@ */ #include "fileviewlist.h" -#include "core/mimedata.h" -#include "core/utilities.h" -#include "ui/iconloader.h" #include #include #include #include +#include "core/mimedata.h" +#include "core/utilities.h" +#include "ui/iconloader.h" + FileViewList::FileViewList(QWidget* parent) : QListView(parent), menu_(new QMenu(this)) { menu_->addAction(IconLoader::Load("media-playback-start", IconLoader::Base), @@ -32,18 +33,18 @@ FileViewList::FileViewList(QWidget* parent) SLOT(AddToPlaylistSlot())); menu_->addAction(IconLoader::Load("media-playback-start", IconLoader::Base), tr("Replace current playlist"), this, SLOT(LoadSlot())); - menu_->addAction(IconLoader::Load("document-new", IconLoader::Base), - tr("Open in new playlist"), this, + menu_->addAction(IconLoader::Load("document-new", IconLoader::Base), + tr("Open in new playlist"), this, SLOT(OpenInNewPlaylistSlot())); menu_->addSeparator(); - menu_->addAction(IconLoader::Load("edit-copy", IconLoader::Base), + menu_->addAction(IconLoader::Load("edit-copy", IconLoader::Base), tr("Copy to library..."), this, SLOT(CopyToLibrarySlot())); - menu_->addAction(IconLoader::Load("go-jump", IconLoader::Base), + menu_->addAction(IconLoader::Load("go-jump", IconLoader::Base), tr("Move to library..."), this, SLOT(MoveToLibrarySlot())); - menu_->addAction(IconLoader::Load("multimedia-player-ipod-mini-blue", - IconLoader::Base), tr("Copy to device..."), this, - SLOT(CopyToDeviceSlot())); - menu_->addAction(IconLoader::Load("edit-delete", IconLoader::Base), + menu_->addAction( + IconLoader::Load("multimedia-player-ipod-mini-blue", IconLoader::Base), + tr("Copy to device..."), this, SLOT(CopyToDeviceSlot())); + menu_->addAction(IconLoader::Load("edit-delete", IconLoader::Base), tr("Delete from disk..."), this, SLOT(DeleteSlot())); menu_->addSeparator(); diff --git a/src/widgets/fileviewlist.h b/src/widgets/fileviewlist.h index 58ab4870e..6d3a966b9 100644 --- a/src/widgets/fileviewlist.h +++ b/src/widgets/fileviewlist.h @@ -31,7 +31,7 @@ class FileViewList : public QListView { void mousePressEvent(QMouseEvent* e); -signals: + signals: void AddToPlaylist(QMimeData* data); void CopyToLibrary(const QList& urls); void MoveToLibrary(const QList& urls); diff --git a/src/widgets/freespacebar.cpp b/src/widgets/freespacebar.cpp index c9789d353..5a3a61185 100644 --- a/src/widgets/freespacebar.cpp +++ b/src/widgets/freespacebar.cpp @@ -16,12 +16,13 @@ */ #include "freespacebar.h" -#include "core/utilities.h" #include #include #include +#include "core/utilities.h" + const int FreeSpaceBar::kBarHeight = 20; const int FreeSpaceBar::kBarBorderRadius = 8; const int FreeSpaceBar::kMarkerSpacing = 32; diff --git a/src/widgets/groupediconview.cpp b/src/widgets/groupediconview.cpp index 77801acb1..c0d5fe61b 100644 --- a/src/widgets/groupediconview.cpp +++ b/src/widgets/groupediconview.cpp @@ -16,14 +16,15 @@ */ #include "groupediconview.h" -#include "core/multisortfilterproxy.h" -#include #include +#include #include #include #include +#include "core/multisortfilterproxy.h" + const int GroupedIconView::kBarThickness = 2; const int GroupedIconView::kBarMarginTop = 3; @@ -86,7 +87,7 @@ void GroupedIconView::DrawHeader(QPainter* painter, const QRect& rect, // Draw a line underneath QColor line_color = palette.color(QPalette::Text); QLinearGradient grad_color(text_rect.bottomLeft(), text_rect.bottomRight()); - const double fade_start_end = (text_rect.width()/3.0)/text_rect.width(); + const double fade_start_end = (text_rect.width() / 3.0) / text_rect.width(); line_color.setAlphaF(0.0); grad_color.setColorAt(0, line_color); line_color.setAlphaF(0.5); @@ -113,7 +114,8 @@ void GroupedIconView::rowsInserted(const QModelIndex& parent, int start, } void GroupedIconView::dataChanged(const QModelIndex& topLeft, - const QModelIndex& bottomRight, const QVector &) { + const QModelIndex& bottomRight, + const QVector&) { QListView::dataChanged(topLeft, bottomRight); LayoutItems(); } @@ -306,8 +308,8 @@ void GroupedIconView::setSelection( selectionModel()->select(selection, command); } -QVector GroupedIconView::IntersectingItems(const QRect& rect) - const { +QVector GroupedIconView::IntersectingItems( + const QRect& rect) const { QVector ret; const int count = visual_rects_.count(); diff --git a/src/widgets/groupediconview.h b/src/widgets/groupediconview.h index ad1ae9569..d53f9cffe 100644 --- a/src/widgets/groupediconview.h +++ b/src/widgets/groupediconview.h @@ -42,7 +42,9 @@ class GroupedIconView : public QListView { public: GroupedIconView(QWidget* parent = nullptr); - enum Role { Role_Group = 1158300, }; + enum Role { + Role_Group = 1158300, + }; void AddSortSpec(int role, Qt::SortOrder order = Qt::AscendingOrder); @@ -72,7 +74,8 @@ class GroupedIconView : public QListView { void resizeEvent(QResizeEvent* e); // QAbstractItemView - void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& = QVector()); + void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, + const QVector& = QVector()); QModelIndex indexAt(const QPoint& p) const; void rowsInserted(const QModelIndex& parent, int start, int end); void setSelection(const QRect& rect, diff --git a/src/widgets/lineedit.cpp b/src/widgets/lineedit.cpp index d5f09d344..27f6e2b19 100644 --- a/src/widgets/lineedit.cpp +++ b/src/widgets/lineedit.cpp @@ -17,8 +17,8 @@ #include "lineedit.h" -#include #include +#include #include #include #include @@ -34,7 +34,8 @@ ExtendedEditor::ExtendedEditor(QWidget* widget, int extra_right_padding, draw_hint_(draw_hint), font_point_size_(widget->font().pointSizeF() - 1), is_rtl_(false) { - clear_button_->setIcon(IconLoader::Load("edit-clear-locationbar-ltr", IconLoader::Base)); + clear_button_->setIcon( + IconLoader::Load("edit-clear-locationbar-ltr", IconLoader::Base)); clear_button_->setIconSize(QSize(16, 16)); clear_button_->setCursor(Qt::ArrowCursor); clear_button_->setStyleSheet("QToolButton { border: none; padding: 0px; }"); diff --git a/src/widgets/lineedit.h b/src/widgets/lineedit.h index 5ba922987..697699ca3 100644 --- a/src/widgets/lineedit.h +++ b/src/widgets/lineedit.h @@ -93,12 +93,10 @@ class ExtendedEditor : public LineEditInterface { class LineEdit : public QLineEdit, public ExtendedEditor { Q_OBJECT Q_PROPERTY(QString hint READ hint WRITE set_hint) - Q_PROPERTY(qreal font_point_size READ font_point_size WRITE - set_font_point_size) - Q_PROPERTY(bool has_clear_button READ has_clear_button WRITE - set_clear_button) - Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE - set_reset_button) + Q_PROPERTY( + qreal font_point_size READ font_point_size WRITE set_font_point_size) + Q_PROPERTY(bool has_clear_button READ has_clear_button WRITE set_clear_button) + Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE set_reset_button) public: LineEdit(QWidget* parent = nullptr); @@ -120,17 +118,15 @@ class LineEdit : public QLineEdit, public ExtendedEditor { private slots: void text_changed(const QString& text); -signals: + signals: void Reset(); }; class TextEdit : public QPlainTextEdit, public ExtendedEditor { Q_OBJECT Q_PROPERTY(QString hint READ hint WRITE set_hint) - Q_PROPERTY(bool has_clear_button READ has_clear_button WRITE - set_clear_button) - Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE - set_reset_button) + Q_PROPERTY(bool has_clear_button READ has_clear_button WRITE set_clear_button) + Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE set_reset_button) public: TextEdit(QWidget* parent = nullptr); @@ -145,17 +141,15 @@ class TextEdit : public QPlainTextEdit, public ExtendedEditor { void paintEvent(QPaintEvent*); void resizeEvent(QResizeEvent*); -signals: + signals: void Reset(); }; class SpinBox : public QSpinBox, public ExtendedEditor { Q_OBJECT Q_PROPERTY(QString hint READ hint WRITE set_hint) - Q_PROPERTY(bool has_clear_button READ has_clear_button WRITE - set_clear_button) - Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE - set_reset_button) + Q_PROPERTY(bool has_clear_button READ has_clear_button WRITE set_clear_button) + Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE set_reset_button) public: SpinBox(QWidget* parent = nullptr); @@ -174,7 +168,7 @@ class SpinBox : public QSpinBox, public ExtendedEditor { void paintEvent(QPaintEvent*); void resizeEvent(QResizeEvent*); -signals: + signals: void Reset(); }; diff --git a/src/widgets/loginstatewidget.cpp b/src/widgets/loginstatewidget.cpp index 504673de1..378fa96e8 100644 --- a/src/widgets/loginstatewidget.cpp +++ b/src/widgets/loginstatewidget.cpp @@ -16,14 +16,15 @@ */ #include "loginstatewidget.h" -#include "ui_loginstatewidget.h" -#include "ui/iconloader.h" #include #include #include #include +#include "ui/iconloader.h" +#include "ui_loginstatewidget.h" + LoginStateWidget::LoginStateWidget(QWidget* parent) : QWidget(parent), ui_(new Ui_LoginStateWidget), state_(LoggedOut) { ui_->setupUi(this); @@ -33,12 +34,12 @@ LoginStateWidget::LoginStateWidget(QWidget* parent) ui_->busy->hide(); ui_->sign_out->setIcon(IconLoader::Load("list-remove", IconLoader::Base)); - ui_->signed_in_icon_label->setPixmap(IconLoader::Load("dialog-ok-apply", - IconLoader::Base).pixmap(22)); - ui_->expires_icon_label->setPixmap(IconLoader::Load("user-away", - IconLoader::Base).pixmap(22)); - ui_->account_type_icon_label->setPixmap(IconLoader::Load("dialog-warning", - IconLoader::Base).pixmap(22)); + ui_->signed_in_icon_label->setPixmap( + IconLoader::Load("dialog-ok-apply", IconLoader::Base).pixmap(22)); + ui_->expires_icon_label->setPixmap( + IconLoader::Load("user-away", IconLoader::Base).pixmap(22)); + ui_->account_type_icon_label->setPixmap( + IconLoader::Load("dialog-warning", IconLoader::Base).pixmap(22)); QFont bold_font(font()); bold_font.setBold(true); diff --git a/src/widgets/loginstatewidget.h b/src/widgets/loginstatewidget.h index 0b203f09a..61e6dfb4a 100644 --- a/src/widgets/loginstatewidget.h +++ b/src/widgets/loginstatewidget.h @@ -56,7 +56,7 @@ class LoginStateWidget : public QWidget { void SetExpires(const QDate& expires); -signals: + signals: void LogoutClicked(); void LoginClicked(); diff --git a/src/widgets/multiloadingindicator.cpp b/src/widgets/multiloadingindicator.cpp index 1f40df53e..a293ee503 100644 --- a/src/widgets/multiloadingindicator.cpp +++ b/src/widgets/multiloadingindicator.cpp @@ -16,12 +16,13 @@ */ #include "multiloadingindicator.h" -#include "core/taskmanager.h" -#include "widgets/busyindicator.h" #include #include +#include "core/taskmanager.h" +#include "widgets/busyindicator.h" + const int MultiLoadingIndicator::kVerticalPadding = 4; const int MultiLoadingIndicator::kHorizontalPadding = 6; const int MultiLoadingIndicator::kSpacing = 6; @@ -78,8 +79,9 @@ void MultiLoadingIndicator::paintEvent(QPaintEvent*) { const QRect text_rect( kHorizontalPadding + spinner_->sizeHint().width() + kSpacing, - kVerticalPadding, width() - kHorizontalPadding * 2 - - spinner_->sizeHint().width() - kSpacing, + kVerticalPadding, + width() - kHorizontalPadding * 2 - spinner_->sizeHint().width() - + kSpacing, height() - kVerticalPadding * 2); p.drawText( text_rect, Qt::TextSingleLine | Qt::AlignLeft, diff --git a/src/widgets/multiloadingindicator.h b/src/widgets/multiloadingindicator.h index 0fa29ef56..6cd9567d6 100644 --- a/src/widgets/multiloadingindicator.h +++ b/src/widgets/multiloadingindicator.h @@ -37,7 +37,7 @@ class MultiLoadingIndicator : public QWidget { QSize sizeHint() const; -signals: + signals: void TaskCountChange(int tasks); protected: diff --git a/src/widgets/nowplayingwidget.cpp b/src/widgets/nowplayingwidget.cpp index d665b19ac..5246be2ad 100644 --- a/src/widgets/nowplayingwidget.cpp +++ b/src/widgets/nowplayingwidget.cpp @@ -29,13 +29,13 @@ #include #include -#include "fullscreenhypnotoad.h" #include "core/application.h" #include "core/logging.h" #include "covers/albumcoverloader.h" #include "covers/coverproviders.h" #include "covers/currentartloader.h" #include "covers/kittenloader.h" +#include "fullscreenhypnotoad.h" #include "library/librarybackend.h" #include "networkremote/networkremote.h" #include "ui/albumcoverchoicecontroller.h" @@ -285,9 +285,10 @@ void NowPlayingWidget::UpdateDetailsText() { } // TODO: Make this configurable - html += QString("%1
%2
%3").arg( - metadata_.PrettyTitle().toHtmlEscaped(), metadata_.artist().toHtmlEscaped(), - metadata_.album().toHtmlEscaped()); + html += QString("%1
%2
%3") + .arg(metadata_.PrettyTitle().toHtmlEscaped(), + metadata_.artist().toHtmlEscaped(), + metadata_.album().toHtmlEscaped()); html += "

"; details_->setHtml(html); diff --git a/src/widgets/nowplayingwidget.h b/src/widgets/nowplayingwidget.h index f4bdf1edf..52ebea7bc 100644 --- a/src/widgets/nowplayingwidget.h +++ b/src/widgets/nowplayingwidget.h @@ -18,9 +18,8 @@ #ifndef NOWPLAYINGWIDGET_H #define NOWPLAYINGWIDGET_H -#include - #include +#include #include "core/song.h" #include "covers/albumcoverloaderoptions.h" @@ -67,7 +66,7 @@ class NowPlayingWidget : public QWidget { QSize sizeHint() const; -signals: + signals: void ShowAboveStatusBarChanged(bool above); public slots: diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp index 7cd74dfbf..5cdea6662 100644 --- a/src/widgets/osd.cpp +++ b/src/widgets/osd.cpp @@ -15,11 +15,12 @@ along with Clementine. If not, see . */ +#include "osd.h" + #include "config.h" #include "core/application.h" #include "core/logging.h" #include "covers/currentartloader.h" -#include "osd.h" #include "osdpretty.h" #include "ui/iconloader.h" #include "ui/systemtrayicon.h" @@ -29,8 +30,8 @@ #endif #include -#include #include +#include const char* OSD::kSettingsGroup = "OSD"; @@ -195,8 +196,9 @@ void OSD::MagnatuneDownloadFinished(const QStringList& albums) { message = tr("%1 albums").arg(albums.count()); ShowMessage(tr("Magnatune download finished"), message, QString(), - QImage(IconLoader::Load("magnatune", - IconLoader::Provider).pixmap(16).toImage())); + QImage(IconLoader::Load("magnatune", IconLoader::Provider) + .pixmap(16) + .toImage())); } void OSD::ShowMessage(const QString& summary, const QString& message, diff --git a/src/widgets/osd.h b/src/widgets/osd.h index fc2e0575c..8f36a673a 100644 --- a/src/widgets/osd.h +++ b/src/widgets/osd.h @@ -18,15 +18,14 @@ #ifndef OSD_H #define OSD_H -#include - #include #include #include +#include #include "config.h" -#include "engines/engine_fwd.h" #include "core/song.h" +#include "engines/engine_fwd.h" #include "playlist/playlistsequence.h" class Application; diff --git a/src/widgets/osd_mac.mm b/src/widgets/osd_mac.mm index 77883c8e7..3c8228229 100644 --- a/src/widgets/osd_mac.mm +++ b/src/widgets/osd_mac.mm @@ -38,10 +38,9 @@ void SendNotificationCenterMessage(NSString* title, NSString* subtitle) { [notification setSubtitle:subtitle]; if ([[NSProcessInfo processInfo] - isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){ - .majorVersion = 10, - .minorVersion = 9, - .patchVersion = 0}]) { + isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = 10, + .minorVersion = 9, + .patchVersion = 0}]) { [notification_center removeAllDeliveredNotifications]; } [notification_center deliverNotification:notification]; @@ -55,8 +54,8 @@ bool OSD::SupportsNativeNotifications() { return true; } bool OSD::SupportsTrayPopups() { return false; } -void OSD::ShowMessageNative(const QString& summary, const QString& message, - const QString& icon, const QImage& image) { +void OSD::ShowMessageNative(const QString& summary, const QString& message, const QString& icon, + const QImage& image) { Q_UNUSED(icon); scoped_nsobject mac_message( [[NSString alloc] initWithUTF8String:message.toUtf8().constData()]); diff --git a/src/widgets/osd_win.cpp b/src/widgets/osd_win.cpp index 7b2ffe277..db00e6dea 100644 --- a/src/widgets/osd_win.cpp +++ b/src/widgets/osd_win.cpp @@ -15,11 +15,11 @@ along with Clementine. If not, see . */ -#include "osd.h" -#include "core/logging.h" - #include +#include "core/logging.h" +#include "osd.h" + void OSD::Init() {} bool OSD::SupportsNativeNotifications() { return false; } diff --git a/src/widgets/osd_x11.cpp b/src/widgets/osd_x11.cpp index ee6829ca2..4d3ff22fa 100644 --- a/src/widgets/osd_x11.cpp +++ b/src/widgets/osd_x11.cpp @@ -15,20 +15,19 @@ along with Clementine. If not, see . */ -#include "osd.h" - -#include - #include +#include #include "config.h" #include "core/logging.h" +#include "osd.h" #ifdef HAVE_DBUS -#include "dbus/notification.h" #include #include +#include "dbus/notification.h" + QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) { if (image.isNull()) { // Sometimes this gets called with a null QImage for no obvious reason. diff --git a/src/widgets/osdpretty.cpp b/src/widgets/osdpretty.cpp index fbf263fe7..81a96f92f 100644 --- a/src/widgets/osdpretty.cpp +++ b/src/widgets/osdpretty.cpp @@ -15,10 +15,7 @@ along with Clementine. If not, see . */ -#include "config.h" #include "osdpretty.h" -#include "ui_osdpretty.h" -#include "core/logging.h" #include #include @@ -34,11 +31,15 @@ #include #include +#include "config.h" +#include "core/logging.h" +#include "ui_osdpretty.h" + #ifdef HAVE_X11 #include #endif #ifdef Q_OS_WIN32 -# include +#include #endif #ifdef Q_OS_WIN32 @@ -264,7 +265,6 @@ void OSDPretty::paintEvent(QPaintEvent*) { void OSDPretty::SetMessage(const QString& summary, const QString& message, const QImage& image) { - if (!image.isNull()) { QImage scaled_image = image.scaled(kMaxIconSize, kMaxIconSize, Qt::KeepAspectRatio, @@ -361,7 +361,6 @@ void OSDPretty::FaderFinished() { void OSDPretty::FaderValueChanged(qreal value) { setWindowOpacity(value); } void OSDPretty::Reposition() { - // Make the OSD the proper size layout()->activate(); resize(sizeHint()); diff --git a/src/widgets/osdpretty.h b/src/widgets/osdpretty.h index b7ea14ba7..2290a282a 100644 --- a/src/widgets/osdpretty.h +++ b/src/widgets/osdpretty.h @@ -30,7 +30,10 @@ class OSDPretty : public QWidget { Q_OBJECT public: - enum Mode { Mode_Popup, Mode_Draggable, }; + enum Mode { + Mode_Popup, + Mode_Draggable, + }; OSDPretty(Mode mode, QWidget* parent = nullptr); ~OSDPretty(); diff --git a/src/widgets/prettyimage.cpp b/src/widgets/prettyimage.cpp index a4112b01e..523fccc1e 100644 --- a/src/widgets/prettyimage.cpp +++ b/src/widgets/prettyimage.cpp @@ -190,7 +190,6 @@ void PrettyImage::contextMenuEvent(QContextMenuEvent* e) { } void PrettyImage::ShowFullsize() { - // Create the window QScrollArea* pwindow = new QScrollArea; pwindow->setAttribute(Qt::WA_DeleteOnClose, true); diff --git a/src/widgets/prettyimage.h b/src/widgets/prettyimage.h index 5a2de0e66..c32755da2 100644 --- a/src/widgets/prettyimage.h +++ b/src/widgets/prettyimage.h @@ -44,7 +44,7 @@ class PrettyImage : public QWidget { QSize sizeHint() const; QSize image_size() const; -signals: + signals: void Loaded(); public slots: diff --git a/src/widgets/prettyimageview.cpp b/src/widgets/prettyimageview.cpp index 8f9fe3e57..2b4edae3d 100644 --- a/src/widgets/prettyimageview.cpp +++ b/src/widgets/prettyimageview.cpp @@ -15,7 +15,6 @@ along with Clementine. If not, see . */ -#include "prettyimage.h" #include "prettyimageview.h" #include @@ -25,6 +24,8 @@ #include #include +#include "prettyimage.h" + PrettyImageView::PrettyImageView(QNetworkAccessManager* network, QWidget* parent) : QScrollArea(parent), diff --git a/src/widgets/ratingwidget.h b/src/widgets/ratingwidget.h index 90ccd4a69..1c24129a2 100644 --- a/src/widgets/ratingwidget.h +++ b/src/widgets/ratingwidget.h @@ -48,7 +48,7 @@ class RatingWidget : public QWidget { float rating() const { return rating_; } void set_rating(float rating); -signals: + signals: void RatingChanged(float rating); protected: diff --git a/src/widgets/renametablineedit.h b/src/widgets/renametablineedit.h index 51c39fea2..932a3a489 100644 --- a/src/widgets/renametablineedit.h +++ b/src/widgets/renametablineedit.h @@ -26,7 +26,7 @@ class RenameTabLineEdit : public QLineEdit { public: RenameTabLineEdit(QWidget* parent = nullptr); -signals: + signals: void EditingCanceled(); public slots: diff --git a/src/widgets/sliderwidget.cpp b/src/widgets/sliderwidget.cpp index 27b81f7e1..b93c896ee 100644 --- a/src/widgets/sliderwidget.cpp +++ b/src/widgets/sliderwidget.cpp @@ -23,15 +23,15 @@ #include #include #include +#include +#include #include #include #include -#include #include -#include -#include -#include #include +#include +#include Amarok::Slider::Slider(Qt::Orientation orientation, QWidget* parent, uint max) : QSlider(orientation, parent), @@ -162,8 +162,8 @@ namespace Amarok { namespace ColorScheme { extern QColor Background; extern QColor Foreground; -} -} +} // namespace ColorScheme +} // namespace Amarok #if 0 /** these functions aren't required in our fixed size world, @@ -194,7 +194,7 @@ Amarok::VolumeSlider::VolumeSlider(QWidget* parent, uint max) : Amarok::Slider(Qt::Horizontal, parent, max), m_animCount(0), m_animTimer(new QTimer(this)), - m_pixmapInset(QPixmap(drawVolumePixmap ())) { + m_pixmapInset(QPixmap(drawVolumePixmap())) { setFocusPolicy(Qt::NoFocus); // Store theme colors to check theme change at paintEvent @@ -284,13 +284,15 @@ void Amarok::VolumeSlider::paintEvent(QPaintEvent*) { const int padding = 7; const int offset = int(double((width() - 2 * padding) * value()) / maximum()); - // If theme changed since last paintEvent, redraw the volume pixmap with new theme colors + // If theme changed since last paintEvent, redraw the volume pixmap with new + // theme colors if (m_previous_theme_text_color != palette().color(QPalette::WindowText)) { m_pixmapInset = drawVolumePixmap(); m_previous_theme_text_color = palette().color(QPalette::WindowText); } - if (m_previous_theme_highlight_color != palette().color(QPalette::Highlight)) { + if (m_previous_theme_highlight_color != + palette().color(QPalette::Highlight)) { drawVolumeSliderHandle(); m_previous_theme_highlight_color = palette().color(QPalette::Highlight); } @@ -330,19 +332,19 @@ void Amarok::VolumeSlider::paletteChange(const QPalette&) { generateGradient(); } -QPixmap Amarok::VolumeSlider::drawVolumePixmap () const { +QPixmap Amarok::VolumeSlider::drawVolumePixmap() const { QPixmap pixmap(112, 36); pixmap.fill(Qt::transparent); QPainter painter(&pixmap); - QPen pen(palette().color(QPalette::WindowText), 0.3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + QPen pen(palette().color(QPalette::WindowText), 0.3, Qt::SolidLine, + Qt::RoundCap, Qt::RoundJoin); painter.setPen(pen); - + painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::SmoothPixmapTransform); // Draw volume control pixmap QPolygon poly; - poly << QPoint(6, 21) << QPoint(104, 21) - << QPoint(104, 7) << QPoint(6, 16) + poly << QPoint(6, 21) << QPoint(104, 21) << QPoint(104, 7) << QPoint(6, 16) << QPoint(6, 21); QPainterPath path; path.addPolygon(poly); @@ -356,18 +358,20 @@ void Amarok::VolumeSlider::drawVolumeSliderHandle() { QImage pixmapHandle(":volumeslider-handle.png"); QImage pixmapHandleGlow(":/volumeslider-handle_glow.png"); - QImage pixmapHandleGlow_image(pixmapHandleGlow.size(), QImage::Format_ARGB32_Premultiplied); + QImage pixmapHandleGlow_image(pixmapHandleGlow.size(), + QImage::Format_ARGB32_Premultiplied); QPainter painter(&pixmapHandleGlow_image); - + painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::SmoothPixmapTransform); // repaint volume slider handle glow image with theme highlight color - painter.fillRect(pixmapHandleGlow_image.rect(), QBrush(palette().color(QPalette::Highlight))); + painter.fillRect(pixmapHandleGlow_image.rect(), + QBrush(palette().color(QPalette::Highlight))); painter.setCompositionMode(QPainter::CompositionMode_DestinationIn); painter.drawImage(0, 0, pixmapHandleGlow); - - // Overlay the volume slider handle image + + // Overlay the volume slider handle image painter.setCompositionMode(QPainter::CompositionMode_SourceAtop); painter.drawImage(0, 0, pixmapHandle); diff --git a/src/widgets/sliderwidget.h b/src/widgets/sliderwidget.h index 185c6cf7e..e30777eda 100644 --- a/src/widgets/sliderwidget.h +++ b/src/widgets/sliderwidget.h @@ -20,9 +20,9 @@ #ifndef AMAROKSLIDER_H #define AMAROKSLIDER_H +#include #include #include -#include class QPalette; class QTimer; @@ -41,7 +41,7 @@ class Slider : public QSlider { // current needs fine int value() const { return adjustValue(QSlider::value()); } -signals: + signals: // we emit this when the user has specifically changed the slider // so connect to it if valueChanged() is too generic // Qt also emits valueChanged( int ) @@ -136,6 +136,6 @@ class VolumeSlider : public Slider { QList m_handlePixmaps; }; -} +} // namespace Amarok #endif diff --git a/src/widgets/stickyslider.h b/src/widgets/stickyslider.h index 6a1e07e1a..439bcd1b7 100644 --- a/src/widgets/stickyslider.h +++ b/src/widgets/stickyslider.h @@ -23,8 +23,8 @@ class StickySlider : public QSlider { Q_OBJECT Q_PROPERTY(int sticky_center READ sticky_center WRITE set_sticky_center) - Q_PROPERTY(int sticky_threshold READ sticky_threshold WRITE - set_sticky_threshold) + Q_PROPERTY( + int sticky_threshold READ sticky_threshold WRITE set_sticky_threshold) public: StickySlider(QWidget* parent = nullptr); diff --git a/src/widgets/stretchheaderview.cpp b/src/widgets/stretchheaderview.cpp index e2f8838ee..24e7f12cd 100644 --- a/src/widgets/stretchheaderview.cpp +++ b/src/widgets/stretchheaderview.cpp @@ -16,14 +16,14 @@ */ #include "stretchheaderview.h" -#include "core/logging.h" #include - #include #include #include +#include "core/logging.h" + const int StretchHeaderView::kMinimumColumnWidth = 20; const int StretchHeaderView::kMagicNumber = 0x502c950f; diff --git a/src/widgets/stretchheaderview.h b/src/widgets/stretchheaderview.h index f3a6ae914..252148625 100644 --- a/src/widgets/stretchheaderview.h +++ b/src/widgets/stretchheaderview.h @@ -61,7 +61,7 @@ class StretchHeaderView : public QHeaderView { void ToggleStretchEnabled(); void SetStretchEnabled(bool enabled); -signals: + signals: // Emitted when the stretch mode is changed. void StretchEnabledChanged(bool enabled); diff --git a/src/widgets/stylehelper.cpp b/src/widgets/stylehelper.cpp index c2fa8fe60..9443aaebb 100644 --- a/src/widgets/stylehelper.cpp +++ b/src/widgets/stylehelper.cpp @@ -29,14 +29,14 @@ #include "stylehelper.h" -#include +#include +#include #include +#include #include #include -#include #include -#include -#include +#include // Clamps float color values within (0, 255) static int clamp(float x) { @@ -164,9 +164,10 @@ void StyleHelper::drawIconWithShadow(const QIcon& icon, const QRect& rect, int radius, const QColor& color, const QPoint& offset) { QPixmap cache; - QString pixmapName = - QString("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg( - rect.height()); + QString pixmapName = QString("icon %0 %1 %2") + .arg(icon.cacheKey()) + .arg(iconMode) + .arg(rect.height()); if (!QPixmapCache::find(pixmapName, cache)) { QPixmap px = icon.pixmap(rect.size()); diff --git a/src/widgets/trackslider.cpp b/src/widgets/trackslider.cpp index 2cc258352..32dfd0beb 100644 --- a/src/widgets/trackslider.cpp +++ b/src/widgets/trackslider.cpp @@ -15,14 +15,15 @@ along with Clementine. If not, see . */ -#include "config.h" #include "trackslider.h" -#include "ui_trackslider.h" -#include "core/timeconstants.h" -#include "core/utilities.h" #include +#include "config.h" +#include "core/timeconstants.h" +#include "core/utilities.h" +#include "ui_trackslider.h" + #ifdef HAVE_MOODBAR #include "moodbar/moodbarproxystyle.h" #endif diff --git a/src/widgets/trackslider.h b/src/widgets/trackslider.h index 233b7e89e..3d034d68e 100644 --- a/src/widgets/trackslider.h +++ b/src/widgets/trackslider.h @@ -51,7 +51,7 @@ class TrackSlider : public QWidget { void SetCanSeek(bool can_seek); void Seek(int gap); -signals: + signals: void ValueChanged(int value); void ValueChangedSeconds(int value); diff --git a/src/widgets/tracksliderpopup.cpp b/src/widgets/tracksliderpopup.cpp index d6e9fbc06..65866ce36 100644 --- a/src/widgets/tracksliderpopup.cpp +++ b/src/widgets/tracksliderpopup.cpp @@ -16,7 +16,6 @@ */ #include "tracksliderpopup.h" -#include "ui/qt_blurimage.h" #include #include @@ -26,6 +25,8 @@ #include #include +#include "ui/qt_blurimage.h" + const int TrackSliderPopup::kTextMargin = 4; const int TrackSliderPopup::kPointLength = 16; const int TrackSliderPopup::kPointWidth = 4; diff --git a/src/widgets/tracksliderslider.cpp b/src/widgets/tracksliderslider.cpp index a4730f184..e292ff906 100644 --- a/src/widgets/tracksliderslider.cpp +++ b/src/widgets/tracksliderslider.cpp @@ -15,16 +15,17 @@ along with Clementine. If not, see . */ -#include "tracksliderpopup.h" #include "tracksliderslider.h" -#include "core/timeconstants.h" -#include "core/utilities.h" #include #include #include -#include #include +#include + +#include "core/timeconstants.h" +#include "core/utilities.h" +#include "tracksliderpopup.h" TrackSliderSlider::TrackSliderSlider(QWidget* parent) : QSlider(parent), @@ -94,7 +95,7 @@ void TrackSliderSlider::mouseMoveEvent(QMouseEvent* e) { mapTo(window(), QPoint(e->x(), rect().center().y()))); } -void TrackSliderSlider::wheelEvent(QWheelEvent *e) { +void TrackSliderSlider::wheelEvent(QWheelEvent* e) { if (e->delta() < 0) { emit SeekBackward(); } else { diff --git a/src/widgets/tracksliderslider.h b/src/widgets/tracksliderslider.h index 0601dc43b..a0c1fdb9b 100644 --- a/src/widgets/tracksliderslider.h +++ b/src/widgets/tracksliderslider.h @@ -29,7 +29,7 @@ class TrackSliderSlider : public QSlider { public: TrackSliderSlider(QWidget* parent = nullptr); -signals: + signals: void SeekForward(); void SeekBackward(); void Previous(); @@ -39,7 +39,7 @@ signals: void mousePressEvent(QMouseEvent* e); void mouseReleaseEvent(QMouseEvent* e); void mouseMoveEvent(QMouseEvent* e); - void wheelEvent(QWheelEvent *e); + void wheelEvent(QWheelEvent* e); void enterEvent(QEvent*); void leaveEvent(QEvent*); void keyPressEvent(QKeyEvent* event); diff --git a/src/widgets/widgetfadehelper.cpp b/src/widgets/widgetfadehelper.cpp index 407b7521f..76119140d 100644 --- a/src/widgets/widgetfadehelper.cpp +++ b/src/widgets/widgetfadehelper.cpp @@ -16,13 +16,14 @@ */ #include "widgetfadehelper.h" -#include "ui/qt_blurimage.h" -#include #include +#include #include #include +#include "ui/qt_blurimage.h" + const int WidgetFadeHelper::kLoadingPadding = 9; const int WidgetFadeHelper::kLoadingBorderRadius = 10; diff --git a/src/wiimotedev/shortcuts.cpp b/src/wiimotedev/shortcuts.cpp index d002d048c..c52ab65f2 100644 --- a/src/wiimotedev/shortcuts.cpp +++ b/src/wiimotedev/shortcuts.cpp @@ -15,10 +15,11 @@ along with Clementine. If not, see . */ +#include "wiimotedev/shortcuts.h" + #include #include "wiimotedev/consts.h" -#include "wiimotedev/shortcuts.h" const char* WiimotedevShortcuts::kActionsGroup = "WiimotedevActions"; const char* WiimotedevShortcuts::kSettingsGroup = "WiimotedevSettings"; @@ -123,7 +124,6 @@ void WiimotedevShortcuts::DbusWiimoteGeneralButtons(uint id, qulonglong value) { if (wiimotedev_buttons_ == buttons) return; if (actions_.contains(buttons)) { - if (wiimotedev_active_) { if (actions_.value(buttons, ActionNone) == WiimotedevActiveDeactive) { actived_ = !actived_; diff --git a/src/wiimotedev/shortcuts.h b/src/wiimotedev/shortcuts.h index 7f19faa24..13004066e 100644 --- a/src/wiimotedev/shortcuts.h +++ b/src/wiimotedev/shortcuts.h @@ -18,12 +18,11 @@ #ifndef WIIMOTEDEV_SHORTCUTS_H #define WIIMOTEDEV_SHORTCUTS_H +#include #include -#include - -#include "dbus/wiimotedev.h" #include "core/player.h" +#include "dbus/wiimotedev.h" #include "widgets/osd.h" class QSettings; @@ -84,7 +83,7 @@ class WiimotedevShortcuts : public QObject { QHash actions_; QSettings settings_; -signals: + signals: void WiiremoteActived(int); void WiiremoteDeactived(int); void WiiremoteConnected(int); diff --git a/src/wiimotedev/wiimotesettingspage.cpp b/src/wiimotedev/wiimotesettingspage.cpp index 8b086de32..d4ddb5ca0 100644 --- a/src/wiimotedev/wiimotesettingspage.cpp +++ b/src/wiimotedev/wiimotesettingspage.cpp @@ -15,26 +15,27 @@ along with Clementine. If not, see . */ -#include "ui/iconloader.h" -#include "consts.h" -#include "shortcuts.h" #include "wiimotesettingspage.h" -#include "wiimoteshortcutgrabber.h" -#include "ui_wiimotesettingspage.h" #include +#include "consts.h" +#include "shortcuts.h" +#include "ui/iconloader.h" +#include "ui_wiimotesettingspage.h" +#include "wiimoteshortcutgrabber.h" + WiimoteSettingsPage::WiimoteSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_WiimoteSettingsPage) { ui_->setupUi(this); ui_->list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); setWindowIcon(IconLoader::Load("wiimotedev", IconLoader::Base)); - ui_->wiimotedev_add_action->setIcon(IconLoader::Load("list-add", - IconLoader::Base)); - ui_->wiimotedev_delete_action->setIcon(IconLoader::Load("list-remove", - IconLoader::Base)); - ui_->wiimotedev_reload->setIcon(IconLoader::Load("view-refresh", - IconLoader::Base)); + ui_->wiimotedev_add_action->setIcon( + IconLoader::Load("list-add", IconLoader::Base)); + ui_->wiimotedev_delete_action->setIcon( + IconLoader::Load("list-remove", IconLoader::Base)); + ui_->wiimotedev_reload->setIcon( + IconLoader::Load("view-refresh", IconLoader::Base)); text_buttons_.insert(WIIMOTE_BTN_1, "Wii Remote 1"); text_buttons_.insert(WIIMOTE_BTN_2, "Wii Remote 2"); diff --git a/src/wiimotedev/wiimotesettingspage.h b/src/wiimotedev/wiimotesettingspage.h index 6597b91b8..a89e096fd 100644 --- a/src/wiimotedev/wiimotesettingspage.h +++ b/src/wiimotedev/wiimotesettingspage.h @@ -18,10 +18,10 @@ #ifndef WIIMOTESETTINGSPAGE_H #define WIIMOTESETTINGSPAGE_H -#include "ui/settingspage.h" - #include +#include "ui/settingspage.h" + class QTreeWidgetItem; class Ui_WiimoteSettingsPage; @@ -37,7 +37,7 @@ class WiimoteSettingsPage : public SettingsPage { QString GetReadableWiiremoteSequence(quint64 value); QStringList TextActions() const { return text_actions_.values(); } -signals: + signals: void SetWiimotedevInterfaceActived(bool); private slots: diff --git a/src/wiimotedev/wiimoteshortcutgrabber.cpp b/src/wiimotedev/wiimoteshortcutgrabber.cpp index 4de606996..22f19e9bd 100644 --- a/src/wiimotedev/wiimoteshortcutgrabber.cpp +++ b/src/wiimotedev/wiimoteshortcutgrabber.cpp @@ -15,10 +15,11 @@ along with Clementine. If not, see . */ -#include "consts.h" #include "wiimoteshortcutgrabber.h" -#include "ui_wiimoteshortcutgrabber.h" + +#include "consts.h" #include "ui/iconloader.h" +#include "ui_wiimoteshortcutgrabber.h" WiimoteShortcutGrabber::WiimoteShortcutGrabber(quint32 action, quint32 device, WiimoteSettingsPage* parent) diff --git a/src/wiimotedev/wiimoteshortcutgrabber.h b/src/wiimotedev/wiimoteshortcutgrabber.h index 853573987..693241e56 100644 --- a/src/wiimotedev/wiimoteshortcutgrabber.h +++ b/src/wiimotedev/wiimoteshortcutgrabber.h @@ -18,13 +18,12 @@ #ifndef WIIMOTESHORTCUTGRABBER_H #define WIIMOTESHORTCUTGRABBER_H -#include - #include #include +#include -#include "wiimotesettingspage.h" #include "dbus/wiimotedev.h" +#include "wiimotesettingspage.h" class Ui_WiimoteShortcutGrabber; @@ -53,7 +52,7 @@ class WiimoteShortcutGrabber : public QDialog { quint64 remember_wiimote_shifts_; quint64 remember_nunchuk_shifts_; -signals: + signals: void AddShortcut(quint64 buttons, quint32 action); };