QTfrontend/hwform.h
changeset 6616 f77bb02b669f
parent 6574 ec059b55aa72
child 6700 e04da46ee43c
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
    53 extern bool frontendEffects;
    53 extern bool frontendEffects;
    54 extern QString playerHash;
    54 extern QString playerHash;
    55 
    55 
    56 class HWForm : public QMainWindow
    56 class HWForm : public QMainWindow
    57 {
    57 {
    58     Q_OBJECT
    58         Q_OBJECT
    59 
    59 
    60 public:
    60     public:
    61     HWForm(QWidget *parent = 0, QString styleSheet = "");
    61         HWForm(QWidget *parent = 0, QString styleSheet = "");
    62     Ui_HWForm ui;
    62         Ui_HWForm ui;
    63     static GameUIConfig * config;
    63         static GameUIConfig * config;
    64     static QSettings * gameSettings; // Same file GameUIConfig points to but without the baggage.  Needs sync() calls if you want to get GameUIConfig changes though
    64         static QSettings * gameSettings; // Same file GameUIConfig points to but without the baggage.  Needs sync() calls if you want to get GameUIConfig changes though
    65     void updateXfire();
    65         void updateXfire();
    66     void PlayDemoQuick(const QString & demofilename);
    66         void PlayDemoQuick(const QString & demofilename);
    67     void exit();
    67         void exit();
    68     void setButtonDescription(QString desc);
    68         void setButtonDescription(QString desc);
    69     void backDescription();
    69         void backDescription();
    70 
    70 
    71 private slots:
    71     private slots:
    72     void GoToSaves();
    72         void GoToSaves();
    73     void GoToDemos();
    73         void GoToDemos();
    74     void GoToNet();
    74         void GoToNet();
    75     void GoToSelectWeapon();
    75         void GoToSelectWeapon();
    76     void GoToSelectWeaponSet(int index);
    76         void GoToSelectWeaponSet(int index);
    77     void GoToSelectNewWeapon();
    77         void GoToSelectNewWeapon();
    78     void GoToScheme(int index);
    78         void GoToScheme(int index);
    79     void GoToEditScheme();
    79         void GoToEditScheme();
    80     void GoToNewScheme();
    80         void GoToNewScheme();
    81     void GoToPage(int id);
    81         void GoToPage(int id);
    82     void GoBack();
    82         void GoBack();
    83     void OpenSnapshotFolder();
    83         void OpenSnapshotFolder();
    84     QString getDemoArguments();
    84         QString getDemoArguments();
    85     void AssociateFiles();
    85         void AssociateFiles();
    86     void btnExitPressed();
    86         void btnExitPressed();
    87     void IntermediateSetup();
    87         void IntermediateSetup();
    88     void NewTeam();
    88         void NewTeam();
    89     void EditTeam(const QString & teamName);
    89         void EditTeam(const QString & teamName);
    90     void AfterTeamEdit();
    90         void AfterTeamEdit();
    91     void DeleteTeam(const QString & teamName);
    91         void DeleteTeam(const QString & teamName);
    92     void DeleteScheme();
    92         void DeleteScheme();
    93     void DeleteWeaponSet();
    93         void DeleteWeaponSet();
    94     void SimpleGame();
    94         void SimpleGame();
    95     void PlayDemo();
    95         void PlayDemo();
    96     void startTraining(const QString&);
    96         void startTraining(const QString&);
    97     void StartCampaign();
    97         void StartCampaign();
    98     void NetConnect();
    98         void NetConnect();
    99     void NetConnectServer(const QString & host, quint16 port);
    99         void NetConnectServer(const QString & host, quint16 port);
   100     void NetConnectOfficialServer();
   100         void NetConnectOfficialServer();
   101     void NetStartServer();
   101         void NetStartServer();
   102     void NetDisconnect();
   102         void NetDisconnect();
   103     void NetConnected();
   103         void NetConnected();
   104     void NetError(const QString & errmsg);
   104         void NetError(const QString & errmsg);
   105     void NetWarning(const QString & wrnmsg);
   105         void NetWarning(const QString & wrnmsg);
   106     void NetGameEnter();
   106         void NetGameEnter();
   107     void NetPassword(const QString & nick);
   107         void NetPassword(const QString & nick);
   108     void NetNickTaken(const QString & nick);
   108         void NetNickTaken(const QString & nick);
   109     void NetAuthFailed();
   109         void NetAuthFailed();
   110     void NetTeamAccepted(const QString& team);
   110         void NetTeamAccepted(const QString& team);
   111     void AddNetTeam(const HWTeam& team);
   111         void AddNetTeam(const HWTeam& team);
   112     void RemoveNetTeam(const HWTeam& team);
   112         void RemoveNetTeam(const HWTeam& team);
   113     void StartMPGame();
   113         void StartMPGame();
   114     void GameStateChanged(GameState gameState);
   114         void GameStateChanged(GameState gameState);
   115     void ForcedDisconnect(const QString & reason);
   115         void ForcedDisconnect(const QString & reason);
   116     void ShowErrorMessage(const QString &);
   116         void ShowErrorMessage(const QString &);
   117     void GetRecord(bool isDemo, const QByteArray & record);
   117         void GetRecord(bool isDemo, const QByteArray & record);
   118     void CreateNetGame();
   118         void CreateNetGame();
   119     void UpdateWeapons();
   119         void UpdateWeapons();
   120     void onFrontendFullscreen(bool value);
   120         void onFrontendFullscreen(bool value);
   121     void onFrontendEffects(bool value);
   121         void onFrontendEffects(bool value);
   122     void Music(bool checked);
   122         void Music(bool checked);
   123     void UpdateCampaignPage(int index);
   123         void UpdateCampaignPage(int index);
   124     //Starts the transmission process for the feedback
   124         //Starts the transmission process for the feedback
   125     void SendFeedback();
   125         void SendFeedback();
   126     //Make a xml representation of the issue to be created
   126         //Make a xml representation of the issue to be created
   127     bool CreateIssueXml();
   127         bool CreateIssueXml();
   128     //Called the first time when receiving authorization token from google,
   128         //Called the first time when receiving authorization token from google,
   129     //second time when receiving the response after posting the issue
   129         //second time when receiving the response after posting the issue
   130     void finishedSlot(QNetworkReply* reply);
   130         void finishedSlot(QNetworkReply* reply);
   131     //Filter the auth token from the reply from google
   131         //Filter the auth token from the reply from google
   132     bool getAuthToken(QString str);
   132         bool getAuthToken(QString str);
   133 
   133 
   134     void NetGameChangeStatus(bool isMaster);
   134         void NetGameChangeStatus(bool isMaster);
   135     void NetGameMaster();
   135         void NetGameMaster();
   136     void NetGameSlave();
   136         void NetGameSlave();
   137 
   137 
   138     void AsyncNetServerStart();
   138         void AsyncNetServerStart();
   139     void NetLeftRoom(const QString & reason);
   139         void NetLeftRoom(const QString & reason);
   140     void selectFirstNetScheme();
   140         void selectFirstNetScheme();
   141     
   141 
   142     void saveDemoWithCustomName();
   142         void saveDemoWithCustomName();
   143 
   143 
   144 private:
   144     private:
   145     void _NetConnect(const QString & hostName, quint16 port, QString nick);
   145         void _NetConnect(const QString & hostName, quint16 port, QString nick);
   146     void UpdateTeamsLists(const QStringList* editable_teams=0);
   146         void UpdateTeamsLists(const QStringList* editable_teams=0);
   147     void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo);
   147         void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo);
   148     void closeEvent(QCloseEvent *event);
   148         void closeEvent(QCloseEvent *event);
   149     void CustomizePalettes();
   149         void CustomizePalettes();
   150     void resizeEvent(QResizeEvent * event);
   150         void resizeEvent(QResizeEvent * event);
   151     //void keyReleaseEvent(QKeyEvent *event);
   151         //void keyReleaseEvent(QKeyEvent *event);
   152     
   152 
   153     enum PageIDs {
   153         enum PageIDs
   154         ID_PAGE_SETUP_TEAM      =  0,
   154         {
   155         ID_PAGE_SETUP           =  1,
   155             ID_PAGE_SETUP_TEAM      =  0,
   156         ID_PAGE_MULTIPLAYER     =  2,
   156             ID_PAGE_SETUP           =  1,
   157         ID_PAGE_DEMOS           =  3,
   157             ID_PAGE_MULTIPLAYER     =  2,
   158         ID_PAGE_NET             =  4,
   158             ID_PAGE_DEMOS           =  3,
   159         ID_PAGE_NETGAME         =  5,
   159             ID_PAGE_NET             =  4,
   160         ID_PAGE_INFO            =  6,
   160             ID_PAGE_NETGAME         =  5,
   161         ID_PAGE_MAIN            =  7,
   161             ID_PAGE_INFO            =  6,
   162         ID_PAGE_GAMESTATS       =  8,
   162             ID_PAGE_MAIN            =  7,
   163         ID_PAGE_SINGLEPLAYER    =  9,
   163             ID_PAGE_GAMESTATS       =  8,
   164         ID_PAGE_TRAINING        = 10,
   164             ID_PAGE_SINGLEPLAYER    =  9,
   165         ID_PAGE_SELECTWEAPON    = 11,
   165             ID_PAGE_TRAINING        = 10,
   166         ID_PAGE_NETSERVER       = 12,
   166             ID_PAGE_SELECTWEAPON    = 11,
   167         ID_PAGE_INGAME          = 13,
   167             ID_PAGE_NETSERVER       = 12,
   168         ID_PAGE_ROOMSLIST       = 14,
   168             ID_PAGE_INGAME          = 13,
   169         ID_PAGE_CONNECTING      = 15,
   169             ID_PAGE_ROOMSLIST       = 14,
   170         ID_PAGE_SCHEME          = 16,
   170             ID_PAGE_CONNECTING      = 15,
   171         ID_PAGE_ADMIN           = 17,
   171             ID_PAGE_SCHEME          = 16,
   172         ID_PAGE_NETTYPE         = 18,
   172             ID_PAGE_ADMIN           = 17,
   173         ID_PAGE_CAMPAIGN        = 19,
   173             ID_PAGE_NETTYPE         = 18,
   174         ID_PAGE_DRAWMAP         = 20,
   174             ID_PAGE_CAMPAIGN        = 19,
   175         ID_PAGE_DATADOWNLOAD    = 21,
   175             ID_PAGE_DRAWMAP         = 20,
   176         ID_PAGE_FEEDBACK        = 22
   176             ID_PAGE_DATADOWNLOAD    = 21,
       
   177             ID_PAGE_FEEDBACK        = 22
   177         };
   178         };
   178     QPointer<HWGame> game;
   179         QPointer<HWGame> game;
   179     QPointer<HWNetServer> pnetserver;
   180         QPointer<HWNetServer> pnetserver;
   180     QPointer<HWNetRegisterServer> pRegisterServer;
   181         QPointer<HWNetRegisterServer> pRegisterServer;
   181     QPointer<HWTeam> editedTeam;
   182         QPointer<HWTeam> editedTeam;
   182     QPointer<HWNewNet> hwnet;
   183         QPointer<HWNewNet> hwnet;
   183     HWNamegen * namegen;
   184         HWNamegen * namegen;
   184     AmmoSchemeModel * ammoSchemeModel;
   185         AmmoSchemeModel * ammoSchemeModel;
   185     QStack<int> PagesStack;
   186         QStack<int> PagesStack;
   186     QTime eggTimer;
   187         QTime eggTimer;
   187     BGWidget * wBackground;
   188         BGWidget * wBackground;
   188     QSignalMapper * pageSwitchMapper;
   189         QSignalMapper * pageSwitchMapper;
   189     QByteArray m_lastDemo;
   190         QByteArray m_lastDemo;
   190     QNetworkAccessManager * nam;
   191         QNetworkAccessManager * nam;
   191     QString issueXml;
   192         QString issueXml;
   192     QString authToken;
   193         QString authToken;
   193 
   194 
   194     QPropertyAnimation *animationNewSlide;
   195         QPropertyAnimation *animationNewSlide;
   195     QPropertyAnimation *animationOldSlide;
   196         QPropertyAnimation *animationOldSlide;
   196     QPropertyAnimation *animationNewOpacity;
   197         QPropertyAnimation *animationNewOpacity;
   197     QPropertyAnimation *animationOldOpacity;
   198         QPropertyAnimation *animationOldOpacity;
   198 
   199 
   199 #ifdef __APPLE__
   200 #ifdef __APPLE__
   200     InstallController * panel;
   201         InstallController * panel;
   201 #endif
   202 #endif
   202 
   203 
   203     void OnPageShown(quint8 id, quint8 lastid=0);
   204         void OnPageShown(quint8 id, quint8 lastid=0);
   204 };
   205 };
   205 
   206 
   206 #endif
   207 #endif