Commit 3f1415b1 authored by Johnny Jazeix's avatar Johnny Jazeix

Added text truncature for stats (states are truncated to 10 characters)

and for containers name  (Qt does it better than me... but I use Qt 
better than it uses me :p).
parent 4c2612e4
......@@ -371,11 +371,14 @@ void Render_opengl::paintOverlayGL (){
painter.setFont(QFont("Arial", 10));
*/
/* Draw container text */
for (unsigned int i=0 ; i<_texts.size() ; i++){
const unsigned int texts_size = _texts.size();
for (unsigned int i=0 ; i<texts_size ; i++){
const QFontMetrics metric(arial_font);
const QString text_elided = metric.elidedText(_texts[i].value.c_str(), Qt::ElideRight, _x_scale_container_state*Info::Screen::width/3.);
renderText ( render_to_screen_x(_texts[i].x * _x_scale_container_state/0.20),
render_to_screen_y( trace_to_render_y(_texts[i].y) + 0.5),
_texts[i].value.c_str(),
text_elided,
arial_font);
// painter.drawText( render_to_screen_x(_texts[i].x * _x_scale_container_state/0.20),
......
......@@ -244,7 +244,7 @@ public:
draw_object->draw_text(pos_x+w+_POS_X_LEGEND_DEFAULT,
this->_size_for_one_container-pos_y,
name);
name.substr(0, 10));
if((*it)->get_extra_fields()->find(std::string("Color")) != (*it)->get_extra_fields()->end())
{
......
......@@ -199,7 +199,8 @@ public:
it != this->_states[container_id].end();
it ++, decalage ++) {
std::string name = (*it).first->get_name().to_string();
draw_object->draw_text(pos_x+w+_POS_X_LEGEND_DEFAULT, pos_y, name);
// We cut the name to don't exceed the place
draw_object->draw_text(pos_x+w+_POS_X_LEGEND_DEFAULT, pos_y, name.substr(0, 10));
if((*it).first->get_extra_fields()->find(std::string("Color")) != (*it).first->get_extra_fields()->end()) {
const Color *color = (const Color *)(*it).first->get_extra_fields()->find(std::string("Color"))->second;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment