]> git.lyx.org Git - features.git/blob - src/frontends/qt2/QAbout.C
Lots and lots of little trivial bits.
[features.git] / src / frontends / qt2 / QAbout.C
1 /**
2  * \file QAbout.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Kalle Dalheimer 
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "support/lstrings.h"
18 #include "Lsstream.h"
19 #include "debug.h"
20 #include "gettext.h"
21 #include "LyXView.h"
22 #include "ButtonControllerBase.h"
23 #include "ControlAboutlyx.h"
24  
25 #include <qlabel.h>
26 #include <qpushbutton.h>
27 #include <qtextview.h>
28
29 #include "QAboutDialog.h"
30 #include "Qt2BC.h"
31 #include "QAbout.h"
32
33 using std::getline;
34
35 typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class;
36
37 QAbout::QAbout()
38         : base_class(_("About LyX"))
39 {
40 }
41
42
43 void QAbout::build_dialog()
44 {
45         dialog_.reset(new QAboutDialog());
46         connect(dialog_.get()->closePB, SIGNAL(clicked()),
47                 this, SLOT(slotClose()));
48
49         dialog_->copyright->setText(controller().getCopyright().c_str());
50         dialog_->copyright->append("\n");
51         dialog_->copyright->append(controller().getLicense().c_str());
52         dialog_->copyright->append("\n");
53         dialog_->copyright->append(controller().getDisclaimer().c_str());
54
55         dialog_->versionLA->setText(controller().getVersion().c_str());
56
57         stringstream in;
58         controller().getCredits(in);
59
60         istringstream ss(in.str().c_str());
61
62         string s;
63         string out;
64
65         while (getline(ss, s)) {
66                 if (prefixIs(s, "@b"))
67                         out += "<b>" + s.substr(2) + "</b>";
68                 else if (prefixIs(s, "@i"))
69                         out += "<i>" + s.substr(2) + "</i>";
70                 else
71                         out += s;
72                 out += "<br>";
73         }
74
75         dialog_->creditsTV->setText(out.c_str());
76
77         // try to resize to a good size
78         dialog_->copyright->hide();
79         dialog_->setMinimumSize(dialog_->copyright->sizeHint());
80         dialog_->copyright->show();
81         dialog_->setMinimumSize(dialog_->sizeHint());
82  
83         // Manage the cancel/close button
84         bc().setCancel(dialog_->closePB);
85         bc().refresh();
86 }