raDIYo 0.4
swsendercontrol.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 <QTextStream>
16#include <QFile>
17
18#include <swsendercontrol.h>
19#include <swradiyomainwidget.h>
20
21
22SWSenderControl::SWSenderControl( SWRaDIYoMainWidget* parent )
23 : SWListControl( parent )
24{
25
26 _header->setText( "Sender" );
27 _itemList->setFocus();
28 _sourceType = SWPlayableItem::SWWEBSTREAM;
29
30}
31
32
33SWSenderControl::~SWSenderControl()
34{
35 saveSettings();
36}
37
38
39void SWSenderControl::loadEntryList( const QString& folderHint )
40{
41
42 // erstmal die 'eingebauten' medien( sender oder songs) laden
43
44 // SWMEDIALIST
45 QString mediafile = readResource( folderHint );
46 QTextStream medialist( &mediafile );
47
48 while( !medialist.atEnd() )
49 {
50 QString line = medialist.readLine();
51 QStringList entry = line.split( ';');
52 if( entry.size() == 2 )
53 {
54 QListWidgetItem* item = new QListWidgetItem( entry[0] );
55 item->setData( SWListControlRole, entry[1] );
56 _itemList->addItem( item );
57 }
58
59 }
60
61 if( _itemList->count() > 0 )
62 {
63 _idx = 0;
64 _itemList->setCurrentRow( _idx );
65 }
66
67}
68
69
70//??
71void SWSenderControl::saveSettings()
72{
73
74}