2011-02-18 20:14:45 +01:00
///////////////////////////////////////////////////////////////////////////////
2010-11-11 19:37:16 +01:00
// LameXP - Audio Encoder Front-End
2011-01-01 17:04:25 +01:00
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
2010-11-11 19:37:16 +01:00
//
// 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.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
# include "Dialog_About.h"
# include "Global.h"
# include "Resource.h"
2010-11-29 20:36:27 +01:00
# include "Model_Settings.h"
2010-11-11 19:37:16 +01:00
# include <QDate>
# include <QApplication>
# include <QIcon>
# include <QPushButton>
2010-11-12 15:58:53 +01:00
# include <QDesktopServices>
# include <QUrl>
2010-11-12 19:02:01 +01:00
# include <QTimer>
2010-12-18 16:49:04 +01:00
# include <QFileInfo>
# include <QDir>
2011-04-24 23:18:39 +02:00
# include <QDesktopWidget>
# include <QLabel>
2010-11-11 19:37:16 +01:00
2011-04-11 21:55:34 +02:00
# include <MMSystem.h>
2010-11-11 19:37:16 +01:00
//Helper macros
2010-12-22 23:45:36 +01:00
# define LINK(URL) QString("<a href=\"%1\">%2< / a>").arg(URL).arg(URL)
2010-11-11 19:37:16 +01:00
2010-11-11 22:58:02 +01:00
//Constants
const char * AboutDialog : : neroAacUrl = " http://www.nero.com/eng/technologies-aac-codec.html " ;
2011-04-24 23:18:39 +02:00
const char * AboutDialog : : disqueUrl = " http://www.youtube.com/watch?v=MEDB4xJsXVo " ; /*http://www.youtube.com/watch?v=LjOM5YjMZ8w*/
2010-11-11 22:58:02 +01:00
2011-01-20 22:54:10 +01:00
//Contributors
static const struct
2011-01-07 23:00:32 +01:00
{
char * pcFlag ;
2011-02-18 20:14:45 +01:00
wchar_t * pcLanguage ;
wchar_t * pcName ;
2011-01-07 23:00:32 +01:00
char * pcMail ;
2011-01-20 22:54:10 +01:00
}
g_lamexp_contributors [ ] =
2011-01-07 23:00:32 +01:00
{
2011-02-21 17:59:26 +01:00
{ " en " , L " Englisch " , L " LoRd_MuldeR " , " MuldeR2@GMX.de " } ,
{ " de " , L " Deutsch " , L " LoRd_MuldeR " , " MuldeR2@GMX.de " } ,
2011-03-09 00:20:36 +01:00
{ " " , L " " , L " Bodo Thevissen " , " Bodo@thevissen.de " } ,
2011-04-08 01:17:47 +02:00
{ " es " , L " Español " , L " Rub3nCT " , " Rub3nCT@gmail.com " } ,
2011-02-21 17:59:26 +01:00
{ " fr " , L " Française " , L " Dodich Informatique " , " Dodich@live.fr " } ,
{ " it " , L " Italiano " , L " Roberto " , " Gulliver_69@libero.it " } ,
2011-04-08 22:01:15 +02:00
{ " kr " , L " 한국어 " , L " JaeHyung Lee " , " Kolanp@gmail.com " } ,
2011-02-21 17:59:26 +01:00
{ " ru " , L " Русский " , L " Neonailol " , " Neonailol@gmail.com " } ,
2011-02-25 13:40:45 +01:00
{ " uk " , L " Українська " , L " Arestarh " , " Arestarh@ukr.net " } ,
2011-01-07 23:00:32 +01:00
{ NULL , NULL , NULL , NULL }
} ;
2010-11-11 22:58:02 +01:00
////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////
2010-11-29 20:36:27 +01:00
AboutDialog : : AboutDialog ( SettingsModel * settings , QWidget * parent , bool firstStart )
:
QMessageBox ( parent ) ,
2011-04-24 23:34:52 +02:00
m_settings ( settings ) ,
m_disque ( NULL ) ,
2011-04-25 21:13:52 +02:00
m_disqueTimer ( NULL ) ,
m_rotateNext ( false ) ,
m_disqueDelay ( _I64_MAX )
2010-11-11 19:37:16 +01:00
{
2011-05-04 01:15:05 +02:00
QString versionStr = QString ( ) . sprintf
2011-04-07 22:40:47 +02:00
(
" Version %d.%02d %s, Build %d [%s], %s, Qt v%s " ,
lamexp_version_major ( ) ,
lamexp_version_minor ( ) ,
lamexp_version_release ( ) ,
lamexp_version_build ( ) ,
lamexp_version_date ( ) . toString ( Qt : : ISODate ) . toLatin1 ( ) . constData ( ) ,
lamexp_version_compiler ( ) ,
qVersion ( )
) ;
2011-03-28 04:26:47 +02:00
2011-04-25 21:13:52 +02:00
for ( int i = 0 ; i < 4 ; i + + )
{
m_cartoon [ i ] = NULL ;
}
2010-11-11 19:37:16 +01:00
QString aboutText ;
2011-01-27 15:46:21 +01:00
aboutText + = QString ( " <h2>%1</h2> " ) . arg ( tr ( " LameXP − Audio Encoder Front-end " ) ) ;
2011-05-04 01:15:05 +02:00
aboutText + = QString ( " <nobr><b>Copyright (C) 2004-%1 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.</b></nobr><br> " ) . arg ( max ( lamexp_version_date ( ) . year ( ) , QDate : : currentDate ( ) . year ( ) ) ) . replace ( " - " , " − " ) ;
aboutText + = QString ( " <nobr><b>%1</b></nobr><br><br> " ) . arg ( versionStr ) . replace ( " - " , " − " ) ;
2011-02-28 01:28:27 +01:00
aboutText + = QString ( " <nobr>%1</nobr><br> " ) . arg ( tr ( " Please visit %1 for news and updates! " ) . arg ( LINK ( lamexp_website_url ( ) ) ) ) ;
2011-04-08 04:24:05 +02:00
2011-04-11 21:55:34 +02:00
if ( LAMEXP_DEBUG )
{
int daysLeft = max ( QDate : : currentDate ( ) . daysTo ( lamexp_version_expires ( ) ) , 0 ) ;
aboutText + = QString ( " <hr><nobr><font color= \" crimson \" >!!! %3 DEBUG BUILD %3 Expires at: %1 %3 Days left: %2 %3 DEBUG BUILD %3 !!!</font></nobr> " ) . arg ( lamexp_version_expires ( ) . toString ( Qt : : ISODate ) , QString : : number ( daysLeft ) , " −−− " ) ;
}
else if ( lamexp_version_demo ( ) )
2011-04-08 04:24:05 +02:00
{
2011-04-08 22:01:15 +02:00
int daysLeft = max ( QDate : : currentDate ( ) . daysTo ( lamexp_version_expires ( ) ) , 0 ) ;
2011-05-04 01:15:05 +02:00
aboutText + = QString ( " <hr><nobr><font color= \" crimson \" >%1</font></nobr> " ) . arg ( tr ( " Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left. " ) . arg ( lamexp_version_expires ( ) . toString ( Qt : : ISODate ) , QString : : number ( daysLeft ) ) ) . replace ( " - " , " − " ) ;
2011-04-08 04:24:05 +02:00
}
2010-11-11 19:37:16 +01:00
aboutText + = " <hr><br> " ;
aboutText + = " <nobr><tt>This program is free software; you can redistribute it and/or<br> " ;
aboutText + = " modify it under the terms of the GNU General Public License<br> " ;
aboutText + = " as published by the Free Software Foundation; either version 2<br> " ;
aboutText + = " of the License, or (at your option) any later version.<br><br> " ;
aboutText + = " This program is distributed in the hope that it will be useful,<br> " ;
aboutText + = " but WITHOUT ANY WARRANTY; without even the implied warranty of<br> " ;
aboutText + = " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br> " ;
aboutText + = " GNU General Public License for more details.<br><br> " ;
aboutText + = " You should have received a copy of the GNU General Public License<br> " ;
aboutText + = " along with this program; if not, write to the Free Software<br> " ;
aboutText + = " Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</tt></nobr><br> " ;
2010-12-27 20:56:29 +01:00
aboutText + = " <hr><table><tr> " ;
aboutText + = " <td valign= \" middle \" ><img src= \" :/icons/error_big.png \" </td><td> </td> " ;
2011-01-01 19:28:19 +01:00
aboutText + = QString ( " <td><font color= \" darkred \" >%1</font></td> " ) . arg ( tr ( " Note: LameXP is free software. Do <b>not</b> pay money to obtain or use LameXP! If some third-party website tries to make you pay for downloading LameXP, you should <b>not</b> respond to the offer !!! " ) ) ;
2010-12-27 20:56:29 +01:00
aboutText + = " </tr></table><hr><br> " ;
2011-01-01 19:28:19 +01:00
aboutText + = QString ( " %1<br> " ) . arg ( tr ( " Special thanks go out to \" John33 \" from %1 for his continuous support. " ) . arg ( LINK ( " http://www.rarewares.org/ " ) ) ) ;
2011-04-08 04:24:05 +02:00
2010-11-11 19:37:16 +01:00
setText ( aboutText ) ;
setIconPixmap ( dynamic_cast < QApplication * > ( QApplication : : instance ( ) ) - > windowIcon ( ) . pixmap ( QSize ( 64 , 64 ) ) ) ;
2011-01-01 19:28:19 +01:00
setWindowTitle ( tr ( " About LameXP " ) ) ;
2011-03-31 03:04:10 +02:00
2010-11-12 15:58:53 +01:00
if ( firstStart )
{
2011-01-01 19:28:19 +01:00
QPushButton * firstButton = addButton ( tr ( " Show License Text " ) , QMessageBox : : AcceptRole ) ;
2010-12-18 16:49:04 +01:00
firstButton - > setIcon ( QIcon ( " :/icons/script.png " ) ) ;
2011-02-10 16:08:03 +01:00
firstButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
2010-11-12 15:58:53 +01:00
firstButton - > setMinimumWidth ( 135 ) ;
2010-11-12 19:02:01 +01:00
firstButton - > disconnect ( ) ;
connect ( firstButton , SIGNAL ( clicked ( ) ) , this , SLOT ( openLicenseText ( ) ) ) ;
2010-11-12 15:58:53 +01:00
2011-01-01 19:28:19 +01:00
QPushButton * secondButton = addButton ( tr ( " Accept License " ) , QMessageBox : : AcceptRole ) ;
2010-11-12 15:58:53 +01:00
secondButton - > setIcon ( QIcon ( " :/icons/accept.png " ) ) ;
2011-02-10 16:08:03 +01:00
secondButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
2010-11-12 15:58:53 +01:00
secondButton - > setMinimumWidth ( 120 ) ;
2011-01-01 19:28:19 +01:00
QPushButton * thirdButton = addButton ( tr ( " Decline License " ) , QMessageBox : : AcceptRole ) ;
2010-11-12 15:58:53 +01:00
thirdButton - > setIcon ( QIcon ( " :/icons/delete.png " ) ) ;
2011-02-10 16:08:03 +01:00
thirdButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
2010-11-12 15:58:53 +01:00
thirdButton - > setMinimumWidth ( 120 ) ;
2010-11-12 19:02:01 +01:00
thirdButton - > setEnabled ( false ) ;
2010-11-12 15:58:53 +01:00
}
else
{
2011-01-01 19:28:19 +01:00
QPushButton * firstButton = addButton ( tr ( " 3rd Party S/W " ) , QMessageBox : : AcceptRole ) ;
2010-12-03 20:26:34 +01:00
firstButton - > setIcon ( QIcon ( " :/icons/page_white_cplusplus.png " ) ) ;
2011-02-10 16:08:03 +01:00
firstButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
2010-11-12 15:58:53 +01:00
firstButton - > setMinimumWidth ( 120 ) ;
2010-11-12 19:02:01 +01:00
firstButton - > disconnect ( ) ;
connect ( firstButton , SIGNAL ( clicked ( ) ) , this , SLOT ( showMoreAbout ( ) ) ) ;
2010-11-11 19:37:16 +01:00
2011-01-01 19:28:19 +01:00
QPushButton * secondButton = addButton ( tr ( " Contributors " ) , QMessageBox : : AcceptRole ) ;
2010-12-03 20:26:34 +01:00
secondButton - > setIcon ( QIcon ( " :icons/user_suit.png " ) ) ;
2011-02-10 16:08:03 +01:00
secondButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
2010-11-12 15:58:53 +01:00
secondButton - > setMinimumWidth ( 120 ) ;
2010-11-12 19:02:01 +01:00
secondButton - > disconnect ( ) ;
2010-12-03 20:26:34 +01:00
connect ( secondButton , SIGNAL ( clicked ( ) ) , this , SLOT ( showAboutContributors ( ) ) ) ;
2010-11-11 19:37:16 +01:00
2011-01-01 19:28:19 +01:00
QPushButton * thirdButton = addButton ( tr ( " About Qt4 " ) , QMessageBox : : AcceptRole ) ;
2010-12-03 20:26:34 +01:00
thirdButton - > setIcon ( QIcon ( " :/images/Qt.svg " ) ) ;
2011-02-10 16:08:03 +01:00
thirdButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
2010-12-03 20:26:34 +01:00
thirdButton - > setMinimumWidth ( 120 ) ;
thirdButton - > disconnect ( ) ;
connect ( thirdButton , SIGNAL ( clicked ( ) ) , this , SLOT ( showAboutQt ( ) ) ) ;
2011-01-01 19:28:19 +01:00
QPushButton * fourthButton = addButton ( tr ( " Discard " ) , QMessageBox : : AcceptRole ) ;
2010-12-03 20:26:34 +01:00
fourthButton - > setIcon ( QIcon ( " :/icons/cross.png " ) ) ;
2011-02-10 16:08:03 +01:00
fourthButton - > setIconSize ( QSize ( 16 , 16 ) ) ;
2010-12-03 20:26:34 +01:00
fourthButton - > setMinimumWidth ( 90 ) ;
2010-11-12 15:58:53 +01:00
2011-04-24 23:18:39 +02:00
QPixmap disque ( " :/images/Disque.png " ) ;
2011-05-01 00:42:34 +02:00
QRect screenGeometry = QApplication : : desktop ( ) - > availableGeometry ( ) ;
2011-04-24 23:18:39 +02:00
m_disque = new QLabel ( this , Qt : : Window | Qt : : FramelessWindowHint | Qt : : WindowStaysOnTopHint ) ;
m_disque - > installEventFilter ( this ) ;
m_disque - > setStyleSheet ( " background:transparent; " ) ;
m_disque - > setAttribute ( Qt : : WA_TranslucentBackground ) ;
2011-05-01 00:42:34 +02:00
m_disque - > setGeometry ( qrand ( ) % ( screenGeometry . width ( ) - disque . width ( ) ) , qrand ( ) % ( screenGeometry . height ( ) - disque . height ( ) ) , disque . width ( ) , disque . height ( ) ) ;
2011-04-24 23:18:39 +02:00
m_disque - > setPixmap ( disque ) ;
m_disque - > setWindowOpacity ( 0.01 ) ;
m_disque - > show ( ) ;
2011-04-25 21:13:52 +02:00
m_disqueFlags [ 0 ] = ( qrand ( ) > ( RAND_MAX / 2 ) ) ;
m_disqueFlags [ 1 ] = ( qrand ( ) > ( RAND_MAX / 2 ) ) ;
2011-04-24 23:18:39 +02:00
m_disqueTimer = new QTimer ;
connect ( m_disqueTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( moveDisque ( ) ) ) ;
m_disqueTimer - > setInterval ( 10 ) ;
m_disqueTimer - > start ( ) ;
}
2010-11-12 15:58:53 +01:00
m_firstShow = firstStart ;
2010-11-11 19:37:16 +01:00
}
AboutDialog : : ~ AboutDialog ( void )
{
2011-04-24 23:18:39 +02:00
if ( m_disque )
{
m_disque - > close ( ) ;
LAMEXP_DELETE ( m_disque ) ;
}
if ( m_disqueTimer )
{
m_disqueTimer - > stop ( ) ;
LAMEXP_DELETE ( m_disqueTimer ) ;
}
2011-04-25 21:13:52 +02:00
for ( int i = 0 ; i < 4 ; i + + )
{
LAMEXP_DELETE ( m_cartoon [ i ] ) ;
}
2011-04-24 23:18:39 +02:00
2010-11-11 19:37:16 +01:00
}
2010-11-11 22:58:02 +01:00
////////////////////////////////////////////////////////////
// Public Functions
////////////////////////////////////////////////////////////
2010-11-11 19:37:16 +01:00
int AboutDialog : : exec ( )
{
2010-11-29 20:36:27 +01:00
if ( m_settings - > soundsEnabled ( ) )
{
2011-01-29 21:57:53 +01:00
if ( m_firstShow )
{
if ( ! playResoureSound ( " imageres.dll " , 5080 , true ) )
{
PlaySound ( TEXT ( " SystemStart " ) , NULL , SND_ALIAS | SND_ASYNC ) ;
}
}
else
2010-12-18 16:49:04 +01:00
{
PlaySound ( MAKEINTRESOURCE ( IDR_WAVE_ABOUT ) , GetModuleHandle ( NULL ) , SND_RESOURCE | SND_ASYNC ) ;
}
2010-11-29 20:36:27 +01:00
}
2010-11-11 19:37:16 +01:00
2010-11-12 19:02:01 +01:00
switch ( QMessageBox : : exec ( ) )
2010-11-12 15:58:53 +01:00
{
2010-11-12 19:02:01 +01:00
case 1 :
return 1 ;
break ;
case 2 :
return - 1 ;
break ;
default :
return 0 ;
break ;
2010-11-12 15:58:53 +01:00
}
2010-11-12 19:02:01 +01:00
}
////////////////////////////////////////////////////////////
// Slots
////////////////////////////////////////////////////////////
void AboutDialog : : enableButtons ( void )
{
const QList < QAbstractButton * > buttonList = buttons ( ) ;
for ( int i = 0 ; i < buttonList . count ( ) ; i + + )
2010-11-11 19:37:16 +01:00
{
2010-11-12 19:02:01 +01:00
buttonList . at ( i ) - > setEnabled ( true ) ;
2010-11-11 19:37:16 +01:00
}
2010-11-12 19:02:01 +01:00
setCursor ( QCursor ( Qt : : ArrowCursor ) ) ;
2010-11-11 19:37:16 +01:00
}
2010-11-12 19:02:01 +01:00
void AboutDialog : : openLicenseText ( void )
{
QDesktopServices : : openUrl ( QUrl ( " http://www.gnu.org/licenses/gpl-2.0.txt " ) ) ;
}
void AboutDialog : : showAboutQt ( void )
{
QMessageBox : : aboutQt ( this ) ;
}
2010-11-11 22:58:02 +01:00
2010-12-03 20:26:34 +01:00
void AboutDialog : : showAboutContributors ( void )
{
QString contributorsAboutText ;
2011-01-07 23:00:32 +01:00
2011-01-02 01:09:05 +01:00
contributorsAboutText + = QString ( " <h3><nobr>%1</nobr></h3> " ) . arg ( tr ( " The following people have contributed to LameXP: " ) ) ;
2011-01-01 19:28:19 +01:00
contributorsAboutText + = QString ( " <b>%1</b> " ) . arg ( tr ( " Translators: " ) ) ;
2010-12-03 23:01:17 +01:00
contributorsAboutText + = " <table style= \" margin-top:5px \" > " ;
2011-01-07 23:00:32 +01:00
for ( int i = 0 ; g_lamexp_contributors [ i ] . pcName ; i + + )
{
2011-03-09 00:20:36 +01:00
QString flagIcon = ( strlen ( g_lamexp_contributors [ i ] . pcFlag ) > 0 ) ? QString ( " <img src= \" :/flags/%1.png \" > " ) . arg ( g_lamexp_contributors [ i ] . pcFlag ) : QString ( ) ;
contributorsAboutText + = QString ( " <tr><td valign= \" middle \" >%1</td><td> </td> " ) . arg ( flagIcon ) ;
2011-02-18 20:14:45 +01:00
contributorsAboutText + = QString ( " <td valign= \" middle \" >%2</td><td> </td> " ) . arg ( WCHAR2QSTR ( g_lamexp_contributors [ i ] . pcLanguage ) ) ;
contributorsAboutText + = QString ( " <td valign= \" middle \" >%3</td><td> </td><td><%4></td></tr> " ) . arg ( WCHAR2QSTR ( g_lamexp_contributors [ i ] . pcName ) , g_lamexp_contributors [ i ] . pcMail ) ;
2011-01-07 23:00:32 +01:00
}
2010-12-05 23:11:03 +01:00
contributorsAboutText + = " </table> " ;
contributorsAboutText + = " <br><br> " ;
2011-01-02 01:09:05 +01:00
contributorsAboutText + = QString ( " <nobr><i>%1</i></nobr><br> " ) . arg ( tr ( " If you are willing to contribute a LameXP translation, feel free to contact us! " ) ) ;
2010-12-03 20:26:34 +01:00
QMessageBox * contributorsAboutBox = new QMessageBox ( this ) ;
contributorsAboutBox - > setText ( contributorsAboutText ) ;
contributorsAboutBox - > setIconPixmap ( dynamic_cast < QApplication * > ( QApplication : : instance ( ) ) - > windowIcon ( ) . pixmap ( QSize ( 64 , 64 ) ) ) ;
2011-01-01 19:28:19 +01:00
QPushButton * closeButton = contributorsAboutBox - > addButton ( tr ( " Discard " ) , QMessageBox : : AcceptRole ) ;
2010-12-03 20:26:34 +01:00
closeButton - > setIcon ( QIcon ( " :/icons/cross.png " ) ) ;
closeButton - > setMinimumWidth ( 90 ) ;
2011-01-01 19:28:19 +01:00
contributorsAboutBox - > setWindowTitle ( tr ( " About Contributors " ) ) ;
2010-12-05 23:11:03 +01:00
contributorsAboutBox - > setIconPixmap ( QIcon ( " :/images/Logo_Contributors.png " ) . pixmap ( QSize ( 64 , 74 ) ) ) ;
2010-12-03 20:26:34 +01:00
contributorsAboutBox - > setWindowIcon ( QIcon ( " :/icons/user_suit.png " ) ) ;
contributorsAboutBox - > exec ( ) ;
2011-05-01 22:02:38 +02:00
2010-12-03 20:26:34 +01:00
LAMEXP_DELETE ( contributorsAboutBox ) ;
}
2010-11-12 19:02:01 +01:00
void AboutDialog : : showMoreAbout ( void )
2010-11-11 19:37:16 +01:00
{
QString moreAboutText ;
2011-01-07 23:00:32 +01:00
2011-01-01 19:28:19 +01:00
moreAboutText + = QString ( " <h3>%1</h3> " ) . arg ( tr ( " The following third-party software is used in LameXP: " ) ) ;
2011-01-27 15:46:21 +01:00
moreAboutText + = " <div style= \" margin-left:-25px;font-size:8pt;white-space:nowrap \" ><table><tr><td><ul> " ;
2010-12-15 22:39:18 +01:00
2011-01-07 23:00:32 +01:00
moreAboutText + = makeToolText
(
2011-01-27 15:46:21 +01:00
tr ( " LAME − OpenSource mp3 Encoder " ) ,
2011-04-16 21:21:08 +02:00
" lame.exe " , " v?.??, Beta-? " ,
2011-01-13 08:57:34 +01:00
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
2011-01-07 23:00:32 +01:00
" http://lame.sourceforge.net/ "
) ;
moreAboutText + = makeToolText
(
2011-01-27 15:46:21 +01:00
tr ( " OggEnc − Ogg Vorbis Encoder " ) ,
2011-04-21 00:50:21 +02:00
" oggenc2.exe " , " v?.??, aoTuV Beta-?.?? " ,
2011-01-07 23:00:32 +01:00
tr ( " Completely open and patent-free audio encoding technology. " ) ,
" http://www.vorbis.com/ "
) ;
moreAboutText + = makeToolText
(
2011-01-27 15:46:21 +01:00
tr ( " Nero AAC Reference MPEG-4 Encoder " ) ,
2011-01-07 23:00:32 +01:00
" neroAacEnc.exe " , " v?.?.?.? " ,
tr ( " Freeware state-of-the-art HE-AAC encoder with 2-Pass support. " ) ,
neroAacUrl ,
tr ( " Available from vendor web-site as free download: " )
) ;
moreAboutText + = makeToolText
(
2011-01-27 15:46:21 +01:00
tr ( " FLAC − Free Lossless Audio Codec " ) ,
2011-01-07 23:00:32 +01:00
" flac.exe " , " v?.?.? " ,
tr ( " Open and patent-free lossless audio compression technology. " ) ,
" http://flac.sourceforge.net/ "
) ;
moreAboutText + = makeToolText
2011-01-25 23:14:42 +01:00
(
2011-01-27 15:46:21 +01:00
tr ( " mpg123 − Fast Console MPEG Audio Player/Decoder " ) ,
2011-01-25 23:14:42 +01:00
" mpg123.exe " , " v?.??.? " ,
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
" http://www.mpg123.de/ "
) ;
moreAboutText + = makeToolText
2011-01-26 20:16:46 +01:00
(
2011-01-27 15:46:21 +01:00
tr ( " FAAD − OpenSource MPEG-4 and MPEG-2 AAC Decoder " ) ,
2011-01-26 20:16:46 +01:00
" faad.exe " , " v?.? " ,
tr ( " Released under the terms of the GNU General Public License. " ) ,
" http://www.audiocoding.com/ "
) ;
moreAboutText + = makeToolText
2011-01-07 23:00:32 +01:00
(
2011-01-27 15:46:21 +01:00
tr ( " AC3Filter Tools − AC3/DTS Decoder " ) ,
2011-01-07 23:00:32 +01:00
" valdec.exe " , " v?.?? " ,
2011-01-13 08:57:34 +01:00
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
2011-01-07 23:00:32 +01:00
" http://www.ac3filter.net/projects/tools "
) ;
moreAboutText + = makeToolText
2011-01-17 20:52:54 +01:00
(
2011-01-27 15:46:21 +01:00
tr ( " WavPack − Hybrid Lossless Compression " ) ,
2011-01-17 20:52:54 +01:00
" wvunpack.exe " , " v?.??.? " ,
tr ( " Completely open audio compression format. " ) ,
" http://www.wavpack.com/ "
) ;
2011-01-29 22:50:37 +01:00
moreAboutText + = makeToolText
(
tr ( " Musepack − Living Audio Compression " ) ,
" mpcdec.exe " , " r??? " ,
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
" http://www.musepack.net/ "
) ;
2011-02-01 22:15:57 +01:00
moreAboutText + = QString
(
" </ul></td><td><ul> "
) ;
2011-01-17 20:52:54 +01:00
moreAboutText + = makeToolText
2011-01-16 22:00:49 +01:00
(
2011-01-27 15:46:21 +01:00
tr ( " Monkey's Audio − Lossless Audio Compressor " ) ,
2011-01-16 22:00:49 +01:00
" mac.exe " , " v?.?? " ,
tr ( " Freely available source code, simple SDK and non-restrictive licensing. " ) ,
" http://www.monkeysaudio.com/ "
) ;
moreAboutText + = makeToolText
2011-01-30 01:45:34 +01:00
(
tr ( " Shorten − Lossless Audio Compressor " ) ,
" shorten.exe " , " v?.?.? " ,
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
" http://etree.org/shnutils/shorten/ "
) ;
moreAboutText + = makeToolText
2011-02-01 22:15:57 +01:00
(
tr ( " Speex − Free Codec For Free Speech " ) ,
" speexdec.exe " , " v?.? " ,
tr ( " Open Source patent-free audio format designed for speech. " ) ,
" http://www.speex.org/ "
) ;
moreAboutText + = makeToolText
2011-01-18 22:07:30 +01:00
(
2011-01-27 15:46:21 +01:00
tr ( " The True Audio − Lossless Audio Codec " ) ,
2011-03-19 20:44:00 +01:00
" tta.exe " , " v?.? " ,
2011-01-18 22:07:30 +01:00
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
" http://tta.sourceforge.net/ "
) ;
moreAboutText + = makeToolText
2011-01-07 23:00:32 +01:00
(
2011-01-27 15:46:21 +01:00
tr ( " MediaInfo − Media File Analysis Tool " ) ,
2011-04-21 00:50:21 +02:00
" mediainfo.exe " , " v?.?.?? " ,
2011-01-13 08:57:34 +01:00
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
2011-01-07 23:00:32 +01:00
" http://mediainfo.sourceforge.net/ "
) ;
moreAboutText + = makeToolText
(
2011-01-27 15:46:21 +01:00
tr ( " SoX − Sound eXchange " ) ,
2011-01-07 23:00:32 +01:00
" sox.exe " , " v??.?.? " ,
2011-01-13 08:57:34 +01:00
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
2011-01-07 23:00:32 +01:00
" http://sox.sourceforge.net/ "
) ;
moreAboutText + = makeToolText
(
2011-01-27 15:46:21 +01:00
tr ( " GnuPG − The GNU Privacy Guard " ) ,
2011-01-07 23:00:32 +01:00
" gpgv.exe " , " v?.?.?? " ,
2011-01-13 08:57:34 +01:00
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
2011-01-07 23:00:32 +01:00
" http://www.gnupg.org/ "
) ;
2011-02-01 22:15:57 +01:00
moreAboutText + = makeToolText
(
tr ( " GNU Wget − Software for retrieving files using HTTP " ) ,
" wget.exe " , " v?.??.? " ,
tr ( " Released under the terms of the GNU Lesser General Public License. " ) ,
" http://www.gnu.org/software/wget/ "
) ;
2011-01-07 23:00:32 +01:00
moreAboutText + = makeToolText
(
2011-01-27 15:46:21 +01:00
tr ( " Silk Icons − Over 700 icons in PNG format " ) ,
2011-01-07 23:00:32 +01:00
QString ( ) , " v1.3 " ,
tr ( " By Mark James, released under the Creative Commons 'by' License. " ) ,
" http://www.famfamfam.com/lab/icons/silk/ "
) ;
2011-01-26 20:16:46 +01:00
moreAboutText + = QString ( " </ul></td><td> </td></tr></table></div><i>%1</i><br> " ) . arg
(
tr ( " LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors. " )
) ;
2010-11-11 19:37:16 +01:00
2010-11-12 19:02:01 +01:00
QMessageBox * moreAboutBox = new QMessageBox ( this ) ;
2010-11-11 19:37:16 +01:00
moreAboutBox - > setText ( moreAboutText ) ;
moreAboutBox - > setIconPixmap ( dynamic_cast < QApplication * > ( QApplication : : instance ( ) ) - > windowIcon ( ) . pixmap ( QSize ( 64 , 64 ) ) ) ;
2011-01-01 19:28:19 +01:00
QPushButton * closeButton = moreAboutBox - > addButton ( tr ( " Discard " ) , QMessageBox : : AcceptRole ) ;
2010-11-11 19:37:16 +01:00
closeButton - > setIcon ( QIcon ( " :/icons/cross.png " ) ) ;
closeButton - > setMinimumWidth ( 90 ) ;
2011-01-01 19:28:19 +01:00
moreAboutBox - > setWindowTitle ( tr ( " About Third-party Software " ) ) ;
2010-12-05 23:11:03 +01:00
moreAboutBox - > setIconPixmap ( QIcon ( " :/images/Logo_Software.png " ) . pixmap ( QSize ( 64 , 71 ) ) ) ;
2010-12-03 20:26:34 +01:00
moreAboutBox - > setWindowIcon ( QIcon ( " :/icons/page_white_cplusplus.png " ) ) ;
2010-11-11 19:37:16 +01:00
moreAboutBox - > exec ( ) ;
LAMEXP_DELETE ( moreAboutBox ) ;
}
2010-11-12 19:02:01 +01:00
2011-04-24 23:18:39 +02:00
void AboutDialog : : moveDisque ( void )
{
2011-04-25 21:13:52 +02:00
int delta = 2 ;
LARGE_INTEGER perfCount , perfFrequ ;
if ( QueryPerformanceFrequency ( & perfFrequ ) & & QueryPerformanceCounter ( & perfCount ) )
{
if ( m_disqueDelay ! = _I64_MAX )
{
2011-05-01 00:42:34 +02:00
const double delay = static_cast < double > ( perfCount . QuadPart ) - static_cast < double > ( m_disqueDelay ) ;
2011-04-25 21:13:52 +02:00
delta = max ( 1 , min ( 128 , static_cast < int > ( ceil ( delay / static_cast < double > ( perfFrequ . QuadPart ) / 0.00512 ) ) ) ) ;
}
m_disqueDelay = perfCount . QuadPart ;
}
2011-04-24 23:34:52 +02:00
if ( m_disque )
2011-04-24 23:18:39 +02:00
{
2011-05-01 00:42:34 +02:00
QRect screenGeometry = QApplication : : desktop ( ) - > availableGeometry ( ) ;
const int minX = screenGeometry . left ( ) ;
const int maxX = screenGeometry . width ( ) - m_disque - > width ( ) + screenGeometry . left ( ) ;
const int minY = screenGeometry . top ( ) ;
const int maxY = screenGeometry . height ( ) - m_disque - > height ( ) + screenGeometry . top ( ) ;
2011-04-24 23:34:52 +02:00
QPoint pos = m_disque - > pos ( ) ;
pos . setX ( m_disqueFlags [ 0 ] ? pos . x ( ) + delta : pos . x ( ) - delta ) ;
pos . setY ( m_disqueFlags [ 1 ] ? pos . y ( ) + delta : pos . y ( ) - delta ) ;
2011-04-24 23:18:39 +02:00
2011-05-01 00:42:34 +02:00
if ( pos . x ( ) < = minX )
2011-04-24 23:34:52 +02:00
{
m_disqueFlags [ 0 ] = true ;
2011-05-01 00:42:34 +02:00
pos . setX ( minX ) ;
2011-04-25 21:13:52 +02:00
m_rotateNext = true ;
2011-04-24 23:34:52 +02:00
}
2011-05-01 00:42:34 +02:00
else if ( pos . x ( ) > = maxX )
2011-04-24 23:34:52 +02:00
{
m_disqueFlags [ 0 ] = false ;
2011-05-01 00:42:34 +02:00
pos . setX ( maxX ) ;
2011-04-25 21:13:52 +02:00
m_rotateNext = true ;
2011-04-24 23:34:52 +02:00
}
2011-05-01 00:42:34 +02:00
if ( pos . y ( ) < = minY )
2011-04-24 23:34:52 +02:00
{
m_disqueFlags [ 1 ] = true ;
2011-05-01 00:42:34 +02:00
pos . setY ( minY ) ;
2011-04-25 21:13:52 +02:00
m_rotateNext = true ;
2011-04-24 23:34:52 +02:00
}
2011-05-01 00:42:34 +02:00
else if ( pos . y ( ) > = maxY )
2011-04-24 23:34:52 +02:00
{
m_disqueFlags [ 1 ] = false ;
2011-05-01 00:42:34 +02:00
pos . setY ( maxY ) ;
2011-04-25 21:13:52 +02:00
m_rotateNext = true ;
}
m_disque - > move ( pos ) ;
if ( m_rotateNext )
{
QPixmap * cartoon = NULL ;
if ( m_disqueFlags [ 0 ] = = true & & m_disqueFlags [ 1 ] ! = true ) cartoon = m_cartoon [ 0 ] ;
if ( m_disqueFlags [ 0 ] = = true & & m_disqueFlags [ 1 ] = = true ) cartoon = m_cartoon [ 1 ] ;
if ( m_disqueFlags [ 0 ] ! = true & & m_disqueFlags [ 1 ] = = true ) cartoon = m_cartoon [ 2 ] ;
if ( m_disqueFlags [ 0 ] ! = true & & m_disqueFlags [ 1 ] ! = true ) cartoon = m_cartoon [ 3 ] ;
if ( cartoon )
{
m_disque - > setPixmap ( * cartoon ) ;
m_disque - > resize ( cartoon - > size ( ) ) ;
}
m_rotateNext = false ;
2011-04-24 23:34:52 +02:00
}
if ( m_disque - > windowOpacity ( ) < 0.9 )
{
m_disque - > setWindowOpacity ( m_disque - > windowOpacity ( ) + 0.01 ) ;
}
2011-04-24 23:18:39 +02:00
}
}
2010-11-12 19:02:01 +01:00
////////////////////////////////////////////////////////////
// Protected Functions
////////////////////////////////////////////////////////////
void AboutDialog : : showEvent ( QShowEvent * e )
{
QDialog : : showEvent ( e ) ;
if ( m_firstShow )
{
const QList < QAbstractButton * > buttonList = buttons ( ) ;
for ( int i = 1 ; i < buttonList . count ( ) ; i + + )
{
buttonList . at ( i ) - > setEnabled ( false ) ;
}
QTimer : : singleShot ( 5000 , this , SLOT ( enableButtons ( ) ) ) ;
setCursor ( QCursor ( Qt : : WaitCursor ) ) ;
}
}
2011-04-24 23:18:39 +02:00
bool AboutDialog : : eventFilter ( QObject * obj , QEvent * event )
{
if ( ( obj = = m_disque ) & & ( event - > type ( ) = = QEvent : : MouseButtonPress ) )
{
2011-04-25 21:13:52 +02:00
QPixmap cartoon ( " :/images/Cartoon.png " ) ;
for ( int i = 0 ; i < 4 ; i + + )
{
if ( ! m_cartoon [ i ] )
{
m_cartoon [ i ] = new QPixmap ( cartoon . transformed ( QMatrix ( ) . rotate ( static_cast < double > ( i * 90 ) + 45.0 ) , Qt : : SmoothTransformation ) ) ;
m_rotateNext = true ;
}
}
2011-04-24 23:18:39 +02:00
QDesktopServices : : openUrl ( QUrl ( disqueUrl ) ) ;
}
return false ;
}
2010-11-12 19:02:01 +01:00
////////////////////////////////////////////////////////////
// Private Functions
////////////////////////////////////////////////////////////
2010-12-18 16:49:04 +01:00
2011-01-07 23:00:32 +01:00
QString AboutDialog : : makeToolText ( const QString & toolName , const QString & toolBin , const QString & toolVerFmt , const QString & toolLicense , const QString & toolWebsite , const QString & extraInfo )
{
QString toolText , verStr ( toolVerFmt ) ;
if ( ! toolBin . isEmpty ( ) )
{
2011-01-14 23:34:31 +01:00
verStr = lamexp_version2string ( toolVerFmt , lamexp_tool_version ( toolBin ) , tr ( " n/a " ) ) ;
2011-01-07 23:00:32 +01:00
}
2011-01-27 15:46:21 +01:00
toolText + = QString ( " <li><nobr><b>%1 (%2)</b></nobr><br> " ) . arg ( toolName , verStr ) ;
2011-01-07 23:00:32 +01:00
toolText + = QString ( " <nobr>%1</nobr><br> " ) . arg ( toolLicense ) ;
if ( ! extraInfo . isEmpty ( ) ) toolText + = QString ( " <nobr><i>%1</i></nobr><br> " ) . arg ( extraInfo ) ;
toolText + = QString ( " <a href= \" %1 \" >%1</a> " ) . arg ( toolWebsite ) ;
toolText + = QString ( " <div style= \" font-size:1pt \" ><br></div> " ) ;
return toolText ;
}
2010-12-18 16:49:04 +01:00
bool AboutDialog : : playResoureSound ( const QString & library , const unsigned long soundId , const bool async )
{
HMODULE module = 0 ;
DWORD flags = SND_RESOURCE ;
bool result = false ;
QFileInfo libraryFile ( library ) ;
if ( ! libraryFile . isAbsolute ( ) )
{
unsigned int buffSize = GetSystemDirectoryW ( NULL , NULL ) + 1 ;
wchar_t * buffer = ( wchar_t * ) _malloca ( buffSize * sizeof ( wchar_t ) ) ;
unsigned int result = GetSystemDirectory ( buffer , buffSize ) ;
if ( result > 0 & & result < buffSize )
{
libraryFile . setFile ( QString ( " %1/%2 " ) . arg ( QDir : : fromNativeSeparators ( QString : : fromUtf16 ( reinterpret_cast < const unsigned short * > ( buffer ) ) ) , library ) ) ;
}
_freea ( buffer ) ;
}
if ( async )
{
flags | = SND_ASYNC ;
}
else
{
flags | = SND_SYNC ;
}
module = LoadLibraryW ( reinterpret_cast < const wchar_t * > ( QDir : : toNativeSeparators ( libraryFile . absoluteFilePath ( ) ) . utf16 ( ) ) ) ;
if ( module )
{
result = PlaySound ( ( LPCTSTR ) soundId , module , flags ) ;
FreeLibrary ( module ) ;
}
return result ;
}