b/
data/
docs/podcast-index/
+/cmake-build-debug/
+/.idea/
Q_PROPERTY(QObject* shows READ shows CONSTANT)
public:
- AppManager(QObject* parent);
- virtual ~AppManager();
+ explicit AppManager(QObject* parent);
+ ~AppManager() override;
static AppManager *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine);
void initializeView(QUrl url);
QObject *shows();
- QString dataDirectory(void) const;
+ [[nodiscard]] QString dataDirectory() const;
public slots:
void requestNewSource(QUrl sourceFile);
{"display": "refresh all",
"link" : "error.qml",
"action" : "refreshAll"} ]
- /* Rectangle { */
- /* id: cardDelegate */
- /* width: cards.width */
- /* height: 100 */
-
- /* border { */
- /* color: "red" */
- /* width: 1 */
- /* } */
-
- /* Text { */
- /* anchors.centerIn: parent */
- /* text: modelData.display */
- /* } */
-
- /* MouseArea { */
- /* anchors.fill: parent */
- /* onClicked: { */
- /* if("error.qml" !== modelData.link){ */
- /* AppManager.requestNewSource(modelData.link) */
- /* }else if(modelData.action) { */
- /* if("refreshAll" == modelData.action){ */
- /* AppManager.shows.refreshAllFeeds() */
- /* } */
- /* } */
- /* } */
- /* } */
- /* } */
TextWrapper {
id: cardDelegate
+ name: modelData.display
+
width: cards.width
height: 100
isTotallyCentered: true
#include <QNetworkRequest>
#include <QDomDocument>
+#include <utility>
Shows::Shows(QString dataDirectory, QObject *parent)
: QObject(parent),
- m_dataDirectory(dataDirectory),
+ m_dataDirectory(std::move(dataDirectory)),
m_netMgr(new QNetworkAccessManager(this)),
m_current(nullptr)
{
}
Shows::~Shows()
-{
-
-}
+= default;
-void Shows::checkSetCurrent(QString normalSelected)
+void Shows::checkSetCurrent(const QString& normalSelected)
{
QFile cacheFile(m_dataDirectory + "/" + normalSelected + "/feed.xml");
if(cacheFile.exists()){
}
}
-QString Shows::selectedName(void)
+QString Shows::selectedName()
{
return m_selectedName;
}
-void Shows::setSelectedName(QString name)
+void Shows::setSelectedName(const QString &name)
{
if(name != m_selectedName){
m_selectedName = name;
}
}
-QString Shows::selected(void)
+QString Shows::selected()
{
return m_selectedFeed;
}
-void Shows::setSelected(QString rssFeedUrl)
+void Shows::setSelected(const QString& rssFeedUrl)
{
if(rssFeedUrl != m_selectedFeed){
m_selectedFeed = rssFeedUrl;
}
}
-void Shows::processByteArray(QByteArray ba)
+void Shows::processByteArray(const QByteArray& ba)
{
QDomDocument feedDoc;
QDomDocument::ParseResult res = feedDoc.setContent(ba);
if(!res){
// error
- fprintf(stderr, "[SH] RSS feed invalid. ba.size(): %d. Error: %s\n",
+ fprintf(stderr, "[SH] RSS feed invalid. ba.size(): %lld. Error: %s\n",
ba.size(), res.errorMessage.toStdString().c_str());
}else{
// fine. get the title so we can write it out.
}
}
-void Shows::refreshAllFeeds(void)
+void Shows::refreshAllFeeds()
{
// open the xml file that holds this
#define COLLECTION_XML "/home/tlb/dev/git/android-qt-sandbox/example-data/collection_opml.xml"
}
}
-void Shows::refreshSelected(void)
+void Shows::refreshSelected()
{
- // need to setup the download thing
+ // need to set up the download thing
m_netMgr->get(QNetworkRequest(QUrl(selected())));
// QFile cache(m_dataDirectory + "/last-downloaded.txt");
// }
}
-QObject *Shows::current(void)
+QObject *Shows::current()
{
return m_current;
}
Q_INVOKABLE void refreshAllFeeds(void);
public slots:
- void setSelectedName(QString name);
- void setSelected(QString rssFeedUrl);
+ void setSelectedName(const QString &name);
+ void setSelected(const QString& rssFeedUrl);
void refreshSelected(void);
signals:
void currentChanged(QObject *current);
private:
- void processByteArray(QByteArray ba);
- void checkSetCurrent(QString normalSelected);
+ void processByteArray(const QByteArray& ba);
+ void checkSetCurrent(const QString& normalSelected);
QString m_dataDirectory;
QString m_selectedName;
--- /dev/null
+import QtQuick
+
-import QtQuick
-import QtQuick.Layouts
-
-Rectangle {
- id: root
-
- property alias text: t.text
- property alias wrapMode: t.wrapMode
- property alias isClickable: ma.enabled
- property var clickHandler: undefined
- property string name: "unnamed"
- property int buffer: 6
- property int textMaxWidth
- property var isTotallyCentered: undefined
-
- height: t.height + buffer
- width: t.width + buffer
-
- /* not sure any of this matters */
-
- /* none = 0, grid = 1, col = 2, row = 3 */
- /* property int fillMode: 0 */
- /* Layout.fillHeight: { */
- /* return (fillMode == 1) || (fillMode == 2) */
- /* } */
- /* Layout.minimumHeight: t.height + buffer */
- /* Layout.preferredHeight: t.height + buffer */
-
- /* Layout.fillWidth: { */
- /* return (fillMode == 1) || (fillMode == 3) */
- /* } */
- /* Layout.minimumWidth: t.width + buffer */
-
- border {
- width: 1
- color: "red"
- }
- Text {
- id: t
-
- anchors {
- left: {
- if(typeof isTotallyCentered !== "undefined"){
- if(isTotallyCentered){
- return undefined
- }
- }
- return parent.left
- }
- leftMargin: {
- if(typeof isTotallyCentered !== "undefined"){
- if(isTotallyCentered){
- return undefined
- }
- }
- return 5
- }
- verticalCenter: {
- if(typeof isTotallyCentered !== "undefined"){
- if(isTotallyCentered){
- return parent.verticalCenter
- }
- }
- /* always? */
- return undefined
- }
- /* don't always want this */
- horizontalCenter: {
- if(typeof isTotallyCentered !== "undefined"){
- if(isTotallyCentered){
- return parent.horizontalCenter
- }
- }
- return undefined
- }
- }
-
- text: "unset"
- wrapMode: Text.WordWrap
- width: parent.width
- }
- function _l_on_clicked()
- {
- console.error("button '" + root.name + "' clicked")
- if(typeof clickHandler !== "undefined"){
- clickHandler()
- }
- }
- MouseArea {
- id: ma
-
- anchors.fill: parent
-
- enabled: false
- onClicked: _l_on_clicked()
- }
-}
+import QtQuick
+import QtQuick.Layouts
+
+Rectangle {
+ id: root
+
+ property alias text: t.text
+ property alias wrapMode: t.wrapMode
+ property alias isClickable: ma.enabled
+ property var clickHandler: undefined
+ property string name: "unnamed"
+ property int buffer: 6
+ property int textMaxWidth
+ property var isTotallyCentered: undefined
+
+ height: t.height + buffer
+ width: t.width + buffer
+
+ border {
+ width: 1
+ color: "red"
+ }
+ Text {
+ id: t
+
+ anchors {
+ left: {
+ if (typeof isTotallyCentered !== "undefined") {
+ if (isTotallyCentered) {
+ return undefined
+ }
+ }
+ return parent.left
+ }
+ leftMargin: {
+ if (typeof isTotallyCentered !== "undefined") {
+ if (isTotallyCentered) {
+ return undefined
+ }
+ }
+ return 5
+ }
+ fill: {
+ if (typeof isTotallyCentered !== "undefined") {
+ if (isTotallyCentered) {
+ return parent
+ }
+ }
+ return undefined
+ }
+ }
+
+ horizontalAlignment: {
+ if (typeof isTotallyCentered !== "undefined") {
+ if (isTotallyCentered) {
+ return Text.AlignHCenter
+ }
+ }
+ return Text.AlignLeft
+ }
+ verticalAlignment: {
+ if (typeof isTotallyCentered !== "undefined") {
+ if (isTotallyCentered) {
+ return Text.AlignVCenter
+ }
+ }
+ return Text.AlignTop
+ }
+
+ text: "unset"
+ wrapMode: Text.WordWrap
+ width: parent.width
+ }
+
+ function _l_on_clicked() {
+ console.error("button '" + root.name + "' clicked")
+ if (typeof clickHandler !== "undefined") {
+ clickHandler()
+ }
+ }
+
+ MouseArea {
+ id: ma
+
+ anchors.fill: parent
+
+ enabled: false
+ onClicked: _l_on_clicked()
+ }
+}
-import QtQuick
-import QtQuick.Layouts
-
-import tlb
-import "qrc:/tlb/templates"
-
-Page {
- pageTitle: "Show Details"
-
- /* this should show actual details for a show. sqlite? */
- content: Item {
- id: root
-
- anchors {
- top: parent.top
- left: parent.left
- right: parent.right
- margins: 20
- }
-
- /* MVP: show basic stats of the show. */
- Loader {
- id: l1
-
- anchors {
- left: parent.left
- right: parent.right
- }
-
- active: AppManager.shows.current !== null
- sourceComponent: /* ColumnLayout { */ Column {
- spacing: 5
-
- TextWrapper {
- text: "Name: " + AppManager.shows.current.title
-
- Layout.preferredWidth: parent.width
- width: parent.width
- }
- TextWrapper {
- wrapMode: Text.WordWrap
- /* the description already has paragraphs, add more for separation */
- text: "Description: <p>" + AppManager.shows.current.description + "</p>"
-
- width: parent.width
- /* these don't work by proxy if we want the word wrap to work */
- textMaxWidth: parent.width
- /* Layout.fillWidth: true */
- Layout.maximumWidth: parent.width
- Layout.preferredWidth: parent.width
- Layout.maximumHeight: 1000
- }
- TextWrapper {
- text: "Language: " + AppManager.shows.current.language
-
- width: parent.width
- Layout.preferredWidth: parent.width
- }
- TextWrapper {
- text: "Author: " + AppManager.shows.current.author
-
- width: parent.width
- Layout.preferredWidth: parent.width
- }
- TextWrapper {
- text: "Episodes: " + AppManager.shows.current.episodeCount
-
- width: parent.width
- Layout.preferredWidth: parent.width
- }
- }
- }
-
- Text {
- text: AppManager.shows.selectedName + " FETCH BY HAND"
- visible: !l1.active
- }
-
- /* near the bottom, put a refresh button that downloads the feed. */
- Rectangle {
- width: 40
- height: 40
- color: "purple"
- anchors {
- bottom: root.bottom
- left: root.left
- margins: 30
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- AppManager.shows.refreshSelected()
- }
- }
- }
- }
-}
+import QtQuick
+import QtQuick.Layouts
+
+import tlb
+import "qrc:/tlb/templates"
+
+Page {
+ pageTitle: "Show Details"
+
+ /* this should show actual details for a show. sqlite? */
+ content: Item {
+ id: root
+
+ anchors.fill: parent
+
+ Column {
+ anchors {
+ fill: parent
+ margins: 20
+ bottomMargin: 80
+ }
+ clip: true
+
+ /* MVP: show basic stats of the show. */
+ Loader {
+ id: l1
+
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ active: AppManager.shows.current !== null
+ sourceComponent: /* ColumnLayout { */ Column {
+ spacing: 5
+
+ TextWrapper {
+ text: "Name: " + AppManager.shows.current.title
+
+ Layout.preferredWidth: parent.width
+ width: parent.width
+ }
+ TextWrapper {
+ wrapMode: Text.WordWrap
+ /* the description already has paragraphs, add more for separation */
+ text: "Description: <p>" + AppManager.shows.current.description + "</p>"
+
+ width: parent.width
+ /* these don't work by proxy if we want the word wrap to work */
+ textMaxWidth: parent.width
+ /* Layout.fillWidth: true */
+ Layout.maximumWidth: parent.width
+ Layout.preferredWidth: parent.width
+ Layout.maximumHeight: 1000
+ }
+ TextWrapper {
+ text: "Language: " + AppManager.shows.current.language
+
+ width: parent.width
+ Layout.preferredWidth: parent.width
+ }
+ TextWrapper {
+ text: "Author: " + AppManager.shows.current.author
+
+ width: parent.width
+ Layout.preferredWidth: parent.width
+ }
+ TextWrapper {
+ text: "Episodes: " + AppManager.shows.current.episodeCount
+
+ width: parent.width
+ Layout.preferredWidth: parent.width
+ }
+ }
+ }
+
+ /* Summary of recent episodes */
+
+ }
+
+ Text {
+ text: AppManager.shows.selectedName + " FETCH BY HAND"
+ visible: !l1.active
+ }
+
+ /* near the bottom, put a refresh button that downloads the feed. */
+ Rectangle {
+ width: 40
+ height: 40
+ color: "purple"
+ anchors {
+ bottom: root.bottom
+ left: root.left
+ margins: 30
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ AppManager.shows.refreshSelected()
+ }
+ }
+ }
+ }
+}
property real curMouseX: 0.0
property real curMouseY: 0.0
property real jumpPos: 0.0
- property alias showBox: selector.visible
+ /* property alias showBox: selector.visible */
property string selectedTitle: ""
property string selectedUrl: ""
var myMiddle = rec.height / 2
var newPoint = mapToItem(col, 0, myMiddle)
jumpPos = newPoint.y
- showBox = true
+ /* showBox = true */
selectedTitle = title
selectedUrl = url
}else if(selectedTitle === title){
console.error(title + " no longer hovered")
- showBox = false
+ /* showBox = false */
selectedTitle = ""
selectedUrl = ""
}