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"
30 using namespace lyx::support;
34 typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
37 QAbout::QAbout(Dialog & parent)
38 : base_class(parent, _("About LyX"))
43 void QAbout::build_dialog()
45 dialog_.reset(new QAboutDialog);
46 connect(dialog_.get()->closePB, SIGNAL(clicked()),
47 this, SLOT(slotClose()));
49 dialog_->copyright->setText(toqstr(controller().getCopyright()));
50 dialog_->copyright->append("\n");
51 dialog_->copyright->append(toqstr(controller().getLicense()));
52 dialog_->copyright->append("\n");
53 dialog_->copyright->append(toqstr(controller().getDisclaimer()));
55 dialog_->versionLA->setText(toqstr(controller().getVersion()));
57 // The code below should depend on a autoconf test. (Lgb)
59 // There are a lot of buggy stringstream implementations..., but the
60 // code below will work on all of them (I hope). The drawback with
61 // this solutions os the extra copying. (Lgb)
64 controller().getCredits(in);
66 istringstream ss(in.str());
71 while (getline(ss, s)) {
72 if (prefixIs(s, "@b"))
73 out << "<b>" << s.substr(2) << "</b>";
74 else if (prefixIs(s, "@i"))
75 out << "<i>" << s.substr(2) << "</i>";
81 // Good stringstream implementations can handle this. It avoids
82 // some copying, and should thus be faster and use less memory. (Lgb)
83 // I'll make this the default for a short while to see if anyone
86 controller().getCredits(in);
91 while (getline(in, s)) {
92 if (prefixIs(s, "@b"))
93 out << "<b>" << s.substr(2) << "</b>";
94 else if (prefixIs(s, "@i"))
95 out << "<i>" << s.substr(2) << "</i>";
102 dialog_->creditsTV->setText(toqstr(out.str()));
104 // try to resize to a good size
105 dialog_->copyright->hide();
106 dialog_->setMinimumSize(dialog_->copyright->sizeHint());
107 dialog_->copyright->show();
108 dialog_->setMinimumSize(dialog_->sizeHint());
110 // Manage the cancel/close button
111 bcview().setCancel(dialog_->closePB);