Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
096fe2f
multiply Library Folders feature from library_features branch, builds…
May 24, 2013
6155f3f
fixed update code and removed useless stuff from initial patch
May 25, 2013
36d5dfd
dlgprefplaylist uses library instance instead of sql connection
May 25, 2013
5981597
basic track adding works
May 25, 2013
d605e8c
directoryDAO query don't work with bindvalue
May 25, 2013
6cd27e2
directory doa works with bindValue now
May 26, 2013
667d90e
remove checksums from schema.xml
May 28, 2013
23c4611
code clean up
May 29, 2013
afa8e43
remove relocate feature
May 30, 2013
588e6cc
Merge branch 'master' into multiplyFolders
May 30, 2013
de9357a
remove more code
May 30, 2013
ee2019b
remove more code
May 30, 2013
a103513
added MAINDIR_ID to missingtablemodel.cpp
May 30, 2013
edec5e2
clean up mess
Jun 2, 2013
2ca37f0
Merge branch 'master' into multiplyFolders
Jun 2, 2013
2f48da4
remove old merge conflicts
Jun 2, 2013
63b1349
still problems with relocating a directory
Jun 2, 2013
fc4217a
Merge branch 'master' into multiplyFolders
Jun 8, 2013
e7155e8
Merge branch 'master' into multiplyFolders
Jun 16, 2013
31457ec
merge with master branch
Jun 19, 2013
168a445
Merge branch 'master' into multiplyFolders
Jun 19, 2013
e28c83b
Merge branch 'master' into multiplyFolders
kain88-de Jun 21, 2013
e34367b
Merge remote-tracking branch 'upstream/master' into multiplyFolders
Jun 22, 2013
c6fc3b3
readd library scheme to allow for several directories
Jun 22, 2013
8e6434a
try to fix relocate query
Jun 22, 2013
d44c8ec
address rryans style comments
Jun 25, 2013
5f3c681
Merge remote-tracking branch 'upstream/master' into multiplyFolders
Jun 25, 2013
f42f5b9
removed main_dirId
kain88-de Jun 29, 2013
ece192a
split dirsChanged signal into 3 seperate signals
kain88-de Jun 29, 2013
89b2e60
prepend request add/remove/... signals
kain88-de Jun 29, 2013
617e95c
mark tracks as mixxx_deleted instead of purgin them
kain88-de Jun 29, 2013
0a603f4
rename buttons in dlgprefplaylist
kain88-de Jun 29, 2013
7160634
give some more meaningful variable name and reselect old index based …
Jun 29, 2013
7e4f0fa
if we already track the parent directory do not add new dir
Jun 29, 2013
858dded
remove unused code
Jun 29, 2013
bed5201
more clean up
Jun 29, 2013
8cee6b7
tidy up a bit more
Jun 29, 2013
9294917
better commits
Jun 30, 2013
51a5eec
relocate seems to work, their still is a problem with loaded tracks
Jun 30, 2013
4639c9d
enable downgrading
Jun 30, 2013
31f6f30
merge with upstream
Jun 30, 2013
b68724a
add comment about library scan
Jun 30, 2013
b8ed1cb
merge with upstream/master
Jul 7, 2013
560f721
also update BaseTrackCache
Jul 7, 2013
3d2455c
Merge branch 'master' into features_multifolder
rryan Jul 12, 2013
9270b78
Use reference for m_database.
rryan Jul 12, 2013
7507202
Fix markTracksAsMixxxDeleted (query was not valid SQL).
rryan Jul 12, 2013
11c2834
Use common #define for legacy library location.
rryan Jul 12, 2013
0e9a03f
Re-order initialization.
rryan Jul 12, 2013
fd6f541
Cleanups to DirectoryDao.
rryan Jul 12, 2013
8875252
General cleanups.
rryan Jul 12, 2013
a3e8fe5
Word-smithing.
rryan Jul 12, 2013
b18a96d
QSqlQuery::bind doesn't work for embedding things inside parantheses.
rryan Jul 12, 2013
6b8d921
Get rid of asserts in detectMovedFiles. Use pointers for arguments th…
rryan Jul 12, 2013
5f9c332
Abort transaction instead of committing when a cancel signal is recei…
rryan Jul 12, 2013
c9ed252
Add warning to Max about track_locations ids not being library ids.
rryan Jul 12, 2013
5ac81de
Random cleanups.
rryan Jul 12, 2013
5d313d7
Switch to LIKE instead of instr which isn't present on all SQLite sys…
rryan Jul 12, 2013
83b5a7d
Get rid of transaction in verifyRemainingTracks now that it is called…
rryan Jul 12, 2013
a409ca5
Warn about calling main TrackDAO from library scanner thread.
rryan Jul 12, 2013
0e33e2e
Add rollback support to addTracksFinish.
rryan Jul 12, 2013
3418fbc
Remove use of instr in favor of LIKE. instr isn't supported on the mo…
rryan Jul 12, 2013
aaf95e9
Add TODO for error reporting.
rryan Jul 12, 2013
19664ee
Use directory for starting point in relocation if it still exists (or…
rryan Jul 12, 2013
67ac323
merge with upstream/master
Sep 8, 2013
e224ae3
Merge remote-tracking branch 'upstream/master' into multiplyFolders
Sep 12, 2013
d447305
add directorydao test
Sep 12, 2013
c98df40
test from empty sql file
Sep 12, 2013
0c45d3d
proper TearDown of tests
Sep 12, 2013
6055128
test removeDir
Sep 12, 2013
a9724d9
added test for getDirs
Sep 12, 2013
67751b7
use a db for testing
Sep 13, 2013
7c09f0c
return more error codes in direcotryDAO
Sep 13, 2013
2a1b485
check for child dir in addDirectory
Sep 15, 2013
9dbcdf4
check dir equality with QDir
Sep 15, 2013
232f554
fix sql statement
Sep 15, 2013
0c78e6d
start to enter test for relocateDir
Oct 8, 2013
cb1ebef
clean the whole database after each test
Nov 8, 2013
9c4bb1d
directoryDao now handles parent dirs correctly
Nov 13, 2013
e2bfb3c
Fix directorydao:replace function
Nov 14, 2013
061838f
Merge remote-tracking branch 'upstream/master' into multiplyFolders
Nov 16, 2013
a785a84
clean up diff
Nov 16, 2013
8d78d5b
add all watched folders to browse quicklink
Nov 16, 2013
cfadda6
Add message box when removing watched directory
Nov 16, 2013
a7880e8
minor clean ups
Nov 16, 2013
c8be27d
relocateDirTest does some checks
Nov 16, 2013
06fc481
Merge remote-tracking branch 'upstream/master' into multiplyFolders
Dec 4, 2013
0f5974e
coding style in library preferences
Dec 4, 2013
00f97a4
Do sql commands in a transaction + small refactor
Dec 4, 2013
4de6580
change algorithm to detect child folders
Dec 4, 2013
5a38b92
Use QSet instead of Qlist to avoid duplicates
Dec 5, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
.sconf_temp
.sconsign.branch
.sconsign.dblite
*.sqlite
*.cfg
cache
lib/*/*.a
lib/*/lib/*.a
Expand Down
1 change: 1 addition & 0 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ def sources(self, build):
"library/libraryfeature.cpp",
"library/analysisfeature.cpp",
"library/autodjfeature.cpp",
"library/dao/directorydao.cpp",
"library/mixxxlibraryfeature.cpp",
"library/baseplaylistfeature.cpp",
"library/playlistfeature.cpp",
Expand Down
10 changes: 10 additions & 0 deletions res/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,14 @@ METADATA
ALTER TABLE itunes_library ADD COLUMN album_artist TEXT DEFAULT "";
</sql>
</revision>
<revision version="23" min_compatible="3">
<description>
Add directories table
</description>
<sql>
CREATE TABLE IF NOT EXISTS directories (
directory TEXT UNIQUE
);
</sql>
</revision>
</schema>
4 changes: 2 additions & 2 deletions src/dlgpreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
DlgPreferences::DlgPreferences(MixxxApp * mixxx, SkinLoader* pSkinLoader,
SoundManager * soundman, PlayerManager* pPlayerManager,
ControllerManager * controllers, VinylControlManager *pVCManager,
ConfigObject<ConfigValue>* pConfig)
ConfigObject<ConfigValue>* pConfig, Library *pLibrary)
: m_pageSizeHint(QSize(0, 0)),
m_preferencesUpdated(ConfigKey("[Preferences]", "updated")) {
setupUi(this);
Expand All @@ -81,7 +81,7 @@ DlgPreferences::DlgPreferences(MixxxApp * mixxx, SkinLoader* pSkinLoader,
#endif
m_wsound = new DlgPrefSound(this, soundman, pPlayerManager, pConfig);
addPageWidget(m_wsound);
m_wplaylist = new DlgPrefPlaylist(this, pConfig);
m_wplaylist = new DlgPrefPlaylist(this, pConfig, pLibrary);
addPageWidget(m_wplaylist);
m_wcontrols = new DlgPrefControls(this, mixxx, pSkinLoader, pPlayerManager, pConfig);
addPageWidget(m_wcontrols);
Expand Down
4 changes: 3 additions & 1 deletion src/dlgpreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class DlgPrefReplayGain;
class ControllerManager;
class SkinLoader;
class PlayerManager;
class Library;
class VinylControlManager;
#ifdef __MODPLUG__
class DlgPrefModplug;
Expand All @@ -54,7 +55,8 @@ class DlgPreferences : public QDialog, public Ui::DlgPreferencesDlg {
public:
DlgPreferences(MixxxApp* mixxx, SkinLoader* pSkinLoader, SoundManager* soundman,
PlayerManager* pPlayerManager, ControllerManager* controllers,
VinylControlManager* pVCManager, ConfigObject<ConfigValue>* config);
VinylControlManager* pVCManager, ConfigObject<ConfigValue>* pConfig,
Library *pLibrary);
virtual ~DlgPreferences();

void addPageWidget(DlgPreferencePage* pWidget);
Expand Down
116 changes: 97 additions & 19 deletions src/dlgprefplaylist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
***************************************************************************/

#include <QDesktopServices>
#include <QDir>
#include <QFileDialog>
#include <QStringList>
#include <QUrl>

#include "dlgprefplaylist.h"
Expand All @@ -25,15 +27,28 @@
#define MIXXX_ADDONS_URL "http://www.mixxx.org/wiki/doku.php/add-ons"


DlgPrefPlaylist::DlgPrefPlaylist(QWidget * parent, ConfigObject<ConfigValue> * config)
: DlgPreferencePage(parent),
m_pconfig(config) {
DlgPrefPlaylist::DlgPrefPlaylist(QWidget * parent,
ConfigObject<ConfigValue> * config, Library *pLibrary)
:DlgPreferencePage(parent),
m_dirListModel(),
m_pconfig(config),
m_pLibrary(pLibrary) {
setupUi(this);
slotUpdate();
checkbox_ID3_sync->setVisible(false);

connect(PushButtonBrowsePlaylist, SIGNAL(clicked()),
this, SLOT(slotBrowseDir()));
connect(this, SIGNAL(requestAddDir(QString)),
m_pLibrary, SLOT(slotRequestAddDir(QString)));
connect(this, SIGNAL(requestRemoveDir(QString, bool)),
m_pLibrary, SLOT(slotRequestRemoveDir(QString, bool)));
connect(this, SIGNAL(requestRelocateDir(QString,QString)),
m_pLibrary, SLOT(slotRequestRelocateDir(QString,QString)));
connect(PushButtonAddDir, SIGNAL(clicked()),
this, SLOT(slotAddDir()));
connect(PushButtonRemoveDir, SIGNAL(clicked()),
this, SLOT(slotRemoveDir()));
connect(PushButtonRelocateDir, SIGNAL(clicked()),
this, SLOT(slotRelocateDir()));
//connect(pushButtonM4A, SIGNAL(clicked()), this, SLOT(slotM4ACheck()));
connect(pushButtonExtraPlugins, SIGNAL(clicked()),
this, SLOT(slotExtraPlugins()));
Expand All @@ -49,14 +64,33 @@ DlgPrefPlaylist::DlgPrefPlaylist(QWidget * parent, ConfigObject<ConfigValue> * c
DlgPrefPlaylist::~DlgPrefPlaylist() {
}

void DlgPrefPlaylist::initialiseDirList(){
// save which index was selected
const QString selected = dirList->currentIndex().data().toString();
// clear and fill model
m_dirListModel.clear();
QStringList dirs = m_pLibrary->getDirs();
foreach (QString dir, dirs) {
m_dirListModel.appendRow(new QStandardItem(dir));
}
dirList->setModel(&m_dirListModel);
dirList->setCurrentIndex(m_dirListModel.index(0, 0));
// reselect index if it still exists
for (int i=0 ; i<m_dirListModel.rowCount() ; ++i) {
const QModelIndex index = m_dirListModel.index(i, 0);
if (index.data().toString() == selected) {
dirList->setCurrentIndex(index);
break;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you user here list->model() instead of m_model?

}
}

void DlgPrefPlaylist::slotExtraPlugins() {
QDesktopServices::openUrl(QUrl(MIXXX_ADDONS_URL));
}

void DlgPrefPlaylist::slotUpdate() {
// Library Path
LineEditSongfiles->setText(m_pconfig->getValueString(
ConfigKey("[Playlist]","Directory")));
initialiseDirList();
//Bundled songs stat tracking
checkBox_library_scan->setChecked((bool)m_pconfig->getValueString(
ConfigKey("[Library]","RescanOnStartup")).toInt());
Expand All @@ -74,12 +108,61 @@ void DlgPrefPlaylist::slotUpdate() {
ConfigKey("[Library]","ShowTraktorLibrary"),"1").toInt());
}

void DlgPrefPlaylist::slotBrowseDir() {
QString fd = QFileDialog::getExistingDirectory(this,
tr("Choose music library directory"),
m_pconfig->getValueString(ConfigKey("[Playlist]","Directory")));
if (fd != "") {
LineEditSongfiles->setText(fd);
void DlgPrefPlaylist::slotAddDir() {
QString fd = QFileDialog::getExistingDirectory(
this, tr("Choose a music library directory"),
QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
if (!fd.isEmpty()) {
emit(requestAddDir(fd));
slotUpdate();
}
}

void DlgPrefPlaylist::slotRemoveDir() {
QModelIndex index = dirList->currentIndex();
QString fd = index.data().toString();
QMessageBox removeMsgBox;
removeMsgBox.setText(tr("Mixxx will hide any information about tracks in "
"this directory. Once you re-add the directory all "
"metadata will be restored"));
removeMsgBox.setInformativeText(tr("Do you want to remove this directory?"));
removeMsgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
QPushButton *removeAllButton = removeMsgBox.addButton(tr("Remove Metadata"),
QMessageBox::YesRole);
removeMsgBox.setDefaultButton(QMessageBox::Cancel);

int ret = removeMsgBox.exec();
bool removeAll = removeMsgBox.clickedButton() == removeAllButton;

if (ret == QMessageBox::Yes || removeAll) {
emit(requestRemoveDir(fd, removeAll));
slotUpdate();
}

}

void DlgPrefPlaylist::slotRelocateDir() {
QModelIndex index = dirList->currentIndex();
QString currentFd = index.data().toString();

// If the selected directory exists, use it. If not, go up one directory (if
// that directory exists). If neither exist, use the default music
// directory.
QString startDir = currentFd;
QDir dir(startDir);
if (!dir.exists() && dir.cdUp()) {
startDir = dir.absolutePath();
} else if (!dir.exists()) {
startDir = QDesktopServices::storageLocation(
QDesktopServices::MusicLocation);
}

QString fd = QFileDialog::getExistingDirectory(
this, tr("relocate to directory"), startDir);

if (!fd.isEmpty()) {
emit(requestRelocateDir(currentFd, fd));
slotUpdate();
}
}

Expand All @@ -99,10 +182,5 @@ void DlgPrefPlaylist::slotApply() {
m_pconfig->set(ConfigKey("[Library]","ShowTraktorLibrary"),
ConfigValue((int)checkBox_show_traktor->isChecked()));

if (LineEditSongfiles->text() !=
m_pconfig->getValueString(ConfigKey("[Playlist]","Directory"))) {
m_pconfig->set(ConfigKey("[Playlist]","Directory"), LineEditSongfiles->text());
emit(apply());
}
m_pconfig->Save();
}
15 changes: 13 additions & 2 deletions src/dlgprefplaylist.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
#ifndef DLGPREFPLAYLIST_H
#define DLGPREFPLAYLIST_H

#include <QStandardItemModel>
#include <QWidget>

#include "ui_dlgprefplaylistdlg.h"
#include "configobject.h"
#include "library/library.h"
#include "preferences/dlgpreferencepage.h"

/**
Expand All @@ -31,24 +33,33 @@
class DlgPrefPlaylist : public DlgPreferencePage, public Ui::DlgPrefPlaylistDlg {
Q_OBJECT
public:
DlgPrefPlaylist(QWidget *parent, ConfigObject<ConfigValue> *config);
DlgPrefPlaylist(QWidget *parent, ConfigObject<ConfigValue> *config,
Library *pLibrary);
virtual ~DlgPrefPlaylist();

public slots:
// Update widget
void slotUpdate();
// Dialog to browse for music file directory
void slotBrowseDir();
void slotAddDir();
void slotRemoveDir();
void slotRelocateDir();
// Apply changes to widget
void slotApply();

void slotExtraPlugins();

signals:
void apply();
void requestAddDir(QString dir);
void requestRemoveDir(QString dir, bool removeAll);
void requestRelocateDir(QString currentDir, QString newDir);

private:
void initialiseDirList();
QStandardItemModel m_dirListModel;
ConfigObject<ConfigValue>* m_pconfig;
Library *m_pLibrary;
};

#endif
Loading