# HG changeset patch
# User Xeli
# Date 1319819618 -7200
# Node ID 3106add9a5bfffcefc4c716ae8fbc28050276d98
# Parent 42b256eca3627a2fc5e21edccc29f38fe577eabb# Parent 3f8ba061775ebabdc797e12999ae86e74b403633
merge
diff -r 3f8ba061775e -r 3106add9a5bf .hgignore
--- a/.hgignore Fri Oct 28 18:27:55 2011 +0200
+++ b/.hgignore Fri Oct 28 18:33:38 2011 +0200
@@ -8,7 +8,7 @@
glob:*.hi
glob:*.*~
glob:*.core
-glob:hedgewars/config.inc
+glob:config.inc
glob:cmake_install.cmake
glob:QTfrontend/hwconsts.cpp
glob:CPackConfig.cmake
diff -r 3f8ba061775e -r 3106add9a5bf .hgtags
--- a/.hgtags Fri Oct 28 18:27:55 2011 +0200
+++ b/.hgtags Fri Oct 28 18:33:38 2011 +0200
@@ -45,3 +45,4 @@
718f98a9df122d73f3ba9add4d1654865199de31 Hedgewars-iOS-1.3
cba92708277b6d0aeabfff2b878845b7d848bdcd Hedgewars-iOS-1.3.1
74bc72746bec68806344f4ba7be0d1bc6e05d380 0.9.16-release
+652a199d4f38f5becbec0839f5a1f63294dd89bf Hedgewars-iOS-1.3.2
diff -r 3f8ba061775e -r 3106add9a5bf CMakeLists.txt
--- a/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200
+++ b/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200
@@ -132,17 +132,17 @@
endif(APPLE)
-#this snippet sets "Release" mode by default
+#build Debug only when explicitally set
if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: None Debug Release." FORCE)
+ set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: Debug Release." FORCE)
endif (NOT CMAKE_BUILD_TYPE)
-if(CMAKE_BUILD_TYPE MATCHES RELEASE OR CMAKE_BUILD_TYPE MATCHES "Release")
+if(CMAKE_BUILD_TYPE MATCHES DEBUG OR CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "debug")
+ message(STATUS "Building Debug")
+ set(Optz false)
+else()
message(STATUS "Building Release")
set(Optz true)
-else()
- message(STATUS "Building Debug")
- set(Optz false)
endif()
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/AbstractPage.h
--- a/QTfrontend/AbstractPage.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef ABSTRACTPAGE_H
-#define ABSTRACTPAGE_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-class QPushButton;
-class QGroupBox;
-class QComboBox;
-class QLabel;
-class QToolBox;
-class QLineEdit;
-class QListWidget;
-class QCheckBox;
-class QSpinBox;
-class QTextEdit;
-class QRadioButton;
-class QTableView;
-class QTextBrowser;
-class QTableWidget;
-class QAction;
-class QDataWidgetMapper;
-class QAbstractItemModel;
-class QSettings;
-class QSlider;
-
-class AbstractPage : public QWidget
-{
- Q_OBJECT
-
- signals:
- void goBack();
-
- protected:
- AbstractPage(QWidget* parent = 0) {
- Q_UNUSED(parent);
-
- font14 = new QFont("MS Shell Dlg", 14);
- //setFocusPolicy(Qt::StrongFocus);
- }
- virtual ~AbstractPage() {};
-
- QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) {
- QPushButton* butt = new QPushButton(this);
- if (!iconed) {
- butt->setFont(*font14);
- butt->setText(btname);
- //butt->setStyleSheet("background-color: #0d0544");
- } else {
- const QIcon& lp=QIcon(btname);
- QSize sz = lp.actualSize(QSize(65535, 65535));
- butt->setIcon(lp);
- butt->setFixedSize(sz);
- butt->setIconSize(sz);
- butt->setFlat(true);
- butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- }
- grid->addWidget(butt, wy, wx);
- return butt;
- };
-
- QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) {
- QPushButton* butt = new QPushButton(this);
- if (!iconed) {
- butt->setFont(*font14);
- butt->setText(btname);
- } else {
- const QIcon& lp=QIcon(btname);
- QSize sz = lp.actualSize(QSize(65535, 65535));
- butt->setIcon(lp);
- butt->setFixedSize(sz);
- butt->setIconSize(sz);
- butt->setFlat(true);
- butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- }
- grid->addWidget(butt, wy, wx, rowSpan, columnSpan);
- return butt;
- };
-
- QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) {
- QPushButton* butt = new QPushButton(this);
- if (!iconed) {
- butt->setFont(*font14);
- butt->setText(btname);
- } else {
- const QIcon& lp=QIcon(btname);
- QSize sz = lp.actualSize(QSize(65535, 65535));
- butt->setIcon(lp);
- butt->setFixedSize(sz);
- butt->setIconSize(sz);
- butt->setFlat(true);
- butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- }
- box->addWidget(butt, where);
- return butt;
- };
-
- QFont * font14;
-};
-
-#endif
-
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/CMakeLists.txt
--- a/QTfrontend/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200
@@ -14,7 +14,7 @@
include(${QT_USE_FILE})
# Check if we need zlib
-check_library_exists(${QT_QTCORE_LIBRARY} inflateInit2_ ${QT_LIBRARY_DIR} QT_PROVIDES_ZLIB_FUNCTIONS)
+check_library_exists("${QT_QTCORE_LIBRARY}" inflateInit2_ ${QT_LIBRARY_DIR} QT_PROVIDES_ZLIB_FUNCTIONS)
if(NOT QT_PROVIDES_ZLIB_FUNCTIONS)
find_package(ZLIB REQUIRED)
@@ -28,6 +28,13 @@
find_package(SDL_mixer REQUIRED)
include_directories(.)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/net)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/dialog)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/page)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/widget)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util)
include_directories(${SDL_INCLUDE_DIR})
include_directories(${SDLMIXER_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/misc/quazip)
@@ -57,76 +64,27 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hwconsts.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp)
+file(GLOB NetCpp net/*.cpp)
+file(GLOB ModelCpp model/*.cpp)
+file(GLOB_RECURSE UIcpp ui/*.cpp)
+file(GLOB UtilCpp util/*.cpp)
+
set(hwfr_src
- HWApplication.cpp
+ ${ModelCpp}
+ ${NetCpp}
+ ${UIcpp}
+ ${UtilCpp}
+ achievements.cpp
+ binds.cpp
+ drawmapscene.cpp
game.cpp
+ gameuiconfig.cpp
+ HWApplication.cpp
+ hwform.cpp
main.cpp
- hwform.cpp
team.cpp
- namegen.cpp
- teamselect.cpp
- teamselhelper.cpp
- frameTeam.cpp
- vertScrollArea.cpp
- gameuiconfig.cpp
ui_hwform.cpp
- gamecfgwidget.cpp
- pagemain.cpp
- pageeditteam.cpp
- pagemultiplayer.cpp
- pageoptions.cpp
- pagenet.cpp
- pagenetserver.cpp
- pagenetgame.cpp
- pageinfo.cpp
- pagedata.cpp
- pagesingleplayer.cpp
- pagetraining.cpp
- pagecampaign.cpp
- pageselectweapon.cpp
- pageingame.cpp
- pageroomslist.cpp
- pageconnecting.cpp
- pagescheme.cpp
- pagegamestats.cpp
- pageplayrecord.cpp
- pageadmin.cpp
- pagenettype.cpp
- pagedrawmap.cpp
- SquareLabel.cpp
- hats.cpp
- hedgehogerWidget.cpp
- hwmap.cpp
- mapContainer.cpp
- tcpBase.cpp
- about.cpp
- proto.cpp
- fpsedit.cpp
- netserver.cpp
- newnetclient.cpp
- netudpserver.cpp
- netudpwidget.cpp
- netregister.cpp
- netserverslist.cpp
- chatwidget.cpp
- binds.cpp
- SDLs.cpp
${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp
- selectWeapon.cpp
- itemNum.cpp
- input_ip.cpp
- igbox.cpp
- weaponItem.cpp
- misc.cpp
- ammoSchemeModel.cpp
- togglebutton.cpp
- bgwidget.cpp
- achievements.cpp
- qaspectratiolayout.cpp
- drawmapwidget.cpp
- drawmapscene.cpp
- themesmodel.cpp
- databrowser.cpp
)
#xfire integration
@@ -145,77 +103,33 @@
set(hwfr_src ${hwfr_src} hedgewars.rc)
endif(MINGW)
+file(GLOB ModelHdr model/*.h)
+file(GLOB NetHdr net/*.h)
+file(GLOB_RECURSE UIhdr ui/*.h)
+file(GLOB UtilHdr util/*.h)
+
+
set(hwfr_moc_hdrs
- HWApplication.h
+ ${ModelHdr}
+ ${NetHdr}
+ ${UIhdr}
+ drawmapscene.h
game.h
- hats.h
- hwform.h
- teamselect.h
- teamselhelper.h
- frameTeam.h
- vertScrollArea.h
gameuiconfig.h
- gamecfgwidget.h
- AbstractPage.h
- pagenet.h
- pagemultiplayer.h
- pagenetserver.h
- pageingame.h
- pagetraining.h
- pageeditteam.h
- pageoptions.h
- pagemain.h
- pageinfo.h
- pagedata.h
- pagesingleplayer.h
- pagenettype.h
- pageconnecting.h
- pagedrawmap.h
- pagecampaign.h
- pagenetgame.h
- pageroomslist.h
- pagegamestats.h
- pageadmin.h
- pagescheme.h
- pageselectweapon.h
- pageplayrecord.h
- SquareLabel.h
- hedgehogerWidget.h
- hwmap.h
- mapContainer.h
- tcpBase.h
- about.h
- proto.h
- fpsedit.h
- netserver.h
- newnetclient.h
- netudpserver.h
- netudpwidget.h
- netregister.h
- netserverslist.h
- chatwidget.h
- SDLs.h
- selectWeapon.h
- itemNum.h
- input_ip.h
- igbox.h
- weaponItem.h
- misc.h
- ammoSchemeModel.h
- togglebutton.h
- bgwidget.h
- qaspectratiolayout.h
- drawmapwidget.h
- drawmapscene.h
- themesmodel.h
- databrowser.h
+ HWApplication.h
+ hwform.h
+ team.h
)
set(hwfr_hdrs
+ ${UtilHdr}
+ team.h
+ achievements.h
binds.h
ui_hwform.h
KB.h
hwconsts.h
+ sdlkeys.h
)
set(hwfr_rez hedgewars.qrc)
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/Doxyfile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/Doxyfile Fri Oct 28 18:33:38 2011 +0200
@@ -0,0 +1,1679 @@
+# Doxyfile 1.7.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Hedgewars Qt-Frontend"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = $(PROJECT_NUMBER)
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description for a project that appears at the top of each page and should give viewer a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = "The default frontend of hedgewars."
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO = res/teamicon2.png
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = $(OUTPUT_DIRECTORY)
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES = "repo{1}=http://code.google.com/p/hedgewars/source/browse/QTfrontend/\1"
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even if there is only one candidate or it is obvious which candidate to choose by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command , where is the value of
+# the FILE_VERSION_FILTER tag, and is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = NO
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command , where
+# is the value of the INPUT_FILTER tag, and is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.hedgewars
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+#
+# Qt Help Project / Custom Filters.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+#
+# Qt Help Project / Filter Attributes.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [0,1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+# Note that a value of 0 will completely suppress the enum values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH = http://www.mathjax.org/mathjax
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS = 0
+
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, svg, gif or svg.
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/HWApplication.h
--- a/QTfrontend/HWApplication.h Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/HWApplication.h Fri Oct 28 18:33:38 2011 +0200
@@ -25,6 +25,14 @@
class HWForm;
+/**
+ * @brief Main class of the Qt application.
+ *
+ * By default uses :res/css/qt.css as style sheet for the main form.
+ * See \repo{res/css/qt.css} for a more detailed description.
+ *
+ * @see http://doc.qt.nokia.com/4.5/stylesheet.html
+ */
class HWApplication : public QApplication
{
Q_OBJECT
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SDLs.cpp
--- a/QTfrontend/SDLs.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "SDLs.h"
-
-#include "SDL.h"
-#include "SDL_mixer.h"
-#include "hwconsts.h"
-#include "HWApplication.h"
-
-
-extern char sdlkeys[1024][2][128];
-extern char xb360buttons[][128];
-extern char xb360dpad[128];
-extern char xbox360axes[][128];
-
-
-SDLInteraction::SDLInteraction()
-{
-
- SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
-
- musicInitialized = 0;
- music = NULL;
- if(SDL_NumJoysticks())
- addGameControllerKeys();
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
-}
-
-SDLInteraction::~SDLInteraction()
-{
- if (musicInitialized == 1) {
- if (music != NULL)
- Mix_FreeMusic(music);
- Mix_CloseAudio();
- }
- SDL_Quit();
-}
-
-QStringList SDLInteraction::getResolutions() const
-{
- QStringList result;
-
- SDL_Rect **modes;
-
- modes = SDL_ListModes(NULL, SDL_FULLSCREEN);
-
- if((modes == (SDL_Rect **)0) || (modes == (SDL_Rect **)-1))
- {
- result << "640x480";
- } else
- {
- for(int i = 0; modes[i]; ++i)
- if ((modes[i]->w >= 640) && (modes[i]->h >= 480))
- result << QString("%1x%2").arg(modes[i]->w).arg(modes[i]->h);
- }
-
- return result;
-}
-
-void SDLInteraction::addGameControllerKeys() const
-{
- QStringList result;
-
- int i = 0;
- while(i < 1024 && sdlkeys[i][1][0] != '\0')
- i++;
-
- // Iterate through all game controllers
- for(int jid = 0; jid < SDL_NumJoysticks(); jid++)
- {
- SDL_Joystick* joy = SDL_JoystickOpen(jid);
-
- // Retrieve the game controller's name and strip "Controller (...)" that's added by some drivers (English only)
- QString joyname = QString(SDL_JoystickName(jid)).replace(QRegExp("^Controller \\((.*)\\)$"), "\\1");
-
- // Connected Xbox 360 controller? Use specific button names then
- // Might be interesting to add 'named' buttons for the most often used gamepads
- bool isxb = joyname.contains("Xbox 360");
-
- // This part of the string won't change for multiple keys/hats, so keep it
- QString prefix = QString("%1 (%2): ").arg(joyname).arg(jid + 1);
-
- // Register entries for missing axes not assigned to sticks of this joystick/gamepad
- for(int aid = 0; aid < SDL_JoystickNumAxes(joy) && i < 1021; aid++)
- {
- // Again store the part of the string not changing for multiple uses
- QString axis = prefix + HWApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1);
-
- // Entry for "Axis Up"
- sprintf(sdlkeys[i][0], "j%da%du", jid, aid);
- sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData());
-
- // Entry for "Axis Down"
- sprintf(sdlkeys[i][0], "j%da%dd", jid, aid);
- sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData());
- }
-
- // Register entries for all coolie hats of this joystick/gamepad
- for(int hid = 0; hid < SDL_JoystickNumHats(joy) && i < 1019; hid++)
- {
- // Again store the part of the string not changing for multiple uses
- QString hat = prefix + (isxb ? (HWApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : HWApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1));
-
- // Entry for "Hat Up"
- sprintf(sdlkeys[i][0], "j%dh%du", jid, hid);
- sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData());
-
- // Entry for "Hat Down"
- sprintf(sdlkeys[i][0], "j%dh%dd", jid, hid);
- sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData());
-
- // Entry for "Hat Left"
- sprintf(sdlkeys[i][0], "j%dh%dl", jid, hid);
- sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Left)")).toUtf8().constData());
-
- // Entry for "Hat Right"
- sprintf(sdlkeys[i][0], "j%dh%dr", jid, hid);
- sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Right)")).toUtf8().constData());
- }
-
- // Register entries for all buttons of this joystick/gamepad
- for(int bid = 0; bid < SDL_JoystickNumButtons(joy) && i < 1022; bid++)
- {
- // Buttons
- sprintf(sdlkeys[i][0], "j%db%d", jid, bid);
- sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (HWApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : HWApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toUtf8().constData());
- }
- // Close the game controller as we no longer need it
- SDL_JoystickClose(joy);
- }
-
- // Terminate the list
- sdlkeys[i][0][0] = '\0';
- sdlkeys[i][1][0] = '\0';
-}
-
-void SDLInteraction::SDLMusicInit()
-{
- if (musicInitialized == 0) {
- SDL_Init(SDL_INIT_AUDIO);
- Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024);
- musicInitialized = 1;
- }
-}
-
-
-void SDLInteraction::StartMusic()
-{
- SDLMusicInit();
- QFile tmpfile;
-
- tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Music/main_theme.ogg");
- if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Music/main_theme.ogg");
- if (music == NULL) {
- music = Mix_LoadMUS(QFileInfo(tmpfile).absoluteFilePath().toLocal8Bit().constData());
-
- }
- Mix_VolumeMusic(MIX_MAX_VOLUME - 28);
- Mix_FadeInMusic(music, -1, 1750);
-}
-
-void SDLInteraction::StopMusic()
-{
- if (music != NULL) {
- // fade out music to finish 0,5 seconds from now
- while(!Mix_FadeOutMusic(1000) && Mix_PlayingMusic()) {
- SDL_Delay(100);
- }
- }
-}
-
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SDLs.h
--- a/QTfrontend/SDLs.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef SDLS_H
-#define SDLS_H
-
-
-#include
-#include "SDL_mixer.h"
-
-
-class SDLInteraction : public QObject
-{
- Q_OBJECT
-
-private:
- Mix_Music *music;
- int musicInitialized;
-
-public:
- SDLInteraction();
- ~SDLInteraction();
- QStringList getResolutions() const;
- void addGameControllerKeys() const;
- void StartMusic();
- void StopMusic();
- void SDLMusicInit();
-};
-
-
-#endif
-
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SquareLabel.cpp
--- a/QTfrontend/SquareLabel.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include "SquareLabel.h"
-#include "hwform.h"
-
-SquareLabel::SquareLabel(QWidget * parent) :
- QWidget(parent)
-{
- if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
-}
-
-void SquareLabel::paintEvent(QPaintEvent * event)
-{
- Q_UNUSED(event);
-
- QPainter painter(this);
- int pixsize;
- if (width() > height()) {
- pixsize = height();
- painter.translate((width() - pixsize) / 2, 0);
- } else {
- pixsize = width();
- painter.translate(0, (height() - pixsize) / 2);
- }
- painter.drawPixmap(0, 0, pixsize, pixsize, pixmap.scaled(pixsize, pixsize, Qt::KeepAspectRatio));
-}
-
-void SquareLabel::setPixmap(const QPixmap & pixmap)
-{
- this->pixmap = pixmap;
- repaint();
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SquareLabel.h
--- a/QTfrontend/SquareLabel.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _SQUARELABEL_H
-#define _SQUARELABEL_H
-
-#include
-#include
-
-class SquareLabel : public QWidget
-{
- Q_OBJECT
-
-public:
- SquareLabel(QWidget * parent = 0);
-
- void setPixmap(const QPixmap & pixmap);
-protected:
- virtual void paintEvent(QPaintEvent * event);
-
-private:
- QPixmap pixmap;
-
-};
-
-#endif // _SQUARELABEL_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/about.cpp
--- a/QTfrontend/about.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-#include "about.h"
-#include "hwconsts.h"
-
-About::About(QWidget * parent) :
- QWidget(parent)
-{
- QGridLayout *mainLayout = new QGridLayout(this);
-
- QLabel *imageLabel = new QLabel;
- QImage image(":/res/Hedgehog.png");
- imageLabel->setPixmap(QPixmap::fromImage(image));
- imageLabel->setScaledContents(true);
- imageLabel->setMinimumWidth(2.8);
- imageLabel->setMaximumWidth(280);
- imageLabel->setMinimumHeight(30);
- imageLabel->setMaximumHeight(300);
-
- mainLayout->addWidget(imageLabel, 0, 0, 2, 1);
-
- QLabel *lbl1 = new QLabel(this);
- lbl1->setOpenExternalLinks(true);
- lbl1->setText(
- ""
- "Hedgewars
"
- "
" + QLabel::tr("Version") + " " + *cVersionString + "
"
- "
http://www.hedgewars.org/
" +
- QLabel::tr("This program is distributed under the GNU General Public License") +
- "
"
- );
- lbl1->setWordWrap(true);
- mainLayout->addWidget(lbl1, 0, 1);
-
- QTextBrowser *lbl2 = new QTextBrowser(this);
-
- lbl2->setOpenExternalLinks(true);
- lbl2->setText(
- "" +
- QString("") +
- QLabel::tr("Developers:") +
- "
"
- "Engine, frontend, net server: Andrey Korotaev <unC0Rr@gmail.com>
"
- "Many frontend improvements: Igor Ulyanov <disinbox@gmail.com>
"
- "Many engine and frontend improvements: Derek Pomery <nemo@m8y.org>
"
- "Drill rocket, Ballgun, RC Plane weapons: Martin Boze <afffect@gmail.com>
"
- "Mine number and time game settings: David A. Cuadrado <krawek@gmail.com>
"
- "Frontend improvements: Martin Minarik <ttsmj@pokec.sk>
"
- "Frontend improvements: Kristian Lehmann <email@thexception.net>
"
- "Mac OS X/iPhone port, OpenGL-ES conversion: Vittorio Giovara <vittorio.giovara@gmail.com>
"
- "Many engine and frontend improvements (and bugs): Richard Karolyi <sheepluva@" "ercatec.net>
"
- "Gamepad and Lua integration: Mario Liebisch <mario.liebisch@gmail.com>
"
- "Many engine improvements and graphics: Carlos Vives <mail@carlosvives.es>
"
- "Maze maps: Henning Kühn <prg@cooco.de>
"
- "Engine and frontend improvements: Henrik Rostedt <henrik.rostedt@gmail.com>
"
- "Lua game modes and missions: John Lambert <redgrinner@gmail.com>
"
- "Frontend improvements: Mayur Pawashe <zorgiepoo@gmail.com>
"
- "Android port: Richard Deurwaarder <xeli@xelification.com>
"
- "
" +
-
- QLabel::tr("Art:") + "
"
- + QString::fromUtf8(
- "John Dum <fizzy@gmail.com>"
- "
"
- "Joshua Frese <joshfrese@gmail.com>"
- "
"
- "Stanko Tadić <stanko@mfhinc.net>"
- "
"
- "Julien Koesten <julienkoesten@aol.com>"
- "
"
- "Joshua O'Sullivan <coheedftw@hotmail.co.uk>"
- "
"
- "Nils Lück <nils.luck.design@gmail.com>"
- "
"
- "Guillaume Englert <genglert@hybird.org>"
- "
"
- "Hats: Trey Perry <tx.perry.j@gmail.com>"
- "
") +
- QLabel::tr("Sounds:") + "
"
- "Hedgehogs voice: Stephen Alexander <ArmagonNo1@gmail.com>"
- "
"
- "John Dum <fizzy@gmail.com>"
- "
"
- "Jonatan Nilsson <jonatanfan@gmail.com>"
- "
"
- "Daniel Martin <elhombresinremedio@gmail.com>"
- "
" +
-
- QLabel::tr("Translations:") + "
"
- + QString::fromUtf8(
- "Brazilian Portuguese: Romulo Fernandes Machado <abra185@gmail.com>
"
- "Bulgarian: Svetoslav Stefanov
"
- "Czech: Petr ŘezáÄek <rezacek@gmail.com>
"
- "Chinese: Jie Luo <lililjlj@gmail.com>
"
- "English: Andrey Korotaev <unC0Rr@gmail.com>
"
- "Finnish: Nina Kuisma <ninnnu@gmail.com>
"
- "French: Antoine Turmel <geekshadow@gmail.com>
"
- "German: Peter Hüwe <PeterHuewe@gmx.de>, Mario Liebisch <mario.liebisch@gmail.com>, Richard Karolyi <sheepluva@" "ercatec.net>
"
- "Greek: <talos_kriti@yahoo.gr>
"
- "Italian: Luca Bonora <bonora.luca@gmail.com>, Marco Bresciani
"
- "Japanese: ADAM Etienne <etienne.adam@gmail.com>
"
- "Korean: Anthony Bellew <webmaster@anthonybellew.com>
"
- "Lithuanian: Lukas Urbonas <lukasu08@gmail.com>
"
- "Polish: Maciej Mroziński <mynick2@o2.pl>, Wojciech Latkowski <magik17l@gmail.com>, Piotr Mitana, Maciej Górny
"
- "Portuguese: Fábio Canário <inufabie@gmail.com>
"
- "Russian: Andrey Korotaev <unC0Rr@gmail.com>
"
- "Slovak: Jose Riha
"
- "Spanish: Carlos Vives <mail@carlosvives.es>
"
- "Swedish: Niklas Grahn <raewolusjoon@yaoo.com>, Henrik Rostedt <henrik.rostedt@gmail.com>
"
- "Ukrainian: Eugene V. Lyubimkin <jackyf.devel@gmail.com>, Igor Paliychuk <mansonigor@gmail.com>, Eugene Sakara <eresid@gmail.com>"
- "
") +
-
- QLabel::tr("Special thanks:") + "
"
- "Aleksey Andreev <blaknayabr@gmail.com>
"
- "Aleksander Rudalev <alexv@pomorsu.ru>
"
- "Natasha Korotaeva <layout@pisem.net>
"
- "Adam Higerd (aka ahigerd at FreeNode)"
- "
"
- );
- mainLayout->addWidget(lbl2, 1, 1);
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/about.h
--- a/QTfrontend/about.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _ABOUT_H
-#define _ABOUT_H
-
-#include
-
-
-class About : public QWidget
-{
- Q_OBJECT
-
-public:
- About(QWidget * parent = 0);
-};
-
-#endif // _ABOUT_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ammoSchemeModel.cpp
--- a/QTfrontend/ammoSchemeModel.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,786 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2005-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-
-#include "ammoSchemeModel.h"
-#include "hwconsts.h"
-
-QList defaultScheme = QList()
- << QVariant("Default") // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(false) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(45) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(5) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(4) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(2) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
-AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
- QAbstractTableModel(parent),
- fileConfig(fileName, QSettings::IniFormat)
-{
- predefSchemesNames = QStringList()
- << "Default"
- << "Pro Mode"
- << "Shoppa"
- << "Clean Slate"
- << "Minefield"
- << "Barrel Mayhem"
- << "Tunnel Hogs"
- << "Fort Mode"
- << "Timeless"
- << "Thinking with Portals"
- << "King Mode"
- ;
-
- numberOfDefaultSchemes = predefSchemesNames.size();
-
- spNames = QStringList()
- << "name" // 0
- << "fortsmode" // 1
- << "divteams" // 2
- << "solidland" // 3
- << "border" // 4
- << "lowgrav" // 5
- << "laser" // 6
- << "invulnerability" // 7
- << "resethealth" // 8
- << "vampiric" // 9
- << "karma" // 10
- << "artillery" // 11
- << "randomorder" // 12
- << "king" // 13
- << "placehog" // 14
- << "sharedammo" // 15
- << "disablegirders" // 16
- << "disablelandobjects" // 17
- << "aisurvival" // 18
- << "infattack" // 19
- << "resetweps" // 20
- << "perhogammo" // 21
- << "disablewind" // 22
- << "morewind" // 23
- << "tagteam" // 24
- << "bottomborder" // 25
- << "damagefactor" // 26
- << "turntime" // 27
- << "health" // 28
- << "suddendeath" // 29
- << "caseprobability" // 30
- << "minestime" // 31
- << "minesnum" // 32
- << "minedudpct" // 33
- << "explosives" // 34
- << "healthprobability" // 35
- << "healthcaseamount" // 36
- << "waterrise" // 37
- << "healthdecrease" // 38
- << "ropepct" // 39
- << "getawaytime" // 40
- ;
-
- QList proMode;
- proMode
- << predefSchemesNames[1] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(true) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(15) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(0) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(0) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(2) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList shoppa;
- shoppa
- << predefSchemesNames[2] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(true) // solid land 3
- << QVariant(true) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(true) // shared ammo 15
- << QVariant(true) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(true) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(30) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(50) // sudden death 29
- << QVariant(1) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(0) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(0) // explosives 34
- << QVariant(0) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList cleanslate;
- cleanslate
- << predefSchemesNames[3] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(true) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(false) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(true) // inf. attack 19
- << QVariant(true) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(45) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(5) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(4) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(2) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList minefield;
- minefield
- << predefSchemesNames[4] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(true) // shared ammo 15
- << QVariant(true) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(30) // turn time 27
- << QVariant(50) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(0) // case prob 30
- << QVariant(0) // mines time 31
- << QVariant(80) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(0) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList barrelmayhem;
- barrelmayhem
- << predefSchemesNames[5] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(true) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(30) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(0) // case prob 30
- << QVariant(0) // mines time 31
- << QVariant(0) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(80) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList tunnelhogs;
- tunnelhogs
- << predefSchemesNames[6] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(true) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(true) // shared ammo 15
- << QVariant(true) // disable girders 16
- << QVariant(true) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(30) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(5) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(10) // mines number 32
- << QVariant(10) // mine dud pct 33
- << QVariant(10) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList forts;
- forts
- << predefSchemesNames[7] // name 0
- << QVariant(true) // fortsmode 1
- << QVariant(true) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(true) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(false) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(45) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(5) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(0) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(0) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList timeless;
- timeless
- << predefSchemesNames[8] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(false) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(true) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(9999) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(5) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(5) // mines number 32
- << QVariant(10) // mine dud pct 33
- << QVariant(2) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(30) // health case amt 36
- << QVariant(0) // water rise amt 37
- << QVariant(0) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList thinkingportals;
- thinkingportals
- << predefSchemesNames[9] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(true) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(false) // king 13
- << QVariant(false) // place hog 14
- << QVariant(false) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(45) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(2) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(5) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(5) // explosives 34
- << QVariant(25) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
- QList kingmode;
- kingmode
- << predefSchemesNames[10] // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(false) // low gravity 5
- << QVariant(false) // laser sight 6
- << QVariant(false) // invulnerable 7
- << QVariant(false) // reset health 8
- << QVariant(false) // vampiric 9
- << QVariant(false) // karma 10
- << QVariant(false) // artillery 11
- << QVariant(true) // random order 12
- << QVariant(true) // king 13
- << QVariant(false) // place hog 14
- << QVariant(false) // shared ammo 15
- << QVariant(false) // disable girders 16
- << QVariant(false) // disable land objects 17
- << QVariant(false) // AI survival 18
- << QVariant(false) // inf. attack 19
- << QVariant(false) // reset weps 20
- << QVariant(false) // per hog ammo 21
- << QVariant(false) // no wind 22
- << QVariant(false) // more wind 23
- << QVariant(false) // tag team 24
- << QVariant(false) // bottom border 25
- << QVariant(100) // damage modfier 26
- << QVariant(45) // turn time 27
- << QVariant(100) // init health 28
- << QVariant(15) // sudden death 29
- << QVariant(5) // case prob 30
- << QVariant(3) // mines time 31
- << QVariant(4) // mines number 32
- << QVariant(0) // mine dud pct 33
- << QVariant(2) // explosives 34
- << QVariant(35) // health case pct 35
- << QVariant(25) // health case amt 36
- << QVariant(47) // water rise amt 37
- << QVariant(5) // health dec amt 38
- << QVariant(100) // rope modfier 39
- << QVariant(100) // get away time 40
- ;
-
-
- schemes.append(defaultScheme);
- schemes.append(proMode);
- schemes.append(shoppa);
- schemes.append(cleanslate);
- schemes.append(minefield);
- schemes.append(barrelmayhem);
- schemes.append(tunnelhogs);
- schemes.append(forts);
- schemes.append(timeless);
- schemes.append(thinkingportals);
- schemes.append(kingmode);
-
-
- int size = fileConfig.beginReadArray("schemes");
- for (int i = 0; i < size; ++i) {
- fileConfig.setArrayIndex(i);
-
- if (!predefSchemesNames.contains(fileConfig.value(spNames[0]).toString()))
- {
- QList scheme;
-
- for (int k = 0; k < spNames.size(); ++k)
- scheme << fileConfig.value(spNames[k], defaultScheme[k]);
-
- schemes.append(scheme);
- }
- }
- fileConfig.endArray();
-}
-
-QVariant AmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- Q_UNUSED(section);
- Q_UNUSED(orientation);
- Q_UNUSED(role);
-
- return QVariant();
-}
-
-int AmmoSchemeModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.isValid())
- return 0;
- else
- return schemes.size();
-}
-
-int AmmoSchemeModel::columnCount(const QModelIndex & parent) const
-{
- if (parent.isValid())
- return 0;
- else
- return defaultScheme.size();
-}
-
-Qt::ItemFlags AmmoSchemeModel::flags(const QModelIndex & index) const
-{
- Q_UNUSED(index);
-
- return
- Qt::ItemIsEnabled
- | Qt::ItemIsSelectable
- | Qt::ItemIsEditable;
-}
-
-bool AmmoSchemeModel::setData(const QModelIndex & index, const QVariant & value, int role)
-{
- if (!index.isValid() || index.row() < numberOfDefaultSchemes
- || index.row() >= schemes.size()
- || index.column() >= defaultScheme.size()
- || role != Qt::EditRole)
- return false;
-
- schemes[index.row()][index.column()] = value;
-
- emit dataChanged(index, index);
- return true;
-}
-
-bool AmmoSchemeModel::insertRows(int row, int count, const QModelIndex & parent)
-{
- Q_UNUSED(count);
-
- beginInsertRows(parent, schemes.size(), schemes.size());
-
- if (row == -1)
- {
- QList newScheme = defaultScheme;
- newScheme[0] = QVariant(tr("new"));
- schemes.insert(schemes.size(), newScheme);
- }
- else
- {
- QList newScheme = schemes[row];
- newScheme[0] = QVariant(tr("copy of") + " " + newScheme[0].toString());
- schemes.insert(schemes.size(), newScheme);
- }
-
- endInsertRows();
-
- return true;
-}
-
-bool AmmoSchemeModel::removeRows(int row, int count, const QModelIndex & parent)
-{
- if(count != 1
- || row < numberOfDefaultSchemes
- || row >= schemes.size())
- return false;
-
- beginRemoveRows(parent, row, row);
-
- schemes.removeAt(row);
-
- endRemoveRows();
-
- return true;
-}
-
-QVariant AmmoSchemeModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid() || index.row() < 0
- || index.row() >= schemes.size()
- || index.column() >= defaultScheme.size()
- || (role != Qt::EditRole && role != Qt::DisplayRole)
- )
- return QVariant();
-
- return schemes[index.row()][index.column()];
-}
-
-void AmmoSchemeModel::Save()
-{
- fileConfig.beginWriteArray("schemes", schemes.size() - numberOfDefaultSchemes);
-
- for (int i = 0; i < schemes.size() - numberOfDefaultSchemes; ++i) {
- fileConfig.setArrayIndex(i);
-
- QList scheme = schemes[i + numberOfDefaultSchemes];
-
- for (int k = 0; k < scheme.size(); ++k)
- fileConfig.setValue(spNames[k], scheme[k]);
- }
- fileConfig.endArray();
-}
-
-
-NetAmmoSchemeModel::NetAmmoSchemeModel(QObject * parent) :
- QAbstractTableModel(parent)
-{
- netScheme = defaultScheme;
-}
-
-QVariant NetAmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- Q_UNUSED(section);
- Q_UNUSED(orientation);
- Q_UNUSED(role);
-
- return QVariant();
-}
-
-int NetAmmoSchemeModel::rowCount(const QModelIndex & parent) const
-{
- if (parent.isValid())
- return 0;
- else
- return 1;
-}
-
-int NetAmmoSchemeModel::columnCount(const QModelIndex & parent) const
-{
- if (parent.isValid())
- return 0;
- else
- return defaultScheme.size();
-}
-
-QVariant NetAmmoSchemeModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid() || index.row() < 0
- || index.row() > 1
- || index.column() >= defaultScheme.size()
- || (role != Qt::EditRole && role != Qt::DisplayRole)
- )
- return QVariant();
-
- return netScheme[index.column()];
-}
-
-void NetAmmoSchemeModel::setNetSchemeConfig(QStringList & cfg)
-{
- if(cfg.size() != netScheme.size())
- {
- qWarning("Incorrect scheme cfg size");
- return;
- }
-
- for(int i = 0; i < cfg.size(); ++i)
- netScheme[i] = QVariant(cfg[i]);
-
- reset();
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ammoSchemeModel.h
--- a/QTfrontend/ammoSchemeModel.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2005-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _AMMO_SCHEME_MODEL_INCLUDED
-#define _AMMO_SCHEME_MODEL_INCLUDED
-
-#include
-#include
-#include
-#include
-
-class AmmoSchemeModel : public QAbstractTableModel
-{
- Q_OBJECT
-
-public:
- AmmoSchemeModel(QObject * parent, const QString & fileName);
-
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- int rowCount(const QModelIndex & parent) const;
- int columnCount(const QModelIndex & parent) const;
- Qt::ItemFlags flags(const QModelIndex & index) const;
- bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
- bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
- bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
- QVariant data(const QModelIndex &index, int role) const;
-
- int numberOfDefaultSchemes;
- QStringList predefSchemesNames;
- QStringList spNames;
-
-public slots:
- void Save();
-
-signals:
- void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
-
-protected:
- QList< QList > schemes;
-
-private:
- QSettings fileConfig;
-};
-
-class NetAmmoSchemeModel : public QAbstractTableModel
-{
- Q_OBJECT
-
-public:
- NetAmmoSchemeModel(QObject * parent);
-
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- int rowCount(const QModelIndex & parent) const;
- int columnCount(const QModelIndex & parent) const;
- QVariant data(const QModelIndex &index, int role) const;
-
-public slots:
- void setNetSchemeConfig(QStringList & cfg);
-
-private:
- QList netScheme;
-};
-
-#endif // _AMMO_SCHEME_MODEL_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/bgwidget.cpp
--- a/QTfrontend/bgwidget.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2009 Kristian Lehmann
- * Copyright (c) 2009-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "bgwidget.h"
-
-SpritePosition::SpritePosition(QWidget * parent, int sh)
-{
- wParent = parent;
- iSpriteHeight = sh;
- reset();
-}
-
-SpritePosition::~SpritePosition()
-{
-}
-
-void SpritePosition::move()
-{
- fX += fXMov;
- fY += fYMov;
- iAngle += 4;
- if (iAngle >= 360) iAngle = 0;
- if (fY > wParent->height()) reset();
-}
-
-void SpritePosition::reset()
-{
- fY = -1 * iSpriteHeight;
- fX = (qrand() % ((int)(wParent->width() * 1.5))) - wParent->width()/2;
- fYMov = ((qrand() % 400)+300) / 100.0f;
- fXMov = fYMov * 0.2f+((qrand()%100)/100.0f * 0.6f); //so between 0.2 and 0.6, or 0.5 +/- 0.3
- iAngle = qrand() % 360;
-}
-
-QPoint SpritePosition::pos()
-{
- return QPoint((int)fX,(int)fY);
-}
-
-int SpritePosition::getAngle()
-{
- return iAngle;
-}
-
-void SpritePosition::init()
-{
- fY = qrand() % (wParent->height() + 1);
- fX = qrand() % (wParent->width() + 1);
-}
-
-BGWidget::BGWidget(QWidget * parent) : QWidget(parent)
-{
- setAttribute(Qt::WA_NoSystemBackground, true);
- sprite.load(":/res/Star.png");
-
- setAutoFillBackground(false);
-
- for (int i = 0; i < SPRITE_MAX; i++) spritePositions[i] = new SpritePosition(this, sprite.height());
-
- for (int i = 0; i < 360; i++)
- {
- rotatedSprites[i] = new QImage(sprite.width(), sprite.height(), QImage::Format_ARGB32);
- rotatedSprites[i]->fill(0);
-
- QPoint translate(sprite.width()/2, sprite.height()/2);
-
- QPainter p;
- p.begin(rotatedSprites[i]);
- // p.setRenderHint(QPainter::Antialiasing);
- p.setRenderHint(QPainter::SmoothPixmapTransform);
- p.translate(translate.x(), translate.y());
- p.rotate(i);
- p.translate(-1*translate.x(), -1*translate.y());
- p.drawImage(0, 0, sprite);
- }
-
- timerAnimation = new QTimer();
- connect(timerAnimation, SIGNAL(timeout()), this, SLOT(animate()));
- timerAnimation->setInterval(ANIMATION_INTERVAL);
-}
-
-BGWidget::~BGWidget()
-{
- for (int i = 0; i < SPRITE_MAX; i++) delete spritePositions[i];
- for (int i = 0; i < 360; i++) delete rotatedSprites[i];
- delete timerAnimation;
-}
-
-void BGWidget::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event);
-
- QPainter p;
- p.begin(this);
- //p.setRenderHint(QPainter::Antialiasing);
- for (int i = 0; i < SPRITE_MAX; i++)
- {
- QPoint point = spritePositions[i]->pos();
- p.drawImage(point.x(), point.y(), *rotatedSprites[spritePositions[i]->getAngle()]);
- }
- p.end();
-}
-
-void BGWidget::animate()
-{
- for (int i = 0; i < SPRITE_MAX; i++)
- {
- // bottom edge of star *seems* clipped, but in fact, if I switch to just plain old repaint()/update() it is still clipped - artifact of transform? As for 5, is arbitrary number. 4 was noticeably clipping, 5 seemed same as update() - I assume extra room is due to rotation and value really should be calculated proportional to width/height
- update(spritePositions[i]->pos().x(),spritePositions[i]->pos().y(), sprite.width()+5, sprite.height()+5);
- spritePositions[i]->move();
- }
-}
-
-void BGWidget::startAnimation()
-{
- timerAnimation->start();
-}
-
-void BGWidget::stopAnimation()
-{
- timerAnimation->stop();
-}
-
-void BGWidget::init()
-{
- for (int i = 0; i < SPRITE_MAX; i++) spritePositions[i]->init();
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/bgwidget.h
--- a/QTfrontend/bgwidget.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2009 Kristian Lehmann
- * Copyright (c) 2009-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef BGWIDGET_H
-#define BGWIDGET_H
-
-#include
-//#include
-#include
-#include
-#include
-#include
-#include
-
-#define SPRITE_MAX 12
-
-#define ANIMATION_INTERVAL 40
-
-class SpritePosition
-{
-public:
- SpritePosition(QWidget * parent, int sh);
- ~SpritePosition();
-private:
- float fX;
- float fY;
- float fXMov;
- float fYMov;
- int iAngle;
- QWidget * wParent;
- int iSpriteHeight;
-public:
- void move();
- void reset();
- QPoint pos();
- int getAngle();
- void init();
-};
-
-class BGWidget : public QWidget
-{
- Q_OBJECT
-public:
- BGWidget(QWidget * parent);
- ~BGWidget();
- void startAnimation();
- void stopAnimation();
- void init();
-private:
- QImage sprite;
- QTimer * timerAnimation;
- SpritePosition * spritePositions[SPRITE_MAX];
- QImage * rotatedSprites[360];
-protected:
- void paintEvent(QPaintEvent * event);
-private slots:
- void animate();
-};
-
-#endif // BGWIDGET_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/chatwidget.cpp
--- a/QTfrontend/chatwidget.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,584 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007 Igor Ulyanov
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "hwconsts.h"
-#include "SDLs.h"
-#include "gameuiconfig.h"
-#include "chatwidget.h"
-
-ListWidgetNickItem::ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored) : QListWidgetItem(nick)
-{
- this->aFriend = isFriend;
- this->isIgnored = isIgnored;
-}
-
-void ListWidgetNickItem::setFriend(bool isFriend)
-{
- this->aFriend = isFriend;
-}
-
-void ListWidgetNickItem::setIgnored(bool isIgnored)
-{
- this->isIgnored = isIgnored;
-}
-
-bool ListWidgetNickItem::isFriend()
-{
- return aFriend;
-}
-
-bool ListWidgetNickItem::ignored()
-{
- return isIgnored;
-}
-
-bool ListWidgetNickItem::operator< (const QListWidgetItem & other) const
-{
- // case in-sensitive comparison of the associated strings
- // chars that are no letters are sorted at the end of the list
-
- ListWidgetNickItem otherNick = const_cast(dynamic_cast(other));
-
- // ignored always down
- if (isIgnored != otherNick.ignored())
- return !isIgnored;
-
- // friends always up
- if (aFriend != otherNick.isFriend())
- return aFriend;
-
- QString txt1 = text().toLower();
- QString txt2 = other.text().toLower();
-
- bool firstIsShorter = (txt1.size() < txt2.size());
- int len = firstIsShorter?txt1.size():txt2.size();
-
- for (int i = 0; i < len; i++)
- {
- if (txt1[i] == txt2[i])
- continue;
- if (txt1[i].isLetter() != txt2[i].isLetter())
- return txt1[i].isLetter();
- return (txt1[i] < txt2[i]);
- }
-
- return firstIsShorter;
-}
-
-const char* HWChatWidget::STYLE =
-"\
-a { color:#c8c8ff; }\
-.nick { text-decoration: none; }\
-.UserChat .nick { color:#ffec20; }\
-.FriendChat { color: #08e008; }\
-.FriendChat .nick { color: #20ff20; }\
-.UserJoin { color: #c0c0c0; }\
-.UserJoin .nick { color: #d0d0d0; }\
-.FriendJoin { color: #c0e0c0; }\
-.FriendJoin .nick { color: #d0f0d0; }\
-.UserAction { color: #ff80ff; }\
-.UserAction .nick { color: #ffa0ff; }\
-.FriendAction { color: #ff00ff; }\
-.FriendAction .nick { color: #ff30ff; }\
-.Error { color: #ff0000 }\
-.Warning { color: #ff8000 }\
-.Notice { color: #fefefe }\
-";
-
-HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) :
- QWidget(parent),
- mainLayout(this)
-{
- this->gameSettings = gameSettings;
- this->sdli = sdli;
- this->notify = notify;
- if(notify && gameSettings->value("frontend/sound", true).toBool()) {
- QFile tmpfile;
- sdli->SDLMusicInit();
- for(int i=0;i<4;i++) {
- tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Sounds/voices/Classic/Hello.ogg");
- if (tmpfile.exists()) sound[i] = Mix_LoadWAV(QFileInfo(tmpfile).absoluteFilePath().toLocal8Bit().constData());
- else sound[i] = Mix_LoadWAV(QString(datadir->absolutePath() +
- "/Sounds/voices/Classic/Hello.ogg").toLocal8Bit().constData());
- }
- }
-
- mainLayout.setSpacing(1);
- mainLayout.setMargin(1);
- mainLayout.setSizeConstraint(QLayout::SetMinimumSize);
- mainLayout.setColumnStretch(0, 76);
- mainLayout.setColumnStretch(1, 24);
-
- chatEditLine = new QLineEdit(this);
- chatEditLine->setMaxLength(300);
- connect(chatEditLine, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
-
- mainLayout.addWidget(chatEditLine, 2, 0);
-
- chatText = new QTextBrowser(this);
- chatText->document()->setDefaultStyleSheet(STYLE);
- chatText->setMinimumHeight(20);
- chatText->setMinimumWidth(10);
- chatText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- chatText->setOpenLinks(false);
- connect(chatText, SIGNAL(anchorClicked(const QUrl&)),
- this, SLOT(linkClicked(const QUrl&)));
- mainLayout.addWidget(chatText, 0, 0, 2, 1);
-
- chatNicks = new QListWidget(this);
- chatNicks->setMinimumHeight(10);
- chatNicks->setMinimumWidth(10);
- chatNicks->setSortingEnabled(true);
- chatNicks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu);
- connect(chatNicks, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
- this, SLOT(chatNickDoubleClicked(QListWidgetItem *)));
- connect(chatNicks, SIGNAL(currentRowChanged(int)),
- this, SLOT(chatNickSelected(int)));
-
- mainLayout.addWidget(chatNicks, 0, 1, 3, 1);
-
- acInfo = new QAction(QAction::tr("Info"), chatNicks);
- acInfo->setIcon(QIcon(":/res/info.png"));
- connect(acInfo, SIGNAL(triggered(bool)), this, SLOT(onInfo()));
- acKick = new QAction(QAction::tr("Kick"), chatNicks);
- acKick->setIcon(QIcon(":/res/kick.png"));
- connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick()));
- acBan = new QAction(QAction::tr("Ban"), chatNicks);
- acBan->setIcon(QIcon(":/res/ban.png"));
- connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan()));
- acFollow = new QAction(QAction::tr("Follow"), chatNicks);
- acFollow->setIcon(QIcon(":/res/follow.png"));
- connect(acFollow, SIGNAL(triggered(bool)), this, SLOT(onFollow()));
- acIgnore = new QAction(QAction::tr("Ignore"), chatNicks);
- acIgnore->setIcon(QIcon(":/res/ignore.png"));
- connect(acIgnore, SIGNAL(triggered(bool)), this, SLOT(onIgnore()));
- acFriend = new QAction(QAction::tr("Add friend"), chatNicks);
- acFriend->setIcon(QIcon(":/res/addfriend.png"));
- connect(acFriend, SIGNAL(triggered(bool)), this, SLOT(onFriend()));
-
- chatNicks->insertAction(0, acFriend);
- chatNicks->insertAction(0, acInfo);
- chatNicks->insertAction(0, acIgnore);
-
- showReady = false;
- setShowFollow(true);
-}
-
-void HWChatWidget::linkClicked(const QUrl & link)
-{
- if (link.scheme() == "http")
- QDesktopServices::openUrl(link);
- if (link.scheme() == "hwnick")
- {
- // decode nick
- const QString& nick = QString::fromUtf8(QByteArray::fromBase64(link.encodedQuery()));
- QList items = chatNicks->findItems(nick, Qt::MatchExactly);
- if (items.size() < 1)
- return;
- QMenu * popup = new QMenu(this);
- // selecting an item will automatically scroll there, so let's save old position
- QScrollBar * scrollBar = chatNicks->verticalScrollBar();
- int oldScrollPos = scrollBar->sliderPosition();
- // select the nick which we want to see the actions for
- chatNicks->setCurrentItem(items[0], QItemSelectionModel::Clear);
- // selecting an item will automatically scroll there, so let's save old position
- scrollBar->setSliderPosition(oldScrollPos);
- // load actions
- popup->addActions(chatNicks->actions());
- // display menu popup at mouse cursor position
- popup->popup(QCursor::pos());
- }
-}
-
-void HWChatWidget::setShowFollow(bool enabled)
-{
- if (enabled) {
- if (!(chatNicks->actions().contains(acFollow)))
- chatNicks->insertAction(acFriend, acFollow);
- }
- else {
- if (chatNicks->actions().contains(acFollow))
- chatNicks->removeAction(acFollow);
- }
-}
-
-void HWChatWidget::loadList(QStringList & list, const QString & file)
-{
- list.clear();
- QFile txt(cfgdir->absolutePath() + "/" + file);
- if(!txt.open(QIODevice::ReadOnly))
- return;
- QTextStream stream(&txt);
- stream.setCodec("UTF-8");
-
- while(!stream.atEnd())
- {
- QString str = stream.readLine();
- if(str.startsWith(";") || str.length() == 0)
- continue;
- list << str.trimmed();
- }
- //readd once we require newer Qt than 4.4
- //list.removeDuplicates();
- txt.close();
-}
-
-void HWChatWidget::saveList(QStringList & list, const QString & file)
-{
- QFile txt(cfgdir->absolutePath() + "/" + file);
- if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate))
- return;
- QTextStream stream(&txt);
- stream.setCodec("UTF-8");
-
- stream << "; this list is used by Hedgewars - do not edit it unless you know what you're doing!" << endl;
- for(int i = 0; i < list.size(); i++)
- stream << list[i] << endl;
- txt.close();
-}
-
-void HWChatWidget::updateNickItem(QListWidgetItem *nickItem)
-{
- QString nick = nickItem->text();
- ListWidgetNickItem * item = dynamic_cast(nickItem);
-
- item->setFriend(friendsList.contains(nick, Qt::CaseInsensitive));
- item->setIgnored(ignoreList.contains(nick, Qt::CaseInsensitive));
-
- if(item->ignored())
- {
- item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_ignore_on.png" : ":/res/chat_ignore_off.png") : ":/res/chat_ignore.png"));
- item->setForeground(Qt::gray);
- }
- else if(item->isFriend())
- {
- item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_friend_on.png" : ":/res/chat_friend_off.png") : ":/res/chat_friend.png"));
- item->setForeground(Qt::green);
- }
- else
- {
- item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_default_on.png" : ":/res/chat_default_off.png") : ":/res/chat_default.png"));
- item->setForeground(QBrush(QColor(0xff, 0xcc, 0x00)));
- }
-}
-
-void HWChatWidget::updateNickItems()
-{
- for(int i = 0; i < chatNicks->count(); i++)
- updateNickItem(chatNicks->item(i));
-
- chatNicks->sortItems();
-}
-
-void HWChatWidget::loadLists(const QString & nick)
-{
- loadList(ignoreList, nick.toLower() + "_ignore.txt");
- loadList(friendsList, nick.toLower() + "_friends.txt");
- updateNickItems();
-}
-
-void HWChatWidget::saveLists(const QString & nick)
-{
- saveList(ignoreList, nick.toLower() + "_ignore.txt");
- saveList(friendsList, nick.toLower() + "_friends.txt");
-}
-
-void HWChatWidget::returnPressed()
-{
- QStringList lines = chatEditLine->text().split('\n');
- chatEditLine->clear();
- foreach (const QString &line, lines)
- emit chatLine(line);
-}
-
-
-void HWChatWidget::onChatString(const QString& str)
-{
- onChatString("", str);
-}
-
-const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http://)?(www\\.)?(hedgewars\\.org(/[^ ]*)?)");
-
-void HWChatWidget::onChatString(const QString& nick, const QString& str)
-{
- bool isFriend = false;
-
- if (!nick.isEmpty()) {
- // don't show chat lines that are from ignored nicks
- if (ignoreList.contains(nick, Qt::CaseInsensitive))
- return;
- // friends will get special treatment, of course
- isFriend = friendsList.contains(nick, Qt::CaseInsensitive);
- }
-
- QString formattedStr = Qt::escape(str.mid(1));
- // make hedgewars.org urls actual links
- formattedStr = formattedStr.replace(URLREGEXP, "\\3");
-
- // "link" nick, but before that encode it in base64 to make sure it can't intefere with html/url syntax
- // the nick is put as querystring as putting it as host would convert it to it's lower case variant
- if(!nick.isEmpty())
- formattedStr.replace("|nick|",QString("%2").arg(QString(nick.toUtf8().toBase64())).arg(nick));
-
- QString cssClass("UserChat");
-
- // check first character for color code and set color properly
- switch (str[0].toAscii()) {
- case 3:
- cssClass = (isFriend ? "FriendJoin" : "UserJoin");
- break;
- case 2:
- cssClass = (isFriend ? "FriendAction" : "UserAction");
- break;
- default:
- if (isFriend)
- cssClass = "FriendChat";
- }
-
- addLine(cssClass,formattedStr);
-}
-
-void HWChatWidget::addLine(const QString& cssClass, QString line)
-{
- if (chatStrings.size() > 250)
- chatStrings.removeFirst();
-
- line = QString("%1").arg(line).arg(cssClass);
-
- chatStrings.append(line);
-
- chatText->setHtml(chatStrings.join("
"));
-
- chatText->moveCursor(QTextCursor::End);
-}
-
-void HWChatWidget::onServerMessage(const QString& str)
-{
- if (chatStrings.size() > 250)
- chatStrings.removeFirst();
-
- chatStrings.append("
" + str + "
");
-
- chatText->setHtml(chatStrings.join("
"));
-
- chatText->moveCursor(QTextCursor::End);
-}
-
-void HWChatWidget::nickAdded(const QString& nick, bool notifyNick)
-{
- QListWidgetItem * item = new ListWidgetNickItem(nick, friendsList.contains(nick, Qt::CaseInsensitive), ignoreList.contains(nick, Qt::CaseInsensitive));
- updateNickItem(item);
- chatNicks->addItem(item);
-
- emit nickCountUpdate(chatNicks->count());
-
- if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool()) {
- Mix_PlayChannel(-1, sound[rand()%4], 0);
- }
-}
-
-void HWChatWidget::nickRemoved(const QString& nick)
-{
- foreach(QListWidgetItem * item, chatNicks->findItems(nick, Qt::MatchExactly))
- chatNicks->takeItem(chatNicks->row(item));
-
- emit nickCountUpdate(chatNicks->count());
-}
-
-void HWChatWidget::clear()
-{
- chatText->clear();
- chatStrings.clear();
- chatNicks->clear();
-}
-
-void HWChatWidget::onKick()
-{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit kick(curritem->text());
-}
-
-void HWChatWidget::onBan()
-{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit ban(curritem->text());
-}
-
-void HWChatWidget::onInfo()
-{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit info(curritem->text());
-}
-
-void HWChatWidget::onFollow()
-{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if (curritem)
- emit follow(curritem->text());
-}
-
-void HWChatWidget::onIgnore()
-{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if(!curritem)
- return;
-
- if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him
- {
- ignoreList.removeAll(curritem->text().toLower());
- onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your ignore list").arg('\x03').arg(curritem->text()));
- }
- else // not on list - add
- {
- // don't consider ignored people friends
- if(friendsList.contains(curritem->text(), Qt::CaseInsensitive))
- emit onFriend();
-
- // scroll down on first ignore added so that people see where that nick went to
- if (ignoreList.isEmpty())
- chatNicks->scrollToBottom();
-
- ignoreList << curritem->text().toLower();
- onChatString(HWChatWidget::tr("%1 *** %2 has been added to your ignore list").arg('\x03').arg(curritem->text()));
- }
- updateNickItem(curritem); // update icon/sort order/etc
- chatNicks->sortItems();
- chatNickSelected(0); // update context menu
-}
-
-void HWChatWidget::onFriend()
-{
- QListWidgetItem * curritem = chatNicks->currentItem();
- if(!curritem)
- return;
-
- if(friendsList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him
- {
- friendsList.removeAll(curritem->text().toLower());
- onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your friends list").arg('\x03').arg(curritem->text()));
- }
- else // not on list - add
- {
- // don't ignore the new friend
- if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive))
- emit onIgnore();
-
- // scroll up on first friend added so that people see where that nick went to
- if (friendsList.isEmpty())
- chatNicks->scrollToTop();
-
- friendsList << curritem->text().toLower();
- onChatString(HWChatWidget::tr("%1 *** %2 has been added to your friends list").arg('\x03').arg(curritem->text()));
- }
- updateNickItem(curritem); // update icon/sort order/etc
- chatNicks->sortItems();
- chatNickSelected(0); // update context menu
-}
-
-void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item)
-{
- Q_UNUSED(item);
-
- QList actions = chatNicks->actions();
- actions.first()->activate(QAction::Trigger);
-}
-
-void HWChatWidget::chatNickSelected(int index)
-{
- Q_UNUSED(index);
-
- QListWidgetItem* item = chatNicks->currentItem();
- if (!item)
- return;
-
- // update context menu labels according to possible action
- if(ignoreList.contains(item->text(), Qt::CaseInsensitive))
- {
- acIgnore->setText(QAction::tr("Unignore"));
- acIgnore->setIcon(QIcon(":/res/unignore.png"));
- }
- else
- {
- acIgnore->setText(QAction::tr("Ignore"));
- acIgnore->setIcon(QIcon(":/res/ignore.png"));
- }
-
- if(friendsList.contains(item->text(), Qt::CaseInsensitive))
- {
- acFriend->setText(QAction::tr("Remove friend"));
- acFriend->setIcon(QIcon(":/res/remfriend.png"));
- }
- else
- {
- acFriend->setText(QAction::tr("Add friend"));
- acFriend->setIcon(QIcon(":/res/addfriend.png"));
- }
-}
-
-void HWChatWidget::setShowReady(bool s)
-{
- showReady = s;
-}
-
-void HWChatWidget::setReadyStatus(const QString & nick, bool isReady)
-{
- QList items = chatNicks->findItems(nick, Qt::MatchExactly);
- if (items.size() != 1)
- {
- qWarning("Bug: cannot find user in chat");
- return;
- }
-
- items[0]->setData(Qt::UserRole, isReady); // bulb status
- updateNickItem(items[0]);
-
- // ensure we're still showing the status bulbs
- showReady = true;
-}
-
-void HWChatWidget::adminAccess(bool b)
-{
- chatNicks->removeAction(acKick);
- chatNicks->removeAction(acBan);
-
- if(b)
- {
- chatNicks->insertAction(0, acKick);
-// chatNicks->insertAction(0, acBan);
- }
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/chatwidget.h
--- a/QTfrontend/chatwidget.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007 Igor Ulyanov
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _CHAT_WIDGET_INCLUDED
-#define _CHAT_WIDGET_INCLUDED
-
-#include
-#include
-#include
-#include
-#include
-
-#include "SDLs.h"
-
-class ListWidgetNickItem;
-class QTextBrowser;
-class QLineEdit;
-class QListWidget;
-class QSettings;
-class SDLInteraction;
-
-// this class is for custom nick sorting
-class ListWidgetNickItem : public QListWidgetItem
-{
-public:
- ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored);
- bool operator<(const QListWidgetItem & other) const;
- void setFriend(bool isFriend);
- void setIgnored(bool isIgnored);
- bool isFriend();
- bool ignored();
-
-private:
- bool aFriend;
- bool isIgnored;
-};
-
-class HWChatWidget : public QWidget
-{
- Q_OBJECT
-
- public:
- HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify);
- void loadLists(const QString & nick);
- void saveLists(const QString & nick);
- void setShowReady(bool s);
- void setShowFollow(bool enabled);
- void addLine(const QString & cssClass, QString line);
- static const char* STYLE;
- QStringList ignoreList, friendsList;
-
-private:
- void loadList(QStringList & list, const QString & file);
- void saveList(QStringList & list, const QString & file);
- void updateNickItem(QListWidgetItem *item);
- void updateNickItems();
- static const QRegExp URLREGEXP;
-
- public slots:
- void onChatString(const QString& str);
- void onChatString(const QString& nick, const QString& str);
- void onServerMessage(const QString& str);
- void nickAdded(const QString& nick, bool notifyNick);
- void nickRemoved(const QString& nick);
- void clear();
- void setReadyStatus(const QString & nick, bool isReady);
- void adminAccess(bool);
-
- signals:
- void chatLine(const QString& str);
- void kick(const QString & str);
- void ban(const QString & str);
- void info(const QString & str);
- void follow(const QString &);
- void nickCountUpdate(int cnt);
-
- private:
- QGridLayout mainLayout;
- QTextBrowser* chatText;
- QStringList chatStrings;
- QListWidget* chatNicks;
- QLineEdit* chatEditLine;
- QAction * acInfo;
- QAction * acKick;
- QAction * acBan;
- QAction * acFollow;
- QAction * acIgnore;
- QAction * acFriend;
- QSettings * gameSettings;
- SDLInteraction * sdli;
- Mix_Chunk *sound[4];
- bool notify;
- bool showReady;
-
- private slots:
- void returnPressed();
- void onBan();
- void onKick();
- void onInfo();
- void onFollow();
- void onIgnore();
- void onFriend();
- void chatNickDoubleClicked(QListWidgetItem * item);
- void chatNickSelected(int index);
- void linkClicked(const QUrl & link);
-};
-
-#endif // _CHAT_WIDGET_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/databrowser.cpp
--- a/QTfrontend/databrowser.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-
-#include "databrowser.h"
-
-const QNetworkRequest::Attribute typeAttribute = (QNetworkRequest::Attribute)(QNetworkRequest::User + 1);
-const QNetworkRequest::Attribute urlAttribute = (QNetworkRequest::Attribute)(QNetworkRequest::User + 2);
-
-DataBrowser::DataBrowser(QWidget *parent) :
- QTextBrowser(parent)
-{
-
- manager = new QNetworkAccessManager(this);
-}
-
-QVariant DataBrowser::loadResource(int type, const QUrl & name)
-{
- if(type == QTextDocument::ImageResource || type == QTextDocument::StyleSheetResource)
- {
- if(resources.contains(name.toString()))
- {
- return resources.take(name.toString());
- }
- else
- if(!requestedResources.contains(name.toString()))
- {
- qDebug() << "Requesting resource" << name.toString();
- requestedResources.insert(name.toString());
-
- QNetworkRequest newRequest(QUrl("http://www.hedgewars.org" + name.toString()));
- newRequest.setAttribute(typeAttribute, type);
- newRequest.setAttribute(urlAttribute, name);
-
- QNetworkReply *reply = manager->get(newRequest);
- connect(reply, SIGNAL(finished()), this, SLOT(resourceDownloaded()));
- }
- }
-
- return QVariant();
-}
-
-void DataBrowser::resourceDownloaded()
-{
- QNetworkReply * reply = qobject_cast(sender());
-
- if(reply)
- {
- int type = reply->request().attribute(typeAttribute).toInt();
- QUrl url = reply->request().attribute(urlAttribute).toUrl();
- resources.insert(url.toString(), reply->readAll());
- document()->addResource(type, reply->request().url(), QVariant());
- update();
- }
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/databrowser.h
--- a/QTfrontend/databrowser.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#ifndef DATABROWSER_H
-#define DATABROWSER_H
-
-#include
-#include
-
-class QNetworkAccessManager;
-
-class DataBrowser : public QTextBrowser
-{
- Q_OBJECT
-public:
- explicit DataBrowser(QWidget *parent = 0);
-
-signals:
-
-public slots:
-
-private:
- QNetworkAccessManager *manager;
-
- // hash and set of QString instead of QUrl to support Qt versions
- // older than 4.7 (those have no support for qHash(const QUrl &))
- QHash resources;
- QSet requestedResources;
-
- QVariant loadResource(int type, const QUrl & name);
-
-private slots:
- void resourceDownloaded();
-};
-
-#endif // DATABROWSER_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/drawmapwidget.cpp
--- a/QTfrontend/drawmapwidget.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-
-#include "drawmapwidget.h"
-
-DrawMapWidget::DrawMapWidget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::DrawMapWidget)
-{
- ui->setupUi(this);
-
- m_scene = 0;
-}
-
-DrawMapWidget::~DrawMapWidget()
-{
- delete ui;
-}
-
-void DrawMapWidget::changeEvent(QEvent *e)
-{
- QWidget::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- ui->retranslateUi(this);
- break;
- default:
- break;
- }
-}
-
-void DrawMapWidget::setScene(DrawMapScene * scene)
-{
- ui->graphicsView->setScene(scene);
- m_scene = scene;
-}
-
-void DrawMapWidget::resizeEvent(QResizeEvent * event)
-{
- Q_UNUSED(event);
-
- if(ui->graphicsView && ui->graphicsView->scene())
- ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio);
-}
-
-void DrawMapWidget::showEvent(QShowEvent * event)
-{
- Q_UNUSED(event);
-
- resizeEvent(0);
-}
-
-void DrawMapWidget::undo()
-{
- if(m_scene) m_scene->undo();
-}
-
-void DrawMapWidget::clear()
-{
- if(m_scene) m_scene->clearMap();
-}
-
-void DrawMapWidget::save(const QString & fileName)
-{
- if(m_scene)
- {
- QFile file(fileName);
-
- if(!file.open(QIODevice::WriteOnly))
- QMessageBox::warning(this, tr("File error"), tr("Cannot open file '%1' for writing").arg(fileName));
- else
- file.write(qCompress(m_scene->encode()).toBase64());
- }
-}
-
-void DrawMapWidget::load(const QString & fileName)
-{
- if(m_scene)
- {
- QFile f(fileName);
-
- if(!f.open(QIODevice::ReadOnly))
- QMessageBox::warning(this, tr("File error"), tr("Cannot read file '%1'").arg(fileName));
- else
- m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll())));
- }
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/drawmapwidget.h
--- a/QTfrontend/drawmapwidget.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef DRAWMAPWIDGET_H
-#define DRAWMAPWIDGET_H
-
-#include
-#include
-#include
-#include
-
-#include "qaspectratiolayout.h"
-#include "drawmapscene.h"
-
-namespace Ui {
- class Ui_DrawMapWidget
- {
- public:
- QGraphicsView *graphicsView;
-
- void setupUi(QWidget *drawMapWidget)
- {
- QAspectRatioLayout * arLayout = new QAspectRatioLayout(drawMapWidget);
- arLayout->setMargin(0);
-
- graphicsView = new QGraphicsView(drawMapWidget);
- arLayout->addWidget(graphicsView);
-
- retranslateUi(drawMapWidget);
-
- QMetaObject::connectSlotsByName(drawMapWidget);
- } // setupUi
-
- void retranslateUi(QWidget *drawMapWidget)
- {
- Q_UNUSED(drawMapWidget);
- } // retranslateUi
-
- };
-
- class DrawMapWidget: public Ui_DrawMapWidget {};
-}
-
-class DrawMapWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit DrawMapWidget(QWidget *parent = 0);
- ~DrawMapWidget();
-
- void setScene(DrawMapScene * scene);
-
-public slots:
- void undo();
- void clear();
- void save(const QString & fileName);
- void load(const QString & fileName);
-
-protected:
- void changeEvent(QEvent *e);
- virtual void resizeEvent(QResizeEvent * event);
- virtual void showEvent(QShowEvent * event);
-
-private:
- Ui::DrawMapWidget *ui;
-
- DrawMapScene * m_scene;
-};
-
-#endif // DRAWMAPWIDGET_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/fpsedit.cpp
--- a/QTfrontend/fpsedit.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "fpsedit.h"
-
-FPSEdit::FPSEdit(QWidget * parent) :
- QSpinBox(parent)
-{
- setRange(1, 34);
- setValue(27);
-}
-
-QString FPSEdit::textFromValue(int value) const
-{
- return QString::number(1000 / (35 - value));
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/fpsedit.h
--- a/QTfrontend/fpsedit.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _FPSEDIT_H
-#define _FPSEDIT_H
-
-#include
-
-class FPSEdit : public QSpinBox
-{
- Q_OBJECT
-
-public:
- FPSEdit(QWidget * parent = 0);
-
-protected:
- QString textFromValue (int value) const;
-};
-
-#endif // _FPSEDIT_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/frameTeam.cpp
--- a/QTfrontend/frameTeam.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2007 Igor Ulyanov
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-
-#include "frameTeam.h"
-#include "teamselhelper.h"
-#include "hwconsts.h"
-
-FrameTeams::FrameTeams(QWidget* parent) :
- QFrame(parent), maxHedgehogsPerGame(48), overallHedgehogs(0), mainLayout(this), nonInteractive(false)
-{
- QPalette newPalette = palette();
- newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
- setPalette(newPalette);
- setAutoFillBackground(true);
-
- mainLayout.setSpacing(1);
- mainLayout.setContentsMargins(4, 4, 4, 4);
-
- int i = 0;
- while(colors[i] != 0)
- availableColors.push_back(QColor(colors[i++]));
-
- resetColors();
-}
-
-void FrameTeams::setInteractivity(bool interactive)
-{
- nonInteractive = !interactive;
- for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ++it) {
- TeamShowWidget* pts = dynamic_cast(it.value());
- if(!pts) throw;
- pts->setInteractivity(interactive);
- }
-}
-
-void FrameTeams::resetColors()
-{
- currentColor=availableColors.end() - 1; // ensure next color is the first one
-}
-
-QColor FrameTeams::getNextColor() const
-{
- QList::ConstIterator nextColor=currentColor;
- ++nextColor;
- if (nextColor==availableColors.end()) nextColor=availableColors.begin();
- return *nextColor;
-}
-
-void FrameTeams::addTeam(HWTeam team, bool willPlay)
-{
- TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this);
- if(nonInteractive) pTeamShowWidget->setInteractivity(false);
-// int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
- mainLayout.addWidget(pTeamShowWidget);
- teamToWidget.insert(team, pTeamShowWidget);
- QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
- QCoreApplication::postEvent(parentWidget(), pevent);
-}
-
-void FrameTeams::removeTeam(HWTeam team)
-{
- tmapTeamToWidget::iterator it=teamToWidget.find(team);
- if(it==teamToWidget.end()) return;
- mainLayout.removeWidget(it.value());
- it.value()->deleteLater();
- teamToWidget.erase(it);
-}
-
-void FrameTeams::resetTeams()
-{
- for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ) {
- mainLayout.removeWidget(it.value());
- it.value()->deleteLater();
- teamToWidget.erase(it++);
- }
-}
-
-void FrameTeams::setHHNum(const HWTeam& team)
-{
- TeamShowWidget* pTeamShowWidget = dynamic_cast(getTeamWidget(team));
- if(!pTeamShowWidget) return;
- pTeamShowWidget->setHHNum(team.numHedgehogs());
-}
-
-void FrameTeams::setTeamColor(const HWTeam& team)
-{
- TeamShowWidget* pTeamShowWidget = dynamic_cast(getTeamWidget(team));
- if(!pTeamShowWidget) return;
- pTeamShowWidget->changeTeamColor(team.color());
-}
-
-QWidget* FrameTeams::getTeamWidget(HWTeam team)
-{
-//qDebug() << "FrameTeams::getTeamWidget getNetID() = " << team.getNetID();
- tmapTeamToWidget::iterator it=teamToWidget.find(team);
- QWidget* ret = it!=teamToWidget.end() ? it.value() : 0;
- return ret;
-}
-
-bool FrameTeams::isFullTeams() const
-{
- return overallHedgehogs==maxHedgehogsPerGame;
-}
-
-void FrameTeams::emitTeamColorChanged(const HWTeam& team)
-{
- emit teamColorChanged(team);
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/frameTeam.h
--- a/QTfrontend/frameTeam.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2007 Igor Ulyanov
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _FRAME_TEAM_INCLUDED
-#define _FRAME_TEAM_INCLUDED
-
-#include
-#include
-#include
-
-#include "teamselect.h"
-
-class FrameTeams : public QFrame
-{
- Q_OBJECT
-
- friend class CHedgehogerWidget;
- friend class TeamShowWidget;
-
- public:
- FrameTeams(QWidget* parent=0);
- QWidget* getTeamWidget(HWTeam team);
- bool isFullTeams() const;
- void resetColors();
- void resetTeams();
- void setHHNum(const HWTeam& team);
- void setTeamColor(const HWTeam& team);
- void setInteractivity(bool interactive);
- QColor getNextColor() const;
-
- signals:
- void teamColorChanged(const HWTeam&);
-
- public slots:
- void addTeam(HWTeam team, bool willPlay);
- void removeTeam(HWTeam team);
-
- private:
- const int maxHedgehogsPerGame;
- int overallHedgehogs;
- QList availableColors;
- QList::Iterator currentColor;
-
- void emitTeamColorChanged(const HWTeam& team);
-
- QVBoxLayout mainLayout;
- typedef QMap tmapTeamToWidget;
- tmapTeamToWidget teamToWidget;
- bool nonInteractive;
-};
-
-#endif // _FRAME_TAM_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/game.cpp
--- a/QTfrontend/game.cpp Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/game.cpp Fri Oct 28 18:33:38 2011 +0200
@@ -41,7 +41,6 @@
{
this->config = config;
this->gamecfg = gamecfg;
- TeamCount = 0;
netSuspend = false;
}
@@ -120,13 +119,11 @@
.arg((themesModel->rowCount() > 0) ? themesModel->index(rand() % themesModel->rowCount()).data().toString() : "steel"));
HWProto::addStringToBuffer(teamscfg, "eseed " + QUuid::createUuid().toString());
- HWNamegen namegen;
-
HWTeam team1;
team1.setDifficulty(0);
team1.setColor(QColor(colors[0]));
team1.setNumHedgehogs(4);
- namegen.teamRandomNames(team1,TRUE);
+ HWNamegen::teamRandomNames(team1,true);
HWProto::addStringListToBuffer(teamscfg,
team1.teamGameConfig(100));
@@ -135,7 +132,7 @@
team2.setColor(QColor(colors[1]));
team2.setNumHedgehogs(4);
do
- namegen.teamRandomNames(team2,TRUE);
+ HWNamegen::teamRandomNames(team2,true);
while(!team2.name().compare(team1.name()) || !team2.hedgehog(0).Hat.compare(team1.hedgehog(0).Hat));
HWProto::addStringListToBuffer(teamscfg,
team2.teamGameConfig(100));
@@ -318,13 +315,6 @@
return arguments;
}
-void HWGame::AddTeam(const QString & teamname)
-{
- if (TeamCount == 5) return;
- teams[TeamCount] = teamname;
- TeamCount++;
-}
-
void HWGame::PlayDemo(const QString & demofilename, bool isSave)
{
gameType = isSave ? gtSave : gtDemo;
@@ -392,13 +382,9 @@
emit GameStateChanged(state);
}
-void HWGame::KillAllTeams()
+void HWGame::abort()
{
- if (m_pTeamSelWidget)
- {
- QByteArray buf;
- foreach(HWTeam team, m_pTeamSelWidget->getPlayingTeams())
- HWProto::addStringToBuffer(buf, QString("eteamgone %1").arg(team.name()));
- RawSendIPC(buf);
- }
+ QByteArray buf;
+ HWProto::addStringToBuffer(buf, QString("efinish"));
+ RawSendIPC(buf);
}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/game.h
--- a/QTfrontend/game.h Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/game.h Fri Oct 28 18:33:38 2011 +0200
@@ -54,7 +54,7 @@
void StartNet();
void StartTraining(const QString & file);
void StartCampaign(const QString & file);
- void KillAllTeams();
+ void abort();
GameState gameState;
bool netSuspend;
@@ -87,9 +87,7 @@
gtSave = 7,
};
char msgbuf[MAXMSGCHARS];
- QString teams[5];
QString ammostr;
- int TeamCount;
GameUIConfig * config;
GameCFGWidget * gamecfg;
TeamSelWidget* m_pTeamSelWidget;
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/gamecfgwidget.cpp
--- a/QTfrontend/gamecfgwidget.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,573 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "gamecfgwidget.h"
-#include "igbox.h"
-#include "hwconsts.h"
-#include "ammoSchemeModel.h"
-#include "proto.h"
-
-GameCFGWidget::GameCFGWidget(QWidget* parent) :
- QGroupBox(parent)
- , mainLayout(this)
- , seedRegexp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}")
-{
- mainLayout.setMargin(0);
-// mainLayout.setSizeConstraint(QLayout::SetMinimumSize);
-
- pMapContainer = new HWMapContainer(this);
- mainLayout.addWidget(pMapContainer, 0, 0);
-
- IconedGroupBox *GBoxOptions = new IconedGroupBox(this);
- GBoxOptions->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
- mainLayout.addWidget(GBoxOptions, 1, 0);
-
- QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions);
-
- GBoxOptions->setTitle(tr("Game Options"));
- GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), GBoxOptions), 1, 0);
-
- Scripts = new QComboBox(GBoxOptions);
- GBoxOptionsLayout->addWidget(Scripts, 1, 1);
-
- Scripts->addItem("Normal");
- Scripts->insertSeparator(1);
-
- for (int i = 0; i < scriptList->size(); ++i) {
- QString script = (*scriptList)[i].remove(".lua", Qt::CaseInsensitive);
- QList scriptInfo;
- scriptInfo.push_back(script);
- QFile scriptCfgFile;
- scriptCfgFile.setFileName(QString("%1/Data/Scripts/Multiplayer/%2.cfg").arg(cfgdir->absolutePath()).arg(script));
- if (!scriptCfgFile.exists()) scriptCfgFile.setFileName(QString("%1/Scripts/Multiplayer/%2.cfg").arg(datadir->absolutePath()).arg(script));
- if (scriptCfgFile.exists() && scriptCfgFile.open(QFile::ReadOnly)) {
- QString scheme;
- QString weapons;
- QTextStream input(&scriptCfgFile);
- input >> scheme;
- input >> weapons;
- if (scheme.isEmpty())
- scheme = "locked";
- scheme.replace("_", " ");
- if (weapons.isEmpty())
- weapons = "locked";
- weapons.replace("_", " ");
- scriptInfo.push_back(scheme);
- scriptInfo.push_back(weapons);
- scriptCfgFile.close();
- }
- else
- {
- scriptInfo.push_back("locked");
- scriptInfo.push_back("locked");
- }
- Scripts->addItem(script.replace("_", " "), scriptInfo);
- }
-
- connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int)));
-
- QWidget *SchemeWidget = new QWidget(GBoxOptions);
- GBoxOptionsLayout->addWidget(SchemeWidget, 2, 0, 1, 2);
-
- QGridLayout *SchemeWidgetLayout = new QGridLayout(SchemeWidget);
- SchemeWidgetLayout->setMargin(0);
-
- GameSchemes = new QComboBox(SchemeWidget);
- SchemeWidgetLayout->addWidget(GameSchemes, 0, 2);
- connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int)));
-
- SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0);
-
- QPixmap pmEdit(":/res/edit.png");
-
- QPushButton * goToSchemePage = new QPushButton(SchemeWidget);
- goToSchemePage->setToolTip(tr("Edit schemes"));
- goToSchemePage->setIconSize(pmEdit.size());
- goToSchemePage->setIcon(pmEdit);
- goToSchemePage->setMaximumWidth(pmEdit.width() + 6);
- SchemeWidgetLayout->addWidget(goToSchemePage, 0, 3);
- connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes()));
-
- SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0);
-
- WeaponsName = new QComboBox(SchemeWidget);
- SchemeWidgetLayout->addWidget(WeaponsName, 1, 2);
-
- connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
-
- QPushButton * goToWeaponPage = new QPushButton(SchemeWidget);
- goToWeaponPage->setToolTip(tr("Edit weapons"));
- goToWeaponPage->setIconSize(pmEdit.size());
- goToWeaponPage->setIcon(pmEdit);
- goToWeaponPage->setMaximumWidth(pmEdit.width() + 6);
- SchemeWidgetLayout->addWidget(goToWeaponPage, 1, 3);
- connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons()));
-
- bindEntries = new QCheckBox(SchemeWidget);
- bindEntries->setToolTip(tr("When this option is enabled selecting a game scheme will auto-select a weapon"));
- bindEntries->setChecked(true);
- bindEntries->setMaximumWidth(42);
- bindEntries->setStyleSheet( "QCheckBox::indicator:checked { image: url(\":/res/lock.png\"); }"
- "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\"); }" );
- SchemeWidgetLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter);
-
- connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &)));
- connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &)));
- connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator)));
- connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int)));
- connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &)));
- connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int)));
- connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap()));
- connect(pMapContainer, SIGNAL(drawnMapChanged(const QByteArray &)), this, SLOT(onDrawnMapChanged(const QByteArray &)));
-}
-
-void GameCFGWidget::jumpToSchemes()
-{
- emit goToSchemes(GameSchemes->currentIndex());
-}
-
-void GameCFGWidget::jumpToWeapons()
-{
- emit goToWeapons(WeaponsName->currentIndex());
-}
-
-QVariant GameCFGWidget::schemeData(int column) const
-{
- return GameSchemes->model()->data(GameSchemes->model()->index(GameSchemes->currentIndex(), column));
-}
-
-quint32 GameCFGWidget::getGameFlags() const
-{
- quint32 result = 0;
-
- if (schemeData(1).toBool())
- result |= 0x00001000; // fort
- if (schemeData(2).toBool())
- result |= 0x00000010; // divide teams
- if (schemeData(3).toBool())
- result |= 0x00000004; // solid land
- if (schemeData(4).toBool())
- result |= 0x00000008; // border
- if (schemeData(5).toBool())
- result |= 0x00000020; // low gravity
- if (schemeData(6).toBool())
- result |= 0x00000040; // laser sight
- if (schemeData(7).toBool())
- result |= 0x00000080; // invulnerable
- if (schemeData(8).toBool())
- result |= 0x00000100; // mines
- if (schemeData(9).toBool())
- result |= 0x00000200; // vampirism
- if (schemeData(10).toBool())
- result |= 0x00000400; // karma
- if (schemeData(11).toBool())
- result |= 0x00000800; // artillery
- if (schemeData(12).toBool())
- result |= 0x00002000; // random
- if (schemeData(13).toBool())
- result |= 0x00004000; // king
- if (schemeData(14).toBool())
- result |= 0x00008000; // place hogs
- if (schemeData(15).toBool())
- result |= 0x00010000; // shared ammo
- if (schemeData(16).toBool())
- result |= 0x00020000; // disable girders
- if (schemeData(17).toBool())
- result |= 0x00040000; // disable land obj
- if (schemeData(18).toBool())
- result |= 0x00080000; // ai survival
- if (schemeData(19).toBool())
- result |= 0x00100000; // infinite attacks
- if (schemeData(20).toBool())
- result |= 0x00200000; // reset weaps
- if (schemeData(21).toBool())
- result |= 0x00400000; // per hog ammo
- if (schemeData(22).toBool())
- result |= 0x00800000; // no wind
- if (schemeData(23).toBool())
- result |= 0x01000000; // more wind
- if (schemeData(24).toBool())
- result |= 0x02000000; // tag team
- if (schemeData(25).toBool())
- result |= 0x04000000; // bottom border
-
- return result;
-}
-
-quint32 GameCFGWidget::getInitHealth() const
-{
- return schemeData(28).toInt();
-}
-
-QByteArray GameCFGWidget::getFullConfig() const
-{
- QList bcfg;
- int mapgen = pMapContainer->get_mapgen();
-
- QString currentMap = pMapContainer->getCurrentMap();
- if (currentMap.size() > 0)
- {
- bcfg << QString("emap " + currentMap).toUtf8();
- if(pMapContainer->getCurrentIsMission())
- bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8();
- }
- bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8();
-
- if (Scripts->currentIndex() > 0)
- {
- bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex()).toList()[0].toString()).toUtf8();
- }
-
- bcfg << QString("eseed " + pMapContainer->getCurrentSeed()).toUtf8();
- bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8();
- bcfg << QString("e$damagepct %1").arg(schemeData(26).toInt()).toUtf8();
- bcfg << QString("e$turntime %1").arg(schemeData(27).toInt() * 1000).toUtf8();
- bcfg << QString("e$sd_turns %1").arg(schemeData(29).toInt()).toUtf8();
- bcfg << QString("e$casefreq %1").arg(schemeData(30).toInt()).toUtf8();
- bcfg << QString("e$minestime %1").arg(schemeData(31).toInt() * 1000).toUtf8();
- bcfg << QString("e$minesnum %1").arg(schemeData(32).toInt()).toUtf8();
- bcfg << QString("e$minedudpct %1").arg(schemeData(33).toInt()).toUtf8();
- bcfg << QString("e$explosives %1").arg(schemeData(34).toInt()).toUtf8();
- bcfg << QString("e$healthprob %1").arg(schemeData(35).toInt()).toUtf8();
- bcfg << QString("e$hcaseamount %1").arg(schemeData(36).toInt()).toUtf8();
- bcfg << QString("e$waterrise %1").arg(schemeData(37).toInt()).toUtf8();
- bcfg << QString("e$healthdec %1").arg(schemeData(38).toInt()).toUtf8();
- bcfg << QString("e$ropepct %1").arg(schemeData(39).toInt()).toUtf8();
- bcfg << QString("e$getawaytime %1").arg(schemeData(40).toInt()).toUtf8();
- bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8();
- bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8();
-
- switch (mapgen)
- {
- case MAPGEN_MAZE:
- bcfg << QString("e$maze_size %1").arg(pMapContainer->getMazeSize()).toUtf8();
- break;
-
- case MAPGEN_DRAWN:
- {
- QByteArray data = pMapContainer->getDrawnMapData();
- while(data.size() > 0)
- {
- QByteArray tmp = data;
- tmp.truncate(200);
- tmp.prepend("edraw ");
- bcfg << tmp;
- data.remove(0, 200);
- }
- break;
- }
- default: ;
- }
-
- QByteArray result;
-
- foreach(QByteArray ba, bcfg)
- HWProto::addByteArrayToBuffer(result, ba);
-
- return result;
-}
-
-void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
-{
- bool illegal = ammo.size() != cDefaultAmmoStore->size();
- if (illegal)
- QMessageBox::critical(this, tr("Error"), tr("Illegal ammo scheme"));
-
- int pos = WeaponsName->findText(name);
- if ((pos == -1) || illegal) { // prevent from overriding schemes with bad ones
- WeaponsName->addItem(name, ammo);
- WeaponsName->setCurrentIndex(WeaponsName->count() - 1);
- } else {
- WeaponsName->setItemData(pos, ammo);
- WeaponsName->setCurrentIndex(pos);
- }
-}
-
-void GameCFGWidget::fullNetConfig()
-{
- ammoChanged(WeaponsName->currentIndex());
-
- seedChanged(pMapContainer->getCurrentSeed());
- templateFilterChanged(pMapContainer->getTemplateFilter());
- themeChanged(pMapContainer->getCurrentTheme());
-
- schemeChanged(GameSchemes->currentIndex());
- scriptChanged(Scripts->currentIndex());
-
- mapgenChanged(pMapContainer->get_mapgen());
- maze_sizeChanged(pMapContainer->getMazeSize());
-
- // map must be the last
- QString map = pMapContainer->getCurrentMap();
- if (map.size())
- mapChanged(map);
-}
-
-void GameCFGWidget::setParam(const QString & param, const QStringList & slValue)
-{
- if (slValue.size() == 1)
- {
- QString value = slValue[0];
- if (param == "MAP") {
- pMapContainer->setMap(value);
- return;
- }
- if (param == "SEED") {
- pMapContainer->setSeed(value);
- if (!seedRegexp.exactMatch(value)) {
- pMapContainer->seedEdit->setVisible(true);
- }
- return;
- }
- if (param == "THEME") {
- pMapContainer->setTheme(value);
- return;
- }
- if (param == "TEMPLATE") {
- pMapContainer->setTemplateFilter(value.toUInt());
- return;
- }
- if (param == "MAPGEN") {
- pMapContainer->setMapgen((MapGenerator)value.toUInt());
- return;
- }
- if (param == "MAZE_SIZE") {
- pMapContainer->setMazeSize(value.toUInt());
- return;
- }
- if (param == "SCRIPT") {
- Scripts->setCurrentIndex(Scripts->findText(value));
- return;
- }
- if (param == "DRAWNMAP") {
- pMapContainer->setDrawnMapData(qUncompress(QByteArray::fromBase64(slValue[0].toLatin1())));
- return;
- }
- }
-
- if (slValue.size() == 2)
- {
- if (param == "AMMO") {
- setNetAmmo(slValue[0], slValue[1]);
- return;
- }
- }
-
- if (slValue.size() == 5)
- {
- if (param == "FULLMAPCONFIG")
- {
- QString seed = slValue[3];
- if (!seedRegexp.exactMatch(seed))
- pMapContainer->seedEdit->setVisible(true);
-
- pMapContainer->setAllMapParameters(
- slValue[0],
- (MapGenerator)slValue[1].toUInt(),
- slValue[2].toUInt(),
- seed,
- slValue[4].toUInt()
- );
- return;
- }
- }
-
- qWarning("Got bad config param from net");
-}
-
-void GameCFGWidget::ammoChanged(int index)
-{
- if (index >= 0) {
- emit paramChanged(
- "AMMO",
- QStringList() << WeaponsName->itemText(index) << WeaponsName->itemData(index).toString()
- );
- }
-}
-
-void GameCFGWidget::mapChanged(const QString & value)
-{
- if(isEnabled() && pMapContainer->getCurrentIsMission())
- {
- Scripts->setEnabled(false);
- Scripts->setCurrentIndex(0);
-
- if (pMapContainer->getCurrentScheme() == "locked")
- {
- GameSchemes->setEnabled(false);
- GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
- }
- else
- {
- GameSchemes->setEnabled(true);
- int num = GameSchemes->findText(pMapContainer->getCurrentScheme());
- if (num != -1)
- GameSchemes->setCurrentIndex(num);
- else
- GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
- }
-
- if (pMapContainer->getCurrentWeapons() == "locked")
- {
- WeaponsName->setEnabled(false);
- WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
- }
- else
- {
- WeaponsName->setEnabled(true);
- int num = WeaponsName->findText(pMapContainer->getCurrentWeapons());
- if (num != -1)
- WeaponsName->setCurrentIndex(num);
- else
- WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
- }
-
- if (pMapContainer->getCurrentScheme() != "locked" && pMapContainer->getCurrentWeapons() != "locked")
- bindEntries->setEnabled(true);
- else
- bindEntries->setEnabled(false);
- }
- else
- {
- Scripts->setEnabled(true);
- GameSchemes->setEnabled(true);
- WeaponsName->setEnabled(true);
- bindEntries->setEnabled(true);
- }
- emit paramChanged("MAP", QStringList(value));
-}
-
-void GameCFGWidget::templateFilterChanged(int value)
-{
- emit paramChanged("TEMPLATE", QStringList(QString::number(value)));
-}
-
-void GameCFGWidget::seedChanged(const QString & value)
-{
- emit paramChanged("SEED", QStringList(value));
-}
-
-void GameCFGWidget::themeChanged(const QString & value)
-{
- emit paramChanged("THEME", QStringList(value));
-}
-
-void GameCFGWidget::schemeChanged(int index)
-{
- QStringList sl;
-
- int size = GameSchemes->model()->columnCount();
- for(int i = 0; i < size; ++i)
- sl << schemeData(i).toString();
-
- emit paramChanged("SCHEME", sl);
-
- if (isEnabled() && bindEntries->isEnabled() && bindEntries->isChecked()) {
- QString schemeName = GameSchemes->itemText(index);
- for (int i = 0; i < WeaponsName->count(); i++) {
- QString weapName = WeaponsName->itemText(i);
- int res = QString::compare(weapName, schemeName, Qt::CaseSensitive);
- if (0 == res) {
- WeaponsName->setCurrentIndex(i);
- emit ammoChanged(i);
- break;
- }
- }
- }
-}
-
-void GameCFGWidget::scriptChanged(int index)
-{
- if(isEnabled() && index > 0)
- {
- QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString();
- QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[2].toString();
-
- if (scheme == "locked")
- {
- GameSchemes->setEnabled(false);
- GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
- }
- else
- {
- GameSchemes->setEnabled(true);
- int num = GameSchemes->findText(scheme);
- if (num != -1)
- GameSchemes->setCurrentIndex(num);
- else
- GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
- }
-
- if (weapons == "locked")
- {
- WeaponsName->setEnabled(false);
- WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
- }
- else
- {
- WeaponsName->setEnabled(true);
- int num = WeaponsName->findText(weapons);
- if (num != -1)
- WeaponsName->setCurrentIndex(num);
- else
- WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
- }
-
- if (scheme != "locked" && weapons != "locked")
- bindEntries->setEnabled(true);
- else
- bindEntries->setEnabled(false);
- }
- else
- {
- GameSchemes->setEnabled(true);
- WeaponsName->setEnabled(true);
- bindEntries->setEnabled(true);
- }
- emit paramChanged("SCRIPT", QStringList(Scripts->itemText(index)));
-}
-
-void GameCFGWidget::mapgenChanged(MapGenerator m)
-{
- emit paramChanged("MAPGEN", QStringList(QString::number(m)));
-}
-
-void GameCFGWidget::maze_sizeChanged(int s)
-{
- emit paramChanged("MAZE_SIZE", QStringList(QString::number(s)));
-}
-
-void GameCFGWidget::resendSchemeData()
-{
- schemeChanged(GameSchemes->currentIndex());
-}
-
-void GameCFGWidget::onDrawnMapChanged(const QByteArray & data)
-{
- emit paramChanged("DRAWNMAP", QStringList(qCompress(data, 9).toBase64()));
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/gamecfgwidget.h
--- a/QTfrontend/gamecfgwidget.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef GAMECONFIGWIDGET_H
-#define GAMECONFIGWIDGET_H
-
-#include
-#include
-#include
-#include
-#include
-
-#include "mapContainer.h"
-
-class QCheckBox;
-class QVBoxLayout;
-class QLabel;
-class QTableView;
-
-class GameCFGWidget : public QGroupBox
-{
- Q_OBJECT
-
-public:
- GameCFGWidget(QWidget* parent);
- quint32 getGameFlags() const;
- quint32 getInitHealth() const;
- QByteArray getFullConfig() const;
- QComboBox * Scripts;
- QComboBox * GameSchemes;
- QComboBox * WeaponsName;
- HWMapContainer* pMapContainer;
- QTableView * tv;
- QVariant schemeData(int column) const;
-
-public slots:
- void setParam(const QString & param, const QStringList & value);
- void fullNetConfig();
- void resendSchemeData();
-
-signals:
- void paramChanged(const QString & param, const QStringList & value);
- void goToSchemes(int);
- void goToWeapons(int);
- void goToDrawMap();
-
-private slots:
- void ammoChanged(int index);
- void mapChanged(const QString &);
- void templateFilterChanged(int);
- void seedChanged(const QString &);
- void themeChanged(const QString &);
- void schemeChanged(int);
- void scriptChanged(int);
- void jumpToSchemes();
- void jumpToWeapons();
- void mapgenChanged(MapGenerator m);
- void maze_sizeChanged(int s);
- void onDrawnMapChanged(const QByteArray & data);
-
-private:
- QGridLayout mainLayout;
- QCheckBox * bindEntries;
- QString curNetAmmoName;
- QString curNetAmmo;
- QRegExp seedRegexp;
-
- void setNetAmmo(const QString& name, const QString& ammo);
-
-};
-
-#endif // GAMECONFIGWIDGET_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hats.cpp
--- a/QTfrontend/hats.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2008-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-#include "hwconsts.h"
-#include "hwform.h"
-#include "hats.h"
-
-HatsModel::HatsModel(QObject* parent) :
- QAbstractListModel(parent)
-{
- QFile hhfile;
- hhfile.setFileName(cfgdir->absolutePath() + "/Data/Graphics/Hedgehog/Idle.png");
- if (!hhfile.exists()) hhfile.setFileName(datadir->absolutePath() + "/Graphics/Hedgehog/Idle.png");
- QPixmap hhpix = QPixmap(QFileInfo(hhfile).absoluteFilePath()).copy(0, 0, 32, 32);
-
- QDir tmpdir;
- tmpdir.cd(cfgdir->absolutePath());
- tmpdir.cd("Data");
- tmpdir.cd("Graphics");
- tmpdir.cd("Hats");
-
- tmpdir.setFilter(QDir::Files);
-
- QStringList userhatsList = tmpdir.entryList(QStringList("*.png"));
- for (QStringList::Iterator it = userhatsList.begin(); it != userhatsList.end(); ++it )
- {
- QString str = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1");
- QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Hats/" + str + ".png");
-
- QPixmap tmppix(32, 37);
- tmppix.fill(QColor(Qt::transparent));
-
- QPainter painter(&tmppix);
- painter.drawPixmap(QPoint(0, 5), hhpix);
- painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32));
- if(pix.width() > 32)
- painter.drawPixmap(QPoint(0, 0), pix.copy(32, 0, 32, 32));
- painter.end();
-
- hats.append(qMakePair(str, QIcon(tmppix)));
- }
-
- tmpdir.cd(datadir->absolutePath());
- tmpdir.cd("Graphics");
- tmpdir.cd("Hats");
-
- QStringList hatsList = tmpdir.entryList(QStringList("*.png"));
- for (QStringList::Iterator it = hatsList.begin(); it != hatsList.end(); ++it )
- {
- if (userhatsList.contains(*it,Qt::CaseInsensitive)) continue;
- QString str = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
- QPixmap pix(datadir->absolutePath() + "/Graphics/Hats/" + str + ".png");
-
- QPixmap tmppix(32, 37);
- tmppix.fill(QColor(Qt::transparent));
-
- QPainter painter(&tmppix);
- painter.drawPixmap(QPoint(0, 5), hhpix);
- painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32));
- if(pix.width() > 32)
- painter.drawPixmap(QPoint(0, 0), pix.copy(32, 0, 32, 32));
- painter.end();
-
- hats.append(qMakePair(str, QIcon(tmppix)));
- }
- // Reserved hats
- tmpdir.cd("Reserved");
- hatsList = tmpdir.entryList(QStringList(playerHash+"*.png"));
- for (QStringList::Iterator it = hatsList.begin(); it != hatsList.end(); ++it )
- {
- QString str = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
- QPixmap pix(datadir->absolutePath() + "/Graphics/Hats/Reserved/" + str + ".png");
-
- QPixmap tmppix(32, 37);
- tmppix.fill(QColor(Qt::transparent));
-
- QPainter painter(&tmppix);
- painter.drawPixmap(QPoint(0, 5), hhpix);
- painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32));
- painter.end();
-
- hats.append(qMakePair("Reserved "+str.remove(0,32), QIcon(tmppix)));
- }
-}
-
-QVariant HatsModel::headerData(int section,
- Qt::Orientation orientation, int role) const
-{
- Q_UNUSED(section);
- Q_UNUSED(orientation);
- Q_UNUSED(role);
-
- return QVariant();
-}
-
-int HatsModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.isValid())
- return 0;
- else
- return hats.size();
-}
-
-/*int HatsModel::columnCount(const QModelIndex & parent) const
-{
- if (parent.isValid())
- return 0;
- else
- return 2;
-}
-*/
-QVariant HatsModel::data(const QModelIndex &index,
- int role) const
-{
- if (!index.isValid() || index.row() < 0
- || index.row() >= hats.size()
- || (role != Qt::DisplayRole && role != Qt::DecorationRole))
- return QVariant();
-
- if (role == Qt::DisplayRole)
- return hats.at(index.row()).first;
- else // role == Qt::DecorationRole
- return hats.at(index.row()).second;
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hats.h
--- a/QTfrontend/hats.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2008-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _HATS_INCLUDED
-#define _HATS_INCLUDED
-
-#include
-#include
-#include
-#include
-#include
-
-class HatsModel : public QAbstractListModel
-{
- Q_OBJECT
-
-public:
- HatsModel(QObject *parent = 0);
-
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- int rowCount(const QModelIndex & parent) const;
- //int columnCount(const QModelIndex & parent) const;
-
- QVariant data(const QModelIndex &index, int role) const;
-protected:
- QVector > hats;
-};
-
-#endif // _HATS_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hedgehogerWidget.cpp
--- a/QTfrontend/hedgehogerWidget.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2008 Ulyanov Igor
- * Copyright (c) 2008-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "hedgehogerWidget.h"
-
-#include "frameTeam.h"
-
-CHedgehogerWidget::CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent) :
- ItemNum(im, img, parent, 1)
-{
- // TODO: maxHedgehogsPerGame doesn't reset properly and won't match map limits for now
- /*if(parent) {
- pOurFrameTeams = dynamic_cast(parent->parentWidget());
- }
- if(pOurFrameTeams->overallHedgehogs + 4 > pOurFrameTeams->maxHedgehogsPerGame) {
- numItems = pOurFrameTeams->maxHedgehogsPerGame - pOurFrameTeams->overallHedgehogs;
- } else numItems = 4;
- pOurFrameTeams->overallHedgehogs += numItems;*/
-}
-
-void CHedgehogerWidget::incItems()
-{
- //if (pOurFrameTeams->overallHedgehogs < pOurFrameTeams->maxHedgehogsPerGame) {
- numItems++;
- //pOurFrameTeams->overallHedgehogs++;
- emit hedgehogsNumChanged();
- //}
-}
-
-void CHedgehogerWidget::decItems()
-{
- numItems--;
- //pOurFrameTeams->overallHedgehogs--;
- emit hedgehogsNumChanged();
-}
-
-CHedgehogerWidget::~CHedgehogerWidget()
-{
- // TODO: not called?
- //pOurFrameTeams->overallHedgehogs-=numItems;
-}
-
-void CHedgehogerWidget::setNonInteractive()
-{
- nonInteractive=true;
-}
-
-void CHedgehogerWidget::setHHNum(unsigned int num)
-{
- /*unsigned int diff = num - numItems;
- numItems += diff;
- pOurFrameTeams->overallHedgehogs += diff;*/
- numItems = num;
- repaint();
-}
-
-unsigned char CHedgehogerWidget::getHedgehogsNum() const
-{
- return numItems;
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hedgehogerWidget.h
--- a/QTfrontend/hedgehogerWidget.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2007 Ulyanov Igor
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _HEDGEHOGER_WIDGET
-#define _HEDGEHOGER_WIDGET
-
-#include "itemNum.h"
-
-class FrameTeams;
-
-class CHedgehogerWidget : public ItemNum
-{
- Q_OBJECT
-
- public:
- CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent);
- virtual ~CHedgehogerWidget();
- unsigned char getHedgehogsNum() const;
- void setHHNum (unsigned int num);
- void setNonInteractive();
-
- signals:
- void hedgehogsNumChanged();
-
- protected:
- virtual void incItems();
- virtual void decItems();
-
- private:
- CHedgehogerWidget();
- FrameTeams* pOurFrameTeams;
-};
-
-#endif // _HEDGEHOGER_WIDGET
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/hedgewars.qrc Fri Oct 28 18:33:38 2011 +0200
@@ -1,6 +1,8 @@
../share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png
+ res/css/qt.css
+ res/css/chat.css
res/hh25x25.png
res/hh25x25grey.png
res/ammopic.png
@@ -45,6 +47,7 @@
res/unchecked.png
res/graphicsicon.png
res/miscicon.png
+ res/Load.png
res/Save.png
res/Record.png
res/weaponsicon.png
@@ -57,31 +60,31 @@
res/PlaySound.png
res/hh_small.png
res/btnDisabled.png
- res/btnForts.png
- res/btnBorder.png
- res/btnInvulnerable.png
- res/btnLaserSight.png
- res/btnLowGravity.png
- res/btnResetHealth.png
- res/btnTeamsDivide.png
- res/btnSolid.png
- res/btnVampiric.png
- res/btnKarma.png
- res/btnArtillery.png
- res/btnRandomOrder.png
- res/btnKing.png
- res/btnPlaceHog.png
- res/btnSharedAmmo.png
- res/btnDisableGirders.png
- res/btnDisableLandObjects.png
- res/btnAISurvival.png
- res/btnInfAttack.png
- res/btnResetWeps.png
- res/btnPerHogAmmo.png
- res/btnNoWind.png
- res/btnMoreWind.png
- res/btnTagTeam.png
- res/btnBottomBorder.png
+ res/btnForts@2x.png
+ res/btnBorder@2x.png
+ res/btnInvulnerable@2x.png
+ res/btnLaserSight@2x.png
+ res/btnLowGravity@2x.png
+ res/btnResetHealth@2x.png
+ res/btnTeamsDivide@2x.png
+ res/btnSolid@2x.png
+ res/btnVampiric@2x.png
+ res/btnKarma@2x.png
+ res/btnArtillery@2x.png
+ res/btnRandomOrder@2x.png
+ res/btnKing@2x.png
+ res/btnPlaceHog@2x.png
+ res/btnSharedAmmo@2x.png
+ res/btnDisableGirders@2x.png
+ res/btnDisableLandObjects@2x.png
+ res/btnAISurvival@2x.png
+ res/btnInfAttack@2x.png
+ res/btnResetWeps@2x.png
+ res/btnPerHogAmmo@2x.png
+ res/btnNoWind@2x.png
+ res/btnMoreWind@2x.png
+ res/btnTagTeam@2x.png
+ res/btnBottomBorder@2x.png
res/iconBox.png
res/iconHealth.png
res/iconSuddenDeath.png
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/hwform.cpp Fri Oct 28 18:33:38 2011 +0200
@@ -44,7 +44,6 @@
#include "hwform.h"
#include "game.h"
#include "team.h"
-#include "namegen.h"
#include "teamselect.h"
#include "selectWeapon.h"
#include "gameuiconfig.h"
@@ -81,6 +80,8 @@
#include "xfire.h"
#include "drawmapwidget.h"
+#include "HWDataManager.h"
+
#ifdef __APPLE__
#include "M3Panel.h"
#ifdef SPARKLE_ENABLED
@@ -95,12 +96,21 @@
QString playerHash;
HWForm::HWForm(QWidget *parent, QString styleSheet)
- : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
+ : QMainWindow(parent)
+ , game(0)
+ , pnetserver(0)
+ , pRegisterServer(0)
+ , editedTeam(0)
+ , hwnet(0)
{
+ // set music track
+ SDLInteraction::instance().setMusicTrack(
+ HWDataManager::instance().findFileForRead("Music/main_theme.ogg")
+ );
+
#ifdef USE_XFIRE
xfire_init();
#endif
- game = NULL;
gameSettings = new QSettings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
frontendEffects = gameSettings->value("frontend/effects", true).toBool();
playerHash = QString(QCryptographicHash::hash(gameSettings->value("net/nick","").toString().toLatin1(), QCryptographicHash::Md5).toHex());
@@ -111,11 +121,10 @@
//setFocusPolicy(Qt::StrongFocus);
CustomizePalettes();
- ui.pageOptions->CBResolution->addItems(sdli.getResolutions());
+ ui.pageOptions->CBResolution->addItems(SDLInteraction::instance().getResolutions());
config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
- namegen = new HWNamegen();
#ifdef __APPLE__
panel = new M3Panel;
@@ -167,14 +176,10 @@
connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD);
- connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
- connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
+ //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
+ //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
- connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave()));
- connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard()));
-
- connect(ui.pageEditTeam->signalMapper2, SIGNAL(mapped(const int &)), this, SLOT(RandomName(const int &)));
- connect(ui.pageEditTeam->randTeamButton, SIGNAL(clicked()), this, SLOT(RandomNames()));
+ connect(ui.pageEditTeam, SIGNAL(teamEdited()), this, SLOT(AfterTeamEdit()));
connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
@@ -189,11 +194,11 @@
connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo()));
- connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam()));
- connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam()));
- connect(ui.pageOptions->BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(DeleteTeam()));
- connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions()));
- connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack()));
+ connect(ui.pageOptions, SIGNAL(newTeamRequested()), this, SLOT(NewTeam()));
+ connect(ui.pageOptions, SIGNAL(editTeamRequested(const QString&)), this, SLOT(EditTeam(const QString&)));
+ connect(ui.pageOptions, SIGNAL(deleteTeamRequested(const QString&)), this, SLOT(DeleteTeam(const QString&)));
+ connect(ui.pageOptions->btnSave, SIGNAL(clicked()), config, SLOT(SaveOptions()));
+ connect(ui.pageOptions->btnSave, SIGNAL(clicked()), this, SLOT(GoBack()));
connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
@@ -240,7 +245,7 @@
connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves()));
connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
- connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining()));
+ connect(ui.pageTraining, SIGNAL(startMission(const QString&)), this, SLOT(startTraining(const QString&)));
connect(ui.pageCampaign->BtnStartCampaign, SIGNAL(clicked()), this, SLOT(StartCampaign()));
connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
@@ -281,26 +286,27 @@
#ifdef USE_XFIRE
void HWForm::updateXfire(void)
{
- if(hwnet)
+ if(hwnet && (hwnet->clientState() != HWNewNet::Disconnected))
{
xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare("netserver.hedgewars.org:46631") ? "Official server" : hwnet->getHost().toAscii());
- switch(hwnet->getClientState())
+ switch(hwnet->clientState())
{
- case 1: // Connecting
+ case HWNewNet::Connecting: // Connecting
+ case HWNewNet::Connected:
xfire_setvalue(XFIRE_STATUS, "Connecting");
xfire_setvalue(XFIRE_NICKNAME, "-");
xfire_setvalue(XFIRE_ROOM, "-");
- case 2: // In lobby
+ case HWNewNet::InLobby: // In lobby
xfire_setvalue(XFIRE_STATUS, "Online");
xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
xfire_setvalue(XFIRE_ROOM, "In game lobby");
break;
- case 3: // In room
+ case HWNewNet::InRoom: // In room
xfire_setvalue(XFIRE_STATUS, "Online");
xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (waiting for players)").toAscii());
break;
- case 5: // In game
+ case HWNewNet::InGame: // In game
xfire_setvalue(XFIRE_STATUS, "Online");
xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (playing or spectating)").toAscii());
@@ -456,6 +462,10 @@
#ifdef USE_XFIRE
updateXfire();
#endif
+ if (id == ID_PAGE_DATADOWNLOAD)
+ {
+ ui.pageDataDownload->fetchList();
+ }
if (id == ID_PAGE_DRAWMAP) {
DrawMapScene * scene;
if(lastid == ID_PAGE_MULTIPLAYER)
@@ -473,14 +483,18 @@
ui.pageNetGame->pGameCFG->pMapContainer->mapDrawingFinished();
}
+ if (id == ID_PAGE_ROOMSLIST) {
+ if (hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills.
+ game->netSuspend = true;
+ ui.pageRoomsList->displayWarning(tr("Game aborted"));
+ game->abort();
+ }
+ }
+
if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
QStringList tmNames = config->GetTeamsList();
TeamSelWidget* curTeamSelWidget;
- ui.pageOptions->BtnNewTeam->setVisible(false);
- ui.pageOptions->BtnEditTeam->setVisible(false);
- ui.pageOptions->BtnDeleteTeam->setVisible(false);
- ui.pageOptions->CBTeamName->setVisible(false);
- ui.pageOptions->LblNoEditTeam->setVisible(true);
+ ui.pageOptions->setTeamOptionsEnabled(false);
if (id == ID_PAGE_MULTIPLAYER) {
curTeamSelWidget = ui.pageMultiplayer->teamsSelect;
@@ -511,11 +525,7 @@
}
if (id == ID_PAGE_MAIN) {
- ui.pageOptions->BtnNewTeam->setVisible(true);
- ui.pageOptions->BtnEditTeam->setVisible(true);
- ui.pageOptions->BtnDeleteTeam->setVisible(true);
- ui.pageOptions->CBTeamName->setVisible(true);
- ui.pageOptions->LblNoEditTeam->setVisible(false);
+ ui.pageOptions->setTeamOptionsEnabled(true);
}
// load and save ignore/friends lists
@@ -527,13 +537,9 @@
if (id == ID_PAGE_NETGAME) // joining a room
ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text());
// joining the lobby
- else if (id == ID_PAGE_ROOMSLIST) {
- if (hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills.
- game->netSuspend = true;
- game->KillAllTeams();
- }
+ else if (id == ID_PAGE_ROOMSLIST)
ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text());
- }
+
}
void HWForm::GoToPage(int id)
@@ -546,8 +552,11 @@
void HWForm::GoBack()
{
+ int curid = ui.Pages->currentIndex();
+ if (curid == ID_PAGE_MAIN)
+ exit();
+
int id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
- int curid = ui.Pages->currentIndex();
ui.Pages->setCurrentIndex(id);
OnPageShown(id, curid);
@@ -563,7 +572,7 @@
GoBack();
if (curid == ID_PAGE_ROOMSLIST || curid == ID_PAGE_CONNECTING) NetDisconnect();
- if (curid == ID_PAGE_NETGAME && hwnet) hwnet->partRoom();
+ if (curid == ID_PAGE_NETGAME && hwnet && hwnet->isInRoom()) hwnet->partRoom();
// need to work on this, can cause invalid state for admin quit trying to prevent bad state message on kick
//if (curid == ID_PAGE_NETGAME && (!game || game->gameState != gsStarted)) hwnet->partRoom();
@@ -582,14 +591,15 @@
eggTimer.start();
}
-void HWForm::btnExitClicked()
+void HWForm::exit()
{
- if (eggTimer.elapsed() < 3000){
+// if (eggTimer.elapsed() < 3000){
#ifdef __APPLE__
panel->showInstallController();
#endif
close();
- }
+// TODO reactivate egg
+/* }
else
{
QPushButton * btn = findChild("imageButt");
@@ -597,7 +607,7 @@
{
btn->setIcon(QIcon(":/res/bonus.png"));
}
- }
+ } */
}
void HWForm::IntermediateSetup()
@@ -624,61 +634,30 @@
void HWForm::NewTeam()
{
- editedTeam = new HWTeam(QLineEdit::tr("unnamed"));
- editedTeam->SetToPage(this);
- GoToPage(ID_PAGE_SETUP_TEAM);
-}
-
-void HWForm::EditTeam()
-{
- editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
- editedTeam->loadFromFile();
- editedTeam->SetToPage(this);
+ ui.pageEditTeam->createTeam(QLineEdit::tr("unnamed"), playerHash);
+ UpdateTeamsLists();
GoToPage(ID_PAGE_SETUP_TEAM);
}
-void HWForm::DeleteTeam()
+void HWForm::EditTeam(const QString & teamName)
{
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel);
-
- if (reallyDelete.exec() == QMessageBox::Ok) {
- editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
- editedTeam->deleteFile();
-
- // Remove from lists
- ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
- }
+ ui.pageEditTeam->editTeam(teamName, playerHash);
+ GoToPage(ID_PAGE_SETUP_TEAM);
}
-void HWForm::RandomNames()
-{
- editedTeam->GetFromPage(this);
- namegen->teamRandomNames(*editedTeam, true);
- editedTeam->SetToPage(this);
-}
-
-void HWForm::RandomName(const int &i)
+void HWForm::AfterTeamEdit()
{
- editedTeam->GetFromPage(this);
- namegen->teamRandomName(*editedTeam,i);
- editedTeam->SetToPage(this);
-}
-
-void HWForm::TeamSave()
-{
- editedTeam->GetFromPage(this);
- editedTeam->saveToFile();
- delete editedTeam;
- editedTeam=0;
UpdateTeamsLists();
GoBack();
}
-void HWForm::TeamDiscard()
+
+void HWForm::DeleteTeam(const QString & teamName)
{
- delete editedTeam;
- editedTeam=0;
- GoBack();
+ ui.pageEditTeam->deleteTeam(teamName);
+ QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel);
+
+ UpdateTeamsLists();
}
void HWForm::DeleteScheme()
@@ -798,19 +777,19 @@
ShowErrorMessage(errmsg);
// no break
case ID_PAGE_NETGAME:
- ui.pageNetGame->pChatWidget->addLine("Error",errmsg);
+ ui.pageNetGame->displayError(errmsg);
break;
default:
- ui.pageRoomsList->chatWidget->addLine("Error",errmsg);
+ ui.pageRoomsList->displayError(errmsg);
}
}
void HWForm::NetWarning(const QString & wrnmsg)
{
if (ui.Pages->currentIndex() == ID_PAGE_NETGAME || ui.Pages->currentIndex() == ID_PAGE_INGAME)
- ui.pageNetGame->pChatWidget->addLine("Warning",wrnmsg);
+ ui.pageNetGame->displayWarning(wrnmsg);
else
- ui.pageRoomsList->chatWidget->addLine("Warning",wrnmsg);
+ ui.pageRoomsList->displayWarning(wrnmsg);
}
void HWForm::_NetConnect(const QString & hostName, quint16 port, QString nick)
@@ -828,7 +807,7 @@
GoToPage(ID_PAGE_CONNECTING);
connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()));
- connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected()));
+ connect(hwnet, SIGNAL(connected()), this, SLOT(NetConnected()));
connect(hwnet, SIGNAL(Error(const QString&)), this, SLOT(NetError(const QString&)));
connect(hwnet, SIGNAL(Warning(const QString&)), this, SLOT(NetWarning(const QString&)));
connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
@@ -944,7 +923,7 @@
connect(ui.pageAdmin, SIGNAL(clearAccountsCache()), hwnet, SLOT(clearAccountsCache()));
// disconnect
- connect(hwnet, SIGNAL(Disconnected(const QString&)), this, SLOT(ForcedDisconnect(const QString&)), Qt::QueuedConnection);
+ connect(hwnet, SIGNAL(disconnected(const QString&)), this, SLOT(ForcedDisconnect(const QString&)), Qt::QueuedConnection);
// config stuff
connect(hwnet, SIGNAL(paramChanged(const QString &, const QStringList &)), ui.pageNetGame->pGameCFG, SLOT(setParam(const QString &, const QStringList &)));
@@ -1166,11 +1145,11 @@
demofile.close();
}
-void HWForm::StartTraining()
+void HWForm::startTraining(const QString & scriptName)
{
CreateGame(0, 0, 0);
- game->StartTraining(ui.pageTraining->CBSelect->itemData(ui.pageTraining->CBSelect->currentIndex()).toString());
+ game->StartTraining(scriptName);
}
void HWForm::StartCampaign()
@@ -1187,7 +1166,7 @@
ui.pageNetGame->pGameCFG->WeaponsName->currentIndex()
).toString();
- CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
+ CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &)));
@@ -1210,9 +1189,9 @@
void HWForm::Music(bool checked)
{
if (checked)
- sdli.StartMusic();
+ SDLInteraction::instance().startMusic();
else
- sdli.StopMusic();
+ SDLInteraction::instance().stopMusic();
}
void HWForm::NetGameChangeStatus(bool isMaster)
@@ -1240,7 +1219,7 @@
// disconnect connections first to ensure their inexistance and not to connect twice
ui.pageNetGame->BtnStart->disconnect(hwnet);
ui.pageNetGame->BtnUpdate->disconnect(hwnet);
- ui.pageNetGame->leRoomName->setText(hwnet->getRoom());
+ ui.pageNetGame->setRoomName(hwnet->getRoom());
ui.pageNetGame->restrictJoins->disconnect(hwnet);
ui.pageNetGame->restrictTeamAdds->disconnect(hwnet);
connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), hwnet, SLOT(startGame()));
@@ -1286,7 +1265,7 @@
{
GoBack();
if (!reason.isEmpty())
- ui.pageRoomsList->chatWidget->addLine("Notice",reason);
+ ui.pageRoomsList->displayNotice(reason);
}
else
qWarning("Left room while not in room");
@@ -1309,24 +1288,14 @@
HWTeam team(ui.pageCampaign->CBTeam->currentText());
ui.pageCampaign->CBSelect->clear();
- QDir tmpdir;
- tmpdir.cd(cfgdir->absolutePath());
- tmpdir.cd("Data/Missions/Campaign");
- tmpdir.setFilter(QDir::Files);
- QStringList userentries = tmpdir.entryList(QStringList("*#*.lua"));
- //entries.sort();
- unsigned int n = userentries.count();
- for(unsigned int i = 0; (i < n) && (i <= team.campaignProgress()); i++)
- ui.pageCampaign->CBSelect->addItem(QString(userentries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2").replace("_", " "), QString(userentries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1"));
-
- tmpdir.cd(datadir->absolutePath());
- tmpdir.cd("Missions/Campaign");
- tmpdir.setFilter(QDir::Files);
- QStringList entries = tmpdir.entryList(QStringList("*#*.lua"));
- //entries.sort();
- n = entries.count();
+ QStringList entries = HWDataManager::instance().entryList(
+ "Missions/Campaign",
+ QDir::Files,
+ QStringList("*#*.lua")
+ );
+
+ unsigned int n = entries.count();
for(unsigned int i = 0; (i < n) && (i <= team.campaignProgress()); i++) {
- if (userentries.contains(entries[i])) continue;
ui.pageCampaign->CBSelect->addItem(QString(entries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2").replace("_", " "), QString(entries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1"));
}
}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwform.h
--- a/QTfrontend/hwform.h Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/hwform.h Fri Oct 28 18:33:38 2011 +0200
@@ -22,11 +22,12 @@
#include
#include
#include
+#include
#include "netserver.h"
#include "game.h"
#include "ui_hwform.h"
-#include "SDLs.h"
+#include "SDLInteraction.h"
#include "bgwidget.h"
#ifdef __APPLE__
@@ -54,11 +55,11 @@
public:
HWForm(QWidget *parent = 0, QString styleSheet = "");
Ui_HWForm ui;
- SDLInteraction sdli;
GameUIConfig * config;
QSettings * gameSettings; // Same file GameUIConfig points to but without the baggage. Needs sync() calls if you want to get GameUIConfig changes though
void updateXfire();
void PlayDemoQuick(const QString & demofilename);
+ void exit();
private slots:
void GoToSaves();
@@ -76,20 +77,16 @@
QString getDemoArguments();
void AssociateFiles();
void btnExitPressed();
- void btnExitClicked();
void IntermediateSetup();
void NewTeam();
- void EditTeam();
- void DeleteTeam();
- void RandomNames();
- void RandomName(const int &i);
- void TeamSave();
- void TeamDiscard();
+ void EditTeam(const QString & teamName);
+ void AfterTeamEdit();
+ void DeleteTeam(const QString & teamName);
void DeleteScheme();
void DeleteWeaponSet();
void SimpleGame();
void PlayDemo();
- void StartTraining();
+ void startTraining(const QString&);
void StartCampaign();
void NetConnect();
void NetConnectServer(const QString & host, quint16 port);
@@ -160,11 +157,11 @@
ID_PAGE_DRAWMAP = 20,
ID_PAGE_DATADOWNLOAD = 21
};
- HWGame * game;
- HWNetServer* pnetserver;
- HWNetRegisterServer* pRegisterServer;
- HWTeam * editedTeam;
- HWNewNet * hwnet;
+ QPointer game;
+ QPointer pnetserver;
+ QPointer pRegisterServer;
+ QPointer editedTeam;
+ QPointer hwnet;
HWNamegen * namegen;
AmmoSchemeModel * ammoSchemeModel;
QStack PagesStack;
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwmap.cpp
--- a/QTfrontend/hwmap.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2007 Ulyanov Igor
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "hwconsts.h"
-#include "hwmap.h"
-
-HWMap::HWMap() :
- TCPBase(false)
-{
-}
-
-HWMap::~HWMap()
-{
-}
-
-void HWMap::getImage(const QString & seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData)
-{
- m_seed = seed;
- templateFilter = filter;
- m_mapgen = mapgen;
- m_maze_size = maze_size;
- if(mapgen == MAPGEN_DRAWN) m_drawMapData = drawMapData;
- Start();
-}
-
-QStringList HWMap::getArguments()
-{
- QStringList arguments;
- arguments << cfgdir->absolutePath();
- arguments << QString("%1").arg(ipc_port);
- arguments << "landpreview";
- return arguments;
-}
-
-void HWMap::onClientDisconnect()
-{
- if (readbuffer.size() == 128 * 32 + 1)
- {
- quint8 *buf = (quint8*) readbuffer.constData();
- QImage im(buf, 256, 128, QImage::Format_Mono);
- im.setNumColors(2);
- emit HHLimitReceived(buf[128 * 32]);
- emit ImageReceived(im);
- }
-}
-
-void HWMap::SendToClientFirst()
-{
- SendIPC(QString("eseed %1").arg(m_seed).toUtf8());
- SendIPC(QString("e$template_filter %1").arg(templateFilter).toUtf8());
- SendIPC(QString("e$mapgen %1").arg(m_mapgen).toUtf8());
-
- switch (m_mapgen)
- {
- case MAPGEN_MAZE:
- SendIPC(QString("e$maze_size %1").arg(m_maze_size).toUtf8());
- break;
-
- case MAPGEN_DRAWN:
- {
- QByteArray data = m_drawMapData;
- while(data.size() > 0)
- {
- QByteArray tmp = data;
- tmp.truncate(200);
- SendIPC("edraw " + tmp);
- data.remove(0, 200);
- }
- break;
- }
- default: ;
- }
-
- SendIPC("!");
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwmap.h
--- a/QTfrontend/hwmap.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006 Igor Ulyanov
- * Copyright (c) 2006-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _HWMAP_INCLUDED
-#define _HWMAP_INCLUDED
-
-#include
-#include
-#include
-
-#include "tcpBase.h"
-
-enum MapGenerator
-{
- MAPGEN_REGULAR,
- MAPGEN_MAZE,
- MAPGEN_DRAWN,
- MAPGEN_MAP
-};
-
-class HWMap : public TCPBase
-{
- Q_OBJECT
-
- public:
- HWMap();
- virtual ~HWMap();
- void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData);
-
- protected:
- virtual QStringList getArguments();
- virtual void onClientDisconnect();
- virtual void SendToClientFirst();
-
- signals:
- void ImageReceived(const QImage newImage);
- void HHLimitReceived(int hhLimit);
-
- private:
- QString m_seed;
- int templateFilter;
- MapGenerator m_mapgen;
- int m_maze_size;
- QByteArray m_drawMapData;
-
- private slots:
-};
-
-#endif // _HWMAP_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/igbox.cpp
--- a/QTfrontend/igbox.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2008-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-#include
-
-#include "igbox.h"
-
-IconedGroupBox::IconedGroupBox(QWidget * parent)
- : QGroupBox(parent)
-{
-// Has issues with border-radius on children
-// setAttribute(Qt::WA_PaintOnScreen, true);
- titleLeftPadding = 49;
- contentTopPadding = 15;
-}
-
-void IconedGroupBox::setIcon(const QIcon & icon)
-{
- if (this->icon.isNull())
- setStyleSheet(QString(
- "IconedGroupBox{"
- "margin-top: 46px;"
- "margin-left: 12px;"
- "padding: %1px 2px 5px 2px;"
- "}"
- "IconedGroupBox::title{"
- "subcontrol-origin: margin;"
- "subcontrol-position: top left;"
- "padding-left: %2px;"
- "padding-top: %1px;"
- "text-align: left;"
- "}"
- ).arg(contentTopPadding).arg(titleLeftPadding)
- );
-
- this->icon = icon;
- repaint();
-}
-
-void IconedGroupBox::paintEvent(QPaintEvent * event)
-{
- Q_UNUSED(event);
-
- QStylePainter painter(this);
-
- QStyleOptionGroupBox option;
- initStyleOption(&option);
- painter.drawComplexControl(QStyle::CC_GroupBox, option);
-
- icon.paint(&painter, QRect(QPoint(0, 0), icon.actualSize(size())));
-}
-
-void IconedGroupBox::setTitleTextPadding(int px)
-{
- titleLeftPadding = px;
-}
-
-void IconedGroupBox::setContentTopPadding(int px)
-{
- contentTopPadding = px;
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/igbox.h
--- a/QTfrontend/igbox.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2008-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _IGBOX_H
-#define _IGBOX_H
-
-#include
-#include
-
-class IconedGroupBox : public QGroupBox
-{
- Q_OBJECT
-
-public:
- IconedGroupBox(QWidget * parent = 0);
-
- void setIcon(const QIcon & icon);
- void setTitleTextPadding(int px);
- void setContentTopPadding(int px);
-protected:
- virtual void paintEvent(QPaintEvent * event);
-
-private:
- QIcon icon;
- int titleLeftPadding;
- int contentTopPadding;
-};
-
-#endif // _IGBOX_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/input_ip.cpp
--- a/QTfrontend/input_ip.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include "input_ip.h"
-
-HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent)
-{
- QGridLayout * layout = new QGridLayout(this);
-
- QLabel * lbHost = new QLabel(this);
- lbHost->setText(QLabel::tr("Host:"));
- layout->addWidget(lbHost, 0, 0);
-
- QLabel * lbPort = new QLabel(this);
- lbPort->setText(QLabel::tr("Port:"));
- layout->addWidget(lbPort, 1, 0);
-
- leHost = new QLineEdit(this);
- layout->addWidget(leHost, 0, 1, 1, 2);
-
- sbPort = new QSpinBox(this);
- sbPort->setMinimum(0);
- sbPort->setMaximum(65535);
- layout->addWidget(sbPort, 1, 1, 1, 2);
-
- pbDefault = new QPushButton(this);
- pbDefault->setText(QPushButton::tr("default"));
- layout->addWidget(pbDefault, 1, 3);
-
- pbOK = new QPushButton(this);
- pbOK->setText(QPushButton::tr("OK"));
- pbOK->setDefault(true);
- layout->addWidget(pbOK, 3, 1);
-
- pbCancel = new QPushButton(this);
- pbCancel->setText(QPushButton::tr("Cancel"));
- layout->addWidget(pbCancel, 3, 2);
-
- connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
- connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
- connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort()));
-}
-
-void HWHostPortDialog::setDefaultPort()
-{
- sbPort->setValue(46631);
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/input_ip.h
--- a/QTfrontend/input_ip.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-
-#ifndef INPUT_IP_H
-#define INPUT_IP_H
-
-#include
-#include
-
-class QLineEdit;
-class QSpinBox;
-class QPushButton;
-
-class HWHostPortDialog : public QDialog
-{
- Q_OBJECT
-public:
- HWHostPortDialog(QWidget* parent = 0);
-
- QLineEdit* leHost;
- QSpinBox* sbPort;
-
-private:
- QPushButton* pbOK;
- QPushButton* pbCancel;
- QPushButton * pbDefault;
-
-private slots:
- void setDefaultPort();
-};
-
-
-#endif // INPUT_IP_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/itemNum.cpp
--- a/QTfrontend/itemNum.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Igor Ulyanov
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "itemNum.h"
-#include "hwform.h"
-
-#include
-#include
-
-ItemNum::ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min, unsigned char max) :
- QFrame(parent), m_im(im), m_img(img), infinityState(false), nonInteractive(false), minItems(min), maxItems(max),
- numItems(min+2 >= max ? min : min+2)
-{
- enabled = true;
- if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
-}
-
-ItemNum::~ItemNum()
-{
-}
-
-void ItemNum::mousePressEvent ( QMouseEvent * event )
-{
- if(nonInteractive) return;
- if(event->button()==Qt::LeftButton && enabled) {
- event->accept();
- if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems)) {
- incItems();
- } else {
- numItems = minItems+1;
- // appears there's an emit in there
- decItems();
- }
- } else if (event->button()==Qt::RightButton && enabled) {
- event->accept();
- if(numItems > minItems) {
- decItems();
- } else {
- numItems = maxItems+(infinityState?0:-1);
- incItems();
- }
- } else {
- event->ignore();
- return;
- }
- repaint();
-}
-
-QSize ItemNum::sizeHint () const
-{
- return QSize((maxItems+1)*12, 32);
-}
-
-void ItemNum::paintEvent(QPaintEvent* event)
-{
- Q_UNUSED(event);
-
- QPainter painter(this);
-
- if (numItems==maxItems+1) {
- QRect target(0, 0, 100, 32);
- if (enabled) {
- painter.drawImage(target, QImage(":/res/infinity.png"));
- } else {
- painter.drawImage(target, QImage(":/res/infinitygrey.png"));
- }
- } else {
- for(int i=0; i
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-
-#ifndef _ITEM_NUM_INCLUDED
-#define _ITEM_NUM_INCLUDED
-
-class ItemNum : public QFrame
-{
- Q_OBJECT
-
- public:
- void setInfinityState(bool value);
- void setEnabled(bool value);
- unsigned char getItemsNum() const;
- void setItemsNum(const unsigned char num);
-
- private:
- QImage m_im;
- QImage m_img;
- bool infinityState;
- bool enabled;
-
- protected:
- ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8);
- virtual QSize sizeHint () const;
- virtual ~ItemNum()=0;
-
- bool nonInteractive;
- unsigned char minItems;
- unsigned char maxItems;
- unsigned char numItems;
-
- // from QWidget
- virtual void mousePressEvent ( QMouseEvent * event );
- virtual void paintEvent(QPaintEvent* event);
-
- // to be implemented in child
- virtual void incItems()=0;
- virtual void decItems()=0;
-};
-
-#endif // _ITEM_NUM_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/main.cpp
--- a/QTfrontend/main.cpp Fri Oct 28 18:27:55 2011 +0200
+++ b/QTfrontend/main.cpp Fri Oct 28 18:33:38 2011 +0200
@@ -30,6 +30,8 @@
#include "hwform.h"
#include "hwconsts.h"
+#include "HWDataManager.h"
+
#ifdef _WIN32
#include
#endif
@@ -96,229 +98,6 @@
Q_INIT_RESOURCE(hedgewars);
- QString styleSheetFromHell =
- QString(
- "HWForm,QDialog{"
- "background-image: url(\":/res/Background.png\");"
- "background-position: bottom center;"
- "background-repeat: repeat-x;"
- "background-color: #141250;"
- "}"
-
- "* {"
- "color: #ffcc00;"
- "selection-background-color: #ffcc00;"
- "selection-color: #00351d;"
- "}"
-
- "QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox, "
- "QComboBox QAbstractItemView, QMenu::item {"
- "background-color: rgba(13, 5, 68, 70%);"
- "}"
-
- "QComboBox::separator {"
- "border: solid; border-width: 3px; border-color: #ffcc00;"
- "}"
-
- "QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView, "
- "QTextBrowser, QSpinBox, QToolBox, QComboBox, "
- "QComboBox QAbstractItemView, IconedGroupBox, "
- ".QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget, "
- "QTabWidget::pane, QTabBar::tab {"
- "border: solid;"
- "border-width: 3px;"
- "border-color: #ffcc00;"
- "}"
-
- "QPushButton:hover, QLineEdit:hover, QListWidget:hover, "
- "QSpinBox:hover, QToolBox:hover, QComboBox:hover {"
- "border-color: yellow;"
- "}"
-
- "QLineEdit, QListWidget,QTableView, QTextBrowser, "
- "QSpinBox, QToolBox { "
- "border-radius: 10px;"
- "}"
-
- "QLineEdit, QLabel, QHeaderView, QListWidget, QTableView, "
- "QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView, "
- "IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget, "
- "SelWeaponWidget, QCheckBox, QRadioButton, QPushButton {"
- "font: bold 13px;"
- "}"
- "SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected {"
- "background-position: bottom center;"
- "background-repeat: repeat-x;"
- "background-color: #000000;"
- "}"
- ".QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget {"
- "background-position: bottom center;"
- "background-repeat: repeat-x;"
- "border-radius: 16px;"
- "background-color: rgba(13, 5, 68, 70%);"
- "padding: 6px;"
- "}"
-/* Experimenting with PaintOnScreen and border-radius on IconedGroupBox children didn't work out well
- "IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, "
- "IconedGroupBox QSpinBox {"
- "border-radius: 0;"
- "}"
- "IconedGroupBox, IconedGroupBox *, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" */
- "IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{"
- "background-color: #130f2c;"
- "}"
-
-
- "QPushButton {"
- "border-radius: 8px;"
- "background-origin: margin;"
- "background-position: top left;"
- "background-color: rgba(18, 42, 5, 70%);"
- "}"
-
- "QPushButton:pressed{"
- "border-color: white;"
- "}"
-
- "QHeaderView {"
- "border-radius: 0;"
- "border-width: 0;"
- "border-bottom-width: 3px;"
- "background-color: #00351d;"
- "}"
- "QTableView {"
- "alternate-background-color: #2f213a;"
- "gridline-color: transparent;"
- "}"
-
- "QTabBar::tab {"
- "border-bottom-width: 0;"
- "border-radius: 0;"
- "border-top-left-radius: 6px;"
- "border-top-right-radius: 6px;"
- "padding: 3px;"
- "}"
- "QTabBar::tab:!selected {"
- "color: #0d0544;"
- "background-color: #ffcc00;"
- "}"
- "QSpinBox::up-button{"
- "background: transparent;"
- "width: 16px;"
- "height: 10px;"
- "}"
-
- "QSpinBox::up-arrow {"
- "image: url(\":/res/spin_up.png\");"
- "}"
-
- "QSpinBox::down-arrow {"
- "image: url(\":/res/spin_down.png\");"
- "}"
-
- "QSpinBox::down-button {"
- "background: transparent;"
- "width: 16px;"
- "height: 10px;"
- "}"
-
- "QComboBox {"
- "border-radius: 10px;"
- "padding: 3px;"
- "}"
- "QComboBox:pressed{"
- "border-color: white;"
- "}"
- "QComboBox::drop-down{"
- "border: transparent;"
- "width: 25px;"
- "}"
- "QComboBox::down-arrow {"
- "image: url(\":/res/dropdown.png\");"
- "}"
-
- "VertScrArea {"
- "background-position: bottom center;"
- "background-repeat: repeat-x;"
- "}"
-
- "IconedGroupBox {"
- "border-radius: 16px;"
- "padding: 2px;"
- "}"
-
- "QGroupBox::title{"
- "subcontrol-origin: margin;"
- "subcontrol-position: top left;"
- "text-align: left;"
- "left: 15px;"
- "top: -4px;"
- "}"
-
- "QCheckBox::indicator:checked{"
- "image: url(\":/res/checked.png\");"
- "}"
- "QCheckBox::indicator:unchecked{"
- "image: url(\":/res/unchecked.png\");"
- "}"
-
- ".QWidget{"
- "background: transparent;"
- "}"
-
- "QTabWidget::pane {"
- "border-top-width: 2px;"
- "}"
-
- "QMenu{"
- "background-color: #ffcc00;"
- "margin: 3px;"
- "}"
- "QMenu::item {"
- "background-color: #0d0544;"
- "border: 1px solid transparent;"
- "font: bold;"
- "padding: 2px 25px 2px 20px;"
- "}"
- "QMenu::item:selected {"
- "background-color: #2d2564;"
- "}"
- "QMenu::indicator {"
- "width: 16px;"
- "height: 16px;"
- "}"
- "QMenu::indicator:non-exclusive:checked{"
- "image: url(\":/res/checked.png\");"
- "}"
- "QMenu::indicator:non-exclusive:unchecked{"
- "image: url(\":/res/unchecked.png\");"
- "}"
-
- "QToolTip{"
- "background-color: #0d0544;"
- "border: 1px solid #ffcc00;"
- "}"
-
- ":disabled{"
- "color: #a0a0a0;"
- "}"
- "SquareLabel, ItemNum {"
- "background-color: #000000;"
- "}"
- "QSlider::groove::horizontal {"
- "height: 2px;"
- "margin: 2px 0px;"
- "background-color: #ffcc00;"
- "}"
- "QSlider::handle::horizontal {"
- "border: 0px;"
- "margin: -2px 0px;"
- "border-radius: 3px;"
- "background-color: #ffcc00;"
- "width: 8px;"
- "}"
- );
-
bindir->cd("bin"); // workaround over NSIS installer
if(cConfigDir->length() == 0)
@@ -386,35 +165,36 @@
return 1;
}
+ HWDataManager & dataMgr = HWDataManager::instance();
+
{
- QDir dir;
- dir.setPath(cfgdir->absolutePath() + "/Data/Themes");
-
QStringList themes;
- themes.append(dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot));
- dir.setPath(datadir->absolutePath() + "/Themes");
- themes.append(dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot));
+ themes.append(dataMgr.entryList(
+ "Themes",
+ QDir::AllDirs | QDir::NoDotAndDotDot)
+ );
QList > icons;
themes.sort();
for(int i = themes.size() - 1; i >= 0; --i)
{
- QFile tmpfile;
- tmpfile.setFileName(QString("%1/Data/Themes/%2/icon.png").arg(cfgdir->absolutePath()).arg(themes.at(i)));
- if (!tmpfile.exists())
- tmpfile.setFileName(QString("%1/Themes/%2/icon.png").arg(datadir->absolutePath()).arg(themes.at(i)));
+ QString file = dataMgr.findFileForRead(
+ QString("Themes/%1/icon.png").arg(themes.at(i))
+ );
- if(tmpfile.exists())
+ if(QFile::exists(file))
{ // load icon
QPair ic;
- ic.first = QIcon(QFileInfo(tmpfile).absoluteFilePath());
+ ic.first = QIcon(file);
- QFile previewIconFile;
- previewIconFile.setFileName(QString("%1/Data/Themes/%2/icon@2x.png").arg(cfgdir->absolutePath()).arg(themes.at(i)));
- if (previewIconFile.exists()) ic.second = QIcon(QFileInfo(previewIconFile).absoluteFilePath());
- else ic.second = QIcon(QString("%1/Themes/%2/icon@2x.png").arg(datadir->absolutePath()).arg(themes.at(i)));
+ // load preview icon
+ ic.second = QIcon(
+ dataMgr.findFileForRead(
+ QString("Themes/%1/icon@2x.png").arg(themes.at(i))
+ )
+ );
icons.prepend(ic);
}
@@ -433,30 +213,18 @@
}
}
- QDir tmpdir;
- tmpdir.cd(cfgdir->absolutePath());
- tmpdir.cd("Data/Maps");
- tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
- mapList = new QStringList(tmpdir.entryList(QStringList("*")));
-
- tmpdir.cd(datadir->absolutePath());
- tmpdir.cd("Maps");
- tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
- QStringList tmplist = QStringList(tmpdir.entryList(QStringList("*")));
- for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it)
- if (!mapList->contains(*it,Qt::CaseInsensitive)) mapList->append(*it);
+ mapList = new QStringList(dataMgr.entryList(
+ QString("Maps"),
+ QDir::Dirs | QDir::NoDotAndDotDot
+ )
+ );
- tmpdir.cd(cfgdir->absolutePath());
- tmpdir.cd("Data/Scripts/Multiplayer");
- tmpdir.setFilter(QDir::Files | QDir::NoDotAndDotDot);
- scriptList = new QStringList(tmpdir.entryList(QStringList("*.lua")));
-
- tmpdir.cd(datadir->absolutePath());
- tmpdir.cd("Scripts/Multiplayer");
- tmpdir.setFilter(QDir::Files | QDir::NoDotAndDotDot);
- tmplist = QStringList(tmpdir.entryList(QStringList("*.lua")));
- for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it)
- if (!scriptList->contains(*it,Qt::CaseInsensitive)) scriptList->append(*it);
+ scriptList = new QStringList(dataMgr.entryList(
+ QString("Scripts/Multiplayer"),
+ QDir::Files,
+ QStringList("*.lua")
+ )
+ );
QTranslator Translator;
{
@@ -464,10 +232,13 @@
QString cc = settings.value("misc/locale", QString()).toString();
if(cc.isEmpty())
cc = QLocale::system().name();
- QFile tmpfile;
- tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Locale/hedgewars_" + cc);
- if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Locale/hedgewars_" + cc);
- Translator.load(QFileInfo(tmpfile).absoluteFilePath());
+
+ // load locale file into translator
+ Translator.load(
+ dataMgr.findFileForRead(
+ QString("Locale/hedgewars_" + cc)
+ )
+ );
app.installTranslator(&Translator);
}
@@ -485,8 +256,27 @@
CocoaInitializer initializer;
#endif
- app.form = new HWForm(NULL,styleSheetFromHell);
+ QString style = "";
+
+ // load external stylesheet if there is any
+ QFile extFile(dataMgr.findFileForRead("css/qt.css"));
+
+ QFile resFile(":/res/css/qt.css");
+
+ QFile & file = (extFile.exists()?extFile:resFile);
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text))
+ {
+ QTextStream in(&file);
+ while (!in.atEnd())
+ {
+ QString line = in.readLine();
+ if(!line.isEmpty())
+ style.append(line);
+ }
+ }
+
+ app.form = new HWForm(NULL, style);
app.form->show();
return app.exec();
}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/mapContainer.cpp
--- a/QTfrontend/mapContainer.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,669 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2011 Igor Ulyanov
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "hwconsts.h"
-#include "mapContainer.h"
-#include "igbox.h"
-#include "HWApplication.h"
-
-HWMapContainer::HWMapContainer(QWidget * parent) :
- QWidget(parent),
- mainLayout(this),
- pMap(0),
- mapgen(MAPGEN_REGULAR)
-{
- hhSmall.load(":/res/hh_small.png");
- hhLimit = 18;
- templateFilter = 0;
-
- mainLayout.setContentsMargins(HWApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
- 1,
- HWApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
- HWApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
-
- QWidget* mapWidget = new QWidget(this);
- mainLayout.addWidget(mapWidget, 0, 0, Qt::AlignHCenter);
-
- QGridLayout* mapLayout = new QGridLayout(mapWidget);
- mapLayout->setMargin(0);
-
- imageButt = new QPushButton(mapWidget);
- imageButt->setObjectName("imageButt");
- imageButt->setFixedSize(256 + 6, 128 + 6);
- imageButt->setFlat(true);
- imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
- mapLayout->addWidget(imageButt, 0, 0, 1, 2);
- connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomMap()));
-
- chooseMap = new QComboBox(mapWidget);
- chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- chooseMap->addItem(
-// FIXME - need real icons. Disabling until then
-//QIcon(":/res/mapRandom.png"),
-QComboBox::tr("generated map..."));
- chooseMap->addItem(
-// FIXME - need real icons. Disabling until then
-//QIcon(":/res/mapMaze.png"),
-QComboBox::tr("generated maze..."));
-
- chooseMap->addItem(QComboBox::tr("hand drawn map..."));
- chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions
-
- chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions
-
- int missionindex = chooseMap->count();
- numMissions = 0;
- QFile mapLuaFile;
- QFile mapCfgFile;
- for (int i = 0; i < mapList->size(); ++i) {
- QString map = (*mapList)[i];
- mapCfgFile.setFileName(
- QString("%1/Data/Maps/%2/map.cfg")
- .arg(cfgdir->absolutePath())
- .arg(map));
- if (mapCfgFile.exists()) {
- mapLuaFile.setFileName(
- QString("%1/Data/Maps/%2/map.lua")
- .arg(cfgdir->absolutePath())
- .arg(map));
- } else {
- mapCfgFile.setFileName(
- QString("%1/Maps/%2/map.cfg")
- .arg(datadir->absolutePath())
- .arg(map));
- mapLuaFile.setFileName(
- QString("%1/Maps/%2/map.lua")
- .arg(datadir->absolutePath())
- .arg(map));
- }
-
- if (mapCfgFile.open(QFile::ReadOnly)) {
- QString theme;
- quint32 limit = 0;
- QString scheme;
- QString weapons;
- QList mapInfo;
- QTextStream input(&mapCfgFile);
- input >> theme;
- input >> limit;
- input >> scheme;
- input >> weapons;
- mapInfo.push_back(map);
- mapInfo.push_back(theme);
- if (limit)
- mapInfo.push_back(limit);
- else
- mapInfo.push_back(18);
- mapInfo.push_back(mapLuaFile.exists());
- if (scheme.isEmpty())
- scheme = "locked";
- scheme.replace("_", " ");
- if (weapons.isEmpty())
- weapons = "locked";
- weapons.replace("_", " ");
- mapInfo.push_back(scheme);
- mapInfo.push_back(weapons);
- if(mapLuaFile.exists())
- {
- chooseMap->insertItem(missionindex++,
-// FIXME - need real icons. Disabling until then
-//QIcon(":/res/mapMission.png"),
-QComboBox::tr("Mission") + ": " + map, mapInfo);
- numMissions++;
- }
- else
- chooseMap->addItem(
-// FIXME - need real icons. Disabling until then
-//QIcon(":/res/mapCustom.png"),
-map, mapInfo);
- mapCfgFile.close();
- }
- }
- chooseMap->insertSeparator(missionindex); // separator between missions and maps
-
- connect(chooseMap, SIGNAL(activated(int)), this, SLOT(mapChanged(int)));
- mapLayout->addWidget(chooseMap, 1, 1);
-
- QLabel * lblMap = new QLabel(tr("Map"), mapWidget);
- mapLayout->addWidget(lblMap, 1, 0);
-
- lblFilter = new QLabel(tr("Filter"), mapWidget);
- mapLayout->addWidget(lblFilter, 2, 0);
-
- cbTemplateFilter = new QComboBox(mapWidget);
- cbTemplateFilter->addItem(tr("All"), 0);
- cbTemplateFilter->addItem(tr("Small"), 1);
- cbTemplateFilter->addItem(tr("Medium"), 2);
- cbTemplateFilter->addItem(tr("Large"), 3);
- cbTemplateFilter->addItem(tr("Cavern"), 4);
- cbTemplateFilter->addItem(tr("Wacky"), 5);
- mapLayout->addWidget(cbTemplateFilter, 2, 1);
-
- connect(cbTemplateFilter, SIGNAL(activated(int)), this, SLOT(setTemplateFilter(int)));
-
- maze_size_label = new QLabel(tr("Type"), mapWidget);
- mapLayout->addWidget(maze_size_label, 2, 0);
- maze_size_label->hide();
- cbMazeSize = new QComboBox(mapWidget);
- cbMazeSize->addItem(tr("Small tunnels"), 0);
- cbMazeSize->addItem(tr("Medium tunnels"), 1);
- cbMazeSize->addItem(tr("Large tunnels"), 2);
- cbMazeSize->addItem(tr("Small floating islands"), 3);
- cbMazeSize->addItem(tr("Medium floating islands"), 4);
- cbMazeSize->addItem(tr("Large floating islands"), 5);
- cbMazeSize->setCurrentIndex(1);
-
- mapLayout->addWidget(cbMazeSize, 2, 1);
- cbMazeSize->hide();
- connect(cbMazeSize, SIGNAL(activated(int)), this, SLOT(setMazeSize(int)));
-
- gbThemes = new IconedGroupBox(mapWidget);
- gbThemes->setTitleTextPadding(80);
- gbThemes->setContentTopPadding(15);
- gbThemes->setTitle(tr("Themes"));
-
- //gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon
- mapLayout->addWidget(gbThemes, 0, 2, 3, 1);
-
- QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
- gbTLayout->setContentsMargins(0, 0, 0 ,0);
- gbTLayout->setSpacing(0);
- lvThemes = new QListView(mapWidget);
- lvThemes->setMinimumHeight(30);
- lvThemes->setFixedWidth(140);
- lvThemes->setModel(themesModel);
- lvThemes->setIconSize(QSize(16, 16));
- lvThemes->setEditTriggers(QListView::NoEditTriggers);
-
- connect(lvThemes->selectionModel(), SIGNAL(currentRowChanged( const QModelIndex &, const QModelIndex &)), this, SLOT(themeSelected( const QModelIndex &, const QModelIndex &)));
-
- // override default style to tighten up theme scroller
- lvThemes->setStyleSheet(QString(
- "QListView{"
- "border: solid;"
- "border-width: 0px;"
- "border-radius: 0px;"
- "border-color: transparent;"
- "background-color: #0d0544;"
- "color: #ffcc00;"
- "font: bold 13px;"
- "}"
- )
- );
-
- gbTLayout->addWidget(lvThemes);
- lvThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
-
- mapLayout->setSizeConstraint(QLayout::SetFixedSize);
-
- QWidget* seedWidget = new QWidget(this);
- mainLayout.addWidget(seedWidget, 1, 0);
-
- QGridLayout* seedLayout = new QGridLayout(seedWidget);
- seedLayout->setMargin(0);
-
- seedLabel = new QLabel(tr("Seed"), seedWidget);
- seedLayout->addWidget(seedLabel, 3, 0);
- seedEdit = new QLineEdit(seedWidget);
- seedEdit->setMaxLength(54);
- connect(seedEdit, SIGNAL(returnPressed()), this, SLOT(seedEdited()));
- seedLayout->addWidget(seedEdit, 3, 1);
- seedLayout->setColumnStretch(1, 5);
- seedSet = new QPushButton(seedWidget);
- seedSet->setText(QPushButton::tr("more"));
- connect(seedSet, SIGNAL(clicked()), this, SLOT(seedEdited()));
- seedLayout->setColumnStretch(2, 1);
- seedLayout->addWidget(seedSet, 3, 2);
-
- seedLabel->setVisible(false);
- seedEdit->setVisible(false);
-
- setRandomSeed();
- setRandomTheme();
-}
-
-void HWMapContainer::setImage(const QImage newImage)
-{
- QPixmap px(256, 128);
- QPixmap pxres(256, 128);
- QPainter p(&pxres);
-
- px.fill(Qt::yellow);
- QBitmap bm = QBitmap::fromImage(newImage);
- px.setMask(bm);
-
- QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128));
- linearGrad.setColorAt(1, QColor(0, 0, 192));
- linearGrad.setColorAt(0, QColor(66, 115, 225));
- p.fillRect(QRect(0, 0, 256, 128), linearGrad);
- p.drawPixmap(QPoint(0, 0), px);
-
- addInfoToPreview(pxres);
- //chooseMap->setCurrentIndex(mapgen);
- pMap = 0;
-}
-
-void HWMapContainer::setHHLimit(int newHHLimit)
-{
- hhLimit = newHHLimit;
-}
-
-void HWMapContainer::mapChanged(int index)
-{
- switch(index) {
- case MAPGEN_REGULAR:
- mapgen = MAPGEN_REGULAR;
- updatePreview();
- gbThemes->show();
- lblFilter->show();
- cbTemplateFilter->show();
- maze_size_label->hide();
- cbMazeSize->hide();
- emit mapChanged("+rnd+");
- emit themeChanged(chooseMap->itemData(index).toList()[1].toString());
- break;
- case MAPGEN_MAZE:
- mapgen = MAPGEN_MAZE;
- updatePreview();
- gbThemes->show();
- lblFilter->hide();
- cbTemplateFilter->hide();
- maze_size_label->show();
- cbMazeSize->show();
- emit mapChanged("+maze+");
- emit themeChanged(chooseMap->itemData(index).toList()[1].toString());
- break;
- case MAPGEN_DRAWN:
- mapgen = MAPGEN_DRAWN;
- updatePreview();
- gbThemes->show();
- lblFilter->hide();
- cbTemplateFilter->hide();
- maze_size_label->hide();
- cbMazeSize->hide();
- emit mapChanged("+drawn+");
- emit themeChanged(chooseMap->itemData(index).toList()[1].toString());
- break;
- default:
- mapgen = MAPGEN_MAP;
- updatePreview();
- gbThemes->hide();
- lblFilter->hide();
- cbTemplateFilter->hide();
- maze_size_label->hide();
- cbMazeSize->hide();
- emit mapChanged(chooseMap->itemData(index).toList()[0].toString());
- }
-
- emit mapgenChanged(mapgen);
-}
-
-// Should this add text to identify map size?
-void HWMapContainer::addInfoToPreview(QPixmap image)
-{
- QPixmap finalImage = QPixmap(image.size());
- finalImage.fill(QColor(0, 0, 0, 0));
-
- QPainter p(&finalImage);
- p.drawPixmap(image.rect(), image);
- //p.setPen(QColor(0xf4,0x9e,0xe9));
- p.setPen(QColor(0xff,0xcc,0x00));
- p.setBrush(QColor(0, 0, 0));
- p.drawRect(image.rect().width() - hhSmall.rect().width() - 28, 3, 40, 20);
- p.setFont(QFont("MS Shell Dlg", 10));
- p.drawText(image.rect().width() - hhSmall.rect().width() - 14 - (hhLimit > 9 ? 10 : 0), 18, QString::number(hhLimit));
- p.drawPixmap(image.rect().width() - hhSmall.rect().width() - 5, 5, hhSmall.rect().width(), hhSmall.rect().height(), hhSmall);
-
- imageButt->setIcon(finalImage);
- imageButt->setIconSize(image.size());
-}
-
-void HWMapContainer::askForGeneratedPreview()
-{
- if (pMap)
- {
- disconnect(pMap, 0, this, SLOT(setImage(const QImage)));
- disconnect(pMap, 0, this, SLOT(setHHLimit(int)));
- pMap = 0;
- }
-
- pMap = new HWMap();
- connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
- connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
- pMap->getImage(m_seed,
- getTemplateFilter(),
- get_mapgen(),
- getMazeSize(),
- getDrawnMapData()
- );
-}
-
-void HWMapContainer::themeSelected(const QModelIndex & current, const QModelIndex &)
-{
- QString theme = current.data().toString();
- QList mapInfo;
- mapInfo.push_back(QString("+rnd+"));
- mapInfo.push_back(theme);
- mapInfo.push_back(18);
- mapInfo.push_back(false);
- chooseMap->setItemData(0, mapInfo);
- mapInfo[0] = QString("+maze+");
- chooseMap->setItemData(1, mapInfo);
- mapInfo[0] = QString("+drawn+");
- chooseMap->setItemData(2, mapInfo);
-
- gbThemes->setIcon(qVariantValue(current.data(Qt::UserRole)));
- emit themeChanged(theme);
-}
-
-QString HWMapContainer::getCurrentSeed() const
-{
- return m_seed;
-}
-
-QString HWMapContainer::getCurrentMap() const
-{
- if(chooseMap->currentIndex() < MAPGEN_MAP) return QString();
- return chooseMap->itemData(chooseMap->currentIndex()).toList()[0].toString();
-}
-
-QString HWMapContainer::getCurrentTheme() const
-{
- return chooseMap->itemData(chooseMap->currentIndex()).toList()[1].toString();
-}
-
-bool HWMapContainer::getCurrentIsMission() const
-{
- if(!chooseMap->currentIndex()) return false;
- return chooseMap->itemData(chooseMap->currentIndex()).toList()[3].toBool();
-}
-
-int HWMapContainer::getCurrentHHLimit() const
-{
- return hhLimit;
-}
-
-QString HWMapContainer::getCurrentScheme() const
-{
- return chooseMap->itemData(chooseMap->currentIndex()).toList()[4].toString();
-}
-
-QString HWMapContainer::getCurrentWeapons() const
-{
- return chooseMap->itemData(chooseMap->currentIndex()).toList()[5].toString();
-}
-
-quint32 HWMapContainer::getTemplateFilter() const
-{
- return cbTemplateFilter->itemData(cbTemplateFilter->currentIndex()).toInt();
-}
-
-void HWMapContainer::resizeEvent ( QResizeEvent * event )
-{
- Q_UNUSED(event);
- //imageButt->setIconSize(imageButt->size());
-}
-
-void HWMapContainer::intSetSeed(const QString & seed)
-{
- m_seed = seed;
- if (seed != seedEdit->text())
- seedEdit->setText(seed);
-}
-
-void HWMapContainer::setSeed(const QString & seed)
-{
- intSetSeed(seed);
- if (chooseMap->currentIndex() < MAPGEN_DRAWN)
- updatePreview();
-}
-
-void HWMapContainer::intSetMap(const QString & map)
-{
- int id = 0;
- for(int i = 0; i < chooseMap->count(); i++)
- if(!chooseMap->itemData(i).isNull() && chooseMap->itemData(i).toList()[0].toString() == map)
- {
- id = i;
- break;
- }
-
- if(id > 0) {
- if (pMap)
- {
- disconnect(pMap, 0, this, SLOT(setImage(const QImage)));
- disconnect(pMap, 0, this, SLOT(setHHLimit(int)));
- pMap = 0;
- }
- chooseMap->setCurrentIndex(id);
- }
-}
-
-void HWMapContainer::setMap(const QString &map)
-{
- intSetMap(map);
- updatePreview();
-}
-
-void HWMapContainer::setTheme(const QString & theme)
-{
- QModelIndexList mdl = themesModel->match(themesModel->index(0), Qt::DisplayRole, theme);
-
- if(mdl.size())
- lvThemes->setCurrentIndex(mdl.at(0));
-}
-
-void HWMapContainer::setRandomMap()
-{
- setRandomSeed();
- switch(chooseMap->currentIndex())
- {
- case MAPGEN_REGULAR:
- case MAPGEN_MAZE:
- setRandomTheme();
- break;
- case MAPGEN_DRAWN:
- emit drawMapRequested();
- break;
- default:
- if(chooseMap->currentIndex() <= numMissions + MAPGEN_MAP + 1)
- setRandomMission();
- else
- setRandomStatic();
- break;
- }
-}
-
-void HWMapContainer::setRandomStatic()
-{
- int i = MAPGEN_MAP + 3 + numMissions + rand() % (chooseMap->count() - MAPGEN_MAP - 3 - numMissions);
- chooseMap->setCurrentIndex(i);
- mapChanged(i);
-}
-
-void HWMapContainer::setRandomMission()
-{
- int i = MAPGEN_MAP + 2 + rand() % numMissions;
- chooseMap->setCurrentIndex(i);
- mapChanged(i);
-}
-
-void HWMapContainer::setRandomSeed()
-{
- m_seed = QUuid::createUuid().toString();
- seedEdit->setText(m_seed);
- emit seedChanged(m_seed);
- if (chooseMap->currentIndex() < MAPGEN_MAP)
- updatePreview();
-}
-
-void HWMapContainer::setRandomTheme()
-{
- if(!themesModel->rowCount()) return;
- quint32 themeNum = rand() % themesModel->rowCount();
- lvThemes->setCurrentIndex(themesModel->index(themeNum));
-}
-
-void HWMapContainer::intSetTemplateFilter(int filter)
-{
- cbTemplateFilter->setCurrentIndex(filter);
- emit newTemplateFilter(filter);
-}
-
-void HWMapContainer::setTemplateFilter(int filter)
-{
- intSetTemplateFilter(filter);
- updatePreview();
-}
-
-MapGenerator HWMapContainer::get_mapgen(void) const
-{
- return mapgen;
-}
-
-int HWMapContainer::getMazeSize(void) const
-{
- return cbMazeSize->currentIndex();
-}
-
-void HWMapContainer::intSetMazeSize(int size)
-{
- cbMazeSize->setCurrentIndex(size);
- emit mazeSizeChanged(size);
-}
-
-void HWMapContainer::setMazeSize(int size)
-{
- intSetMazeSize(size);
- updatePreview();
-}
-
-void HWMapContainer::intSetMapgen(MapGenerator m)
-{
- mapgen = m;
-
- if(m != MAPGEN_MAP)
- chooseMap->setCurrentIndex(m);
-
- emit mapgenChanged(m);
-}
-
-void HWMapContainer::setMapgen(MapGenerator m)
-{
- intSetMapgen(m);
- updatePreview();
-}
-
-void HWMapContainer::setDrawnMapData(const QByteArray & ar)
-{
- drawMapScene.decode(ar);
- updatePreview();
-}
-
-QByteArray HWMapContainer::getDrawnMapData()
-{
- return drawMapScene.encode();
-}
-
-void HWMapContainer::seedEdited()
-{
- if (seedLabel->isVisible() == false )
- {
- seedLabel->setVisible(true);
- seedEdit->setVisible(true);
- seedSet->setText(tr("Set"));
- return;
- }
-
- if (seedEdit->text().isEmpty())
- seedEdit->setText(m_seed);
- else
- {
- setSeed(seedEdit->text());
- emit seedChanged(seedEdit->text());
- }
-}
-
-DrawMapScene * HWMapContainer::getDrawMapScene()
-{
- return &drawMapScene;
-}
-
-void HWMapContainer::mapDrawingFinished()
-{
- emit drawnMapChanged(getDrawnMapData());
-
- updatePreview();
-}
-
-void HWMapContainer::updatePreview()
-{
- int curIndex = chooseMap->currentIndex();
-
- switch(curIndex)
- {
- case MAPGEN_REGULAR:
- askForGeneratedPreview();
- break;
- case MAPGEN_MAZE:
- askForGeneratedPreview();
- break;
- case MAPGEN_DRAWN:
- askForGeneratedPreview();
- break;
- default:
- QPixmap mapImage;
- QFile tmpfile;
- tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Maps/" + chooseMap->itemData(curIndex).toList()[0].toString() + "/preview.png");
- if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Maps/" + chooseMap->itemData(curIndex).toList()[0].toString() + "/preview.png");
- if(!mapImage.load(QFileInfo(tmpfile).absoluteFilePath())) {
- imageButt->setIcon(QIcon());
- return;
- }
-
- hhLimit = chooseMap->itemData(curIndex).toList()[2].toInt();
- addInfoToPreview(mapImage);
- }
-}
-
-void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl)
-{
- intSetMap(map);
- intSetMapgen(m);
- intSetMazeSize(mazesize);
- intSetSeed(seed);
- intSetTemplateFilter(tmpl);
-
- updatePreview();
-}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/mapContainer.h
--- a/QTfrontend/mapContainer.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2007 Igor Ulyanov
- * Copyright (c) 2007-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _HWMAP_CONTAINER_INCLUDED
-#define _HWMAP_CONTAINER_INCLUDED
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "hwmap.h"
-#include "drawmapscene.h"
-
-class QPushButton;
-class IconedGroupBox;
-class QListView;
-
-class MapFileErrorException
-{
-};
-
-class HWMapContainer : public QWidget
-{
- Q_OBJECT
-
- public:
- HWMapContainer(QWidget * parent=0);
- QString getCurrentSeed() const;
- QString getCurrentMap() const;
- QString getCurrentTheme() const;
- int getCurrentHHLimit() const;
- QString getCurrentScheme() const;
- QString getCurrentWeapons() const;
- quint32 getTemplateFilter() const;
- MapGenerator get_mapgen(void) const;
- int getMazeSize(void) const;
- bool getCurrentIsMission() const;
- QByteArray getDrawnMapData();
- DrawMapScene * getDrawMapScene();
- void mapDrawingFinished();
- QLineEdit* seedEdit;
-
- public slots:
- void askForGeneratedPreview();
- void setSeed(const QString & seed);
- void setMap(const QString & map);
- void setTheme(const QString & theme);
- void setTemplateFilter(int);
- void setMapgen(MapGenerator m);
- void setMazeSize(int size);
- void setDrawnMapData(const QByteArray & ar);
- void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl);
-
- signals:
- void seedChanged(const QString & seed);
- void mapChanged(const QString & map);
- void themeChanged(const QString & theme);
- void newTemplateFilter(int filter);
- void mapgenChanged(MapGenerator m);
- void mazeSizeChanged(int s);
- void drawMapRequested();
- void drawnMapChanged(const QByteArray & data);
-
- private slots:
- void setImage(const QImage newImage);
- void setHHLimit(int hhLimit);
- void mapChanged(int index);
- void setRandomSeed();
- void setRandomTheme();
- void setRandomMap();
- void setRandomStatic();
- void setRandomMission();
- void themeSelected(const QModelIndex & current, const QModelIndex &);
- void addInfoToPreview(QPixmap image);
- void seedEdited();
-
- protected:
- virtual void resizeEvent ( QResizeEvent * event );
-
- private:
- QGridLayout mainLayout;
- QPushButton* imageButt;
- QComboBox* chooseMap;
- IconedGroupBox* gbThemes;
- QListView* lvThemes;
- HWMap* pMap;
- QString m_seed;
- QPushButton* seedSet;
- QLabel* seedLabel;
- int hhLimit;
- int templateFilter;
- QPixmap hhSmall;
- QLabel* lblFilter;
- QComboBox* cbTemplateFilter;
- QLabel *maze_size_label;
- QComboBox *cbMazeSize;
- MapGenerator mapgen;
- int numMissions;
- DrawMapScene drawMapScene;
-
- void intSetSeed(const QString & seed);
- void intSetMap(const QString & map);
- void intSetMapgen(MapGenerator m);
- void intSetTemplateFilter(int);
- void intSetMazeSize(int size);
- void updatePreview();
-};
-
-#endif // _HWMAP_CONTAINER_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/misc.cpp
--- a/QTfrontend/misc.cpp Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2005-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "misc.h"
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/misc.h
--- a/QTfrontend/misc.h Fri Oct 28 18:27:55 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2005-2011 Andrey Korotaev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef _MISC_H
-#define _MISC_H
-
-
-#include
-#include
-
-class FreqSpinBox : public QSpinBox
-{
- Q_OBJECT
-
-public:
- FreqSpinBox(QWidget* parent) : QSpinBox(parent)
- {
-
- }
-
- QString textFromValue(int value) const
- {
- if (!value)
- return tr("Never");
- else
- return tr("Every %1 turn", "", value).arg(value);
- }
-};
-
-
-#endif // _MISC_H
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/ammoSchemeModel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/model/ammoSchemeModel.cpp Fri Oct 28 18:33:38 2011 +0200
@@ -0,0 +1,786 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2005-2011 Andrey Korotaev
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include
+#include
+
+#include "ammoSchemeModel.h"
+#include "hwconsts.h"
+
+QList defaultScheme = QList()
+ << QVariant("Default") // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(false) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(45) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(5) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(4) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(2) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
+ QAbstractTableModel(parent),
+ fileConfig(fileName, QSettings::IniFormat)
+{
+ predefSchemesNames = QStringList()
+ << "Default"
+ << "Pro Mode"
+ << "Shoppa"
+ << "Clean Slate"
+ << "Minefield"
+ << "Barrel Mayhem"
+ << "Tunnel Hogs"
+ << "Fort Mode"
+ << "Timeless"
+ << "Thinking with Portals"
+ << "King Mode"
+ ;
+
+ numberOfDefaultSchemes = predefSchemesNames.size();
+
+ spNames = QStringList()
+ << "name" // 0
+ << "fortsmode" // 1
+ << "divteams" // 2
+ << "solidland" // 3
+ << "border" // 4
+ << "lowgrav" // 5
+ << "laser" // 6
+ << "invulnerability" // 7
+ << "resethealth" // 8
+ << "vampiric" // 9
+ << "karma" // 10
+ << "artillery" // 11
+ << "randomorder" // 12
+ << "king" // 13
+ << "placehog" // 14
+ << "sharedammo" // 15
+ << "disablegirders" // 16
+ << "disablelandobjects" // 17
+ << "aisurvival" // 18
+ << "infattack" // 19
+ << "resetweps" // 20
+ << "perhogammo" // 21
+ << "disablewind" // 22
+ << "morewind" // 23
+ << "tagteam" // 24
+ << "bottomborder" // 25
+ << "damagefactor" // 26
+ << "turntime" // 27
+ << "health" // 28
+ << "suddendeath" // 29
+ << "caseprobability" // 30
+ << "minestime" // 31
+ << "minesnum" // 32
+ << "minedudpct" // 33
+ << "explosives" // 34
+ << "healthprobability" // 35
+ << "healthcaseamount" // 36
+ << "waterrise" // 37
+ << "healthdecrease" // 38
+ << "ropepct" // 39
+ << "getawaytime" // 40
+ ;
+
+ QList proMode;
+ proMode
+ << predefSchemesNames[1] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(true) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(15) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(0) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(0) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(2) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList shoppa;
+ shoppa
+ << predefSchemesNames[2] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(true) // solid land 3
+ << QVariant(true) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(true) // shared ammo 15
+ << QVariant(true) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(true) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(30) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(50) // sudden death 29
+ << QVariant(1) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(0) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(0) // explosives 34
+ << QVariant(0) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList cleanslate;
+ cleanslate
+ << predefSchemesNames[3] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(true) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(false) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(true) // inf. attack 19
+ << QVariant(true) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(45) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(5) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(4) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(2) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList minefield;
+ minefield
+ << predefSchemesNames[4] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(true) // shared ammo 15
+ << QVariant(true) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(30) // turn time 27
+ << QVariant(50) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(0) // case prob 30
+ << QVariant(0) // mines time 31
+ << QVariant(80) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(0) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList barrelmayhem;
+ barrelmayhem
+ << predefSchemesNames[5] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(true) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(30) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(0) // case prob 30
+ << QVariant(0) // mines time 31
+ << QVariant(0) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(80) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList tunnelhogs;
+ tunnelhogs
+ << predefSchemesNames[6] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(true) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(true) // shared ammo 15
+ << QVariant(true) // disable girders 16
+ << QVariant(true) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(30) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(5) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(10) // mines number 32
+ << QVariant(10) // mine dud pct 33
+ << QVariant(10) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList forts;
+ forts
+ << predefSchemesNames[7] // name 0
+ << QVariant(true) // fortsmode 1
+ << QVariant(true) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(true) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(false) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(45) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(5) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(0) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(0) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList timeless;
+ timeless
+ << predefSchemesNames[8] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(false) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(true) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(9999) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(5) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(5) // mines number 32
+ << QVariant(10) // mine dud pct 33
+ << QVariant(2) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(30) // health case amt 36
+ << QVariant(0) // water rise amt 37
+ << QVariant(0) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList thinkingportals;
+ thinkingportals
+ << predefSchemesNames[9] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(true) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(false) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(false) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(45) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(2) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(5) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(5) // explosives 34
+ << QVariant(25) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+ QList kingmode;
+ kingmode
+ << predefSchemesNames[10] // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(false) // reset health 8
+ << QVariant(false) // vampiric 9
+ << QVariant(false) // karma 10
+ << QVariant(false) // artillery 11
+ << QVariant(true) // random order 12
+ << QVariant(true) // king 13
+ << QVariant(false) // place hog 14
+ << QVariant(false) // shared ammo 15
+ << QVariant(false) // disable girders 16
+ << QVariant(false) // disable land objects 17
+ << QVariant(false) // AI survival 18
+ << QVariant(false) // inf. attack 19
+ << QVariant(false) // reset weps 20
+ << QVariant(false) // per hog ammo 21
+ << QVariant(false) // no wind 22
+ << QVariant(false) // more wind 23
+ << QVariant(false) // tag team 24
+ << QVariant(false) // bottom border 25
+ << QVariant(100) // damage modfier 26
+ << QVariant(45) // turn time 27
+ << QVariant(100) // init health 28
+ << QVariant(15) // sudden death 29
+ << QVariant(5) // case prob 30
+ << QVariant(3) // mines time 31
+ << QVariant(4) // mines number 32
+ << QVariant(0) // mine dud pct 33
+ << QVariant(2) // explosives 34
+ << QVariant(35) // health case pct 35
+ << QVariant(25) // health case amt 36
+ << QVariant(47) // water rise amt 37
+ << QVariant(5) // health dec amt 38
+ << QVariant(100) // rope modfier 39
+ << QVariant(100) // get away time 40
+ ;
+
+
+ schemes.append(defaultScheme);
+ schemes.append(proMode);
+ schemes.append(shoppa);
+ schemes.append(cleanslate);
+ schemes.append(minefield);
+ schemes.append(barrelmayhem);
+ schemes.append(tunnelhogs);
+ schemes.append(forts);
+ schemes.append(timeless);
+ schemes.append(thinkingportals);
+ schemes.append(kingmode);
+
+
+ int size = fileConfig.beginReadArray("schemes");
+ for (int i = 0; i < size; ++i) {
+ fileConfig.setArrayIndex(i);
+
+ if (!predefSchemesNames.contains(fileConfig.value(spNames[0]).toString()))
+ {
+ QList scheme;
+
+ for (int k = 0; k < spNames.size(); ++k)
+ scheme << fileConfig.value(spNames[k], defaultScheme[k]);
+
+ schemes.append(scheme);
+ }
+ }
+ fileConfig.endArray();
+}
+
+QVariant AmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ Q_UNUSED(section);
+ Q_UNUSED(orientation);
+ Q_UNUSED(role);
+
+ return QVariant();
+}
+
+int AmmoSchemeModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ else
+ return schemes.size();
+}
+
+int AmmoSchemeModel::columnCount(const QModelIndex & parent) const
+{
+ if (parent.isValid())
+ return 0;
+ else
+ return defaultScheme.size();
+}
+
+Qt::ItemFlags AmmoSchemeModel::flags(const QModelIndex & index) const
+{
+ Q_UNUSED(index);
+
+ return
+ Qt::ItemIsEnabled
+ | Qt::ItemIsSelectable
+ | Qt::ItemIsEditable;
+}
+
+bool AmmoSchemeModel::setData(const QModelIndex & index, const QVariant & value, int role)
+{
+ if (!index.isValid() || index.row() < numberOfDefaultSchemes
+ || index.row() >= schemes.size()
+ || index.column() >= defaultScheme.size()
+ || role != Qt::EditRole)
+ return false;
+
+ schemes[index.row()][index.column()] = value;
+
+ emit dataChanged(index, index);
+ return true;
+}
+
+bool AmmoSchemeModel::insertRows(int row, int count, const QModelIndex & parent)
+{
+ Q_UNUSED(count);
+
+ beginInsertRows(parent, schemes.size(), schemes.size());
+
+ if (row == -1)
+ {
+ QList newScheme = defaultScheme;
+ newScheme[0] = QVariant(tr("new"));
+ schemes.insert(schemes.size(), newScheme);
+ }
+ else
+ {
+ QList newScheme = schemes[row];
+ newScheme[0] = QVariant(tr("copy of") + " " + newScheme[0].toString());
+ schemes.insert(schemes.size(), newScheme);
+ }
+
+ endInsertRows();
+
+ return true;
+}
+
+bool AmmoSchemeModel::removeRows(int row, int count, const QModelIndex & parent)
+{
+ if(count != 1
+ || row < numberOfDefaultSchemes
+ || row >= schemes.size())
+ return false;
+
+ beginRemoveRows(parent, row, row);
+
+ schemes.removeAt(row);
+
+ endRemoveRows();
+
+ return true;
+}
+
+QVariant AmmoSchemeModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || index.row() < 0
+ || index.row() >= schemes.size()
+ || index.column() >= defaultScheme.size()
+ || (role != Qt::EditRole && role != Qt::DisplayRole)
+ )
+ return QVariant();
+
+ return schemes[index.row()][index.column()];
+}
+
+void AmmoSchemeModel::Save()
+{
+ fileConfig.beginWriteArray("schemes", schemes.size() - numberOfDefaultSchemes);
+
+ for (int i = 0; i < schemes.size() - numberOfDefaultSchemes; ++i) {
+ fileConfig.setArrayIndex(i);
+
+ QList scheme = schemes[i + numberOfDefaultSchemes];
+
+ for (int k = 0; k < scheme.size(); ++k)
+ fileConfig.setValue(spNames[k], scheme[k]);
+ }
+ fileConfig.endArray();
+}
+
+
+NetAmmoSchemeModel::NetAmmoSchemeModel(QObject * parent) :
+ QAbstractTableModel(parent)
+{
+ netScheme = defaultScheme;
+}
+
+QVariant NetAmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ Q_UNUSED(section);
+ Q_UNUSED(orientation);
+ Q_UNUSED(role);
+
+ return QVariant();
+}
+
+int NetAmmoSchemeModel::rowCount(const QModelIndex & parent) const
+{
+ if (parent.isValid())
+ return 0;
+ else
+ return 1;
+}
+
+int NetAmmoSchemeModel::columnCount(const QModelIndex & parent) const
+{
+ if (parent.isValid())
+ return 0;
+ else
+ return defaultScheme.size();
+}
+
+QVariant NetAmmoSchemeModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || index.row() < 0
+ || index.row() > 1
+ || index.column() >= defaultScheme.size()
+ || (role != Qt::EditRole && role != Qt::DisplayRole)
+ )
+ return QVariant();
+
+ return netScheme[index.column()];
+}
+
+void NetAmmoSchemeModel::setNetSchemeConfig(QStringList & cfg)
+{
+ if(cfg.size() != netScheme.size())
+ {
+ qWarning("Incorrect scheme cfg size");
+ return;
+ }
+
+ for(int i = 0; i < cfg.size(); ++i)
+ netScheme[i] = QVariant(cfg[i]);
+
+ reset();
+}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/ammoSchemeModel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/model/ammoSchemeModel.h Fri Oct 28 18:33:38 2011 +0200
@@ -0,0 +1,79 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2005-2011 Andrey Korotaev
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef _AMMO_SCHEME_MODEL_INCLUDED
+#define _AMMO_SCHEME_MODEL_INCLUDED
+
+#include
+#include
+#include
+#include
+
+class AmmoSchemeModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ AmmoSchemeModel(QObject * parent, const QString & fileName);
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ int rowCount(const QModelIndex & parent) const;
+ int columnCount(const QModelIndex & parent) const;
+ Qt::ItemFlags flags(const QModelIndex & index) const;
+ bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
+ bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
+ bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
+ QVariant data(const QModelIndex &index, int role) const;
+
+ int numberOfDefaultSchemes;
+ QStringList predefSchemesNames;
+ QStringList spNames;
+
+public slots:
+ void Save();
+
+signals:
+ void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
+
+protected:
+ QList< QList > schemes;
+
+private:
+ QSettings fileConfig;
+};
+
+class NetAmmoSchemeModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ NetAmmoSchemeModel(QObject * parent);
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ int rowCount(const QModelIndex & parent) const;
+ int columnCount(const QModelIndex & parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
+
+public slots:
+ void setNetSchemeConfig(QStringList & cfg);
+
+private:
+ QList netScheme;
+};
+
+#endif // _AMMO_SCHEME_MODEL_INCLUDED
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/hats.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/model/hats.cpp Fri Oct 28 18:33:38 2011 +0200
@@ -0,0 +1,129 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2008-2011 Andrey Korotaev
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include
+#include
+#include
+#include "hwconsts.h"
+#include "hwform.h"
+#include "hats.h"
+
+#include "HWDataManager.h"
+
+HatsModel::HatsModel(QObject* parent) :
+ QAbstractListModel(parent)
+{
+ HWDataManager & dataMgr = HWDataManager::instance();
+
+ QPixmap hhpix = QPixmap(
+ dataMgr.findFileForRead("Graphics/Hedgehog/Idle.png")
+ ).copy(0, 0, 32, 32);
+
+ // my reserved hats
+ QStringList hatsList = dataMgr.entryList(
+ "Graphics/Hats/Reserved",
+ QDir::Files,
+ QStringList(playerHash+"*.png")
+ );
+
+ int nReserved = hatsList.size();
+
+ // regular hats
+ hatsList.append(dataMgr.entryList(
+ "Graphics/Hats",
+ QDir::Files,
+ QStringList("*.png")
+ )
+ );
+
+
+ int nHats = hatsList.size();
+
+ for (int i = 0; i < nHats; i++)
+ {
+ bool isReserved = (i < nReserved);
+
+ QString str = hatsList.at(i);
+ str = str.remove(QRegExp("\\.png$"));
+ QPixmap pix(
+ dataMgr.findFileForRead(
+ "Graphics/Hats/" + QString(isReserved?"Reserved/":"") + str +
+ ".png"
+ )
+ );
+
+ // rename properly
+ if (isReserved)
+ str = "Reserved "+str.remove(0,32);
+
+ QPixmap tmppix(32, 37);
+ tmppix.fill(QColor(Qt::transparent));
+
+ QPainter painter(&tmppix);
+ painter.drawPixmap(QPoint(0, 5), hhpix);
+ painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32));
+ if(pix.width() > 32)
+ painter.drawPixmap(QPoint(0, 0), pix.copy(32, 0, 32, 32));
+ painter.end();
+
+ if (str == "NoHat")
+ hats.prepend(qMakePair(str, QIcon(tmppix)));
+ else
+ hats.append(qMakePair(str, QIcon(tmppix)));
+ }
+}
+
+QVariant HatsModel::headerData(int section,
+ Qt::Orientation orientation, int role) const
+{
+ Q_UNUSED(section);
+ Q_UNUSED(orientation);
+ Q_UNUSED(role);
+
+ return QVariant();
+}
+
+int HatsModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ else
+ return hats.size();
+}
+
+/*int HatsModel::columnCount(const QModelIndex & parent) const
+{
+ if (parent.isValid())
+ return 0;
+ else
+ return 2;
+}
+*/
+QVariant HatsModel::data(const QModelIndex &index,
+ int role) const
+{
+ if (!index.isValid() || index.row() < 0
+ || index.row() >= hats.size()
+ || (role != Qt::DisplayRole && role != Qt::DecorationRole))
+ return QVariant();
+
+ if (role == Qt::DisplayRole)
+ return hats.at(index.row()).first;
+ else // role == Qt::DecorationRole
+ return hats.at(index.row()).second;
+}
diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/hats.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/model/hats.h Fri Oct 28 18:33:38 2011 +0200
@@ -0,0 +1,44 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2008-2011 Andrey Korotaev
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef _HATS_INCLUDED
+#define _HATS_INCLUDED
+
+#include
+#include
+#include
+#include
+#include