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-03 05:59:32 +00:00
# include "gettext.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 ( ) ) {
out < < toqstr ( _ ( " ERROR: LyX wasn't able to read CREDITS file \n " ) ) ;
out < < toqstr ( _ ( " Please install correctly to estimate the great \n " ) ) ;
out < < toqstr ( _ ( " amount of work other people have done for the LyX project. " ) ) ;
} 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 ( )
{
return toqstr ( _ ( " LyX is Copyright (C) 1995 by Matthias Ettrich , \ n1995 - 2006 LyX Team " )) ;
}
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 ( )
{
return toqstr ( _ ( " 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. " ) ) ;
}
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
static QString disclaimer ( )
{
return toqstr ( _ ( " 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. " ) ) ;
}
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
static QString version ( )
{
QString res ;
QTextStream out ( & res ) ;
out < < toqstr ( _ ( " LyX Version " ) ) ;
out < < lyx_version ;
out < < " ( " ;
out < < lyx_release_date ;
out < < " ) \n " ;
out < < toqstr ( _ ( " Library directory: " ) ) ;
out < < toqstr ( makeDisplayPath ( package ( ) . system_support ( ) . absFilename ( ) ) ) ;
out < < " \n " ;
out < < toqstr ( _ ( " User directory: " ) ) ;
out < < toqstr ( makeDisplayPath ( package ( ) . user_support ( ) . absFilename ( ) ) ) ;
return res ;
}
2006-03-05 17:24:44 +00:00
2007-09-08 21:16:54 +00:00
class ControlAbout : public Controller
2007-09-05 22:54:47 +00:00
{
public :
2007-09-08 21:16:54 +00:00
ControlAbout ( Dialog & parent ) : Controller ( parent ) { }
2007-09-05 22:54:47 +00:00
bool initialiseParams ( std : : string const & ) { return true ; }
void clearParams ( ) { }
void dispatchParams ( ) { }
bool isBufferDependent ( ) const { return false ; }
} ;
2006-03-05 17:24:44 +00:00
2007-09-05 22:54:47 +00:00
GuiAboutDialog : : GuiAboutDialog ( LyXView & lv )
: GuiDialog ( lv , " aboutlyx " )
{
setupUi ( this ) ;
setViewTitle ( _ ( " About LyX " ) ) ;
setController ( new ControlAbout ( * 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
}
} // namespace frontend
} // namespace lyx
2007-04-24 11:32:09 +00:00
2007-08-31 05:53:55 +00:00
# include "GuiAbout_moc.cpp"