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.
15 #include "qt_helpers.h"
17 #include "controllers/ButtonController.h"
18 #include "controllers/ControlAboutlyx.h"
20 #include "support/lstrings.h"
25 #include <QPushButton>
27 #include <QTextBrowser>
29 using lyx::support::prefixIs;
33 using std::istringstream;
34 using std::ostringstream;
41 GuiAbout::GuiAbout(Dialog & parent)
42 : GuiView<GuiAboutDialog>(parent, _("About LyX"))
47 void GuiAbout::build_dialog()
49 dialog_.reset(new GuiAboutDialog);
50 connect(dialog_.get()->closePB, SIGNAL(clicked()),
51 this, SLOT(slotClose()));
53 dialog_->copyrightTB->setPlainText(toqstr(controller().getCopyright()));
54 dialog_->copyrightTB->append("");
55 dialog_->copyrightTB->append(toqstr(controller().getLicense()));
56 dialog_->copyrightTB->append("");
57 dialog_->copyrightTB->append(toqstr(controller().getDisclaimer()));
59 dialog_->versionLA->setText(toqstr(controller().getVersion()));
61 // The code below should depend on a autoconf test. (Lgb)
63 // There are a lot of buggy stringstream implementations..., but the
64 // code below will work on all of them (I hope). The drawback with
65 // this solutions os the extra copying. (Lgb)
68 controller().getCredits(in);
70 istringstream ss(in.str());
75 while (getline(ss, s)) {
76 if (prefixIs(s, "@b"))
77 out << "<b>" << s.substr(2) << "</b>";
78 else if (prefixIs(s, "@i"))
79 out << "<i>" << s.substr(2) << "</i>";
85 // Good stringstream implementations can handle this. It avoids
86 // some copying, and should thus be faster and use less memory. (Lgb)
87 // I'll make this the default for a short while to see if anyone
90 controller().getCredits(in);
95 while (getline(in, s)) {
96 if (prefixIs(s, "@b"))
97 out << "<b>" << s.substr(2) << "</b>";
98 else if (prefixIs(s, "@i"))
99 out << "<i>" << s.substr(2) << "</i>";
106 dialog_->creditsTB->setHtml(toqstr(out.str()));
108 // try to resize to a good size
109 dialog_->copyrightTB->hide();
110 dialog_->setMinimumSize(dialog_->copyrightTB->sizeHint());
111 dialog_->copyrightTB->show();
112 dialog_->setMinimumSize(dialog_->sizeHint());
114 // Manage the cancel/close button
115 bcview().setCancel(dialog_->closePB);
119 } // namespace frontend
122 #include "GuiAbout_moc.cpp"