Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaski committed Oct 29, 2024
1 parent dfcf715 commit 27125b3
Show file tree
Hide file tree
Showing 596 changed files with 8,039 additions and 12,594 deletions.
1,121 changes: 72 additions & 1,049 deletions CMakeLists.txt

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,71 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)

add_subdirectory(utilities)
add_subdirectory(core)
add_subdirectory(mimedata)
add_subdirectory(osd)
add_subdirectory(tagreader)
add_subdirectory(widgets)
add_subdirectory(dialogs)
add_subdirectory(engine)
add_subdirectory(lyrics)
add_subdirectory(filterparser)
add_subdirectory(analyzer)
add_subdirectory(transcoder)
add_subdirectory(collection)
add_subdirectory(playlist)
add_subdirectory(playlistparsers)
add_subdirectory(equalizer)
add_subdirectory(edittagdialog)
add_subdirectory(smartplaylists)
add_subdirectory(settings)
add_subdirectory(device)
add_subdirectory(covermanager)
add_subdirectory(fileview)
add_subdirectory(player)
add_subdirectory(radios)
add_subdirectory(streaming)
add_subdirectory(scrobbler)
add_subdirectory(organize)
add_subdirectory(context)
add_subdirectory(queue)
add_subdirectory(providers)
add_subdirectory(songloader)
add_subdirectory(systemtrayicon)

if(HAVE_MUSICBRAINZ)
add_subdirectory(musicbrainz)
endif()

if(HAVE_GLOBALSHORTCUTS)
add_subdirectory(globalshortcuts)
endif()

if(HAVE_MOODBAR)
add_subdirectory(moodbar)
endif()

if(HAVE_MPRIS2)
add_subdirectory(mpris2)
endif()

if(HAVE_SUBSONIC)
add_subdirectory(subsonic)
endif()

if(HAVE_TIDAL)
add_subdirectory(tidal)
endif()

if(HAVE_SPOTIFY)
add_subdirectory(spotify)
endif()

if(HAVE_QOBUZ)
add_subdirectory(qobuz)
endif()

if(APPLE)
add_subdirectory(macstartup)
endif()
41 changes: 41 additions & 0 deletions src/analyzer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
set(ANALYZER_SOURCES
fht.cpp
analyzerbase.cpp
analyzercontainer.cpp
blockanalyzer.cpp
boomanalyzer.cpp
turbineanalyzer.cpp
sonogramanalyzer.cpp
waverubberanalyzer.cpp
rainbowanalyzer.cpp
)

set(ANALYZER_HEADERS
analyzerbase.h
analyzercontainer.h
blockanalyzer.h
boomanalyzer.h
turbineanalyzer.h
sonogramanalyzer.h
waverubberanalyzer.h
rainbowanalyzer.h
)

qt_wrap_cpp(ANALYZER_SOURCES ${ANALYZER_HEADERS})

add_library(strawberry_analyzer STATIC ${ANALYZER_SOURCES})

target_include_directories(strawberry_analyzer PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
)

target_link_libraries(strawberry_analyzer PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
strawberry_core
strawberry_engine
)
2 changes: 1 addition & 1 deletion src/analyzer/analyzerbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <QString>
#include <QPainter>

#include "core/shared_ptr.h"
#include "includes/shared_ptr.h"
#include "analyzer/fht.h"
#include "engine/enginebase.h"

Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzercontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
#include "waverubberanalyzer.h"
#include "rainbowanalyzer.h"

#include "includes/shared_ptr.h"
#include "core/logging.h"
#include "core/shared_ptr.h"
#include "core/settings.h"
#include "engine/enginebase.h"

Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzercontainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <QAction>
#include <QActionGroup>

#include "core/shared_ptr.h"
#include "includes/shared_ptr.h"
#include "engine/enginebase.h"

