]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlAboutlyx.cpp
Rename .C => .cpp for files in src/frontends/controllers, step 2
[lyx.git] / src / frontends / controllers / ControlAboutlyx.cpp
1 /**
2  * \file ControlAboutlyx.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "ControlAboutlyx.h"
15 #include "gettext.h"
16 #include "version.h"
17
18 #include "support/filetools.h" // FileSearch
19 #include "support/package.h"
20
21 #include <fstream>
22 #include <sstream>
23
24 using std::ostream;
25 using std::ostringstream;
26 using std::string;
27
28
29 namespace lyx {
30
31 using support::FileName;
32 using support::fileSearch;
33 using support::makeDisplayPath;
34 using support::package;
35
36 namespace frontend {
37
38
39 ControlAboutlyx::ControlAboutlyx(Dialog & parent)
40         : Dialog::Controller(parent)
41 {}
42
43
44 void ControlAboutlyx::getCredits(ostream & ss) const
45 {
46         FileName const name = fileSearch(package().system_support().absFilename(), "CREDITS");
47
48         bool found(!name.empty());
49
50         if (found) {
51                 std::ifstream in(name.toFilesystemEncoding().c_str());
52
53                 ss << in.rdbuf();
54                 found = ss.good();
55         }
56
57         if (!found) {
58                 ss << to_utf8(_("ERROR: LyX wasn't able to read CREDITS file\n"))
59                    << to_utf8(_("Please install correctly to estimate the great\n"))
60                    << to_utf8(_("amount of work other people have done for the LyX project."));
61         }
62 }
63
64
65 string const ControlAboutlyx::getCopyright() const
66 {
67         return to_utf8(_("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2006 LyX Team"));
68 }
69
70
71 string const ControlAboutlyx::getLicense() const
72 {
73         return to_utf8(_("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."));
74 }
75
76
77 string const ControlAboutlyx::getDisclaimer() const
78 {
79         return to_utf8(_("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."));
80 }
81
82
83 string const ControlAboutlyx::getVersion() const
84 {
85         ostringstream ss;
86
87         ss << to_utf8(_("LyX Version "))
88            << lyx_version
89            << " ("
90            << lyx_release_date
91            << ")\n"
92            << to_utf8(_("Library directory: "))
93            << to_utf8(makeDisplayPath(package().system_support().absFilename()))
94            << "\n"
95            << to_utf8(_("User directory: "))
96            << to_utf8(makeDisplayPath(package().user_support().absFilename()));
97
98         return ss.str();
99 }
100
101 } // namespace frontend
102 } // namespace lyx