QTfrontend/ui/page/AbstractPage.h
author sheepluva
Mon, 24 Oct 2011 20:01:25 +0200
changeset 6200 6a4ace88d85a
parent 6175 a80833ddaef0
child 6477 ad5741c252b9
permissions -rw-r--r--
tweak and document abstract page
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: 788
diff changeset
     2
 * Hedgewars, a free turn based strategy game
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4870
diff changeset
     3
 * Copyright (c) 2006-2011 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
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    17
 */
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    18
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    19
/**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    20
 * @file
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    21
 * @brief AbstractPage class definition
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    22
 */
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    23
5205
78138ae93820 some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents: 5204
diff changeset
    24
#ifndef ABSTRACTPAGE_H
78138ae93820 some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents: 5204
diff changeset
    25
#define ABSTRACTPAGE_H
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    26
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    27
#include <QWidget>
684
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
    28
#include <QPushButton>
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
    29
#include <QFont>
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
    30
#include <QGridLayout>
5205
78138ae93820 some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents: 5204
diff changeset
    31
#include <QComboBox>
1840
4747f0232b88 ttsmj2's random teams patch
unc0rr
parents: 1812
diff changeset
    32
#include <QSignalMapper>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    33
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    34
class QPushButton;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    35
class QGroupBox;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    36
class QComboBox;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    37
class QLabel;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    38
class QToolBox;
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    39
class QLineEdit;
665
5c7bfc8bac6a Start move from custom widgets to custom models
unc0rr
parents: 657
diff changeset
    40
class QListWidget;
5c7bfc8bac6a Start move from custom widgets to custom models
unc0rr
parents: 657
diff changeset
    41
class QCheckBox;
5c7bfc8bac6a Start move from custom widgets to custom models
unc0rr
parents: 657
diff changeset
    42
class QSpinBox;
5c7bfc8bac6a Start move from custom widgets to custom models
unc0rr
parents: 657
diff changeset
    43
class QTextEdit;
5c7bfc8bac6a Start move from custom widgets to custom models
unc0rr
parents: 657
diff changeset
    44
class QRadioButton;
5c7bfc8bac6a Start move from custom widgets to custom models
unc0rr
parents: 657
diff changeset
    45
class QTableView;
1377
a9e768739345 - Customize QTextBrowser look
unc0rr
parents: 1315
diff changeset
    46
class QTextBrowser;
1399
ada2411c1d60 Show additional info in rooms list
unc0rr
parents: 1395
diff changeset
    47
class QTableWidget;
1409
d1cbe4a57ebf Add button for controlling room options (no usefull yet)
unc0rr
parents: 1399
diff changeset
    48
class QAction;
1885
75489216b5b0 Continue work on new schemes
unc0rr
parents: 1884
diff changeset
    49
class QDataWidgetMapper;
1887
d68939b3f7f0 - Share model between test table and widgets
unc0rr
parents: 1885
diff changeset
    50
class QAbstractItemModel;
2773
e94f240a8a41 Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents: 2762
diff changeset
    51
class QSettings;
3694
3e9c0634065c new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents: 3690
diff changeset
    52
class QSlider;
6038
58d9badf3e7f wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents: 6009
diff changeset
    53
class QGridlayout;
665
5c7bfc8bac6a Start move from custom widgets to custom models
unc0rr
parents: 657
diff changeset
    54
684
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
    55
class AbstractPage : public QWidget
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
    56
{
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
    57
    Q_OBJECT
1885
75489216b5b0 Continue work on new schemes
unc0rr
parents: 1884
diff changeset
    58
6038
58d9badf3e7f wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents: 6009
diff changeset
    59
    signals:
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    60
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    61
         * @brief This signal is emitted when going back to the previous is
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    62
         * requested - e.g. when the back-button is clicked.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    63
         */
6038
58d9badf3e7f wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents: 6009
diff changeset
    64
        void goBack();
684
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
    65
6038
58d9badf3e7f wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents: 6009
diff changeset
    66
    protected:
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    67
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    68
         * @brief Class constructor
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    69
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    70
         * @param parent parent widget.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    71
         */
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
    72
        AbstractPage(QWidget * parent = 0);
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
    73
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    74
        /// Class Destructor
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    75
        virtual ~AbstractPage() {};
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    76
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    77
        /// Call this in the constructor of your subclass.
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
    78
        void initPage();
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
    79
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    80
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    81
         * @brief Used during page construction.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    82
         * You MUST implement this method in your subclass.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    83
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    84
         * Use it to define the main layout (no behavior) of the page.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    85
         */
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    86
        virtual QLayout * bodyLayoutDefinition() = 0;
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
    87
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    88
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    89
         * @brief Used during page construction.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    90
         * You can implement this method in your subclass.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    91
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    92
         * Use it to define layout (not behavior) of the page's footer.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    93
         */
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    94
        virtual QLayout * footerLayoutDefinition() { return NULL; };
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
    95
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    96
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    97
         * @brief Used during page construction.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    98
         * You can implement this method in your subclass.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
    99
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   100
         * This is a good place to connect signals within your page in order
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   101
         * to get the desired page behavior.<br />
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   102
         * Keep in mind not to expose twidgets as public!
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   103
         * instead define a signal with a meaningful name and connect the widget
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   104
         * signals to your page signals
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   105
         */
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   106
        virtual void connectSignals() {};
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
   107
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   108
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   109
         * @brief Creates a default formatted button for this page.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   110
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   111
         * @param name name of the button - used as its text if not hasIcon.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   112
         * @param hasIcon set to true if this is a picture button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   113
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   114
         * @return the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   115
         */
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   116
        QPushButton * formattedButton(const QString & name, bool hasIcon = false);
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
   117
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   118
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   119
         * @brief Creates a default formatted button and adds it to a
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   120
         * grid layout at the location specified.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   121
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   122
         * @param name label or path to icon of the button (depends on hasIcon)
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   123
         * @param grid pointer of the grid layout in which to insert the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   124
         * @param row layout row index in which to insert the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   125
         * @param column layout column index in which to insert the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   126
         * @param rowSpan how many layout rows the button will span.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   127
         * @param columnSpan how many layout columns the button will span.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   128
         * @param hasIcon set to true if this is a picture button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   129
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   130
         * @return the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   131
         */
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   132
        QPushButton * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false);
684
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
   133
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   134
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   135
         * @brief Creates a default formatted button and adds it to a
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   136
         * grid layout at the location specified.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   137
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   138
         * @param name label or path to icon of the button (depends on hasIcon)
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   139
         * @param box pointer of the box layout in which to insert the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   140
         * @param where layout ndex in which to insert the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   141
         * @param hasIcon set to true if this is a picture button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   142
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   143
         * @return the button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   144
         */
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   145
        QPushButton * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false);
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
   146
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   147
        /**
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   148
         * @brief Changes visibility of the back-button.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   149
         *
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   150
         * @param visible set to true if the button should be visible.
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   151
         */
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
   152
        void setBackButtonVisible(bool visible = true);
692
07787e748831 code size reduse
displacer
parents: 686
diff changeset
   153
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   154
        QFont * font14; ///< used font
684
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
   155
6038
58d9badf3e7f wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents: 6009
diff changeset
   156
    private:
6042
8b5345758f62 some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents: 6038
diff changeset
   157
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6175
diff changeset
   158
        QPushButton * btnBack; ///< back button
684
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
   159
};
257444d8429f some copy/paste code removed
displacer
parents: 683
diff changeset
   160
5205
78138ae93820 some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents: 5204
diff changeset
   161
#endif
78138ae93820 some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents: 5204
diff changeset
   162