00001 #ifndef _SOURCEMANAGER_H_ 00002 #define _SOURCEMANAGER_H_ 00003 00004 // QT headers 00005 #include <QDir> 00006 #include <QObject> 00007 #include <QMultiMap> 00008 #include <QStringList> 00009 00010 // MythWeather headers 00011 #include "weatherUtils.h" 00012 #include "weatherSource.h" 00013 00014 class WeatherScreen; 00015 struct ScriptInfo; 00016 typedef QMultiMap<long, const WeatherSource*> SourceMap; 00017 00018 class SourceManager : public QObject 00019 { 00020 Q_OBJECT 00021 00022 public: 00023 SourceManager(); 00024 ~SourceManager(); 00025 WeatherSource *needSourceFor(int id, const QString &loc, units_t units); 00026 QStringList getLocationList(ScriptInfo *si, const QString &str); 00027 void startTimers(); 00028 void stopTimers(); 00029 void doUpdate(bool forceUpdate = false); 00030 bool findPossibleSources(QStringList types, QList<ScriptInfo *> &sources); 00031 void clearSources(); 00032 bool findScripts(); 00033 bool findScriptsDB(); 00034 void setupSources(); 00035 bool connectScreen(uint id, WeatherScreen *screen); 00036 bool disconnectScreen(WeatherScreen *screen); 00037 ScriptInfo *getSourceByName(const QString &name); 00038 00039 private slots: 00040 void timeout(void) {} 00041 00042 private: 00043 QList<ScriptInfo *> m_scripts; //all scripts 00044 QList<WeatherSource *> m_sources; //in-use scripts 00045 SourceMap m_sourcemap; 00046 units_t m_units; 00047 void recurseDirs(QDir dir); 00048 }; 00049 00050 #endif
1.6.3