/**
* \file ControlAboutlyx.C
- * Copyright 2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Edwin Leuven, leuven@fee.uva.nl
- * \author Angus Leeming, a.leeming@.ac.uk
+ * \author Edwin Leuven
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-#include <fstream>
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-#include "ViewBase.h"
-#include "ButtonControllerBase.h"
#include "ControlAboutlyx.h"
-#include "Dialogs.h"
-#include "frontends/LyXView.h"
-#include "Lsstream.h"
-#include "BufferView.h"
#include "gettext.h"
-#include "support/filetools.h" // FileSearch
#include "version.h"
-#include <boost/bind.hpp>
+#include "support/filetools.h" // FileSearch
+#include "support/package.h"
-// needed for the browser
-extern string system_lyxdir;
-extern string user_lyxdir;
+#include <fstream>
+#include <sstream>
-ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d)
- : ControlDialogBI(lv, d)
-{
- d_.showAboutlyx = boost::bind(&ControlAboutlyx::show, this);
-}
+using std::ostream;
+using std::ostringstream;
+using std::string;
+
+
+namespace lyx {
+
+using support::FileName;
+using support::fileSearch;
+using support::makeDisplayPath;
+using support::package;
+namespace frontend {
-stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
+
+ControlAboutlyx::ControlAboutlyx(Dialog & parent)
+ : Dialog::Controller(parent)
+{}
+
+
+void ControlAboutlyx::getCredits(ostream & ss) const
{
- string const name = FileSearch(system_lyxdir, "CREDITS");
+ FileName const name = fileSearch(package().system_support(), "CREDITS");
bool found(!name.empty());
if (found) {
- std::ifstream in(name.c_str());
- found = (in.get());
+ std::ifstream in(name.toFilesystemEncoding().c_str());
- if (found) {
- in.seekg(0, std::ios::beg); // rewind to the beginning
-
- ss << in.rdbuf();
- found = (ss.good());
- }
+ ss << in.rdbuf();
+ found = ss.good();
}
if (!found) {
- ss << _("ERROR: LyX wasn't able to read CREDITS file\n")
- << _("Please install correctly to estimate the great\n")
- << _("amount of work other people have done for the LyX project.");
+ ss << to_utf8(_("ERROR: LyX wasn't able to read CREDITS file\n"))
+ << to_utf8(_("Please install correctly to estimate the great\n"))
+ << to_utf8(_("amount of work other people have done for the LyX project."));
}
-
- return ss;
}
+
string const ControlAboutlyx::getCopyright() const
{
- return _("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 LyX Team");
+ return to_utf8(_("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2006 LyX Team"));
}
+
string const ControlAboutlyx::getLicense() const
{
- 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.");
+ 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."));
}
+
string const ControlAboutlyx::getDisclaimer() const
{
- 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.");
+ 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."));
}
+
string const ControlAboutlyx::getVersion() const
{
- stringstream ss;
+ ostringstream ss;
- ss << _("LyX Version ")
+ ss << to_utf8(_("LyX Version "))
<< lyx_version
- << _(" of ")
+ << " ("
<< lyx_release_date
+ << ")\n"
+ << to_utf8(_("Library directory: "))
+ << to_utf8(makeDisplayPath(package().system_support()))
<< "\n"
- << _("Library directory: ")
- << MakeDisplayPath(system_lyxdir)
- << "\n"
- << _("User directory: ")
- << MakeDisplayPath(user_lyxdir);
+ << to_utf8(_("User directory: "))
+ << to_utf8(makeDisplayPath(package().user_support()));
- return ss.str().c_str();
+ return ss.str();
}
+
+} // namespace frontend
+} // namespace lyx