summaryrefslogtreecommitdiffstats
path: root/tsapp.h
diff options
context:
space:
mode:
Diffstat (limited to 'tsapp.h')
-rw-r--r--tsapp.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/tsapp.h b/tsapp.h
new file mode 100644
index 0000000..57de48c
--- /dev/null
+++ b/tsapp.h
@@ -0,0 +1,77 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14 *
15 * Authors: Manuel Mausz (manuel@mausz.at)
16 * Christian Raschko (c.raschko@netcore.at)
17 */
18
19#ifndef TSAPP_H
20#define TSAPP_H
21
22//libraries
23#include "tsclient.h"
24#include "tsquerythread.h"
25
26#include <wx/wx.h>
27#include <wx/ffile.h>
28#include <wx/fileconf.h>
29
30
31//config file name
32#define CONFIG_FILE_NAME _T("tsclient.cfg")
33//! Timeout for reconnect sec
34#define RECONNECT_TIMEOUT 10
35
36//Main application class
37class TSApp : public wxAppConsole
38{
39 public:
40 //main() replacment
41 virtual int OnRun();
42 //app cleanup
43 virtual int OnExit();
44 //app init
45 virtual bool OnInit();
46 //Command line parser
47 virtual void OnInitCmdLine(wxCmdLineParser &parser);
48 virtual bool OnCmdLineParsed(wxCmdLineParser &parser);
49 virtual bool OnCmdLineHelp(wxCmdLineParser &parser);
50 virtual bool OnCmdLineError(wxCmdLineParser &parser);
51 //interactive mode
52 bool Interactive();
53 //load config
54 bool LoadConfig(wxString const &filename);
55
56 private:
57 wxString ReadString(wxString const &str);
58
59 wxLogStderr *m_pLog;
60 wxFFile *m_pLogFile;
61 wxString m_pLogFileStr;
62 TSClient *m_pClient;
63 TSQueryThread*m_pQuery;
64 wxFileConfig *m_pConfig;
65 bool m_Interactive;
66 bool m_Logtostderr;
67 #if defined __UNIX__
68 bool m_Foreground;
69 #endif
70 wxString m_ConfigFileName;
71};
72
73//create a forward declaration of the wxGetApp
74//function implemented by IMPLEMENT_APP
75DECLARE_APP(TSApp)
76
77#endif