30 m_listFunctionWidget(nullptr),
31 m_songSearchWidget(nullptr)
105 inDeed.remove(item.m_itemIndex);
108 if(!inDeed.isEmpty())
112 for(
const int item :
qAsConst(inDeed))
135 case MUSIC_RECENT_LIST:
157 return inDeed.isEmpty();
162 for(
int i = 0; i < items.count(); ++i)
190 const QFileInfo fin(path);
198 files << fin.absoluteFilePath();
213 if(item->
m_songs.contains(song))
227 files << fin.absoluteFilePath();
249 progress.
setTitle(tr(
"Import file mode"));
250 progress.setRange(0, files.count());
256 for(
const QString &path :
qAsConst(files))
263 progress.setValue(++i);
310 if(playlistRow < 0 || playlistRow >=
m_containerItems.count() || path.isEmpty())
316 for(
int i = 0; i < songs->count(); ++i)
334 if(index < 0 || index >= songs->count())
339 return songs->at(index).path();
350 if(row >= result.count() || row < 0)
411 QString
name = tr(
"Default Item");
417 if(
id < songItem.m_id)
444 message.
setText(tr(
"Are you sure to delete?"));
456 m_itemList.front().m_widgetItem->setExpand(
false);
474 message.
setText(tr(
"Are you sure to delete?"));
483 m_itemList.front().m_widgetItem->setExpand(
false);
508 if(widget->rowCount() > 0)
510 widget->setCurrentCell(0, 1);
681 for(
int i = 0; i < searchedSongs.count(); ++i)
702 for(
int i = 0; i < searchedSongs.count(); ++i)
704 if(searchedSongs[i].contains(text, Qt::CaseInsensitive))
730 if(lastPlayIndex.count() != 3)
736 const int index = lastPlayIndex[2].toInt();
762 if(item->
m_songs.removeOne(song))
798 if(item->
m_songs.removeOne(song))
816 int index = songItem->
m_songs.indexOf(song);
822 index = songItem->
m_songs.count() - 1;
841 QStringList files(items);
846 const MusicSongList *musicSongs = &item->
m_songs;
849 int index = musicSongs->count() - 1;
850 if(musicSongs->contains(song))
852 index = musicSongs->indexOf(song);
869 QStringList deleteFiles;
870 for(
int i = index.count() - 1; i >= 0; --i)
873 deleteFiles << song.
path();
878 if(playIndex > -1 && playIndex < songs.count())
880 if(songs[playIndex] == song)
905 for(
int i = start; i > end; --i)
912 for(
int i = start; i < end; ++i)
945 if(!songs.isEmpty() && index < songs.count())
960 if(songs->isEmpty() || index >= songs->count())
967 MusicSongList *recentSongs = &item->
m_songs;
969 if(!recentSongs->contains(recentSong))
973 recentSongs->takeFirst();
977 recentSong.setPlayCount(recentSong.playCount() + 1);
978 recentSongs->append(recentSong);
981 const QString title(QString(
"%1[%2]").arg(item->
m_itemName).arg(recentSongs->count()));
988 if(recentSong == song)
990 song.setPlayCount(song.playCount() + 1);
1049 for(
int i = 0; i < songs->count(); ++i)
1051 (*songs)[i].setSort(sort);
1056 std::sort(songs->begin(), songs->end());
1060 std::sort(songs->begin(), songs->end(), std::greater<MusicSong>());
1066 index = songs->indexOf(song);
1110 MusicSongsToolBoxWidget::resizeEvent(event);
1116 MusicSongsToolBoxWidget::dragEnterEvent(event);
1117 event->setDropAction(Qt::IgnoreAction);
1123 MusicSongsToolBoxWidget::dragMoveEvent(event);
1125 bool contains =
false;
1133 QWidget *container = item.m_widgetItem->item();
1134 if(item.m_widgetItem->isActive() || (container && container->isVisible()))
1140 event->setDropAction(contains ? Qt::CopyAction : Qt::IgnoreAction);
1146 MusicSongsToolBoxWidget::dropEvent(event);
1148 QStringList dirs, files;
1149 const QMimeData *data =
event->mimeData();
1151 for(
const QUrl &url : data->urls())
1153 const QString &path = url.toLocalFile();
1154 if(QFileInfo(path).isDir())
1171 QWidget *container = item.m_widgetItem->item();
1172 if(item.m_widgetItem->isActive() || (container && container->isVisible()))
1179 for(
const QString &dir :
qAsConst(dirs))
1186 for(
const QString &path :
qAsConst(files))
1198 MusicSongsToolBoxWidget::contextMenuEvent(event);
1202 menu.addAction(tr(
"Create Item"),
this, SLOT(
addNewRowItem()));
1210 menu.exec(QCursor::pos());
1231 QString check =
name;
1237 if(check == songItem.m_itemName)
1240 check = name + QString::number(i);
1283 const QString title(QString(
"%1[%2]").arg(item->
m_itemName).arg(item->
m_songs.count()));
1324 item.m_itemWidget->setPlaylistRow(index);
1327 TTK::IndexPropertyList
items;
1341 for(
int i = begin; i < end; ++i)
1343 items << TTK::IndexProperty(i + 1, i);
1348 for(
int i = end; i > begin; --i)
1350 items << TTK::IndexProperty(i, i - 1);
#define TTKStaticCast(x, y)
TTK_MODULE_EXPORT QByteArray md5(const QByteArray &data)
The class of the search result data item.
static MusicApplication * instance()
virtual void setVisible(bool visible) overridefinal
void setText(const QString &text) const
TTK_MODULE_EXPORT bool playlistRowValid(int index)
#define QtContainerSwap(p, i, j)
Container swap.
void addSongToLovestList(bool state=true)
MusicSongItemList m_containerItems
QString path() const noexcept
void playIndexBy(int row)
The class of the messagebox widget.
#define MUSIC_RECENT_LIST
#define TTKGenerateSingleWidget(...)
void removeItemAt(const QStringList &path, bool remove, bool current, int playlistRow)
void importSongsByDir(int index=TTK_LOW_LEVEL)
The class of the index property.
TTKSearchItems m_searchResultItems
static void popup(const QString &text)
TTK_MODULE_EXPORT QString pefix(const QString &name)
TTK_MODULE_EXPORT QString generateNetworkSongPath(const QString &path)
void importSongsByFiles(int index=TTK_LOW_LEVEL)
MusicAbstractSongsListTableWidget * m_itemWidget
void playIndexClicked(int row, int column)
TTK_MODULE_EXPORT QFileInfoList fileInfoListByPath(const QString &dpath, const QStringList &filter={}, bool recursively=true)
TTK_MODULE_EXPORT QString splitToken(const QString &name)
static const QString MenuStyle02
The class of the music song item.
#define MUSIC_NETWORK_LIST
#define MUSIC_LOVEST_LIST
void setPlayCount(const int c) noexcept
bool hasSearchResult() const
TTK_MODULE_EXPORT QStringList fileListByPath(const QString &dpath, const QStringList &filter={}, bool recursively=true)
#define TTK_FILE_SUFFIX(fin)
The class of the music song info.
The class of the song search widget.
void removeLoveItemAt(const QString &path, bool current)
#define MUSIC_NORMAL_LIST
int playCount() const noexcept
TTK_MODULE_EXPORT bool isNetworkUrl(const QString &path)
TTK_MODULE_EXPORT MusicSongList generateSongList(const QString &path)
#define TTKObjectCast(x, y)