blob: 86c71195cee30756588ec443fe03bce03ce71f60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#ifndef __NOPACITY_RSSREADER_H
#define __NOPACITY_RSSREADER_H
#include <curl/curl.h>
#include <curl/easy.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <string>
#include <vector>
#define NOPACITY_USERAGENT "libcurl-agent/1.0"
struct XMLMemoryStruct {
char *memory;
size_t size;
};
struct RssElement {
std::string title;
std::string content;
int width;
};
class cRssReader : public cThread{
public:
cRssReader(cOsd *osd, cFont *font, cPoint position, cPoint size);
~cRssReader();
virtual void Action(void);
void Stop(void) {Cancel(-1);};
void SetFeed(std::string feedUrl) {this->feedUrl = feedUrl;};
void SwitchNextMessage(void) {switchToNextMessage = true;};
private:
cOsd *osd;
cFont *font;
cPixmap *pixmap;
std::string feedUrl;
int x, y;
int width, height;
void createPixmap(void);
void drawText(void);
int readRssURL(const char *url);
void saveRss(void);
void traverseTree(xmlNode * a_node, bool foundItem);
void saveItem(void);
void fadeInOut(bool fadeIn);
XMLMemoryStruct xmlData;
xmlDoc *doc;
std::string title, content;
std::vector<RssElement> rssElements;
int currentElement;
bool useProxy;
std::string httpproxy;
std::string separator;
void DoSleep(int duration);
bool switchToNextMessage;
void debugRSS(void);
};
class cRssStandaloneTicker {
public:
cRssStandaloneTicker(void);
~cRssStandaloneTicker();
void Start(void);
void SetFeed(std::string feedName);
void SwitchNextRssMessage(void);
void SwitchNextRssFeed(void);
private:
int osdLeft;
int osdTop;
int osdWidth;
int osdHeight;
cRssReader *rssReader;
cOsd *osd;
cPixmap *pixmapFeed;
cPixmap *pixmapBackground;
cPixmap *pixmapIcon;
cFont *font;
int labelWidth;
int currentFeed;
void SetNextFeed(void);
};
#endif //__NOPACITY_RSSREADER_H
|