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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#ifndef NEWSBOAT_CONTROLLER_H_
#define NEWSBOAT_CONTROLLER_H_
#include <libxml/tree.h>
#include "cache.h"
#include "colormanager.h"
#include "configcontainer.h"
#include "configparser.h"
#include "feedcontainer.h"
#include "filtercontainer.h"
#include "fslock.h"
#include "queuemanager.h"
#include "regexmanager.h"
#include "reloader.h"
#include "remoteapi.h"
#include "rssignores.h"
#include "urlreader.h"
namespace newsboat {
class CliArgsParser;
class ConfigPaths;
class View;
class Controller {
public:
Controller(ConfigPaths& configpaths);
~Controller();
void set_view(View* vv);
View* get_view()
{
return v;
}
int run(const CliArgsParser& args);
std::vector<std::shared_ptr<RssItem>> search_for_items(
const std::string& query,
std::shared_ptr<RssFeed> feed);
void update_feedlist();
void update_visible_feeds();
void mark_all_read(unsigned int pos);
void mark_article_read(const std::string& guid, bool read);
void mark_all_read(const std::string& feedurl);
void mark_all_read(std::shared_ptr<RssFeed> feed)
{
rsscache->mark_all_read(feed);
}
void mark_all_read(const std::vector<std::string>& item_guids);
bool get_refresh_on_start() const
{
return refresh_on_start;
}
EnqueueResult enqueue_url(std::shared_ptr<RssItem> item,
std::shared_ptr<RssFeed> feed);
void reload_urls_file();
void edit_urls_file();
FeedContainer* get_feedcontainer()
{
return &feedcontainer;
}
void write_item(std::shared_ptr<RssItem> item,
const std::string& filename);
void write_item(std::shared_ptr<RssItem> item, std::ostream& ostr);
std::string write_temporary_item(std::shared_ptr<RssItem> item);
void update_config();
void load_configfile(const std::string& filename);
void dump_config(const std::string& filename) const;
void update_flags(std::shared_ptr<RssItem> item);
Reloader* get_reloader()
{
return reloader.get();
}
void replace_feed(std::shared_ptr<RssFeed> oldfeed,
std::shared_ptr<RssFeed> newfeed,
unsigned int pos,
bool unattended);
ConfigContainer* get_config()
{
return &cfg;
}
RssIgnores* get_ignores()
{
return &ign;
}
RemoteApi* get_api()
{
return api;
}
RegexManager& get_regexmanager()
{
return rxman;
}
FilterContainer& get_filtercontainer()
{
return filters;
}
const ColorManager& get_colormanager()
{
return colorman;
}
private:
int import_opml(const std::string& opmlFile, const std::string& urlFile);
void export_opml(bool version2);
void rec_find_rss_outlines(xmlNode* node, std::string tag);
int execute_commands(const std::vector<std::string>& cmds);
void import_read_information(const std::string& readinfofile);
void export_read_information(const std::string& readinfofile);
View* v;
UrlReader* urlcfg;
Cache* rsscache;
bool refresh_on_start;
ConfigContainer cfg;
RssIgnores ign;
FeedContainer feedcontainer;
FilterContainer filters;
ConfigParser cfgparser;
ColorManager colorman;
RegexManager rxman;
RemoteApi* api;
FsLock fslock;
ConfigPaths& configpaths;
std::unique_ptr<Reloader> reloader;
QueueManager queueManager;
};
} // namespace newsboat
#endif /* NEWSBOAT_CONTROLLER_H_ */
|