on 7acf415 help sign in
unity8/plugins/Unity/Indicators/indicatorsmanager.h
73 lines 2.0 kB history raw
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
19#ifndef INDICATORS_MANAGER_H
20#define INDICATORS_MANAGER_H
22#include <QObject>
23#include <QFileSystemWatcher>
24#include <QDir>
25#include <QHash>
26#include <QSharedPointer>
28#include "indicator.h"
30class IndicatorsManager : public QObject
32 Q_OBJECT
33 Q_PROPERTY(bool loaded READ isLoaded NOTIFY loadedChanged)
34public:
35 explicit IndicatorsManager(QObject* parent = 0);
36 ~IndicatorsManager();
38 Q_INVOKABLE void load();
39 Q_INVOKABLE void unload();
41 Indicator::Ptr indicator(const QString& indicator_name);
43 QList<Indicator::Ptr> indicators();
45 bool isLoaded() const;
47Q_SIGNALS:
48 void loadedChanged(bool);
50 void indicatorLoaded(const QString& indicator_name);
51 void indicatorAboutToBeUnloaded(const QString& indicator_name);
53private Q_SLOTS:
54 void onDirectoryChanged(const QString& directory);
55 void onFileChanged(const QString& file);
57private:
58 void loadDir(const QDir& dir);
59 void loadFile(const QFileInfo& file);
60 void unloadFile(const QFileInfo& dir);
62 void startVerify(const QString& path);
63 void endVerify(const QString& path);
65 void setLoaded(bool);
67 class IndicatorData;
68 QHash<QString, IndicatorData*> m_indicatorsData;
69 QSharedPointer<QFileSystemWatcher> m_fsWatcher;
70 bool m_loaded;
71};
73#endif // INDICATORS_MANAGER_H