Planeshift

pawslauncherwindow.h

Go to the documentation of this file.
00001 /*
00002 * pawslauncherwindow.h - Author: Mike Gist
00003 *
00004 * Copyright (C) 2007 Atomic Blue ([email protected], http://www.atomicblue.org)
00005 *
00006 *
00007 * This program is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU General Public License
00009 * as published by the Free Software Foundation (version 2 of the License)
00010 * This program is distributed in the hope that it will be useful,
00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 * GNU General Public License for more details.
00014 * You should have received a copy of the GNU General Public License
00015 * along with this program; if not, write to the Free Software
00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 *
00018 */
00019 
00020 #ifndef __PAWS_LAUNCHER_WINDOW_H__
00021 #define __PAWS_LAUNCHER_WINDOW_H__
00022 
00023 #include "paws/pawswidget.h"
00024 
00025 #include "pslaunch.h"
00026 
00027 class pawsComboBox;
00028 class pawsOkBox;
00029 class pawsYesNoBox;
00030 
00031 class pawsLauncherWindow : public pawsWidget
00032 {
00033 public:
00034     pawsLauncherWindow();
00035     bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget );
00036     bool PostSetup();
00037     void EnablePlay();
00038 
00039 private:
00040     pawsWidget* launcherMain;
00041     pawsWidget* launcherUpdater;
00042     pawsWidget* launcherSettings;
00043     pawsComboBox* resolution;
00044     pawsYesNoBox* updateAvailable;
00045     pawsOkBox* notify;
00046     csRef<iConfigFile> configFile;
00047     csRef<iConfigFile> configUser;
00048     csRef<CS::Threading::Thread> newsUpdater;
00049     csString mountedPath;
00050     csString currentSkin;
00051 
00052     static void HandleUpdateButton(bool choice, void *thisptr);
00053     static void HandleCacheButton(bool choice, void* thisptr);
00054     void HandleAspectRatio(csString ratio);
00055     void UpdateNews();
00056     void LoadSettings();
00057     void SaveSettings();
00058     bool DeleteShaderCache();
00059     void LoadSkin(const char* name);
00060     bool LoadResource(const char* resource,const char* resname, const char* mountPath);
00061     void OnListAction(pawsListBox* widget, int status);
00062 
00063     class NewsUpdater : public CS::Threading::Runnable
00064     {
00065     public:
00066         NewsUpdater(pawsLauncherWindow* plw)
00067         {
00068             lw = plw;
00069         }
00070 
00071         void Run()
00072         {
00073             lw->UpdateNews();
00074         }
00075     private:
00076         pawsLauncherWindow* lw;
00077     };
00078 
00079     enum WidgetID
00080     {
00081         LAUNCHER = 1,
00082         LAUNCHER_MAIN = 11,
00083         LAUNCHER_UPDATER,
00084         LAUNCHER_SETTINGS,
00085         UPDATE_AVAILABLE,
00086         SERVER_NEWS = 111,
00087         QUIT_BUTTON,
00088         REPAIR_BUTTON,
00089         SETTINGS_BUTTON,
00090         PLAY_BUTTON,
00091         UPDATER_OUTPUT = 121,
00092         UPDATER_YES_BUTTON,
00093         UPDATER_NO_BUTTON,
00094         UPDATER_OK_BUTTON,
00095         UPDATER_CANCEL_BUTTON,
00096         SETTINGS_OK_BUTTON = 131,
00097         SETTINGS_CANCEL_BUTTON,
00098         SETTINGS_AUDIO_BUTTON,
00099         SETTINGS_CONTROLS_BUTTON,
00100         SETTINGS_GENERAL_BUTTON,
00101         SETTINGS_GRAPHICS_BUTTON,
00102         ASPECT_RATIO = 1394,
00103         SKINS = 1399,
00104         DELETE_CACHE = 1402,
00105         UPDATE_MESSAGE_BOX = 141,
00106         UPDATE_YES_BUTTON,
00107         UPDATE_NO_BUTTON,
00108         NOTIFY_MESSAGE_BOX = 151,
00109         NOTIFY_OK_BUTTON
00110     };
00111 
00112     enum GraphicsPresets
00113     {
00114         HIGHEST = 0,
00115         HIGH,
00116         MEDIUM,
00117         LOW,
00118         LOWEST,
00119         CUSTOM
00120     };
00121 
00122     pawsButton* FindButton(WidgetID id);
00123 };
00124 
00125 CREATE_PAWS_FACTORY( pawsLauncherWindow );
00126 
00127 #endif // __PAWS_LAUNCHER_WINDOW_H__