2011-05-15 01:45:27 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// LameXP - Audio Encoder Front-End
|
2015-01-01 18:06:21 +01:00
|
|
|
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
2011-05-15 01:45:27 +02:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
2013-10-23 20:56:57 +02:00
|
|
|
// (at your option) any later version, but always including the *additional*
|
|
|
|
// restrictions defined in the "License.txt" file.
|
2011-05-15 01:45:27 +02:00
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
//
|
|
|
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QMap>
|
|
|
|
|
|
|
|
class AudioFileModel;
|
2013-10-12 22:55:41 +02:00
|
|
|
class AudioFileModel_MetaInfo;
|
2011-05-16 18:05:50 +02:00
|
|
|
class CueSheetModel;
|
2011-05-15 01:45:27 +02:00
|
|
|
class QFile;
|
|
|
|
class QDir;
|
|
|
|
class QFileInfo;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// Splash Thread
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class CueSplitter: public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2011-05-16 18:05:50 +02:00
|
|
|
CueSplitter(const QString &outputDir, const QString &baseName, CueSheetModel *model, const QList<AudioFileModel> &inputFilesInfo);
|
2011-05-15 18:53:44 +02:00
|
|
|
~CueSplitter(void);
|
2011-05-16 18:05:50 +02:00
|
|
|
|
2011-05-15 01:45:27 +02:00
|
|
|
void run();
|
2011-05-15 15:14:33 +02:00
|
|
|
unsigned int getTracksSuccess(void) { return m_nTracksSuccess; }
|
|
|
|
unsigned int getTracksSkipped(void) { return m_nTracksSkipped; }
|
2011-05-16 18:05:50 +02:00
|
|
|
bool getSuccess(void) { return !isRunning() && m_bSuccess; }
|
|
|
|
bool getAborted(void) { return m_bAborted; }
|
2011-05-15 01:45:27 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void fileSelected(const QString &fileName);
|
|
|
|
void fileSplit(const AudioFileModel &file);
|
2012-05-06 23:58:18 +02:00
|
|
|
void progressValChanged(unsigned int);
|
|
|
|
void progressMaxChanged(unsigned int);
|
2011-05-15 01:45:27 +02:00
|
|
|
|
2011-05-15 18:53:44 +02:00
|
|
|
private slots:
|
|
|
|
void handleUpdate(int progress);
|
|
|
|
|
2011-05-16 18:05:50 +02:00
|
|
|
public slots:
|
|
|
|
void abortProcess(void) { m_abortFlag = true; }
|
|
|
|
|
2011-05-15 01:45:27 +02:00
|
|
|
private:
|
2013-10-13 21:28:06 +02:00
|
|
|
void splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, const int baseProgress);
|
2011-05-15 01:45:27 +02:00
|
|
|
QString indexToString(const double index) const;
|
2011-05-29 16:57:38 +02:00
|
|
|
QString shortName(const QString &longName) const;
|
2011-05-15 01:45:27 +02:00
|
|
|
|
|
|
|
const QString m_soxBin;
|
|
|
|
const QString m_outputDir;
|
|
|
|
const QString m_baseName;
|
2011-05-15 15:14:33 +02:00
|
|
|
unsigned int m_nTracksSuccess;
|
|
|
|
unsigned int m_nTracksSkipped;
|
2011-05-16 18:05:50 +02:00
|
|
|
|
2011-06-14 13:06:27 +02:00
|
|
|
static const int m_processTimeoutInterval = 180000;
|
|
|
|
|
2011-05-16 18:05:50 +02:00
|
|
|
bool m_bAborted;
|
2011-05-15 01:45:27 +02:00
|
|
|
bool m_bSuccess;
|
2011-05-16 18:05:50 +02:00
|
|
|
|
2011-05-15 01:45:27 +02:00
|
|
|
volatile bool m_abortFlag;
|
|
|
|
|
2011-05-16 18:05:50 +02:00
|
|
|
CueSheetModel *m_model;
|
|
|
|
QMap<QString,AudioFileModel> m_inputFilesInfo;
|
2011-05-15 18:53:44 +02:00
|
|
|
QMap<QString,QString> m_decompressedFiles;
|
|
|
|
QStringList m_tempFiles;
|
2011-05-16 18:05:50 +02:00
|
|
|
QString m_activeFile;
|
2011-05-15 01:45:27 +02:00
|
|
|
};
|