OSDN Git Service

Some improvements to "About" screen.
[lamexp/LameXP.git] / src / Dialog_About.cpp
index 6dd912a..46a4b41 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2018 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // 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
@@ -64,8 +64,8 @@
 #define MAKE_TRANSPARENT(WIDGET) do { QPalette _p = (WIDGET)->palette(); _p.setColor(QPalette::Background, Qt::transparent); (WIDGET)->setPalette(_p); } while(0)
 
 //Constants
-const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/company/about-nero/nero-aac-codec.php"; //"http://www.videohelp.com/tools/Nero-AAC-Codec";
-const char *AboutDialog::disqueUrl =  "http://muldersoft.com/?player_url=38X-MXOB014";
+const char *AboutDialog::neroAacUrl = "http://www.videohelp.com/software/Nero-AAC-Codec"; //"http://www.nero.com/eng/company/about-nero/nero-aac-codec.php"
+const char *AboutDialog::disqueUrl =  "http://muldersoft.com/?player_url=n4bply6Ibqw"; //38X-MXOB014
 
 //Contributors
 static const struct 
@@ -82,6 +82,7 @@ g_lamexp_translators[] =
        {"",   L"",           L"Bodo Thevissen",      "Bodo@thevissen.de"        },
        {"es", L"Español",    L"Rub3nCT",             "Rub3nCT@gmail.com"        },
        {"fr", L"Française",  L"Dodich Informatique", "Dodich@live.fr"           },
+       {"",   L"Française",  L"Sami Ghoul-Duclos",   "samgd14@live.ca"          },
        {"hu", L"Magyarul",   L"ZityiSoft Team",      "zityisoft@gmail.com"      },
        {"it", L"Italiano",   L"Roberto",             "Gulliver_69@libero.it"    },
        {"",   L"",           L"Gianluca Papi",       "johnnyb.goode68@gmail.com"},
@@ -93,7 +94,7 @@ g_lamexp_translators[] =
        {"tw", L"繁体中文",       L"456Vv",               "123@456vv.com"            },
        {"uk", L"Українська", L"Arestarh",            "Arestarh@ukr.net"         },
        {"zh", L"简体中文",       L"456Vv",               "123@456vv.com"            },
-       {"",   L"",           L"庄泓川",                 "kidneybean@sohu.com"      },
+       {"",   L"",           L"庄泓川",                 "kidneybean@pku.edu.cn"    },
        {NULL, NULL, NULL, NULL}
 };
 
@@ -111,7 +112,7 @@ g_lamexp_specialThanks[] =
        { "RareWares",             "http://www.rarewares.org/"     },
        { "GitHub",                "http://github.com/"            },
        { "SourceForge",           "http://sourceforge.net/"       },
-       { "Qt Developer Network",  "http://qt-project.org/"        },
+       { "Qt Developer Network",  "https://www.qt.io/developers/" },
        { "CodePlex",              "http://www.codeplex.com/"      },
        { "Marius Hudea",          "http://savedonthe.net/"        },
        { "Codecs.com",            "http://www.codecs.com/"        },
@@ -128,7 +129,7 @@ g_lamexp_mirrors[] =
 {
        { "GitHub.com",      "https://github.com/lordmulder/LameXP"              },
        { "SourceForge.net", "http://sourceforge.net/p/lamexp/code/"             },
-       { "Bitbucket.org",   "https://bitbucket.org/lord_mulder/lamexp"          },
+       { "Bitbucket.org",   "https://bitbucket.org/muldersoft/lamexp"           },
        { "GitLab.com"   ,   "https://gitlab.com/lamexp/lamexp"                  },
        { "Codeplex.com",    "https://lamexp.codeplex.com/SourceControl/latest"  },
        { "Assembla.com",    "https://www.assembla.com/spaces/lamexp/"           },
@@ -148,25 +149,23 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
        m_disque(NULL),
        m_disqueTimer(NULL),
        m_rotateNext(false),
-       m_lastTab(0)
+       m_lastTab(0),
+       m_firstStart(firstStart)
 {
        //Init the dialog, from the .ui file
        ui->setupUi(this);
        setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
-       resize(this->minimumSize());
-       
+       setMinimumSize(this->size());
+
+       //Adjust size to DPI settings and re-center
+       MUtils::GUI::scale_widget(this);
+
        //Disable "X" button
        if(firstStart)
        {
                MUtils::GUI::enable_close_button(this, false);
        }
 
-       //Init images
-       for(int i = 0; i < 4; i++)
-       {
-               m_cartoon[i] = NULL;
-       }
-
        //Init tab widget
        connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
 
@@ -183,37 +182,34 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
        //Show about dialog for the first time?
        if(!firstStart)
        {
-               MUtils::seed_rand();
-
                ui->acceptButton->hide();
                ui->declineButton->hide();
                ui->aboutQtButton->show();
                ui->closeButton->show();
 
                QPixmap disque(":/images/Disque.png");
-               m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+               m_disque.reset(new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
                m_disque->resize(disque.size());
                m_disque->setStyleSheet("background:transparent;");
                m_disque->setAttribute(Qt::WA_TranslucentBackground);
                m_disque->setPixmap(disque);
+               m_disque->setCursor(QCursor(Qt::PointingHandCursor));
                m_disque->installEventFilter(this);
 
                connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
                geometryUpdated();
 
                m_discOpacity = 0.01;
-               m_disquePos.setX(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.right()  - disque.width()  - m_disqueBound.left())) + m_disqueBound.left());
-               m_disquePos.setY(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top()))  + m_disqueBound.top());
-               m_disqueFlags[0] = (MUtils::next_rand32() > (UINT_MAX/2));
-               m_disqueFlags[1] = (MUtils::next_rand32() > (UINT_MAX/2));
+               m_disquePos.setX(static_cast<int>(MUtils::next_rand_u32() % static_cast<unsigned int>(m_disqueBound.right()  - disque.width()  - m_disqueBound.left())) + m_disqueBound.left());
+               m_disquePos.setY(static_cast<int>(MUtils::next_rand_u32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top()))  + m_disqueBound.top());
+               m_disqueFlags[0] = (MUtils::next_rand_u32() > (UINT_MAX/2));
+               m_disqueFlags[1] = (MUtils::next_rand_u32() > (UINT_MAX/2));
                m_disque->move(m_disquePos);
                m_disque->setWindowOpacity(m_discOpacity);
