Add cpp files for classes with only header files

This commit is contained in:
Jonas Kvinge
2024-08-12 00:48:16 +02:00
parent 1ebcd61a75
commit f624b7a331
19 changed files with 317 additions and 47 deletions

View File

@@ -0,0 +1,37 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry 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.
*
* Strawberry 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.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "playlistitemmimedata.h"
#include "playlistitem.h"
PlaylistItemMimeData::PlaylistItemMimeData(const PlaylistItemPtr &item, QObject *parent)
: items_(PlaylistItemPtrList() << item) {
Q_UNUSED(parent);
}
PlaylistItemMimeData::PlaylistItemMimeData(const PlaylistItemPtrList &items, QObject *parent)
: items_(items) {
Q_UNUSED(parent);
}

View File

@@ -2,6 +2,7 @@
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,8 +33,8 @@ class PlaylistItemMimeData : public MimeData {
Q_OBJECT
public:
explicit PlaylistItemMimeData(const PlaylistItemPtr &item, QObject* = nullptr) : MimeData(), items_(PlaylistItemPtrList() << item) {}
explicit PlaylistItemMimeData(const PlaylistItemPtrList &items, QObject* = nullptr) : MimeData(), items_(items) {}
explicit PlaylistItemMimeData(const PlaylistItemPtr &item, QObject *parent = nullptr);
explicit PlaylistItemMimeData(const PlaylistItemPtrList &items, QObject *parent = nullptr);
PlaylistItemPtrList items_;
};

View File

@@ -0,0 +1,36 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry 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.
*
* Strawberry 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.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "playlistlistsortfiltermodel.h"
PlaylistListSortFilterModel::PlaylistListSortFilterModel(QObject *parent)
: QSortFilterProxyModel(parent) {}
bool PlaylistListSortFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const {
// Compare the display text first.
const int ret = left.data().toString().localeAwareCompare(right.data().toString());
if (ret < 0) return true;
if (ret > 0) return false;
// Now use the source model row order to ensure we always get a deterministic sorting even when two items are named the same.
return left.row() < right.row();
}

View File

@@ -2,7 +2,7 @@
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,18 +28,9 @@ class PlaylistListSortFilterModel : public QSortFilterProxyModel {
Q_OBJECT
public:
explicit PlaylistListSortFilterModel(QObject *parent)
: QSortFilterProxyModel(parent) {}
explicit PlaylistListSortFilterModel(QObject *parent);
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override {
// Compare the display text first.
const int ret = left.data().toString().localeAwareCompare(right.data().toString());
if (ret < 0) return true;
if (ret > 0) return false;
// Now use the source model row order to ensure we always get a deterministic sorting even when two items are named the same.
return left.row() < right.row();
}
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
};
#endif // PLAYLISTLISTSORTFILTERMODEL_H

View File

@@ -0,0 +1,26 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry 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.
*
* Strawberry 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.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "songmimedata.h"
SongMimeData::SongMimeData(QObject *parent) : backend(nullptr) {
Q_UNUSED(parent);
}

View File

@@ -2,6 +2,7 @@
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,9 +24,6 @@
#include "config.h"
#include <QObject>
#include <QMimeData>
#include "core/shared_ptr.h"
#include "core/mimedata.h"
#include "core/song.h"
@@ -36,7 +34,7 @@ class SongMimeData : public MimeData {
Q_OBJECT
public:
explicit SongMimeData(QObject* = nullptr) : MimeData(), backend(nullptr) {}
explicit SongMimeData(QObject *parent = nullptr);
SharedPtr<CollectionBackendInterface> backend;
SongList songs;