| 1 | /* |
|---|
| 2 | * QuteCom, a voice over Internet phone |
|---|
| 3 | * Copyright (C) 2010 Mbdsys |
|---|
| 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 2 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, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #ifndef OWCOIPMODULE_H |
|---|
| 21 | #define OWCOIPMODULE_H |
|---|
| 22 | |
|---|
| 23 | #include <coipmanager/coipmanagerdll.h> |
|---|
| 24 | |
|---|
| 25 | #include <util/Identifiable.h> |
|---|
| 26 | #include <util/Interface.h> |
|---|
| 27 | |
|---|
| 28 | #include <QtCore/QObject> |
|---|
| 29 | |
|---|
| 30 | class CoIpManager; |
|---|
| 31 | |
|---|
| 32 | /** |
|---|
| 33 | * Base class for all CoIp module. |
|---|
| 34 | * |
|---|
| 35 | * @author Philippe Bernery |
|---|
| 36 | */ |
|---|
| 37 | class COIPMANAGER_API CoIpModule : public QObject, public Identifiable { |
|---|
| 38 | Q_OBJECT |
|---|
| 39 | public: |
|---|
| 40 | |
|---|
| 41 | CoIpModule(CoIpManager & coIpManager); |
|---|
| 42 | |
|---|
| 43 | CoIpModule(const CoIpModule & coIpModule); |
|---|
| 44 | |
|---|
| 45 | virtual ~CoIpModule(); |
|---|
| 46 | |
|---|
| 47 | /** |
|---|
| 48 | * Checks if the Module/Session has been already started or not. |
|---|
| 49 | * |
|---|
| 50 | * @return true if Module/Session already started; false otherwise |
|---|
| 51 | */ |
|---|
| 52 | bool isStarted() const; |
|---|
| 53 | void setStarted(bool started); |
|---|
| 54 | |
|---|
| 55 | Q_SIGNALS: |
|---|
| 56 | |
|---|
| 57 | /** |
|---|
| 58 | * Sent when the module is finished. |
|---|
| 59 | */ |
|---|
| 60 | void moduleFinishedSignal(); |
|---|
| 61 | |
|---|
| 62 | public Q_SLOTS: |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | * Starts the Module. |
|---|
| 66 | */ |
|---|
| 67 | virtual void start() = 0; |
|---|
| 68 | |
|---|
| 69 | /** |
|---|
| 70 | * Pauses the Module. |
|---|
| 71 | * |
|---|
| 72 | * No effect if paused or stopped. |
|---|
| 73 | */ |
|---|
| 74 | virtual void pause() = 0; |
|---|
| 75 | |
|---|
| 76 | /** |
|---|
| 77 | * Resumes the Module. |
|---|
| 78 | * |
|---|
| 79 | * No effect if not paused. |
|---|
| 80 | */ |
|---|
| 81 | virtual void resume() = 0; |
|---|
| 82 | |
|---|
| 83 | /** |
|---|
| 84 | * Stops the Module. |
|---|
| 85 | */ |
|---|
| 86 | virtual void stop() = 0; |
|---|
| 87 | |
|---|
| 88 | protected: |
|---|
| 89 | |
|---|
| 90 | /** |
|---|
| 91 | * True if the Module/Session has been already started; false otherwise. |
|---|
| 92 | * |
|---|
| 93 | * Code factorization, to use in subclasses. |
|---|
| 94 | * |
|---|
| 95 | * @see CoIpModule::isStarted() |
|---|
| 96 | * @see CoIpModule::start() |
|---|
| 97 | * @see CoIpModule::stop() |
|---|
| 98 | */ |
|---|
| 99 | bool _started; |
|---|
| 100 | |
|---|
| 101 | /** Link to CoIpManager. */ |
|---|
| 102 | CoIpManager & _coIpManager; |
|---|
| 103 | }; |
|---|
| 104 | |
|---|
| 105 | #endif //OWCOIPMODULE_H |
|---|