diff options
author | Jan Darmochwal | 2010-10-10 14:21:55 +0200 |
---|---|---|
committer | Jan Darmochwal | 2010-10-10 14:21:55 +0200 |
commit | af4417a6afd3b6585625f1eb181021e6d6a730cb (patch) | |
tree | 72fe9d16e19ca91201d9e4c5f83d0125c636154f | |
parent | Failure message if session cannot be started (diff) | |
download | vmchooser-af4417a6afd3b6585625f1eb181021e6d6a730cb.tar.gz vmchooser-af4417a6afd3b6585625f1eb181021e6d6a730cb.tar.xz vmchooser-af4417a6afd3b6585625f1eb181021e6d6a730cb.zip |
Console error messages
-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")); |