#ifndef DC_HUB_H #define DC_HUB_H #include "hub_info.h" #include class QProcess; #include using namespace std; class dc_hub : public QObject { Q_OBJECT public: dc_hub(); virtual ~dc_hub(); //! Loads a hublist from an url. /** This function starts the hublist program and exists. The result is ready when the signal got_list is emitted. \param url Gives an hublist url. Can be null. Can be several urls separated by something. */ void load_list_from_web(const QString &url); void load_list_from_disk(); void abortLoad(); void load_running_hubs(); vector& get_hubs() { return hubs; } vector& get_running_hubs() { return running; } const hub_info get_public_hub(int i) { return *hubs[i]; } const hub_info get_public_hub(const QString &ip); const hub_info get_running_hub(int i) { return *running[i]; } const hub_info get_running_hub(const QString &ip); static int getNumClients(); private: void load_list_from_process(const QString& process,const QString& arg,const QString& env); void clear_list(vector &l); vector hubs; vector running; QProcess *proc; bool loadAborted; public slots: void readFromStdout(); signals: void got_list(); }; #endif