1 /* 2 * Hedgewars, a free turn based strategy game 3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef THEMEPROMPT_H 20 #define THEMEPROMPT_H 21 22 #include <QWidget> 23 #include <QDialog> 24 #include <QListView> 25 26 class QLineEdit; 27 class QModelIndex; 28 class QSortFilterProxyModel; 29 class LineEditCursor; 30 31 class ThemeListView : public QListView 32 { 33 friend class ThemePrompt; 34 35 public: QListView(parent)36 ThemeListView(QWidget* parent = 0) : QListView(parent){} 37 void moveUp(); 38 void moveDown(); 39 void moveLeft(); 40 void moveRight(); 41 }; 42 43 class ThemePrompt : public QDialog 44 { 45 Q_OBJECT 46 47 public: 48 ThemePrompt(int currentIndex = 0, QWidget* parent = 0); 49 50 private: 51 LineEditCursor * txtFilter; 52 ThemeListView * list; 53 QSortFilterProxyModel * filterModel; 54 55 private slots: 56 void onAccepted(); 57 void onRejected(); 58 void themeChosen(const QModelIndex & index); 59 void filterChanged(const QString & text); 60 void moveUp(); 61 void moveDown(); 62 void moveLeft(); 63 void moveRight(); 64 }; 65 66 #endif // THEMEPROMPT_H 67