-               m_disque->show();
 
-               m_disqueTimer = new QTimer;
-               connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
-               m_disqueTimer->start(10);
+               m_disqueTimer.reset(new QTimer());
 
+               connect(m_disqueTimer.data(), SIGNAL(timeout()), this, SLOT(moveDisque()));
                connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
        }
        else
@@ -227,8 +223,6 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
        //Activate "show license" button
        ui->showLicenseButton->show();
        connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
-
-       m_firstShow = firstStart;
 }
 
 AboutDialog::~AboutDialog(void)
@@ -236,18 +230,11 @@ AboutDialog::~AboutDialog(void)
        if(m_disque)
        {
                m_disque->close();
-               MUTILS_DELETE(m_disque);
        }
        if(m_disqueTimer)
        {
                m_disqueTimer->stop();
-               MUTILS_DELETE(m_disqueTimer);
        }
-       for(int i = 0; i < 4; i++)
-       {
-               MUTILS_DELETE(m_cartoon[i]);
-       }
-       MUTILS_DELETE(m_initFlags);
        MUTILS_DELETE(ui);
 }
 
@@ -259,7 +246,7 @@ int AboutDialog::exec()
 {
        if(m_settings->soundsEnabled())
        {
-               if(m_firstShow)
+               if(m_firstStart)
                {
                        if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true))
                        {
@@ -268,7 +255,7 @@ int AboutDialog::exec()
                }
                else
                {
-                       MUtils::Sound::play_sound("uuaarrgh", true);
+                       MUtils::Sound::play_sound("ghost", true);
                }
        }
        
@@ -416,11 +403,7 @@ void AboutDialog::moveDisque(void)
                
                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];
+                       const QPixmap *const cartoon = m_cartoon[m_disqueFlags[0] ? (m_disqueFlags[1] ? 1 : 0): (m_disqueFlags[1] ? 2 : 3)].data();
                        if(cartoon)
                        {
                                m_disque->setPixmap(*cartoon);
@@ -496,7 +479,7 @@ void AboutDialog::showEvent(QShowEvent *e)
        ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
        tabChanged(m_lastTab = ui->tabWidget->currentIndex(), true);
        
-       if(m_firstShow)
+       if(m_firstStart)
        {
                ui->acceptButton->setEnabled(false);
                ui->declineButton->setEnabled(false);
@@ -504,24 +487,34 @@ void AboutDialog::showEvent(QShowEvent *e)
                setCursor(QCursor(Qt::WaitCursor));
        }
 
+       if (!(m_disque.isNull() || m_disqueTimer.isNull()))
+       {
+               m_disque->show();
+               m_disqueTimer->start(10);
+       }
+
        QTimer::singleShot(0, this, SLOT(adjustSize()));
 }
 
 void AboutDialog::closeEvent(QCloseEvent *e)
 {
-       if(m_firstShow) e->ignore();
+       if (m_firstStart)
+       {
+               e->ignore();
+       }
 }
 
 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
 {
-       if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
+       if((!m_disque.isNull()) && (obj == m_disque.data()) && (event->type() == QEvent::MouseButtonPress))
        {
-               QPixmap cartoon(":/images/Cartoon.png");
-               for(int i = 0; i < 4; i++)
+               MUtils::Sound::play_sound("chicken", true);
+               if (!m_cartoon[0])
                {
-                       if(!m_cartoon[i])
+                       QPixmap cartoon(":/images/Cartoon.png");
+                       for(int i = 0; i < 4; i++)
                        {
-                               m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
+                               m_cartoon[i].reset(new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation)));
                                m_rotateNext = true;
                        }
                }
