From eb0fd22b521776fa4ac1e7fc5f73221091da3bac Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Mon, 20 May 2013 23:26:18 -0400 Subject: [PATCH 01/19] Add a preference option for the order that tracks will be loaded in 4-deck skins, since controllers vary --- mixxx/res/skins/Deere1280x1024-SXGA/skin.xml | 16 +++---- mixxx/res/skins/Deere1280x800-WXGA/skin.xml | 16 +++---- mixxx/res/skins/Deere1366x768-WXGA/skin.xml | 16 +++---- mixxx/res/skins/Deere1440x900-WXGA+/skin.xml | 16 +++---- .../res/skins/Deere1920x1080-FullHD/skin.xml | 16 +++---- mixxx/res/skins/Deere1920x1200-WUXGA/skin.xml | 16 +++---- .../DeereSamplegrid1280x800-WXGA/skin.xml | 6 +-- .../skins/LateNight1280x1024-SXGA/skin.xml | 16 +++---- .../res/skins/LateNight1280x800-WXGA/skin.xml | 16 +++---- .../res/skins/LateNight1366x768-WXGA/skin.xml | 16 +++---- .../LateNightBlues1280x1024-SXGA/skin.xml | 16 +++---- .../LateNightBlues1280x800-WXGA/skin.xml | 16 +++---- .../LateNightBlues1366x768-WXGA/skin.xml | 16 +++---- .../skins/Outline1024x600-Netbook/skin.xml | 18 ++++---- mixxx/res/skins/Outline1024x768-XGA/skin.xml | 18 ++++---- mixxx/res/skins/Outline800x480-WVGA/skin.xml | 12 +++--- mixxx/res/skins/Phoney1600x1200-UXGA/skin.xml | 26 +++++------ .../res/skins/Phoney1680x1050-WSXGA/skin.xml | 26 +++++------ .../skins/PhoneyDark1600x1200-UXGA/skin.xml | 24 +++++------ .../skins/PhoneyDark1680x1050-WSXGA/skin.xml | 24 +++++------ .../res/skins/Shade1024x600-Netbook/skin.xml | 16 +++---- mixxx/res/skins/Shade1024x768-XGA/skin.xml | 16 +++---- .../skins/ShadeDark1024x600-Netbook/skin.xml | 16 +++---- .../res/skins/ShadeDark1024x768-XGA/skin.xml | 6 +-- .../src/controllers/dlgcontrollerlearning.cpp | 8 ++-- mixxx/src/dlgprefcontrols.cpp | 19 ++++++++ mixxx/src/dlgprefcontrols.h | 1 + mixxx/src/dlgprefcontrolsdlg.ui | 15 ++++++- mixxx/src/engine/bpmcontrol.cpp | 2 +- mixxx/src/library/browse/browsetablemodel.cpp | 2 +- mixxx/src/playermanager.cpp | 43 ++++++++++++++++--- mixxx/src/playermanager.h | 28 ++++++++++++ mixxx/src/widget/wtracktableview.cpp | 6 +-- 33 files changed, 307 insertions(+), 217 deletions(-) diff --git a/mixxx/res/skins/Deere1280x1024-SXGA/skin.xml b/mixxx/res/skins/Deere1280x1024-SXGA/skin.xml index 85e4776279b..a5cde755865 100644 --- a/mixxx/res/skins/Deere1280x1024-SXGA/skin.xml +++ b/mixxx/res/skins/Deere1280x1024-SXGA/skin.xml @@ -16,7 +16,7 @@ Under the following conditions: Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). - A attribution should include the following: The name of the author and/or licensor, + A attribution should include the following: The name of the author and/or licensor, the title of the work, the URL that is associated with the work. Share Alike - If you alter, transform, or build upon this work, you may distribute @@ -58,9 +58,9 @@ en Creative Commons Attribution, Share-Alike 3.0 Unported - 2 - 4 - 1 + 2 + 4 + 1 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -2243,7 +2243,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2299,7 +2299,7 @@ --> text - + 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -3270,7 +3270,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -3326,7 +3326,7 @@ --> text - + 1 1 @@ -3270,7 +3270,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -3326,7 +3326,7 @@ --> text - + 1 1 diff --git a/mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml b/mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml index 1218c1018fc..285ec368483 100644 --- a/mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml +++ b/mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml @@ -16,7 +16,7 @@ Under the following conditions: Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). - A attribution should include the following: The name of the author and/or licensor, + A attribution should include the following: The name of the author and/or licensor, the title of the work, the URL that is associated with the work. Share Alike - If you alter, transform, or build upon this work, you may distribute @@ -58,9 +58,9 @@ en Creative Commons Attribution, Share-Alike 3.0 Unported - 2 - 4 - 1 + 2 + 4 + 1 1 1 @@ -2241,7 +2241,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2297,7 +2297,7 @@ --> text - + 1 1 @@ -2241,7 +2241,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2297,7 +2297,7 @@ --> text - + 1 1 @@ -2241,7 +2241,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2297,7 +2297,7 @@ --> text - + 1 1 @@ -2241,7 +2241,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2297,7 +2297,7 @@ --> text - + 1 1 @@ -2241,7 +2241,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2297,7 +2297,7 @@ --> text - + 1 1 @@ -2241,7 +2241,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2297,7 +2297,7 @@ --> text - + 1 1 @@ -901,7 +901,7 @@ visual_bpm - + QTableView, QTextBrowser, QTreeView { font: 13px/15px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; } QTableView::indicator { width: 12px; height: 12px;} QTableView::indicator:checked { background: url(skin:/style/style_checkbox_checked.png);} diff --git a/mixxx/res/skins/Outline1024x768-XGA/skin.xml b/mixxx/res/skins/Outline1024x768-XGA/skin.xml index b1c3a8b42bb..1e05e9b7ca0 100644 --- a/mixxx/res/skins/Outline1024x768-XGA/skin.xml +++ b/mixxx/res/skins/Outline1024x768-XGA/skin.xml @@ -52,9 +52,9 @@ en GNU General Public License, version 2 or later - 2 - 4 - 0 + 2 + 4 + 0 1 1 @@ -901,7 +901,7 @@ visual_bpm - + QTableView, QTextBrowser, QTreeView { font: 13px/15px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; } QTableView::indicator { width: 12px; height: 12px;} QTableView::indicator:checked { background: url(skin:/style/style_checkbox_checked.png);} diff --git a/mixxx/res/skins/Outline800x480-WVGA/skin.xml b/mixxx/res/skins/Outline800x480-WVGA/skin.xml index 1cb18f23b28..0cfd3b78331 100644 --- a/mixxx/res/skins/Outline800x480-WVGA/skin.xml +++ b/mixxx/res/skins/Outline800x480-WVGA/skin.xml @@ -52,9 +52,9 @@ en GNU General Public License, version 2 or later - 2 - 3 - 0 + 2 + 3 + 0 1 1 @@ -898,7 +898,7 @@ visual_bpm + 1 1 @@ -2239,7 +2239,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0;} QTreeView::branch:has-children:!has-siblings:closed, @@ -2295,7 +2295,7 @@ --> text - + 1 1 @@ -2239,7 +2239,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0;} QTreeView::branch:has-children:!has-siblings:closed, @@ -2295,7 +2295,7 @@ --> text - + 1 1 diff --git a/mixxx/src/controllers/dlgcontrollerlearning.cpp b/mixxx/src/controllers/dlgcontrollerlearning.cpp index 94ca1096ae2..ef54499f0df 100644 --- a/mixxx/src/controllers/dlgcontrollerlearning.cpp +++ b/mixxx/src/controllers/dlgcontrollerlearning.cpp @@ -210,7 +210,7 @@ DlgControllerLearning::DlgControllerLearning(QWidget * parent, addControl("[Vinylcontrol]", "show_vinylcontrol", tr("Show/hide the vinyl control section"), guiMenu); addControl("[PreviewDeck]", "show_previewdeck", tr("Show/hide the preview deck"), guiMenu); - ControlObject *co = ControlObject::getControl(ConfigKey("[Master]", "num_decks")); + ControlObject *co = ControlObject::getControl(ConfigKey("[Skin]", "num_decks")); const int iNumDecks = co->get(); QString spinnyText = tr("Show/hide spinning vinyl widget"); for (int i = 1; i <= iNumDecks; ++i) { @@ -252,11 +252,11 @@ void DlgControllerLearning::addControl(QString group, QString control, QString d void DlgControllerLearning::addPlayerControl( QString control, QString controlDescription, QMenu* pMenu, bool deckControls, bool samplerControls, bool previewdeckControls, bool addReset) { - ControlObject* numSamplers = ControlObject::getControl(ConfigKey("[Master]", "num_samplers")); + ControlObject* numSamplers = ControlObject::getControl(ConfigKey("[Skin]", "num_samplers")); const int iNumSamplers = numSamplers->get(); - ControlObject* numDecks = ControlObject::getControl(ConfigKey("[Master]", "num_decks")); + ControlObject* numDecks = ControlObject::getControl(ConfigKey("[Skin]", "num_decks")); const int iNumDecks = numDecks->get(); - ControlObject* numPreviewDecks = ControlObject::getControl(ConfigKey("[Master]", "num_preview_decks")); + ControlObject* numPreviewDecks = ControlObject::getControl(ConfigKey("[Skin]", "num_preview_decks")); const int iNumPreviewDecks = numPreviewDecks->get(); QMenu* controlMenu = new QMenu(controlDescription, pMenu); diff --git a/mixxx/src/dlgprefcontrols.cpp b/mixxx/src/dlgprefcontrols.cpp index b042614e4b8..b791f56bf13 100644 --- a/mixxx/src/dlgprefcontrols.cpp +++ b/mixxx/src/dlgprefcontrols.cpp @@ -212,6 +212,20 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, ComboBoxAutoDjRequeue->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); + // Ordering of decks in 4-deck mode + QList > deck_orderings = m_pPlayerManager->getAvailableDeckOrderings(); + for (int i = 0; i < deck_orderings.count(); ++i) { + QString ui_order = " "; + // Orderings are given in load order, not mixer order, so we have to we have to + // do a little inefficient shuffling to display the correct letters. + for (int j = 0; j < deck_orderings[i].count(); ++j) { + ui_order[deck_orderings[i][j]] = j + 'A'; + } + ComboBoxDeckOrder->addItem(tr(ui_order.toStdString().c_str())); + } + ComboBoxDeckOrder->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Controls]", "4DeckOrder")).toInt()); + connect(ComboBoxDeckOrder, SIGNAL(activated(int)), this, SLOT(slotSetDeckOrder(int))); + // // Skin configurations // @@ -429,6 +443,11 @@ void DlgPrefControls::slotSetAutoDjRequeue(int) m_pConfig->set(ConfigKey("[Auto DJ]", "Requeue"), ConfigValue(ComboBoxAutoDjRequeue->currentIndex())); } +void DlgPrefControls::slotSetDeckOrder(int) +{ + m_pConfig->set(ConfigKey("[Controls]", "4DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentIndex())); +} + void DlgPrefControls::slotSetTooltips(int) { int configValue = (ComboBoxTooltips->currentIndex() + 1) % 3; diff --git a/mixxx/src/dlgprefcontrols.h b/mixxx/src/dlgprefcontrols.h index b83140fdee5..b8f366bdcdf 100644 --- a/mixxx/src/dlgprefcontrols.h +++ b/mixxx/src/dlgprefcontrols.h @@ -59,6 +59,7 @@ public slots: void slotSetCueDefault(int); void slotSetCueRecall(int); void slotSetAutoDjRequeue(int); + void slotSetDeckOrder(int); void slotSetRateRamp(bool); void slotSetRateRampSensitivity(int); void slotSetLocale(int); diff --git a/mixxx/src/dlgprefcontrolsdlg.ui b/mixxx/src/dlgprefcontrolsdlg.ui index f0731cf8c71..1a50645c5cb 100644 --- a/mixxx/src/dlgprefcontrolsdlg.ui +++ b/mixxx/src/dlgprefcontrolsdlg.ui @@ -257,7 +257,20 @@ - + + + + + + + 4-deck mode track order + + + ComboBoxDeckOrder + + + + diff --git a/mixxx/src/engine/bpmcontrol.cpp b/mixxx/src/engine/bpmcontrol.cpp index fc509ca796c..673b223e198 100644 --- a/mixxx/src/engine/bpmcontrol.cpp +++ b/mixxx/src/engine/bpmcontrol.cpp @@ -19,7 +19,7 @@ BpmControl::BpmControl(const char* _group, ConfigObject* _config) : EngineControl(_group, _config), m_tapFilter(this, filterLength, maxInterval) { - m_pNumDecks = ControlObject::getControl(ConfigKey("[Master]", "num_decks")); + m_pNumDecks = ControlObject::getControl(ConfigKey("[Skin]", "num_decks")); m_pPlayButton = ControlObject::getControl(ConfigKey(_group, "play")); m_pRateSlider = ControlObject::getControl(ConfigKey(_group, "rate")); diff --git a/mixxx/src/library/browse/browsetablemodel.cpp b/mixxx/src/library/browse/browsetablemodel.cpp index 4dab236389d..a1618701189 100644 --- a/mixxx/src/library/browse/browsetablemodel.cpp +++ b/mixxx/src/library/browse/browsetablemodel.cpp @@ -295,7 +295,7 @@ Qt::ItemFlags BrowseTableModel::flags(const QModelIndex &index) const { bool BrowseTableModel::isTrackInUse(const QString &track_location) const { int decks = ControlObject::getControl( - ConfigKey("[Master]", "num_decks"))->get(); + ConfigKey("[Skin]", "num_decks"))->get(); // check if file is loaded to a deck for (int i = 1; i <= decks; ++i) { TrackPointer loaded_track = PlayerInfo::Instance().getTrackInfo( diff --git a/mixxx/src/playermanager.cpp b/mixxx/src/playermanager.cpp index aaa36b59228..43e1a0eab7a 100644 --- a/mixxx/src/playermanager.cpp +++ b/mixxx/src/playermanager.cpp @@ -34,17 +34,24 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, m_pAnalyserQueue(NULL), m_pCONumDecks(new ControlObject(ConfigKey("[Master]", "num_decks"), true, true)), m_pCONumSamplers(new ControlObject(ConfigKey("[Master]", "num_samplers"), true, true)), - m_pCONumPreviewDecks(new ControlObject(ConfigKey("[Master]", "num_preview_decks"), true, true)) { + m_pCONumPreviewDecks(new ControlObject(ConfigKey("[Master]", "num_preview_decks"), true, true)), + m_pCOSkinNumDecks(new ControlObject(ConfigKey("[Skin]", "num_decks"), true, true)) { connect(m_pCONumDecks, SIGNAL(valueChanged(double)), this, SLOT(slotNumDecksControlChanged(double)), Qt::DirectConnection); + connect(m_pCONumDecks, SIGNAL(valueChangedFromEngine(double)), + this, SLOT(slotNumDecksControlChanged(double)), + Qt::DirectConnection); connect(m_pCONumSamplers, SIGNAL(valueChanged(double)), this, SLOT(slotNumSamplersControlChanged(double)), Qt::DirectConnection); connect(m_pCONumPreviewDecks, SIGNAL(valueChanged(double)), this, SLOT(slotNumPreviewDecksControlChanged(double)), Qt::DirectConnection); + connect(m_pCOSkinNumDecks, SIGNAL(valueChanged(double)), + this, SLOT(slotSkinNumDecksControlChanged(double)), + Qt::DirectConnection); // This is parented to the PlayerManager so does not need to be deleted SamplerBank* pSamplerBank = new SamplerBank(this); @@ -73,6 +80,7 @@ PlayerManager::~PlayerManager() { delete m_pCONumSamplers; delete m_pCONumDecks; delete m_pCONumPreviewDecks; + delete m_pCOSkinNumDecks; if (m_pAnalyserQueue) { delete m_pAnalyserQueue; } @@ -165,6 +173,22 @@ unsigned int PlayerManager::numPreviewDecks() { return pNumCO ? pNumCO->get() : 0; } +const QList PlayerManager::getDeckOrdering() { + QList order; + int skin_deck_count = m_pCOSkinNumDecks->get(); + if (skin_deck_count == 4) { + return ms_deck_orderings[m_pConfig->getValueString(ConfigKey("[Controls]", "4DeckOrder")).toInt()]; + } + // A skin might not have this value defined -- assume it's an old 2-deck skin. + if (skin_deck_count == 0) { + skin_deck_count = 2; + } + for (int i = 0; i < skin_deck_count; ++i) { + order << i; + } + return order; +} + void PlayerManager::slotNumDecksControlChanged(double v) { QMutexLocker locker(&m_mutex); int num = (int)v; @@ -210,6 +234,11 @@ void PlayerManager::slotNumPreviewDecksControlChanged(double v) { } } +void PlayerManager::slotSkinNumDecksControlChanged(double v) { + m_skin_decks = static_cast(v); + m_pCONumDecks->set(m_skin_decks); +} + void PlayerManager::addDeck() { QMutexLocker locker(&m_mutex); addDeckInner(); @@ -373,9 +402,11 @@ void PlayerManager::slotLoadToSampler(QString location, int sampler) { void PlayerManager::slotLoadTrackIntoNextAvailableDeck(TrackPointer pTrack) { QMutexLocker locker(&m_mutex); - QList::iterator it = m_decks.begin(); - while (it != m_decks.end()) { - Deck* pDeck = *it; + const QList& order = getDeckOrdering(); + QList::const_iterator it = order.begin(); + while (it != order.end()) { + qDebug() << "try loading " << *it; + Deck* pDeck = m_decks[*it]; ControlObject* playControl = ControlObject::getControl(ConfigKey(pDeck->getGroup(), "play")); if (playControl && playControl->get() != 1.) { @@ -383,7 +414,7 @@ void PlayerManager::slotLoadTrackIntoNextAvailableDeck(TrackPointer pTrack) { pDeck->slotLoadTrack(pTrack, false); return; } - it++; + ++it; } } @@ -402,5 +433,3 @@ void PlayerManager::slotLoadTrackIntoNextAvailableSampler(TrackPointer pTrack) { it++; } } - - diff --git a/mixxx/src/playermanager.h b/mixxx/src/playermanager.h index e185ac5a895..fd4cfaf8366 100644 --- a/mixxx/src/playermanager.h +++ b/mixxx/src/playermanager.h @@ -84,6 +84,29 @@ class PlayerManager : public QObject { return QString("[PreviewDeck%1]").arg(i+1); } + // Returns a list of lists of possible orders to load tracks into decks. + // Controllers label their channels differently and these are the three combinations + // we've encountered. + const QList > getAvailableDeckOrderings() { + if (ms_deck_orderings.count() == 0) { + QList order; + // Corresponds to ABCD + order << 0 << 1 << 2 << 3; + ms_deck_orderings.push_back(order); + order.clear(); + // Corresponds to CABD + order << 1 << 2 << 0 << 3; + ms_deck_orderings.push_back(order); + order.clear(); + // Corresponds to ACDB + order << 0 << 3 << 1 << 2; + ms_deck_orderings.push_back(order); + } + return ms_deck_orderings; + } + + const QList getDeckOrdering(); + public slots: // Slots for loading tracks into a Player, which is either a Sampler or a Deck void slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); @@ -104,6 +127,7 @@ class PlayerManager : public QObject { void slotNumDecksControlChanged(double v); void slotNumSamplersControlChanged(double v); void slotNumPreviewDecksControlChanged(double v); + void slotSkinNumDecksControlChanged(double v); signals: void loadLocationToPlayer(QString location, QString group); @@ -123,6 +147,8 @@ class PlayerManager : public QObject { // Used to protect access to PlayerManager state across threads. mutable QMutex m_mutex; + QList > ms_deck_orderings; + ConfigObject* m_pConfig; SoundManager* m_pSoundManager; EngineMaster* m_pEngine; @@ -131,10 +157,12 @@ class PlayerManager : public QObject { ControlObject* m_pCONumDecks; ControlObject* m_pCONumSamplers; ControlObject* m_pCONumPreviewDecks; + ControlObject* m_pCOSkinNumDecks; QList m_decks; QList m_samplers; QList m_preview_decks; + unsigned int m_skin_decks; QMap m_players; }; diff --git a/mixxx/src/widget/wtracktableview.cpp b/mixxx/src/widget/wtracktableview.cpp index 1ca7a7158a8..8ee22ea9b0e 100644 --- a/mixxx/src/widget/wtracktableview.cpp +++ b/mixxx/src/widget/wtracktableview.cpp @@ -43,11 +43,11 @@ WTrackTableView::WTrackTableView(QWidget * parent, this, SLOT(loadSelectionToGroup(QString))); m_pNumSamplers = new ControlObjectThreadMain( - ControlObject::getControl(ConfigKey("[Master]", "num_samplers"))); + ControlObject::getControl(ConfigKey("[Skin]", "num_samplers"))); m_pNumDecks = new ControlObjectThreadMain( - ControlObject::getControl(ConfigKey("[Master]", "num_decks"))); + ControlObject::getControl(ConfigKey("[Skin]", "num_decks"))); m_pNumPreviewDecks = new ControlObjectThreadMain( - ControlObject::getControl(ConfigKey("[Master]", "num_preview_decks"))); + ControlObject::getControl(ConfigKey("[Skin]", "num_preview_decks"))); m_pMenu = new QMenu(this); From 57ea2f1ecfdd77beb376610399874ac85115982a Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Tue, 21 May 2013 13:47:32 -0400 Subject: [PATCH 02/19] Address most notes. Still need to add [Skin] COs for samplers and previews --- mixxx/src/dlgprefcontrols.cpp | 13 ++++++++++--- mixxx/src/playermanager.cpp | 34 ++++++++++++++++++++++------------ mixxx/src/playermanager.h | 24 +++--------------------- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/mixxx/src/dlgprefcontrols.cpp b/mixxx/src/dlgprefcontrols.cpp index b791f56bf13..00bdd4fe8a9 100644 --- a/mixxx/src/dlgprefcontrols.cpp +++ b/mixxx/src/dlgprefcontrols.cpp @@ -214,6 +214,8 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, // Ordering of decks in 4-deck mode QList > deck_orderings = m_pPlayerManager->getAvailableDeckOrderings(); + QString order = m_pConfig->getValueString(ConfigKey("[Controls]", "4DeckOrder")); + int deckorder_index = 0; for (int i = 0; i < deck_orderings.count(); ++i) { QString ui_order = " "; // Orderings are given in load order, not mixer order, so we have to we have to @@ -221,9 +223,14 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, for (int j = 0; j < deck_orderings[i].count(); ++j) { ui_order[deck_orderings[i][j]] = j + 'A'; } - ComboBoxDeckOrder->addItem(tr(ui_order.toStdString().c_str())); + if (ui_order == order) { + deckorder_index = i; + } + // TODO: Do we need to translate "ABCD," etc? If so then we need to untranslate it + // when we save to config file. + ComboBoxDeckOrder->addItem(ui_order); } - ComboBoxDeckOrder->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Controls]", "4DeckOrder")).toInt()); + ComboBoxDeckOrder->setCurrentIndex(deckorder_index); connect(ComboBoxDeckOrder, SIGNAL(activated(int)), this, SLOT(slotSetDeckOrder(int))); // @@ -445,7 +452,7 @@ void DlgPrefControls::slotSetAutoDjRequeue(int) void DlgPrefControls::slotSetDeckOrder(int) { - m_pConfig->set(ConfigKey("[Controls]", "4DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentIndex())); + m_pConfig->set(ConfigKey("[Controls]", "4DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); } void DlgPrefControls::slotSetTooltips(int) diff --git a/mixxx/src/playermanager.cpp b/mixxx/src/playermanager.cpp index 43e1a0eab7a..39e1b7ea348 100644 --- a/mixxx/src/playermanager.cpp +++ b/mixxx/src/playermanager.cpp @@ -40,18 +40,12 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, connect(m_pCONumDecks, SIGNAL(valueChanged(double)), this, SLOT(slotNumDecksControlChanged(double)), Qt::DirectConnection); - connect(m_pCONumDecks, SIGNAL(valueChangedFromEngine(double)), - this, SLOT(slotNumDecksControlChanged(double)), - Qt::DirectConnection); connect(m_pCONumSamplers, SIGNAL(valueChanged(double)), this, SLOT(slotNumSamplersControlChanged(double)), Qt::DirectConnection); connect(m_pCONumPreviewDecks, SIGNAL(valueChanged(double)), this, SLOT(slotNumPreviewDecksControlChanged(double)), Qt::DirectConnection); - connect(m_pCOSkinNumDecks, SIGNAL(valueChanged(double)), - this, SLOT(slotSkinNumDecksControlChanged(double)), - Qt::DirectConnection); // This is parented to the PlayerManager so does not need to be deleted SamplerBank* pSamplerBank = new SamplerBank(this); @@ -173,11 +167,32 @@ unsigned int PlayerManager::numPreviewDecks() { return pNumCO ? pNumCO->get() : 0; } +// static +QList > PlayerManager::deckOrderings; +const QList > PlayerManager::getAvailableDeckOrderings() { + if (PlayerManager::deckOrderings.count() == 0) { + QList order; + // Corresponds to ABCD + order << 0 << 1 << 2 << 3; + PlayerManager::deckOrderings.push_back(order); + order.clear(); + // Corresponds to CABD + order << 1 << 2 << 0 << 3; + PlayerManager::deckOrderings.push_back(order); + order.clear(); + // Corresponds to ACDB + order << 0 << 3 << 1 << 2; + PlayerManager::deckOrderings.push_back(order); + } + return PlayerManager::deckOrderings; +} + const QList PlayerManager::getDeckOrdering() { QList order; int skin_deck_count = m_pCOSkinNumDecks->get(); if (skin_deck_count == 4) { - return ms_deck_orderings[m_pConfig->getValueString(ConfigKey("[Controls]", "4DeckOrder")).toInt()]; + return PlayerManager::deckOrderings[ + m_pConfig->getValueString(ConfigKey("[Controls]","4DeckOrder")).toInt()]; } // A skin might not have this value defined -- assume it's an old 2-deck skin. if (skin_deck_count == 0) { @@ -234,11 +249,6 @@ void PlayerManager::slotNumPreviewDecksControlChanged(double v) { } } -void PlayerManager::slotSkinNumDecksControlChanged(double v) { - m_skin_decks = static_cast(v); - m_pCONumDecks->set(m_skin_decks); -} - void PlayerManager::addDeck() { QMutexLocker locker(&m_mutex); addDeckInner(); diff --git a/mixxx/src/playermanager.h b/mixxx/src/playermanager.h index fd4cfaf8366..3e2fb6970b3 100644 --- a/mixxx/src/playermanager.h +++ b/mixxx/src/playermanager.h @@ -87,23 +87,7 @@ class PlayerManager : public QObject { // Returns a list of lists of possible orders to load tracks into decks. // Controllers label their channels differently and these are the three combinations // we've encountered. - const QList > getAvailableDeckOrderings() { - if (ms_deck_orderings.count() == 0) { - QList order; - // Corresponds to ABCD - order << 0 << 1 << 2 << 3; - ms_deck_orderings.push_back(order); - order.clear(); - // Corresponds to CABD - order << 1 << 2 << 0 << 3; - ms_deck_orderings.push_back(order); - order.clear(); - // Corresponds to ACDB - order << 0 << 3 << 1 << 2; - ms_deck_orderings.push_back(order); - } - return ms_deck_orderings; - } + static const QList > getAvailableDeckOrderings(); const QList getDeckOrdering(); @@ -127,7 +111,6 @@ class PlayerManager : public QObject { void slotNumDecksControlChanged(double v); void slotNumSamplersControlChanged(double v); void slotNumPreviewDecksControlChanged(double v); - void slotSkinNumDecksControlChanged(double v); signals: void loadLocationToPlayer(QString location, QString group); @@ -147,8 +130,6 @@ class PlayerManager : public QObject { // Used to protect access to PlayerManager state across threads. mutable QMutex m_mutex; - QList > ms_deck_orderings; - ConfigObject* m_pConfig; SoundManager* m_pSoundManager; EngineMaster* m_pEngine; @@ -162,8 +143,9 @@ class PlayerManager : public QObject { QList m_decks; QList m_samplers; QList m_preview_decks; - unsigned int m_skin_decks; QMap m_players; + + static QList > deckOrderings; }; #endif // PLAYERMANAGER_H From aa98cddc9635c8a846addfe00baeecd9d16ba7eb Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Tue, 21 May 2013 13:55:02 -0400 Subject: [PATCH 03/19] Make sure we have enough samplers and previewdecks to match the skin --- mixxx/src/playermanager.cpp | 23 +++++++++++++++++++++-- mixxx/src/playermanager.h | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/mixxx/src/playermanager.cpp b/mixxx/src/playermanager.cpp index 39e1b7ea348..8033f499aaf 100644 --- a/mixxx/src/playermanager.cpp +++ b/mixxx/src/playermanager.cpp @@ -34,8 +34,11 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, m_pAnalyserQueue(NULL), m_pCONumDecks(new ControlObject(ConfigKey("[Master]", "num_decks"), true, true)), m_pCONumSamplers(new ControlObject(ConfigKey("[Master]", "num_samplers"), true, true)), - m_pCONumPreviewDecks(new ControlObject(ConfigKey("[Master]", "num_preview_decks"), true, true)), - m_pCOSkinNumDecks(new ControlObject(ConfigKey("[Skin]", "num_decks"), true, true)) { + m_pCONumPreviewDecks(new ControlObject(ConfigKey("[Master]", "num_preview_decks"), + true, true)), + m_pCOSkinNumDecks(new ControlObject(ConfigKey("[Skin]", "num_decks"), true, true)), + m_pCOSkinNumSamplers(new ControlObject(ConfigKey("[Skin]", "num_samplers"), true, true)), + m_pCOSkinNumPreviewDecks(new ControlObject(ConfigKey("[Skin]", "num_preview_decks"), true, true)) { connect(m_pCONumDecks, SIGNAL(valueChanged(double)), this, SLOT(slotNumDecksControlChanged(double)), @@ -47,6 +50,17 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, this, SLOT(slotNumPreviewDecksControlChanged(double)), Qt::DirectConnection); + // Make sure the number of internal decks is in sync with the number of decks in the skin. + connect(m_pCOSkinNumDecks, SIGNAL(valueChanged(double)), + this, SLOT(slotNumDecksControlChanged(double)), + Qt::DirectConnection); + connect(m_pCOSkinNumSamplers, SIGNAL(valueChanged(double)), + this, SLOT(slotNumSamplersControlChanged(double)), + Qt::DirectConnection); + connect(m_pCOSkinNumPreviewDecks, SIGNAL(valueChanged(double)), + this, SLOT(slotNumPreviewDecksControlChanged(double)), + Qt::DirectConnection); + // This is parented to the PlayerManager so does not need to be deleted SamplerBank* pSamplerBank = new SamplerBank(this); Q_UNUSED(pSamplerBank); @@ -55,6 +69,9 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, m_pCONumDecks->set(0); m_pCONumSamplers->set(0); m_pCONumPreviewDecks->set(0); + m_pCOSkinNumDecks->set(0); + m_pCOSkinNumSamplers->set(0); + m_pCOSkinNumPreviewDecks->set(0); // register the engine's outputs m_pSoundManager->registerOutput(AudioOutput(AudioOutput::MASTER), @@ -75,6 +92,8 @@ PlayerManager::~PlayerManager() { delete m_pCONumDecks; delete m_pCONumPreviewDecks; delete m_pCOSkinNumDecks; + delete m_pCOSkinNumSamplers; + delete m_pCOSkinNumPreviewDecks; if (m_pAnalyserQueue) { delete m_pAnalyserQueue; } diff --git a/mixxx/src/playermanager.h b/mixxx/src/playermanager.h index 3e2fb6970b3..95e57092474 100644 --- a/mixxx/src/playermanager.h +++ b/mixxx/src/playermanager.h @@ -139,6 +139,8 @@ class PlayerManager : public QObject { ControlObject* m_pCONumSamplers; ControlObject* m_pCONumPreviewDecks; ControlObject* m_pCOSkinNumDecks; + ControlObject* m_pCOSkinNumSamplers; + ControlObject* m_pCOSkinNumPreviewDecks; QList m_decks; QList m_samplers; From f1af43418b6fc35c19e95055eac113b0704156ba Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Tue, 21 May 2013 17:01:48 -0400 Subject: [PATCH 04/19] put definition back in header --- mixxx/src/playermanager.cpp | 23 +++-------------------- mixxx/src/playermanager.h | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/mixxx/src/playermanager.cpp b/mixxx/src/playermanager.cpp index 8033f499aaf..9449b34f5d9 100644 --- a/mixxx/src/playermanager.cpp +++ b/mixxx/src/playermanager.cpp @@ -20,6 +20,9 @@ #include "util/stat.h" #include "engine/enginedeck.h" +// static +QList > PlayerManager::deckOrderings; + PlayerManager::PlayerManager(ConfigObject* pConfig, SoundManager* pSoundManager, EngineMaster* pEngine, @@ -186,26 +189,6 @@ unsigned int PlayerManager::numPreviewDecks() { return pNumCO ? pNumCO->get() : 0; } -// static -QList > PlayerManager::deckOrderings; -const QList > PlayerManager::getAvailableDeckOrderings() { - if (PlayerManager::deckOrderings.count() == 0) { - QList order; - // Corresponds to ABCD - order << 0 << 1 << 2 << 3; - PlayerManager::deckOrderings.push_back(order); - order.clear(); - // Corresponds to CABD - order << 1 << 2 << 0 << 3; - PlayerManager::deckOrderings.push_back(order); - order.clear(); - // Corresponds to ACDB - order << 0 << 3 << 1 << 2; - PlayerManager::deckOrderings.push_back(order); - } - return PlayerManager::deckOrderings; -} - const QList PlayerManager::getDeckOrdering() { QList order; int skin_deck_count = m_pCOSkinNumDecks->get(); diff --git a/mixxx/src/playermanager.h b/mixxx/src/playermanager.h index 95e57092474..48be5f35d18 100644 --- a/mixxx/src/playermanager.h +++ b/mixxx/src/playermanager.h @@ -87,7 +87,23 @@ class PlayerManager : public QObject { // Returns a list of lists of possible orders to load tracks into decks. // Controllers label their channels differently and these are the three combinations // we've encountered. - static const QList > getAvailableDeckOrderings(); + static const QList > getAvailableDeckOrderings() { + if (PlayerManager::deckOrderings.count() == 0) { + QList order; + // Corresponds to ABCD + order << 0 << 1 << 2 << 3; + PlayerManager::deckOrderings.push_back(order); + order.clear(); + // Corresponds to CABD + order << 1 << 2 << 0 << 3; + PlayerManager::deckOrderings.push_back(order); + order.clear(); + // Corresponds to ACDB + order << 0 << 3 << 1 << 2; + PlayerManager::deckOrderings.push_back(order); + } + return PlayerManager::deckOrderings; + } const QList getDeckOrdering(); From 8977f64dcd529aa5523c7efb7d10c1802304cdd5 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Tue, 21 May 2013 23:53:39 -0400 Subject: [PATCH 05/19] not getting number of decks on load, but otherwise working ok --- mixxx/src/baseplayer.cpp | 2 +- mixxx/src/baseplayer.h | 2 +- mixxx/src/dlgprefcontrols.cpp | 57 ++++++++++++++------- mixxx/src/dlgprefcontrols.h | 2 + mixxx/src/dlgprefcontrolsdlg.ui | 2 +- mixxx/src/playermanager.cpp | 38 +++++--------- mixxx/src/playermanager.h | 91 +++++++++++++++++++++++++++++++-- 7 files changed, 143 insertions(+), 51 deletions(-) diff --git a/mixxx/src/baseplayer.cpp b/mixxx/src/baseplayer.cpp index e7302da543c..93e3725164e 100644 --- a/mixxx/src/baseplayer.cpp +++ b/mixxx/src/baseplayer.cpp @@ -9,6 +9,6 @@ BasePlayer::~BasePlayer() { } -const QString BasePlayer::getGroup() { +const QString BasePlayer::getGroup() const { return m_group; } diff --git a/mixxx/src/baseplayer.h b/mixxx/src/baseplayer.h index 110a2b8b947..b64f915fcd5 100644 --- a/mixxx/src/baseplayer.h +++ b/mixxx/src/baseplayer.h @@ -9,7 +9,7 @@ class BasePlayer : public QObject { BasePlayer(QObject* pParent, QString group); virtual ~BasePlayer(); - const QString getGroup(); + const QString getGroup() const; private: const QString m_group; diff --git a/mixxx/src/dlgprefcontrols.cpp b/mixxx/src/dlgprefcontrols.cpp index 00bdd4fe8a9..e8815228e8a 100644 --- a/mixxx/src/dlgprefcontrols.cpp +++ b/mixxx/src/dlgprefcontrols.cpp @@ -213,24 +213,10 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); // Ordering of decks in 4-deck mode - QList > deck_orderings = m_pPlayerManager->getAvailableDeckOrderings(); - QString order = m_pConfig->getValueString(ConfigKey("[Controls]", "4DeckOrder")); - int deckorder_index = 0; - for (int i = 0; i < deck_orderings.count(); ++i) { - QString ui_order = " "; - // Orderings are given in load order, not mixer order, so we have to we have to - // do a little inefficient shuffling to display the correct letters. - for (int j = 0; j < deck_orderings[i].count(); ++j) { - ui_order[deck_orderings[i][j]] = j + 'A'; - } - if (ui_order == order) { - deckorder_index = i; - } - // TODO: Do we need to translate "ABCD," etc? If so then we need to untranslate it - // when we save to config file. - ComboBoxDeckOrder->addItem(ui_order); - } - ComboBoxDeckOrder->setCurrentIndex(deckorder_index); + QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); + int deck_count = static_cast(ControlObject::getControl( + ConfigKey("[Skin]", "num_decks"))->get()); + updateDeckOrderCombo(deck_count, config_order); connect(ComboBoxDeckOrder, SIGNAL(activated(int)), this, SLOT(slotSetDeckOrder(int))); // @@ -452,7 +438,10 @@ void DlgPrefControls::slotSetAutoDjRequeue(int) void DlgPrefControls::slotSetDeckOrder(int) { - m_pConfig->set(ConfigKey("[Controls]", "4DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); + m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); + int deck_count = static_cast(ControlObject::getControl( + ConfigKey("[Skin]", "num_decks"))->get()); + m_pConfig->set(ConfigKey("[Skin]", "num_decks"), ConfigValue(deck_count)); } void DlgPrefControls::slotSetTooltips(int) @@ -483,6 +472,9 @@ void DlgPrefControls::slotSetSkin(int) checkSkinResolution(ComboBoxSkinconf->currentText()) ? warningLabel->hide() : warningLabel->show(); slotUpdateSchemes(); + int deck_count = static_cast(ControlObject::getControl( + ConfigKey("[Skin]", "num_decks"))->get()); + updateDeckOrderCombo(deck_count); } void DlgPrefControls::slotSetPositionDisplay(int) @@ -713,3 +705,30 @@ bool DlgPrefControls::checkSkinResolution(QString skin) return !(skinWidth.toInt() > screenWidth || skinHeight.toInt() > screenHeight); } + +void DlgPrefControls::updateDeckOrderCombo(int deck_count) { + updateDeckOrderCombo(deck_count, ""); +} + +void DlgPrefControls::updateDeckOrderCombo(int deck_count, QString preselect) { + QString current_combo_val = ComboBoxDeckOrder->currentText(); + int deckorder_index = 0; + + int i = 0; + qDebug() << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PREFS " << deck_count; + + textDeckOrder->setVisible(deck_count != 0); + ComboBoxDeckOrder->setVisible(deck_count != 0); + ComboBoxDeckOrder->clear(); + + foreach(const PlayerManager::DeckOrderingManager::t_deck_order& order, + PlayerManager::getDeckOrderings(deck_count)) { + qDebug() << "INITIALIZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZING " << order.first; + ComboBoxDeckOrder->addItem(order.first); + if (order.first == preselect || order.first == current_combo_val) { + deckorder_index = i; + } + ++i; + } + ComboBoxDeckOrder->setCurrentIndex(deckorder_index); +} diff --git a/mixxx/src/dlgprefcontrols.h b/mixxx/src/dlgprefcontrols.h index b8f366bdcdf..344f9d3f522 100644 --- a/mixxx/src/dlgprefcontrols.h +++ b/mixxx/src/dlgprefcontrols.h @@ -85,6 +85,8 @@ public slots: void initWaveformControl(); void notifyRebootNecessary(); bool checkSkinResolution(QString skin); + void updateDeckOrderCombo(int deck_count); + void updateDeckOrderCombo(int deck_count, QString preselect); private: /** Pointer to ConfigObject */ diff --git a/mixxx/src/dlgprefcontrolsdlg.ui b/mixxx/src/dlgprefcontrolsdlg.ui index 1a50645c5cb..bf31ca4ff77 100644 --- a/mixxx/src/dlgprefcontrolsdlg.ui +++ b/mixxx/src/dlgprefcontrolsdlg.ui @@ -263,7 +263,7 @@ - 4-deck mode track order + Deck track load order ComboBoxDeckOrder diff --git a/mixxx/src/playermanager.cpp b/mixxx/src/playermanager.cpp index 9449b34f5d9..137104bc289 100644 --- a/mixxx/src/playermanager.cpp +++ b/mixxx/src/playermanager.cpp @@ -21,7 +21,9 @@ #include "engine/enginedeck.h" // static -QList > PlayerManager::deckOrderings; +PlayerManager::DeckOrderingManager PlayerManager::s_deckOrderingManager = + PlayerManager::DeckOrderingManager(); +PlayerManager::DeckOrderingManager::t_deck_order PlayerManager::s_currentDeckOrder; PlayerManager::PlayerManager(ConfigObject* pConfig, SoundManager* pSoundManager, @@ -55,7 +57,7 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, // Make sure the number of internal decks is in sync with the number of decks in the skin. connect(m_pCOSkinNumDecks, SIGNAL(valueChanged(double)), - this, SLOT(slotNumDecksControlChanged(double)), + this, SLOT(slotSkinNumDecksControlChanged(double)), Qt::DirectConnection); connect(m_pCOSkinNumSamplers, SIGNAL(valueChanged(double)), this, SLOT(slotNumSamplersControlChanged(double)), @@ -189,23 +191,6 @@ unsigned int PlayerManager::numPreviewDecks() { return pNumCO ? pNumCO->get() : 0; } -const QList PlayerManager::getDeckOrdering() { - QList order; - int skin_deck_count = m_pCOSkinNumDecks->get(); - if (skin_deck_count == 4) { - return PlayerManager::deckOrderings[ - m_pConfig->getValueString(ConfigKey("[Controls]","4DeckOrder")).toInt()]; - } - // A skin might not have this value defined -- assume it's an old 2-deck skin. - if (skin_deck_count == 0) { - skin_deck_count = 2; - } - for (int i = 0; i < skin_deck_count; ++i) { - order << i; - } - return order; -} - void PlayerManager::slotNumDecksControlChanged(double v) { QMutexLocker locker(&m_mutex); int num = (int)v; @@ -221,6 +206,11 @@ void PlayerManager::slotNumDecksControlChanged(double v) { } } +void PlayerManager::slotSkinNumDecksControlChanged(double v) { + PlayerManager::s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(v); + slotNumDecksControlChanged(v); +} + void PlayerManager::slotNumSamplersControlChanged(double v) { QMutexLocker locker(&m_mutex); int num = (int)v; @@ -414,11 +404,10 @@ void PlayerManager::slotLoadToSampler(QString location, int sampler) { void PlayerManager::slotLoadTrackIntoNextAvailableDeck(TrackPointer pTrack) { QMutexLocker locker(&m_mutex); - const QList& order = getDeckOrdering(); - QList::const_iterator it = order.begin(); - while (it != order.end()) { - qDebug() << "try loading " << *it; - Deck* pDeck = m_decks[*it]; + + foreach(const int& i, PlayerManager::s_currentDeckOrder.second) { + Deck* pDeck = m_decks.at(i); + qDebug() << "try loading " << i; ControlObject* playControl = ControlObject::getControl(ConfigKey(pDeck->getGroup(), "play")); if (playControl && playControl->get() != 1.) { @@ -426,7 +415,6 @@ void PlayerManager::slotLoadTrackIntoNextAvailableDeck(TrackPointer pTrack) { pDeck->slotLoadTrack(pTrack, false); return; } - ++it; } } diff --git a/mixxx/src/playermanager.h b/mixxx/src/playermanager.h index 48be5f35d18..4a10d386278 100644 --- a/mixxx/src/playermanager.h +++ b/mixxx/src/playermanager.h @@ -84,10 +84,91 @@ class PlayerManager : public QObject { return QString("[PreviewDeck%1]").arg(i+1); } + class DeckOrderingManager { + public: + typedef QPair > t_deck_order; + typedef QHash > t_orders_hash; + + DeckOrderingManager() { + addOrdering(4, "ABCD"); + addOrdering(4, "CABD"); + addOrdering(4, "ACDB"); + } + + bool addOrdering(int deck_count, QString order) { + qDebug() << "AAAAAAAAAAAASSSSSSSSSSSSSSSSSSSSSSSSSSKKKKKKKKKKKKKKKKKED TO ADD " << order; + t_deck_order new_order; + new_order.first = order; + new_order.second = makeLoadOrder(order); + // ordering will be empty on error + if (new_order.second.empty()) { + return false; + } + m_hOrdersHash[deck_count].push_back(new_order); + return true; + } + + // The first order in the list is default + t_deck_order getDefaultOrder(int deck_count) { + t_orders_hash::const_iterator it = m_hOrdersHash.find(deck_count); + if (it == m_hOrdersHash.end()) { + m_hOrdersHash[deck_count].push_back(makeDefaultOrder(deck_count)); + } + return m_hOrdersHash[deck_count].at(0); + } + + const QList getDeckOrderings(int deck_count) const { + return m_hOrdersHash[deck_count]; + } + + const QList getLoadOrder(QString deckstring) const { + t_orders_hash::const_iterator it = m_hOrdersHash.find(deckstring.length()); + if (it == m_hOrdersHash.end()) { + return QList(); + } + foreach(const t_deck_order& order, *it) { + if (order.first == deckstring) { + return order.second; + } + } + } + + private: + t_deck_order makeDefaultOrder(int deck_count) const { + QString str_order; + QList int_order; + for (int i = 0; i < deck_count; ++i) { + str_order += 'A' + i; + int_order.push_back(i); + } + return qMakePair(str_order, int_order); + } + + // Constructs a list of integers for load-order based on the string. + // If the string has errors, then we return an empty list. + QList makeLoadOrder(QString str_order) { + QList int_order; + for (int i = 0; i < str_order.length(); ++i) { + int pos = str_order.indexOf('A' + i); + if (pos == -1) { + return QList(); + } + int_order.push_back(pos); + } + return int_order; + } + + t_orders_hash m_hOrdersHash; + }; + + static const QList getDeckOrderings(int deck_count) { + return s_deckOrderingManager.getDeckOrderings(deck_count); + } + // Returns a list of lists of possible orders to load tracks into decks. // Controllers label their channels differently and these are the three combinations // we've encountered. - static const QList > getAvailableDeckOrderings() { + /*static const QList > getAvailableDeckOrderings() { if (PlayerManager::deckOrderings.count() == 0) { QList order; // Corresponds to ABCD @@ -103,9 +184,9 @@ class PlayerManager : public QObject { PlayerManager::deckOrderings.push_back(order); } return PlayerManager::deckOrderings; - } + }*/ - const QList getDeckOrdering(); + //const QList getDeckOrdering(); public slots: // Slots for loading tracks into a Player, which is either a Sampler or a Deck @@ -127,6 +208,7 @@ class PlayerManager : public QObject { void slotNumDecksControlChanged(double v); void slotNumSamplersControlChanged(double v); void slotNumPreviewDecksControlChanged(double v); + void slotSkinNumDecksControlChanged(double v); signals: void loadLocationToPlayer(QString location, QString group); @@ -163,7 +245,8 @@ class PlayerManager : public QObject { QList m_preview_decks; QMap m_players; - static QList > deckOrderings; + static DeckOrderingManager s_deckOrderingManager; + static DeckOrderingManager::t_deck_order s_currentDeckOrder; }; #endif // PLAYERMANAGER_H From b4923bc40e1c26c5489446dd9d5ccf2ccc2efda8 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Wed, 22 May 2013 13:04:18 -0400 Subject: [PATCH 06/19] clean up, and fix loading config at startup --- mixxx/src/dlgprefcontrols.cpp | 42 +++++++++++---------- mixxx/src/dlgprefcontrols.h | 4 +- mixxx/src/playermanager.cpp | 7 ++-- mixxx/src/playermanager.h | 69 +++++++++++++---------------------- 4 files changed, 55 insertions(+), 67 deletions(-) diff --git a/mixxx/src/dlgprefcontrols.cpp b/mixxx/src/dlgprefcontrols.cpp index e8815228e8a..e7e251fbc33 100644 --- a/mixxx/src/dlgprefcontrols.cpp +++ b/mixxx/src/dlgprefcontrols.cpp @@ -212,12 +212,14 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, ComboBoxAutoDjRequeue->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); - // Ordering of decks in 4-deck mode - QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); - int deck_count = static_cast(ControlObject::getControl( - ConfigKey("[Skin]", "num_decks"))->get()); - updateDeckOrderCombo(deck_count, config_order); + // Ordering of decks, if configurable + ControlObject* skin_num_decks = ControlObject::getControl(ConfigKey("[Skin]", "num_decks")); + int deck_count = static_cast(skin_num_decks->get()); + updateDeckOrderCombo(deck_count); connect(ComboBoxDeckOrder, SIGNAL(activated(int)), this, SLOT(slotSetDeckOrder(int))); + connect(skin_num_decks, SIGNAL(valueChanged(double)), + this, SLOT(slotSkinNumDecksControlChanged(double)), + Qt::DirectConnection); // // Skin configurations @@ -441,7 +443,6 @@ void DlgPrefControls::slotSetDeckOrder(int) m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); int deck_count = static_cast(ControlObject::getControl( ConfigKey("[Skin]", "num_decks"))->get()); - m_pConfig->set(ConfigKey("[Skin]", "num_decks"), ConfigValue(deck_count)); } void DlgPrefControls::slotSetTooltips(int) @@ -707,28 +708,31 @@ bool DlgPrefControls::checkSkinResolution(QString skin) } void DlgPrefControls::updateDeckOrderCombo(int deck_count) { - updateDeckOrderCombo(deck_count, ""); -} - -void DlgPrefControls::updateDeckOrderCombo(int deck_count, QString preselect) { - QString current_combo_val = ComboBoxDeckOrder->currentText(); - int deckorder_index = 0; - - int i = 0; - qDebug() << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PREFS " << deck_count; + // We always try to find the configured order because the skin deckcount value isn't set + // at construction time. We'll receive a signal when that value changes, this function + // will get called, and then we'll set the proper ordering. Since we update the config + // every time they change the value, this shouldn't cause weird overwrites. + QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); textDeckOrder->setVisible(deck_count != 0); ComboBoxDeckOrder->setVisible(deck_count != 0); ComboBoxDeckOrder->clear(); + if (deck_count == 0) { + return; + } - foreach(const PlayerManager::DeckOrderingManager::t_deck_order& order, + int deckorder_index = 0; + int i = 0; + foreach(const PlayerManager::DeckOrderingManager::deck_order_t& order, PlayerManager::getDeckOrderings(deck_count)) { - qDebug() << "INITIALIZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZING " << order.first; - ComboBoxDeckOrder->addItem(order.first); - if (order.first == preselect || order.first == current_combo_val) { + ComboBoxDeckOrder->addItem(order.label); + if (order.label == config_order) { deckorder_index = i; } ++i; } ComboBoxDeckOrder->setCurrentIndex(deckorder_index); + if (ComboBoxDeckOrder->currentText() != config_order) { + m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); + } } diff --git a/mixxx/src/dlgprefcontrols.h b/mixxx/src/dlgprefcontrols.h index 344f9d3f522..66c65475851 100644 --- a/mixxx/src/dlgprefcontrols.h +++ b/mixxx/src/dlgprefcontrols.h @@ -78,6 +78,9 @@ public slots: virtual void onShow(); virtual void onHide(); +private slots: + void slotSkinNumDecksControlChanged(double v) { updateDeckOrderCombo(v); } + protected: void timerEvent(QTimerEvent *); @@ -86,7 +89,6 @@ public slots: void notifyRebootNecessary(); bool checkSkinResolution(QString skin); void updateDeckOrderCombo(int deck_count); - void updateDeckOrderCombo(int deck_count, QString preselect); private: /** Pointer to ConfigObject */ diff --git a/mixxx/src/playermanager.cpp b/mixxx/src/playermanager.cpp index 137104bc289..d56d03dbab6 100644 --- a/mixxx/src/playermanager.cpp +++ b/mixxx/src/playermanager.cpp @@ -23,7 +23,7 @@ // static PlayerManager::DeckOrderingManager PlayerManager::s_deckOrderingManager = PlayerManager::DeckOrderingManager(); -PlayerManager::DeckOrderingManager::t_deck_order PlayerManager::s_currentDeckOrder; +PlayerManager::DeckOrderingManager::deck_order_t PlayerManager::s_currentDeckOrder; PlayerManager::PlayerManager(ConfigObject* pConfig, SoundManager* pSoundManager, @@ -207,7 +207,7 @@ void PlayerManager::slotNumDecksControlChanged(double v) { } void PlayerManager::slotSkinNumDecksControlChanged(double v) { - PlayerManager::s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(v); + s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(v); slotNumDecksControlChanged(v); } @@ -405,9 +405,8 @@ void PlayerManager::slotLoadToSampler(QString location, int sampler) { void PlayerManager::slotLoadTrackIntoNextAvailableDeck(TrackPointer pTrack) { QMutexLocker locker(&m_mutex); - foreach(const int& i, PlayerManager::s_currentDeckOrder.second) { + foreach(const int& i, s_currentDeckOrder.load_order) { Deck* pDeck = m_decks.at(i); - qDebug() << "try loading " << i; ControlObject* playControl = ControlObject::getControl(ConfigKey(pDeck->getGroup(), "play")); if (playControl && playControl->get() != 1.) { diff --git a/mixxx/src/playermanager.h b/mixxx/src/playermanager.h index 4a10d386278..af5401c9f84 100644 --- a/mixxx/src/playermanager.h +++ b/mixxx/src/playermanager.h @@ -86,62 +86,68 @@ class PlayerManager : public QObject { class DeckOrderingManager { public: - typedef QPair > t_deck_order; - typedef QHash > t_orders_hash; + struct deck_order_t { + deck_order_t() { } + deck_order_t(QString l, QList o) : label(l), load_order(o) { } + + QString label; + QList load_order; + }; + + typedef QHash > orders_hash_t; DeckOrderingManager() { + // Known orderings for 4-deck controllers. addOrdering(4, "ABCD"); addOrdering(4, "CABD"); addOrdering(4, "ACDB"); } bool addOrdering(int deck_count, QString order) { - qDebug() << "AAAAAAAAAAAASSSSSSSSSSSSSSSSSSSSSSSSSSKKKKKKKKKKKKKKKKKED TO ADD " << order; - t_deck_order new_order; - new_order.first = order; - new_order.second = makeLoadOrder(order); + deck_order_t new_order(order, makeLoadOrder(order)); // ordering will be empty on error - if (new_order.second.empty()) { + if (new_order.load_order.empty()) { return false; } m_hOrdersHash[deck_count].push_back(new_order); return true; } - // The first order in the list is default - t_deck_order getDefaultOrder(int deck_count) { - t_orders_hash::const_iterator it = m_hOrdersHash.find(deck_count); + // Just take the first order in the list is default. Make sure it's the natural ordering + // "ABCD..." + deck_order_t getDefaultOrder(int deck_count) { + orders_hash_t::const_iterator it = m_hOrdersHash.find(deck_count); if (it == m_hOrdersHash.end()) { m_hOrdersHash[deck_count].push_back(makeDefaultOrder(deck_count)); } return m_hOrdersHash[deck_count].at(0); } - const QList getDeckOrderings(int deck_count) const { + const QList getDeckOrderings(int deck_count) const { return m_hOrdersHash[deck_count]; } const QList getLoadOrder(QString deckstring) const { - t_orders_hash::const_iterator it = m_hOrdersHash.find(deckstring.length()); + orders_hash_t::const_iterator it = m_hOrdersHash.find(deckstring.length()); if (it == m_hOrdersHash.end()) { return QList(); } - foreach(const t_deck_order& order, *it) { - if (order.first == deckstring) { - return order.second; + foreach(const deck_order_t& order, *it) { + if (order.label == deckstring) { + return order.load_order; } } } private: - t_deck_order makeDefaultOrder(int deck_count) const { + deck_order_t makeDefaultOrder(int deck_count) const { QString str_order; QList int_order; for (int i = 0; i < deck_count; ++i) { str_order += 'A' + i; int_order.push_back(i); } - return qMakePair(str_order, int_order); + return deck_order_t(str_order, int_order); } // Constructs a list of integers for load-order based on the string. @@ -158,36 +164,13 @@ class PlayerManager : public QObject { return int_order; } - t_orders_hash m_hOrdersHash; + orders_hash_t m_hOrdersHash; }; - static const QList getDeckOrderings(int deck_count) { + static const QList getDeckOrderings(int deck_count) { return s_deckOrderingManager.getDeckOrderings(deck_count); } - // Returns a list of lists of possible orders to load tracks into decks. - // Controllers label their channels differently and these are the three combinations - // we've encountered. - /*static const QList > getAvailableDeckOrderings() { - if (PlayerManager::deckOrderings.count() == 0) { - QList order; - // Corresponds to ABCD - order << 0 << 1 << 2 << 3; - PlayerManager::deckOrderings.push_back(order); - order.clear(); - // Corresponds to CABD - order << 1 << 2 << 0 << 3; - PlayerManager::deckOrderings.push_back(order); - order.clear(); - // Corresponds to ACDB - order << 0 << 3 << 1 << 2; - PlayerManager::deckOrderings.push_back(order); - } - return PlayerManager::deckOrderings; - }*/ - - //const QList getDeckOrdering(); - public slots: // Slots for loading tracks into a Player, which is either a Sampler or a Deck void slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); @@ -246,7 +229,7 @@ class PlayerManager : public QObject { QMap m_players; static DeckOrderingManager s_deckOrderingManager; - static DeckOrderingManager::t_deck_order s_currentDeckOrder; + static DeckOrderingManager::deck_order_t s_currentDeckOrder; }; #endif // PLAYERMANAGER_H From 40aae88a18f47a59e26bef848f7176fc68dd6a07 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Wed, 22 May 2013 13:50:30 -0400 Subject: [PATCH 07/19] remove unused function --- mixxx/src/playermanager.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mixxx/src/playermanager.h b/mixxx/src/playermanager.h index af5401c9f84..f4ad21dd5eb 100644 --- a/mixxx/src/playermanager.h +++ b/mixxx/src/playermanager.h @@ -127,18 +127,6 @@ class PlayerManager : public QObject { return m_hOrdersHash[deck_count]; } - const QList getLoadOrder(QString deckstring) const { - orders_hash_t::const_iterator it = m_hOrdersHash.find(deckstring.length()); - if (it == m_hOrdersHash.end()) { - return QList(); - } - foreach(const deck_order_t& order, *it) { - if (order.label == deckstring) { - return order.load_order; - } - } - } - private: deck_order_t makeDefaultOrder(int deck_count) const { QString str_order; From 87810052499eda918b6e7a25deba2968b4eb60ba Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Wed, 7 Aug 2013 20:21:53 -0400 Subject: [PATCH 08/19] clean up merge conflicts --- src/dlgprefcontrols.cpp | 44 ++++++++++++++++++++++++++---------- src/engine/bpmcontrol.cpp | 1 - src/engine/enginecontrol.cpp | 2 +- src/playermanager.h | 1 - 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index 9d0519c798f..0d23279084c 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -213,7 +213,8 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); // Ordering of decks, if configurable - const int deck_count = ControlObject::get(ConfigKey("[Skin]", "num_decks")); + ControlObject* skin_num_decks = ControlObject::getControl(ConfigKey("[Skin]", "num_decks")); + int deck_count = static_cast(skin_num_decks->get()); updateDeckOrderCombo(deck_count); connect(ComboBoxDeckOrder, SIGNAL(activated(int)), this, SLOT(slotSetDeckOrder(int))); connect(skin_num_decks, SIGNAL(valueChanged(double)), @@ -259,7 +260,6 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, #endif // __AUTODJCRATES__ - // // Skin configurations // @@ -475,16 +475,6 @@ void DlgPrefControls::slotSetAutoDjRequeue(int) void DlgPrefControls::slotSetDeckOrder(int) { m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); - int deck_count = static_cast(ControlObject::getControl( - ConfigKey("[Skin]", "num_decks"))->get()); -} - -void DlgPrefControls::slotSetTooltips(int) -{ - int configValue = (ComboBoxTooltips->currentIndex() + 1) % 3; - m_pConfig->set(ConfigKey("[Controls]","Tooltips"), - ConfigValue(configValue)); - m_mixxx->setToolTips(configValue); } void DlgPrefControls::slotSetAutoDjMinimumAvailable(int a_iValue) { @@ -782,3 +772,33 @@ bool DlgPrefControls::checkSkinResolution(QString skin) return !(skinWidth.toInt() > screenWidth || skinHeight.toInt() > screenHeight); } + +void DlgPrefControls::updateDeckOrderCombo(int deck_count) { + // We always try to find the configured order because the skin deckcount value isn't set + // at construction time. We'll receive a signal when that value changes, this function + // will get called, and then we'll set the proper ordering. Since we update the config + // every time they change the value, this shouldn't cause weird overwrites. + + QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); + textDeckOrder->setVisible(deck_count != 0); + ComboBoxDeckOrder->setVisible(deck_count != 0); + ComboBoxDeckOrder->clear(); + if (deck_count == 0) { + return; + } + + int deckorder_index = 0; + int i = 0; + foreach(const PlayerManager::DeckOrderingManager::deck_order_t& order, + PlayerManager::getDeckOrderings(deck_count)) { + ComboBoxDeckOrder->addItem(order.label); + if (order.label == config_order) { + deckorder_index = i; + } + ++i; + } + ComboBoxDeckOrder->setCurrentIndex(deckorder_index); + if (ComboBoxDeckOrder->currentText() != config_order) { + m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); + } +} diff --git a/src/engine/bpmcontrol.cpp b/src/engine/bpmcontrol.cpp index 13112d7455c..f1b3fd5e62c 100644 --- a/src/engine/bpmcontrol.cpp +++ b/src/engine/bpmcontrol.cpp @@ -19,7 +19,6 @@ BpmControl::BpmControl(const char* _group, ConfigObject* _config) : EngineControl(_group, _config), m_tapFilter(this, filterLength, maxInterval) { - m_pNumDecks = ControlObject::getControl(ConfigKey("[Skin]", "num_decks")); m_pPlayButton = ControlObject::getControl(_group, "play"); m_pRateSlider = ControlObject::getControl(_group, "rate"); connect(m_pRateSlider, SIGNAL(valueChanged(double)), diff --git a/src/engine/enginecontrol.cpp b/src/engine/enginecontrol.cpp index ad094e5fff7..dcbd212bb9c 100644 --- a/src/engine/enginecontrol.cpp +++ b/src/engine/enginecontrol.cpp @@ -14,7 +14,7 @@ EngineControl::EngineControl(const char * _group, m_dTotalSamples(0), m_pEngineMaster(NULL), m_pEngineBuffer(NULL), - m_numDecks(ConfigKey("[Master]", "num_decks")) { + m_numDecks(ConfigKey("[Skin]", "num_decks")) { } EngineControl::~EngineControl() { diff --git a/src/playermanager.h b/src/playermanager.h index 57ce994830b..7f5f962c59e 100644 --- a/src/playermanager.h +++ b/src/playermanager.h @@ -203,7 +203,6 @@ class PlayerManager : public QObject { ConfigObject* m_pConfig; SoundManager* m_pSoundManager; EngineMaster* m_pEngine; - VinylControlManager* m_pVCManager; AnalyserQueue* m_pAnalyserQueue; ControlObject* m_pCONumDecks; ControlObject* m_pCONumSamplers; From 6e810026dfde570721b8a723b6a6bc5d3fdedaba Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Wed, 7 Aug 2013 21:20:35 -0400 Subject: [PATCH 09/19] fix preferences UI --- src/dlgprefcontrols.cpp | 4 +-- src/dlgprefcontrolsdlg.ui | 52 +++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index 0d23279084c..e9db8f9c8c1 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -780,8 +780,8 @@ void DlgPrefControls::updateDeckOrderCombo(int deck_count) { // every time they change the value, this shouldn't cause weird overwrites. QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); - textDeckOrder->setVisible(deck_count != 0); - ComboBoxDeckOrder->setVisible(deck_count != 0); + //textDeckOrder->setVisible(deck_count != 0); + //ComboBoxDeckOrder->setVisible(deck_count != 0); ComboBoxDeckOrder->clear(); if (deck_count == 0) { return; diff --git a/src/dlgprefcontrolsdlg.ui b/src/dlgprefcontrolsdlg.ui index 0643a02f415..bf8abb14581 100644 --- a/src/dlgprefcontrolsdlg.ui +++ b/src/dlgprefcontrolsdlg.ui @@ -208,7 +208,20 @@ - + + + + + + + Deck track load order + + + ComboBoxDeckOrder + + + + Track load behaviour @@ -218,10 +231,10 @@ - + - + Cue behaviour @@ -231,10 +244,10 @@ - + - + Auto Recall Cue @@ -244,10 +257,10 @@ - + - + Re-queue tracks in Auto DJ @@ -258,22 +271,9 @@ - - - - - - Deck track load order - - - ComboBoxDeckOrder - - - - - + Locale @@ -283,7 +283,7 @@ - + @@ -296,14 +296,14 @@ - + Auto DJ: Minimum available tracks [%] - + This percentage of tracks are always available for selecting, regardless of when they were last played. @@ -316,7 +316,7 @@ - + Uncheck, to ignore all played tracks. @@ -326,7 +326,7 @@ - + Duration after which a track is eligible for selection by Auto DJ again From d4e62c1d6aecd4fa4e690f91b9a422aa67b0956e Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Wed, 7 Aug 2013 21:49:21 -0400 Subject: [PATCH 10/19] Actually activate the selected deck ordering. BUG: only works on load. does not update the ordering if the user changes the combo box. --- src/playermanager.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/playermanager.cpp b/src/playermanager.cpp index cf8daf5d1ed..be29d7e73d7 100644 --- a/src/playermanager.cpp +++ b/src/playermanager.cpp @@ -204,7 +204,18 @@ void PlayerManager::slotNumDecksControlChanged(double v) { } void PlayerManager::slotSkinNumDecksControlChanged(double v) { - s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(v); + QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); + bool found_valid = false; + foreach(const PlayerManager::DeckOrderingManager::deck_order_t& order, + PlayerManager::getDeckOrderings(v)) { + if (order.label == config_order) { + found_valid = true; + s_currentDeckOrder = order; + } + } + if (!found_valid) { + s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(v); + } slotNumDecksControlChanged(v); } From a7f52a9776cc81f53c9c2dd2acf190400f8f159f Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Fri, 16 Aug 2013 19:33:09 -0400 Subject: [PATCH 11/19] Rewrite skins that use incorrect [Master] attribute --- src/skin/legacyskinparser.cpp | 15 ++++++++++++++- src/skin/legacyskinparser.h | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/skin/legacyskinparser.cpp b/src/skin/legacyskinparser.cpp index 63698210b88..85477e797df 100644 --- a/src/skin/legacyskinparser.cpp +++ b/src/skin/legacyskinparser.cpp @@ -222,6 +222,10 @@ SkinManifest LegacySkinParser::getSkinManifest(QDomElement skinDocument) { if (attribute_node.isElement()) { QDomElement attribute_element = attribute_node.toElement(); QString configKey = attribute_element.attribute("config_key"); + if (isLegacyAttribute(configKey)) { + qWarning() << "Warning: Skin uses old [Master] attribute instead of [Skin]"; + configKey = convertLegacyAttribute(configKey); + } QString value = attribute_element.text(); SkinManifest::Attribute* attr = manifest.add_attribute(); attr->set_config_key(configKey.toStdString()); @@ -232,6 +236,16 @@ SkinManifest LegacySkinParser::getSkinManifest(QDomElement skinDocument) { return manifest; } +// static +bool LegacySkinParser::isLegacyAttribute(QString configKey) { + return (configKey.indexOf("[Master]") != -1); +} + +// static +QString LegacySkinParser::convertLegacyAttribute(QString configKey) { + return configKey.replace("[Master]", "[Skin]"); +} + QWidget* LegacySkinParser::parseSkin(QString skinPath, QWidget* pParent) { if (m_pParent) { qDebug() << "ERROR: Somehow a parent already exists -- you are probably re-using a LegacySkinParser which is not advisable!"; @@ -1482,4 +1496,3 @@ void LegacySkinParser::addShortcutToToolTip(QWidget* pWidget, const QString& sho tooltip += nativeShortcut; pWidget->setToolTip(tooltip); } - diff --git a/src/skin/legacyskinparser.h b/src/skin/legacyskinparser.h index 09727dcd335..ae191edb61e 100644 --- a/src/skin/legacyskinparser.h +++ b/src/skin/legacyskinparser.h @@ -83,6 +83,12 @@ class LegacySkinParser : public QObject, public SkinParser { QString lookupNodeGroup(QDomElement node); static const char* safeChannelString(QString channelStr); + // Older skins used to directly set the [Master] config keys, but skins shouldn't + // have direct access to Mixxx internals. Instead change these to [Skin] and + // print a warning. + static bool isLegacyAttribute(QString configKey); + static QString convertLegacyAttribute(QString configkey); + ConfigObject* m_pConfig; MixxxKeyboard* m_pKeyboard; PlayerManager* m_pPlayerManager; From 7dadc8697d46e06c104a681fd650ddaa130fbfac Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Fri, 16 Aug 2013 19:50:44 -0400 Subject: [PATCH 12/19] Make sure to activate new deck orders. Rearrange UI --- src/dlgprefcontrols.cpp | 4 +++- src/dlgprefcontrolsdlg.ui | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index e9db8f9c8c1..25a3fa73bc8 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -474,7 +474,9 @@ void DlgPrefControls::slotSetAutoDjRequeue(int) void DlgPrefControls::slotSetDeckOrder(int) { - m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); + QString deckorder = ComboBoxDeckOrder->currentText(); + m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(deckorder)); + m_pPlayerManager->slotSkinNumDecksControlChanged(deckorder.length()); } void DlgPrefControls::slotSetAutoDjMinimumAvailable(int a_iValue) { diff --git a/src/dlgprefcontrolsdlg.ui b/src/dlgprefcontrolsdlg.ui index bf8abb14581..95bd648e68c 100644 --- a/src/dlgprefcontrolsdlg.ui +++ b/src/dlgprefcontrolsdlg.ui @@ -80,7 +80,7 @@ - + true @@ -99,7 +99,7 @@ - + @@ -112,7 +112,7 @@ - + true @@ -131,7 +131,7 @@ - + @@ -144,7 +144,7 @@ - + true @@ -163,7 +163,7 @@ - + @@ -176,7 +176,7 @@ - + true @@ -195,7 +195,7 @@ - + @@ -208,10 +208,10 @@ - + - + Deck track load order From 7574921b8c8488d03f423a8a822a6451365d304f Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sun, 18 Aug 2013 12:52:42 -0400 Subject: [PATCH 13/19] Change deck orientations after skin has been loaded --- src/playermanager.cpp | 15 +++++++++++++++ src/playermanager.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/playermanager.cpp b/src/playermanager.cpp index be29d7e73d7..e0cfcfc0bdd 100644 --- a/src/playermanager.cpp +++ b/src/playermanager.cpp @@ -217,6 +217,21 @@ void PlayerManager::slotSkinNumDecksControlChanged(double v) { s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(v); } slotNumDecksControlChanged(v); + reorientDecks(); +} + +void PlayerManager::reorientDecks() { + int total_decks = static_cast(m_pCOSkinNumDecks->get()); + for (int i = 1; i < total_decks + 1; ++i) { + ControlObject* orientation = + ControlObject::getControl( + ConfigKey(QString("[Channel%1]").arg(i), "orientation")); + if (i > total_decks / 2) { + orientation->set(EngineChannel::RIGHT); + } else { + orientation->set(EngineChannel::LEFT); + } + } } void PlayerManager::slotNumSamplersControlChanged(double v) { diff --git a/src/playermanager.h b/src/playermanager.h index 7f5f962c59e..7a1f092249f 100644 --- a/src/playermanager.h +++ b/src/playermanager.h @@ -196,6 +196,9 @@ class PlayerManager : public QObject { // Must hold m_mutex before calling this method. Internal method that // creates a new preview deck. void addPreviewDeckInner(); + // When the skin changes, we need to change the orientations of the decks + // because deck B might have moved from the right to the left. + void reorientDecks(); // Used to protect access to PlayerManager state across threads. mutable QMutex m_mutex; From 733bdd7ddf17901ef288da6c67beb967fda1df6d Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sat, 21 Dec 2013 13:49:31 -0500 Subject: [PATCH 14/19] eliminate [Skin]/decks COs --- src/controllers/dlgcontrollerlearning.cpp | 8 ++--- src/dlgprefcontrols.cpp | 9 +++-- src/engine/enginecontrol.cpp | 2 +- src/playermanager.cpp | 42 ++--------------------- src/playermanager.h | 4 --- src/skin/legacyskinparser.cpp | 14 -------- src/skin/legacyskinparser.h | 6 ---- src/widget/wtracktableview.cpp | 6 ++-- 8 files changed, 14 insertions(+), 77 deletions(-) diff --git a/src/controllers/dlgcontrollerlearning.cpp b/src/controllers/dlgcontrollerlearning.cpp index 12e73006791..f8e1d00dd56 100644 --- a/src/controllers/dlgcontrollerlearning.cpp +++ b/src/controllers/dlgcontrollerlearning.cpp @@ -216,7 +216,7 @@ DlgControllerLearning::DlgControllerLearning(QWidget * parent, addControl("[Vinylcontrol]", "show_vinylcontrol", tr("Show/hide the vinyl control section"), guiMenu); addControl("[PreviewDeck]", "show_previewdeck", tr("Show/hide the preview deck"), guiMenu); - const int iNumDecks = ControlObject::get(ConfigKey("[Skin]", "num_decks")); + const int iNumDecks = ControlObject::get(ConfigKey("[Master]", "num_decks")); QString spinnyText = tr("Show/hide spinning vinyl widget"); for (int i = 1; i <= iNumDecks; ++i) { addControl(QString("[Spinny%1]").arg(i), "show_spinny", @@ -257,9 +257,9 @@ void DlgControllerLearning::addControl(QString group, QString control, QString d void DlgControllerLearning::addPlayerControl( QString control, QString controlDescription, QMenu* pMenu, bool deckControls, bool samplerControls, bool previewdeckControls, bool addReset) { - const int iNumSamplers = ControlObject::get(ConfigKey("[Skin]", "num_samplers")); - const int iNumDecks = ControlObject::get(ConfigKey("[Skin]", "num_decks")); - const int iNumPreviewDecks = ControlObject::get(ConfigKey("[Skin]", "num_preview_decks")); + const int iNumSamplers = ControlObject::get(ConfigKey("[Master]", "num_samplers")); + const int iNumDecks = ControlObject::get(ConfigKey("[Master]", "num_decks")); + const int iNumPreviewDecks = ControlObject::get(ConfigKey("[Master]", "num_preview_decks")); QMenu* controlMenu = new QMenu(controlDescription, pMenu); pMenu->addMenu(controlMenu); diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index 511de821161..0cfe57df9a3 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -197,11 +197,11 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); // Ordering of decks, if configurable - ControlObject* skin_num_decks = ControlObject::getControl(ConfigKey("[Skin]", "num_decks")); - int deck_count = static_cast(skin_num_decks->get()); + ControlObject* num_decks = ControlObject::getControl(ConfigKey("[Master]", "num_decks")); + int deck_count = static_cast(num_decks->get()); updateDeckOrderCombo(deck_count); connect(ComboBoxDeckOrder, SIGNAL(activated(int)), this, SLOT(slotSetDeckOrder(int))); - connect(skin_num_decks, SIGNAL(valueChanged(double)), + connect(num_decks, SIGNAL(valueChanged(double)), this, SLOT(slotSkinNumDecksControlChanged(double)), Qt::DirectConnection); @@ -462,7 +462,6 @@ void DlgPrefControls::slotSetDeckOrder(int) { QString deckorder = ComboBoxDeckOrder->currentText(); m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(deckorder)); - m_pPlayerManager->slotSkinNumDecksControlChanged(deckorder.length()); } void DlgPrefControls::slotSetAutoDjMinimumAvailable(int a_iValue) { @@ -514,7 +513,7 @@ void DlgPrefControls::slotSetSkin(int) checkSkinResolution(ComboBoxSkinconf->currentText()) ? warningLabel->hide() : warningLabel->show(); slotUpdateSchemes(); - const int deck_count = ControlObject::get(ConfigKey("[Skin]", "num_decks")); + const int deck_count = ControlObject::get(ConfigKey("[Master]", "num_decks")); updateDeckOrderCombo(deck_count); } diff --git a/src/engine/enginecontrol.cpp b/src/engine/enginecontrol.cpp index 5d076b23370..6be7c8c315f 100644 --- a/src/engine/enginecontrol.cpp +++ b/src/engine/enginecontrol.cpp @@ -13,7 +13,7 @@ EngineControl::EngineControl(const char* _group, m_dTotalSamples(0), m_pEngineMaster(NULL), m_pEngineBuffer(NULL), - m_numDecks(ConfigKey("[Skin]", "num_decks")) { + m_numDecks(ConfigKey("[Master]", "num_decks")) { m_dCurrentSample.setValue(0); } diff --git a/src/playermanager.cpp b/src/playermanager.cpp index 893c0217765..7f07e664545 100644 --- a/src/playermanager.cpp +++ b/src/playermanager.cpp @@ -36,11 +36,7 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, m_pAnalyserQueue(NULL), m_pCONumDecks(new ControlObject(ConfigKey("[Master]", "num_decks"), true, true)), m_pCONumSamplers(new ControlObject(ConfigKey("[Master]", "num_samplers"), true, true)), - m_pCONumPreviewDecks(new ControlObject(ConfigKey("[Master]", "num_preview_decks"), - true, true)), - m_pCOSkinNumDecks(new ControlObject(ConfigKey("[Skin]", "num_decks"), true, true)), - m_pCOSkinNumSamplers(new ControlObject(ConfigKey("[Skin]", "num_samplers"), true, true)), - m_pCOSkinNumPreviewDecks(new ControlObject(ConfigKey("[Skin]", "num_preview_decks"), true, true)) { + m_pCONumPreviewDecks(new ControlObject(ConfigKey("[Master]", "num_preview_decks"), true, true)) { connect(m_pCONumDecks, SIGNAL(valueChanged(double)), this, SLOT(slotNumDecksControlChanged(double)), @@ -52,17 +48,6 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, this, SLOT(slotNumPreviewDecksControlChanged(double)), Qt::DirectConnection); - // Make sure the number of internal decks is in sync with the number of decks in the skin. - connect(m_pCOSkinNumDecks, SIGNAL(valueChanged(double)), - this, SLOT(slotSkinNumDecksControlChanged(double)), - Qt::DirectConnection); - connect(m_pCOSkinNumSamplers, SIGNAL(valueChanged(double)), - this, SLOT(slotNumSamplersControlChanged(double)), - Qt::DirectConnection); - connect(m_pCOSkinNumPreviewDecks, SIGNAL(valueChanged(double)), - this, SLOT(slotNumPreviewDecksControlChanged(double)), - Qt::DirectConnection); - // This is parented to the PlayerManager so does not need to be deleted SamplerBank* pSamplerBank = new SamplerBank(this); Q_UNUSED(pSamplerBank); @@ -71,9 +56,6 @@ PlayerManager::PlayerManager(ConfigObject* pConfig, m_pCONumDecks->set(0); m_pCONumSamplers->set(0); m_pCONumPreviewDecks->set(0); - m_pCOSkinNumDecks->set(0); - m_pCOSkinNumSamplers->set(0); - m_pCOSkinNumPreviewDecks->set(0); // register the engine's outputs m_pSoundManager->registerOutput(AudioOutput(AudioOutput::MASTER), @@ -97,9 +79,6 @@ PlayerManager::~PlayerManager() { delete m_pCONumSamplers; delete m_pCONumDecks; delete m_pCONumPreviewDecks; - delete m_pCOSkinNumDecks; - delete m_pCOSkinNumSamplers; - delete m_pCOSkinNumPreviewDecks; if (m_pAnalyserQueue) { delete m_pAnalyserQueue; } @@ -207,25 +186,8 @@ void PlayerManager::slotNumDecksControlChanged(double v) { } } -void PlayerManager::slotSkinNumDecksControlChanged(double v) { - QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); - bool found_valid = false; - foreach(const PlayerManager::DeckOrderingManager::deck_order_t& order, - PlayerManager::getDeckOrderings(v)) { - if (order.label == config_order) { - found_valid = true; - s_currentDeckOrder = order; - } - } - if (!found_valid) { - s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(v); - } - slotNumDecksControlChanged(v); - reorientDecks(); -} - void PlayerManager::reorientDecks() { - int total_decks = static_cast(m_pCOSkinNumDecks->get()); + int total_decks = static_cast(m_pCONumDecks->get()); for (int i = 1; i < total_decks + 1; ++i) { ControlObject* orientation = ControlObject::getControl( diff --git a/src/playermanager.h b/src/playermanager.h index 7a1f092249f..2c3b60da540 100644 --- a/src/playermanager.h +++ b/src/playermanager.h @@ -180,7 +180,6 @@ class PlayerManager : public QObject { void slotNumDecksControlChanged(double v); void slotNumSamplersControlChanged(double v); void slotNumPreviewDecksControlChanged(double v); - void slotSkinNumDecksControlChanged(double v); signals: void loadLocationToPlayer(QString location, QString group); @@ -210,9 +209,6 @@ class PlayerManager : public QObject { ControlObject* m_pCONumDecks; ControlObject* m_pCONumSamplers; ControlObject* m_pCONumPreviewDecks; - ControlObject* m_pCOSkinNumDecks; - ControlObject* m_pCOSkinNumSamplers; - ControlObject* m_pCOSkinNumPreviewDecks; QList m_decks; QList m_samplers; diff --git a/src/skin/legacyskinparser.cpp b/src/skin/legacyskinparser.cpp index 485c0412560..8884c67fa97 100644 --- a/src/skin/legacyskinparser.cpp +++ b/src/skin/legacyskinparser.cpp @@ -224,10 +224,6 @@ SkinManifest LegacySkinParser::getSkinManifest(QDomElement skinDocument) { if (attribute_node.isElement()) { QDomElement attribute_element = attribute_node.toElement(); QString configKey = attribute_element.attribute("config_key"); - if (isLegacyAttribute(configKey)) { - qWarning() << "Warning: Skin uses old [Master] attribute instead of [Skin]"; - configKey = convertLegacyAttribute(configKey); - } QString value = attribute_element.text(); SkinManifest::Attribute* attr = manifest.add_attribute(); attr->set_config_key(configKey.toStdString()); @@ -238,16 +234,6 @@ SkinManifest LegacySkinParser::getSkinManifest(QDomElement skinDocument) { return manifest; } -// static -bool LegacySkinParser::isLegacyAttribute(QString configKey) { - return (configKey.indexOf("[Master]") != -1); -} - -// static -QString LegacySkinParser::convertLegacyAttribute(QString configKey) { - return configKey.replace("[Master]", "[Skin]"); -} - QWidget* LegacySkinParser::parseSkin(QString skinPath, QWidget* pParent) { if (m_pParent) { qDebug() << "ERROR: Somehow a parent already exists -- you are probably re-using a LegacySkinParser which is not advisable!"; diff --git a/src/skin/legacyskinparser.h b/src/skin/legacyskinparser.h index 64319ce6573..593756c3112 100644 --- a/src/skin/legacyskinparser.h +++ b/src/skin/legacyskinparser.h @@ -83,12 +83,6 @@ class LegacySkinParser : public QObject, public SkinParser { QString lookupNodeGroup(QDomElement node); static const char* safeChannelString(QString channelStr); - // Older skins used to directly set the [Master] config keys, but skins shouldn't - // have direct access to Mixxx internals. Instead change these to [Skin] and - // print a warning. - static bool isLegacyAttribute(QString configKey); - static QString convertLegacyAttribute(QString configkey); - ConfigObject* m_pConfig; MixxxKeyboard* m_pKeyboard; PlayerManager* m_pPlayerManager; diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 3b3c5008b9e..b9f5677d863 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -51,11 +51,11 @@ WTrackTableView::WTrackTableView(QWidget * parent, this, SLOT(slotScaleBpm(int))); m_pNumSamplers = new ControlObjectThread( - "[Skin]", "num_samplers"); + "[Master]", "num_samplers"); m_pNumDecks = new ControlObjectThread( - "[Skin]", "num_decks"); + "[Master]", "num_decks"); m_pNumPreviewDecks = new ControlObjectThread( - "[Skin]", "num_preview_decks"); + "[Master]", "num_preview_decks"); m_pMenu = new QMenu(this); From 4ad2ac91b82dae6e118620661614c887a07e4203 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sat, 21 Dec 2013 15:22:36 -0500 Subject: [PATCH 15/19] fix deck order not getting saved/loaded properly Conflicts: src/dlgprefcontrols.cpp --- src/dlgprefcontrols.cpp | 80 +++++++++++++++++++++-------------------- src/dlgprefcontrols.h | 2 +- src/playermanager.cpp | 17 +++++++++ src/playermanager.h | 2 ++ 4 files changed, 62 insertions(+), 39 deletions(-) diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index 0cfe57df9a3..263eb92616f 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -197,13 +197,9 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); // Ordering of decks, if configurable - ControlObject* num_decks = ControlObject::getControl(ConfigKey("[Master]", "num_decks")); - int deck_count = static_cast(num_decks->get()); + int deck_count = static_cast(m_pNumDecks->get()); updateDeckOrderCombo(deck_count); connect(ComboBoxDeckOrder, SIGNAL(activated(int)), this, SLOT(slotSetDeckOrder(int))); - connect(num_decks, SIGNAL(valueChanged(double)), - this, SLOT(slotSkinNumDecksControlChanged(double)), - Qt::DirectConnection); #ifdef __AUTODJCRATES__ @@ -248,7 +244,7 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, // Skin configurations // QString warningString = "" - + tr("The minimum size of the selected skin is bigger than your screen resolution."); + + tr("The selected skin is bigger than your screen resolution."); warningLabel->setText(warningString); ComboBoxSkinconf->clear(); @@ -265,7 +261,7 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, if (list.at(i).fileName()!="." && list.at(i).fileName()!="..") { checkSkinResolution(list.at(i).fileName()) - ? ComboBoxSkinconf->insertItem(i, list.at(i).fileName()) + ? ComboBoxSkinconf->insertItem(i, QIcon(":/trolltech/styles/commonstyle/images/standardbutton-apply-32.png"), list.at(i).fileName()) : ComboBoxSkinconf->insertItem(i, QIcon(":/images/preferences/ic_preferences_warning.png"), list.at(i).fileName()); if (list.at(i).filePath() == configuredSkinPath) { @@ -462,6 +458,8 @@ void DlgPrefControls::slotSetDeckOrder(int) { QString deckorder = ComboBoxDeckOrder->currentText(); m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(deckorder)); + updateDeckOrderCombo(static_cast(m_pNumDecks->get())); + m_pPlayerManager->setDeckOrder(deckorder); } void DlgPrefControls::slotSetAutoDjMinimumAvailable(int a_iValue) { @@ -513,7 +511,7 @@ void DlgPrefControls::slotSetSkin(int) checkSkinResolution(ComboBoxSkinconf->currentText()) ? warningLabel->hide() : warningLabel->show(); slotUpdateSchemes(); - const int deck_count = ControlObject::get(ConfigKey("[Master]", "num_decks")); + const int deck_count = static_cast(m_pNumDecks->get()); updateDeckOrderCombo(deck_count); } @@ -614,6 +612,7 @@ void DlgPrefControls::slotApply() else m_pConfig->set(ConfigKey("[Controls]","RateDir"), ConfigValue(1)); + slotSetDeckOrder(ComboBoxDeckOrder->currentIndex()); } void DlgPrefControls::slotSetFrameRate(int frameRate) { @@ -755,36 +754,6 @@ bool DlgPrefControls::checkSkinResolution(QString skin) return !(skinWidth.toInt() > screenWidth || skinHeight.toInt() > screenHeight); } -void DlgPrefControls::updateDeckOrderCombo(int deck_count) { - // We always try to find the configured order because the skin deckcount value isn't set - // at construction time. We'll receive a signal when that value changes, this function - // will get called, and then we'll set the proper ordering. Since we update the config - // every time they change the value, this shouldn't cause weird overwrites. - - QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); - //textDeckOrder->setVisible(deck_count != 0); - //ComboBoxDeckOrder->setVisible(deck_count != 0); - ComboBoxDeckOrder->clear(); - if (deck_count == 0) { - return; - } - - int deckorder_index = 0; - int i = 0; - foreach(const PlayerManager::DeckOrderingManager::deck_order_t& order, - PlayerManager::getDeckOrderings(deck_count)) { - ComboBoxDeckOrder->addItem(order.label); - if (order.label == config_order) { - deckorder_index = i; - } - ++i; - } - ComboBoxDeckOrder->setCurrentIndex(deckorder_index); - if (ComboBoxDeckOrder->currentText() != config_order) { - m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); - } -} - void DlgPrefControls::slotNumDecksChanged(double new_count) { int numdecks = static_cast(new_count); if (numdecks <= m_iNumConfiguredDecks) { @@ -807,6 +776,7 @@ void DlgPrefControls::slotNumDecksChanged(double new_count) { m_iNumConfiguredDecks = numdecks; slotSetRateDir(m_pConfig->getValueString(ConfigKey("[Controls]","RateDir")).toInt()); slotSetRateRange(m_pConfig->getValueString(ConfigKey("[Controls]","RateRange")).toInt()); + updateDeckOrderCombo(numdecks); } void DlgPrefControls::slotNumSamplersChanged(double new_count) { @@ -831,3 +801,37 @@ void DlgPrefControls::slotNumSamplersChanged(double new_count) { slotSetRateDir(m_pConfig->getValueString(ConfigKey("[Controls]","RateDir")).toInt()); slotSetRateRange(m_pConfig->getValueString(ConfigKey("[Controls]","RateRange")).toInt()); } + +void DlgPrefControls::updateDeckOrderCombo(int deck_count) { + // We always try to find the configured order because the skin deckcount value isn't set + // at construction time. We'll receive a signal when that value changes, this function + // will get called, and then we'll set the proper ordering. Since we update the config + // every time they change the value, this shouldn't cause weird overwrites. + + QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); + //textDeckOrder->setVisible(deck_count != 0); + //ComboBoxDeckOrder->setVisible(deck_count != 0); + ComboBoxDeckOrder->clear(); + if (deck_count == 0) { + return; + } + + int deckorder_index = -1; + int i = 0; + foreach(const PlayerManager::DeckOrderingManager::deck_order_t& order, + PlayerManager::getDeckOrderings(deck_count)) { + ComboBoxDeckOrder->addItem(order.label); + if (order.label == config_order) { + deckorder_index = i; + } + ++i; + } + if (deckorder_index >= 0) { + ComboBoxDeckOrder->setCurrentIndex(deckorder_index); + if (ComboBoxDeckOrder->currentText() != config_order) { + m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), + ConfigValue(ComboBoxDeckOrder->currentText())); + } + } +} + diff --git a/src/dlgprefcontrols.h b/src/dlgprefcontrols.h index f5b5779ab53..20b3bbea25b 100644 --- a/src/dlgprefcontrols.h +++ b/src/dlgprefcontrols.h @@ -72,7 +72,6 @@ class DlgPrefControls : public DlgPreferencePage, public Ui::DlgPrefControlsDlg void slotSetRateRampSensitivity(int); void slotSetLocale(int); - void slotSetFrameRate(int frameRate); void slotSetWaveformType(int index); void slotSetWaveformOverviewType(int index); @@ -85,6 +84,7 @@ class DlgPrefControls : public DlgPreferencePage, public Ui::DlgPrefControlsDlg void slotSetNormalizeOverview( bool normalize); void slotWaveformMeasured(float frameRate, int rtErrorCnt); + private slots: void slotNumDecksChanged(double); void slotNumSamplersChanged(double); diff --git a/src/playermanager.cpp b/src/playermanager.cpp index 7f07e664545..1cabc596ff0 100644 --- a/src/playermanager.cpp +++ b/src/playermanager.cpp @@ -173,6 +173,7 @@ unsigned int PlayerManager::numPreviewDecks() { void PlayerManager::slotNumDecksControlChanged(double v) { QMutexLocker locker(&m_mutex); + int num = (int)v; if (num < m_decks.size()) { // The request was invalid -- reset the value. @@ -186,6 +187,22 @@ void PlayerManager::slotNumDecksControlChanged(double v) { } } +void PlayerManager::setDeckOrder(QString deckorder) { + int num_decks = m_pCONumDecks->get(); + bool found_valid = false; + foreach(const PlayerManager::DeckOrderingManager::deck_order_t& order, + PlayerManager::getDeckOrderings(num_decks)) { + if (order.label == deckorder) { + found_valid = true; + s_currentDeckOrder = order; + } + } + if (!found_valid) { + s_currentDeckOrder = s_deckOrderingManager.getDefaultOrder(num_decks); + } + reorientDecks(); +} + void PlayerManager::reorientDecks() { int total_decks = static_cast(m_pCONumDecks->get()); for (int i = 1; i < total_decks + 1; ++i) { diff --git a/src/playermanager.h b/src/playermanager.h index 2c3b60da540..7431249a5f7 100644 --- a/src/playermanager.h +++ b/src/playermanager.h @@ -160,6 +160,8 @@ class PlayerManager : public QObject { return s_deckOrderingManager.getDeckOrderings(deck_count); } + void setDeckOrder(QString order); + public slots: // Slots for loading tracks into a Player, which is either a Sampler or a Deck void slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); From da7868127ce3face0f71684386134e469e7d5524 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sun, 22 Dec 2013 14:55:33 -0500 Subject: [PATCH 16/19] Fix tracks not loading on startup --- src/dlgprefcontrols.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index 263eb92616f..cbee448cd7a 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -832,6 +832,7 @@ void DlgPrefControls::updateDeckOrderCombo(int deck_count) { m_pConfig->set(ConfigKey("[Controls]", "DeckOrder"), ConfigValue(ComboBoxDeckOrder->currentText())); } + m_pPlayerManager->setDeckOrder(config_order); } } From 36f4ba3538b2f768f96aaa6cf1fbd33392a888bd Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sun, 29 Dec 2013 22:02:34 -0500 Subject: [PATCH 17/19] Revert changes in skins -- don't need [Skin] attributes --- res/skins/Deere1280x1024-SXGA/skin.xml | 16 ++++++++-------- res/skins/Deere1280x800-WXGA/skin.xml | 16 ++++++++-------- res/skins/Deere1366x768-WXGA/skin.xml | 16 ++++++++-------- res/skins/Deere1440x900-WXGA+/skin.xml | 16 ++++++++-------- res/skins/Deere1920x1080-FullHD/skin.xml | 16 ++++++++-------- res/skins/Deere1920x1200-WUXGA/skin.xml | 16 ++++++++-------- .../DeereSamplegrid1280x800-WXGA/skin.xml | 6 +++--- res/skins/LateNight1280x1024-SXGA/skin.xml | 16 ++++++++-------- res/skins/LateNight1280x800-WXGA/skin.xml | 16 ++++++++-------- res/skins/LateNight1366x768-WXGA/skin.xml | 16 ++++++++-------- .../LateNightBlues1280x1024-SXGA/skin.xml | 16 ++++++++-------- res/skins/LateNightBlues1280x800-WXGA/skin.xml | 16 ++++++++-------- res/skins/LateNightBlues1366x768-WXGA/skin.xml | 16 ++++++++-------- res/skins/Outline1024x600-Netbook/skin.xml | 18 +++++++++--------- res/skins/Outline1024x768-XGA/skin.xml | 18 +++++++++--------- res/skins/Outline800x480-WVGA/skin.xml | 12 ++++++------ res/skins/Phoney1600x1200-UXGA/skin.xml | 6 +++--- res/skins/Phoney1680x1050-WSXGA/skin.xml | 6 +++--- res/skins/PhoneyDark1600x1200-UXGA/skin.xml | 6 +++--- res/skins/PhoneyDark1680x1050-WSXGA/skin.xml | 6 +++--- res/skins/Shade1024x600-Netbook/skin.xml | 16 ++++++++-------- res/skins/Shade1024x768-XGA/skin.xml | 16 ++++++++-------- res/skins/ShadeDark1024x600-Netbook/skin.xml | 16 ++++++++-------- res/skins/ShadeDark1024x768-XGA/skin.xml | 6 +++--- 24 files changed, 162 insertions(+), 162 deletions(-) diff --git a/res/skins/Deere1280x1024-SXGA/skin.xml b/res/skins/Deere1280x1024-SXGA/skin.xml index 677d052feca..5cc0ff4b062 100644 --- a/res/skins/Deere1280x1024-SXGA/skin.xml +++ b/res/skins/Deere1280x1024-SXGA/skin.xml @@ -16,7 +16,7 @@ Under the following conditions: Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). - A attribution should include the following: The name of the author and/or licensor, + A attribution should include the following: The name of the author and/or licensor, the title of the work, the URL that is associated with the work. Share Alike - If you alter, transform, or build upon this work, you may distribute @@ -58,9 +58,9 @@ en Creative Commons Attribution, Share-Alike 3.0 Unported - 2 - 4 - 1 + 2 + 4 + 1 1 1 @@ -2243,7 +2243,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2299,7 +2299,7 @@ --> text - + 1 1 @@ -2243,7 +2243,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2299,7 +2299,7 @@ --> text - + 1 1 @@ -2243,7 +2243,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2299,7 +2299,7 @@ --> text - + 1 1 @@ -2243,7 +2243,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2299,7 +2299,7 @@ --> text - + 1 1 @@ -3271,7 +3271,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -3327,7 +3327,7 @@ --> text - + 1 1 @@ -3271,7 +3271,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -3327,7 +3327,7 @@ --> text - + 1 1 diff --git a/res/skins/LateNight1280x1024-SXGA/skin.xml b/res/skins/LateNight1280x1024-SXGA/skin.xml index 198233debfe..0cec6116608 100644 --- a/res/skins/LateNight1280x1024-SXGA/skin.xml +++ b/res/skins/LateNight1280x1024-SXGA/skin.xml @@ -16,7 +16,7 @@ Under the following conditions: Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). - A attribution should include the following: The name of the author and/or licensor, + A attribution should include the following: The name of the author and/or licensor, the title of the work, the URL that is associated with the work. Share Alike - If you alter, transform, or build upon this work, you may distribute @@ -58,9 +58,9 @@ en Creative Commons Attribution, Share-Alike 3.0 Unported - 2 - 4 - 1 + 2 + 4 + 1 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -2242,7 +2242,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0; } QTreeView::branch:has-children:!has-siblings:closed, @@ -2298,7 +2298,7 @@ --> text - + 1 1 @@ -901,7 +901,7 @@ visual_bpm - + QTableView, QTextBrowser, QTreeView { font: 13px/15px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; } QTableView::indicator { width: 12px; height: 12px;} QTableView::indicator:checked { background: url(skin:/style/style_checkbox_checked.png);} diff --git a/res/skins/Outline1024x768-XGA/skin.xml b/res/skins/Outline1024x768-XGA/skin.xml index 6dc447698df..943a9e7f165 100644 --- a/res/skins/Outline1024x768-XGA/skin.xml +++ b/res/skins/Outline1024x768-XGA/skin.xml @@ -52,9 +52,9 @@ en GNU General Public License, version 2 or later - 2 - 4 - 0 + 2 + 4 + 0 1 1 @@ -901,7 +901,7 @@ visual_bpm - + QTableView, QTextBrowser, QTreeView { font: 13px/15px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; } QTableView::indicator { width: 12px; height: 12px;} QTableView::indicator:checked { background: url(skin:/style/style_checkbox_checked.png);} diff --git a/res/skins/Outline800x480-WVGA/skin.xml b/res/skins/Outline800x480-WVGA/skin.xml index 1d3566f2085..a0ef6f8b85b 100644 --- a/res/skins/Outline800x480-WVGA/skin.xml +++ b/res/skins/Outline800x480-WVGA/skin.xml @@ -52,9 +52,9 @@ en GNU General Public License, version 2 or later - 2 - 3 - 0 + 2 + 3 + 0 1 1 @@ -898,7 +898,7 @@ visual_bpm + 1 1 @@ -2240,7 +2240,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0;} QTreeView::branch:has-children:!has-siblings:closed, @@ -2296,7 +2296,7 @@ --> text - + 1 1 @@ -2240,7 +2240,7 @@ QTreeView { margin: 6px 0px 0px 0px; } - + QTreeView { show-decoration-selected: 0;} QTreeView::branch:has-children:!has-siblings:closed, @@ -2296,7 +2296,7 @@ --> text - + 1 1 From 1d9b748ae17836bb809e2decddb37316b9c278cb Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sun, 29 Dec 2013 22:07:20 -0500 Subject: [PATCH 18/19] Fix bad merges --- src/dlgprefcontrols.cpp | 4 ++-- src/dlgprefcontrols.h | 6 ------ src/playermanager.cpp | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index cbee448cd7a..370ab1fb355 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -244,7 +244,7 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, // Skin configurations // QString warningString = "" - + tr("The selected skin is bigger than your screen resolution."); + + tr("The minimum size of the selected skin is bigger than your screen resolution."); warningLabel->setText(warningString); ComboBoxSkinconf->clear(); @@ -261,7 +261,7 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, if (list.at(i).fileName()!="." && list.at(i).fileName()!="..") { checkSkinResolution(list.at(i).fileName()) - ? ComboBoxSkinconf->insertItem(i, QIcon(":/trolltech/styles/commonstyle/images/standardbutton-apply-32.png"), list.at(i).fileName()) + ? ComboBoxSkinconf->insertItem(i, list.at(i).fileName()) : ComboBoxSkinconf->insertItem(i, QIcon(":/images/preferences/ic_preferences_warning.png"), list.at(i).fileName()); if (list.at(i).filePath() == configuredSkinPath) { diff --git a/src/dlgprefcontrols.h b/src/dlgprefcontrols.h index 20b3bbea25b..a4ed028c3fd 100644 --- a/src/dlgprefcontrols.h +++ b/src/dlgprefcontrols.h @@ -88,12 +88,6 @@ class DlgPrefControls : public DlgPreferencePage, public Ui::DlgPrefControlsDlg void slotNumDecksChanged(double); void slotNumSamplersChanged(double); - private slots: - void slotSkinNumDecksControlChanged(double v) { updateDeckOrderCombo(v); } - - protected: - void timerEvent(QTimerEvent *); - private: void initWaveformControl(); void notifyRebootNecessary(); diff --git a/src/playermanager.cpp b/src/playermanager.cpp index 1cabc596ff0..a353348cb45 100644 --- a/src/playermanager.cpp +++ b/src/playermanager.cpp @@ -173,7 +173,6 @@ unsigned int PlayerManager::numPreviewDecks() { void PlayerManager::slotNumDecksControlChanged(double v) { QMutexLocker locker(&m_mutex); - int num = (int)v; if (num < m_decks.size()) { // The request was invalid -- reset the value. From f3d0f4ae838409e8e27e11cb3df4695449ed1a52 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Mon, 3 Feb 2014 13:51:35 -0500 Subject: [PATCH 19/19] Temporarily make deck ordering non-configurable. 4-deck setups default to CABD --- src/dlgprefcontrols.cpp | 12 ++++++++++-- src/dlgprefcontrolsdlg.ui | 3 +++ src/playermanager.h | 13 +++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index aac2f5dc8a5..09361fadd9e 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -807,7 +807,16 @@ void DlgPrefControls::updateDeckOrderCombo(int deck_count) { // will get called, and then we'll set the proper ordering. Since we update the config // every time they change the value, this shouldn't cause weird overwrites. - QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); + // Temporarily, all 4-deck setups will use the same order + QString config_order; + if (deck_count == 4) { + config_order = "CABD"; + } else { + config_order = PlayerManager::getDefaultOrder(deck_count).label; + } + + // Eventually, load from config: + //QString config_order = m_pConfig->getValueString(ConfigKey("[Controls]", "DeckOrder")); //textDeckOrder->setVisible(deck_count != 0); //ComboBoxDeckOrder->setVisible(deck_count != 0); ComboBoxDeckOrder->clear(); @@ -834,4 +843,3 @@ void DlgPrefControls::updateDeckOrderCombo(int deck_count) { m_pPlayerManager->setDeckOrder(config_order); } } - diff --git a/src/dlgprefcontrolsdlg.ui b/src/dlgprefcontrolsdlg.ui index 68ece42c23f..a6a763a9f84 100644 --- a/src/dlgprefcontrolsdlg.ui +++ b/src/dlgprefcontrolsdlg.ui @@ -219,6 +219,9 @@ ComboBoxDeckOrder + + false + diff --git a/src/playermanager.h b/src/playermanager.h index 7431249a5f7..fc1de3ac0fb 100644 --- a/src/playermanager.h +++ b/src/playermanager.h @@ -117,14 +117,15 @@ class PlayerManager : public QObject { // Just take the first order in the list is default. Make sure it's the natural ordering // "ABCD..." deck_order_t getDefaultOrder(int deck_count) { + // Don't access the hash directly in case we need to generate a default order. + return getDeckOrderings(deck_count).at(0); + } + + const QList getDeckOrderings(int deck_count) { orders_hash_t::const_iterator it = m_hOrdersHash.find(deck_count); if (it == m_hOrdersHash.end()) { m_hOrdersHash[deck_count].push_back(makeDefaultOrder(deck_count)); } - return m_hOrdersHash[deck_count].at(0); - } - - const QList getDeckOrderings(int deck_count) const { return m_hOrdersHash[deck_count]; } @@ -160,6 +161,10 @@ class PlayerManager : public QObject { return s_deckOrderingManager.getDeckOrderings(deck_count); } + static const DeckOrderingManager::deck_order_t getDefaultOrder(int deck_count) { + return s_deckOrderingManager.getDefaultOrder(deck_count); + } + void setDeckOrder(QString order); public slots: