summaryrefslogtreecommitdiff
path: root/client/resumewidget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/resumewidget.cc')
-rw-r--r--client/resumewidget.cc36
1 files changed, 26 insertions, 10 deletions
diff --git a/client/resumewidget.cc b/client/resumewidget.cc
index d5b1825..6581797 100644
--- a/client/resumewidget.cc
+++ b/client/resumewidget.cc
@@ -29,30 +29,31 @@
#include <QHBoxLayout>
#include <QBoxLayout>
-//#define RICH
-ResumeWidget::ResumeWidget()
+#define MAX_COMPACT_SIZE 100
+
+//#define RICH // Experimental syntax highlighter (numbers turn blue)
+
+ResumeWidget::ResumeWidget(bool compact)
{
+ this->compact = compact;
setLayout(new QHBoxLayout());
layout()->setContentsMargins(10,2,2,2);
- resume = new QLabel("Endnu ikke udfyldt");
+ resume = new QLabel("<font style='color: #ccc;'>Endnu ikke udfyldt</font>");
#ifdef RICH
resume->setTextFormat(Qt::RichText);
#endif
resume->setWordWrap(true);
- resume->setEnabled(false);
layout()->addWidget(resume);
}
void ResumeWidget::setText(QString text)
{
- resume->setEnabled(true);
-
-#ifdef RICH
QString f;
+#ifdef RICH
for(int i = 0; i < text.length(); i++) {
if(text[i] >= '0' && text[i] <= '9') f += "<font style='color: #55F;'>" + text[i] + "</font>";
else if(text[i] == '\n') f += "<br/>";
@@ -60,10 +61,25 @@ void ResumeWidget::setText(QString text)
else f += text[i];
}
- resume->setText(f);
resume->setWordWrap(true);
#else
- resume->setText(text);
+ f = text;
#endif
-}
+ if(compact) {
+ QString origtext = f;
+
+ if(f.count('\n') > 0) f = f.left(f.indexOf('\n')); // Limit to one line.
+
+ if(f.length() > MAX_COMPACT_SIZE) {
+ f = f.left(MAX_COMPACT_SIZE); // limit to first MAX_COMPACT_SIZE characters.
+ }
+
+ if(text != f) {
+ f += " <font style='color: #0b0;'>...</font>";
+ resume->setToolTip(origtext); // Only set tooltip if resume has actually been cut off.
+ }
+ }
+
+ resume->setText(f);
+}