summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2016-01-15 10:10:21 -0800
committerRJ Ryan <rryan@mixxx.org>2016-01-15 11:03:29 -0800
commit7c6987648c649b632c05fae6385c8a6d377875f5 (patch)
tree73cc11383fbc992344305010ba72d7a31c1af47e /src
parent0bb570394a0cec51861600145ab5f3077865e2cd (diff)
Move menu logic and VC/Passthrough/Mic checking out of MixxxMainWindow.
Drops 1000+ lines from mixxx.h/mixxx.cpp -- now they're "only" 1400 lines!
Diffstat (limited to 'src')
-rw-r--r--src/engine/enginedeck.cpp3
-rw-r--r--src/engine/enginedeck.h3
-rw-r--r--src/library/scanner/libraryscanner.h4
-rw-r--r--src/mixer/basetrackplayer.cpp39
-rw-r--r--src/mixer/basetrackplayer.h13
-rw-r--r--src/mixer/deck.cpp2
-rw-r--r--src/mixer/deck.h8
-rw-r--r--src/mixer/microphone.cpp17
-rw-r--r--src/mixer/microphone.h11
-rw-r--r--src/mixer/playermanager.cpp7
-rw-r--r--src/mixer/playermanager.h12
-rw-r--r--src/mixxx.cpp1265
-rw-r--r--src/mixxx.h200
-rw-r--r--src/shoutcast/shoutcastmanager.cpp5
-rw-r--r--src/shoutcast/shoutcastmanager.h3
-rw-r--r--src/vinylcontrol/vinylcontrolmanager.cpp28
-rw-r--r--src/vinylcontrol/vinylcontrolmanager.h7
-rw-r--r--src/widget/wmainmenubar.cpp692
-rw-r--r--src/widget/wmainmenubar.h92
19 files changed, 1118 insertions, 1293 deletions
diff --git a/src/engine/enginedeck.cpp b/src/engine/enginedeck.cpp
index f605c2eee6..8bf6432928 100644
--- a/src/engine/enginedeck.cpp
+++ b/src/engine/enginedeck.cpp
@@ -34,6 +34,7 @@ EngineDeck::EngineDeck(const ChannelHandleAndGroup& handle_group,
: EngineChannel(handle_group, defaultOrientation),
m_pConfig(pConfig),
m_pEngineEffectsManager(pEffectsManager ? pEffectsManager->getEngineEffectsManager() : NULL),
+ m_pInputConfigured(new ControlObject(ConfigKey(getGroup(), "input_enabled"))),
m_pPassing(new ControlPushButton(ConfigKey(getGroup(), "passthrough"))),
// Need a +1 here because the CircularBuffer only allows its size-1
// items to be held at once (it keeps a blank spot open persistently)
@@ -152,6 +153,7 @@ void EngineDeck::onInputConfigured(AudioInput input) {
qDebug() << "WARNING: EngineDeck connected to AudioInput for a non-vinylcontrol type!";
return;
}
+ m_pInputConfigured->set(1.0);
m_sampleBuffer = NULL;
}
@@ -161,6 +163,7 @@ void EngineDeck::onInputUnconfigured(AudioInput input) {
qDebug() << "WARNING: EngineDeck connected to AudioInput for a non-vinylcontrol type!";
return;
}
+ m_pInputConfigured->set(0.0);
m_sampleBuffer = NULL;
}
diff --git a/src/engine/enginedeck.h b/src/engine/enginedeck.h
index 8d6e753614..4ec27968d8 100644
--- a/src/engine/enginedeck.h
+++ b/src/engine/enginedeck.h
@@ -18,6 +18,8 @@
#ifndef ENGINEDECK_H
#define ENGINEDECK_H
+#include <QScopedPointer>
+
#include "configobject.h"
#include "controlobjectslave.h"
#include "controlpushbutton.h"
@@ -83,6 +85,7 @@ class EngineDeck : public EngineChannel, public AudioDestination {
ControlObjectSlave* m_pSampleRate;
// Begin vinyl passthrough fields
+ QScopedPointer<ControlObject> m_pInputConfigured;
ControlPushButton* m_pPassing;
const CSAMPLE* volatile m_sampleBuffer;
bool m_bPassthroughIsActive;
diff --git a/src/library/scanner/libraryscanner.h b/src/library/scanner/libraryscanner.h
index 2ae50b13de..648cbb11d5 100644
--- a/src/library/scanner/libraryscanner.h
+++ b/src/library/scanner/libraryscanner.h
@@ -55,13 +55,11 @@ class LibraryScanner : public QThread {
ConfigObject<ConfigValue>* pConfig);
virtual ~LibraryScanner();
+ public slots:
// Call from any thread to start a scan. Does nothing if a scan is already
// in progress.
void scan();
-
-
- public slots:
// Call from any thread to cancel the scan.
void slotCancel();
diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp
index 03ecc8bd5e..a28c60ec7a 100644
--- a/src/mixer/basetrackplayer.cpp
+++ b/src/mixer/basetrackplayer.cpp
@@ -14,6 +14,7 @@
#include "analyzer/analyzerqueue.h"
#include "util/sandbox.h"
#include "effects/effectsmanager.h"
+#include "vinylcontrol/defs_vinylcontrol.h"
BaseTrackPlayer::BaseTrackPlayer(QObject* pParent, const QString& group)
: BasePlayer(pParent, group) {
@@ -24,7 +25,7 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent,
EngineMaster* pMixingEngine,
EffectsManager* pEffectsManager,
EngineChannel::ChannelOrientation defaultOrientation,
- QString group,
+ const QString& group,
bool defaultMaster,
bool defaultHeadphones)
: BaseTrackPlayer(pParent, group),
@@ -44,6 +45,15 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(QObject* pParent,
m_pChannel = new EngineDeck(channelGroup, pConfig, pMixingEngine,
pEffectsManager, defaultOrientation);
+ m_pInputEnabled.reset(new ControlObjectSlave(group, "input_enabled", this));
+ m_pPassthroughEnabled.reset(new ControlObjectSlave(group, "passthrough", this));
+ m_pPassthroughEnabled->connectValueChanged(SLOT(slotPassthroughEnabled(double)));
+#ifdef __VINYLCONTROL__
+ m_pVinylControlEnabled.reset(new ControlObjectSlave(group, "vinylcontrol_enabled", this));
+ m_pVinylControlEnabled->connectValueChanged(SLOT(slotVinylControlEnabled(double)));
+ m_pVinylControlStatus.reset(new ControlObjectSlave(group, "vinylcontrol_status", this));
+#endif
+
EngineBuffer* pEngineBuffer = m_pChannel->getEngineBuffer();
pMixingEngine->addChannel(m_pChannel);
@@ -335,3 +345,30 @@ void BaseTrackPlayerImpl::setupEqControls() {
m_pSpeed = new ControlObjectSlave(group, "rate", this);
m_pPitchAdjust = new ControlObjectSlave(group, "pitch_adjust", this);
}
+
+void BaseTrackPlayerImpl::slotPassthroughEnabled(double v) {
+ bool configured = m_pInputEnabled->toBool();
+ bool passthrough = v > 0.0;
+
+ // Warn the user if they try to enable passthrough on a player with no
+ // configured input.
+ if (!configured && passthrough) {
+ m_pPassthroughEnabled->set(0.0);
+ emit(noPassthroughInputConfigured());
+ }
+}
+
+void BaseTrackPlayerImpl::slotVinylControlEnabled(double v) {
+#ifdef __VINYLCONTROL__
+ bool configured = m_pInputEnabled->toBool();
+ bool vinylcontrol_enabled = v > 0.0;
+
+ // Warn the user if they try to enable vinyl control on a player with no
+ // configured input.
+ if (!configured && vinylcontrol_enabled) {
+ m_pVinylControlEnabled->set(0.0);
+ m_pVinylControlStatus->set(VINYL_STATUS_DISABLED);
+ emit(noVinylControlInputConfigured());
+ }
+#endif
+}
diff --git a/src/mixer/basetrackplayer.h b/src/mixer/basetrackplayer.h
index 52e168afe6..8225dce24a 100644
--- a/src/mixer/basetrackplayer.h
+++ b/src/mixer/basetrackplayer.h
@@ -2,6 +2,7 @@
#define MIXER_BASETRACKPLAYER_H
#include <QObject>
+#include <QScopedPointer>
#include <QString>
#include "configobject.h"
@@ -41,6 +42,8 @@ class BaseTrackPlayer : public BasePlayer {
void loadTrackFailed(TrackPointer pTrack);
void newTrackLoaded(TrackPointer pLoadedTrack);
void unloadingTrack(TrackPointer pAboutToBeUnloaded);
+ void noPassthroughInputConfigured();
+ void noVinylControlInputConfigured();
};
class BaseTrackPlayerImpl : public BaseTrackPlayer {
@@ -51,7 +54,7 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
EngineMaster* pMixingEngine,
EffectsManager* pEffectsManager,
EngineChannel::ChannelOrientation defaultOrientation,
- QString group,
+ const QString& group,
bool defaultMaster,
bool defaultHeadphones);
virtual ~BaseTrackPlayerImpl();
@@ -72,6 +75,10 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
void slotSetReplayGain(Mixxx::ReplayGain replayGain);
void slotPlayToggled(double);
+ private slots:
+ void slotPassthroughEnabled(double v);
+ void slotVinylControlEnabled(double v);
+
private:
ConfigObject<ConfigValue>* m_pConfig;
TrackPointer m_pLoadedTrack;
@@ -100,6 +107,10 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
ControlObjectSlave* m_pPreGain;
ControlObjectSlave* m_pSpeed;
ControlObjectSlave* m_pPitchAdjust;
+ QScopedPointer<ControlObjectSlave> m_pInputEnabled;
+ QScopedPointer<ControlObjectSlave> m_pPassthroughEnabled;
+ QScopedPointer<ControlObjectSlave> m_pVinylControlEnabled;
+ QScopedPointer<ControlObjectSlave> m_pVinylControlStatus;
EngineDeck* m_pChannel;
bool m_replaygainPending;
diff --git a/src/mixer/deck.cpp b/src/mixer/deck.cpp
index 3b05c986dd..6f47274fad 100644
--- a/src/mixer/deck.cpp
+++ b/src/mixer/deck.cpp
@@ -5,7 +5,7 @@ Deck::Deck(QObject* pParent,
EngineMaster* pMixingEngine,
EffectsManager* pEffectsManager,
EngineChannel::ChannelOrientation defaultOrientation,
- QString group) :
+ const QString& group) :
BaseTrackPlayerImpl(pParent, pConfig, pMixingEngine, pEffectsManager,
defaultOrientation, group, true, false) {
}
diff --git a/src/mixer/deck.h b/src/mixer/deck.h
index af194f3c9f..0a7f86b294 100644
--- a/src/mixer/deck.h
+++ b/src/mixer/deck.h
@@ -1,5 +1,5 @@
-#ifndef DECK_H
-#define DECK_H
+#ifndef MIXER_DECK_H
+#define MIXER_DECK_H
#include <QObject>
@@ -13,8 +13,8 @@ class Deck : public BaseTrackPlayerImpl {
EngineMaster* pMixingEngine,
EffectsManager* pEffectsManager,
EngineChannel::ChannelOrientation defaultOrientation,
- QString group);
+ const QString& group);
virtual ~Deck();
};
-#endif // DECK_H
+#endif // MIXER_DECK_H
diff --git a/src/mixer/microphone.cpp b/src/mixer/microphone.cpp
index 701a48a707..404a644894 100644
--- a/src/mixer/microphone.cpp
+++ b/src/mixer/microphone.cpp
@@ -1,5 +1,6 @@
#include "mixer/microphone.h"
+#include "controlobjectslave.h"
#include "engine/enginemaster.h"
#include "engine/enginemicrophone.h"
#include "soundio/soundmanager.h"
@@ -15,7 +16,23 @@ Microphone::Microphone(QObject* pParent, const QString& group, int index,
pEngine->addChannel(pMicrophone);
AudioInput micInput = AudioInput(AudioPath::MICROPHONE, 0, 0, index);
pSoundManager->registerInput(micInput, pMicrophone);
+
+ m_pInputEnabled.reset(new ControlObjectSlave(group, "enabled", this));
+ m_pTalkoverEnabled.reset(new ControlObjectSlave(group, "talkover", this));
+ m_pTalkoverEnabled->connectValueChanged(SLOT(slotTalkoverEnabled(double)));
}
Microphone::~Microphone() {
}
+
+void Microphone::slotTalkoverEnabled(double v) {
+ bool configured = m_pInputEnabled->toBool();
+ bool talkover = v > 0.0;
+
+ // Warn the user if they try to enable talkover on a microphone with no
+ // configured input.
+ if (!configured && talkover) {
+ m_pTalkoverEnabled->set(0.0);
+ emit(noMicrophoneInputConfigured());
+ }
+}
diff --git a/src/mixer/microphone.h b/src/mixer/microphone.h
index ea76367706..72f2921184 100644
--- a/src/mixer/microphone.h
+++ b/src/mixer/microphone.h
@@ -2,10 +2,12 @@
#define MIXER_MICROPHONE_H
#include <QObject>
+#include <QScopedPointer>
#include <QString>
#include "mixer/baseplayer.h"
+class ControlObjectSlave;
class EffectsManager;
class EngineMaster;
class SoundManager;
@@ -21,6 +23,15 @@ class Microphone : public BasePlayer {
EffectsManager* pEffectsManager);
virtual ~Microphone();
+ signals:
+ void noMicrophoneInputConfigured();
+
+ private slots:
+ void slotTalkoverEnabled(double v);
+
+ private:
+ QScopedPointer<ControlObjectSlave> m_pInputEnabled;
+ QScopedPointer<ControlObjectSlave> m_pTalkoverEnabled;
};
#endif /* MIXER_MICROPHONE_H */
diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp
index ae4481ea05..a408ee01da 100644
--- a/src/mixer/playermanager.cpp
+++ b/src/mixer/playermanager.cpp
@@ -337,6 +337,11 @@ void PlayerManager::addDeckInner() {
Deck* pDeck = new Deck(this, m_pConfig, m_pEngine, m_pEffectsManager,
orientation, group);
+ connect(pDeck, SIGNAL(noPassthroughInputConfigured()),
+ this, SIGNAL(noDeckPassthroughInputConfigured()));
+ connect(pDeck, SIGNAL(noVinylControlInputConfigured()),
+ this, SIGNAL(noVinylControlInputConfigured()));
+
if (m_pAnalyzerQueue) {
connect(pDeck, SIGNAL(newTrackLoaded(TrackPointer)),
m_pAnalyzerQueue, SLOT(slotAnalyseTrack(TrackPointer)));
@@ -440,6 +445,8 @@ void PlayerManager::addMicrophoneInner() {
QString group = groupForMicrophone(index);
Microphone* pMicrophone = new Microphone(this, group, index, m_pSoundManager,
m_pEngine, m_pEffectsManager);
+ connect(pMicrophone, SIGNAL(noMicrophoneInputConfigured()),
+ this, SIGNAL(noMicrophoneInputConfigured()));
m_microphones.append(pMicrophone);
}
diff --git a/src/mixer/playermanager.h b/src/mixer/playermanager.h
index 19ed303b2d..a9c05838ff 100644
--- a/src/mixer/playermanager.h
+++ b/src/mixer/playermanager.h
@@ -191,6 +191,18 @@ class PlayerManager : public QObject, public PlayerManagerInterface {
signals:
void loadLocationToPlayer(QString location, QString group);
+ // Emitted when the user tries to enable a microphone talkover control when
+ // there is no input configured.
+ void noMicrophoneInputConfigured();
+
+ // Emitted when the user tries to enable deck passthrough when there is no
+ // input configured.
+ void noDeckPassthroughInputConfigured();
+
+ // Emitted when the user tries to enable vinyl control when there is no
+ // input configured.
+ void noVinylControlInputConfigured();
+
private:
TrackPointer lookupTrack(QString location);
// Must hold m_mutex before calling this method. Internal method that
diff --git a/src/mixxx.cpp b/src/mixxx.cpp
index 11d2988204..59e5e313bf 100644
--- a/src/mixxx.cpp
+++ b/src/mixxx.cpp
@@ -15,38 +15,29 @@
* *
***************************************************************************/
-#include <QtDebug>
-#include <QMenu>
-#include <QMenuBar>
-#include <QFileDialog>
-#include <QDesktopWidget>
+#include "mixxx.h"
+
#include <QDesktopServices>
+#include <QDesktopWidget>
+#include <QFileDialog>
+#include <QGLWidget>
#include <QUrl>
-
-#include "mixxx.h"
+#include <QtDebug>
#include "analyzer/analyzerqueue.h"
-#include "controlpotmeter.h"
-#include "controlobjectslave.h"
-#include "defs_urls.h"
#include "dlgabout.h"
#include "dlgpreferences.h"
-#include "dlgprefeq.h"
#include "dlgdevelopertools.h"
#include "engine/enginemaster.h"
-#include "engine/enginemicrophone.h"
#include "effects/effectsmanager.h"
#include "effects/native/nativebackend.h"
-#include "engine/engineaux.h"
#include "library/coverartcache.h"
#include "library/library.h"
#include "library/library_preferences.h"
#include "library/scanner/libraryscanner.h"
-#include "library/librarytablemodel.h"
#include "controllers/controllermanager.h"
#include "mixxxkeyboard.h"
#include "mixer/playermanager.h"
-#include "recording/defs_recording.h"
#include "recording/recordingmanager.h"
#include "shoutcast/shoutcastmanager.h"
#include "skin/legacyskinparser.h"
@@ -55,9 +46,6 @@
#include "soundsourceproxy.h"
#include "trackinfoobject.h"
#include "waveform/waveformwidgetfactory.h"
-#include "widget/wwaveformviewer.h"
-#include "widget/wwidget.h"
-#include "widget/wspinny.h"
#include "waveform/sharedglcontext.h"
#include "util/debug.h"
#include "util/statsmanager.h"
@@ -75,9 +63,9 @@
#include "util/translations.h"
#include "skin/launchimage.h"
#include "preferences/settingsmanager.h"
+#include "widget/wmainmenubar.h"
#ifdef __VINYLCONTROL__
-#include "vinylcontrol/defs_vinylcontrol.h"
#include "vinylcontrol/vinylcontrolmanager.h"
#endif
@@ -91,36 +79,53 @@ const int MixxxMainWindow::kMicrophoneCount = 4;
const int MixxxMainWindow::kAuxiliaryCount = 4;
MixxxMainWindow::MixxxMainWindow(QApplication* pApp, const CmdlineArgs& args)
- : m_pWidgetParent(NULL),
+ : m_pWidgetParent(nullptr),
+ m_pLaunchImage(nullptr),
m_pSettingsManager(nullptr),
- m_pSoundManager(NULL),
- m_pRecordingManager(NULL),
+ m_pEffectsManager(nullptr),
+ m_pEngine(nullptr),
+ m_pSkinLoader(nullptr),
+ m_pSoundManager(nullptr),
+ m_pPlayerManager(nullptr),
+ m_pRecordingManager(nullptr),
#ifdef __SHOUTCAST__
- m_pShoutcastManager(NULL),
+ m_pShoutcastManager(nullptr),
#endif
- m_pControllerManager(NULL),
- m_pDeveloperToolsDlg(NULL),
+ m_pControllerManager(nullptr),
+ m_pGuiTick(nullptr),
#ifdef __VINYLCONTROL__
- m_pShowVinylControl(NULL),
+ m_pVCManager(nullptr),
#endif
- m_pShowSamplers(NULL),
- m_pShowMicrophone(NULL),
- m_pShowPreviewDeck(NULL),
- m_pShowEffects(NULL),
- m_pShowCoverArt(NULL),
-
- m_pPrefDlg(NULL),
+ m_pKeyboard(nullptr),
+ m_pLibraryScanner(nullptr),
+ m_pLibrary(nullptr),
+ m_pMenuBar(nullptr),
+ m_pDeveloperToolsDlg(nullptr),
+ m_pPrefDlg(nullptr),
+ m_NativeMenuBarSupport(false),
+ m_pKbdConfig(nullptr),
+ m_pKbdConfigEmpty(nullptr),
+ m_toolTipsCfg(1), // TODO(rryan); enum
m_runtime_timer("MixxxMainWindow::runtime"),
m_cmdLineArgs(args),
- m_iNumConfiguredDecks(0) {
+ m_pTouchShift(nullptr) {
+ m_runtime_timer.start();
+ Time::start();
+
Version::logBuildDetails();
+ // Only record stats in developer mode.
+ if (m_cmdLineArgs.getDeveloper()) {
+ StatsManager::create();
+ }
+
+ m_pSettingsManager = new SettingsManager(this, args.getSettingsPath());
+
+ initializeKeyboard();
initMenuBar();
initializeWindow();
- m_pSettingsManager = new SettingsManager(this, args.getSettingsPath());
-
// First load launch image to show a the user a quick responds
m_pSkinLoader = new SkinLoader(m_pSettingsManager->settings().data());
m_pLaunchImage = m_pSkinLoader->loadLaunchImage(this);
@@ -147,6 +152,8 @@ MixxxMainWindow::~MixxxMainWindow() {
}
void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
+ ScopedTimer t("MixxxMainWindow::initialize");
+
// Register custom data types for signal processing
qRegisterMetaType<TrackId>("TrackId");
qRegisterMetaType<QSet<TrackId>>("QSet<TrackId>");
@@ -154,19 +161,10 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
qRegisterMetaType<Mixxx::ReplayGain>("Mixxx::ReplayGain");
qRegisterMetaType<Mixxx::Bpm>("Mixxx::Bpm");
- ScopedTimer t("MixxxMainWindow::MixxxMainWindow");
- m_runtime_timer.start();
- Time::start();
-
UserSettingsPointer pConfig = m_pSettingsManager->settings();
Sandbox::initialize(QDir(pConfig->getSettingsPath()).filePath("sandbox.cfg"));
- // Only record stats in developer mode.
- if (m_cmdLineArgs.getDeveloper()) {
- StatsManager::create();
- }
-
QString resourcePath = pConfig->getResourcePath();
mixxx::Translations::initializeTranslations(
@@ -206,24 +204,31 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
m_pSoundManager = new SoundManager(pConfig.data(), m_pEngine);
m_pRecordingManager = new RecordingManager(pConfig.data(), m_pEngine);
+ connect(m_pRecordingManager, SIGNAL(isRecording(bool)),
+ m_pMenuBar, SLOT(onRecordingStateChange(bool)));
+ connect(m_pMenuBar, SIGNAL(toggleRecording(bool)),
+ m_pRecordingManager, SLOT(slotSetRecording(bool)));
+ m_pMenuBar->onRecordingStateChange(m_pRecordingManager->isRecordingActive());
#ifdef __SHOUTCAST__
m_pShoutcastManager = new ShoutcastManager(pConfig.data(), m_pSoundManager);
+ connect(m_pShoutcastManager, SIGNAL(shoutcastEnabled(bool)),
+ m_pMenuBar, SLOT(onBroadcastingStateChange(bool)));
+ connect(m_pMenuBar, SIGNAL(toggleBroadcasting(bool)),
+ m_pShoutcastManager, SLOT(setEnabled(bool)));
+
+ m_pMenuBar->onBroadcastingStateChange(m_pShoutcastManager->isEnabled());
#endif
launchProgress(11);
- m_PassthroughMapper = new QSignalMapper(this);
- connect(m_PassthroughMapper, SIGNAL(mapped(int)),
- this, SLOT(slotControlPassthrough(int)));
-
- m_AuxiliaryMapper = new QSignalMapper(this);
- connect(m_AuxiliaryMapper, SIGNAL(mapped(int)),
- this, SLOT(slotControlAuxiliary(int)));
-
m_pGuiTick = new GuiTick();
#ifdef __VINYLCONTROL__
m_pVCManager = new VinylControlManager(this, pConfig.data(), m_pSoundManager);
+ connect(m_pMenuBar, SIGNAL(toggleVinylControl(int)),
+ m_pVCManager, SLOT(toggleVinylControl(int)));
+ connect(m_pVCManager, SIGNAL(vinylControlDeckEnabled(int, bool)),
+ m_pMenuBar, SLOT(onVinylControlDeckEnabledStateChange(int, bool)));
#else
m_pVCManager = NULL;
#endif
@@ -231,23 +236,19 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
// Create the player manager. (long)
m_pPlayerManager = new PlayerManager(pConfig.data(), m_pSoundManager,
m_pEffectsManager, m_pEngine);
+ connect(m_pPlayerManager, SIGNAL(noMicrophoneInputConfigured()),
+ this, SLOT(slotNoMicrophoneInputConfigured()));
+ connect(m_pPlayerManager, SIGNAL(noDeckPassthroughInputConfigured()),
+ this, SLOT(slotNoDeckPassthroughInputConfigured()));
+ connect(m_pPlayerManager, SIGNAL(noVinylControlInputConfigured()),
+ this, SLOT(slotNoVinylControlInputConfigured()));
+
for (int i = 0; i < kMicrophoneCount; ++i) {
m_pPlayerManager->addMicrophone();
}
for (int i = 0; i < kAuxiliaryCount; ++i) {
m_pPlayerManager->addAuxiliary();
- QString group = PlayerManager::groupForAuxiliary(i);
- m_pAuxiliaryPassthrough.push_back(
- new ControlObjectSlave(group, "passthrough"));
- ControlObjectSlave* auxiliary_passthrough =
- m_pAuxiliaryPassthrough.back();
-
- // These non-vinyl passthrough COs have their index offset by the max
- // number of vinyl inputs.
- m_AuxiliaryMapper->setMapping(auxiliary_passthrough, i);
- auxiliary_passthrough->connectValueChanged(m_AuxiliaryMapper,
- SLOT(map()));
}
m_pPlayerManager->addConfiguredDecks();
@@ -263,9 +264,6 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
m_pVCManager->init();
#endif
- m_pNumDecks = new ControlObjectSlave(ConfigKey("[Master]", "num_decks"));
- m_pNumDecks->connectValueChanged(this, SLOT(slotNumDecksChanged(double)));
-
#ifdef __MODPLUG__
// restore the configuration for the modplug library before trying to load a module
DlgPrefModplug* pModplugPrefs = new DlgPrefModplug(0, pConfig.data());
@@ -281,6 +279,10 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
m_pPlayerManager,
m_pRecordingManager);
m_pPlayerManager->bindToLibrary(m_pLibrary);
+ connect(m_pMenuBar, SIGNAL(createCrate()),
+ m_pLibrary, SLOT(slotCreateCrate()));
+ connect(m_pMenuBar, SIGNAL(createPlaylist()),
+ m_pLibrary, SLOT(slotCreatePlaylist()));
launchProgress(35);
@@ -323,8 +325,6 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
launchProgress(52);
connect(this, SIGNAL(newSkinLoaded()),
- this, SLOT(onNewSkinLoaded()));
- connect(this, SIGNAL(newSkinLoaded()),
m_pLibrary, SLOT(onSkinLoadFinished()));
// Initialize preference dialog
@@ -336,10 +336,6 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
launchProgress(60);
- initializeKeyboard();
- initActions();
- populateMenuBar(); // already inited in the constructor
-
// Before creating the first skin we need to create a QGLWidget so that all
// the QGLWidget's we create can use it as a shared QGLContext.
QGLWidget* pContextWidget = new QGLWidget(this);
@@ -408,11 +404,20 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
// Scan the library directory. Initialize this after the skinloader has
// loaded a skin, see Bug #1047435
+ // TODO(rryan): Move LibraryScanner into Library.
m_pLibraryScanner = new LibraryScanner(this,
m_pLibrary->getTrackCollection(),
pConfig.data());
+ connect(m_pLibraryScanner, SIGNAL(scanStarted()),
+ this, SIGNAL(libraryScanStarted()));
+ connect(m_pLibraryScanner, SIGNAL(scanFinished()),
+ this, SIGNAL(libraryScanFinished()));
+ connect(m_pLibraryScanner, SIGNAL(scanStarted()),
+ m_pMenuBar, SLOT(onLibraryScanStarted()));
connect(m_pLibraryScanner, SIGNAL(scanFinished()),
- this, SLOT(slotEnableRescanLibraryAction()));
+ m_pMenuBar, SLOT(onLibraryScanFinished()));
+ connect(m_pMenuBar, SIGNAL(rescanLibrary()),
+ m_pLibraryScanner, SLOT(scan()));
// Refresh the library models when the library (re)scan is finished.
connect(m_pLibraryScanner, SIGNAL(scanFinished()),
@@ -421,7 +426,6 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
if (rescan || hasChanged_MusicDir || m_pSettingsManager->shouldRescanLibrary()) {
m_pLibraryScanner->scan();
}
- slotNumDecksChanged(m_pNumDecks->get());
// Try open player device If that fails, the preference panel is opened.
int setupDevices = m_pSoundManager->setupDevices();
@@ -498,13 +502,7 @@ void MixxxMainWindow::finalize() {
// (vinylcontrol_enabled in VinylControlControl)
qDebug() << "delete vinylcontrolmanager " << qTime.elapsed();
delete m_pVCManager;
- qDeleteAll(m_pVinylControlEnabled);
- delete m_VCControlMapper;
- delete m_VCCheckboxMapper;
#endif
- delete m_PassthroughMapper;
- delete m_AuxiliaryMapper;
- delete m_TalkoverMapper;
// LibraryScanner depends on Library
qDebug() << "delete library scanner " << qTime.elapsed();
@@ -533,12 +531,6 @@ void MixxxMainWindow::finalize() {
delete m_pShoutcastManager;
#endif
- // Delete ControlObjectSlaves we created for checking passthrough and
- // talkover status.
- qDeleteAll(m_pAuxiliaryPassthrough);
- qDeleteAll(m_pPassthroughEnabled);
- qDeleteAll(m_micTalkoverControls);
-
// EngineMaster depends on Config and m_pEffectsManager.
qDebug() << "delete m_pEngine " << qTime.elapsed();
delete m_pEngine;
@@ -557,14 +549,6 @@ void MixxxMainWindow::finalize() {
delete m_pGuiTick;
- delete m_pShowVinylControl;
- delete m_pShowSamplers;
- delete m_pShowMicrophone;
- delete m_pShowPreviewDeck;
- delete m_pShowEffects;
- delete m_pShowCoverArt;
- delete m_pNumDecks;
-
// Check for leaked ControlObjects and give warnings.
QList<QSharedPointer<ControlDoublePrivate> > leakedControls;
QList<ConfigKey> leakedConfigKeys;
@@ -624,6 +608,7 @@ void MixxxMainWindow::finalize() {
void MixxxMainWindow::initializeWindow() {
// be sure initMenuBar() is called first
+ DEBUG_ASSERT(m_pMenuBar != nullptr);
QPalette Pal(palette());
// safe default QMenuBar background
@@ -685,131 +670,7 @@ void MixxxMainWindow::initializeKeyboard() {
m_pKeyboard = new MixxxKeyboard(keyboardShortcutsEnabled ? m_pKbdConfig : m_pKbdConfigEmpty);
}
-void toggleVisibility(ConfigKey key, bool enable) {
- qDebug() << "Setting visibility for" << key.group << key.item << enable;
- ControlObject::set(key, enable ? 1.0 : 0.0);
-}
-
-void MixxxMainWindow::slotViewShowSamplers(bool enable) {
- toggleVisibility(ConfigKey("[Samplers]", "show_samplers"), enable);
-}
-
-void MixxxMainWindow::slotViewShowVinylControl(bool enable) {
- toggleVisibility(ConfigKey(VINYL_PREF_KEY, "show_vinylcontrol"), enable);
-}
-
-void MixxxMainWindow::slotViewShowMicrophone(bool enable) {
- toggleVisibility(ConfigKey("[Microphone]", "show_microphone"), enable);
-}
-
-void MixxxMainWindow::slotViewShowPreviewDeck(bool enable) {
- toggleVisibility(ConfigKey("[PreviewDeck]", "show_previewdeck"), enable);
-}
-
-void MixxxMainWindow::slotViewShowEffects(bool enable) {
- toggleVisibility(ConfigKey("[EffectRack1]", "show"), enable);
-}
-
-void MixxxMainWindow::slotViewShowCoverArt(bool enable) {
- toggleVisibility(ConfigKey("[Library]", "show_coverart"), enable);
-}
-
-void MixxxMainWindow::slotViewMaximizeLibrary(bool enable) {
- toggleVisibility(ConfigKey("[Master]", "maximize_library"), enable);
-}
-
-void setVisibilityOptionState(QAction* pAction, ConfigKey key) {
- ControlObject* pVisibilityControl = ControlObject::getControl(key);
- pAction->setEnabled(pVisibilityControl != NULL);
- pAction->setChecked(pVisibilityControl != NULL ? pVisibilityControl->get() > 0.0 : false);
-}
-
-void MixxxMainWindow::updateCheckedMenuAction(QAction* menuAction, ConfigKey key) {
- menuAction->blockSignals(true);
- menuAction->setChecked(ControlObject::get(key));
- menuAction->blockSignals(false);
-}
-
-void MixxxMainWindow::slotToggleCheckedVinylControl() {
- ConfigKey key(VINYL_PREF_KEY, "show_vinylcontrol");
- updateCheckedMenuAction(m_pViewVinylControl, key);
-}
-
-void MixxxMainWindow::slotToggleCheckedSamplers() {
- ConfigKey key("[Samplers]", "show_samplers");
- updateCheckedMenuAction(m_pViewShowSamplers, key);
-}
-
-void MixxxMainWindow::slotToggleCheckedMicrophone() {
- ConfigKey key("[Microphone]", "show_microphone");
- updateCheckedMenuAction(m_pViewShowMicrophone, key);
-}
-
-void MixxxMainWindow::slotToggleCheckedPreviewDeck() {
- ConfigKey key("[PreviewDeck]", "show_previewdeck");
- updateCheckedMenuAction(m_pViewShowPreviewDeck, key);
-}
-
-void MixxxMainWindow::slotToggleCheckedEffects() {
- ConfigKey key("[EffectRack1]", "show");
- updateCheckedMenuAction(m_pViewShowEffects, key);
-}
-
-void MixxxMainWindow::slotToggleCheckedCoverArt() {
- ConfigKey key("[Library]", "show_coverart");
- updateCheckedMenuAction(m_pViewShowCoverArt, key);
-}
-
-void MixxxMainWindow::linkSkinWidget(ControlObjectSlave** pCOS,
- ConfigKey key, const char* slot) {
- if (!*pCOS) {
- *pCOS = new ControlObjectSlave(key, this);
- (*pCOS)->connectValueChanged(slot);
- }
-}
-
-void MixxxMainWindow::onNewSkinLoaded() {
-#ifdef __VINYLCONTROL__
- setVisibilityOptionState(m_pViewVinylControl,
- ConfigKey(VINYL_PREF_KEY, "show_vinylcontrol"));
-#endif
- setVisibilityOptionState(m_pViewShowSamplers,
- ConfigKey("[Samplers]", "show_samplers"));
- setVisibilityOptionState(m_pViewShowMicrophone,<