]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCredits.C
Controller-view split of Graphics and Index popups.
[lyx.git] / src / frontends / controllers / ControlCredits.C
1 /**
2  * \file ControlCredits.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 #include "Lsstream.h"
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "ControlCredits.h"
19 #include "Dialogs.h"
20 #include "LyXView.h"
21 #include "BufferView.h"
22 #include "gettext.h"
23 #include "support/filetools.h" // FileSearch
24
25 // needed for the browser
26 extern string system_lyxdir;
27
28
29 ControlCredits::ControlCredits(LyXView & lv, Dialogs & d)
30         : ControlDialog<ControlConnectBI>(lv, d)
31 {
32         d_.showCredits.connect(SigC::slot(this, &ControlCredits::show));
33 }
34
35
36 std::stringstream & ControlCredits::getCredits(std::stringstream & ss) const
37 {
38         string const name = FileSearch(system_lyxdir, "CREDITS");
39
40         bool found(!name.empty());
41
42         if (found) {
43                 std::ifstream in(name.c_str());
44                 found = (in.get());
45
46                 if (found) {
47                         in.seekg(0, std::ios::beg); // rewind to the beginning
48
49                         ss << in.rdbuf();
50                         found = (ss.good());
51                 }
52         }
53
54         if (!found) {
55                 ss << _("ERROR: LyX wasn't able to read CREDITS file\n")
56                    << _("Please install correctly to estimate the great\n")
57                    << _("amount of work other people have done for the LyX project.");
58         }
59
60         return ss;
61 }