aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/General/rdetect/removablehelper.cpp34
-rw-r--r--src/plugins/General/rdetect/removablehelper.h1
2 files changed, 28 insertions, 7 deletions
diff --git a/src/plugins/General/rdetect/removablehelper.cpp b/src/plugins/General/rdetect/removablehelper.cpp
index 8dcb16500..ec939d9aa 100644
--- a/src/plugins/General/rdetect/removablehelper.cpp
+++ b/src/plugins/General/rdetect/removablehelper.cpp
@@ -20,8 +20,8 @@
#include <QApplication>
#include <QStorageInfo>
#include <QActionGroup>
-#include <QtDebug>
#include <QStyle>
+#include <QDir>
#include <QSettings>
#include <qmmpui/playlistmanager.h>
#include <windows.h>
@@ -106,16 +106,22 @@ void RemovableHelper::updateActions()
QString dev_path;
- qDebug() << storage.fileSystemType();
-
if(m_detectRemovable && storage.bytesTotal() < 40000000000LL &&
(storage.fileSystemType() == "NTFS" ||
storage.fileSystemType() == "FAT32" ||
- storage.fileSystemType() == "CDFS" ||
storage.fileSystemType() == "UDF"))
{
dev_path = storage.rootPath();
}
+ else if(storage.fileSystemType() == "CDFS")
+ {
+ dev_path = storage.rootPath();
+ if(isAudioCd(dev_path))
+ {
+ dev_path = QString("cdda://%1").arg(dev_path);
+ dev_path = dev_path.left(dev_path.size() - 1); //remove trailing '/'
+ }
+ }
else
continue;
@@ -123,15 +129,16 @@ void RemovableHelper::updateActions()
{
QAction *action = new QAction(this);
QString actionText;
- /*if (device->isAudio())
+ if (dev_path.startsWith("cdda"))
{
actionText = QString(tr("Add CD \"%1\"")).arg(storage.displayName());
}
- else*/
+ else
{
actionText = QString(tr("Add Volume \"%1\"")).arg(storage.displayName());
}
+
if(storage.fileSystemType() == "CDFS")
action->setIcon(qApp->style()->standardIcon(QStyle::SP_DriveCDIcon));
else if(storage.fileSystemType() == "UDF")
@@ -154,7 +161,14 @@ void RemovableHelper::updateActions()
foreach(const QStorageInfo &storage, volumes)
{
- if(storage.rootPath() == action->data().toString())
+ QString dev_path = storage.rootPath();
+ if(isAudioCd(dev_path))
+ {
+ dev_path = QString("cdda://%1").arg(dev_path);
+ dev_path = dev_path.left(dev_path.size() - 1); //remove trailing '/'
+ }
+
+ if(dev_path == action->data().toString())
{
found = true;
break;
@@ -221,3 +235,9 @@ void RemovableHelper::removePath(const QString &path)
}
}
+bool RemovableHelper::isAudioCd(const QString &path)
+{
+ QDir dir(path);
+ return !dir.entryInfoList(QStringList() << "*.cda").isEmpty();
+}
+
diff --git a/src/plugins/General/rdetect/removablehelper.h b/src/plugins/General/rdetect/removablehelper.h
index c97b1b749..6ef31efb3 100644
--- a/src/plugins/General/rdetect/removablehelper.h
+++ b/src/plugins/General/rdetect/removablehelper.h
@@ -43,6 +43,7 @@ private:
QAction *findAction(const QString &dev_path);
void addPath(const QString &path);
void removePath(const QString &path);
+ bool isAudioCd(const QString &path);
QActionGroup *m_actions;
bool m_detectCDA;