About.cpp 2.38 KB
Newer Older
Ludovic Fauvet's avatar
Ludovic Fauvet committed
1 2 3
/*****************************************************************************
 * About.cpp: About dialog
 *****************************************************************************
4
 * Copyright (C) 2008-2016 VideoLAN
Ludovic Fauvet's avatar
Ludovic Fauvet committed
5 6
 *
 * Authors: Christophe Courtaut <christophe.courtaut@gmail.com>
7
 *          Rohit Yadav <rohityadav89@gmail.com>
Ludovic Fauvet's avatar
Ludovic Fauvet committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * 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.
 *
 * This program 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.  See the
 * GNU General Public License for more details.
 *
 * 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.
 *****************************************************************************/

24 25 26 27
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

28 29 30
#include "About.h"
#include "config.h"

Ludovic Fauvet's avatar
Ludovic Fauvet committed
31
#include <QApplication>
Ludovic Fauvet's avatar
Ludovic Fauvet committed
32
#include <QFile>
Ludovic Fauvet's avatar
Ludovic Fauvet committed
33
#include <QPlainTextEdit>
34
#include <QString>
35
#include <QtGlobal>
Ludovic Fauvet's avatar
Ludovic Fauvet committed
36

37
About::About( QWidget *parent ) : QDialog( parent )
Ludovic Fauvet's avatar
Ludovic Fauvet committed
38 39 40
{
    m_ui.setupUi( this );
    m_ui.tabWidget->setCurrentIndex( 0 );
41

Ludovic Fauvet's avatar
Ludovic Fauvet committed
42
    setText( ":/text/AUTHORS", m_ui.plainTextEditAuthors );
43
    setText( ":/text/THANKS", m_ui.plainTextEditThanks );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
44 45
    setText( ":/text/TRANSLATORS", m_ui.plainTextEditTranslators );
    setText( ":/text/COPYING", m_ui.plainTextEditLicense );
46

47
    m_ui.labelTitle->setText(
48
        m_ui.labelTitle->text().arg( PACKAGE_VERSION, CODENAME ) );
49 50

    m_ui.labelBuild->setText(
51
        m_ui.labelBuild->text().arg( VLMC_COMPILE_HOST, VLMC_COMPILE_SYSTEM,
52
                                     QT_VERSION_STR, qVersion() ) );
53

54
    m_ui.labelCopyright->setText(
55 56
        m_ui.labelCopyright->text().arg( COPYRIGHT_MESSAGE, PROJECT_CONTACT,
                                         PROJECT_WEBSITE ) );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
57 58
}

59 60
void
About::setText( const QString& filename, QPlainTextEdit* widget )
Ludovic Fauvet's avatar
Ludovic Fauvet committed
61 62
{
    QFile file( filename );
63

Ludovic Fauvet's avatar
Ludovic Fauvet committed
64 65
    if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
        widget->insertPlainText( QString::fromUtf8( file.readAll() ) );
66

Ludovic Fauvet's avatar
Ludovic Fauvet committed
67 68
    widget->moveCursor( QTextCursor::Start );
}