3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Kalle Dalheimer
8 * Full author contact details are available in file CREDITS.
15 #include "qt_helpers.h"
18 #include "support/filetools.h"
19 #include "support/gettext.h"
20 #include "support/lstrings.h"
21 #include "support/Package.h"
27 using namespace lyx::support;
28 using lyx::support::package;
29 using lyx::support::makeDisplayPath;
36 static QDate release_date()
38 return QDate::fromString(QString(lyx_release_date), Qt::ISODate);
42 static QString credits()
45 QFile file(toqstr(package().system_support().absFilename()) + "/CREDITS");
46 QTextStream out(&res);
48 if (file.isReadable()) {
49 out << qt_("ERROR: LyX wasn't able to read CREDITS file\n");
50 out << qt_("Please install correctly to estimate the great\n");
51 out << qt_("amount of work other people have done for the LyX project.");
53 file.open(QIODevice::ReadOnly);
54 QTextStream ts(&file);
59 if (line.startsWith("@b"))
60 out << "<b>" << line.mid(2) << "</b>";
61 else if (line.startsWith("@i"))
62 out << "<i>" << line.mid(2) << "</i>";
66 } while (!line.isNull());
73 static QString copyright()
75 QString release_year = release_date().toString("yyyy");
76 docstring copy_message =
77 bformat(_("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995--%1$s LyX Team"),
78 qstring_to_ucs4(release_year));
79 return toqstr(copy_message);
83 static QString license()
85 return qt_("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.");
89 static QString disclaimer()
91 return qt_("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.");
95 static QString version()
97 QString loc_release_date;
98 QDate date = release_date();
101 loc_release_date = loc.toString(date, QLocale::LongFormat);
103 if (QString(lyx_release_date) == "not released yet")
104 loc_release_date = qt_("not released yet");
106 loc_release_date = toqstr(lyx_release_date);
108 docstring version_date =
109 bformat(_("LyX Version %1$s\n(%2$s)"),
110 from_ascii(lyx_version),
111 qstring_to_ucs4(loc_release_date))+"\n\n";
113 QTextStream out(&res);
114 out << toqstr(version_date);
115 out << qt_("Library directory: ");
116 out << toqstr(makeDisplayPath(package().system_support().absFilename()));
118 out << qt_("User directory: ");
119 out << toqstr(makeDisplayPath(package().user_support().absFilename()));
124 GuiAbout::GuiAbout(GuiView & lv)
125 : GuiDialog(lv, "aboutlyx", qt_("About LyX"))
129 connect(closePB, SIGNAL(clicked()), this, SLOT(reject()));
131 copyrightTB->setPlainText(copyright());
132 copyrightTB->append(QString());
133 copyrightTB->append(license());
134 copyrightTB->append(QString());
135 copyrightTB->append(disclaimer());
137 versionLA->setText(version());
138 creditsTB->setHtml(credits());
142 Dialog * createGuiAbout(GuiView & lv) { return new GuiAbout(lv); }
145 } // namespace frontend
148 #include "moc_GuiAbout.cpp"