Make the CD ripper clean up after itself.
This commit is contained in:
parent
efd4e8666e
commit
4676e2839d
@ -22,6 +22,7 @@
|
||||
#include "transcoder/transcoderoptionsdialog.h"
|
||||
#include "ui/iconloader.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QCheckBox>
|
||||
@ -225,7 +226,7 @@ int RipCD::NumTracksToRip() {
|
||||
|
||||
void RipCD::ThreadClickedRipButton() {
|
||||
|
||||
QString source_directory = QDir::tempPath() + "/";
|
||||
temporary_directory_ = Utilities::MakeTempDir() + "/";
|
||||
|
||||
finished_success_ = 0;
|
||||
finished_failed_ = 0;
|
||||
@ -241,7 +242,7 @@ void RipCD::ThreadClickedRipButton() {
|
||||
}
|
||||
tracks_to_rip_.append(i);
|
||||
|
||||
QString filename = source_directory
|
||||
QString filename = temporary_directory_
|
||||
+ ParseFileFormatString(ui_->format_filename->text(), i) + ".wav";
|
||||
QFile *destination_file = new QFile(filename);
|
||||
destination_file->open(QIODevice::WriteOnly);
|
||||
@ -336,6 +337,8 @@ void RipCD::JobComplete(const QString& filename, bool success) {
|
||||
}
|
||||
|
||||
void RipCD::AllJobsComplete() {
|
||||
RemoveTemporaryDirectory();
|
||||
|
||||
// having a little trouble on wav files, works fine on ogg-vorbis
|
||||
qSort(generated_files_);
|
||||
|
||||
@ -411,6 +414,7 @@ void RipCD::AddDestinationDirectory(QString dir) {
|
||||
|
||||
void RipCD::Cancel() {
|
||||
transcoder_->Cancel();
|
||||
RemoveTemporaryDirectory();
|
||||
SetWorking(false);
|
||||
}
|
||||
|
||||
@ -448,3 +452,8 @@ void RipCD::InvertSelection() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RipCD::RemoveTemporaryDirectory() {
|
||||
Utilities::RemoveRecursive(temporary_directory_);
|
||||
temporary_directory_.clear();
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ class RipCD: public QDialog {
|
||||
QPushButton* cancel_button_;
|
||||
QPushButton* close_button_;
|
||||
QPushButton* rip_button_;
|
||||
QString temporary_directory_;
|
||||
|
||||
void WriteWAVHeader(QFile *stream, int32_t i_bytecount);
|
||||
int NumTracksToRip();
|
||||
@ -67,6 +68,7 @@ class RipCD: public QDialog {
|
||||
QString ParseFileFormatString(const QString& file_format, int track_no) const;
|
||||
void SetWorking(bool working);
|
||||
void AddDestinationDirectory(QString dir);
|
||||
void RemoveTemporaryDirectory();
|
||||
|
||||
signals:
|
||||
void RippingComplete();
|
||||
|
Loading…
x
Reference in New Issue
Block a user