possible fix #75

I've added 'optimize' option (by default true). If it options is set
then sources will be checked if they are required (with dependencies if
any). And if they are not required they will be dropped by using common
mechanism.

Please note that if this option enabled the following features (at the
    moment) will be unavailable:

* key request from context menu (from configuration interface it still works)
* notifications event if sources on which notification is not connected

I suppose this commit will increase performance in about 4-5 times.
This commit is contained in:
2016-02-05 11:08:09 +03:00
parent 54e1545bb1
commit d856fa8e97
23 changed files with 522 additions and 374 deletions

View File

@ -67,7 +67,6 @@ public:
// get methods
QString formater(const QVariant &data, const QString &key) const;
QStringList keysFromSource(const QString &source) const;
QStringList requiredByKeysFromSource(const QString &source) const;
// set methods
void setAcOffline(const QString inactive);
void setAcOnline(const QString active);
@ -78,7 +77,8 @@ public:
void setTranslate(const bool translate);
public slots:
QStringList registerSource(const QString &source, const QString &units);
QStringList registerSource(const QString &source, const QString &units,
const QStringList &keys = QStringList());
private:
float temperature(const float temp) const;
@ -91,7 +91,6 @@ private:
QHash<QString, QStringList> m_devices;
QHash<QString, FormaterType> m_formater;
QHash<QString, QString> m_map;
QHash<QString, QString> m_requiredByMap;
QString m_tempUnits;
bool m_translate = false;
};