QTfrontend/gameuiconfig.h
author nemo
Sun, 24 Mar 2024 14:05:06 -0400
branch1.0.0
changeset 16022 64740eec84ad
parent 15320 3bf780084c86
child 15685 d92eeb468dad
permissions -rw-r--r--
requested change by andu. filtering out ignored player. lobby notice
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 949
diff changeset
     2
 * Hedgewars, a free turn based strategy game
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10108
diff changeset
     3
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     4
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     8
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    12
 * GNU General Public License for more details.
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    13
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 10015
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    17
 */
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    18
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    19
#ifndef GAMECONFIG_H
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    20
#define GAMECONFIG_H
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    21
301
29bf9c1a3ad3 Use QSettings to storing config
unc0rr
parents: 297
diff changeset
    22
#include <QSettings>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    23
#include <QStringList>
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 529
diff changeset
    24
#include <QRect>
5260
f50f620771ee When the password field is filled with null characters and when the user tries to edit the field, clear it.
Zorg <zorgiepoo@gmail.com>
parents: 5229
diff changeset
    25
#include <QEvent>
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8325
diff changeset
    26
#include <QList>
8354
c25bee85d6f8 Separated fullscreen and windowed hwengine resolution parameters.
vitiv <nikita.utiu@gmail.com>
parents: 8346
diff changeset
    27
#include <utility>
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8325
diff changeset
    28
#include "binds.h"
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    29
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    30
class HWForm;
301
29bf9c1a3ad3 Use QSettings to storing config
unc0rr
parents: 297
diff changeset
    31
class QSettings;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    32
301
29bf9c1a3ad3 Use QSettings to storing config
unc0rr
parents: 297
diff changeset
    33
class GameUIConfig : public QSettings
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    34
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    35
        Q_OBJECT
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    36
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    37
    public:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    38
        HWForm * Form;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    39
        GameUIConfig(HWForm * FormWidgets, const QString & fileName);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    40
        QStringList GetTeamsList();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    41
        QRect vid_Resolution();
8354
c25bee85d6f8 Separated fullscreen and windowed hwengine resolution parameters.
vitiv <nikita.utiu@gmail.com>
parents: 8346
diff changeset
    42
        std::pair<QRect, QRect> vid_ResolutionPair();
15320
3bf780084c86 Remember maximized state of game window
Wuzzy <Wuzzy2@mail.ru>
parents: 14982
diff changeset
    43
        bool vid_Maximized();
3bf780084c86 Remember maximized state of game window
Wuzzy <Wuzzy2@mail.ru>
parents: 14982
diff changeset
    44
        void vid_SetMaximized(bool isMaximized);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    45
        bool vid_Fullscreen();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    46
        quint32 translateQuality();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    47
        bool isSoundEnabled();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    48
        bool isFrontendSoundEnabled();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    49
        QString language();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    50
        bool isMusicEnabled();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    51
        bool isFrontendMusicEnabled();
13628
d5e029b84e16 Add setting to disable audio dampening if losing window focus
Wuzzy <Wuzzy2@mail.ru>
parents: 11046
diff changeset
    52
        bool isAudioDampenEnabled();
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    53
        bool isShowFPSEnabled();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    54
        bool isAltDamageEnabled();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    55
        bool appendDateTimeToRecordName();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    56
        quint8 volume();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    57
        quint8 timerInterval();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    58
        QString netNick();
14761
7b2bd37d7503 Fix inconsistencies in guest nick name generation
Wuzzy <Wuzzy2@mail.ru>
parents: 14698
diff changeset
    59
        QString getRandomNick();
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    60
        QByteArray netPasswordHash();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    61
        int netPasswordLength();
8294
0e5782b0dd54 Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents: 8179
diff changeset
    62
        void clearPasswordHash();
0e5782b0dd54 Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents: 8179
diff changeset
    63
        void setPasswordHash(const QString & passwordhash);
0e5782b0dd54 Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents: 8179
diff changeset
    64
        QString passwordHash();
0e5782b0dd54 Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents: 8179
diff changeset
    65
        void clearTempHash();
0e5782b0dd54 Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents: 8179
diff changeset
    66
        void setTempHash(const QString & temphash);
