]> git.lyx.org Git - features.git/blob - src/frontends/controllers/ControlAboutlyx.C
Switch from SigC signals to boost::signals
[features.git] / src / frontends / controllers / ControlAboutlyx.C
1 /**
2  * \file ControlAboutlyx.C
3  * Copyright 2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \author Edwin Leuven, leuven@fee.uva.nl
7  * \author Angus Leeming, a.leeming@.ac.uk
8  */
9
10 #include <config.h>
11 #include <fstream>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "ViewBase.h"
18 #include "ButtonControllerBase.h"
19 #include "ControlAboutlyx.h"
20 #include "Dialogs.h"
21 #include "frontends/LyXView.h"
22 #include "Lsstream.h"
23 #include "BufferView.h"
24 #include "gettext.h"
25 #include "support/filetools.h" // FileSearch
26 #include "version.h"
27
28 #include <boost/bind.hpp>
29
30 // needed for the browser
31 extern string system_lyxdir;
32 extern string user_lyxdir;
33
34 ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d)
35         : ControlDialogBI(lv, d)
36 {
37         d_.showAboutlyx = boost::bind(&ControlAboutlyx::show, this);
38 }
39
40
41 stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
42 {
43         string const name = FileSearch(system_lyxdir, "CREDITS");
44
45         bool found(!name.empty());
46
47         if (found) {
48                 std::ifstream in(name.c_str());
49                 found = (in.get());
50
51                 if (found) {
52                         in.seekg(0, std::ios::beg); // rewind to the beginning
53
54                         ss << in.rdbuf();
55                         found = (ss.good());
56                 }
57         }
58
59         if (!found) {
60                 ss << _("ERROR: LyX wasn't able to read CREDITS file\n")
61                    << _("Please install correctly to estimate the great\n")
62                    << _("amount of work other people have done for the LyX project.");
63         }
64
65         return ss;
66 }
67
68 string const ControlAboutlyx::getCopyright() const
69 {
70         return _("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 LyX Team");
71 }
72
73 string const ControlAboutlyx::getLicense() const
74 {
75         return _("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.");
76 }
77
78 string const ControlAboutlyx::getDisclaimer() const
79 {
80         return _("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., 675 Mass Ave, Cambridge, MA 02139, USA.");
81 }
82
83 string const ControlAboutlyx::getVersion() const
84 {
85         stringstream ss;
86
87         ss << _("LyX Version ")
88            << lyx_version
89            << _(" of ")
90            << lyx_release_date
91            << "\n"
92            << _("Library directory: ")
93            << MakeDisplayPath(system_lyxdir)
94            << "\n"
95            << _("User directory: ")
96            << MakeDisplayPath(user_lyxdir);
97
98         return ss.str().c_str();
99 }