3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Kalle Dalheimer
8 * Full author contact details are available in file CREDITS
14 #include "support/lstrings.h"
17 #include "qt_helpers.h"
19 #include "ButtonController.h"
20 #include "ControlAboutlyx.h"
23 #include <qpushbutton.h>
24 #include <qtextview.h>
26 #include "QAboutDialog.h"
32 typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
35 QAbout::QAbout(Dialog & parent)
36 : base_class(parent, qt_("About LyX"))
41 void QAbout::build_dialog()
43 dialog_.reset(new QAboutDialog);
44 connect(dialog_.get()->closePB, SIGNAL(clicked()),
45 this, SLOT(slotClose()));
47 dialog_->copyright->setText(toqstr(controller().getCopyright()));
48 dialog_->copyright->append("\n");
49 dialog_->copyright->append(toqstr(controller().getLicense()));
50 dialog_->copyright->append("\n");
51 dialog_->copyright->append(toqstr(controller().getDisclaimer()));
53 dialog_->versionLA->setText(toqstr(controller().getVersion()));
55 // The code below should depend on a autoconf test. (Lgb)
57 // There are a lot of buggy stringstream implementations..., but the
58 // code below will work on all of them (I hope). The drawback with
59 // this solutions os the extra copying. (Lgb)
62 controller().getCredits(in);
64 istringstream ss(in.str());
69 while (getline(ss, s)) {
70 if (prefixIs(s, "@b"))
71 out << "<b>" << s.substr(2) << "</b>";
72 else if (prefixIs(s, "@i"))
73 out << "<i>" << s.substr(2) << "</i>";
79 // Good stringstream implementations can handle this. It avoids
80 // some copying, and should thus be faster and use less memory. (Lgb)
81 // I'll make this the default for a short while to see if anyone
84 controller().getCredits(in);
89 while (getline(in, s)) {
90 if (prefixIs(s, "@b"))
91 out << "<b>" << s.substr(2) << "</b>";
92 else if (prefixIs(s, "@i"))
93 out << "<i>" << s.substr(2) << "</i>";
100 dialog_->creditsTV->setText(toqstr(out.str()));
102 // try to resize to a good size
103 dialog_->copyright->hide();
104 dialog_->setMinimumSize(dialog_->copyright->sizeHint());
105 dialog_->copyright->show();
106 dialog_->setMinimumSize(dialog_->sizeHint());
108 // Manage the cancel/close button
109 bcview().setCancel(dialog_->closePB);