Skip to content

Commit

Permalink
Added variables to skip images download
Browse files Browse the repository at this point in the history
  • Loading branch information
Iktwo committed Sep 29, 2014
1 parent 0c410eb commit e10d26d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/musicstreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ MusicStreamer::MusicStreamer(QObject *parent) :
connect(mDownloader, SIGNAL(serverError()), SIGNAL(serverError()));
connect(mDownloader, SIGNAL(activeConnectionsChanged()), SIGNAL(activeConnectionsChanged()));
connect(mDownloader, SIGNAL(noResults()), SIGNAL(noResults()));


QSettings settings;
m_skipImages = settings.value("skipImages", true).toBool();
}

void MusicStreamer::downloadSong(const QString &name, const QString &url)
Expand Down Expand Up @@ -133,6 +137,24 @@ QHash<int, QByteArray> MusicStreamer::roleNames() const
return roles;
}

bool MusicStreamer::skipImages() const
{
return m_skipImages;
}

void MusicStreamer::setSkipImages(bool skipImages)
{
if (m_skipImages == skipImages)
return;

m_skipImages = skipImages;

QSettings settings;
settings.setValue("skipImages", m_skipImages);

emit skipImagesChanged();
}

int MusicStreamer::activeConnections() const
{
return mDownloader->activeConnections();
Expand Down
6 changes: 6 additions & 0 deletions src/musicstreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MusicStreamer : public QAbstractListModel
//Q_PROPERTY(bool serverError READ serverError NOTIFY serverErrorChanged)
Q_PROPERTY(bool downloading READ isDownloading NOTIFY downloadingChanged)
Q_PROPERTY(int activeConnections READ activeConnections NOTIFY activeConnectionsChanged)
Q_PROPERTY(bool skipImages READ skipImages WRITE setSkipImages NOTIFY skipImagesChanged)

public:
enum DownloaderRoles {
Expand Down Expand Up @@ -52,6 +53,9 @@ class MusicStreamer : public QAbstractListModel
int activeConnections() const;
void setActiveConnections(int activeConnections);

bool skipImages() const;
void setSkipImages(bool skipImages);

signals:
void songsChanged();
void searchingChanged();
Expand All @@ -61,6 +65,7 @@ class MusicStreamer : public QAbstractListModel
void progressChanged(float progress, const QString &name);
void activeConnectionsChanged();
void noResults();
void skipImagesChanged();

protected:
QHash<int, QByteArray> roleNames() const;
Expand All @@ -73,6 +78,7 @@ class MusicStreamer : public QAbstractListModel
bool mServerError;
QString mLastSearchHasMoreResults;
int fetched;
bool m_skipImages;

private slots:
void songFound(const QString &title, const QString &artist, const QString &length,
Expand Down

0 comments on commit e10d26d

Please sign in to comment.