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 #pragma implementation
17 #include "support/lstrings.h"
22 #include "ButtonControllerBase.h"
23 #include "ControlAboutlyx.h"
26 #include <qpushbutton.h>
27 #include <qtextview.h>
29 #include "QAboutDialog.h"
35 typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class;
39 : base_class(_("About LyX"))
44 void QAbout::build_dialog()
46 dialog_.reset(new QAboutDialog);
47 connect(dialog_.get()->closePB, SIGNAL(clicked()),
48 this, SLOT(slotClose()));
50 dialog_->copyright->setText(controller().getCopyright().c_str());
51 dialog_->copyright->append("\n");
52 dialog_->copyright->append(controller().getLicense().c_str());
53 dialog_->copyright->append("\n");
54 dialog_->copyright->append(controller().getDisclaimer().c_str());
56 dialog_->versionLA->setText(controller().getVersion().c_str());
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().c_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_->creditsTV->setText(out.str().c_str());
105 // try to resize to a good size
106 dialog_->copyright->hide();
107 dialog_->setMinimumSize(dialog_->copyright->sizeHint());
108 dialog_->copyright->show();
109 dialog_->setMinimumSize(dialog_->sizeHint());
111 // Manage the cancel/close button
112 bc().setCancel(dialog_->closePB);