2006-03-05 17:24:44 +00:00
/**
2007-08-31 05:53:55 +00:00
* \ file GuiAbout . cpp
2006-03-05 17:24:44 +00:00
* This file is part of LyX , the document processor .
* Licence details can be found in the file COPYING .
*
* \ author Kalle Dalheimer
*
* Full author contact details are available in file CREDITS .
*/
# include <config.h>
2007-08-31 05:53:55 +00:00
# include "GuiAbout.h"
2007-09-05 22:54:47 +00:00
2006-03-05 17:24:44 +00:00
# include "qt_helpers.h"
2007-09-05 22:54:47 +00:00
# include "version.h"
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
# include "support/filetools.h"
# include "support/Package.h"
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
# include <QtCore>
# include <QtGui>
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
using lyx : : support : : package ;
using lyx : : support : : makeDisplayPath ;
2006-03-05 17:24:44 +00:00
2007-09-05 20:33:29 +00:00
2006-03-05 17:24:44 +00:00
namespace lyx {
namespace frontend {
2007-09-05 22:54:47 +00:00
static QString credits ( )
2006-03-05 17:24:44 +00:00
{
2007-09-05 22:54:47 +00:00
QString res ;
QFile file ( toqstr ( package ( ) . system_support ( ) . absFilename ( ) ) + " CREDITS " ) ;
QTextStream out ( & res ) ;
if ( file . isReadable ( ) ) {
2008-02-05 12:43:19 +00:00
out < < qt_ ( " ERROR: LyX wasn't able to read CREDITS file \n " ) ;
out < < qt_ ( " Please install correctly to estimate the great \n " ) ;
out < < qt_ ( " amount of work other people have done for the LyX project. " ) ;
2007-09-05 22:54:47 +00:00
} else {
file . open ( QIODevice : : ReadOnly ) ;
QTextStream ts ( & file ) ;
QString line ;
do {
line = ts . readLine ( ) ;
if ( line . startsWith ( " @b " ) )
out < < " <b> " < < line . mid ( 2 ) < < " </b> " ;
else if ( line . startsWith ( " @i " ) )
out < < " <i> " < < line . mid ( 2 ) < < " </i> " ;
else
out < < line ;
out < < " <br> " ;
} while ( ! line . isNull ( ) ) ;
}
out . flush ( ) ;
return res ;
}
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
static QString copyright ( )
{
2008-03-14 23:32:34 +00:00
return qt_ ( " LyX is Copyright (C) 1995 by Matthias Ettrich , \ n1995 - 2008 LyX Team " ) ;
2007-09-05 22:54:47 +00:00
}
2007-09-05 20:33:29 +00:00
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
static QString license ( )
{
2008-02-05 12:43:19 +00:00
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. " ) ;
2007-09-05 22:54:47 +00:00
}
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
static QString disclaimer ( )
{
2008-02-05 12:43:19 +00:00
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. \n See the GNU General Public License for more details. \n You 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. " ) ;
2007-09-05 22:54:47 +00:00
}
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
static QString version ( )
{
QString res ;
QTextStream out ( & res ) ;
2008-02-05 12:43:19 +00:00
out < < qt_ ( " LyX Version " ) ;
2007-09-05 22:54:47 +00:00
out < < lyx_version ;
out < < " ( " ;
out < < lyx_release_date ;
out < < " ) \n " ;
2008-02-05 12:43:19 +00:00
out < < qt_ ( " Library directory: " ) ;
2007-09-05 22:54:47 +00:00
out < < toqstr ( makeDisplayPath ( package ( ) . system_support ( ) . absFilename ( ) ) ) ;
out < < " \n " ;
2008-02-05 12:43:19 +00:00
out < < qt_ ( " User directory: " ) ;
2007-09-05 22:54:47 +00:00
out < < toqstr ( makeDisplayPath ( package ( ) . user_support ( ) . absFilename ( ) ) ) ;
return res ;
}
2006-03-05 17:24:44 +00:00
2007-11-23 09:44:02 +00:00
GuiAbout : : GuiAbout ( GuiView & lv )
2008-02-05 12:43:19 +00:00
: GuiDialog ( lv , " aboutlyx " , qt_ ( " About LyX " ) )
2007-09-05 22:54:47 +00:00
{
setupUi ( this ) ;
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
connect ( closePB , SIGNAL ( clicked ( ) ) , this , SLOT ( reject ( ) ) ) ;
2007-09-05 20:33:29 +00:00
2007-09-05 22:54:47 +00:00
copyrightTB - > setPlainText ( copyright ( ) ) ;
copyrightTB - > append ( QString ( ) ) ;
copyrightTB - > append ( license ( ) ) ;
copyrightTB - > append ( QString ( ) ) ;
copyrightTB - > append ( disclaimer ( ) ) ;
2007-09-05 20:33:29 +00:00
2007-09-05 22:54:47 +00:00
versionLA - > setText ( version ( ) ) ;
creditsTB - > setHtml ( credits ( ) ) ;
2006-03-05 17:24:44 +00:00
}
2007-10-06 09:55:21 +00:00
2007-11-23 09:44:02 +00:00
Dialog * createGuiAbout ( GuiView & lv ) { return new GuiAbout ( lv ) ; }
2007-10-06 09:55:21 +00:00
2006-03-05 17:24:44 +00:00
} // namespace frontend
} // namespace lyx
2007-04-24 11:32:09 +00:00
2007-08-31 05:53:55 +00:00
# include "GuiAbout_moc.cpp"