Skip to content

Commit 3493a7f

Browse files
committed
Basic Input-Checking for AddGames
1 parent a133921 commit 3493a7f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

addgamedialog.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "ui_addgamedialog.h"
33
#include "fgame.h"
44
#include <QFileDialog>
5+
#include <QMessageBox>
56
#include "fdb.h"
67
#include "flauncher.h"
78

@@ -56,6 +57,22 @@ void AddGameDialog::on_chooseGameExecutableButton_clicked()
5657
void AddGameDialog::on_buttonBox_accepted()
5758
{
5859
game.setName(ui->gameNameEdit->text());
60+
61+
if(game.getName().length() <= 0) {
62+
QMessageBox::warning(this, "Please fill all fields!", "You have to fill the name-field!", QMessageBox::Ok);
63+
return;
64+
}
65+
66+
if(game.getExe().length() <= 0) {
67+
QMessageBox::warning(this, "Please fill all fields!", "You have to set an executable!", QMessageBox::Ok);
68+
return;
69+
}
70+
71+
if(game.getPath().length() <= 0) {
72+
QMessageBox::warning(this, "Please fill all fields!", "You have to set a path!", QMessageBox::Ok);
73+
return;
74+
}
75+
5976
game.setCommand(ui->gameCommandEdit->text());
6077
game.setArgs(QStringList(ui->gameArgsEdit->text()));
6178
game.setType(Executable);

0 commit comments

Comments
 (0)