raDIYo 0.4
swsongscontrol.cpp
1/***************************************************************************
2
3 source::worx raDIYo
4 Copyright © 2020-2022 c.holzheuer
5 c.holzheuer@sourceworx.org
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12***************************************************************************/
13
14
15#include <QDebug>
16#include <QPainter>
17#include <QDir>
18#include <QStandardPaths>
19
20#include <swsongscontrol.h>
21#include <swradiyomainwidget.h>
22
23
24SWSongsControl::SWSongsControl( SWRaDIYoMainWidget* parent )
25 : SWListControl( parent )
26{
27
28 _header->setText( "Playlist" );
29 _itemList->setFocus();
30 _sourceType = SWPlayableItem::SWLOCALFILE;
31}
32
33
34SWSongsControl::~SWSongsControl()
35{
36 saveSettings();
37}
38
39
40void SWSongsControl::loadEntryList( const QString& folderHint )
41{
42 QDir songs( folderHint );
43
44 songs.setFilter( QDir::Files );
45 QFileInfoList list = songs.entryInfoList();
46 for( auto& entry : list )
47 {
48 //qDebug() << "ja: "<< entry;
49 QListWidgetItem* item = new QListWidgetItem( entry.fileName() );
50 //item->setData( SWListControlRole, _pathPrefix + entry.absoluteFilePath() );
51 item->setData( SWListControlRole, "file:" + entry.absoluteFilePath() );
52 _itemList->addItem( item );
53 }
54
55 if( _itemList->count() > 0 )
56 {
57 _idx = 0;
58 _itemList->setCurrentRow( _idx );
59 }
60
61
62
63
64}
65
66//??
67void SWSongsControl::loadSettings()
68{
69
70
71}
72
73void SWSongsControl::saveSettings()
74{
75
76}
77
78
79