QTfrontend/ui/widget/MinesTimeSpinBox.cpp
author alfadur <mail@none>
Wed, 06 Feb 2019 00:14:04 +0300
changeset 14686 9f98086de1b6
parent 11815 68bc5ebce319
permissions -rw-r--r--
Server action refactoring part 9 of N
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 implementation
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
#include "MinesTimeSpinBox.h"
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    25
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
MinesTimeSpinBox::MinesTimeSpinBox(QWidget* parent) : QSpinBox(parent)
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
{
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
    // do nothing
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
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
QString MinesTimeSpinBox::textFromValue(int value) const
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
{
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
    switch (value)
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
    {
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    37
        case -1: return tr("Random");
68bc5ebce319 Fix mines time displaying "1 seconds" in frontend
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
        default: return tr("%1 seconds", "", value).arg(value);
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
}