author | koda |
Wed, 27 Feb 2013 16:14:24 +0100 | |
branch | physfslayer |
changeset 8561 | c3bc61f21874 |
parent 8488 | e72f3398a28b |
child 8534 | 92da587691c9 |
permissions | -rw-r--r-- |
8377 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2004-2012 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#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:
8434
diff
changeset
|
20 |
#include <QGridLayout> |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
21 |
#include <QHBoxLayout> |
8377 | 22 |
#include <QScrollArea> |
23 |
#include <QPushButton> |
|
24 |
#include <QToolButton> |
|
25 |
#include <QWidgetItem> |
|
26 |
#include <QModelIndex> |
|
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:
8434
diff
changeset
|
27 |
#include <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:
8434
diff
changeset
|
28 |
#include <QLineEdit> |
8377 | 29 |
#include <QLabel> |
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:
8434
diff
changeset
|
30 |
#include <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:
8434
diff
changeset
|
31 |
#include <QDebug> |
8377 | 32 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8377
diff
changeset
|
33 |
#include "DataManager.h" |
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:
8434
diff
changeset
|
34 |
#include "lineeditcursor.h" |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8377
diff
changeset
|
35 |
#include "ThemeModel.h" |
8377 | 36 |
#include "themeprompt.h" |
37 |
||
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:
8434
diff
changeset
|
38 |
ThemePrompt::ThemePrompt(int currentIndex, QWidget* parent) : QDialog(parent) |
8377 | 39 |
{ |
8434 | 40 |
setModal(true); |
41 |
setWindowFlags(Qt::Sheet); |
|
42 |
setWindowModality(Qt::WindowModal); |
|
43 |
setMinimumSize(550, 430); |
|
44 |
resize(550, 430); |
|
45 |
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
|
8377 | 46 |
|
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:
8434
diff
changeset
|
47 |
setStyleSheet("QPushButton { padding: 5px; margin-top: 10px; }"); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
48 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
49 |
// Theme model, and a model for setting a filter |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
50 |
ThemeModel * themeModel = DataManager::instance().themeModel(); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
51 |
filterModel = new 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:
8434
diff
changeset
|
52 |
filterModel->setSourceModel(themeModel); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
53 |
filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
54 |
|
8434 | 55 |
// Grid |
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:
8434
diff
changeset
|
56 |
QGridLayout * dialogLayout = new QGridLayout(this); |
8434 | 57 |
dialogLayout->setSpacing(0); |
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:
8434
diff
changeset
|
58 |
dialogLayout->setColumnStretch(1, 1); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
59 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
60 |
QHBoxLayout * topLayout = new QHBoxLayout(); |
8377 | 61 |
|
8434 | 62 |
// Help/prompt message at top |
8488
e72f3398a28b
Removed in-lineedit labels such as "search:" and "room name:" due to size issues with localization and platform differences.
dag10
parents:
8475
diff
changeset
|
63 |
QLabel * lblDesc = new QLabel(tr("Search for a theme:")); |
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:
8434
diff
changeset
|
64 |
lblDesc->setObjectName("lblDesc"); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
65 |
lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}"); |
8377 | 66 |
lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
67 |
lblDesc->setFixedHeight(24); |
|
68 |
lblDesc->setMinimumWidth(0); |
|
69 |
||
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:
8434
diff
changeset
|
70 |
// Filter text box |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
71 |
QWidget * filterContainer = new QWidget(); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
72 |
filterContainer->setFixedHeight(24); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
73 |
filterContainer->setObjectName("filterContainer"); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
74 |
filterContainer->setStyleSheet("#filterContainer { background: #F6CB1C; border-top-right-radius: 10px; padding: 3px; }"); |
8488
e72f3398a28b
Removed in-lineedit labels such as "search:" and "room name:" due to size issues with localization and platform differences.
dag10
parents:
8475
diff
changeset
|
75 |
filterContainer->setFixedWidth(150); |
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:
8434
diff
changeset
|
76 |
txtFilter = new LineEditCursor(filterContainer); |
8488
e72f3398a28b
Removed in-lineedit labels such as "search:" and "room name:" due to size issues with localization and platform differences.
dag10
parents:
8475
diff
changeset
|
77 |
txtFilter->setFixedWidth(150); |
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:
8434
diff
changeset
|
78 |
txtFilter->setFocus(); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
79 |
txtFilter->setFixedHeight(22); |
8488
e72f3398a28b
Removed in-lineedit labels such as "search:" and "room name:" due to size issues with localization and platform differences.
dag10
parents:
8475
diff
changeset
|
80 |
txtFilter->setStyleSheet("LineEditCursor { border-width: 0px; border-radius: 6px; margin-top: 3px; margin-right: 3px; padding-left: 4px; padding-bottom: 2px; background-color: rgb(23, 11, 54); } LineEditCursor:hover, LineEditCursor:focus { background-color: rgb(13, 5, 68); }"); |
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:
8434
diff
changeset
|
81 |
connect(txtFilter, SIGNAL(textChanged(const QString &)), this, SLOT(filterChanged(const QString &))); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
82 |
connect(txtFilter, SIGNAL(moveUp()), this, SLOT(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:
8434
diff
changeset
|
83 |
connect(txtFilter, SIGNAL(moveDown()), this, SLOT(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:
8434
diff
changeset
|
84 |
connect(txtFilter, SIGNAL(moveLeft()), this, SLOT(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:
8434
diff
changeset
|
85 |
connect(txtFilter, SIGNAL(moveRight()), this, SLOT(moveRight())); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
86 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
87 |
// Corner widget |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
88 |
QLabel * corner = new QLabel(); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
89 |
corner->setPixmap(QPixmap(QString::fromUtf8(":/res/inverse-corner-bl.png"))); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
90 |
corner->setFixedSize(10, 10); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
91 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
92 |
// Add widgets to top layout |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
93 |
topLayout->addWidget(lblDesc); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
94 |
topLayout->addWidget(filterContainer); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
95 |
topLayout->addWidget(corner, 0, Qt::AlignBottom); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
96 |
topLayout->addStretch(1); |
8377 | 97 |
|
8434 | 98 |
// Cancel button (closes dialog) |
99 |
QPushButton * btnCancel = new QPushButton(tr("Cancel")); |
|
100 |
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); |
|
8377 | 101 |
|
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:
8434
diff
changeset
|
102 |
// Select button |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
103 |
QPushButton * btnSelect = new QPushButton(tr("Use selected theme")); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
104 |
btnSelect->setDefault(true); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
105 |
connect(btnSelect, SIGNAL(clicked()), this, SLOT(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:
8434
diff
changeset
|
106 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
107 |
// Add themes |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
108 |
list = new ThemeListView(); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
109 |
list->setModel(filterModel); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
110 |
list->setViewMode(QListView::IconMode); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
111 |
list->setResizeMode(QListView::Adjust); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
112 |
list->setMovement(QListView::Static); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
113 |
list->setEditTriggers(QAbstractItemView::NoEditTriggers); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
114 |
list->setSpacing(8); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
115 |
list->setWordWrap(true); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
116 |
list->setSelectionMode(QAbstractItemView::SingleSelection); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
117 |
list->setObjectName("themeList"); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
118 |
list->setCurrentIndex(filterModel->index(currentIndex, 0)); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
119 |
connect(list, SIGNAL(activated(const QModelIndex &)), this, SLOT(themeChosen(const 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:
8434
diff
changeset
|
120 |
connect(list, SIGNAL(clicked(const QModelIndex &)), this, SLOT(themeChosen(const 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:
8434
diff
changeset
|
121 |
|
8434 | 122 |
// Add elements to layouts |
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:
8434
diff
changeset
|
123 |
dialogLayout->addLayout(topLayout, 0, 0, 1, 3); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
124 |
dialogLayout->addWidget(list, 1, 0, 1, 3); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
125 |
dialogLayout->addWidget(btnCancel, 2, 0, 1, 1, Qt::AlignLeft); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
126 |
dialogLayout->addWidget(btnSelect, 2, 2, 1, 1, Qt::AlignRight); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
127 |
} |
8377 | 128 |
|
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:
8434
diff
changeset
|
129 |
void ThemePrompt::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:
8434
diff
changeset
|
130 |
{ |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
131 |
list->setCurrentIndex(list->moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier)); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
132 |
} |
8377 | 133 |
|
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:
8434
diff
changeset
|
134 |
void ThemePrompt::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:
8434
diff
changeset
|
135 |
{ |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
136 |
list->setCurrentIndex(list->moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier)); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
137 |
} |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
138 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
139 |
void ThemePrompt::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:
8434
diff
changeset
|
140 |
{ |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
141 |
list->setCurrentIndex(list->moveCursor(QAbstractItemView::MoveLeft, Qt::NoModifier)); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
142 |
} |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
143 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
144 |
void ThemePrompt::moveRight() |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
145 |
{ |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
146 |
list->setCurrentIndex(list->moveCursor(QAbstractItemView::MoveRight, Qt::NoModifier)); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
147 |
} |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
148 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
149 |
void ThemePrompt::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:
8434
diff
changeset
|
150 |
{ |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
151 |
themeChosen(list->currentIndex()); |
8377 | 152 |
} |
153 |
||
154 |
// When a theme is selected |
|
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:
8434
diff
changeset
|
155 |
void ThemePrompt::themeChosen(const QModelIndex & index) |
8377 | 156 |
{ |
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:
8434
diff
changeset
|
157 |
done(filterModel->mapToSource(index).row() + 1); // Since returning 0 means canceled |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
8377
diff
changeset
|
158 |
} |
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:
8434
diff
changeset
|
159 |
|
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
160 |
// When the text in the filter text box is changed |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
161 |
void ThemePrompt::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:
8434
diff
changeset
|
162 |
{ |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
163 |
filterModel->setFilterFixedString(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:
8434
diff
changeset
|
164 |
list->setCurrentIndex(filterModel->index(0, 0)); |
f605bc59c603
Initial theme selection is now random. Theme prompt now has a search input and no longer uses FlowLayout. (Resolves issue 520)
dag10
parents:
8434
diff
changeset
|
165 |
} |