mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 19:45:31 +01:00
Added ripcd to optional features, deleted ui_ripcd on destruction, added a warning in case cdio_open returns NULL
This commit is contained in:
parent
2859d826ae
commit
7cebf23bba
@ -351,7 +351,6 @@ set(SOURCES
|
||||
ui/organiseerrordialog.cpp
|
||||
ui/playbacksettingspage.cpp
|
||||
ui/qtsystemtrayicon.cpp
|
||||
ui/ripcd.cpp
|
||||
ui/screensaver.cpp
|
||||
ui/settingsdialog.cpp
|
||||
ui/settingspage.cpp
|
||||
@ -630,7 +629,6 @@ set(HEADERS
|
||||
ui/organiseerrordialog.h
|
||||
ui/playbacksettingspage.h
|
||||
ui/qtsystemtrayicon.h
|
||||
ui/ripcd.h
|
||||
ui/settingsdialog.h
|
||||
ui/settingspage.h
|
||||
ui/standarditemiconloader.h
|
||||
@ -753,7 +751,6 @@ set(UI
|
||||
ui/organisedialog.ui
|
||||
ui/organiseerrordialog.ui
|
||||
ui/playbacksettingspage.ui
|
||||
ui/ripcd.ui
|
||||
ui/settingsdialog.ui
|
||||
ui/trackselectiondialog.ui
|
||||
|
||||
@ -1030,9 +1027,13 @@ optional_source(HAVE_AUDIOCD
|
||||
SOURCES
|
||||
devices/cddadevice.cpp
|
||||
devices/cddalister.cpp
|
||||
ui/ripcd.cpp
|
||||
HEADERS
|
||||
devices/cddadevice.h
|
||||
devices/cddalister.h
|
||||
ui/ripcd.h
|
||||
UI
|
||||
ui/ripcd.ui
|
||||
)
|
||||
|
||||
# mtp device
|
||||
|
@ -1676,7 +1676,12 @@ void MainWindow::OpenRipCD() {
|
||||
if (!rip_cd_) {
|
||||
rip_cd_.reset(new RipCD);
|
||||
}
|
||||
rip_cd_->show();
|
||||
if(rip_cd_->CDIOIsValid()) {
|
||||
rip_cd_->show();
|
||||
} else {
|
||||
QMessageBox cdio_fail(QMessageBox::Critical, tr("Error"), tr("Failed reading CD drive"));
|
||||
cdio_fail.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::AddCDTracks() {
|
||||
|
@ -73,7 +73,8 @@ RipCD::RipCD(QWidget* parent) :
|
||||
finished_failed_(0),
|
||||
ui_(new Ui_RipCD)
|
||||
{
|
||||
// Init
|
||||
|
||||
// Init
|
||||
ui_->setupUi(this);
|
||||
cancel_button_ = ui_->button_box->button(QDialogButtonBox::Cancel);
|
||||
|
||||
@ -93,19 +94,26 @@ RipCD::RipCD(QWidget* parent) :
|
||||
setWindowTitle(tr("Rip CD"));
|
||||
|
||||
cdio_ = cdio_open(NULL, DRIVER_UNKNOWN);
|
||||
i_tracks = cdio_get_num_tracks(cdio_);
|
||||
ui_->tableWidget->setRowCount(i_tracks);
|
||||
|
||||
for (int i = 1; i <= i_tracks; i++) {
|
||||
QCheckBox *checkbox_i = new QCheckBox(ui_->tableWidget);
|
||||
checkbox_i->setCheckState(Qt::Checked);
|
||||
checkboxes_.append(checkbox_i);
|
||||
ui_->tableWidget->setCellWidget(i - 1, kCheckboxColumn, checkbox_i);
|
||||
ui_->tableWidget->setCellWidget(i - 1, kTrackNumberColumn, new QLabel(QString::number(i)));
|
||||
QString track_title = QString("Track %1").arg(i);
|
||||
QLineEdit *line_edit_track_title_i = new QLineEdit(track_title,ui_->tableWidget);
|
||||
track_names_.append(line_edit_track_title_i);
|
||||
ui_->tableWidget->setCellWidget(i - 1, kTrackTitleColumn, line_edit_track_title_i);
|
||||
if(!cdio_) {
|
||||
qLog(Error) << "Failed to read CD drive";
|
||||
return;
|
||||
} else {
|
||||
i_tracks = cdio_get_num_tracks(cdio_);
|
||||
ui_->tableWidget->setRowCount(i_tracks);
|
||||
for (int i = 1; i <= i_tracks; i++) {
|
||||
QCheckBox *checkbox_i = new QCheckBox(ui_->tableWidget);
|
||||
checkbox_i->setCheckState(Qt::Checked);
|
||||
checkboxes_.append(checkbox_i);
|
||||
ui_->tableWidget->setCellWidget(i - 1, kCheckboxColumn, checkbox_i);
|
||||
ui_->tableWidget->setCellWidget(i - 1, kTrackNumberColumn,
|
||||
new QLabel(QString::number(i)));
|
||||
QString track_title = QString("Track %1").arg(i);
|
||||
QLineEdit *line_edit_track_title_i = new QLineEdit(track_title,
|
||||
ui_->tableWidget);
|
||||
track_names_.append(line_edit_track_title_i);
|
||||
ui_->tableWidget->setCellWidget(i - 1, kTrackTitleColumn,
|
||||
line_edit_track_title_i);
|
||||
}
|
||||
}
|
||||
// Get presets
|
||||
QList <TranscoderPreset> presets = Transcoder::GetAllPresets();
|
||||
@ -134,6 +142,11 @@ RipCD::RipCD(QWidget* parent) :
|
||||
ui_->progress_bar->setMaximum(100);
|
||||
}
|
||||
|
||||
RipCD::~RipCD() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* WAV Header documentation
|
||||
* as taken from:
|
||||
@ -369,3 +382,7 @@ void RipCD::AddDestination() {
|
||||
void RipCD::Cancel() {
|
||||
transcoder_->Cancel();
|
||||
}
|
||||
|
||||
bool RipCD::CDIOIsValid() const {
|
||||
return (cdio_);
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ class RipCD: public QDialog {
|
||||
|
||||
public:
|
||||
explicit RipCD(QWidget* parent = 0);
|
||||
~RipCD();
|
||||
bool CDIOIsValid() const;
|
||||
|
||||
private:
|
||||
static const char* kSettingsGroup;
|
||||
|
Loading…
x
Reference in New Issue
Block a user