class QTimer;
Expand Down
82 changes: 82 additions & 0 deletions src/collection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
set(COLLECTION_SOURCES
collectionlibrary.cpp
collectionmodel.cpp
collectionbackend.cpp
collectionwatcher.cpp
collectionview.cpp
collectionitemdelegate.cpp
collectionviewcontainer.cpp
collectiondirectorymodel.cpp
collectionfilteroptions.cpp
collectionfilterwidget.cpp
collectionfilter.cpp
collectionplaylistitem.cpp
collectionquery.cpp
savedgroupingmanager.cpp
groupbydialog.cpp
collectiontask.cpp
collectionmodelupdate.cpp
collectionitem.cpp
)

set(COLLECTION_HEADERS
collectionlibrary.h
collectionmodel.h
collectionbackend.h
collectionwatcher.h
collectionview.h
collectionitemdelegate.h
collectionviewcontainer.h
collectiondirectorymodel.h
collectionfilterwidget.h
collectionfilter.h
savedgroupingmanager.h
groupbydialog.h
)

set(COLLECTION_UI
groupbydialog.ui
collectionfilterwidget.ui
collectionviewcontainer.ui
savedgroupingmanager.ui
)

qt_wrap_cpp(COLLECTION_SOURCES ${COLLECTION_HEADERS})
qt_wrap_ui(COLLECTION_SOURCES ${COLLECTION_UI})

add_library(strawberry_collection STATIC ${COLLECTION_SOURCES})

target_include_directories(strawberry_collection PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
)

target_link_libraries(strawberry_collection PRIVATE
PkgConfig::GLIB
PkgConfig::GOBJECT
PkgConfig::GSTREAMER
PkgConfig::GSTREAMER_BASE
PkgConfig::GSTREAMER_AUDIO
PkgConfig::GSTREAMER_APP
PkgConfig::GSTREAMER_TAG
PkgConfig::GSTREAMER_PBUTILS
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Concurrent
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Sql
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
strawberry_utilities
strawberry_core
strawberry_mimedata
strawberry_engine
strawberry_tagreader
strawberry_covermanager
strawberry_filterparser
strawberry_dialogs
strawberry_edittagdialog
strawberry_organize
strawberry_playlistparsers
)
25 changes: 6 additions & 19 deletions src/collection/collectionbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@
#include <QSqlQuery>
#include <QSqlError>

#include "core/shared_ptr.h"
#include "includes/shared_ptr.h"
#include "core/logging.h"
#include "core/database.h"
#include "core/scopedtransaction.h"
#include "core/song.h"
#include "core/sqlrow.h"
#include "smartplaylists/smartplaylistsearch.h"

#include "collectiondirectory.h"
#include "collectionbackend.h"
Expand Down Expand Up @@ -1932,37 +1930,26 @@ void CollectionBackend::DeleteAll() {

}

