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.
13 #include "support/lstrings.h"
14 #include "support/std_sstream.h"
15 #include "qt_helpers.h"
16 #include "ButtonController.h"
17 #include "ControlAboutlyx.h"
20 #include <qpushbutton.h>
21 #include <qtextview.h>
23 #include "QAboutDialog.h"
27 using namespace lyx::support;
30 using std::istringstream;
31 using std::ostringstream;
34 typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
36 QAbout::QAbout(Dialog & parent)
37 : base_class(parent, _("About LyX"))
42 void QAbout::build_dialog()
44 dialog_.reset(new QAboutDialog);
45 connect(dialog_.get()->closePB, SIGNAL(clicked()),
46 this, SLOT(slotClose()));
48 dialog_->copyright->setText(toqstr(controller().getCopyright()));
49 dialog_->copyright->append("\n");
50 dialog_->copyright->append(toqstr(controller().getLicense()));
51 dialog_->copyright->append("\n");
52 dialog_->copyright->append(toqstr(controller().getDisclaimer()));
54 dialog_->versionLA->setText(toqstr(controller().getVersion()));
56 // The code below should depend on a autoconf test. (Lgb)
58 // There are a lot of buggy stringstream implementations..., but the
59 // code below will work on all of them (I hope). The drawback with
60 // this solutions os the extra copying. (Lgb)
63 controller().getCredits(in);
65 istringstream ss(in.str());
70 while (getline(ss, s)) {
71 if (prefixIs(s, "@b"))
72 out << "<b>" << s.substr(2) << "</b>";
73 else if (prefixIs(s, "@i"))
74 out << "<i>" << s.substr(2) << "</i>";
80 // Good stringstream implementations can handle this. It avoids
81 // some copying, and should thus be faster and use less memory. (Lgb)
82 // I'll make this the default for a short while to see if anyone
85 controller().getCredits(in);
90 while (getline(in, s)) {
91 if (prefixIs(s, "@b"))
92 out << "<b>" << s.substr(2) << "</b>";
93 else if (prefixIs(s, "@i"))
94 out << "<i>" << s.substr(2) << "</i>";
101 dialog_->creditsTV->setText(toqstr(STRCONV(out.str())));
103 // try to resize to a good size
104 dialog_->copyright->hide();
105 dialog_->setMinimumSize(dialog_->copyright->sizeHint());
106 dialog_->copyright->show();
107 dialog_->setMinimumSize(dialog_->sizeHint());
109 // Manage the cancel/close button
110 bcview().setCancel(dialog_->closePB);