diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2018-11-30 01:37:33 +0100 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2018-11-30 01:37:33 +0100 |
| commit | e67ae8402090ae7a242a4c2030042b571228bffc (patch) | |
| tree | aeb1c7d0378ea92e78df90e06b7d0a355dfae246 /main.cpp | |
| parent | 48ce5c59fe7f981d9f2da6ee9ddb9bbf03c8945b (diff) | |
QApplication::processEvents() would not work under Linux if ACK bytes are to be received from the target device. This has been changed by a call to a blocking function which ensures input data has been received.HEADmaster
Diffstat (limited to 'main.cpp')
| -rw-r--r-- | main.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
@@ -7,36 +7,27 @@ int main(int argc, char *argv[]) QStringList param_list; - for(int i = 1; i < argc; i++) + for (int i = 1; i < argc; i++) { param_list.append(argv[i]); } - QPSXSerial* w; + QPSXSerial w(nullptr, param_list.isEmpty() ? GUI_APP : CLI_APP); - if(param_list.isEmpty() == true) - { - w = new QPSXSerial(0, GUI_APP); - } - else - { - w = new QPSXSerial(0, CLI_APP); - } - - w->setParamList(param_list); + w.setParamList(param_list); - if(param_list.isEmpty() == true) + if (param_list.isEmpty()) { - w->show(); + w.show(); } else { // This will cause the application to exit when // the task signals finished. - QObject::connect(w, SIGNAL(finished(void)), &a, SLOT(quit(void))); + QObject::connect(&w, SIGNAL(finished(void)), &a, SLOT(quit(void))); // This will run the task from the application event loop. - QTimer::singleShot(0, w, SLOT(cli_run())); + QTimer::singleShot(0, &w, SLOT(cli_run())); } return a.exec(); |
