void DlgPrefLibrary::slotHide() { if (!m_baddedDirectory) { return; } QMessageBox msgBox; msgBox.setIcon(QMessageBox::Warning); msgBox.setWindowTitle(tr("Music Directory Added")); msgBox.setText(tr("You added one or more music directories. The tracks in " "these directories won't be available until you rescan " "your library. Would you like to rescan now?")); QPushButton* scanButton = msgBox.addButton( tr("Scan"), QMessageBox::AcceptRole); msgBox.addButton(QMessageBox::Cancel); msgBox.setDefaultButton(scanButton); msgBox.exec(); if (msgBox.clickedButton() == scanButton) { emit(scanLibrary()); return; } }
Library::Library( QObject* parent, UserSettingsPointer pConfig, mixxx::DbConnectionPoolPtr pDbConnectionPool, PlayerManagerInterface* pPlayerManager, RecordingManager* pRecordingManager) : m_pConfig(pConfig), m_pDbConnectionPool(pDbConnectionPool), m_pSidebarModel(new SidebarModel(parent)), m_pTrackCollection(new TrackCollection(pConfig)), m_pLibraryControl(new LibraryControl(this)), m_pMixxxLibraryFeature(nullptr), m_pPlaylistFeature(nullptr), m_pCrateFeature(nullptr), m_pAnalysisFeature(nullptr), m_scanner(pDbConnectionPool, m_pTrackCollection, pConfig) { QSqlDatabase dbConnection = mixxx::DbConnectionPooled(m_pDbConnectionPool); // TODO(XXX): Add a checkbox in the library preferences for checking // and repairing the database on the next restart of the application. if (pConfig->getValue(kConfigKeyRepairDatabaseOnNextRestart, false)) { kLogger.info() << "Checking and repairing database (if necessary)"; m_pTrackCollection->repairDatabase(dbConnection); // Reset config value pConfig->setValue(kConfigKeyRepairDatabaseOnNextRestart, false); } kLogger.info() << "Connecting database"; m_pTrackCollection->connectDatabase(dbConnection); qRegisterMetaType<Library::RemovalType>("Library::RemovalType"); m_pKeyNotation.reset(new ControlObject(ConfigKey(kConfigGroup, "key_notation"))); connect(&m_scanner, SIGNAL(scanStarted()), this, SIGNAL(scanStarted())); connect(&m_scanner, SIGNAL(scanFinished()), this, SIGNAL(scanFinished())); // Refresh the library models when the library (re)scan is finished. connect(&m_scanner, SIGNAL(scanFinished()), this, SLOT(slotRefreshLibraryModels())); // TODO(rryan) -- turn this construction / adding of features into a static // method or something -- CreateDefaultLibrary m_pMixxxLibraryFeature = new MixxxLibraryFeature(this, m_pTrackCollection,m_pConfig); addFeature(m_pMixxxLibraryFeature); addFeature(new AutoDJFeature(this, pConfig, pPlayerManager, m_pTrackCollection)); m_pPlaylistFeature = new PlaylistFeature(this, m_pTrackCollection, m_pConfig); addFeature(m_pPlaylistFeature); m_pCrateFeature = new CrateFeature(this, m_pTrackCollection, m_pConfig); addFeature(m_pCrateFeature); BrowseFeature* browseFeature = new BrowseFeature( this, pConfig, m_pTrackCollection, pRecordingManager); connect(browseFeature, SIGNAL(scanLibrary()), &m_scanner, SLOT(scan())); connect(&m_scanner, SIGNAL(scanStarted()), browseFeature, SLOT(slotLibraryScanStarted())); connect(&m_scanner, SIGNAL(scanFinished()), browseFeature, SLOT(slotLibraryScanFinished())); addFeature(browseFeature); addFeature(new RecordingFeature(this, pConfig, m_pTrackCollection, pRecordingManager)); addFeature(new SetlogFeature(this, pConfig, m_pTrackCollection)); m_pAnalysisFeature = new AnalysisFeature(this, pConfig, m_pTrackCollection); connect(m_pPlaylistFeature, SIGNAL(analyzeTracks(QList<TrackId>)), m_pAnalysisFeature, SLOT(analyzeTracks(QList<TrackId>))); connect(m_pCrateFeature, SIGNAL(analyzeTracks(QList<TrackId>)), m_pAnalysisFeature, SLOT(analyzeTracks(QList<TrackId>))); addFeature(m_pAnalysisFeature); //iTunes and Rhythmbox should be last until we no longer have an obnoxious //messagebox popup when you select them. (This forces you to reach for your //mouse or keyboard if you're using MIDI control and you scroll through them...) if (RhythmboxFeature::isSupported() && pConfig->getValue(ConfigKey(kConfigGroup,"ShowRhythmboxLibrary"), true)) { addFeature(new RhythmboxFeature(this, m_pTrackCollection)); } if (pConfig->getValue(ConfigKey(kConfigGroup,"ShowBansheeLibrary"), true)) { BansheeFeature::prepareDbPath(pConfig); if (BansheeFeature::isSupported()) { addFeature(new BansheeFeature(this, m_pTrackCollection, pConfig)); } } if (ITunesFeature::isSupported() && pConfig->getValue(ConfigKey(kConfigGroup,"ShowITunesLibrary"), true)) { addFeature(new ITunesFeature(this, m_pTrackCollection)); } if (TraktorFeature::isSupported() && pConfig->getValue(ConfigKey(kConfigGroup,"ShowTraktorLibrary"), true)) { addFeature(new TraktorFeature(this, m_pTrackCollection)); } // On startup we need to check if all of the user's library folders are // accessible to us. If the user is using a database from <1.12.0 with // sandboxing then we will need them to give us permission. QStringList directories = m_pTrackCollection->getDirectoryDAO().getDirs(); qDebug() << "Checking for access to user's library directories:"; foreach (QString directoryPath, directories) { QFileInfo directory(directoryPath); bool hasAccess = Sandbox::askForAccess(directory.canonicalFilePath()); qDebug() << "Checking for access to" << directoryPath << ":" << hasAccess; }
DlgPreferences::DlgPreferences(MixxxMainWindow * mixxx, SkinLoader* pSkinLoader, SoundManager * soundman, PlayerManager* pPlayerManager, ControllerManager * controllers, VinylControlManager *pVCManager, LV2Backend* pLV2Backend, EffectsManager* pEffectsManager, SettingsManager* pSettingsManager, Library *pLibrary) : m_pConfig(pSettingsManager->settings()), m_pageSizeHint(QSize(0, 0)), m_preferencesUpdated(ConfigKey("[Preferences]", "updated"), false) { setupUi(this); #if QT_VERSION >= 0x040400 //setHeaderHidden is a qt4.4 addition so having it in the .ui file breaks the build on OpenBSD4.4 (FIXME: revisit this when OpenBSD4.5 comes out?) contentsTreeWidget->setHeaderHidden(true); #endif connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonPressed(QAbstractButton*))); createIcons(); while (pagesWidget->count() > 0) { pagesWidget->removeWidget(pagesWidget->currentWidget()); } // Construct widgets for use in tabs. m_soundPage = new DlgPrefSound(this, soundman, pPlayerManager, m_pConfig); addPageWidget(m_soundPage); m_libraryPage = new DlgPrefLibrary(this, m_pConfig, pLibrary); addPageWidget(m_libraryPage); connect(m_libraryPage, SIGNAL(scanLibrary()), pLibrary, SLOT(scan())); m_controllersPage = new DlgPrefControllers(this, m_pConfig, controllers, m_pControllerTreeItem); addPageWidget(m_controllersPage); #ifdef __VINYLCONTROL__ // It's important for this to be before the connect for wsound. // TODO(rryan) determine why/if this is still true m_vinylControlPage = new DlgPrefVinyl(this, pVCManager, m_pConfig); addPageWidget(m_vinylControlPage); #else m_noVinylControlPage = new DlgPrefNoVinyl(this, soundman, m_pConfig); addPageWidget(m_noVinylControlPage); #endif m_interfacePage = new DlgPrefInterface(this, mixxx, pSkinLoader, m_pConfig); addPageWidget(m_interfacePage); m_waveformPage = new DlgPrefWaveform(this, mixxx, m_pConfig, pLibrary); addPageWidget(m_waveformPage); m_deckPage = new DlgPrefDeck(this, mixxx, pPlayerManager, m_pConfig); addPageWidget(m_deckPage); m_equalizerPage = new DlgPrefEQ(this, pEffectsManager, m_pConfig); addPageWidget(m_equalizerPage); m_crossfaderPage = new DlgPrefCrossfader(this, m_pConfig); addPageWidget(m_crossfaderPage); m_effectsPage = new DlgPrefEffects(this, m_pConfig, pEffectsManager); addPageWidget(m_effectsPage); #ifdef __LILV__ m_lv2Page = new DlgPrefLV2(this, pLV2Backend, m_pConfig, pEffectsManager); addPageWidget(m_lv2Page); #endif /* __LILV__ */ m_autoDjPage = new DlgPrefAutoDJ(this, m_pConfig); addPageWidget(m_autoDjPage); #ifdef __BROADCAST__ m_broadcastingPage = new DlgPrefBroadcast(this, pSettingsManager->broadcastSettings()); addPageWidget(m_broadcastingPage); #endif m_recordingPage = new DlgPrefRecord(this, m_pConfig); addPageWidget(m_recordingPage); #ifdef __VAMP__ m_beatgridPage = new DlgPrefBeats(this, m_pConfig); addPageWidget (m_beatgridPage); m_musicalKeyPage = new DlgPrefKey(this, m_pConfig); addPageWidget(m_musicalKeyPage); #endif m_replayGainPage = new DlgPrefReplayGain(this, m_pConfig); addPageWidget(m_replayGainPage); #ifdef __MODPLUG__ m_modplugPage = new DlgPrefModplug(this, m_pConfig); addPageWidget(m_modplugPage); #endif // Install event handler to generate closeDlg signal installEventFilter(this); // If we don't call this explicitly, then we default to showing the sound // hardware page but the tree item is not selected. showSoundHardwarePage(); }
Library::Library(QObject* parent, ConfigObject<ConfigValue>* pConfig, PlayerManagerInterface* pPlayerManager, RecordingManager* pRecordingManager) : m_pConfig(pConfig), m_pSidebarModel(new SidebarModel(parent)), m_pTrackCollection(new TrackCollection(pConfig)), m_pLibraryControl(new LibraryControl(this)), m_pRecordingManager(pRecordingManager) { qRegisterMetaType<Library::RemovalType>("Library::RemovalType"); // TODO(rryan) -- turn this construction / adding of features into a static // method or something -- CreateDefaultLibrary m_pMixxxLibraryFeature = new MixxxLibraryFeature(this, m_pTrackCollection,m_pConfig); addFeature(m_pMixxxLibraryFeature); addFeature(new AutoDJFeature(this, pConfig, pPlayerManager, m_pTrackCollection)); m_pPlaylistFeature = new PlaylistFeature(this, m_pTrackCollection, m_pConfig); addFeature(m_pPlaylistFeature); m_pCrateFeature = new CrateFeature(this, m_pTrackCollection, m_pConfig); addFeature(m_pCrateFeature); BrowseFeature* browseFeature = new BrowseFeature( this, pConfig, m_pTrackCollection, m_pRecordingManager); connect(browseFeature, SIGNAL(scanLibrary()), parent, SLOT(slotScanLibrary())); connect(parent, SIGNAL(libraryScanStarted()), browseFeature, SLOT(slotLibraryScanStarted())); connect(parent, SIGNAL(libraryScanFinished()), browseFeature, SLOT(slotLibraryScanFinished())); addFeature(browseFeature); addFeature(new RecordingFeature(this, pConfig, m_pTrackCollection, m_pRecordingManager)); addFeature(new SetlogFeature(this, pConfig, m_pTrackCollection)); m_pAnalysisFeature = new AnalysisFeature(this, pConfig, m_pTrackCollection); connect(m_pPlaylistFeature, SIGNAL(analyzeTracks(QList<int>)), m_pAnalysisFeature, SLOT(analyzeTracks(QList<int>))); connect(m_pCrateFeature, SIGNAL(analyzeTracks(QList<int>)), m_pAnalysisFeature, SLOT(analyzeTracks(QList<int>))); addFeature(m_pAnalysisFeature); //iTunes and Rhythmbox should be last until we no longer have an obnoxious //messagebox popup when you select them. (This forces you to reach for your //mouse or keyboard if you're using MIDI control and you scroll through them...) if (RhythmboxFeature::isSupported() && pConfig->getValueString(ConfigKey("[Library]","ShowRhythmboxLibrary"),"1").toInt()) { addFeature(new RhythmboxFeature(this, m_pTrackCollection)); } if (pConfig->getValueString(ConfigKey("[Library]","ShowBansheeLibrary"),"1").toInt()) { BansheeFeature::prepareDbPath(pConfig); if (BansheeFeature::isSupported()) { addFeature(new BansheeFeature(this, m_pTrackCollection, pConfig)); } } if (ITunesFeature::isSupported() && pConfig->getValueString(ConfigKey("[Library]","ShowITunesLibrary"),"1").toInt()) { addFeature(new ITunesFeature(this, m_pTrackCollection)); } if (TraktorFeature::isSupported() && pConfig->getValueString(ConfigKey("[Library]","ShowTraktorLibrary"),"1").toInt()) { addFeature(new TraktorFeature(this, m_pTrackCollection)); } // On startup we need to check if all of the user's library folders are // accessible to us. If the user is using a database from <1.12.0 with // sandboxing then we will need them to give us permission. QStringList directories = m_pTrackCollection->getDirectoryDAO().getDirs(); qDebug() << "Checking for access to user's library directories:"; foreach (QString directoryPath, directories) { QFileInfo directory(directoryPath); bool hasAccess = Sandbox::askForAccess(directory.canonicalFilePath()); qDebug() << "Checking for access to" << directoryPath << ":" << hasAccess; }
DlgPreferences::DlgPreferences(MixxxMainWindow * mixxx, SkinLoader* pSkinLoader, SoundManager * soundman, PlayerManager* pPlayerManager, ControllerManager * controllers, VinylControlManager *pVCManager, EffectsManager* pEffectsManager, SettingsManager* pSettingsManager, Library *pLibrary) : m_pConfig(pSettingsManager->settings()), m_pageSizeHint(QSize(0, 0)), m_preferencesUpdated(ConfigKey("[Preferences]", "updated"), false) { setupUi(this); #if QT_VERSION >= 0x040400 //setHeaderHidden is a qt4.4 addition so having it in the .ui file breaks the build on OpenBSD4.4 (FIXME: revisit this when OpenBSD4.5 comes out?) contentsTreeWidget->setHeaderHidden(true); #endif connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonPressed(QAbstractButton*))); createIcons(); while (pagesWidget->count() > 0) { pagesWidget->removeWidget(pagesWidget->currentWidget()); } // Construct widgets for use in tabs. #ifdef __VINYLCONTROL__ // It's important for this to be before the connect for wsound. // TODO(rryan) determine why/if this is still true m_wvinylcontrol = new DlgPrefVinyl(this, pVCManager, m_pConfig); addPageWidget(m_wvinylcontrol); #else m_wnovinylcontrol = new DlgPrefNoVinyl(this, soundman, m_pConfig); addPageWidget(m_wnovinylcontrol); #endif m_wsound = new DlgPrefSound(this, soundman, pPlayerManager, m_pConfig); addPageWidget(m_wsound); m_wlibrary = new DlgPrefLibrary(this, m_pConfig, pLibrary); addPageWidget(m_wlibrary); connect(m_wlibrary, SIGNAL(scanLibrary()), pLibrary, SLOT(scan())); m_wcontrols = new DlgPrefControls(this, mixxx, pSkinLoader, pPlayerManager, m_pConfig); addPageWidget(m_wcontrols); m_wwaveform = new DlgPrefWaveform(this, mixxx, m_pConfig, pLibrary); addPageWidget(m_wwaveform); m_wautodj = new DlgPrefAutoDJ(this, m_pConfig); addPageWidget(m_wautodj); m_weq = new DlgPrefEQ(this, pEffectsManager, m_pConfig); addPageWidget(m_weq); // TODO: Re-enable the effects preferences pane when it does something useful. //m_weffects = new DlgPrefEffects(this, m_pConfig, pEffectsManager); //addPageWidget(m_weffects); m_wcrossfader = new DlgPrefCrossfader(this, m_pConfig); addPageWidget(m_wcrossfader); #ifdef __VAMP__ m_wbeats = new DlgPrefBeats(this, m_pConfig); addPageWidget (m_wbeats); m_wkey = new DlgPrefKey(this, m_pConfig); addPageWidget(m_wkey); #endif m_wreplaygain = new DlgPrefReplayGain(this, m_pConfig); addPageWidget(m_wreplaygain); m_wrecord = new DlgPrefRecord(this, m_pConfig); addPageWidget(m_wrecord); #ifdef __BROADCAST__ m_wbroadcast = new DlgPrefBroadcast(this, pSettingsManager->broadcastSettings()); addPageWidget(m_wbroadcast); #endif #ifdef __MODPLUG__ m_wmodplug = new DlgPrefModplug(this, m_pConfig); addPageWidget(m_wmodplug); #endif m_wcontrollers = new DlgPrefControllers(this, m_pConfig, controllers, m_pControllerTreeItem); addPageWidget(m_wcontrollers); // Install event handler to generate closeDlg signal installEventFilter(this); // If we don't call this explicitly, then we default to showing the sound // hardware page but the tree item is not selected. showSoundHardwarePage(); }