author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 10 Mar 2018 01:28:15 +0100 | |
changeset 13153 | 2a53b598c1ae |
parent 11490 | fb7817a5c2b1 |
child 13248 | b0022324fb4e |
permissions | -rw-r--r-- |
8377 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
8377 | 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
8377 | 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 |
||
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
38 |
|
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
39 |
void ThemeListView::moveUp() |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
40 |
{ |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
41 |
setCurrentIndex(moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier)); |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
42 |
} |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
43 |
|
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
44 |
void ThemeListView::moveDown() |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
45 |
{ |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
46 |
setCurrentIndex(moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier)); |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
47 |
} |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
48 |
|
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
49 |
void ThemeListView::moveLeft() |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
50 |
{ |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
51 |
setCurrentIndex(moveCursor(QAbstractItemView::MoveLeft, Qt::NoModifier)); |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
52 |
} |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
53 |
|
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
54 |
void ThemeListView::moveRight() |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
55 |
{ |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
56 |
setCurrentIndex(moveCursor(QAbstractItemView::MoveRight, Qt::NoModifier)); |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
57 |
} |
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
58 |
|
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
|
59 |
ThemePrompt::ThemePrompt(int currentIndex, QWidget* parent) : QDialog(parent) |
8377 | 60 |
{ |
8434 | 61 |
setModal(true); |
62 |
setWindowFlags(Qt::Sheet); |
|
63 |
setWindowModality(Qt::WindowModal); |
|
11490
fb7817a5c2b1
Add window titles for title-less windows
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
64 |
setWindowTitle(tr("Choose a theme")); |
8434 | 65 |
setMinimumSize(550, 430); |
66 |
resize(550, 430); |
|
67 |
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
|
8377 | 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
|
69 |
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
|
70 |
|
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 |
// 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
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
|
8434 | 77 |
// 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
|
78 |
QGridLayout * dialogLayout = new QGridLayout(this); |
8434 | 79 |
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
|
80 |
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
|
81 |
|
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 |
QHBoxLayout * topLayout = new QHBoxLayout(); |
8377 | 83 |
|
8434 | 84 |
// 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
|
85 |
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
|
86 |
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
|
87 |
lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}"); |
8377 | 88 |
lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
89 |
lblDesc->setFixedHeight(24); |
|
90 |
lblDesc->setMinimumWidth(0); |
|
91 |
||
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
|
92 |
// 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
|
93 |
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
|
94 |
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
|
95 |
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
|
96 |
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
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
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
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
|
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 |
// 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
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
|
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 |
// 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
|
115 |
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
|
116 |
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
|
117 |
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
|
118 |
topLayout->addStretch(1); |
8377 | 119 |
|
8434 | 120 |
// Cancel button (closes dialog) |
121 |
QPushButton * btnCancel = new QPushButton(tr("Cancel")); |
|
122 |
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); |
|
8377 | 123 |
|
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
|
124 |
// 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
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
|
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 |
// 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
|
130 |
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
|
131 |
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
|
132 |
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
|
133 |
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
|
134 |
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
|
135 |
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
|
136 |
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
|
137 |
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
|
138 |
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
|
139 |
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
|
140 |
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
|
141 |
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
|
142 |
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
|
143 |
|
8434 | 144 |
// 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
|
145 |
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
|
146 |
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
|
147 |
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
|
148 |
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
|
149 |
} |
8377 | 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
|
151 |
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
|
152 |
{ |
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
153 |
list->moveUp(); |
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
|
154 |
} |
8377 | 155 |
|
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
|
156 |
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
|
157 |
{ |
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
158 |
list->moveDown(); |
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 |
|
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::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
|
162 |
{ |
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
163 |
list->moveLeft(); |
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
|
164 |
} |
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 |
|
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
|
166 |
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
|
167 |
{ |
8731
924840dad6a0
fix compilation with clang. fixes issue 553 - thanks to julien for reporting and to drew for the first part of the fix
sheepluva
parents:
8534
diff
changeset
|
168 |
list->moveRight(); |
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
|
169 |
} |
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
|
170 |
|
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
|
171 |
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
|
172 |
{ |
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
|
173 |
themeChosen(list->currentIndex()); |
8377 | 174 |
} |
175 |
||
176 |
// 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
|
177 |
void ThemePrompt::themeChosen(const QModelIndex & index) |
8377 | 178 |
{ |
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
|
179 |
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
|
180 |
} |
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
|
181 |
|
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
|
182 |
// 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
|
183 |
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
|
184 |
{ |
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
|
185 |
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
|
186 |
list->setCurrentIndex(filterModel->index(0, 0)); |
8534
92da587691c9
Workaround queued signals problem in netclient instead. Should fix everything.
unc0rr
parents:
8488
diff
changeset
|
187 |
} |