Skip to content

Commit 9ff172f

Browse files
committed
fix cancelClicked, fix set level list focus after download
add keyborad shourtcuts
1 parent badb54e commit 9ff172f

5 files changed

Lines changed: 63 additions & 16 deletions

File tree

MANUAL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ From here you can:
5353

5454
![Info](doc/Info.png)
5555

56-
- [ ] Focus Info content (ctrl+i)
57-
- [ ] Focus Cover List (ctrl+c)
56+
- [x] Focus Info content (ctrl+i)
57+
- [x] Focus Cover List (ctrl+c)
5858
- [x] Go to Walkthrough (ctrl+w)
5959
- [x] Go Back to Level List (ctrl+b)
6060

@@ -69,9 +69,9 @@ From here you can:
6969
![Setup](doc/Setup.png)
7070

7171
- [x] Level Tab (alt+l)
72-
- [ ] Save Level Options (ctrl+s)
73-
- [ ] Reset Level Options (ctrl+r)
74-
- [ ] Environment Variables (ctrl+e)
72+
- [x] Save Level Options (ctrl+s)
73+
- [x] Reset Level Options (ctrl+r)
74+
- [x] Environment Variables (ctrl+e)
7575

7676
## Some open source modes that work well with Proton/Wine
7777

src/view/Levels.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ UiLevels::UiLevels(QWidget *parent)
4343

4444
stackedWidget->addWidget(select);
4545

46-
connect(dialog, &Dialog::cancelClicked, this, [this]() {
47-
this->setStackedWidget("select");
48-
});
49-
5046
Filter* filter_p = select->filter;
5147
filter_p->setVisible(false);
5248

@@ -96,16 +92,19 @@ UiLevels::UiLevels(QWidget *parent)
9692
} else {
9793
pushButtonFilter->setIcon(arrowDownIcon);
9894
}
99-
pushButtonFilter->setIconSize(QSize(16, 16));
10095
this->select->levelViewList->setFocus();
10196
});
10297

10398
pushButtonFilter->setIcon(arrowDownIcon);
104-
pushButtonFilter->setIconSize(QSize(16, 16));
10599

106100
connect(dialog, &Dialog::setLevelsState,
107101
this, &UiLevels::callbackDialog);
108102

103+
connect(dialog, &Dialog::cancelClicked,
104+
this, [this](){
105+
this->setStackedWidget("select");
106+
});
107+
109108
// Arrive with next batch of level icons
110109
connect(&Controller::getInstance(), &Controller::controllerReloadLevelList,
111110
this, &UiLevels::loadMoreCovers);
@@ -143,7 +142,7 @@ UiLevels::UiLevels(QWidget *parent)
143142
connect(this->select->stackedWidgetBar->navigateWidgetBar->pushButtonInfo,
144143
&QPushButton::clicked,
145144
this, &UiLevels::infoClicked);
146-
145+
147146
connect(this->select->stackedWidgetBar->navigateWidgetBar->pushButtonRun,
148147
&QPushButton::clicked, this, &UiLevels::runClicked);
149148
}
@@ -558,7 +557,6 @@ void UiLevels::downloadClicked(qint64 id) {
558557
select->downloadingState(false);
559558
select->stackedWidgetBar->progressWidgetBar->progressBar->setValue(0);
560559
select->setCurrentWidgetBar(StackedWidgetBar::Progress);
561-
this->select->levelViewList->setFocus();
562560
}
563561

564562
void UiLevels::setpushButtonRunText(const QString &text) {
@@ -598,6 +596,7 @@ void UiLevels::workTick() {
598596
select->setCurrentWidgetBar(StackedWidgetBar::Navigate);
599597
select->downloadingState(true);
600598
levelDirSelected(id);
599+
this->select->levelViewList->setFocus();
601600
}
602601
}
603602

src/view/Levels/Dialog.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ Dialog::Dialog(QWidget *parent)
7171
qDebug() << "OK clicked, selected:" << selected;
7272
emit setLevelsState(selected);
7373
});
74+
75+
connect(m_cancelButton, &QPushButton::clicked, this, [this]() {
76+
qDebug() << "Cancel clicked";
77+
emit cancelClicked();
78+
});
7479
}
7580

