@@ -121,8 +121,8 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent)
121121 connect (ui->comboBoxDuration , &QComboBox::currentTextChanged,
122122 this , &TombRaiderLinuxLauncher::filterByDuration);
123123
124- model = new LevelListModel (this );
125- ui->listViewLevels ->setModel (model );
124+ levelListModel = new LevelListModel (this );
125+ ui->listViewLevels ->setModel (levelListModel );
126126 CardItemDelegate* delegate = new CardItemDelegate (ui->listViewLevels );
127127 ui->listViewLevels ->setItemDelegate (delegate);
128128 ui->listViewLevels ->setSpacing (8 );
@@ -132,6 +132,13 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent)
132132 this ,
133133 &TombRaiderLinuxLauncher::onCurrentItemChanged);
134134
135+
136+ connect (ui->commandLinkButton , &QCommandLinkButton::clicked, this , [=]() {
137+ QString searchText = ui->lineEditSearch ->text ();
138+ qDebug () << " You searched for:" << searchText;
139+ levelListModel->filterSearch (searchText);
140+ });
141+
135142 // Read settings
136143 QString value = m_settings.value (" setup" ).toString ();
137144 if (value != " yes" ) {
@@ -142,47 +149,47 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent)
142149}
143150
144151void TombRaiderLinuxLauncher::generateList (const QList<int >& availableGames) {
145- model ->setLevels ();
152+ levelListModel ->setLevels ();
146153}
147154
148155void TombRaiderLinuxLauncher::sortByTitle () {
149- model ->sortItems (model ->compareTitles );
156+ levelListModel ->sortItems (levelListModel ->compareTitles );
150157}
151158
152159void TombRaiderLinuxLauncher::sortByDifficulty () {
153- model ->sortItems (model ->compareDifficulties );
160+ levelListModel ->sortItems (levelListModel ->compareDifficulties );
154161}
155162
156163void TombRaiderLinuxLauncher::sortByDuration () {
157- model ->sortItems (model ->compareDurations );
164+ levelListModel ->sortItems (levelListModel ->compareDurations );
158165}
159166
160167void TombRaiderLinuxLauncher::sortByClass () {
161- model ->sortItems (model ->compareClasses );
168+ levelListModel ->sortItems (levelListModel ->compareClasses );
162169}
163170
164171void TombRaiderLinuxLauncher::sortByType () {
165- model ->sortItems (model ->compareTypes );
172+ levelListModel ->sortItems (levelListModel ->compareTypes );
166173}
167174
168175void TombRaiderLinuxLauncher::sortByReleaseDate () {
169- model ->sortItems (model ->compareReleaseDates );
176+ levelListModel ->sortItems (levelListModel ->compareReleaseDates );
170177}
171178
172179void TombRaiderLinuxLauncher::filterByClass (const QString& class_) {
173- model ->filterClass (class_);
180+ levelListModel ->filterClass (class_);
174181}
175182
176183void TombRaiderLinuxLauncher::filterByType (const QString& type) {
177- model ->filterType (type);
184+ levelListModel ->filterType (type);
178185}
179186
180187void TombRaiderLinuxLauncher::filterByDifficulty (const QString& difficulty) {
181- model ->filterDifficulty (difficulty);
188+ levelListModel ->filterDifficulty (difficulty);
182189}
183190
184191void TombRaiderLinuxLauncher::filterByDuration (const QString& duration) {
185- model ->filterDuration (duration);
192+ levelListModel ->filterDuration (duration);
186193}
187194
188195void TombRaiderLinuxLauncher::readSavedSettings () {
@@ -263,7 +270,7 @@ void TombRaiderLinuxLauncher::levelDirSelected(qint64 id) {
263270void TombRaiderLinuxLauncher::onCurrentItemChanged (
264271 const QModelIndex ¤t, const QModelIndex &previous) {
265272 if (current.isValid ()) {
266- qint64 id = model ->getLid (current);
273+ qint64 id = levelListModel ->getLid (current);
267274 if (id < 0 ) { // its the original game
268275 originalSelected (id);
269276 } else {
@@ -311,7 +318,7 @@ void TombRaiderLinuxLauncher::setOptionsClicked() {
311318void TombRaiderLinuxLauncher::linkClicked () {
312319 QModelIndex current = ui->listViewLevels ->currentIndex ();
313320 if (current.isValid ()) {
314- qint64 id = model ->getLid (current);
321+ qint64 id = levelListModel ->getLid (current);
315322 if (id != 0 ) {
316323 if (m_settings.value (QString (" level%1/RunnerType" ).arg (id)) == 2 ) {
317324 Model::getInstance ().runWine (id);
@@ -328,7 +335,7 @@ void TombRaiderLinuxLauncher::linkClicked() {
328335void TombRaiderLinuxLauncher::downloadClicked () {
329336 QModelIndex current = ui->listViewLevels ->currentIndex ();
330337 if (current.isValid ()) {
331- qint64 id = model ->getLid (current);
338+ qint64 id = levelListModel ->getLid (current);
332339 if (id < 0 ) {
333340 ui->listViewLevels ->setEnabled (false );
334341 ui->progressBar ->setValue (0 );
@@ -349,7 +356,7 @@ void TombRaiderLinuxLauncher::downloadClicked() {
349356void TombRaiderLinuxLauncher::infoClicked () {
350357 QModelIndex current = ui->listViewLevels ->currentIndex ();
351358 if (current.isValid ()) {
352- qint64 id = model ->getLid (current);
359+ qint64 id = levelListModel ->getLid (current);
353360 if (id != 0 ) {
354361 InfoData info = controller.getInfo (id);
355362 ui->infoWebEngineView ->setHtml (info.m_body );
@@ -395,7 +402,7 @@ void TombRaiderLinuxLauncher::infoClicked() {
395402void TombRaiderLinuxLauncher::walkthroughClicked () {
396403 QModelIndex current = ui->listViewLevels ->currentIndex ();
397404 if (current.isValid ()) {
398- qint64 id = model ->getLid (current);
405+ qint64 id = levelListModel ->getLid (current);
399406 if (id != 0 ) {
400407 QWebEngineView* w = ui->walkthroughWebEngineView ;
401408 w->setHtml (controller.getWalkthrough (id));
@@ -421,7 +428,7 @@ void TombRaiderLinuxLauncher::backClicked() {
421428}
422429
423430void TombRaiderLinuxLauncher::loadMoreCovers () {
424- model ->loadMoreCovers ();
431+ levelListModel ->loadMoreCovers ();
425432}
426433
427434void TombRaiderLinuxLauncher::workTick () {
@@ -431,7 +438,7 @@ void TombRaiderLinuxLauncher::workTick() {
431438 if (ui->progressBar ->value () >= 100 ) {
432439 QModelIndex current = ui->listViewLevels ->currentIndex ();
433440 if (current.isValid ()) {
434- qint64 id = model ->getLid (current);
441+ qint64 id = levelListModel ->getLid (current);
435442 if (id < 0 ) { // its the original game
436443 ui->pushButtonLink ->setEnabled (true );
437444 ui->pushButtonInfo ->setEnabled (false );
@@ -494,7 +501,7 @@ void TombRaiderLinuxLauncher::GlobalResetClicked() {
494501void TombRaiderLinuxLauncher::LevelSaveClicked () {
495502 QModelIndex current = ui->listViewLevels ->currentIndex ();
496503 if (current.isValid ()) {
497- qint64 id = model ->getLid (current);
504+ qint64 id = levelListModel ->getLid (current);
498505
499506 m_settings.setValue (QString (" level%1/CustomCommand" )
500507 .arg (id), ui->lineEditCustomCommand ->text ());
0 commit comments