0e5782b0dd54 Removed whitespaces, refactored hash setting getting and clearing
Ondrej Skopek <skopekondrej@gmail.com>
parents: 8179
diff changeset
    67
        QString tempHash();
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    68
        void setNetPasswordLength(int passwordLength);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    69
        bool isReducedQuality() const;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    70
        bool isFrontendEffects() const;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    71
        bool isFrontendFullscreen() const;
14698
93429d8f6b3f Add setting to set default/initial zoom
Wuzzy <Wuzzy2@mail.ru>
parents: 14691
diff changeset
    72
        quint16 zoom();
14691
56831f466d1d Add settings.ini setting and hwengine param to disable holiday silliness (hat changes, etc.)
Wuzzy <Wuzzy2@mail.ru>
parents: 13628
diff changeset
    73
        bool isHolidaySillinessEnabled() const;
14982
575dbd7b5f43 Quick games: Cap max. difficulty for the first 15 games
Wuzzy <Wuzzy2@mail.ru>
parents: 14761
diff changeset
    74
        int quickGameExperience() const;
575dbd7b5f43 Quick games: Cap max. difficulty for the first 15 games
Wuzzy <Wuzzy2@mail.ru>
parents: 14761
diff changeset
    75
        void setQuickGameExperience(int exp);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    76
        void resizeToConfigValues();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    77
        quint32 stereoMode() const;
8179
a1ffcb559f99 Refactor: get rid of excessive QSettings instances on the same poor hedgewars.ini file
unc0rr
parents: 7633
diff changeset
    78
        void setValue(const QString & key, const QVariant & value);
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8325
diff changeset
    79
        QString bind(int bindID);
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8325
diff changeset
    80
        void setBind(int bindID, QString & strbind);
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
    81
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    82
        QString AVFormat();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    83
        QString videoCodec();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    84
        QString audioCodec();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    85
        QRect rec_Resolution();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    86
        int rec_Framerate();
7633
d4251e519062 Allow adjusting bitrate so that I can get a somewhat usable webm video. The audio is still tinny and unlistenable. Configuration option for that might be helpful, or just adjusting defaults in the wrapper.
nemo
parents: 7235
diff changeset
    87
        int rec_Bitrate();
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    88
        bool recordAudio();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    89
2401
2a694ea2a437 fixes & co.
koda
parents: 2395
diff changeset
    90
#ifdef __APPLE__
2a694ea2a437 fixes & co.
koda
parents: 2395
diff changeset
    91
#ifdef SPARKLE_ENABLED
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    92
        bool isAutoUpdateEnabled();
2401
2a694ea2a437 fixes & co.
koda
parents: 2395
diff changeset
    93
#endif
2261
57e99c908e7c a lot of stuff:
koda
parents: 2098
diff changeset
    94
#endif
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    95
        void reloadValues();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
    96
        void reloadVideosValues();
2377
f3fab2b09e0c And in frontend
nemo
parents: 2261
diff changeset
    97
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    98
    signals:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
    99
        void frontendFullscreen(bool value);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   100
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
   101
    public slots:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
   102
        void SaveOptions();
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents: 6952
diff changeset
   103
        void SaveVideosOptions();
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
   104
        void updNetNick();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
   105
    private:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
   106
        bool netPasswordIsValid();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 5390
diff changeset
   107
        bool eventFilter(QObject *object, QEvent *event);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8354
diff changeset
   108
        QString temphash;
8346
3443e0de2c9d GCI2012: Advanced Keyboard Configuration
dag10
parents: 8325
diff changeset
   109
        QList<BindAction> m_binds;
9547
f9e82f34c904 Fix issue 662
unc0rr
parents: 9080
diff changeset
   110
f9e82f34c904 Fix issue 662
unc0rr
parents: 9080
diff changeset
   111
        void applyProxySettings();
15320
3bf780084c86 Remember maximized state of game window
Wuzzy <Wuzzy2@mail.ru>
parents: 14982
diff changeset
   112
        bool pIsEngineWindowMaximized;
14761
7b2bd37d7503 Fix inconsistencies in guest nick name generation
Wuzzy <Wuzzy2@mail.ru>
parents: 14698
diff changeset
   113
7b2bd37d7503 Fix inconsistencies in guest nick name generation
Wuzzy <Wuzzy2@mail.ru>
parents: 14698
diff changeset
   114
        QString cachedRandomNick;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   115
};
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   116
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   117
#endif