aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-06-15 19:24:15 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-06-15 19:24:15 +0000
commit4163cabef5b80851dd68cc196c2d34f48539693b (patch)
tree08953439466e338416d388e4873ec849b7434255 /src
parenta991df9d7164ddfc1604c8b8d7161d52da2ca516 (diff)
downloadqmmp-4163cabef5b80851dd68cc196c2d34f48539693b.tar.gz
qmmp-4163cabef5b80851dd68cc196c2d34f48539693b.tar.bz2
qmmp-4163cabef5b80851dd68cc196c2d34f48539693b.zip
rgscan: added feature to detect previous tags (#709)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@5157 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/plugins/General/rgscan/rgscandialog.cpp22
-rw-r--r--src/plugins/General/rgscan/rgscandialog.ui70
-rw-r--r--src/plugins/General/rgscan/rgscanner.cpp10
-rw-r--r--src/plugins/General/rgscan/rgscanner.h3
4 files changed, 76 insertions, 29 deletions
diff --git a/src/plugins/General/rgscan/rgscandialog.cpp b/src/plugins/General/rgscan/rgscandialog.cpp
index 7b3824921..bb4c7693a 100644
--- a/src/plugins/General/rgscan/rgscandialog.cpp
+++ b/src/plugins/General/rgscan/rgscandialog.cpp
@@ -92,6 +92,7 @@ RGScanDialog::RGScanDialog(QList <PlayListTrack *> tracks, QWidget *parent) : Q
restoreGeometry(settings.value("RGScanner/geometry").toByteArray());
m_ui.trackCheckBox->setChecked(settings.value("RGScanner/write_track",true).toBool());
m_ui.albumCheckBox->setChecked(settings.value("RGScanner/write_album",true).toBool());
+ m_ui.skipScannedCheckBox->setChecked(settings.value("RGScanner/skip_scanned",true).toBool());
}
RGScanDialog::~RGScanDialog()
@@ -115,6 +116,19 @@ void RGScanDialog::on_calculateButton_clicked()
delete scanner;
continue;
}
+
+ if(m_ui.skipScannedCheckBox->isChecked() && !scanner->oldReplayGainInfo().isEmpty())
+ {
+ qDebug("RGScanDialog: skipping scanned file..");
+ QMap<Qmmp::ReplayGainKey, double> rg = scanner->oldReplayGainInfo();
+ m_ui.tableWidget->setItem(i, 2, new QTableWidgetItem(tr("%1 dB").arg(rg.value(Qmmp::REPLAYGAIN_TRACK_GAIN))));
+ m_ui.tableWidget->setItem(i, 3, new QTableWidgetItem(tr("%1 dB").arg(rg.value(Qmmp::REPLAYGAIN_ALBUM_GAIN))));
+ m_ui.tableWidget->setItem(i, 4, new QTableWidgetItem(QString::number(rg.value(Qmmp::REPLAYGAIN_TRACK_PEAK))));
+ m_ui.tableWidget->setItem(i, 5, new QTableWidgetItem(QString::number(rg.value(Qmmp::REPLAYGAIN_ALBUM_PEAK))));
+ delete scanner;
+ continue;
+ }
+
scanner->setAutoDelete(false);
m_scanners.append(scanner);
connect(scanner, SIGNAL(progress(int)), m_ui.tableWidget->cellWidget(i, 1), SLOT(setValue(int)));
@@ -125,7 +139,6 @@ void RGScanDialog::on_calculateButton_clicked()
void RGScanDialog::onScanFinished(QString url)
{
-
for(int i = 0; i < m_ui.tableWidget->rowCount(); ++i)
{
if(url != m_ui.tableWidget->item(i, 0)->data(Qt::UserRole).toString())
@@ -148,7 +161,7 @@ void RGScanDialog::onScanFinished(QString url)
if(stopped)
{
- qDebug("RGScanDialog: all threads finished");
+ qDebug("RGScanDialog: all threads are finished");
QThreadPool::globalInstance()->waitForDone();
QMultiMap<QString, ReplayGainInfoItem*> itemGroupMap; //items grouped by album
@@ -208,8 +221,8 @@ void RGScanDialog::onScanFinished(QString url)
m_ui.tableWidget->setItem(i, 5, new QTableWidgetItem(QString::number(album_peak)));
}
}
- if(!found)
- m_ui.tableWidget->setItem(i, 3, new QTableWidgetItem(tr("Error")));
+ //if(!found)
+ // m_ui.tableWidget->setItem(i, 3, new QTableWidgetItem(tr("Error")));
}
//clear items
@@ -225,6 +238,7 @@ void RGScanDialog::reject()
settings.setValue("RGScanner/geometry", saveGeometry());
settings.setValue("RGScanner/write_track", m_ui.trackCheckBox->isChecked());
settings.setValue("RGScanner/write_album", m_ui.albumCheckBox->isChecked());
+ settings.setValue("RGScanner/skip_scanned", m_ui.skipScannedCheckBox->isChecked());
QDialog::reject();
}
diff --git a/src/plugins/General/rgscan/rgscandialog.ui b/src/plugins/General/rgscan/rgscandialog.ui
index b9f562c22..ae277479c 100644
--- a/src/plugins/General/rgscan/rgscandialog.ui
+++ b/src/plugins/General/rgscan/rgscandialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>765</width>
- <height>431</height>
+ <width>756</width>
+ <height>429</height>
</rect>
</property>
<property name="windowTitle">
@@ -23,21 +23,7 @@
<property name="bottomMargin">
<number>6</number>
</property>
- <item row="1" column="2">
- <widget class="QCheckBox" name="trackCheckBox">
- <property name="text">
- <string>Write track gain/peak</string>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Close</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="5">
+ <item row="0" column="0" colspan="3">
<widget class="QTableWidget" name="tableWidget">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
@@ -83,24 +69,62 @@
</column>
</widget>
</item>
- <item row="1" column="0">
+ <item row="1" column="0" colspan="3">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QCheckBox" name="skipScannedCheckBox">
+ <property name="text">
+ <string>Skip already skanned files</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="trackCheckBox">
+ <property name="text">
+ <string>Write track gain/peak</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="albumCheckBox">
+ <property name="text">
+ <string>Write album gain/peak</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
<widget class="QPushButton" name="calculateButton">
<property name="text">
<string>Calculate</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<widget class="QPushButton" name="writeButton">
<property name="text">
<string>Write Tags</string>
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="QCheckBox" name="albumCheckBox">
- <property name="text">
- <string>Write album gain/peak</string>
+ <item row="2" column="2">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
diff --git a/src/plugins/General/rgscan/rgscanner.cpp b/src/plugins/General/rgscan/rgscanner.cpp
index db80af7ce..9aafbc0cf 100644
--- a/src/plugins/General/rgscan/rgscanner.cpp
+++ b/src/plugins/General/rgscan/rgscanner.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2013 by Ilya Kotov *
+ * Copyright (C) 2013-2015 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -132,6 +132,14 @@ bool RGScanner::hasValues() const
return m_has_values;
}
+QMap<Qmmp::ReplayGainKey, double> RGScanner::oldReplayGainInfo() const
+{
+ if(!m_decoder)
+ return QMap<Qmmp::ReplayGainKey, double>();
+
+ return m_decoder->replayGainInfo();
+}
+
double RGScanner::gain() const
{
return m_gain;
diff --git a/src/plugins/General/rgscan/rgscanner.h b/src/plugins/General/rgscan/rgscanner.h
index dad5b08a7..86a8d4b99 100644
--- a/src/plugins/General/rgscan/rgscanner.h
+++ b/src/plugins/General/rgscan/rgscanner.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2013 by Ilya Kotov *
+ * Copyright (C) 2013-2015 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -46,6 +46,7 @@ public:
bool isRunning() const;
bool isPending() const;
bool hasValues() const;
+ QMap<Qmmp::ReplayGainKey, double> oldReplayGainInfo() const;
double gain() const;
double peak() const;
QString url() const;