Planeshift
pslaunch.h
Go to the documentation of this file.
1 /*
2 * pslaunch.h - Author: Mike Gist
3 *
4 * Copyright (C) 2007 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5 *
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation (version 2 of the License)
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 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 */
19 
20 #ifndef __PSLAUNCH_H__
21 #define __PSLAUNCH_H__
22 
23 #include <csutil/threading/thread.h>
24 
25 #include "updaterconfig.h"
26 #include "updaterengine.h"
27 
28 #include "util/genericevent.h"
29 
30 class pawsMessageTextBox;
31 
32 #define APPNAME "PlaneShift Launcher"
33 
34 #define LAUNCHER_CONFIG_FILENAME "/this/pslaunch.cfg"
35 
36 class pawsLauncherWindowFactory;
37 class pawsMainWidget;
38 class PawsManager;
39 struct iSoundManager;
40 struct iObjectRegistry;
41 
43 {
44 private:
45 
46  iObjectRegistry* object_reg;
47  csRef<iVFS> vfs;
48  csRef<iConfigManager> configManager;
49  csRef<iGraphics3D> g3d;
50  csRef<iGraphics2D> g2d;
51  csRef<iEventQueue> queue;
52  csRef<iSoundManager> soundManager;
53  DeclareGenericEventHandler(EventHandler, psLauncherGUI, "planeshift.launcher");
54  csRef<EventHandler> event_handler;
55 
56  // PAWS
57  PawsManager* paws;
58  pawsMainWidget* mainWidget;
59  pawsLauncherWindowFactory* launcherWidget;
60 
61  /* Info shared with other threads. */
62  InfoShare *infoShare;
63 
64  /* Set to true to launch the client. */
65  bool *execPSClient;
66 
67  /* keeps track of whether the window is visible or not. */
68  bool drawScreen;
69 
70  /* Limits the frame rate either by sleeping. */
71  void FrameLimit();
72 
73  /* Time when the last frame was drawn. */
74  csTicks elapsed;
75 
76  /* Load the app */
77  bool InitApp();
78 
79  /* Handles an event from the event handler */
80  bool HandleEvent (iEvent &ev);
81 
82  /* Downloads server news */
83  Downloader* downloader;
84 
85  /* File utilities */
86  FileUtil* fileUtil;
87 
88  /* True if we've already been told there's an update available. */
89  bool updateTold;
90 
91 public:
92  /* Quit the application */
93  void Quit();
94 
95  void ExecClient(bool value) { *execPSClient = value; }
96 
97  psLauncherGUI(iObjectRegistry* _object_reg, InfoShare *_infoShare, bool *_execPSClient);
98 
99  Downloader* GetDownloader() { return downloader; }
100 
101  iVFS* GetVFS() { return vfs; }
102 
103  FileUtil* GetFileUtil() { return fileUtil; }
104 
105  void PerformUpdate(bool update, bool integrity);
106 
107  void PerformRepair();
108 
109  void CancelUpdater() { infoShare->SetCancelUpdater(true); }
110 
111  bool UpdateChecked() { return infoShare->GetUpdateChecked(); }
112 
113  csString GetCurrentClientVersion() { return infoShare->GetCurrentClientVersion(); }
114 
115  // Run.
116  void Run();
117 };
118 
119 #endif // __PSLAUNCH_H__
void PerformRepair()
void PerformUpdate(bool update, bool integrity)
csString GetCurrentClientVersion()
Main PlaneShift Window manager.
Definition: pawsmanager.h:82
psLauncherGUI(iObjectRegistry *_object_reg, InfoShare *_infoShare, bool *_execPSClient)
void SetCancelUpdater(bool v)
iVFS * GetVFS()
Definition: pslaunch.h:101
FileUtil * GetFileUtil()
Definition: pslaunch.h:103
Downloader * GetDownloader()
Definition: pslaunch.h:99
void ExecClient(bool value)
Definition: pslaunch.h:95
The main or desktop widget.
This is a special type of text box that is used for messages.
Definition: pawstextbox.h:285
bool GetUpdateChecked()
csString GetCurrentClientVersion()
Definition: pslaunch.h:113
bool UpdateChecked()
Definition: pslaunch.h:111
void CancelUpdater()
Definition: pslaunch.h:109