author | koda |
Sun, 03 Nov 2013 22:54:02 +0100 | |
branch | spacecampaign |
changeset 9647 | 2898b802a49e |
parent 9080 | 9b42757d7e71 |
child 9998 | 736015b847e3 |
permissions | -rw-r--r-- |
8377 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
9080 | 3 |
* Copyright (c) 2004-2013 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 |
|
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 |
||
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); |
|
64 |
setMinimumSize(550, 430); |
|
65 |
resize(550, 430); |
|
66 |
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
|
8377 | 67 |
|
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
|
68 |
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
|
69 |
|
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 |
// 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
|
71 |
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
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
|
8434 | 76 |
// 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
|
77 |
QGridLayout * dialogLayout = new QGridLayout(this); |
8434 | 78 |
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
|
79 |
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
|
80 |
|
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 |
QHBoxLayout * topLayout = new QHBoxLayout(); |
8377 | 82 |
|
8434 | 83 |
// 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
|
84 |
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
|
85 |
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
|
86 |
lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}"); |
8377 | 87 |
lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
88 |
lblDesc->setFixedHeight(24); |
|
89 |
lblDesc->setMinimumWidth(0); |
|
90 |
||
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
|
91 |
// 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
|
92 |
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
|
93 |
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
|
94 |
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
|
95 |
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
|
96 |
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
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
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
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
|
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 |
// 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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
|
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 |
// 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
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
topLayout->addStretch(1); |
8377 | 118 |
|
8434 | 119 |
// Cancel button (closes dialog) |
120 |
QPushButton * btnCancel = new QPushButton(tr("Cancel")); |
|
121 |
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); |
|
8377 | 122 |
|
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 |
// 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
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
|
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 |
// 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
|
129 |
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
|
130 |
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
|
131 |
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
|
132 |
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
|
133 |
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
|
134 |
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
|
135 |
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
|
136 |
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
|
137 |
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
|
138 |
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
|
139 |
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
|
140 |
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
|
141 |
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
|
142 |
|
8434 | 143 |
// 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
|
144 |
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
|
145 |
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
|
146 |
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
|
147 |
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
|
148 |
} |
8377 | 149 |
|
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
|
150 |
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
|
151 |
{ |
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
|
152 |
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
|
153 |
} |
8377 | 154 |
|
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::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
|
156 |
{ |
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
|
157 |
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
|
158 |
} |
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 |
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
|
161 |
{ |
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
|
162 |
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
|
163 |
} |
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 |
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
|
166 |
{ |
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
|
167 |
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
|
168 |
} |
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 |
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
|
171 |
{ |
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 |
themeChosen(list->currentIndex()); |
8377 | 173 |
} |
174 |
||
175 |
// 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
|
176 |
void ThemePrompt::themeChosen(const QModelIndex & index) |
8377 | 177 |
{ |
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
|
178 |
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
|
179 |
} |
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
|
180 |
|
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 |
// 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
|
182 |
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
|
183 |
{ |
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 |
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
|
185 |
list->setCurrentIndex(filterModel->index(0, 0)); |
8534
92da587691c9
Workaround queued signals problem in netclient instead. Should fix everything.
unc0rr
parents:
8488
diff
changeset
|
186 |
} |