Commit 72297473 authored by Ludovic Fauvet's avatar Ludovic Fauvet

New about dialog

The necessary files (COPYING, AUTHORS and TRANSLATORS) are stored into the binary using resources.
parent 9b441728
Many thanks to our translators!
French, Spanish:
Christophe Courtaut <kri5@vlmc.org>
Swedish:
Daniel Nylander <po@danielnylander.se>
......@@ -4,4 +4,12 @@
<file alias="fr" >ts/vlmc_fr.qm</file>
<file alias="sv" >ts/vlmc_sv.qm</file>
</qresource>
<qresource prefix="/images" >
<file>images/vlmc.png</file>
</qresource>
<qresource prefix="/text" >
<file>AUTHORS</file>
<file>COPYING</file>
<file>TRANSLATORS</file>
</qresource>
</RCC>
/*****************************************************************************
* About.cpp: About dialog
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Christophe Courtaut <christophe.courtaut@gmail.com>
*
* 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.
*****************************************************************************/
#include <QFile>
#include <QString>
#include <QCoreApplication>
#include "About.h"
About* About::m_instance = NULL;
About::About( QWidget *parent ) :
QDialog( parent )
{
m_ui.setupUi( this );
m_ui.tabWidget->setCurrentIndex( 0 );
setText( ":/text/AUTHORS", m_ui.plainTextEditAuthors );
setText( ":/text/TRANSLATORS", m_ui.plainTextEditTranslators );
setText( ":/text/COPYING", m_ui.plainTextEditLicense );
connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( deleteLater() ) );
}
void About::changeEvent( QEvent *e )
{
QDialog::changeEvent( e );
switch ( e->type() )
{
case QEvent::LanguageChange:
m_ui.retranslateUi( this );
break;
default:
break;
}
}
About* About::instance()
{
if ( m_instance )
return m_instance;
m_instance = new About();
return m_instance;
}
void About::setText( const QString& filename, QPlainTextEdit* widget )
{
QFile file( filename );
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
widget->insertPlainText( QString::fromUtf8( file.readAll() ) );
widget->moveCursor( QTextCursor::Start );
}
/*****************************************************************************
* About.h: About dialog
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Christophe Courtaut <christophe.courtaut@gmail.com>
*
* 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.
*****************************************************************************/
#ifndef ABOUT_H
#define ABOUT_H
#include <QPlainTextEdit>
#include "ui_About.h"
class About : public QDialog
{
Q_OBJECT
Q_DISABLE_COPY( About )
public:
static About* instance();
protected:
virtual void changeEvent( QEvent *e );
private:
explicit About( QWidget *parent = 0 );
void setText( const QString& filename, QPlainTextEdit* widget );
Ui::About m_ui;
static About* m_instance;
};
#endif // ABOUT_H
......@@ -26,6 +26,7 @@
#include <QDockWidget>
#include "MainWindow.h"
#include "Timeline.h"
#include "About.h"
MainWindow::MainWindow( QWidget *parent ) :
QMainWindow( parent )
......@@ -81,3 +82,8 @@ void MainWindow::on_actionPreferences_triggered()
Preferences* pref = new Preferences();
pref->show();
}
void MainWindow::on_actionAbout_triggered()
{
About::instance()->exec();
}
......@@ -50,7 +50,8 @@ private:
private slots:
void on_actionQuit_triggered();
void on_actionPreferences_triggered();
void on_actionAbout_triggered();
void on_actionPreferences_triggered();
}
;
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>About</class>
<widget class="QDialog" name="About">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>410</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>560</width>
<height>410</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../ressources.qrc">:/images/images/vlmc.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>VideoLAN Movie Creator</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>3</number>
</property>
<widget class="QWidget" name="About">
<attribute name="title">
<string>About</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
<widget class="QWidget" name="Authors">
<attribute name="title">
<string>Authors</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="plainTextEditAuthors">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="Translators">
<attribute name="title">
<string>Translators</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="plainTextEditTranslators">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="License">
<attribute name="title">
<string>License</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="plainTextEditLicense">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="plainText">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../../ressources.qrc"/>
</resources>
<connections/>
</ui>
......@@ -23,7 +23,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>26</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
......
......@@ -28,7 +28,8 @@ SOURCES += src/main.cpp \
src/gui/ListViewMediaItem.cpp \
src/gui/MediaListWidget.cpp \
src/Media.cpp \
src/OutputMedia.cpp
src/OutputMedia.cpp \
src/gui/About.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......@@ -49,12 +50,14 @@ HEADERS += src/gui/MainWindow.h \
src/Media.h \
src/Image.h \
src/gui/MediaListWidget.h \
src/OutputMedia.h
src/OutputMedia.h \
src/gui/About.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/PreviewWidget.ui \
src/gui/ui/Preferences.ui \
src/gui/ui/Timeline.ui \
src/gui/ui/LibraryWidget.ui
src/gui/ui/LibraryWidget.ui \
src/gui/ui/About.ui
FORMS +=
TRANSLATIONS = ts/vlmc_es.ts \
ts/vlmc_fr.ts \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment