Skip to content

Commit

Permalink
#1202417 Fixed - Customize left-click in library action
Browse files Browse the repository at this point in the history
  • Loading branch information
cardinot committed Mar 11, 2014
1 parent bd30c74 commit 7a8ab1f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 6 deletions.
25 changes: 25 additions & 0 deletions src/dlgpreflibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ DlgPrefLibrary::DlgPrefLibrary(QWidget * parent,
setupUi(this);
slotUpdate();
checkbox_ID3_sync->setVisible(false);
radioButton_dbclick_status = 0; // default: add track on available deck

connect(this, SIGNAL(requestAddDir(QString)),
m_pLibrary, SLOT(slotRequestAddDir(QString)));
Expand Down Expand Up @@ -106,6 +107,19 @@ void DlgPrefLibrary::slotUpdate() {
ConfigKey("[Library]","ShowITunesLibrary"),"1").toInt());
checkBox_show_traktor->setChecked((bool)m_pconfig->getValueString(
ConfigKey("[Library]","ShowTraktorLibrary"),"1").toInt());
radioButton_dbclick_status = m_pconfig->getValueString(
ConfigKey("[Library]","dbClickAction"),"0").toInt();
switch (radioButton_dbclick_status) {
case 1:
radioButton_dbclick_bottom->click();
break;
case 2:
radioButton_dbclick_top->click();
break;
default:
radioButton_dbclick_deck->click();
break;
}
}

void DlgPrefLibrary::slotAddDir() {
Expand Down Expand Up @@ -215,5 +229,16 @@ void DlgPrefLibrary::slotApply() {
m_pconfig->set(ConfigKey("[Library]","ShowTraktorLibrary"),
ConfigValue((int)checkBox_show_traktor->isChecked()));

if (radioButton_dbclick_bottom->isChecked()) {
radioButton_dbclick_status = 1;
} else if (radioButton_dbclick_top->isChecked()) {
radioButton_dbclick_status = 2;
} else {
radioButton_dbclick_status = 0;
}

m_pconfig->set(ConfigKey("[Library]","dbClickAction"),
ConfigValue(radioButton_dbclick_status));

m_pconfig->Save();
}
1 change: 1 addition & 0 deletions src/dlgpreflibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class DlgPrefLibrary : public DlgPreferencePage, public Ui::DlgPrefLibraryDlg {
QStandardItemModel m_dirListModel;
ConfigObject<ConfigValue>* m_pconfig;
Library *m_pLibrary;
int radioButton_dbclick_status;
};

#endif
38 changes: 37 additions & 1 deletion src/dlgpreflibrarydlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>546</width>
<height>615</height>
<height>731</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -266,6 +266,42 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Double Click Action</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton_dbclick_top">
<property name="text">
<string>Add track to Auto-DJ Queue (top).</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="radioButton_dbclick_deck">
<property name="text">
<string>Add track on available deck.</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radioButton_dbclick_bottom">
<property name="text">
<string>Add track to Auto-DJ Queue (bottom).</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
Expand Down
20 changes: 15 additions & 5 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,21 @@ void WTrackTableView::slotMouseDoubleClicked(const QModelIndex &index) {
if (!modelHasCapabilities(TrackModel::TRACKMODELCAPS_LOADTODECK)) {
return;
}

TrackModel* trackModel = getTrackModel();
TrackPointer pTrack;
if (trackModel && (pTrack = trackModel->getTrack(index))) {
emit(loadTrack(pTrack));
// Read the current double_click settings
switch (m_pConfig->getValueString(ConfigKey("[Library]","dbClickAction")).toInt()) {
case 1:
sendToAutoDJ(false); // add track to Auto-DJ Queue (bottom)
break;
case 2:
sendToAutoDJ(true); // add track to Auto-DJ Queue (top)
break;
default: // add track on available deck
TrackModel* trackModel = getTrackModel();
TrackPointer pTrack;
if (trackModel && (pTrack = trackModel->getTrack(index))) {
emit(loadTrack(pTrack));
}
break;
}
}

Expand Down

0 comments on commit 7a8ab1f

Please sign in to comment.