RipCDDialog now only depends on CddaDevice, no longer on CddaSongLoader

This commit is contained in:
Lukas Prediger 2021-07-30 15:58:44 +03:00 committed by John Maguire
parent 6b03b8f5d1
commit 50404a967b
3 changed files with 6 additions and 17 deletions

View File

@ -54,6 +54,7 @@ class CddaDevice : public ConnectedDevice {
// Check whether a valid device handle was opened.
bool IsValid() const;
void WatchForDiscChanges(bool watch);
void LoadSongs();
static QStringList url_schemes() { return QStringList() << "cdda"; }
@ -77,8 +78,6 @@ class CddaDevice : public ConnectedDevice {
void CheckDiscChanged();
private:
void LoadSongs();
CdIo_t* cdio_;
QTimer disc_changed_timer_;
CddaSongLoader cdda_song_loader_;

View File

@ -63,8 +63,7 @@ RipCDDialog::RipCDDialog(DeviceManager* device_manager, QWidget* parent)
cdda_devices_(
device_manager->FindDevicesByUrlSchemes(CddaDevice::url_schemes())),
working_(false),
cdda_device_(),
loader_(nullptr) {
cdda_device_() {
Q_ASSERT(device_manager);
// Init
ui_->setupUi(this);
@ -314,8 +313,7 @@ void RipCDDialog::InvertSelection() {
}
void RipCDDialog::DeviceSelected(int device_index) {
// disconnecting from previous loader and device, if any
if (loader_) disconnect(loader_, nullptr, this, nullptr);
// disconnecting from previous device, if any
if (cdda_device_) disconnect(cdda_device_.get(), nullptr, this, nullptr);
ResetDialog();
@ -338,15 +336,9 @@ void RipCDDialog::DeviceSelected(int device_index) {
}
connect(cdda_device_.get(), SIGNAL(DiscChanged()), SLOT(DiscChanged()));
// get SongLoader from device and connect signals
loader_ = cdda_device_->loader();
Q_ASSERT(loader_);
connect(loader_, SIGNAL(SongsUpdated(SongList)), SLOT(SongsLoaded(SongList)));
// load songs from new SongLoader
loader_->LoadSongs();
connect(cdda_device_.get(), SIGNAL(SongsDiscovered(SongList)),
SLOT(SongsLoaded(SongList)));
cdda_device_->LoadSongs();
}
void RipCDDialog::Finished(Ripper* ripper) {

View File

@ -29,7 +29,6 @@ class QCloseEvent;
class QLineEdit;
class QShowEvent;
class CddaSongLoader;
class Ripper;
class Ui_RipCDDialog;
class CddaDevice;
@ -90,7 +89,6 @@ class RipCDDialog : public QDialog {
QList<DeviceInfo*> cdda_devices_;
bool working_;
std::shared_ptr<CddaDevice> cdda_device_;
CddaSongLoader* loader_;
SongList songs_;
};
#endif // SRC_RIPPER_RIPCDDIALOG_H_