]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiAbout.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiAbout.cpp
1 /**
2  * \file GuiAbout.cpp
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 #include "GuiAbout.h"
14
15 #include "qt_helpers.h"
16 #include "version.h"
17
18 #include "support/filetools.h"
19 #include "support/Package.h"
20
21 #include <QtCore>
22 #include <QtGui>
23
24 using lyx::support::package;
25 using lyx::support::makeDisplayPath;
26
27
28 namespace lyx {
29 namespace frontend {
30
31 static QString credits()
32 {
33         QString res;
34         QFile file(toqstr(package().system_support().absFilename()) + "CREDITS");
35         QTextStream out(&res);
36
37         if (file.isReadable()) {
38                 out << qt_("ERROR: LyX wasn't able to read CREDITS file\n");
39                 out << qt_("Please install correctly to estimate the great\n");
40                 out << qt_("amount of work other people have done for the LyX project.");
41         } else {
42                 file.open(QIODevice::ReadOnly);
43                 QTextStream ts(&file);
44                 QString line;
45                 do {
46                         line = ts.readLine();
47                         if (line.startsWith("@b"))
48                                 out << "<b>" << line.mid(2) << "</b>";
49                         else if (line.startsWith("@i"))
50                                 out << "<i>" << line.mid(2) << "</i>";
51                         else
52                                 out << line;
53                         out << "<br>";
54                 } while (!line.isNull());
55         }
56         out.flush();
57         return res;
58 }
59
60
61 static QString copyright()
62 {
63         return qt_("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2008 LyX Team");
64 }
65
66
67 static QString license()
68 {
69         return qt_("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.");
70 }
71
72
73 static QString disclaimer()
74 {
75         return qt_("LyX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.");
76 }
77
78
79 static QString version()
80 {
81         QString res;
82         QTextStream out(&res);
83         out << qt_("LyX Version ");
84         out << lyx_version;
85         out << " (";
86         out << lyx_release_date;
87         out << ")\n";
88         out << qt_("Library directory: ");
89         out << toqstr(makeDisplayPath(package().system_support().absFilename()));
90         out << "\n";
91         out << qt_("User directory: ");
92         out << toqstr(makeDisplayPath(package().user_support().absFilename()));
93         return res;
94 }
95
96
97 GuiAbout::GuiAbout(GuiView & lv)
98         : GuiDialog(lv, "aboutlyx", qt_("About LyX"))
99 {
100         setupUi(this);
101
102         connect(closePB, SIGNAL(clicked()), this, SLOT(reject()));
103
104         copyrightTB->setPlainText(copyright());
105         copyrightTB->append(QString());
106         copyrightTB->append(license());
107         copyrightTB->append(QString());
108         copyrightTB->append(disclaimer());
109
110         versionLA->setText(version());
111         creditsTB->setHtml(credits());
112 }
113
114
115 Dialog * createGuiAbout(GuiView & lv) { return new GuiAbout(lv); }
116
117
118 } // namespace frontend
119 } // namespace lyx
120
121 #include "GuiAbout_moc.cpp"