QTfrontend/ui/widget/themeprompt.h
author dag10
Sat, 09 Feb 2013 15:26:10 -0500
changeset 8475 f605bc59c603
parent 8377 869f80966a77
child 8623 93645b4ba0de
permissions -rw-r--r--
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue #520)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     1
/*
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     4
 *
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     8
 *
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    12
 * GNU General Public License for more details.
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    13
 *
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    17
 */
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    18
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    19
#ifndef THEMEPROMPT_H
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    20
#define THEMEPROMPT_H
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    21
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    22
#include <QWidget>
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    23
#include <QDialog>
8475
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    24
#include <QListView>
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    25
8475
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    26
class QLineEdit;
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    27
class QModelIndex;
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    28
class QSortFilterProxyModel;
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    29
class LineEditCursor;
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    30
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    31
class ThemeListView : public QListView
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    32
{
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    33
    friend class ThemePrompt;
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    34
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    35
    public:
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    36
        ThemeListView(QWidget* parent = 0) : QListView(parent){}
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    37
};
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    38
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    39
class ThemePrompt : public QDialog
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    40
{
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    41
        Q_OBJECT
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    42
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    43
    public:
8475
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    44
        ThemePrompt(int currentIndex = 0, QWidget* parent = 0);
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    45
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    46
    private:
8475
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    47
        LineEditCursor * txtFilter;
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    48
        ThemeListView * list;
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    49
        QSortFilterProxyModel * filterModel;
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    50
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    51
    private slots:
8475
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    52
        void onAccepted();
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    53
        void themeChosen(const QModelIndex & index);
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    54
        void filterChanged(const QString & text);
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    55
        void moveUp();
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    56
        void moveDown();
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    57
        void moveLeft();
f605bc59c603 Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents: 8377
diff changeset
    58
        void moveRight();
8377
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    59
};
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    60
869f80966a77 GCI2012: Improve Game Configuration Widget
dag10
parents:
diff changeset
    61
#endif // THEMEPROMPT_H