Implement Credits window in the About dialog to show project contributors.

The actual credits file is to be fully populated yet.
This commit is contained in:
Konstantin Isakov 2010-11-14 19:28:50 +03:00
parent 953d9237a3
commit 921c42088d
7 changed files with 106 additions and 21 deletions

2
CREDITS.txt Normal file
View file

@ -0,0 +1,2 @@
Konstantin Isakov <ikm\users.berlios.de>: Principal author of the program
Jennie Petoumenou <epetoumenou\gmail.com>: Greek transliteration and Greek translation

56
about.cc Normal file
View file

@ -0,0 +1,56 @@
/* This file is (c) 2008-2011 Konstantin Isakov <ikm@users.berlios.de>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "about.hh"
#include <QtGui>
About::About( QWidget * parent ): QDialog( parent )
{
ui.setupUi( this );
QFile versionFile( ":/version.txt" );
QString version;
if ( !versionFile.open( QFile::ReadOnly ) )
version = tr( "[Unknown]" );
else
version = QString::fromAscii( versionFile.readAll() ).trimmed();
ui.version->setText( version );
QFile creditsFile( ":/CREDITS.txt" );
if ( creditsFile.open( QFile::ReadOnly ) )
{
QStringList creditsList =
QString::fromUtf8(
creditsFile.readAll() ).split( '\n', QString::SkipEmptyParts );
QString html = "<html><body style='color: black; background: #f4f4f4;'>";
for( int x = 0; x < creditsList.size(); ++x )
{
QString str = creditsList[ x ];
str.replace( "\\", "@" );
str = Qt::escape( str );
int colon = str.indexOf( ":" );
if ( colon != -1 )
{
str.replace( colon, 1, "</font><br>&nbsp;&nbsp;&nbsp;&nbsp;" );
str.prepend( "<font color='blue'>" );
}
html += str;
html += "<br>";
}
html += "</body></html>";
ui.credits->setHtml( html );
}
}

22
about.hh Normal file
View file

@ -0,0 +1,22 @@
/* This file is (c) 2008-2011 Konstantin Isakov <ikm@users.berlios.de>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef ABOUT_HH
#define ABOUT_HH
#include <QDialog>
#include "ui_about.h"
class About: public QDialog
{
Q_OBJECT
public:
About( QWidget * parent = 0 );
private:
Ui::About ui;
};
#endif // ABOUT_HH

View file

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>123</height>
<height>235</height>
</rect>
</property>
<property name="windowTitle">
@ -58,7 +58,7 @@
<string/>
</property>
<property name="text">
<string>#.#</string>
<string notr="true">#.#</string>
</property>
</widget>
</item>
@ -88,6 +88,16 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Credits:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -101,6 +111,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QTextBrowser" name="credits">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">

View file

@ -155,7 +155,8 @@ HEADERS += folding.hh \
greektranslit.hh \
webmultimediadownload.hh \
forvo.hh \
country.hh
country.hh \
about.hh
FORMS += groups.ui \
dictgroupwidget.ui \
mainwindow.ui \
@ -236,7 +237,8 @@ SOURCES += folding.cc \
greektranslit.cc \
webmultimediadownload.cc \
forvo.cc \
country.cc
country.cc \
about.cc
win32 {
SOURCES += mouseover_win32/ThTypes.c
HEADERS += mouseover_win32/ThTypes.h

View file

@ -5,7 +5,7 @@
#include "editdictionaries.hh"
#include "loaddictionaries.hh"
#include "preferences.hh"
#include "ui_about.h"
#include "about.hh"
#include <limits.h>
#include <QDir>
#include <QMessageBox>
@ -1727,22 +1727,7 @@ void MainWindow::visitForum()
void MainWindow::showAbout()
{
QDialog about( this );
Ui::About ui;
ui.setupUi( &about );
QFile versionFile( ":/version.txt" );
QString version;
if ( !versionFile.open( QFile::ReadOnly ) )
version = tr( "[Unknown]" );
else
version = QString::fromAscii( versionFile.readAll() ).trimmed();
ui.version->setText( version );
About about( this );
about.show();
about.exec();

View file

@ -42,5 +42,6 @@
<file>icons/icon_dsl_native.png</file>
<file>icons/forvo.png</file>
<file>icons/windows-list.png</file>
<file>CREDITS.txt</file>
</qresource>
</RCC>