From 816278b4cb0fe5040d890f2678908dcae0fed12c Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 3 Dec 2008 13:01:08 +0000 Subject: Made some fixups on the way compressed resumes are shown. --- client/resumewidget.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/client/resumewidget.cc b/client/resumewidget.cc index 6581797..563d2df 100644 --- a/client/resumewidget.cc +++ b/client/resumewidget.cc @@ -32,6 +32,7 @@ #define MAX_COMPACT_SIZE 100 //#define RICH // Experimental syntax highlighter (numbers turn blue) +//#define FIXED_FONT // Show the resume, using a fixed font. ResumeWidget::ResumeWidget(bool compact) { @@ -49,10 +50,40 @@ ResumeWidget::ResumeWidget(bool compact) layout()->addWidget(resume); } +#define LINEWIDTH 80 +static QString reformatString(QString help) +{ + QString output; + + int lastnl = 0; + for(int i = 0; i < help.size(); i++) { + if(help[i] == '\n') { + lastnl = 0; + } else { + if(lastnl > LINEWIDTH && help[i] == ' ') { + output += '\n'; + lastnl = 0; + } else { + lastnl++; + } + } + + output += help[i]; + + } + return output; +} + void ResumeWidget::setText(QString text) { QString f; +#ifdef FIXED_FONT + QFont font = resume->font(); + font.setFamily("Courier New"); + resume->setFont(font); +#endif + #ifdef RICH for(int i = 0; i < text.length(); i++) { if(text[i] >= '0' && text[i] <= '9') f += "" + text[i] + ""; @@ -76,8 +107,8 @@ void ResumeWidget::setText(QString text) } if(text != f) { - f += " ..."; - resume->setToolTip(origtext); // Only set tooltip if resume has actually been cut off. + f += " "; + resume->setToolTip(reformatString(origtext)); // Only set tooltip if resume has actually been cut off. } } -- cgit v1.2.3