@@ -538,18 +531,26 @@ bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
 void AboutDialog::initInformationTab(void)
 {
        const QDate versionDate = MUtils::Version::app_build_date();
+       const QTime versionTime = MUtils::Version::app_build_time();
 
-       const QString versionStr = QString().sprintf
+       const QString versionStr = QString("Version %1 %2, Build %3 [%4] [%5]").arg
        (
-               "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
-               lamexp_version_major(),
-               lamexp_version_minor(),
-               lamexp_version_release(),
-               lamexp_version_build(),
-               versionDate.toString(Qt::ISODate).toLatin1().constData(),
-               MUtils::Version::compiler_version(),
-               MUtils::Version::compiler_arch(),
-               qVersion()
+               QString().sprintf("%u.%02u", lamexp_version_major(), lamexp_version_minor()),
+               QString::fromLatin1(lamexp_version_release()),
+               QString::number(lamexp_version_build()),
+               versionDate.toString(Qt::ISODate),
+               versionTime.toString(Qt::ISODate)
+       );
+
+       const QString platformStr = QString("%1 [%2], MUtilities %3 [%4] [%5], Qt Framework v%6 [%7]").arg
+       (
+               QString::fromLatin1(MUtils::Version::compiler_version()),
+               QString::fromLatin1(MUtils::Version::compiler_arch()),
+               QString().sprintf("%u.%02u", MUtils::Version::lib_version_major(), MUtils::Version::lib_version_minor()),
+               MUtils::Version::lib_build_date().toString(Qt::ISODate).toLatin1().constData(),
+               MUtils::Version::lib_build_time().toString(Qt::ISODate).toLatin1().constData(),
+               QString::fromLatin1(qVersion()),
+               QString::fromLatin1(QT_PACKAGEDATE_STR)
        );
 
        const QString copyrightStr = QString().sprintf
@@ -562,7 +563,8 @@ void AboutDialog::initInformationTab(void)
 
        aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
        aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
-       aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
+       aboutText += QString("<b>%1</b><br>").arg(NOBR(versionStr));
+       aboutText += QString("<b>%1</b><br><br>").arg(NOBR(platformStr));
        aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
 
 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
@@ -678,7 +680,7 @@ void AboutDialog::initSoftwareTab(void)
        moreAboutText += makeToolText
        (
                tr("LAME - OpenSource mp3 Encoder"),
-               "lame.exe", "v?.??, #-?",
+               "lame.exe", "v?.???, #-?",
                tr("Released under the terms of the GNU Lesser General Public License."),
                "http://lame.sourceforge.net/"
        );
@@ -721,16 +723,16 @@ void AboutDialog::initSoftwareTab(void)
        moreAboutText += makeToolText
        (
                tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
-               "mpg123.exe", "v?.??.?",
+               "mpg123.exe", "v?.??.??",
                tr("Released under the terms of the GNU Lesser General Public License."),
                "http://www.mpg123.de/"
        );
        moreAboutText += makeToolText
        (
                tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
-               "faad.exe", "v?.?",
+               "faad.exe", "v?.?.?",
                tr("Released under the terms of the GNU General Public License."),
-               "http://www.audiocoding.com/"
+               "https://sourceforge.net/projects/faac/"        //"http://www.audiocoding.com/"
        );
        moreAboutText += makeToolText
        (
@@ -819,7 +821,7 @@ void AboutDialog::initSoftwareTab(void)
        moreAboutText += makeToolText
        (
                tr("MediaInfo - Media File Analysis Tool"),
-               "mediainfo.exe", "v?.?.??",
+               "mediainfo.exe", "v??.??.?",
                tr("Released under the terms of the GNU Lesser General Public License."),
                "http://mediainfo.sourceforge.net/"
        );
@@ -853,11 +855,18 @@ void AboutDialog::initSoftwareTab(void)
        );
        moreAboutText += makeToolText
        (
-               tr("Silk Icons - Over 700  icons in PNG format"),
+               tr("Silk Icons - Over 700 icons in PNG format"),
                QString(), "v1.3",
-               tr("By Mark James, released under the Creative Commons 'by' License."),
+               tr("By Mark James, released under the Creative Commons 'BY' License."),
                "http://www.famfamfam.com/lab/icons/silk/"
        );
+       moreAboutText += makeToolText
+       (
+               tr("Angry Chicken and Ghost Scream sound"),
+               QString(), "v1.0",
+               tr("By Alexander, released under the Creative Commons 'BY' License."),
+               "http://www.orangefreesounds.com/"
+       );
        moreAboutText += QString("</ul></td><td>&nbsp;</td></tr></table></div><br><i>%1</i><br>").arg
        (
                tr("The copyright of LameXP as a whole belongs to LoRd_MuldeR. The copyright of third-party software used in LameXP belongs to the individual authors.")