QTfrontend/ui/widget/MinesTimeSpinBox.h
author Wuzzy <Wuzzy2@mail.ru>
Wed, 25 Oct 2017 23:09:41 +0200
changeset 12763 ad67a3804981
parent 11815 68bc5ebce319
child 12824 c75781937859
permissions -rw-r--r--
Fix sometimes ammo schemes not being saved after changing before an ammo scheme got deleted in session This was because the bool isDeleting is not initialized, so its initial value is unpredictable. Which means there's chance it starts with true, confusing the frontend.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11815
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     1
/*
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     4
 *
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
 *
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    13
 *
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
 */
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    18
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
/**
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    20
 * @file
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    21
 * @brief MinesTimeSpinBox class definition
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
 */
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    23
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    24
#ifndef HEDGEWARS_MINESTIMESPINBOX_H
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    25
#define HEDGEWARS_MINESTIMESPINBOX_H
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    27
#include <QObject>
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
#include <QSpinBox>
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    30
/**
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
 * <code>SpinBox</code> that returns its value as localized mines time.
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
 * @since  0.9.23
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
 */
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
class MinesTimeSpinBox : public QSpinBox
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
{
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
        Q_OBJECT
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    37
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
    public:
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    39
        /**
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    40
         * @brief Class constructor.
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    41
         * @param parent parent widget.
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    42
         */
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    43
        MinesTimeSpinBox(QWidget * parent);
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    44
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    45
    protected:
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    46
        /**
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    47
         * Returns it's value localized.
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    48
         * @param value integer value to be representing as string.
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    49
         * @return string representation
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    50
         */
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    51
        QString textFromValue(int value) const;
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    52
};
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    53
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    54
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    55
#endif // HEDGEWARS_MINESTIMESPINBOX_H