This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goclient. from 8462740 helpdialog.cpp: use QT_VERSION macro to select either a monospaced or typewriter font (Qt < 4.7.0 only supports TypeWriter.) new 4fd874a x2goutils.{cpp,h}: add new font_is_monospaced() helper. new 739e2e1 helpdialog.cpp: try harder to set a monospaced font. new a944db8 helpdialog.cpp: lower font size to have more space for text. new 2ee86a4 ui/helpdialog.ui: almost double the window size. new 0fe6b3a {helpdialog.cpp,x2goutils.h}: whitespace only. new 5734a0d help.cpp: typo fix for --git-info. new bf9294c help.{cpp,h}: provide string splitting logic as separate split_long_line() function. Use this in pretty_print(). new dbaba2f help.cpp: simplify pretty_print() and make it also split lines for non-terminal output or when the terminal width is unknown. new 6e7ca03 help.cpp: move functions around a bit. new 3d58218 help.{cpp,h}: add a boolean terminal_output parameter to the pretty_print() function family. new dc2c70c onmainwindow.cpp: don't let a potential terminal affect the help string shown in the GUI. new d9e4716 help.h: lower default splitting length to 100 characters. The 12 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 | 15 ++++++ src/help.cpp | 128 ++++++++++++++++++++++++++------------------------ src/help.h | 25 ++++++++-- src/helpdialog.cpp | 29 +++++++++--- src/onmainwindow.cpp | 2 +- src/ui/helpdialog.ui | 8 ++-- src/x2goutils.cpp | 5 ++ src/x2goutils.h | 6 +++ 8 files changed, 143 insertions(+), 75 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 master in repository x2goclient. commit a944db8175f05567d1f12188f735637497c73def Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Apr 23 23:27:21 2015 +0200 helpdialog.cpp: lower font size to have more space for text. --- debian/changelog | 1 + src/helpdialog.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/debian/changelog b/debian/changelog index d993c2e..bf69fd3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -300,6 +300,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low typewriter font (Qt < 4.7.0 only supports TypeWriter.) - x2goutils.{cpp,h}: add new font_is_monospaced() helper. - helpdialog.cpp: try harder to set a monospaced font. + - helpdialog.cpp: lower font size to have more space for text. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/helpdialog.cpp b/src/helpdialog.cpp index 4a1936f..d8fe9ad 100644 --- a/src/helpdialog.cpp +++ b/src/helpdialog.cpp @@ -45,6 +45,8 @@ void HelpDialog::setText (QString text) { } /* If the font is not monospaced by now, there's not much else we can do... */ + font.setPointSize (10); + plainTextEdit->setFont (font); plainTextEdit->setTabStopWidth (30); -- 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 master in repository x2goclient. commit 0fe6b3a72faf0660df53256d91b4f22e57a1201e Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Apr 23 23:30:28 2015 +0200 {helpdialog.cpp,x2goutils.h}: whitespace only. --- src/helpdialog.cpp | 38 +++++++++++++++++++------------------- src/x2goutils.h | 4 ++++ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/helpdialog.cpp b/src/helpdialog.cpp index d8fe9ad..877ecc8 100644 --- a/src/helpdialog.cpp +++ b/src/helpdialog.cpp @@ -21,36 +21,36 @@ #include "x2goutils.h" HelpDialog::HelpDialog (QWidget *parent): QDialog (parent) { - setupUi (this); + setupUi (this); } void HelpDialog::setText (QString text) { - /* Try real hard to get a monospaced font. */ - QFont font ("monospace"); + /* Try real hard to get a monospaced font. */ + QFont font ("monospace"); - if (!font_is_monospaced (font)) { + if (!font_is_monospaced (font)) { #if QT_VERSION >= 0x040700 - font.setStyleHint (QFont::Monospace); + font.setStyleHint (QFont::Monospace); #else - font.setStyleHint (QFont::TypeWriter); + font.setStyleHint (QFont::TypeWriter); #endif - } + } - if (!font_is_monospaced (font)) { - font.setFamily ("Courier New"); - } + if (!font_is_monospaced (font)) { + font.setFamily ("Courier New"); + } - if (!font_is_monospaced (font)) { - font.setFamily ("Courier"); - } + if (!font_is_monospaced (font)) { + font.setFamily ("Courier"); + } - /* If the font is not monospaced by now, there's not much else we can do... */ - font.setPointSize (10); + /* If the font is not monospaced by now, there's not much else we can do... */ + font.setPointSize (10); - plainTextEdit->setFont (font); + plainTextEdit->setFont (font); - plainTextEdit->setTabStopWidth (30); - plainTextEdit->setWordWrapMode (QTextOption::NoWrap); - plainTextEdit->setPlainText (text); + plainTextEdit->setTabStopWidth (30); + plainTextEdit->setWordWrapMode (QTextOption::NoWrap); + plainTextEdit->setPlainText (text); } diff --git a/src/x2goutils.h b/src/x2goutils.h index e438d0f..2617b1b 100644 --- a/src/x2goutils.h +++ b/src/x2goutils.h @@ -24,10 +24,14 @@ #define UNUSED(x) do { (void) x; } while (0) QString expandHome (QString path); + QString fixup_resource_URIs (const QString &res_path); + QString wrap_legacy_resource_URIs (const QString &res_path); + QString convert_to_rich_text (const QString &text, bool force = false); void show_RichText_WarningMsgBox (const QString &main_text, const QString &informative_text = ""); + QString git_changelog_extract_commit_sha (const QString &gitlog); bool font_is_monospaced (const QFont &font); -- 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 master in repository x2goclient. commit 2ee86a4ef254f43c5461d1e9ad0e991c611b45ba Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Apr 23 23:29:11 2015 +0200 ui/helpdialog.ui: almost double the window size. --- debian/changelog | 1 + src/ui/helpdialog.ui | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index bf69fd3..4b9d4d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -301,6 +301,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - x2goutils.{cpp,h}: add new font_is_monospaced() helper. - helpdialog.cpp: try harder to set a monospaced font. - helpdialog.cpp: lower font size to have more space for text. + - ui/helpdialog.ui: almost double the window size. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/ui/helpdialog.ui b/src/ui/helpdialog.ui index b4321cd..1e38bbe 100644 --- a/src/ui/helpdialog.ui +++ b/src/ui/helpdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>400</width> - <height>300</height> + <width>700</width> + <height>600</height> </rect> </property> <property name="windowTitle"> @@ -45,8 +45,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>330</x> - <y>277</y> + <x>630</x> + <y>577</y> </hint> <hint type="destinationlabel"> <x>4</x> -- 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 master in repository x2goclient. commit bf9294c223e2ed31dfd3571d4d1a1fe8c2bda1d2 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Apr 24 00:37:20 2015 +0200 help.{cpp,h}: provide string splitting logic as separate split_long_line() function. Use this in pretty_print(). --- debian/changelog | 2 ++ src/help.cpp | 62 ++++++++++++++++++++++++++++-------------------------- src/help.h | 13 ++++++++++++ 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7bb0bce..dbe7eaf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -303,6 +303,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - helpdialog.cpp: lower font size to have more space for text. - ui/helpdialog.ui: almost double the window size. - help.cpp: typo fix for --git-info. + - help.{cpp,h}: provide string splitting logic as separate + split_long_line() function. Use this in pretty_print(). [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index bd0a4a0..78bef9e 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -167,6 +167,24 @@ QString help::pretty_print () { return (help::pretty_print (help::build_data ())); } +help::string_split_t help::split_long_line (QString &line, std::ptrdiff_t max_length) { + string_split_t ret (line, ""); + + if (line.size () > max_length) { + /* Try to find the next split point. */ + std::ptrdiff_t split_point = line.lastIndexOf (" ", max_length - 1); + + /* Only care for valid split points. */ + if (0 <= split_point) { + x2goDebug << "Split onto " << line.left (split_point) << " and new part " << line.mid (split_point + 1); + ret.first = line.left (split_point); + ret.second = line.mid (split_point + 1); + } + } + + return (ret); +} + QString help::pretty_print (help::data_t data) { QString ret = ""; QTextStream out (&ret); @@ -238,36 +256,20 @@ QString help::pretty_print (help::data_t data) { 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 = ""; - } - else { - /* Try to find the next split point. */ - std::ptrdiff_t split_point = working_copy.lastIndexOf (" ", remaining - 1); - - 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); - } - } + string_split_t string_split = split_long_line (working_copy, remaining); + working_copy = string_split.first; + + /* Print potentially splitted line. */ + out << working_copy; + + /* Continue with next chunk. */ + working_copy = string_split.second;; + + /* Print whitespace if the remainder string is non-empty. */ + if (!working_copy.isEmpty ()) { + out << "\n"; + indent = terminal_cols - remaining; + out << QString (" ").repeated (indent); } } } diff --git a/src/help.h b/src/help.h index 69852b3..b6bfb21 100644 --- a/src/help.h +++ b/src/help.h @@ -23,12 +23,14 @@ #include <QPair> #include <QStringList> #include <QTextStream> +#include <cstddef> namespace help { typedef QStringList prelude_t; typedef QPair<QString, QString> params_elem_t; typedef QList<params_elem_t> params_t; typedef QPair<prelude_t, params_t> data_t; + typedef QPair<QString, QString> string_split_t; /* Builds a prelude_t object. Values are hardcoded here. */ prelude_t build_prelude (); @@ -43,6 +45,17 @@ namespace help { prelude_t cleanup_prelude (prelude_t prelude); params_t cleanup_params (params_t params); + /* + * Splits a string into two component. + * The first component is at most max_length (or 200) characters long. + * The string is split on the nearest space surrounding max_length + * (or max_length itself.) + * Caveat: if the string length is less than max_length, no splitting + * is performed. + * In that case, the second component is empty. + */ + string_split_t split_long_line (QString &line, std::ptrdiff_t max_length = 200); + /* Prints a help_data_t structure. */ QString pretty_print (); QString pretty_print (data_t data); -- 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 master in repository x2goclient. commit 5734a0d5e290264b6f61872446b73bd3a909722a Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Apr 23 23:37:09 2015 +0200 help.cpp: typo fix for --git-info. --- debian/changelog | 1 + src/help.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4b9d4d5..7bb0bce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -302,6 +302,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - helpdialog.cpp: try harder to set a monospaced font. - helpdialog.cpp: lower font size to have more space for text. - ui/helpdialog.ui: almost double the window size. + - help.cpp: typo fix for --git-info. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index 718f18b..bd0a4a0 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -103,7 +103,7 @@ help::params_t help::build_params () { } if (QFile::exists (":/txt/git-info")) { - ADD_OPT ("--git-info", "Shows git information as used at compile this. [Deprecated: please use --version.]"); + ADD_OPT ("--git-info", "Shows git information as used at compile time. [Deprecated: please use --version.]"); } ADD_OPT ("--help-pack", "Shows available pack methods."); -- 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 master in repository x2goclient. commit 739e2e1cc31e9b662db568417ae8a27fbc3a7bb8 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Apr 23 23:26:04 2015 +0200 helpdialog.cpp: try harder to set a monospaced font. --- debian/changelog | 1 + src/helpdialog.cpp | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1be98b7..d993c2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -299,6 +299,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - helpdialog.cpp: use QT_VERSION macro to select either a monospaced or typewriter font (Qt < 4.7.0 only supports TypeWriter.) - x2goutils.{cpp,h}: add new font_is_monospaced() helper. + - helpdialog.cpp: try harder to set a monospaced font. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/helpdialog.cpp b/src/helpdialog.cpp index 3fa478f..4a1936f 100644 --- a/src/helpdialog.cpp +++ b/src/helpdialog.cpp @@ -18,18 +18,33 @@ #include <QtGlobal> #include "helpdialog.h" +#include "x2goutils.h" HelpDialog::HelpDialog (QWidget *parent): QDialog (parent) { setupUi (this); } void HelpDialog::setText (QString text) { + /* Try real hard to get a monospaced font. */ QFont font ("monospace"); + + if (!font_is_monospaced (font)) { #if QT_VERSION >= 0x040700 - font.setStyleHint (QFont::Monospace); + font.setStyleHint (QFont::Monospace); #else - font.setStyleHint (QFont::TypeWriter); + font.setStyleHint (QFont::TypeWriter); #endif + } + + if (!font_is_monospaced (font)) { + font.setFamily ("Courier New"); + } + + if (!font_is_monospaced (font)) { + font.setFamily ("Courier"); + } + + /* If the font is not monospaced by now, there's not much else we can do... */ plainTextEdit->setFont (font); plainTextEdit->setTabStopWidth (30); -- 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 master in repository x2goclient. commit 4fd874a406d8853d170165590f8aa1d5c8c990b3 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Apr 23 23:24:24 2015 +0200 x2goutils.{cpp,h}: add new font_is_monospaced() helper. --- debian/changelog | 1 + src/x2goutils.cpp | 5 +++++ src/x2goutils.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index a305ee3..1be98b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -298,6 +298,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - helpdialog.cpp: change to monospaced font. - helpdialog.cpp: use QT_VERSION macro to select either a monospaced or typewriter font (Qt < 4.7.0 only supports TypeWriter.) + - x2goutils.{cpp,h}: add new font_is_monospaced() helper. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/x2goutils.cpp b/src/x2goutils.cpp index 7bf3d00..d5c6141 100644 --- a/src/x2goutils.cpp +++ b/src/x2goutils.cpp @@ -140,3 +140,8 @@ QString git_changelog_extract_commit_sha (const QString &gitlog) { return (ret); } + +bool font_is_monospaced (const QFont &font) { + const QFontInfo font_info (font); + return (font_info.fixedPitch ()); +} diff --git a/src/x2goutils.h b/src/x2goutils.h index d87a997..e438d0f 100644 --- a/src/x2goutils.h +++ b/src/x2goutils.h @@ -30,4 +30,6 @@ QString convert_to_rich_text (const QString &text, bool force = false); void show_RichText_WarningMsgBox (const QString &main_text, const QString &informative_text = ""); QString git_changelog_extract_commit_sha (const QString &gitlog); +bool font_is_monospaced (const QFont &font); + #endif /* !defined (X2GOUTILS_H) */ -- 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 master in repository x2goclient. commit 3d5821802240c81a7bcfa263f94ae2b9af4435c1 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Apr 24 01:08:39 2015 +0200 help.{cpp,h}: add a boolean terminal_output parameter to the pretty_print() function family. Controls terminal width auto-detection and automatic printing to stderr. --- debian/changelog | 3 +++ src/help.cpp | 30 +++++++++++++++++------------- src/help.h | 12 +++++++++--- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5b9ad08..e7a6516 100644 --- a/debian/changelog +++ b/debian/changelog @@ -307,6 +307,9 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low split_long_line() function. Use this in pretty_print(). - help.cpp: simplify pretty_print() and make it also split lines for non-terminal output or when the terminal width is unknown. + - help.{cpp,h}: add a boolean terminal_output parameter to the + pretty_print() function family. Controls terminal width auto-detection + and automatic printing to stderr. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index 6b95732..f5871be 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -181,11 +181,11 @@ help::string_split_t help::split_long_line (QString &line, std::ptrdiff_t max_le return (ret); } -QString help::pretty_print () { - return (help::pretty_print (help::build_data ())); +QString help::pretty_print (bool terminal_output) { + return (help::pretty_print (help::build_data (), terminal_output)); } -QString help::pretty_print (help::data_t data) { +QString help::pretty_print (help::data_t data, bool terminal_output) { QString ret = ""; QTextStream out (&ret); out << data.first.join ("\n") << "\n"; @@ -199,19 +199,21 @@ QString help::pretty_print (help::data_t data) { std::size_t terminal_cols = 0; + if (terminal_output) { #ifdef Q_OS_WIN - CONSOLE_SCREEN_BUFFER_INFO terminal_internal; - HANDLE stderr_handle = GetStdHandle (STD_ERROR_HANDLE); - if (stderr_handle && (stderr_handle != INVALID_HANDLE_VALUE)) { - if (GetConsoleScreenBufferInfo (stderr_handle, &terminal_internal)) { - terminal_cols = (terminal_internal.srWindow.Right - terminal_internal.srWindow.Left) + 1; + CONSOLE_SCREEN_BUFFER_INFO terminal_internal; + HANDLE stderr_handle = GetStdHandle (STD_ERROR_HANDLE); + if (stderr_handle && (stderr_handle != INVALID_HANDLE_VALUE)) { + if (GetConsoleScreenBufferInfo (stderr_handle, &terminal_internal)) { + terminal_cols = (terminal_internal.srWindow.Right - terminal_internal.srWindow.Left) + 1; + } } - } #elif defined (Q_OS_UNIX) - struct winsize terminal_internal; - ioctl (0, TIOCGWINSZ, &terminal_internal); - terminal_cols = terminal_internal.ws_col; + struct winsize terminal_internal; + ioctl (0, TIOCGWINSZ, &terminal_internal); + terminal_cols = terminal_internal.ws_col; #endif + } x2goDebug << "Terminal cols: " << terminal_cols << endl; @@ -288,7 +290,9 @@ QString help::pretty_print (help::data_t data) { } } - qCritical ().nospace () << qPrintable (ret); + if (terminal_output) { + qCritical ().nospace () << qPrintable (ret); + } return (ret); } diff --git a/src/help.h b/src/help.h index b6bfb21..3a9c24d 100644 --- a/src/help.h +++ b/src/help.h @@ -56,9 +56,15 @@ namespace help { */ string_split_t split_long_line (QString &line, std::ptrdiff_t max_length = 200); - /* Prints a help_data_t structure. */ - QString pretty_print (); - QString pretty_print (data_t data); + /* + * Returns a help_data_t structure as a QString. + * If terminal_output is true, the terminal width is probed for and the function + * family tries its best to adhere to the auto-detected width. + * Additionally, terminal_output controls whether the resulting string is + * printed to stderr or not. + */ + QString pretty_print (bool terminal_output = true); + QString pretty_print (data_t data, bool terminal_output = true); } #endif /* !defined (HELP_H) */ -- 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 master in repository x2goclient. commit dc2c70c147f84ce47e2e709a5f40bc24c7d666e7 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Apr 24 01:10:34 2015 +0200 onmainwindow.cpp: don't let a potential terminal affect the help string shown in the GUI. --- debian/changelog | 2 ++ src/onmainwindow.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e7a6516..bd28f64 100644 --- a/debian/changelog +++ b/debian/changelog @@ -310,6 +310,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - help.{cpp,h}: add a boolean terminal_output parameter to the pretty_print() function family. Controls terminal width auto-detection and automatic printing to stderr. + - onmainwindow.cpp: don't let a potential terminal affect the help string + shown in the GUI. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 2230cd6..080ea03 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -7184,7 +7184,7 @@ void ONMainWindow::showHelp () if (!startHidden && !haveTerminal) { HelpDialog dlg (this); dlg.setWindowTitle (tr ("Help")); - dlg.setText (out); + dlg.setText (help::pretty_print (false)); dlg.exec (); } } -- 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 master in repository x2goclient. commit dbaba2f174a6166accd77bd9d68ced414cf690d0 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Apr 24 00:56:48 2015 +0200 help.cpp: simplify pretty_print() and make it also split lines for non-terminal output or when the terminal width is unknown. --- debian/changelog | 2 ++ src/help.cpp | 54 +++++++++++++++++++++++++++--------------------------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/debian/changelog b/debian/changelog index dbe7eaf..5b9ad08 100644 --- a/debian/changelog +++ b/debian/changelog @@ -305,6 +305,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - help.cpp: typo fix for --git-info. - help.{cpp,h}: provide string splitting logic as separate split_long_line() function. Use this in pretty_print(). + - help.cpp: simplify pretty_print() and make it also split lines for + non-terminal output or when the terminal width is unknown. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index 78bef9e..12a1264 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -249,41 +249,41 @@ QString help::pretty_print (help::data_t data) { remaining = terminal_cols; indent = 0; } + } - QString working_copy (*desc_split_it); + QString working_copy (*desc_split_it); - while (!working_copy.isEmpty ()) { - cur_len = working_copy.size (); - x2goDebug << "Trying to fit a (remaining) description " << cur_len << " characters wide." << endl; + while (!working_copy.isEmpty ()) { + cur_len = working_copy.size (); + x2goDebug << "Trying to fit a (remaining) description " << cur_len << " characters wide." << endl; - string_split_t string_split = split_long_line (working_copy, remaining); - working_copy = string_split.first; + string_split_t string_split; - /* Print potentially splitted line. */ - out << working_copy; + if (0 != terminal_cols) { + string_split = split_long_line (working_copy, remaining); + } + else { + /* For non-terminal printing (or if the width is unknown), use the default splitting length. */ + string_split = split_long_line (working_copy); + } - /* Continue with next chunk. */ - working_copy = string_split.second;; + /* Print potentially splitted line. */ + working_copy = string_split.first; + out << working_copy; - /* Print whitespace if the remainder string is non-empty. */ - if (!working_copy.isEmpty ()) { - out << "\n"; - indent = terminal_cols - remaining; - out << QString (" ").repeated (indent); - } - } - } - else { - /* No idea what the terminal size is. Just print it all onto one line. */ - out << (*desc_split_it); - } + /* Continue with next chunk. */ + working_copy = string_split.second;; - out << "\n"; + out << "\n"; - /* Add whitespace if description shall continue on next line. */ - if ((desc_split_it + 1) != desc_split.constEnd ()) { - indent = 2 + max_len + 4; - out << QString (" ").repeated (indent); + /* + * Print whitespace if the remainder string is non-empty + * or printing shall continue on next line. + */ + if ((!working_copy.isEmpty ()) || ((desc_split_it + 1) != desc_split.constEnd ())) { + indent = 2 + max_len + 4; + out << QString (" ").repeated (indent); + } } } } -- 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 master in repository x2goclient. commit 6e7ca038f6188cf300ec9a78887b57f019d5c6e0 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Apr 24 01:01:45 2015 +0200 help.cpp: move functions around a bit. --- src/help.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/help.cpp b/src/help.cpp index 12a1264..6b95732 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -163,10 +163,6 @@ help::data_t help::build_data () { return (help::data_t (help::cleanup_prelude (help::build_prelude ()), help::cleanup_params (help::build_params ()))); } -QString help::pretty_print () { - return (help::pretty_print (help::build_data ())); -} - help::string_split_t help::split_long_line (QString &line, std::ptrdiff_t max_length) { string_split_t ret (line, ""); @@ -185,6 +181,10 @@ help::string_split_t help::split_long_line (QString &line, std::ptrdiff_t max_le return (ret); } +QString help::pretty_print () { + return (help::pretty_print (help::build_data ())); +} + QString help::pretty_print (help::data_t data) { QString ret = ""; QTextStream out (&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 master in repository x2goclient. commit d9e471602d440e8fc765d7e58bfadd630ca640fe Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Apr 24 01:31:31 2015 +0200 help.h: lower default splitting length to 100 characters. --- debian/changelog | 1 + src/help.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index bd28f64..7c4673d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -312,6 +312,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low and automatic printing to stderr. - onmainwindow.cpp: don't let a potential terminal affect the help string shown in the GUI. + - help.h: lower default splitting length to 100 characters. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.h b/src/help.h index 3a9c24d..e05ca92 100644 --- a/src/help.h +++ b/src/help.h @@ -54,7 +54,7 @@ namespace help { * is performed. * In that case, the second component is empty. */ - string_split_t split_long_line (QString &line, std::ptrdiff_t max_length = 200); + string_split_t split_long_line (QString &line, std::ptrdiff_t max_length = 100); /* * Returns a help_data_t structure as a QString. -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git