This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch bugfix/help-cmd in repository x2goclient. from d3ff608 help.cpp: fix splitting algorithm to step over a space character, but include hyphens correctly into the current line. new 28a111d help.cpp: don't let qCritical() add even more spaces or quotes around the help message. new 37b20f9 help.cpp: add support for newlines within descriptions. new 50378fa help.cpp: use new newline feature for some options. The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 4 ++ src/help.cpp | 140 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 88 insertions(+), 56 deletions(-) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/help-cmd in repository x2goclient. commit 50378fa01e6ebcbf77250c6b8231a5de00e388f3 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 23:47:02 2015 +0200 help.cpp: use new newline feature for some options. --- debian/changelog | 1 + src/help.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 786d9a8..1a2639b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -282,6 +282,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - help.cpp: don't let qCritical() add even more spaces or quotes around the help message. - help.cpp: add support for newlines within descriptions. + - help.cpp: use new newline feature for some options. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index d6ba5dd..fc920c6 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -103,7 +103,8 @@ help::params_t help::build_params () { } ADD_OPT ("--help-pack", "Shows available pack methods."); - ADD_OPT ("--debug", "Enables extensive debug output to the console. On Windows also enables PulseAudio logging to a file in the \".x2go/pulse\" in the USERPROFILE directory. The logs are not deleted when X2Go Client terminates."); + ADD_OPT ("--debug", "Enables extensive debug output to the console. On Windows also enables PulseAudio logging to a file in the \".x2go/pulse\" in the USERPROFILE directory." NEWLINE + "The logs are not deleted when X2Go Client terminates."); ADD_OPT ("--no-menu", "Hides menu bar."); ADD_OPT ("--no-session-edit", "Disables session editing."); ADD_OPT ("--maximize", "Starts maximized."); @@ -138,7 +139,12 @@ help::params_t help::build_params () { ADD_OPT ("--close-disconnect", "Automatically closes X2Go Client after a disconnect."); ADD_OPT ("--hide-foldersharing", "Hides all Folder-Sharing-related options."); ADD_OPT ("--broker-name=<name>", "Sets the broker name to display in X2Go Client. This parameter is optional."); - ADD_OPT ("--broker-url=<protocol>://[username@]<host>[:port]/path", "Sets the URL of the session broker. \"protocol\" must be one of \"http\", \"https\" or \"ssh\". If \"username@\" is provided, it will be pasted into the authorization dialog of X2Go Client. URL examples are: https://x2gobroker.org/cgi-bin/x2gobroker.cgi, ssh://user@x2gobroker.org:22/usr/lib/x2go/x2gobroker.pl"); + ADD_OPT ("--broker-url=<protocol>://[username@]<host>[:port]/path", "Sets the URL of the session broker." NEWLINE + "\"protocol\" must be one of \"http\", \"https\" or \"ssh\"." NEWLINE + "If \"username@\" is provided, it will be pasted into the authorization dialog of X2Go Client." NEWLINE + "URL examples are:" NEWLINE + " https://x2gobroker.org/cgi-bin/x2gobroker.cgi" NEWLINE + " ssh://user@x2gobroker.org:22/usr/lib/x2go/x2gobroker.pl"); ADD_OPT ("--broker-ssh-key=<path to key>", "Sets the path to an SSH key to use for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers."); ADD_OPT ("--broker-autologin", "Enables the use of the default SSH key or SSH agent for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers."); ADD_OPT ("--broker-noauth", "Does not ask for user credentials during session broker authentication. This can be useful if you are using an HTTP(S) session broker without authentication. If you run an HTTP(S) server without authentication, but with user-specific profiles, then put the user name into the broker URL (refer to --broker-url.) The user name then will be extracted from the broker URL and be sent to the session broker. The client's behavior is undefined if this flag is used f [...] -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/help-cmd in repository x2goclient. commit 28a111df52daaf5c9889f74e2216219763852a24 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 22:12:46 2015 +0200 help.cpp: don't let qCritical() add even more spaces or quotes around the help message. --- debian/changelog | 2 ++ src/help.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 9396918..b5d72b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -279,6 +279,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low before --help for this to work. - help.cpp: fix splitting algorithm to step over a space character, but include hyphens correctly into the current line. + - help.cpp: don't let qCritical() add even more spaces or quotes around + the help message. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index 8a7a715..8eea079 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -260,7 +260,7 @@ QString help::pretty_print (help::data_t data) { out << "\n"; } - qCritical () << ret; + qCritical ().nospace () << qPrintable (ret); return (ret); } -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/help-cmd in repository x2goclient. commit 37b20f902940065bb8e21d5e0bcf0c37d0ba043b Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 23:46:23 2015 +0200 help.cpp: add support for newlines within descriptions. --- debian/changelog | 1 + src/help.cpp | 128 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 76 insertions(+), 53 deletions(-) diff --git a/debian/changelog b/debian/changelog index b5d72b9..786d9a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -281,6 +281,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low include hyphens correctly into the current line. - help.cpp: don't let qCritical() add even more spaces or quotes around the help message. + - help.cpp: add support for newlines within descriptions. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index 8eea079..d6ba5dd 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -89,6 +89,8 @@ help::params_t help::build_params () { params_t ret; # define ADD_OPT(param, desc) do { ret.append (params_elem_t (param, QObject::tr (desc))); } while (0) +# define NEWLINE "\n" + ADD_OPT ("--help", "Shows this message."); ADD_OPT ("--version", "Prints version information."); @@ -140,6 +142,8 @@ help::params_t help::build_params () { ADD_OPT ("--broker-ssh-key=<path to key>", "Sets the path to an SSH key to use for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers."); ADD_OPT ("--broker-autologin", "Enables the use of the default SSH key or SSH agent for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers."); ADD_OPT ("--broker-noauth", "Does not ask for user credentials during session broker authentication. This can be useful if you are using an HTTP(S) session broker without authentication. If you run an HTTP(S) server without authentication, but with user-specific profiles, then put the user name into the broker URL (refer to --broker-url.) The user name then will be extracted from the broker URL and be sent to the session broker. The client's behavior is undefined if this flag is used f [...] + +# undef NEWLINE # undef ADD_OPT return (ret); @@ -193,71 +197,89 @@ QString help::pretty_print (help::data_t data) { /* Append first two spaces to the general indent level for upcoming lines. */ indent += 2; std::ptrdiff_t remaining = 0; - std::size_t cur_len = (*it).second.size (); - x2goDebug << "Going to output a description " << (*it).second.size () << " chars wide." << endl; - if (0 != terminal_cols) { - remaining = terminal_cols - (indent + (*it).first.size ()); - x2goDebug << "Still have " << remaining << " characters left on this line." << endl; - - /* Ran out of space? That's bad... print a newline and don't use any indentation level. */ - if (0 > remaining) { - x2goDebug << "Ran out of space! Will break line and start the description on a new one." << endl; - out << "\n"; - remaining = terminal_cols; - indent = 0; - } - - QString working_copy ((*it).second); - - do { - cur_len = working_copy.size (); - x2goDebug << "Trying to fit a (remaining) description " << cur_len << " characters wide." << endl; - /* Fits onto the current line. Great! */ - if (remaining > static_cast<std::ptrdiff_t> (cur_len)) { - x2goDebug << "Fit onto the current line. Done." << endl; - out << working_copy; - working_copy = ""; + /* Split up description on newlines. */ + QStringList desc_split = (*it).second.split ("\n"); + + for (QStringList::const_iterator desc_split_it = desc_split.constBegin (); desc_split_it != desc_split.constEnd (); ++desc_split_it) { + std::size_t cur_len = (*desc_split_it).size (); + x2goDebug << "Going to output a description " << (*desc_split_it).size () << " chars wide." << endl; + if (0 != terminal_cols) { + /* + * Only set this the first time right after having written the parameter and indent spaces. + * Don't change it after that. + */ + if (desc_split_it == desc_split.constBegin ()) { + remaining = terminal_cols - (indent + (*it).first.size ()); + } + x2goDebug << "Still have " << remaining << " characters left on this line." << endl; + + /* Ran out of space? That's bad... print a newline and don't use any indentation level. */ + if (0 > remaining) { + x2goDebug << "Ran out of space! Will break line and start the description on a new one." << endl; + out << "\n"; + remaining = terminal_cols; + indent = 0; } - else { - /* Try to find the next split point. */ - std::ptrdiff_t split_point_white = working_copy.lastIndexOf (" ", remaining - 1); - std::ptrdiff_t split_point_hyphen = working_copy.lastIndexOf ("-", remaining - 1); - /* Make sure the hyphen is part of the current line. */ - ++split_point_hyphen; + QString working_copy (*desc_split_it); - std::ptrdiff_t split_point = std::max (split_point_white, split_point_hyphen); + do { + cur_len = working_copy.size (); + x2goDebug << "Trying to fit a (remaining) description " << cur_len << " characters wide." << endl; - if (-1 == split_point) { - /* No split point available. Just print it out and hope for better times... */ + /* Fits onto the current line. Great! */ + if (remaining > static_cast<std::ptrdiff_t> (cur_len)) { + x2goDebug << "Fit onto the current line. Done." << endl; out << working_copy; working_copy = ""; } else { - /* Yay, we can split. */ - x2goDebug << "Split onto " << working_copy.left (split_point); - out << working_copy.left (split_point); - - x2goDebug << " and new part " << working_copy.mid (split_point + 1); - working_copy = working_copy.mid (split_point + 1); - - /* Do the next chunk, if there are remaining characters. */ - if (!working_copy.isEmpty ()) { - out << "\n"; - indent = terminal_cols - remaining; - out << QString (" ").repeated (indent); + /* Try to find the next split point. */ + std::ptrdiff_t split_point_white = working_copy.lastIndexOf (" ", remaining - 1); + std::ptrdiff_t split_point_hyphen = working_copy.lastIndexOf ("-", remaining - 1); + + /* Make sure the hyphen is part of the current line. */ + ++split_point_hyphen; + + std::ptrdiff_t split_point = std::max (split_point_white, split_point_hyphen); + + if (-1 == split_point) { + /* No split point available. Just print it out and hope for better times... */ + out << working_copy; + working_copy = ""; + } + else { + /* Yay, we can split. */ + x2goDebug << "Split onto " << working_copy.left (split_point); + out << working_copy.left (split_point); + + x2goDebug << " and new part " << working_copy.mid (split_point + 1); + working_copy = working_copy.mid (split_point + 1); + + /* Do the next chunk, if there are remaining characters. */ + if (!working_copy.isEmpty ()) { + out << "\n"; + indent = terminal_cols - remaining; + out << QString (" ").repeated (indent); + } } } - } - } while (!working_copy.isEmpty ()); - } - else { - /* No idea what the terminal size is. Just print it all onto one line. */ - out << (*it).second; - } + } while (!working_copy.isEmpty ()); + } + else { + /* No idea what the terminal size is. Just print it all onto one line. */ + out << (*desc_split_it); + } + + out << "\n"; - out << "\n"; + /* Add whitespace if description shall continue on next line. */ + if ((desc_split_it + 1) != desc_split.constEnd ()) { + indent = terminal_cols - remaining; + out << QString (" ").repeated (indent); + } + } } qCritical ().nospace () << qPrintable (ret); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git