7681
void Dialog::setMessage(const QString &text) {

src/view/Levels/Dialog.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class Dialog : public QWidget {
3434
QString selectedOption() const;
3535

3636
signals:
37-
void okClicked();
3837
void setLevelsState(QString qwidget);
3938
void cancelClicked();
4039

src/view/Ui.cpp

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "view/Ui.hpp"
22
#include "view/Levels/Select/Filter.hpp"
33
#include <qcombobox.h>
4+
#include <qnamespace.h>
45

56
Ui::Ui(QWidget *parent)
67
: QWidget(parent),
@@ -95,6 +96,11 @@ void Ui::setShortCuts() {
9596
filterGroupBoxSearch->lineEditSearch->setFocus();
9697
}
9798
}
99+
// Setup save
100+
if (this->tabs->currentWidget() == this->setup) {
101+
this->setup->settings->frameLevelSetup->
102+
levelControl->commandLinkButtonLSSave->click();
103+
}
98104
});
99105

100106
// Search Type
@@ -172,15 +178,21 @@ void Ui::setShortCuts() {
172178
connectShortCut(QKeySequence(Qt::CTRL | Qt::Key_I),
173179
[this]() -> void {
174180
if (this->tabs->currentWidget() == this->levels) {
181+
// Activate info
175182
if (this->levels->stackedWidget->currentWidget() ==
176183
this->levels->select) {
177184
this->levels->select->stackedWidgetBar->
178185
navigateWidgetBar->pushButtonInfo->click();
179186
}
187+
// Info text focus
188+
if (this->levels->stackedWidget->currentWidget() ==
189+
this->levels->info) {
190+
this->levels->info->infoContent->infoWebEngineView->setFocus();
191+
}
180192
}
181193
});
182194

183-
// Go Back
195+
// Info/Walkthrough Go Back
184196
connectShortCut(QKeySequence(Qt::CTRL | Qt::Key_B),
185197
[this]() -> void {
186198
if (this->tabs->currentWidget() == this->levels) {
@@ -191,7 +203,7 @@ void Ui::setShortCuts() {
191203
}
192204
});
193205

194-
// Walkthrough
206+
// Info Go to Walkthrough
195207
connectShortCut(QKeySequence(Qt::CTRL | Qt::Key_W),
196208
[this]() -> void {
197209
if (this->tabs->currentWidget() == this->levels) {
@@ -202,6 +214,18 @@ void Ui::setShortCuts() {
202214
}
203215
});
204216

217+
218+
// Info coverList focus
219+
connectShortCut(QKeySequence(Qt::CTRL | Qt::Key_C),
220+
[this]() -> void {
221+
if (this->tabs->currentWidget() == this->levels) {
222+
if (this->levels->stackedWidget->currentWidget() ==
223+
this->levels->info) {
224+
this->levels->info->infoContent->coverListWidget->setFocus();
225+
}
226+
}
227+
});
228+
205229
// Select Filter
206230
connectShortCut(QKeySequence(Qt::CTRL | Qt::Key_Y),
207231
[this]() -> void {
@@ -232,6 +256,12 @@ void Ui::setShortCuts() {
232256
filterGroupBoxSort->focusSelected();
233257
}
234258
}
259+
260+
// Setup reset
261+
if (this->tabs->currentWidget() == this->setup) {
262+
this->setup->settings->frameLevelSetup->
263+
levelControl->commandLinkButtonLSReset->click();
264+
}
235265
});
236266

237267
// Download
@@ -251,6 +281,7 @@ void Ui::setShortCuts() {
251281
[this]() -> void {
252282
if (this->tabs->currentWidget() != this->levels) {
253283
this->tabs->setCurrentWidget(this->levels);
284+
this->levels->select->levelViewList->setFocus();
254285
}
255286
});
256287

@@ -259,6 +290,19 @@ void Ui::setShortCuts() {
259290
[this]() -> void {
260291
if (this->tabs->currentWidget() != this->setup) {
261292
this->tabs->setCurrentWidget(this->setup);
293+
this->setup->settings->frameLevelSetup->
294+
frameLevelSetupSettings->widgetEnvironmentVariables->
295+
lineEditEnvironmentVariables->setFocus();
296+
}
297+
});
298+
299+
// Setup environment
300+
connectShortCut(QKeySequence(Qt::CTRL | Qt::Key_E),
301+
[this]() -> void {
302+
if (this->tabs->currentWidget() == this->setup) {
303+
this->setup->settings->frameLevelSetup->
304+
frameLevelSetupSettings->widgetEnvironmentVariables->
305+
lineEditEnvironmentVariables->setFocus();
262306
}
263307
});
264308
}

0 commit comments

Comments
 (0)