Skip to content

Commit

Permalink
dialog/dlgreplacecuecolor: Notify TrackDAO after DB change
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Mar 17, 2020
1 parent a5aa43c commit 7926008
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
7 changes: 7 additions & 0 deletions src/dialog/dlgreplacecuecolor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ void setButtonColor(QPushButton* button, const QColor& color) {

DlgReplaceCueColor::DlgReplaceCueColor(
UserSettingsPointer pConfig,
TrackDAO* pTrackDAO,
mixxx::DbConnectionPoolPtr dbConnectionPool,
QWidget* pParent)
: QDialog(pParent),
m_pConfig(pConfig),
m_pTrackDAO(pTrackDAO),
m_pDbConnectionPool(dbConnectionPool),
m_pNewColorMenu(new QMenu(this)),
m_pCurrentColorMenu(new QMenu(this)) {
Expand Down Expand Up @@ -102,6 +104,10 @@ DlgReplaceCueColor::DlgReplaceCueColor(
&QFutureWatcher<int>::finished,
this,
&DlgReplaceCueColor::slotDatabaseUpdated);
connect(this,
&DlgReplaceCueColor::databaseTracksChanged,
m_pTrackDAO,
&TrackDAO::databaseTracksChanged);

connect(buttonBox,
&QDialogButtonBox::clicked,
Expand Down Expand Up @@ -303,6 +309,7 @@ void DlgReplaceCueColor::updateCues(QSet<int> cueIds, QSet<TrackId> trackIds, mi
return;
}
transaction.commit();
emit databaseTracksChanged(trackIds);
}

void DlgReplaceCueColor::slotDatabaseUpdated() {
Expand Down
6 changes: 6 additions & 0 deletions src/dialog/dlgreplacecuecolor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <QSet>

#include "dialog/ui_dlgreplacecuecolordlg.h"
#include "library/dao/trackdao.h"
#include "preferences/usersettings.h"
#include "track/trackid.h"
#include "util/color/rgbcolor.h"
Expand All @@ -31,10 +32,14 @@ class DlgReplaceCueColor : public QDialog, public Ui::DlgReplaceCueColor {

DlgReplaceCueColor(
UserSettingsPointer pConfig,
TrackDAO* pTrackDAO,
mixxx::DbConnectionPoolPtr dbConnectionPool,
QWidget* pParent);
~DlgReplaceCueColor();

signals:
void databaseTracksChanged(QSet<TrackId> Trackids);

private slots:
void slotApply();
void slotDatabaseIdsSelected();
Expand All @@ -49,6 +54,7 @@ class DlgReplaceCueColor : public QDialog, public Ui::DlgReplaceCueColor {
void updateCues(QSet<int> cueIds, QSet<TrackId> trackIds, mixxx::RgbColor newColor);

const UserSettingsPointer m_pConfig;
const TrackDAO* m_pTrackDAO;
mixxx::DbConnectionPoolPtr m_pDbConnectionPool;
QMenu* m_pNewColorMenu;
QMenu* m_pCurrentColorMenu;
Expand Down
49 changes: 27 additions & 22 deletions src/mixxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,45 @@
#ifdef __LILV__
#include "effects/lv2/lv2backend.h"
#endif
#include "broadcast/broadcastmanager.h"
#include "control/controlpushbutton.h"
#include "controllers/controllermanager.h"
#include "controllers/keyboard/keyboardeventfilter.h"
#include "database/mixxxdb.h"
#include "library/coverartcache.h"
#include "library/library.h"
#include "library/library_preferences.h"
#include "library/trackcollection.h"
#include "library/trackcollectionmanager.h"
#include "controllers/controllermanager.h"
#include "controllers/keyboard/keyboardeventfilter.h"
#include "mixer/playerinfo.h"
#include "mixer/playermanager.h"
#include "preferences/settingsmanager.h"
#include "recording/recordingmanager.h"
#include "broadcast/broadcastmanager.h"
#include "skin/launchimage.h"
#include "skin/legacyskinparser.h"
#include "skin/skinloader.h"
#include "soundio/soundmanager.h"
#include "sources/soundsourceproxy.h"
#include "track/track.h"
#include "waveform/waveformwidgetfactory.h"
#include "waveform/visualsmanager.h"
#include "waveform/sharedglcontext.h"
#include "database/mixxxdb.h"
#include "util/compatibility.h"
#include "util/db/dbconnectionpooled.h"
#include "util/debug.h"
#include "util/experiment.h"
#include "util/font.h"
#include "util/logger.h"
#include "util/math.h"
#include "util/sandbox.h"
#include "util/screensaver.h"
#include "util/statsmanager.h"
#include "util/timer.h"
#include "util/time.h"
#include "util/timer.h"
#include "util/translations.h"
#include "util/version.h"
#include "control/controlpushbutton.h"
#include "util/sandbox.h"
#include "mixer/playerinfo.h"
#include "waveform/guitick.h"
#include "util/math.h"
#include "util/experiment.h"
#include "util/font.h"
#include "util/translations.h"
#include "skin/launchimage.h"
#include "preferences/settingsmanager.h"
#include "waveform/sharedglcontext.h"
#include "waveform/visualsmanager.h"
#include "waveform/waveformwidgetfactory.h"
#include "widget/wmainmenubar.h"
#include "util/compatibility.h"
#include "util/screensaver.h"
#include "util/logger.h"
#include "util/db/dbconnectionpooled.h"

#ifdef __VINYLCONTROL__
#include "vinylcontrol/vinylcontrolmanager.h"
Expand Down Expand Up @@ -465,7 +466,11 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
m_pPrefDlg->setWindowIcon(QIcon(":/images/mixxx_icon.svg"));
m_pPrefDlg->setHidden(true);

m_pReplaceCueColorDlg = new DlgReplaceCueColor(pConfig, m_pLibrary->dbConnectionPool(), this);
m_pReplaceCueColorDlg = new DlgReplaceCueColor(
pConfig,
&(m_pTrackCollectionManager->internalCollection()->getTrackDAO()),
m_pLibrary->dbConnectionPool(),
this);
m_pReplaceCueColorDlg->setHidden(true);

launchProgress(60);
Expand Down

0 comments on commit 7926008

Please sign in to comment.