QTfrontend/model/ThemeFilterProxyModel.h
author Wuzzy <Wuzzy2@mail.ru>
Mon, 12 Oct 2020 01:01:28 +0200
changeset 15769 ed3c5c15dcbd
parent 14849 8ed0c3761640
permissions -rw-r--r--
Fix minor offset mismatch with wrapping laser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13247
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     1
/*
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     3
 * Copyright (c) 2004-2018 Andrey Korotaev <unC0Rr@gmail.com>
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     4
 *
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     8
 *
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    13
 *
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    17
 */
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    18
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    19
/**
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    20
 * @file
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    21
 * @brief Class definition of ThemeFilterProxyModel
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    22
 */
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    23
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    24
#ifndef HEDGEWARS_THEMEFILTERPROXYMODEL_H
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    25
#define HEDGEWARS_THEMEFILTERPROXYMODEL_H
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    26
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    27
#include <QSortFilterProxyModel>
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    28
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    29
/**
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    30
 * @brief A filter model for filtering DLC themes
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    31
 */
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    32
class ThemeFilterProxyModel : public QSortFilterProxyModel
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    33
{
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    34
        Q_OBJECT
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    35
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    36
    public:
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    37
        ThemeFilterProxyModel(QObject *parent = 0);
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    38
        void setFilterDLC(bool enabled);
13248
b0022324fb4e Add IsHiddenRole to ThemeModel for hidden themes
Wuzzy <Wuzzy2@mail.ru>
parents: 13247
diff changeset
    39
        void setFilterHidden(bool enabled);
14849
8ed0c3761640 Change theme to Nature if changing from background-only or hidden theme to a generated map type
Wuzzy <Wuzzy2@mail.ru>
parents: 13248
diff changeset
    40
        void setFilterBackground(bool enabled);
13247
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    41
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    42
    protected:
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    43
        bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    44
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    45
    private:
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    46
        bool isFilteringDLC;
13248
b0022324fb4e Add IsHiddenRole to ThemeModel for hidden themes
Wuzzy <Wuzzy2@mail.ru>
parents: 13247
diff changeset
    47
        bool isFilteringHidden;
14849
8ed0c3761640 Change theme to Nature if changing from background-only or hidden theme to a generated map type
Wuzzy <Wuzzy2@mail.ru>
parents: 13248
diff changeset
    48
        bool isFilteringBackground;
13247
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    49
};
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    50
4df9d8cedf7f ThemeModel: Filter themes based on IsDlcRole rather than string-based
Wuzzy <Wuzzy2@mail.ru>
parents:
diff changeset
    51
#endif // HEDGEWARS_THEMEFILTERPROXYMODEL_H