Properly detect Windows 8, now that Qt supports it officially.
[LameXP.git] / src / Thread_CueSplitter.h
blob644e5c8a5fec68688674e9c572ac4764e2db7f0f
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #pragma once
24 #include <QThread>
25 #include <QStringList>
26 #include <QMap>
28 class AudioFileModel;
29 class AudioFileModel_MetaInfo;
30 class CueSheetModel;
31 class QFile;
32 class QDir;
33 class QFileInfo;
35 ////////////////////////////////////////////////////////////
36 // Splash Thread
37 ////////////////////////////////////////////////////////////
39 class CueSplitter: public QThread
41 Q_OBJECT
43 public:
44 CueSplitter(const QString &outputDir, const QString &baseName, CueSheetModel *model, const QList<AudioFileModel> &inputFilesInfo);
45 ~CueSplitter(void);
47 void run();
48 unsigned int getTracksSuccess(void) { return m_nTracksSuccess; }
49 unsigned int getTracksSkipped(void) { return m_nTracksSkipped; }
50 bool getSuccess(void) { return !isRunning() && m_bSuccess; }
51 bool getAborted(void) { return m_bAborted; }
53 signals:
54 void fileSelected(const QString &fileName);
55 void fileSplit(const AudioFileModel &file);
56 void progressValChanged(unsigned int);
57 void progressMaxChanged(unsigned int);
59 private slots:
60 void handleUpdate(int progress);
62 public slots:
63 void abortProcess(void) { m_abortFlag = true; }
65 private:
66 void splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, const int baseProgress);
67 QString indexToString(const double index) const;
68 QString shortName(const QString &longName) const;
70 const QString m_soxBin;
71 const QString m_outputDir;
72 const QString m_baseName;
73 unsigned int m_nTracksSuccess;
74 unsigned int m_nTracksSkipped;
76 static const int m_processTimeoutInterval = 180000;
78 bool m_bAborted;
79 bool m_bSuccess;
81 volatile bool m_abortFlag;
83 CueSheetModel *m_model;
84 QMap<QString,AudioFileModel> m_inputFilesInfo;
85 QMap<QString,QString> m_decompressedFiles;
86 QStringList m_tempFiles;
87 QString m_activeFile;