diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 356b0b6..54487d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,7 +66,10 @@ int main(int argc, char *argv[]) { if (s.init(file) && s.run()) { return EXIT_SUCCESS; } - // TODO: error message + std::cerr << a.translate( + "Console", + "vmchooser: failed to run session").toUtf8().data() << + std::endl; return EXIT_FAILURE; } else if (file.endsWith(".xml")) { // our XML-files can contain multiple sessions @@ -75,9 +78,15 @@ int main(int argc, char *argv[]) { if (s && s->run()) { return EXIT_SUCCESS; } - return EXIT_FAILURE; + std::cerr << a.translate( + "Console", + "vmchooser: failed to run session").toUtf8().data() << + std::endl; } else { - std::cerr << "not a valid session file" << std::endl; + std::cerr << a.translate( + "Console", + "vmchooser: invalid session file").toUtf8().data() << + std::endl; return EXIT_FAILURE; } } @@ -143,11 +152,11 @@ int main(int argc, char *argv[]) { width = list.value(1).toInt(); height = list.value(2).toInt(); } else if (!size.isEmpty()) { - std::cerr - << a.translate("Console", - "invlid size argument").toUtf8().data() + std::cerr << a.translate( + "Console", + "vmchooser: invlid size argument").toUtf8().data() << std::endl; - exit(1); + return EXIT_FAILURE; } else { width = VMCHOOSER_DEFAULT_WIDTH; height = VMCHOOSER_DEFAULT_HEIGHT; @@ -159,6 +168,13 @@ int main(int argc, char *argv[]) { Dialog w; w.resize(width, height); + if (xsessions.empty() && vsessions.empty()) { + std::cerr << a.translate( + "Console", + "vmchooser: no sessions found").toUtf8().data() + << std::endl; + return EXIT_FAILURE; + } if (xsessions.size()) { qSort(xsessions.begin(), xsessions.end(), myLessThan); w.addItems(xsessions, a.translate("Dialog", "X Sessions")); |