96 static std::vector<Item>
parseRSS(
const std::string& xml);
99 long onFetched(FXObject*, FXSelector,
void*);
102 long onCmdShow(FXObject*, FXSelector,
void*);
Periodically fetches an RSS feed with news about upcoming releases.
FXButton * myButton
the button in the status bar (null while there is nothing new)
FXStatusBar * myStatusBar
the status bar holding the news button
time_t getLastAccess() const
time of the last successful access (0 if never)
static const std::string DEFAULT_URL
default feed location
std::atomic< bool > myAbort
tells the worker thread to give up
std::mutex myMutex
protects myDocument and myOK
time_t myPreviousAccess
the last access time before this download started
void fetch()
the download, executed in myThread
bool myShowAfterFetch
whether the dialog should open as soon as the running download finishes
GUINewsFeed & operator=(const GUINewsFeed &)=delete
invalidated assignment operator
void showLatest()
shows the latest items, downloading them first if necessary
static std::vector< Item > parseRSS(const std::string &xml)
extracts the items of an RSS document
std::string myURL
the feed address
long onCmdShow(FXObject *, FXSelector, void *)
called when the news button was clicked, shows the latest items
std::string myDocument
the downloaded document
FXEX::MFXThreadEvent myThreadEvent
wakes the GUI thread
FXApp * myApp
the application (registry access)
FXWindow * myOwner
parent of the news dialog
~GUINewsFeed()
destructor, aborts a running download
GUINewsFeed(const GUINewsFeed &)=delete
invalidated copy constructor
static const time_t MIN_INTERVAL
minimum time between two accesses (seconds)
std::vector< Item > myItems
the latest items (empty until a download succeeded)
bool myOK
whether the download succeeded
bool startCheck(const bool force=false)
starts a download if enabled, curl is available and the last access is long enough ago
std::thread myThread
the worker thread
long onFetched(FXObject *, FXSelector, void *)
called in the GUI thread when the download has finished
a single entry of the feed
time_t published
publication time (seconds since epoch), 0 if unknown