2014-01-11 04:32:08 +01:00
|
|
|
/* This file is part of Clementine.
|
2014-01-13 06:32:25 +01:00
|
|
|
Copyright 2014, Andre Siviero <altsiviero@gmail.com>
|
2014-01-11 04:32:08 +01:00
|
|
|
|
2014-01-13 06:32:25 +01:00
|
|
|
Clementine 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2014-01-11 04:32:08 +01:00
|
|
|
|
2014-01-13 06:32:25 +01:00
|
|
|
Clementine 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.
|
2014-01-11 04:32:08 +01:00
|
|
|
|
2014-01-13 06:32:25 +01:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2013-12-27 06:38:43 +01:00
|
|
|
|
2014-01-14 02:41:41 +01:00
|
|
|
#ifndef SRC_UI_RIPCD_H_
|
|
|
|
#define SRC_UI_RIPCD_H_
|
2013-12-27 06:38:43 +01:00
|
|
|
|
|
|
|
#include <QDialog>
|
2014-01-11 06:02:11 +01:00
|
|
|
#include <QCheckBox>
|
2014-01-08 04:39:28 +01:00
|
|
|
#include <QThread>
|
2014-01-14 02:41:41 +01:00
|
|
|
#include <QFile>
|
2014-01-08 04:39:28 +01:00
|
|
|
#include <cdio/cdio.h>
|
2013-12-27 06:38:43 +01:00
|
|
|
#include "ui_ripcd.h"
|
2014-01-11 04:26:13 +01:00
|
|
|
|
2014-01-13 06:32:25 +01:00
|
|
|
class Ui_RipCD;
|
2014-01-11 04:26:13 +01:00
|
|
|
class Transcoder;
|
2013-12-27 06:38:43 +01:00
|
|
|
|
2014-01-13 06:32:25 +01:00
|
|
|
struct TranscoderPreset;
|
|
|
|
|
|
|
|
class RipCD: public QDialog {
|
2014-01-14 02:41:41 +01:00
|
|
|
Q_OBJECT
|
2013-12-27 06:38:43 +01:00
|
|
|
|
2014-01-13 06:32:25 +01:00
|
|
|
public:
|
2014-01-14 02:41:41 +01:00
|
|
|
explicit RipCD(QWidget* parent = 0);
|
2014-01-22 04:44:56 +01:00
|
|
|
~RipCD();
|
|
|
|
bool CDIOIsValid() const;
|
2014-01-15 06:00:41 +01:00
|
|
|
|
|
|
|
private:
|
2014-01-14 02:41:41 +01:00
|
|
|
static const char* kSettingsGroup;
|
|
|
|
static const int kProgressInterval;
|
|
|
|
static const int kMaxDestinationItems;
|
|
|
|
Transcoder* transcoder_;
|
|
|
|
int queued_;
|
|
|
|
int finished_success_;
|
|
|
|
int finished_failed_;
|
2014-01-29 20:35:03 +01:00
|
|
|
track_t i_tracks_;
|
2014-01-14 02:41:41 +01:00
|
|
|
Ui_RipCD* ui_;
|
2014-01-15 06:00:41 +01:00
|
|
|
CdIo_t *cdio_;
|
2014-01-14 02:41:41 +01:00
|
|
|
QList<QCheckBox*> checkboxes_;
|
|
|
|
QList<QString> generated_files_;
|
|
|
|
QList<int> tracks_to_rip_;
|
|
|
|
QList<QLineEdit*> track_names_;
|
|
|
|
QString last_add_dir_;
|
|
|
|
QPushButton* cancel_button_;
|
2014-01-26 16:51:19 +01:00
|
|
|
QPushButton* close_button_;
|
|
|
|
QPushButton* rip_button_;
|
2014-02-03 13:22:02 +01:00
|
|
|
QString temporary_directory_;
|
2014-01-14 02:41:41 +01:00
|
|
|
|
2014-01-21 02:38:36 +01:00
|
|
|
void WriteWAVHeader(QFile *stream, int32_t i_bytecount);
|
2014-01-14 02:41:41 +01:00
|
|
|
int NumTracksToRip();
|
|
|
|
void ThreadClickedRipButton();
|
|
|
|
QString TrimPath(const QString& path) const;
|
|
|
|
QString GetOutputFileName(const QString& input,
|
|
|
|
const TranscoderPreset& preset) const;
|
2014-01-15 06:00:41 +01:00
|
|
|
QString ParseFileFormatString(const QString& file_format, int track_no) const;
|
2014-01-26 16:51:19 +01:00
|
|
|
void SetWorking(bool working);
|
2014-01-26 20:34:38 +01:00
|
|
|
void AddDestinationDirectory(QString dir);
|
2014-02-03 13:22:02 +01:00
|
|
|
void RemoveTemporaryDirectory();
|
2014-01-13 06:32:25 +01:00
|
|
|
|
|
|
|
signals:
|
2014-01-14 02:41:41 +01:00
|
|
|
void RippingComplete();
|
|
|
|
void SignalUpdateProgress();
|
2014-01-13 06:32:25 +01:00
|
|
|
private slots:
|
2014-01-14 02:41:41 +01:00
|
|
|
void UpdateProgress();
|
|
|
|
void ThreadedTranscoding();
|
|
|
|
void ClickedRipButton();
|
|
|
|
void JobComplete(const QString& filename, bool success);
|
|
|
|
void AllJobsComplete();
|
2014-01-15 06:00:41 +01:00
|
|
|
void AppendOutput(const QString& filename);
|
2014-01-14 02:41:41 +01:00
|
|
|
void Options();
|
|
|
|
void AddDestination();
|
|
|
|
void Cancel();
|
2014-01-26 19:12:05 +01:00
|
|
|
void SelectAll();
|
|
|
|
void SelectNone();
|
|
|
|
void InvertSelection();
|
2013-12-27 06:38:43 +01:00
|
|
|
};
|
|
|
|
|
2014-01-14 02:41:41 +01:00
|
|
|
#endif // SRC_UI_RIPCD_H_
|