1 /* 2 * Hedgewars, a free turn based strategy game 3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef PAGE_OPTIONS_H 20 #define PAGE_OPTIONS_H 21 22 #include "igbox.h" 23 #include "AbstractPage.h" 24 25 #include <QString> 26 27 class GameUIConfig; 28 class FPSEdit; 29 class QSignalMapper; 30 class KeyBinder; 31 class QGridLayout; 32 33 // Let's stay D-R-Y 34 class OptionGroupBox : public IconedGroupBox 35 { 36 Q_OBJECT 37 38 public: 39 OptionGroupBox(const QString & iconName, 40 const QString & title, 41 QWidget * parent = 0); 42 QGridLayout * layout(); 43 void addDivider(); 44 45 private: 46 QGridLayout * m_layout; 47 }; 48 49 class PageOptions : public AbstractPage 50 { 51 Q_OBJECT 52 53 public: 54 enum ProxyTypes { 55 NoProxy = 0, 56 SystemProxy = 1, 57 Socks5Proxy = 2, 58 HTTPProxy = 3 59 }; 60 61 PageOptions(QWidget* parent = 0); 62 63 QCheckBox *WeaponTooltip; 64 QPushButton *WeaponNew; 65 QPushButton *WeaponEdit; 66 QPushButton *WeaponDelete; 67 QComboBox *WeaponsName; 68 QPushButton *SchemeNew; 69 QPushButton *SchemeEdit; 70 QPushButton *SchemeDelete; 71 QComboBox *SchemesName; 72 73 QComboBox *CBLanguage; 74 75 IconedGroupBox *teamsBox; 76 QPushButton *BtnAssociateFiles; 77 QComboBox *CBTeamName; 78 IconedGroupBox *AGGroupBox; 79 QComboBox *CBResolution; 80 QSpinBox *windowWidthEdit; 81 QSpinBox *windowHeightEdit; 82 QLabel *winLabelX; 83 QComboBox *CBStereoMode; 84 QCheckBox *CBFrontendSound; 85 QCheckBox *CBFrontendMusic; 86 QCheckBox *CBSound; 87 QCheckBox *CBMusic; 88 QCheckBox *CBDampenAudio; 89 QCheckBox *CBFullscreen; 90 QCheckBox *CBFrontendFullscreen; 91 QCheckBox *CBShowFPS; 92 QCheckBox *CBSavePassword; 93 QCheckBox *CBAltDamage; 94 QCheckBox *CBNameWithDate; 95 96 97 QCheckBox *CBTeamTag; 98 QCheckBox *CBHogTag; 99 QCheckBox *CBHealthTag; 100 QCheckBox *CBTagOpacity; 101 102 #ifdef __APPLE__ 103 QCheckBox *CBAutoUpdate; 104 QPushButton *BtnUpdateNow; 105 #endif 106 107 FPSEdit *fpsedit; 108 QLabel *labelNN; 109 QSlider *SLVolume; 110 QLabel *lblVolumeLevel; 111 QLineEdit *editNetNick; 112 QLineEdit *editNetPassword; 113 QSlider *SLQuality; 114 QSpinBox *SLZoom; 115 QCheckBox *CBFrontendEffects; 116 QComboBox * cbProxyType; 117 QSpinBox * sbProxyPort; 118 QLineEdit * leProxy; 119 QLineEdit * leProxyLogin; 120 QLineEdit * leProxyPassword; 121 122 QComboBox *framerateBox; 123 QSpinBox *bitrateBox; 124 QLineEdit *widthEdit; 125 QLineEdit *heightEdit; 126 QCheckBox *checkUseGameRes; 127 QCheckBox *checkRecordAudio; 128 format()129 QString format() 130 { return comboAVFormats->itemData(comboAVFormats->currentIndex()).toString(); } 131 videoCodec()132 QString videoCodec() 133 { return comboVideoCodecs->itemData(comboVideoCodecs->currentIndex()).toString(); } 134 audioCodec()135 QString audioCodec() 136 { return comboAudioCodecs->itemData(comboAudioCodecs->currentIndex()).toString(); } 137 138 void setDefaultCodecs(); 139 bool tryCodecs(const QString & format, const QString & vcodec, const QString & acodec); 140 void setConfig(GameUIConfig * config); 141 142 void setTeamOptionsEnabled(bool enabled); 143 144 signals: 145 void newTeamRequested(); 146 void editTeamRequested(const QString & teamName); 147 void deleteTeamRequested(const QString & teamName); 148 149 150 private: 151 QLayout * bodyLayoutDefinition(); 152 QLayout * footerLayoutDefinition(); 153 void connectSignals(); 154 int resetBindToDefault(int bindID); 155 void setupTabPage(QWidget * tabpage, QVBoxLayout ** leftColumn, QVBoxLayout ** rightColumn); 156 157 bool previousFullscreenValue; 158 int previousResolutionIndex; 159 int previousQuality; 160 QLabel *LblNoEditTeam; 161 QPushButton *BtnNewTeam; 162 QPushButton *BtnEditTeam; 163 QPushButton *BtnDeleteTeam; 164 QList<QPushButton *> m_colorButtons; 165 166 QComboBox *comboAVFormats; 167 QComboBox *comboVideoCodecs; 168 QComboBox *comboAudioCodecs; 169 QPushButton *btnDefaults; 170 QPushButton *btnUpdateNow; 171 GameUIConfig * config; 172 KeyBinder * binder; 173 int currentTab; 174 int binderTab; 175 176 QLabel * lblFullScreenRes; 177 QLabel * lblWinScreenRes; 178 QLabel * lblTags; 179 QWidget * winResContainer; 180 QWidget * tagsContainer; 181 182 private slots: 183 void forceFullscreen(int index); 184 void setFullscreen(int state); 185 void setResolution(int state); 186 void setQuality(int value); 187 void trimNetNick(); 188 void requestEditSelectedTeam(); 189 void requestDeleteSelectedTeam(); 190 void savePwdChanged(int state); 191 void colorButtonClicked(int i); 192 void onColorModelDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight); 193 void onProxyTypeChanged(); 194 void changeAVFormat(int index); 195 void changeUseGameRes(int state); 196 void changeRecordAudio(int state); 197 void checkForUpdates(); 198 void tabIndexChanged(int); 199 void bindUpdated(int bindID); 200 void resetAllBinds(); 201 void setVolume(int); 202 203 public slots: 204 void setDefaultOptions(); 205 }; 206 207 #endif 208 209