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