From e5ae0c0bb0b641673f21855927395ca053d05de2 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 4 Dec 2008 13:03:16 +0000 Subject: Moved images to icons folder and added them as internal resources. Created a nice way to show full resume in resumewidget. --- client/add.png | Bin 242 -> 0 bytes client/arrows.png | Bin 547 -> 0 bytes client/client.qrc | 4 ++++ client/del.png | Bin 370 -> 0 bytes client/icons/add.png | Bin 0 -> 242 bytes client/icons/arrows.png | Bin 0 -> 547 bytes client/icons/compressed.png | Bin 0 -> 302 bytes client/icons/del.png | Bin 0 -> 370 bytes client/resumewidget.cc | 34 +++++++++++++++++++++++++++++----- client/resumewidget.h | 6 ++++++ client/widgets/multilist.cc | 6 +++--- 11 files changed, 42 insertions(+), 8 deletions(-) delete mode 100644 client/add.png delete mode 100644 client/arrows.png delete mode 100644 client/del.png create mode 100644 client/icons/add.png create mode 100644 client/icons/arrows.png create mode 100644 client/icons/compressed.png create mode 100644 client/icons/del.png diff --git a/client/add.png b/client/add.png deleted file mode 100644 index 7a8dfc0..0000000 Binary files a/client/add.png and /dev/null differ diff --git a/client/arrows.png b/client/arrows.png deleted file mode 100644 index ae56b01..0000000 Binary files a/client/arrows.png and /dev/null differ diff --git a/client/client.qrc b/client/client.qrc index 2ef2314..6da90ed 100644 --- a/client/client.qrc +++ b/client/client.qrc @@ -2,5 +2,9 @@ icons/icon.png + icons/add.png + icons/del.png + icons/arrows.png + icons/compressed.png diff --git a/client/del.png b/client/del.png deleted file mode 100644 index 222ac8b..0000000 Binary files a/client/del.png and /dev/null differ diff --git a/client/icons/add.png b/client/icons/add.png new file mode 100644 index 0000000..7a8dfc0 Binary files /dev/null and b/client/icons/add.png differ diff --git a/client/icons/arrows.png b/client/icons/arrows.png new file mode 100644 index 0000000..ae56b01 Binary files /dev/null and b/client/icons/arrows.png differ diff --git a/client/icons/compressed.png b/client/icons/compressed.png new file mode 100644 index 0000000..6213762 Binary files /dev/null and b/client/icons/compressed.png differ diff --git a/client/icons/del.png b/client/icons/del.png new file mode 100644 index 0000000..222ac8b Binary files /dev/null and b/client/icons/del.png differ diff --git a/client/resumewidget.cc b/client/resumewidget.cc index 563d2df..8e67b92 100644 --- a/client/resumewidget.cc +++ b/client/resumewidget.cc @@ -29,6 +29,9 @@ #include #include +#include +#include + #define MAX_COMPACT_SIZE 100 //#define RICH // Experimental syntax highlighter (numbers turn blue) @@ -48,6 +51,8 @@ ResumeWidget::ResumeWidget(bool compact) resume->setWordWrap(true); layout()->addWidget(resume); + + connect(resume, SIGNAL(linkActivated(const QString &)), this, SLOT(showFull(const QString &))); } #define LINEWIDTH 80 @@ -78,6 +83,8 @@ void ResumeWidget::setText(QString text) { QString f; + fulltext = text; + #ifdef FIXED_FONT QFont font = resume->font(); font.setFamily("Courier New"); @@ -98,19 +105,36 @@ void ResumeWidget::setText(QString 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 += " "; - resume->setToolTip(reformatString(origtext)); // Only set tooltip if resume has actually been cut off. + if(fulltext != f) { + f += " "; + resume->setToolTip(reformatString(fulltext)); // Only set tooltip if resume has actually been cut off. + resume->setWhatsThis(fulltext); // Only set tooltip if resume has actually been cut off. } } resume->setText(f); } + +void ResumeWidget::showFull(const QString &) +{ + QDialog d(this); + d.setWindowTitle("Resume"); + + QTextEdit *t = new QTextEdit(&d); + d.resize(500, 200); + d.move(mapToGlobal(pos())); + t->setText(reformatString(fulltext)); + t->setReadOnly(true); + t->setLineWrapMode(QTextEdit::NoWrap); + + d.setLayout(new QHBoxLayout()); + d.layout()->addWidget(t); + + d.exec(); +} diff --git a/client/resumewidget.h b/client/resumewidget.h index 4b0eba9..fe8beb1 100644 --- a/client/resumewidget.h +++ b/client/resumewidget.h @@ -29,14 +29,20 @@ #include #include +#include class ResumeWidget : public QWidget { +Q_OBJECT public: ResumeWidget(bool compact); void setText(QString text); +public slots: + void showFull(const QString &); + private: + QString fulltext; QLabel *resume; bool compact; }; diff --git a/client/widgets/multilist.cc b/client/widgets/multilist.cc index 5ba40ac..bff3ad7 100644 --- a/client/widgets/multilist.cc +++ b/client/widgets/multilist.cc @@ -89,13 +89,13 @@ MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow) } QLabel *arrows = new QLabel(); - arrows->setPixmap(QPixmap("arrows.png")); + arrows->setPixmap(QPixmap(":icons/arrows.png")); layout->addWidget(arrows, 1, 0, 1, 2, Qt::AlignHCenter); QPushButton *add = new QPushButton(this); connect(add, SIGNAL(clicked()), this, SLOT(add())); add->setText("Tilføj ovenstående til listen"); - add->setIcon(QIcon(QPixmap("add.png"))); + add->setIcon(QIcon(QPixmap(":icons/add.png"))); // layout->addWidget(add, 0, 1, Qt::AlignTop); layout->addWidget(add, 2, 0, 1, 1, Qt::AlignTop); @@ -103,7 +103,7 @@ MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow) QPushButton *rem = new QPushButton(this); connect(rem, SIGNAL(clicked()), this, SLOT(remove())); rem->setText("Fjern det markerede element fra listen"); - rem->setIcon(QIcon(QPixmap("del.png"))); + rem->setIcon(QIcon(QPixmap(":icons/del.png"))); // layout->addWidget(rem, 1, 1, Qt::AlignTop); layout->addWidget(rem, 2, 1, 1, 1, Qt::AlignTop); -- cgit v1.2.3