302
307
m_pRecordingManager);
303
308
qRegisterMetaType<TrackPointer>("TrackPointer");
305
// Create the player manager.
306
m_pPlayerManager = new PlayerManager(m_pConfig, m_pEngine, m_pLibrary);
307
m_pPlayerManager->addDeck();
308
m_pPlayerManager->addDeck();
309
m_pPlayerManager->addDeck();
310
m_pPlayerManager->addDeck();
311
m_pPlayerManager->addSampler();
312
m_pPlayerManager->addSampler();
313
m_pPlayerManager->addSampler();
314
m_pPlayerManager->addSampler();
316
// register the engine's outputs
317
m_pSoundManager->registerOutput(AudioOutput(AudioOutput::MASTER),
319
m_pSoundManager->registerOutput(AudioOutput(AudioOutput::HEADPHONES),
321
for (unsigned int deck = 0; deck < m_pPlayerManager->numDecks(); ++deck) {
322
// TODO(bkgood) make this look less dumb by putting channelBase after
323
// index in the AudioOutput() params
324
m_pSoundManager->registerOutput(
325
AudioOutput(AudioOutput::DECK, 0, deck), m_pEngine);
328
310
#ifdef __VINYLCONTROL__
329
311
m_pVCManager = new VinylControlManager(this, m_pConfig);
330
for (unsigned int deck = 0; deck < m_pPlayerManager->numDecks(); ++deck) {
331
m_pSoundManager->registerInput(
332
AudioInput(AudioInput::VINYLCONTROL, 0, deck),
336
313
m_pVCManager = NULL;
339
//Scan the library directory.
340
m_pLibraryScanner = new LibraryScanner(m_pLibrary->getTrackCollection());
342
//Refresh the library models when the library (re)scan is finished.
343
connect(m_pLibraryScanner, SIGNAL(scanFinished()),
344
m_pLibrary, SLOT(slotRefreshLibraryModels()));
346
//Scan the library for new files and directories
347
bool rescan = (bool)m_pConfig->getValueString(ConfigKey("[Library]","RescanOnStartup")).toInt();
348
// rescan the library if we get a new plugin
349
QSet<QString> prev_plugins = QSet<QString>::fromList(m_pConfig->getValueString(
350
ConfigKey("[Library]", "SupportedFileExtensions")).split(",", QString::SkipEmptyParts));
351
QSet<QString> curr_plugins = QSet<QString>::fromList(
352
SoundSourceProxy::supportedFileExtensions());
353
rescan = rescan || (prev_plugins != curr_plugins);
355
if(rescan || hasChanged_MusicDir){
356
m_pLibraryScanner->scan(
357
m_pConfig->getValueString(ConfigKey("[Playlist]", "Directory")));
358
qDebug() << "Rescan finished";
360
m_pConfig->set(ConfigKey("[Library]", "SupportedFileExtensions"),
361
QStringList(SoundSourceProxy::supportedFileExtensions()).join(","));
316
// Create the player manager.
317
m_pPlayerManager = new PlayerManager(m_pConfig, m_pSoundManager, m_pEngine,
318
m_pLibrary, m_pVCManager);
319
m_pPlayerManager->addDeck();
320
m_pPlayerManager->addDeck();
321
m_pPlayerManager->addSampler();
322
m_pPlayerManager->addSampler();
323
m_pPlayerManager->addSampler();
324
m_pPlayerManager->addSampler();
363
326
// Call inits to invoke all other construction parts
507
473
// Wait until all other ControlObjects are set up
508
474
// before initializing controllers
509
475
m_pControllerManager->setUpDevices();
477
// Scan the library for new files and directories
478
bool rescan = (bool)m_pConfig->getValueString(ConfigKey("[Library]","RescanOnStartup")).toInt();
479
// rescan the library if we get a new plugin
480
QSet<QString> prev_plugins = QSet<QString>::fromList(m_pConfig->getValueString(
481
ConfigKey("[Library]", "SupportedFileExtensions")).split(",", QString::SkipEmptyParts));
482
QSet<QString> curr_plugins = QSet<QString>::fromList(
483
SoundSourceProxy::supportedFileExtensions());
484
rescan = rescan || (prev_plugins != curr_plugins);
485
m_pConfig->set(ConfigKey("[Library]", "SupportedFileExtensions"),
486
QStringList(SoundSourceProxy::supportedFileExtensions()).join(","));
488
// Scan the library directory. Initialize this after the skinloader has
489
// loaded a skin, see Bug #1047435
490
m_pLibraryScanner = new LibraryScanner(m_pLibrary->getTrackCollection());
491
connect(m_pLibraryScanner, SIGNAL(scanFinished()),
492
this, SLOT(slotEnableRescanLibraryAction()));
494
//Refresh the library models when the library (re)scan is finished.
495
connect(m_pLibraryScanner, SIGNAL(scanFinished()),
496
m_pLibrary, SLOT(slotRefreshLibraryModels()));
498
if (rescan || hasChanged_MusicDir) {
499
m_pLibraryScanner->scan(
500
m_pConfig->getValueString(ConfigKey("[Playlist]", "Directory")));
501
qDebug() << "Rescan finished";
512
505
MixxxApp::~MixxxApp()
547
533
m_pControllerManager->shutdown();
548
534
delete m_pControllerManager;
550
// PlayerManager depends on Engine, Library, and Config
536
// PlayerManager depends on Engine, Library, SoundManager, VinylControlManager, and Config
551
537
qDebug() << "delete playerManager " << qTime.elapsed();
552
538
delete m_pPlayerManager;
540
#ifdef __VINYLCONTROL__
541
// VinylControlManager depends on a CO the engine owns
542
// (vinylcontrol_enabled in VinylControlControl)
543
qDebug() << "delete vinylcontrolmanager " << qTime.elapsed();
554
547
// EngineMaster depends on Config
555
548
qDebug() << "delete m_pEngine " << qTime.elapsed();
556
549
delete m_pEngine;
606
599
qDebug() << "~MixxxApp: All leaking controls deleted.";
608
601
delete m_pKeyboard;
602
delete m_pKbdConfigEmpty;
604
WaveformWidgetFactory::destroy();
607
void toggleVisibility(ConfigKey key, bool enable) {
608
ControlObject* pShowControl = ControlObject::getControl(key);
609
if (pShowControl == NULL) {
612
qDebug() << "Setting visibility for" << key.group << key.item << enable;
613
pShowControl->set(enable ? 1.0 : 0.0);
616
void MixxxApp::slotViewShowSamplers(bool enable) {
617
toggleVisibility(ConfigKey("[Samplers]", "show_samplers"), enable);
620
void MixxxApp::slotViewShowVinylControl(bool enable) {
621
toggleVisibility(ConfigKey("[Vinylcontrol]", "show_vinylcontrol"), enable);
624
void MixxxApp::slotViewShowMicrophone(bool enable) {
625
toggleVisibility(ConfigKey("[Microphone]", "show_microphone"), enable);
628
void setVisibilityOptionState(QAction* pAction, ConfigKey key) {
629
ControlObject* pVisibilityControl = ControlObject::getControl(key);
630
pAction->setEnabled(pVisibilityControl != NULL);
631
pAction->setChecked(pVisibilityControl != NULL ? pVisibilityControl->get() > 0.0 : false);
634
void MixxxApp::onNewSkinLoaded() {
635
setVisibilityOptionState(m_pViewVinylControl,
636
ConfigKey("[Vinylcontrol]", "show_vinylcontrol"));
637
setVisibilityOptionState(m_pViewShowSamplers,
638
ConfigKey("[Samplers]", "show_samplers"));
639
setVisibilityOptionState(m_pViewShowMicrophone,
640
ConfigKey("[Microphone]", "show_microphone"));
611
643
int MixxxApp::noSoundDlg(void)
776
808
m_pLibraryRescan->setCheckable(false);
777
809
connect(m_pLibraryRescan, SIGNAL(triggered()),
778
810
this, SLOT(slotScanLibrary()));
779
connect(m_pLibraryScanner, SIGNAL(scanFinished()),
780
this, SLOT(slotEnableRescanLibraryAction()));
782
812
QString createPlaylistTitle = tr("Add &New Playlist");
783
813
QString createPlaylistText = tr("Create a new playlist");
802
832
QString fullScreenTitle = tr("&Full Screen");
803
833
QString fullScreenText = tr("Display Mixxx using the full screen");
804
m_pOptionsFullScreen = new QAction(fullScreenTitle, this);
834
m_pViewFullScreen = new QAction(fullScreenTitle, this);
806
m_pOptionsFullScreen->setShortcut(QKeySequence(tr("Ctrl+Shift+F")));
836
m_pViewFullScreen->setShortcut(QKeySequence(tr("Ctrl+Shift+F")));
808
m_pOptionsFullScreen->setShortcut(QKeySequence(tr("F11")));
838
m_pViewFullScreen->setShortcut(QKeySequence(tr("F11")));
810
m_pOptionsFullScreen->setShortcutContext(Qt::ApplicationShortcut);
840
m_pViewFullScreen->setShortcutContext(Qt::ApplicationShortcut);
811
841
// QShortcut * shortcut = new QShortcut(QKeySequence(tr("Esc")), this);
812
842
// connect(shortcut, SIGNAL(triggered()), this, SLOT(slotQuitFullScreen()));
813
m_pOptionsFullScreen->setCheckable(true);
814
m_pOptionsFullScreen->setChecked(false);
815
m_pOptionsFullScreen->setStatusTip(fullScreenText);
816
m_pOptionsFullScreen->setWhatsThis(buildWhatsThis(fullScreenTitle, fullScreenText));
817
connect(m_pOptionsFullScreen, SIGNAL(toggled(bool)),
818
this, SLOT(slotOptionsFullScreen(bool)));
843
m_pViewFullScreen->setCheckable(true);
844
m_pViewFullScreen->setChecked(false);
845
m_pViewFullScreen->setStatusTip(fullScreenText);
846
m_pViewFullScreen->setWhatsThis(buildWhatsThis(fullScreenTitle, fullScreenText));
847
connect(m_pViewFullScreen, SIGNAL(toggled(bool)),
848
this, SLOT(slotViewFullScreen(bool)));
820
850
QString keyboardShortcutTitle = tr("Enable &Keyboard Shortcuts");
821
851
QString keyboardShortcutText = tr("Toggles keyboard shortcuts on or off");
932
962
this, SLOT(slotOptionsShoutcast(bool)));
965
QString mayNotBeSupported = tr("May not be supported on all skins.");
966
QString showSamplersTitle = tr("Show Sample Deck Widgets");
967
QString showSamplersText = tr("Show the sample deck section of the Mixxx interface.") +
968
" " + mayNotBeSupported;
969
m_pViewShowSamplers = new QAction(showSamplersTitle, this);
970
m_pViewShowSamplers->setCheckable(true);
971
m_pViewShowSamplers->setShortcut(tr("Ctrl+S"));
972
m_pViewShowSamplers->setStatusTip(showSamplersText);
973
m_pViewShowSamplers->setWhatsThis(buildWhatsThis(showSamplersTitle, showSamplersText));
974
connect(m_pViewShowSamplers, SIGNAL(toggled(bool)),
975
this, SLOT(slotViewShowSamplers(bool)));
977
QString showVinylControlTitle = tr("Show Vinyl Control Widgets");
978
QString showVinylControlText = tr("Show the vinyl control section of the Mixxx interface.") +
979
" " + mayNotBeSupported;
980
m_pViewVinylControl = new QAction(showVinylControlTitle, this);
981
m_pViewVinylControl->setCheckable(true);
982
m_pViewVinylControl->setShortcut(tr("Ctrl+V"));
983
m_pViewVinylControl->setStatusTip(showVinylControlText);
984
m_pViewVinylControl->setWhatsThis(buildWhatsThis(showVinylControlTitle, showVinylControlText));
985
connect(m_pViewVinylControl, SIGNAL(toggled(bool)),
986
this, SLOT(slotViewShowVinylControl(bool)));
988
QString showMicrophoneTitle = tr("Show Microphone Widgets");
989
QString showMicrophoneText = tr("Show the microphone section of the Mixxx interface.") +
990
" " + mayNotBeSupported;
991
m_pViewShowMicrophone = new QAction(showMicrophoneTitle, this);
992
m_pViewShowMicrophone->setCheckable(true);
993
m_pViewShowMicrophone->setShortcut(tr("Ctrl+M"));
994
m_pViewShowMicrophone->setStatusTip(showMicrophoneText);
995
m_pViewShowMicrophone->setWhatsThis(buildWhatsThis(showMicrophoneTitle, showMicrophoneText));
996
connect(m_pViewShowMicrophone, SIGNAL(toggled(bool)),
997
this, SLOT(slotViewShowMicrophone(bool)));
935
1001
QString recordTitle = tr("&Record Mix");
936
1002
QString recordText = tr("Record your mix to a file");
937
1003
m_pOptionsRecord = new QAction(recordTitle, this);
966
1032
m_pVinylControlMenu = new QMenu(tr("&Vinyl Control"), menuBar());
967
1033
m_pVinylControlMenu->addAction(m_pOptionsVinylControl);
968
1034
m_pVinylControlMenu->addAction(m_pOptionsVinylControl2);
969
1036
m_pOptionsMenu->addMenu(m_pVinylControlMenu);
1037
m_pOptionsMenu->addSeparator();
971
1040
m_pOptionsMenu->addAction(m_pOptionsRecord);
972
1041
#ifdef __SHOUTCAST__
973
1042
m_pOptionsMenu->addAction(m_pOptionsShoutcast);
975
1044
m_pOptionsMenu->addAction(m_pOptionsKeyboard);
976
m_pOptionsMenu->addAction(m_pOptionsFullScreen);
977
1045
m_pOptionsMenu->addSeparator();
978
1046
m_pOptionsMenu->addAction(m_pOptionsPreferences);
1426
1506
// mode. If you change skins while in fullscreen (on Linux, at least) the
1427
1507
// window returns to 0,0 but and the backdrop disappears so it looks as if
1428
1508
// it is not fullscreen, but acts as if it is.
1429
bool wasFullScreen = m_pOptionsFullScreen->isChecked();
1430
slotOptionsFullScreen(false);
1509
bool wasFullScreen = m_pViewFullScreen->isChecked();
1510
slotViewFullScreen(false);
1432
1512
//delete the view cause swaping central widget do not remove the old one !
1434
1514
delete m_pView;
1436
1516
m_pView = new QFrame();
1438
1518
// assignment in next line intentional
1489
1570
bool MixxxApp::eventFilter(QObject *obj, QEvent *event)
1491
static int tooltips =
1492
m_pConfig->getValueString(ConfigKey("[Controls]", "Tooltips")).toInt();
1494
1572
if (event->type() == QEvent::ToolTip) {
1495
// QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
1496
// unused, remove? TODO(bkgood)
1573
// return true for no tool tips
1574
if (m_tooltips == 1) {
1575
// ON (only in Library)
1576
WWidget* pWidget = dynamic_cast<WWidget*>(obj);
1577
WWaveformViewer* pWfViewer = dynamic_cast<WWaveformViewer*>(obj);
1578
QLabel* pLabel = dynamic_cast<QLabel*>(obj);
1579
return (pWidget || pWfViewer || pLabel);
1580
} else if (m_tooltips == 0) {
1502
1588
// standard event processing
1503
1589
return QObject::eventFilter(obj, event);