diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-12-02 08:51:06 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-12-02 08:51:06 +0000 |
| commit | 8a72e0d67cb208957842883433f8bcb3e9ceb558 (patch) | |
| tree | a6c7666811b2c43e64cb7a330bd8fd2b7c146c40 /src/plugins | |
| parent | 366eb153e82063a1157695e6c0873a7a64bee3af (diff) | |
| download | qmmp-8a72e0d67cb208957842883433f8bcb3e9ceb558.tar.gz qmmp-8a72e0d67cb208957842883433f8bcb3e9ceb558.tar.bz2 qmmp-8a72e0d67cb208957842883433f8bcb3e9ceb558.zip | |
rdetect: cda support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8472 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/General/rdetect/removablehelper.cpp | 34 | ||||
| -rw-r--r-- | src/plugins/General/rdetect/removablehelper.h | 1 |
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;
|
