]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QAbout.C
Compile fixes. Qt2 should now build (and fail immediately when you start it,
[lyx.git] / src / frontends / qt2 / QAbout.C
1 /**
2  * \file QAbout.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Kalle Dalheimer <kalle@klaralvdalens-datakonsult.se>
7  */
8
9 #include <config.h>
10
11 #include "support/lstrings.h"
12 #include "Lsstream.h"
13 #include "debug.h"
14 #include "gettext.h"
15 #include "LyXView.h"
16 #include "ButtonControllerBase.h"
17 #include "ControlAboutlyx.h"
18  
19 #include <qlabel.h>
20 #include <qpushbutton.h>
21 #include <qtextview.h>
22
23 #include "QAboutDialog.h"
24 #include "Qt2BC.h"
25 #include "QAbout.h"
26
27 using std::getline;
28
29 typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class;
30
31 QAbout::QAbout(ControlAboutlyx & c, Dialogs &)
32         : base_class(c, _("About LyX"))
33 {
34 }
35
36
37 void QAbout::build_dialog()
38 {
39         dialog_.reset(new QAboutDialog());
40         connect(dialog_.get()->closePB, SIGNAL(clicked()),
41                 this, SLOT(slotClose()));
42
43         dialog_->copyright->setText(controller().getCopyright().c_str());
44         dialog_->copyright->append("\n");
45         dialog_->copyright->append(controller().getLicense().c_str());
46         dialog_->copyright->append("\n");
47         dialog_->copyright->append(controller().getDisclaimer().c_str());
48
49         dialog_->versionLA->setText(controller().getVersion().c_str());
50
51         stringstream in;
52         controller().getCredits(in);
53
54         istringstream ss(in.str().c_str());
55
56         string s;
57         string out;
58
59         while (getline(ss, s)) {
60                 if (prefixIs(s, "@b"))
61                         out += "<b>" + s.substr(2) + "</b>";
62                 else if (prefixIs(s, "@i"))
63                         out += "<i>" + s.substr(2) + "</i>";
64                 else
65                         out += s;
66                 out += "<br>";
67         }
68
69         dialog_->creditsTV->setText(out.c_str());
70
71         // Manage the cancel/close button
72         bc().setCancel(dialog_->closePB);
73         bc().refresh();
74 }