diff options
author | RJ Skerry-Ryan <rryan@mixxx.org> | 2018-11-04 15:53:48 -0800 |
---|---|---|
committer | RJ Skerry-Ryan <rryan@mixxx.org> | 2018-11-21 12:03:36 -0800 |
commit | f781261373c266449561211ba050a33b8d030a4e (patch) | |
tree | 2d5c3cd628374ac0e81481b8fc8b6ce0a9314edc | |
parent | 63213519c0280069b5bd773d50b8eef0e7b07ad9 (diff) |
Cache creation of QIcons in LibraryFeatures.
This showed up in profiling as a hotspot after disabling waveforms.
22 files changed, 45 insertions, 22 deletions
diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index a56279a2ef..548c7c1f05 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -31,7 +31,8 @@ AnalysisFeature::AnalysisFeature(Library* parent, m_pAnalyzerQueue(nullptr), m_iOldBpmEnabled(0), m_analysisTitleName(tr("Analyze")), - m_pAnalysisView(nullptr) { + m_pAnalysisView(nullptr), + m_icon(":/images/library/ic_library_prepare.svg") { setTitleDefault(); } @@ -60,7 +61,7 @@ QVariant AnalysisFeature::title() { } QIcon AnalysisFeature::getIcon() { - return QIcon(":/images/library/ic_library_prepare.svg"); + return m_icon; } void AnalysisFeature::bindWidget(WLibrary* libraryWidget, diff --git a/src/library/analysisfeature.h b/src/library/analysisfeature.h index 74d6480b8c..262f4b49d7 100644 --- a/src/library/analysisfeature.h +++ b/src/library/analysisfeature.h @@ -77,6 +77,7 @@ class AnalysisFeature : public LibraryFeature { const static QString m_sAnalysisViewName; QString m_analysisTitleName; DlgAnalysis* m_pAnalysisView; + QIcon m_icon; }; diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index c07f4a7f43..0edbbbae7f 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -52,7 +52,8 @@ AutoDJFeature::AutoDJFeature(Library* pLibrary, m_iAutoDJPlaylistId(findOrCrateAutoDjPlaylistId(m_playlistDao)), m_pAutoDJProcessor(NULL), m_pAutoDJView(NULL), - m_autoDjCratesDao(m_iAutoDJPlaylistId, pTrackCollection, pConfig) { + m_autoDjCratesDao(m_iAutoDJPlaylistId, pTrackCollection, pConfig), + m_icon(":/images/library/ic_library_autodj.svg") { qRegisterMetaType<AutoDJProcessor::AutoDJState>("AutoDJState"); m_pAutoDJProcessor = new AutoDJProcessor( @@ -98,7 +99,7 @@ QVariant AutoDJFeature::title() { } QIcon AutoDJFeature::getIcon() { - return QIcon(":/images/library/ic_library_autodj.svg"); + return m_icon; } void AutoDJFeature::bindWidget(WLibrary* libraryWidget, diff --git a/src/library/autodj/autodjfeature.h b/src/library/autodj/autodjfeature.h index 1d447fa642..559f185645 100644 --- a/src/library/autodj/autodjfeature.h +++ b/src/library/autodj/autodjfeature.h @@ -91,6 +91,8 @@ class AutoDJFeature : public LibraryFeature { // Used to map menu-item signals. QSignalMapper m_crateMapper; + QIcon m_icon; + private slots: // Add a crate to the auto-DJ queue. void slotAddCrateToAutoDj(int iCrateId); diff --git a/src/library/banshee/bansheefeature.cpp b/src/library/banshee/bansheefeature.cpp index bdb16b58e1..fad33e0e67 100644 --- a/src/library/banshee/bansheefeature.cpp +++ b/src/library/banshee/bansheefeature.cpp @@ -18,7 +18,8 @@ BansheeFeature::BansheeFeature(QObject* parent, UserSettingsPointer pConfig) : BaseExternalLibraryFeature(parent, pTrackCollection), m_pTrackCollection(pTrackCollection), - m_cancelImport(false) { + m_cancelImport(false), + m_icon(":/images/library/ic_library_banshee.svg") { Q_UNUSED(pConfig); m_pBansheePlaylistModel = new BansheePlaylistModel(this, m_pTrackCollection, &m_connection); m_isActivated = false; @@ -57,7 +58,7 @@ QVariant BansheeFeature::title() { } QIcon BansheeFeature::getIcon() { - return QIcon(":/images/library/ic_library_banshee.svg"); + return m_icon; } void BansheeFeature::activate() { diff --git a/src/library/banshee/bansheefeature.h b/src/library/banshee/bansheefeature.h index 5668358962..c9f3908df4 100644 --- a/src/library/banshee/bansheefeature.h +++ b/src/library/banshee/bansheefeature.h @@ -53,6 +53,7 @@ class BansheeFeature : public BaseExternalLibraryFeature { QFuture<TreeItem*> m_future; QString m_title; bool m_cancelImport; + QIcon m_icon; static QString m_databaseFile; diff --git a/src/library/browse/browsefeature.cpp b/src/library/browse/browsefeature.cpp index abb97e427d..aebf483b46 100644 --- a/src/library/browse/browsefeature.cpp +++ b/src/library/browse/browsefeature.cpp @@ -32,7 +32,8 @@ BrowseFeature::BrowseFeature(QObject* parent, m_browseModel(this, pTrackCollection, pRecordingManager), m_proxyModel(&m_browseModel), m_pTrackCollection(pTrackCollection), - m_pLastRightClickedItem(NULL) { + m_pLastRightClickedItem(NULL), + m_icon(":/images/library/ic_library_computer.svg") { connect(this, SIGNAL(requestAddDir(QString)), parent, SLOT(slotRequestAddDir(QString))); @@ -199,7 +200,7 @@ void BrowseFeature::slotRemoveQuickLink() { } QIcon BrowseFeature::getIcon() { - return QIcon(":/images/library/ic_library_computer.svg"); + return m_icon; } TreeItemModel* BrowseFeature::getChildModel() { diff --git a/src/library/browse/browsefeature.h b/src/library/browse/browsefeature.h index 94188ee6b0..a414614759 100644 --- a/src/library/browse/browsefeature.h +++ b/src/library/browse/browsefeature.h @@ -75,6 +75,7 @@ class BrowseFeature : public LibraryFeature { TreeItem* m_pLastRightClickedItem; TreeItem* m_pQuickLinkItem; QStringList m_quickLinkList; + QIcon m_icon; }; #endif // BROWSEFEATURE_H diff --git a/src/library/itunes/itunesfeature.cpp b/src/library/itunes/itunesfeature.cpp index 57e486fbdb..c98d7445c6 100644 --- a/src/library/itunes/itunesfeature.cpp +++ b/src/library/itunes/itunesfeature.cpp @@ -61,7 +61,8 @@ QString localhost_token() { ITunesFeature::ITunesFeature(QObject* parent, TrackCollection* pTrackCollection) : BaseExternalLibraryFeature(parent, pTrackCollection), m_pTrackCollection(pTrackCollection), - m_cancelImport(false) { + m_cancelImport(false), + m_icon(":/images/library/ic_library_itunes.svg") { QString tableName = "itunes_library"; QString idColumn = "id"; QStringList columns; @@ -139,7 +140,7 @@ QVariant ITunesFeature::title() { } QIcon ITunesFeature::getIcon() { - return QIcon(":/images/library/ic_library_itunes.svg"); + return m_icon; } void ITunesFeature::activate() { diff --git a/src/library/itunes/itunesfeature.h b/src/library/itunes/itunesfeature.h index 3dfbd3ef7a..e3319a16d8 100644 --- a/src/library/itunes/itunesfeature.h +++ b/src/library/itunes/itunesfeature.h @@ -70,6 +70,7 @@ class ITunesFeature : public BaseExternalLibraryFeature { QString m_mixxxItunesRoot; QSharedPointer<BaseTrackCache> m_trackSource; + QIcon m_icon; }; #endif // ITUNESFEATURE_H diff --git a/src/library/mixxxlibraryfeature.cpp b/src/library/mixxxlibraryfeature.cpp index 5d9acadb53..199a2926df 100644 --- a/src/library/mixxxlibraryfeature.cpp +++ b/src/library/mixxxlibraryfeature.cpp @@ -32,7 +32,8 @@ MixxxLibraryFeature::MixxxLibraryFeature(Library* pLibrary, m_pHiddenView(NULL), m_trackDao(pTrackCollection->getTrackDAO()), m_pConfig(pConfig), - m_pTrackCollection(pTrackCollection) { + m_pTrackCollection(pTrackCollection), + m_icon(":/images/library/ic_library_tracks.svg") { QStringList columns; columns << "library." + LIBRARYTABLE_ID << "library." + LIBRARYTABLE_PLAYED @@ -140,7 +141,7 @@ QVariant MixxxLibraryFeature::title() { } QIcon MixxxLibraryFeature::getIcon() { - return QIcon(":/images/library/ic_library_tracks.svg"); + return m_icon; } TreeItemModel* MixxxLibraryFeature::getChildModel() { diff --git a/src/library/mixxxlibraryfeature.h b/src/library/mixxxlibraryfeature.h index e959aed37c..d0a1aa07fe 100644 --- a/src/library/mixxxlibraryfeature.h +++ b/src/library/mixxxlibraryfeature.h @@ -63,6 +63,7 @@ class MixxxLibraryFeature : public LibraryFeature { TrackDAO& m_trackDao; UserSettingsPointer m_pConfig; TrackCollection* m_pTrackCollection; + QIcon m_icon; }; #endif /* MIXXXLIBRARYFEATURE_H */ diff --git a/src/library/playlistfeature.cpp b/src/library/playlistfeature.cpp index 62ef484646..4f636f8cea 100644 --- a/src/library/playlistfeature.cpp +++ b/src/library/playlistfeature.cpp @@ -23,7 +23,8 @@ PlaylistFeature::PlaylistFeature(QObject* parent, TrackCollection* pTrackCollection, UserSettingsPointer pConfig) : BasePlaylistFeature(parent, pConfig, pTrackCollection, - "PLAYLISTHOME") { + "PLAYLISTHOME"), + m_icon(":/images/library/ic_library_playlist.svg") { m_pPlaylistTableModel = new PlaylistTableModel(this, pTrackCollection, "mixxx.db.model.playlist"); @@ -41,7 +42,7 @@ QVariant PlaylistFeature::title() { } QIcon PlaylistFeature::getIcon() { - return QIcon(":/images/library/ic_library_playlist.svg"); + return m_icon; } void PlaylistFeature::onRightClick(const QPoint& globalPos) { diff --git a/src/library/playlistfeature.h b/src/library/playlistfeature.h index 0d129eff74..a32548b53f 100644 --- a/src/library/playlistfeature.h +++ b/src/library/playlistfeature.h @@ -45,6 +45,7 @@ class PlaylistFeature : public BasePlaylistFeature { private: QString getRootViewHtml() const; + QIcon m_icon; }; #endif /* PLAYLISTFEATURE_H */ diff --git a/src/library/recording/recordingfeature.cpp b/src/library/recording/recordingfeature.cpp index ae1c48fb80..22c436ee3a 100644 --- a/src/library/recording/recordingfeature.cpp +++ b/src/library/recording/recordingfeature.cpp @@ -20,7 +20,8 @@ RecordingFeature::RecordingFeature(Library* pLibrary, m_pConfig(pConfig), m_pLibrary(pLibrary), m_pTrackCollection(pTrackCollection), - m_pRecordingManager(pRecordingManager) { + m_pRecordingManager(pRecordingManager), + m_icon(":/images/library/ic_library_recordings.svg") { } RecordingFeature::~RecordingFeature() { @@ -32,7 +33,7 @@ QVariant RecordingFeature::title() { } QIcon RecordingFeature::getIcon() { - return QIcon(":/images/library/ic_library_recordings.svg"); + return m_icon; } TreeItemModel* RecordingFeature::getChildModel() { diff --git a/src/library/recording/recordingfeature.h b/src/library/recording/recordingfeature.h index 7ff7e43ac4..0e597ca5d3 100644 --- a/src/library/recording/recordingfeature.h +++ b/src/library/recording/recordingfeature.h @@ -49,6 +49,7 @@ class RecordingFeature : public LibraryFeature { FolderTreeModel m_childModel; const static QString m_sRecordingViewName; RecordingManager* m_pRecordingManager; + QIcon m_icon; }; #endif diff --git a/src/library/rhythmbox/rhythmboxfeature.cpp b/src/library/rhythmbox/rhythmboxfeature.cpp index 7a29de829d..370c7c276c 100644 --- a/src/library/rhythmbox/rhythmboxfeature.cpp +++ b/src/library/rhythmbox/rhythmboxfeature.cpp @@ -13,7 +13,8 @@ RhythmboxFeature::RhythmboxFeature(QObject* parent, TrackCollection* pTrackCollection) : BaseExternalLibraryFeature(parent, pTrackCollection), m_pTrackCollection(pTrackCollection), - m_cancelImport(false) { + m_cancelImport(false), + m_icon(":/images/library/ic_library_rhythmbox.svg") { QString tableName = "rhythmbox_library"; QString idColumn = "id"; QStringList columns; @@ -100,7 +101,7 @@ QVariant RhythmboxFeature::title() { } QIcon RhythmboxFeature::getIcon() { - return QIcon(":/images/library/ic_library_rhythmbox.svg"); + return m_icon; } TreeItemModel* RhythmboxFeature::getChildModel() { diff --git a/src/library/rhythmbox/rhythmboxfeature.h b/src/library/rhythmbox/rhythmboxfeature.h index b2649959b5..25ecb3d216 100644 --- a/src/library/rhythmbox/rhythmboxfeature.h +++ b/src/library/rhythmbox/rhythmboxfeature.h @@ -63,6 +63,7 @@ class RhythmboxFeature : public BaseExternalLibraryFeature { bool m_cancelImport; QSharedPointer<BaseTrackCache> m_trackSource; + QIcon m_icon; }; #endif // RHYTHMBOXFEATURE_H diff --git a/src/library/setlogfeature.cpp b/src/library/setlogfeature.cpp index c801727e08..9577aae9a5 100644 --- a/src/library/setlogfeature.cpp +++ b/src/library/setlogfeature.cpp @@ -18,7 +18,8 @@ SetlogFeature::SetlogFeature(QObject* parent, TrackCollection* pTrackCollection) : BasePlaylistFeature(parent, pConfig, pTrackCollection, "SETLOGHOME"), m_playlistId(-1), - m_libraryWidget(nullptr) { + m_libraryWidget(nullptr), + m_icon(":/images/library/ic_library_history.svg") { m_pPlaylistTableModel = new PlaylistTableModel(this, pTrackCollection, "mixxx.db.model.setlog", true); //show all tracks @@ -54,7 +55,7 @@ QVariant SetlogFeature::title() { } QIcon SetlogFeature::getIcon() { - return QIcon(":/images/library/ic_library_history.svg"); + return m_icon; } void SetlogFeature::bindWidget(WLibrary* libraryWidget, diff --git a/src/library/setlogfeature.h b/src/library/setlogfeature.h index 22833affa2..386ab0bd3f 100644 --- a/src/library/setlogfeature.h +++ b/src/library/setlogfeature.h @@ -50,6 +50,7 @@ public: QAction* m_pGetNewPlaylist; int m_playlistId; WLibrary* m_libraryWidget; + QIcon m_icon; }; #endif // SETLOGFEATURE_H diff --git a/src/library/traktor/traktorfeature.cpp b/src/library/traktor/traktorfeature.cpp index e14352f3fd..89d370fdc4 100644 --- a/src/library/traktor/traktorfeature.cpp +++ b/src/library/traktor/traktorfeature.cpp @@ -53,7 +53,8 @@ bool TraktorPlaylistModel::isColumnHiddenByDefault(int column) { TraktorFeature::TraktorFeature(QObject* parent, TrackCollection* pTrackCollection) : BaseExternalLibraryFeature(parent, pTrackCollection), m_pTrackCollection(pTrackCollection), - m_cancelImport(false) { + m_cancelImport(false), + m_icon(":/images/library/ic_library_traktor.svg") { QString tableName = "traktor_library"; QString idColumn = "id"; QStringList columns; @@ -120,7 +121,7 @@ QVariant TraktorFeature::title() { } QIcon TraktorFeature::getIcon() { - return QIcon(":/images/library/ic_library_traktor.svg"); + return m_icon; } bool TraktorFeature::isSupported() { diff --git a/src/library/traktor/traktorfeature.h b/src/library/traktor/traktorfeature.h index edf04e4266..82cfea26b9 100644 --- a/src/library/traktor/traktorfeature.h +++ b/src/library/traktor/traktorfeature.h @@ -80,6 +80,7 @@ class TraktorFeature : public BaseExternalLibraryFeature { QString m_title; QSharedPointer<BaseTrackCache> m_trackSource; + QIcon m_icon; }; #endif // TRAKTOR_FEATURE_H |