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 "qt_helpers.h"
17 #include "support/lstrings.h"
22 #include <QPushButton>
24 #include <QTextBrowser>
26 using lyx::support::prefixIs;
30 using std::istringstream;
31 using std::ostringstream;
38 GuiAboutDialog::GuiAboutDialog(LyXView & lv)
39 : GuiDialog(lv, "aboutlyx")
42 setViewTitle(_("About LyX"));
44 setController(new ControlAboutlyx(*this));
46 connect(closePB, SIGNAL(clicked()), this, SLOT(reject()));
48 connect(closePB, SIGNAL(clicked()),
49 this, SLOT(slotClose()));
51 copyrightTB->setPlainText(toqstr(controller().getCopyright()));
52 copyrightTB->append("");
53 copyrightTB->append(toqstr(controller().getLicense()));
54 copyrightTB->append("");
55 copyrightTB->append(toqstr(controller().getDisclaimer()));
57 versionLA->setText(toqstr(controller().getVersion()));
59 // The code below should depend on a autoconf test. (Lgb)
61 // There are a lot of buggy stringstream implementations..., but the
62 // code below will work on all of them (I hope). The drawback with
63 // this solutions os the extra copying. (Lgb)
66 controller().getCredits(in);
68 istringstream ss(in.str());
73 while (getline(ss, s)) {
74 if (prefixIs(s, "@b"))
75 out << "<b>" << s.substr(2) << "</b>";
76 else if (prefixIs(s, "@i"))
77 out << "<i>" << s.substr(2) << "</i>";
83 // Good stringstream implementations can handle this. It avoids
84 // some copying, and should thus be faster and use less memory. (Lgb)
85 // I'll make this the default for a short while to see if anyone
88 controller().getCredits(in);
93 while (getline(in, s)) {
94 if (prefixIs(s, "@b"))
95 out << "<b>" << s.substr(2) << "</b>";
96 else if (prefixIs(s, "@i"))
97 out << "<i>" << s.substr(2) << "</i>";
104 creditsTB->setHtml(toqstr(out.str()));
106 // try to resize to a good size
108 setMinimumSize(copyrightTB->sizeHint());
110 setMinimumSize(sizeHint());
112 // Manage the cancel/close button
113 bc().setPolicy(ButtonPolicy::OkCancelPolicy);
114 bc().setCancel(closePB);
119 ControlAboutlyx & GuiAboutDialog::controller() const
121 return static_cast<ControlAboutlyx &>(Dialog::controller());
124 } // namespace frontend
127 #include "GuiAbout_moc.cpp"