source: SMSSender/gateways/Schoolnet/business/deepthought/deepthoughthelper.h @ 318:6704a54871cf

separation-frontend-backend
Last change on this file since 318:6704a54871cf was 318:6704a54871cf, checked in by Sämy Zehnder <saemy.zehnder@…>, 8 years ago
  • Flattens gateways/Schoolnet/gui/ui/.
File size: 2.6 KB
Line 
1/*
2 Schoolnet gateway plugin - The smssender plugin for the Schoolnet sms platform.
3 Copyright (C) 2007-2014, gorrión. See http://smssender.gorrion.ch
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef SCHOOLNET_DEEPTHOUGHTHELPER_H_
19#define SCHOOLNET_DEEPTHOUGHTHELPER_H_
20
21#include <QObject>
22#include <QScopedPointer>
23#include <QThread>
24
25#include "common/business/iintegration.h"
26#include "common/network/snetworkhelper.h"
27#include "gateways/Schoolnet/business/account.h"
28#include "gateways/Schoolnet/business/deepthought/datatypes.h"
29#include "gateways/Schoolnet/business/deepthought/daemons.h"
30
31class SNetworkHelper;
32
33namespace Schoolnet {
34namespace DeepThought {
35
36class AnswerToSchoolnetTask;
37class DeepThoughtDaemon;
38class SchoolnetDaemon;
39class QuestionManager;
40
41class DeepThoughtHelper : public QObject {
42    Q_OBJECT
43
44    friend class AnswerToDeepThoughtTask; // httpHelper()
45    friend class FetchDataFromDeepThoughtTask; // httpHelper()
46
47public:
48    /**
49     * @param httpHelper (takes ownership)
50     * @param deepThoughtDaemon (takes ownership)
51     * @param questionManager (takes ownership)
52     */
53    DeepThoughtHelper(const IAccountIntegrationHelper *accountHelper,
54                      DeepThoughtDaemon *deepThoughtDaemon,
55                      SNetworkHelper *httpHelper,
56                      QuestionManager *questionManager);
57    virtual ~DeepThoughtHelper();
58
59public:
60    STask *proposeAnswer(const Account *account, Answer *answer);
61
62    QuestionManager &questionManager() const;
63
64private slots:
65    void onAccountAdded(IAccount *account);
66    void onAccountModified(IAccount *account, int property);
67    void onAccountRemoved(IAccount *account);
68
69private:
70    Q_DISABLE_COPY(DeepThoughtHelper)
71
72private:
73    QScopedPointer<DeepThoughtDaemon> m_deepThoughtDaemon;
74    QScopedPointer<SNetworkHelper> m_httpHelper;
75    QScopedPointer<QuestionManager> m_questionManager;
76
77    QMap<const Account*, SchoolnetDaemon*> m_schoolnetDaemons;
78};
79
80} // namespace DeepThought
81} // namespace Schoolnet
82
83#endif /* SCHOOLNET_DEEPTHOUGHTHELPER_H_ */
Note: See TracBrowser for help on using the repository browser.