diff options
Diffstat (limited to 'plugingui')
| -rw-r--r-- | plugingui/abouttab.cc | 34 | 
1 files changed, 16 insertions, 18 deletions
| diff --git a/plugingui/abouttab.cc b/plugingui/abouttab.cc index 960a321..0c56c62 100644 --- a/plugingui/abouttab.cc +++ b/plugingui/abouttab.cc @@ -37,8 +37,10 @@ namespace GUI  class AboutTextBuilder {  public:  	//!Class constructor. Sets the separator character. -	AboutTextBuilder(char _separator='=') -    :separator_character(_separator) +	AboutTextBuilder(char _separator='=', size_t _separator_count=20, size_t _space_count=13) +    :separator_character(_separator), +    separator_count(_separator_count), +    space_count(_space_count)  	{  	} @@ -46,18 +48,14 @@ public:  	//!Returns a reference to the builder so more calls can be chained.  	AboutTextBuilder& add(const std::string& _title, const std::string& _contents)   	{ -		auto repeat=[](std::string& _str, char _fill, size_t _count)  -		{ -			_str.insert(_str.size(), _count, _fill); -		}; - -		repeat(about_text, separator_character, separator_count); -		about_text+="\n"; -		repeat(about_text, ' ', space_count); -		about_text+=_title+"\n"; -		repeat(about_text, separator_character, separator_count); -		repeat(about_text, '\n', 3); -		about_text+=_contents+"\n"; +		about_text.append(separator_count, separator_character) +		          .append(1, '\n') +		          .append(space_count, ' ') +		          .append(1, '\n') +		          .append(separator_count, separator_character) +		          .append(3, '\n') +		          .append(_contents) +		          .append(1, '\n');  		return *this;  	} @@ -69,8 +67,8 @@ public:  	}  private: -	const size_t separator_count=13; //!< Number of times that the separator character will be added.  -	const size_t space_count=13; //!< Number of times that the space character will be added before the title. +	const size_t separator_count; //!< Number of times that the separator character will be added. Defaults to 20. +	const size_t space_count; //!< Number of times that the space character will be added before the title. Defaults to 13.  	char separator_character; //!< Separator character. Defaults to '='.  	std::string about_text; //!< Text that will be filled up with calls to "add".  }; @@ -94,11 +92,11 @@ void AboutTab::resize(std::size_t width, std::size_t height)  std::string AboutTab::getAboutText()  { -	AboutTextBuilder builder('*'); +	AboutTextBuilder builder;  	//This will casually add an extra newline at the end of License.  	return builder.add("About", about.data()) -	    .add("Version", std::string(VERSION)) +	    .add("Version", std::string(VERSION)+"\n")  	    .add("Bugs", bugs.data())  	    .add("Authors", UTF8().toLatin1(authors.data()))  	    .add("License", gpl.data()) | 
