16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 03:09:18 +02:00

build 190514. partial usage of utf8 in the ui, timetable panel appeaance improvements

This commit is contained in:
tmj-fstate
2019-05-14 20:15:01 +02:00
parent 1626224dc8
commit 9cdce2d346
10 changed files with 144 additions and 55 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -246,6 +246,24 @@ std::string to_hex_str( int const Value, int const Width )
return converter.str();
};
char * const fractionlabels[] = { " ", u8"¹", u8"²", u8"³", u8"", u8"", u8"", u8"", u8"", u8"" };
std::string to_minutes_str( float const Minutes, bool const Leadingzero, int const Width ) {
float minutesintegral;
auto const minutesfractional { std::modf( Minutes, &minutesintegral ) };
auto const width { Width - 1 };
auto minutes = (
std::string( width - 1, ' ' )
+ ( Leadingzero ?
to_string( 100 + minutesintegral ).substr( 1, 2 ) :
to_string( minutesintegral, 0 ) ) );
return (
minutes.substr( minutes.size() - width, width )
+ fractionlabels[ static_cast<int>( std::floor( minutesfractional * 10 + 0.1 ) ) ] );
}
int stol_def(const std::string &str, const int &DefaultValue) {
int result { DefaultValue };