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 GuiAbout::GuiAbout(GuiDialog & parent)
39 : GuiView<GuiAboutDialog>(parent, _("About LyX"))
44 void GuiAbout::build_dialog()
46 dialog_.reset(new GuiAboutDialog);
47 connect(dialog_.get()->closePB, SIGNAL(clicked()),
48 this, SLOT(slotClose()));
50 dialog_->copyrightTB->setPlainText(toqstr(controller().getCopyright()));
51 dialog_->copyrightTB->append("");
52 dialog_->copyrightTB->append(toqstr(controller().getLicense()));
53 dialog_->copyrightTB->append("");
54 dialog_->copyrightTB->append(toqstr(controller().getDisclaimer()));
56 dialog_->versionLA->setText(toqstr(controller().getVersion()));
58 // The code below should depend on a autoconf test. (Lgb)
60 // There are a lot of buggy stringstream implementations..., but the
61 // code below will work on all of them (I hope). The drawback with
62 // this solutions os the extra copying. (Lgb)
65 controller().getCredits(in);
67 istringstream ss(in.str());
72 while (getline(ss, s)) {
73 if (prefixIs(s, "@b"))
74 out << "<b>" << s.substr(2) << "</b>";
75 else if (prefixIs(s, "@i"))
76 out << "<i>" << s.substr(2) << "</i>";
82 // Good stringstream implementations can handle this. It avoids
83 // some copying, and should thus be faster and use less memory. (Lgb)
84 // I'll make this the default for a short while to see if anyone
87 controller().getCredits(in);
92 while (getline(in, s)) {
93 if (prefixIs(s, "@b"))
94 out << "<b>" << s.substr(2) << "</b>";
95 else if (prefixIs(s, "@i"))
96 out << "<i>" << s.substr(2) << "</i>";
103 dialog_->creditsTB->setHtml(toqstr(out.str()));
105 // try to resize to a good size
106 dialog_->copyrightTB->hide();
107 dialog_->setMinimumSize(dialog_->copyrightTB->sizeHint());
108 dialog_->copyrightTB->show();
109 dialog_->setMinimumSize(dialog_->sizeHint());
111 // Manage the cancel/close button
112 bc().setCancel(dialog_->closePB);
113 //FIXME bc().refresh();
116 } // namespace frontend
119 #include "GuiAbout_moc.cpp"