Fix minor code issues
This commit is contained in:
@@ -440,6 +440,8 @@ void Database::ExecSongTablesCommands(QSqlDatabase &db, const QStringList &song_
|
||||
|
||||
QStringList Database::SongsTables(QSqlDatabase &db, int schema_version) const {
|
||||
|
||||
Q_UNUSED(schema_version);
|
||||
|
||||
QStringList ret;
|
||||
|
||||
// look for the tables in the main db
|
||||
|
||||
@@ -2069,10 +2069,14 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
|
||||
}
|
||||
|
||||
void MainWindow::ForceShowOSD(const Song &song, const bool toggle) {
|
||||
|
||||
Q_UNUSED(song);
|
||||
|
||||
if (toggle) {
|
||||
osd_->SetPrettyOSDToggleMode(toggle);
|
||||
}
|
||||
osd_->ReshowCurrentSong();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::Activate() {
|
||||
@@ -2385,11 +2389,13 @@ void MainWindow::PlaylistViewSelectionModelChanged() {
|
||||
}
|
||||
|
||||
void MainWindow::PlaylistCurrentChanged(const QModelIndex &proxy_current) {
|
||||
|
||||
const QModelIndex source_current =app_->playlist_manager()->current()->proxy()->mapToSource(proxy_current);
|
||||
|
||||
// If the user moves the current index using the keyboard and then presses
|
||||
// F2, we don't want that editing the last column that was right clicked on.
|
||||
if (source_current != playlist_menu_index_) playlist_menu_index_ = QModelIndex();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::Raise() {
|
||||
@@ -2399,10 +2405,16 @@ void MainWindow::Raise() {
|
||||
|
||||
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) {
|
||||
|
||||
Q_UNUSED(eventType);
|
||||
Q_UNUSED(result);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
MSG *msg = static_cast<MSG*>(message);
|
||||
thumbbar_->HandleWinEvent(msg);
|
||||
#else
|
||||
Q_UNUSED(message);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
using std::unique_ptr;
|
||||
|
||||
class About;
|
||||
class AlbumCoverManager;;
|
||||
class AlbumCoverManager;
|
||||
class Application;
|
||||
class ContextView;
|
||||
class CollectionViewContainer;
|
||||
|
||||
@@ -388,6 +388,8 @@ void Mpris2::CurrentSongChanged(const Song &song) {
|
||||
// ... and we add the cover information later, when it's available.
|
||||
void Mpris2::AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image) {
|
||||
|
||||
Q_UNUSED(image);
|
||||
|
||||
last_metadata_ = QVariantMap();
|
||||
song.ToXesam(&last_metadata_);
|
||||
|
||||
@@ -502,19 +504,31 @@ TrackIds Mpris2::Tracks() const {
|
||||
bool Mpris2::CanEditTracks() const { return false; }
|
||||
|
||||
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds &tracks) const {
|
||||
|
||||
Q_UNUSED(tracks);
|
||||
|
||||
// TODO
|
||||
return TrackMetadata();
|
||||
|
||||
}
|
||||
|
||||
void Mpris2::AddTrack(const QString &uri, const QDBusObjectPath &afterTrack, bool setAsCurrent) {
|
||||
|
||||
Q_UNUSED(uri);
|
||||
Q_UNUSED(afterTrack);
|
||||
Q_UNUSED(setAsCurrent);
|
||||
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
void Mpris2::RemoveTrack(const QDBusObjectPath &trackId) {
|
||||
Q_UNUSED(trackId);
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Mpris2::GoTo(const QDBusObjectPath &trackId) {
|
||||
Q_UNUSED(trackId);
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -571,6 +585,8 @@ void Mpris2::ActivatePlaylist(const QDBusObjectPath &playlist_id) {
|
||||
// TODO: Support sort orders.
|
||||
MprisPlaylistList Mpris2::GetPlaylists(quint32 index, quint32 max_count, const QString &order, bool reverse_order) {
|
||||
|
||||
Q_UNUSED(order);
|
||||
|
||||
MprisPlaylistList ret;
|
||||
for (Playlist *p : app_->playlist_manager()->GetAllPlaylists()) {
|
||||
MprisPlaylist mpris_playlist;
|
||||
@@ -597,6 +613,7 @@ void Mpris2::PlaylistChanged(Playlist *playlist) {
|
||||
}
|
||||
|
||||
void Mpris2::PlaylistCollectionChanged(Playlist *playlist) {
|
||||
Q_UNUSED(playlist);
|
||||
EmitNotification("PlaylistCount", "", "org.mpris.MediaPlayer2.Playlists");
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class Playlist;
|
||||
|
||||
typedef QList<QVariantMap> TrackMetadata;
|
||||
typedef QList<QDBusObjectPath> TrackIds;
|
||||
Q_DECLARE_METATYPE(TrackMetadata);
|
||||
Q_DECLARE_METATYPE(TrackMetadata)
|
||||
|
||||
struct MprisPlaylist {
|
||||
QDBusObjectPath id;
|
||||
@@ -57,14 +57,14 @@ struct MprisPlaylist {
|
||||
QString icon; // Uri
|
||||
};
|
||||
typedef QList<MprisPlaylist> MprisPlaylistList;
|
||||
Q_DECLARE_METATYPE(MprisPlaylist);
|
||||
Q_DECLARE_METATYPE(MprisPlaylistList);
|
||||
Q_DECLARE_METATYPE(MprisPlaylist)
|
||||
Q_DECLARE_METATYPE(MprisPlaylistList)
|
||||
|
||||
struct MaybePlaylist {
|
||||
bool valid;
|
||||
MprisPlaylist playlist;
|
||||
};
|
||||
Q_DECLARE_METATYPE(MaybePlaylist);
|
||||
Q_DECLARE_METATYPE(MaybePlaylist)
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const MprisPlaylist &playlist);
|
||||
const QDBusArgument &operator>> (const QDBusArgument &arg, MprisPlaylist &playlist);
|
||||
|
||||
@@ -76,21 +76,21 @@ class MusicStorage {
|
||||
|
||||
virtual TranscodeMode GetTranscodeMode() const { return Transcode_Never; }
|
||||
virtual Song::FileType GetTranscodeFormat() const { return Song::FileType_Unknown; }
|
||||
virtual bool GetSupportedFiletypes(QList<Song::FileType>* ret) { return true; }
|
||||
virtual bool GetSupportedFiletypes(QList<Song::FileType>* ret) { Q_UNUSED(ret); return true; }
|
||||
|
||||
virtual bool StartCopy(QList<Song::FileType>* supported_types) { return true;}
|
||||
virtual bool StartCopy(QList<Song::FileType>* supported_types) { Q_UNUSED(supported_types); return true; }
|
||||
virtual bool CopyToStorage(const CopyJob& job) = 0;
|
||||
virtual void FinishCopy(bool success) {}
|
||||
virtual void FinishCopy(bool success) { Q_UNUSED(success); }
|
||||
|
||||
virtual void StartDelete() {}
|
||||
virtual bool DeleteFromStorage(const DeleteJob& job) = 0;
|
||||
virtual void FinishDelete(bool success) {}
|
||||
virtual void FinishDelete(bool success) { Q_UNUSED(success); }
|
||||
|
||||
virtual void Eject() {}
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(MusicStorage*);
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>);
|
||||
Q_DECLARE_METATYPE(MusicStorage*)
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>)
|
||||
|
||||
#endif // MUSICSTORAGE_H
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
class PoTranslator : public QTranslator {
|
||||
public:
|
||||
QString translate(const char *context, const char *source_text, const char *disambiguation = 0, int n = -1) const {
|
||||
Q_UNUSED(n);
|
||||
QString ret = QTranslator::translate(context, source_text, disambiguation);
|
||||
if (!ret.isEmpty()) return ret;
|
||||
return QTranslator::translate(nullptr, source_text, disambiguation);
|
||||
|
||||
@@ -362,10 +362,10 @@ class Song {
|
||||
|
||||
QSharedDataPointer<Private> d;
|
||||
};
|
||||
Q_DECLARE_METATYPE(Song);
|
||||
Q_DECLARE_METATYPE(Song)
|
||||
|
||||
typedef QList<Song> SongList;
|
||||
Q_DECLARE_METATYPE(QList<Song>);
|
||||
Q_DECLARE_METATYPE(QList<Song>)
|
||||
|
||||
uint qHash(const Song &song);
|
||||
// Hash function using field checked in IsSimilar function
|
||||
|
||||
@@ -94,6 +94,8 @@ void StandardItemIconLoader::ModelReset() {
|
||||
|
||||
void StandardItemIconLoader::ImageLoaded(const quint64 id, const QUrl &cover_url, const QImage &image) {
|
||||
|
||||
Q_UNUSED(cover_url);
|
||||
|
||||
QStandardItem *item = pending_covers_.take(id);
|
||||
if (!item) return;
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ SystemTrayIcon::SystemTrayIcon(QObject *parent)
|
||||
|
||||
QPixmap SystemTrayIcon::CreateIcon(const QPixmap &icon, const QPixmap &grey_icon) {
|
||||
|
||||
Q_UNUSED(grey_icon);
|
||||
|
||||
QRect rect(icon.rect());
|
||||
|
||||
// The angle of the line that's used to cover the icon.
|
||||
@@ -97,8 +99,12 @@ void SystemTrayIcon::SetPaused() {
|
||||
}
|
||||
|
||||
void SystemTrayIcon::SetPlaying(bool enable_play_pause) {
|
||||
|
||||
Q_UNUSED(enable_play_pause);
|
||||
|
||||
current_state_icon_ = playing_icon_;
|
||||
UpdateIcon();
|
||||
|
||||
}
|
||||
|
||||
void SystemTrayIcon::SetStopped() {
|
||||
|
||||
@@ -42,16 +42,16 @@ class SystemTrayIcon : public QObject {
|
||||
virtual void SetupMenu(QAction *previous, QAction *play, QAction *stop, QAction *stop_after, QAction *next, QAction *mute, QAction *love, QAction *quit) = 0;
|
||||
|
||||
virtual bool IsVisible() const { return true; }
|
||||
virtual void SetVisible(bool visible) {}
|
||||
virtual void SetVisible(bool visible) { Q_UNUSED(visible); }
|
||||
|
||||
// Called by the OSD
|
||||
virtual void ShowPopup(const QString &summary, const QString &message, int timeout) {}
|
||||
virtual void ShowPopup(const QString &summary, const QString &message, int timeout) { Q_UNUSED(summary); Q_UNUSED(message); Q_UNUSED(timeout); }
|
||||
// If this gets invoked with image_path equal to nullptr, the tooltip should still be shown - just without the cover art.
|
||||
virtual void SetNowPlaying(const Song &song, const QUrl &cover_url) {}
|
||||
virtual void SetNowPlaying(const Song &song, const QUrl &cover_url) { Q_UNUSED(song); Q_UNUSED(cover_url); }
|
||||
virtual void ClearNowPlaying() {}
|
||||
|
||||
virtual bool MuteEnabled() { return false; }
|
||||
virtual void SetMuteEnabled(bool enabled) {}
|
||||
virtual void SetMuteEnabled(bool enabled) { Q_UNUSED(enabled); }
|
||||
|
||||
static SystemTrayIcon *CreateSystemTrayIcon(QObject *parent = nullptr);
|
||||
|
||||
@@ -60,9 +60,9 @@ class SystemTrayIcon : public QObject {
|
||||
virtual void SetPaused();
|
||||
virtual void SetPlaying(bool enable_play_pause = false);
|
||||
virtual void SetStopped();
|
||||
virtual void LoveVisibilityChanged(bool value) {}
|
||||
virtual void LoveStateChanged(bool value) {}
|
||||
virtual void MuteButtonStateChanged(bool value) {}
|
||||
virtual void LoveVisibilityChanged(bool value) { Q_UNUSED(value); }
|
||||
virtual void LoveStateChanged(bool value) { Q_UNUSED(value); }
|
||||
virtual void MuteButtonStateChanged(bool value) { Q_UNUSED(value); }
|
||||
|
||||
signals:
|
||||
void ChangeVolume(int delta);
|
||||
|
||||
@@ -56,7 +56,7 @@ class TaskManager : public QObject {
|
||||
const int task_id_;
|
||||
TaskManager *task_manager_;
|
||||
|
||||
Q_DISABLE_COPY(ScopedTask);
|
||||
Q_DISABLE_COPY(ScopedTask)
|
||||
};
|
||||
|
||||
// Everything here is thread safe
|
||||
@@ -80,7 +80,7 @@ signals:
|
||||
QMap<int, Task> tasks_;
|
||||
int next_task_id_;
|
||||
|
||||
Q_DISABLE_COPY(TaskManager);
|
||||
Q_DISABLE_COPY(TaskManager)
|
||||
};
|
||||
|
||||
#endif // TASKMANAGER_H
|
||||
|
||||
@@ -791,20 +791,26 @@ QString UnicodeToAscii(const QString &unicode) {
|
||||
if (conv == (iconv_t) -1) return QString();
|
||||
|
||||
QByteArray utf8 = unicode.toUtf8();
|
||||
|
||||
size_t input_len = utf8.length() + 1;
|
||||
char input[input_len];
|
||||
char *input = new char[input_len];
|
||||
char *input_ptr = input;
|
||||
|
||||
size_t output_len = input_len*2;
|
||||
char *output = new char[output_len];
|
||||
char *output_ptr = output;
|
||||
|
||||
snprintf(input, input_len, "%s", utf8.constData());
|
||||
|
||||
char output[input_len*2];
|
||||
size_t output_len = sizeof(output);
|
||||
|
||||
char *input_ptr = input;
|
||||
char *output_ptr = output;
|
||||
iconv(conv, &input_ptr, &input_len, &output_ptr, &output_len);
|
||||
iconv(conv, &input, &input_len, &output, &output_len);
|
||||
iconv_close(conv);
|
||||
|
||||
return QString(output);
|
||||
QString ret(output_ptr);
|
||||
|
||||
delete[] input_ptr;
|
||||
delete[] output_ptr;
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ class ScopedWCharArray {
|
||||
int bytes() const { return (chars_ + 1) *sizeof(wchar_t); }
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ScopedWCharArray);
|
||||
Q_DISABLE_COPY(ScopedWCharArray)
|
||||
|
||||
int chars_;
|
||||
std::unique_ptr<wchar_t[]> data_;
|
||||
|
||||
Reference in New Issue
Block a user