diff options
author | Arno <arno@disconnect.de> | 2018-02-17 07:14:46 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-02-17 07:14:46 +0100 |
commit | 7ea45995fe16be78ebeebd8d79b8145802699eaa (patch) | |
tree | 5b9d1069e776bccc8994bea3579a4fe75396621e /collectionwebradioview.cpp | |
parent | 3095a50fe57b9ccefca133106651f3bc2c3d7895 (diff) | |
download | BeetPlayer-7ea45995fe16be78ebeebd8d79b8145802699eaa.tar.gz BeetPlayer-7ea45995fe16be78ebeebd8d79b8145802699eaa.tar.bz2 BeetPlayer-7ea45995fe16be78ebeebd8d79b8145802699eaa.zip |
New class: CollectionWebradioView
Basically the same as populateByWebradio, just wrapped in a shiny, new
CollectionWidget.
Diffstat (limited to 'collectionwebradioview.cpp')
-rw-r--r-- | collectionwebradioview.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/collectionwebradioview.cpp b/collectionwebradioview.cpp new file mode 100644 index 0000000..53d7cbd --- /dev/null +++ b/collectionwebradioview.cpp @@ -0,0 +1,26 @@ +#include <QSqlDatabase> +#include <QSqlQuery> +#include <QStandardItem> + +#include "collectionwebradioview.h" + +CollectionWebradioView::CollectionWebradioView(QWidget *parent) : CollectionWidget(parent){ +} + +void CollectionWebradioView::populate(){ + model()->clear(); + model()->setHorizontalHeaderLabels(headers()); + QSqlDatabase db = QSqlDatabase::database("beetplayerdb"); + QStandardItem *root = model()->invisibleRootItem(); + QIcon wrIcon(":/dog_hood.png"); + QSqlQuery wrQ = QSqlQuery("SELECT tdescription, turl FROM webradio ORDER BY tdescription DESC", db); + while(wrQ.next()){ + QStandardItem *curWr = new QStandardItem; + curWr->setEditable(false); + curWr->setFont(QFont("courier")); + curWr->setText(wrQ.value(0).toString()); + curWr->setIcon(wrIcon); + curWr->setData(wrQ.value(1), UrlRole); + root->appendRow(curWr); + } +} |