SongList CollectionBackend::SmartPlaylistsFindSongs(const SmartPlaylistSearch &search) {
SongList CollectionBackend::ExecuteQuery(const QString &sql) {

QMutexLocker l(db_->Mutex());
QSqlDatabase db(db_->Connect());

// Build the query
QString sql = search.ToSql(songs_table());

// Run the query
SongList ret;
SqlQuery query(db);
query.prepare(sql);
if (!query.Exec()) {
db_->ReportErrors(query);
return ret;
return SongList();
}

// Read the results
SongList songs;
while (query.next()) {
Song song;
song.InitFromQuery(query, true);
ret << song;
songs << song;
}
return ret;

}

SongList CollectionBackend::SmartPlaylistsGetAllSongs() {

// Get all the songs!
return SmartPlaylistsFindSongs(SmartPlaylistSearch(SmartPlaylistSearch::SearchType::All, SmartPlaylistSearch::TermList(), SmartPlaylistSearch::SortType::FieldAsc, SmartPlaylistSearchTerm::Field::Artist, -1));
return songs;

}

Expand Down
6 changes: 2 additions & 4 deletions src/collection/collectionbackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <QUrl>
#include <QSqlDatabase>

#include "core/shared_ptr.h"
#include "includes/shared_ptr.h"
#include "core/song.h"
#include "collectionfilteroptions.h"
#include "collectionquery.h"
Expand All @@ -45,7 +45,6 @@
class QThread;
class TaskManager;
class Database;
class SmartPlaylistSearch;

class CollectionBackendInterface : public QObject {
Q_OBJECT
Expand Down Expand Up @@ -227,8 +226,7 @@ class CollectionBackend : public CollectionBackendInterface {

SongList GetSongsByFingerprint(const QString &fingerprint) override;

SongList SmartPlaylistsGetAllSongs();
SongList SmartPlaylistsFindSongs(const SmartPlaylistSearch &search);
SongList ExecuteQuery(const QString &sql);

void AddOrUpdateSongsAsync(const SongList &songs);
void UpdateSongsBySongIDAsync(const SongMap &new_songs);
Expand Down
2 changes: 1 addition & 1 deletion src/collection/collectiondirectorymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <QVariant>
#include <QString>

#include "core/shared_ptr.h"
#include "includes/shared_ptr.h"
#include "core/filesystemmusicstorage.h"
#include "core/iconloader.h"
#include "core/musicstorage.h"
Expand Down
2 changes: 1 addition & 1 deletion src/collection/collectiondirectorymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <QStringList>
#include <QIcon>

#include "core/shared_ptr.h"
#include "includes/shared_ptr.h"
#include "collectiondirectory.h"

class QModelIndex;
Expand Down
5 changes: 2 additions & 3 deletions src/collection/collectionfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
#include "core/song.h"
#include "filterparser/filterparser.h"
#include "filterparser/filtertree.h"
#include "playlist/songmimedata.h"
#include "playlist/playlistmanager.h"
#include "mimedata/songmimedata.h"
#include "collectionbackend.h"
#include "collectionfilter.h"
#include "collectionmodel.h"
Expand Down Expand Up @@ -95,7 +94,7 @@ QMimeData *CollectionFilter::mimeData(const QModelIndexList &indexes) const {
}

data->setUrls(urls);
data->name_for_new_playlist_ = PlaylistManager::GetNameForNewPlaylist(data->songs);
data->name_for_new_playlist_ = Song::GetNameForNewPlaylist(data->songs);

return data;

Expand Down
12 changes: 6 additions & 6 deletions src/collection/collectionfilterwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
#include "savedgroupingmanager.h"
#include "collectionfilterwidget.h"
#include "groupbydialog.h"
#include "ui_collectionfilterwidget.h"
#include "collection/ui_collectionfilterwidget.h"
#include "widgets/searchfield.h"
#include "settings/collectionsettingspage.h"
#include "settings/appearancesettingspage.h"
#include "constants/collectionsettings.h"
#include "constants/appearancesettings.h"

using namespace Qt::Literals::StringLiterals;

Expand Down Expand Up @@ -204,8 +204,8 @@ void CollectionFilterWidget::setFilter(CollectionFilter *filter) {
void CollectionFilterWidget::ReloadSettings() {

Settings s;
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
int iconsize = s.value(AppearanceSettingsPage::kIconSizeConfigureButtons, 20).toInt();
s.beginGroup(AppearanceSettings::kSettingsGroup);
int iconsize = s.value(AppearanceSettings::kIconSizeConfigureButtons, 20).toInt();
s.endGroup();
ui_->options->setIconSize(QSize(iconsize, iconsize));
ui_->search_field->setIconSize(iconsize);
Expand Down Expand Up @@ -345,7 +345,7 @@ void CollectionFilterWidget::SaveGroupBy() {
qLog(Debug) << "Saving current grouping to" << name;

Settings s;
if (settings_group_.isEmpty() || settings_group_ == QLatin1String(CollectionSettingsPage::kSettingsGroup)) {
if (settings_group_.isEmpty() || settings_group_ == QLatin1String(CollectionSettings::kSettingsGroup)) {
s.beginGroup(SavedGroupingManager::kSavedGroupingsSettingsGroup);
}
else {
Expand Down
Loading

0 comments on commit 27125b3

Please sign in to comment.