/mainwindow.h

http://cutefootball.googlecode.com/ · C Header · 171 lines · 123 code · 25 blank · 23 comment · 0 complexity · 7b056a67110bb654cc99146e90a0465e MD5 · raw file

  1. /*
  2. * Copyright 2010,2011 Timothy Rochford
  3. *
  4. * This file is part of CuteFootball.
  5. *
  6. * CuteFootball is free software: you can redistribute it and/or modify
  7. * it under the terms of the Lesser GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * CuteFootball is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * Lesser GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the Lesser GNU General Public License
  17. * along with CuteFootball. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. #ifndef MAINWINDOW_H
  21. #define MAINWINDOW_H
  22. #include <QtGui>
  23. #include <qmap.h>
  24. class TeamSelectionFrame;
  25. class aboutFrame;
  26. class Pitch;
  27. class SoundEffects;
  28. class settingsFrame;
  29. class helpFrame;
  30. class inputSettingsFrame;
  31. class mainMenuFrame;
  32. class HalfStatisticsFrame;
  33. class InGameMenuFrame;
  34. namespace Ui {
  35. class MainWindow;
  36. }
  37. class MWindow : public QMainWindow
  38. {
  39. Q_OBJECT
  40. public:
  41. enum ScreenOrientation {
  42. ScreenOrientationLockPortrait,
  43. ScreenOrientationLockLandscape,
  44. ScreenOrientationAuto
  45. };
  46. MWindow(QWidget *parent = 0);
  47. virtual ~MWindow();
  48. void setOrientation(ScreenOrientation orientation);
  49. Pitch* pitch() { return m_pitch; }
  50. enum Action {
  51. East = 0,
  52. SouthEast = -45,
  53. South = -90,
  54. SouthWest = -135,
  55. West = -180,
  56. NorthWest = -225,
  57. North = -270,
  58. NorthEast = -315,
  59. Button,
  60. ButtonShortPress,
  61. ButtonLongPress,
  62. Shot,
  63. Pass,
  64. Tackle,
  65. TackleN,
  66. TackleNE,
  67. TackleE,
  68. TackleSE,
  69. TackleS,
  70. TackleSW,
  71. TackleW,
  72. TackleNW,
  73. // Due to loosing a tackle
  74. FallenOver,
  75. // TODO YellowCard,
  76. // TODO RedCard,
  77. // goal keeper moves
  78. DiveEast = 1,
  79. DiveWest = -179,
  80. Pause,
  81. NoAction
  82. };
  83. enum Frame {
  84. MainMenu,
  85. Settings,
  86. Help,
  87. InputSettings,
  88. TeamSelection,
  89. HalfTimeStatistics,
  90. GraphicsView,
  91. InGameMenu,
  92. About
  93. };
  94. private:
  95. void createConnections();
  96. void removeContextMenus();
  97. signals:
  98. void setFrame(MWindow::Frame f);
  99. public slots:
  100. void showFrame(MWindow::Frame f);
  101. void newGame();
  102. inline void setComputerTeam(int index) { m_awayTeamIndex = index; }
  103. inline int computerTeam() const { return m_awayTeamIndex; }
  104. inline void setPlayerTeam(int index){ m_homeTeamIndex = index; }
  105. inline int playerTeam() const { return m_homeTeamIndex; }
  106. void hideInputSettingsFrame(){ emit setFrame(MWindow::MainMenu);}
  107. void hideHelpFrame(){emit setFrame(MWindow::MainMenu);}
  108. void hideSettingsFrame(){ emit setFrame(MWindow::MainMenu);}
  109. void showSettingsFrame(){ emit setFrame(MWindow::Settings);}
  110. void showMainMenuFrame(){ emit setFrame(MWindow::MainMenu);}
  111. void hideTeamSelectionFrame(){ emit setFrame(MWindow::MainMenu);}
  112. void showSingleGameTeamSelection();
  113. void showInputSettingsFrame() { emit setFrame(MWindow::InputSettings);}
  114. void showHelpFrame(){emit setFrame(MWindow::Help);}
  115. void showStatisticsFrame(){emit setFrame(MWindow::HalfTimeStatistics);}
  116. void hideStatisticsFrame();
  117. void showAboutFrame(){emit setFrame(MWindow::About);}
  118. void hideAboutFrame() { emit setFrame(MWindow::MainMenu);}
  119. void showInGameMenu() { emit setFrame(MWindow::InGameMenu); }
  120. void hideInGameMenu();
  121. void displayHalfTimeStatistics(bool display);
  122. void showGraphicsViewFrame() { emit setFrame(MWindow::GraphicsView); }
  123. void showComputerTeamSelection();
  124. void showCupTeamSelection();
  125. protected:
  126. void resizeEvent(QResizeEvent *e);
  127. private slots:
  128. void enableActions(bool gameInProgress);
  129. private:
  130. int m_homeTeamIndex;
  131. int m_awayTeamIndex;
  132. Pitch *m_pitch;
  133. settingsFrame* m_settingsFrame;
  134. inputSettingsFrame* m_inputSettingsFrame;
  135. HalfStatisticsFrame* m_halfStatisticsFrame;
  136. helpFrame* m_helpFrame;
  137. TeamSelectionFrame* m_teamSelectionFrame;
  138. InGameMenuFrame* m_inGameMenuFrame;
  139. mainMenuFrame* m_mainMenuFrame;
  140. SoundEffects* m_soundEffects;
  141. aboutFrame* m_aboutFrame;
  142. bool m_gameInProgress;
  143. public:
  144. Ui::MainWindow* uiMainWindow;
  145. };
  146. #endif // MAINWINDOW_H