[go: up one dir, main page]

Menu

[r4]: / trunk / gui / mainapp.h  Maximize  Restore  History

Download this file

125 lines (97 with data), 4.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#ifndef MAINAPP_H_INCLUDED
#define MAINAPP_H_INCLUDED
// This file is part of c'mon, a lightweight telephony monitor.
//
// Copyright (C) 2012 Peter Schaefer-Hutter ("THE AUTHOR")
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
// ----------------------------------------------------------------------------
// NOTE: This License does NOT permit incorporating this file (or parts or
// changed versions of it) into proprietary programs that are
// distributed to third-parties in binary form only.
// ----------------------------------------------------------------------------
// You can contact the original author by email at peter.schaefer@gmx.de
// if you need different license-terms or other modifications to c'mon.
// $Revision: 47 $ $Date: 2012-11-18 22:38:42 +0100 (Sun, 18 Nov 2012) $
#include "plugin/callmonitor.h"
#include "journal/journalmodel.h"
#include "pluginloader.h"
class CNotificationMgr;
class CMainFrame;
class CDBBackend;
class CGlobalPreferences;
class CResolverModel;
class CJournalModel;
class CJournalEntry;
class CGeneralPrefs;
class CPluginLoader;
class CAddressbookApi;
class CContact;
// ----------------------------------------------------------------------------
class CMainApp : public wxApp, public ICallObserver
{
public:
CMainApp();
virtual bool OnInit();
virtual int OnExit();
void OnIdle(wxIdleEvent&);
CMainFrame *getFrameWindow() { return m_pFrame; }
DECLARE_EVENT_TABLE()
public:
// Overrides from ICallObserver
virtual void newCall(unsigned pid, unsigned cid, TCallType type, TCallStatus status);
virtual void callStatus(unsigned pid, unsigned cid, TCallStatus status);
virtual void callInfo(unsigned pid, unsigned cid, const TCallInfo& info);
// Callback from Resolver
void resolverResponse(unsigned cid, unsigned data, const CContact& contact);
const TJournalMap& getActiveCalls() const { return m_ActiveCalls; }
CJournalModel& getJournalModel();
CResolverModel& getResolverModel();
CGeneralPrefs& getPrefs();
CGlobalPreferences& getGlobalPrefs();
CPluginLoader& getPluginLoader();
wxLocale& getLocale();
CCallMonitorApi *getDefaultCallProvider();
CAddressbookApi *getAddressbook(const CGUID& gid);
const TAddressbookMap& getAddressbooks() const;
CAddressbookApi *getCurrentAddressbook();
void setCurrentAddressbook(const CGUID& gid);
bool reverseLookup(const wxString& strNumber, CContact& resolvedContact);
void displayNotification(CJournalEntry& e);
void closeNotification(CJournalEntry& e);
virtual void CleanUp();
protected:
void OnNewCall(wxThreadEvent& event);
void OnCallStateUpdate(wxThreadEvent& event);
void OnCallInfoUpdate(wxThreadEvent& event);
void OnResolverResponse(wxThreadEvent& event);
void ResolveCalled(const std::string& toResolve, CJournalEntry *pJ);
void ResolveCaller(const std::string& toResolve, CJournalEntry *pJ);
CJournalEntry *findActiveEntry(long long dbKey);
bool findJournalEntry(long long dbKey, CJournalEntry& e);
protected:
wxLocale m_Locale;
TJournalMap m_ActiveCalls;
CNotificationMgr *m_pNotificationMgr;
CMainFrame *m_pFrame;
CDBBackend *m_pDB;
CResolverModel *m_pResolverModel;
CJournalModel *m_pJournalModel;
CPluginLoader *m_pPluginLoader;
CGlobalPreferences *m_pPrefs;
CAddressbookApi *m_pCurrentAddressbook;
wxSingleInstanceChecker *m_pSingleInstance;
};
DECLARE_APP(CMainApp)
#endif // MAINAPP_H_INCLUDED