X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2FDialog_About.cpp;h=149bc6de48e640ec6b77aa2abd00a498415c0b48;hb=a1a2d63c42f434173eb9e399b839ce6292e13cea;hp=44f893c167d3251a5439eefa463f5fd2eb6e6800;hpb=083af203a3d4d8a1a5d011dca37deb8090acfeb0;p=lamexp%2FLameXP.git diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 44f893c1..149bc6de 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // LameXP - Audio Encoder Front-End -// Copyright (C) 2004-2013 LoRd_MuldeR +// Copyright (C) 2004-2015 LoRd_MuldeR // // 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 @@ -22,14 +22,20 @@ #include "Dialog_About.h" -#include "../tmp/UIC_AboutDialog.h" +#include "UIC_AboutDialog.h" +//Internal #include "Global.h" -#include "Resource.h" #include "Model_Settings.h" -#include +//MUtils +#include +#include +#include +#include +#include +//Qt #include #include #include @@ -45,16 +51,20 @@ #include #include #include +#include #include #include +//CRT +#include + //Helper macros #define LINK(URL) QString("%2").arg(URL).arg(QString(URL).replace("-", "−")) #define TRIM_RIGHT(STR) do { while(STR.endsWith(QChar(' ')) || STR.endsWith(QChar('\t')) || STR.endsWith(QChar('\r')) || STR.endsWith(QChar('\n'))) STR.chop(1); } while(0) #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"; +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"; //Contributors @@ -67,24 +77,63 @@ static const struct } g_lamexp_translators[] = { - {"en", L"Englisch", L"LoRd_MuldeR", "MuldeR2@GMX.de" }, - {"de", L"Deutsch", L"LoRd_MuldeR", "MuldeR2@GMX.de" }, - {"", 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" }, - {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it" }, - {"kr", L"한국어", L"JaeHyung Lee", "Kolanp@gmail.com" }, - {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com"}, - {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" }, - {"", L"", L"Иван Митин", "bardak@inbox.ru" }, - {"sv", L"Svenska", L"Åke Engelbrektson", "eson57@gmail.com" }, - {"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" }, + {"en", L"Englisch", L"LoRd_MuldeR", "MuldeR2@GMX.de" }, + {"de", L"Deutsch", L"LoRd_MuldeR", "MuldeR2@GMX.de" }, + {"", 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" }, + {"hu", L"Magyarul", L"ZityiSoft Team", "zityisoft@gmail.com" }, + {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it" }, + {"kr", L"한국어", L"JaeHyung Lee", "Kolanp@gmail.com" }, + {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com" }, + {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" }, + {"", L"", L"Иван Митин", "bardak@inbox.ru" }, + {"sv", L"Svenska", L"Åke Engelbrektson", "eson@svenskasprakfiler.se"}, + {"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" }, {NULL, NULL, NULL, NULL} }; +//Special Thanks +static const struct +{ + char* pcName; + char *pcAddress; +} +g_lamexp_specialThanks[] = +{ + { "Doom9's Forum", "http://forum.doom9.org/" }, + { "Gleitz | German Doom9", "http://forum.gleitz.info/" }, + { "Hydrogenaudio Forums", "http://www.hydrogenaudio.org/" }, + { "RareWares", "http://www.rarewares.org/" }, + { "GitHub", "http://github.com/" }, + { "SourceForge", "http://sourceforge.net/" }, + { "Qt Developer Network", "http://qt-project.org/" }, + { "CodePlex", "http://www.codeplex.com/" }, + { "Marius Hudea", "http://savedonthe.net/" }, + { "Codecs.com", "http://www.codecs.com/" }, + { NULL, NULL } +}; + +//Mirrors +static const struct +{ + char* pcName; + char *pcAddress; +} +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" }, + { "GitLab.com" , "https://gitlab.com/lamexp/lamexp" }, + { "Codeplex.com", "https://lamexp.codeplex.com/SourceControl/latest" }, + { "Assembla.com", "https://www.assembla.com/spaces/lamexp/" }, + { NULL, NULL } +}; + //////////////////////////////////////////////////////////// // Constructor //////////////////////////////////////////////////////////// @@ -98,7 +147,6 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta m_disque(NULL), m_disqueTimer(NULL), m_rotateNext(false), - m_disqueDelay(_I64_MAX), m_lastTab(0) { //Init the dialog, from the .ui file @@ -109,7 +157,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta //Disable "X" button if(firstStart) { - lamexp_enable_close_button(this, false); + MUtils::GUI::enable_close_button(this, false); } //Init images @@ -134,7 +182,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta //Show about dialog for the first time? if(!firstStart) { - lamexp_seed_rand(); + MUtils::seed_rand(); ui->acceptButton->hide(); ui->declineButton->hide(); @@ -153,10 +201,10 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta geometryUpdated(); m_discOpacity = 0.01; - m_disquePos.setX(static_cast(lamexp_rand() % static_cast(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left()); - m_disquePos.setY(static_cast(lamexp_rand() % static_cast(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top()); - m_disqueFlags[0] = (lamexp_rand() > (UINT_MAX/2)); - m_disqueFlags[1] = (lamexp_rand() > (UINT_MAX/2)); + m_disquePos.setX(static_cast(MUtils::next_rand32() % static_cast(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left()); + m_disquePos.setY(static_cast(MUtils::next_rand32() % static_cast(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_disque->move(m_disquePos); m_disque->setWindowOpacity(m_discOpacity); m_disque->show(); @@ -187,19 +235,19 @@ AboutDialog::~AboutDialog(void) if(m_disque) { m_disque->close(); - LAMEXP_DELETE(m_disque); + MUTILS_DELETE(m_disque); } if(m_disqueTimer) { m_disqueTimer->stop(); - LAMEXP_DELETE(m_disqueTimer); + MUTILS_DELETE(m_disqueTimer); } for(int i = 0; i < 4; i++) { - LAMEXP_DELETE(m_cartoon[i]); + MUTILS_DELETE(m_cartoon[i]); } - LAMEXP_DELETE(m_initFlags); - LAMEXP_DELETE(ui); + MUTILS_DELETE(m_initFlags); + MUTILS_DELETE(ui); } //////////////////////////////////////////////////////////// @@ -212,14 +260,14 @@ int AboutDialog::exec() { if(m_firstShow) { - if(!lamexp_play_sound_file("imageres.dll", 5080, true)) + if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true)) { - lamexp_play_sound(0, true, L"SystemStart"); + MUtils::Sound::play_system_sound("SystemStart", true); } } else { - lamexp_play_sound(IDR_WAVE_ABOUT, true); + MUtils::Sound::play_sound("uuaarrgh", true); } } @@ -291,7 +339,7 @@ void AboutDialog::tabChanged(int index, const bool silent) //Play tick sound if(m_settings->soundsEnabled() && (!silent)) { - lamexp_play_sound(IDR_WAVE_TICK, true); + MUtils::Sound::play_sound("tick", true); } //Scroll to the top @@ -319,7 +367,7 @@ void AboutDialog::openURL(const QString &url) { if(!QDesktopServices::openUrl(QUrl(url))) { - lamexp_exec_shell(this, url); + MUtils::OS::shell_open(this, url); } } @@ -339,17 +387,18 @@ void AboutDialog::gotoLicenseTab(void) void AboutDialog::moveDisque(void) { int delta = 2; - const __int64 perfFrequ = lamexp_perfcounter_frequ(); - const __int64 perfCount = lamexp_perfcounter_value(); + QElapsedTimer elapsedTimer; + elapsedTimer.start(); - if((perfFrequ >= 0) && (perfCount >= 0)) + if((!m_disqueDelay.isNull()) && m_disqueDelay->isValid()) { - if(m_disqueDelay != _I64_MAX) - { - const double delay = static_cast(perfCount) - static_cast(m_disqueDelay); - delta = qMax(1, qMin(128, static_cast(ceil(delay / static_cast(perfFrequ) / 0.00512)))); - } - m_disqueDelay = perfCount; + const qint64 delay = m_disqueDelay->restart(); + delta = qBound(1, static_cast(ceil(static_cast(delay) / 5.12)), 128); + } + else + { + m_disqueDelay.reset(new QElapsedTimer()); + m_disqueDelay->start(); } if(m_disque) @@ -414,15 +463,25 @@ void AboutDialog::geometryUpdated(void) void AboutDialog::adjustSize(void) { - int maximumHeight = QApplication::desktop()->availableGeometry().height(); + const int maxH = QApplication::desktop()->availableGeometry().height(); + const int maxW = QApplication::desktop()->availableGeometry().width(); - int delta = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height(); - if(delta > 0) + const int deltaH = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height(); + const int deltaW = ui->infoScrollArea->widget()->width() - ui->infoScrollArea->viewport()->width(); + + if(deltaH > 0) { - this->resize(this->width(), qMin(this->height() + delta, maximumHeight)); - this->move(this->x(), this->y() - (delta/2)); + this->resize(this->width(), qMin(this->height() + deltaH, maxH)); + this->move(this->x(), this->y() - (deltaH / 2)); this->setMinimumHeight(qMax(this->minimumHeight(), this->height())); } + + if(deltaW > 0) + { + this->resize(qMin(this->width() + deltaW, maxW), this->height()); + this->move(this->x() - (deltaW / 2), this->y()); + this->setMinimumWidth(qMax(this->minimumWidth(), this->width())); + } } //////////////////////////////////////////////////////////// @@ -477,6 +536,8 @@ bool AboutDialog::eventFilter(QObject *obj, QEvent *event) void AboutDialog::initInformationTab(void) { + const QDate versionDate = MUtils::Version::app_build_date(); + const QString versionStr = QString().sprintf ( "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s", @@ -484,16 +545,16 @@ void AboutDialog::initInformationTab(void) lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), - lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(), - lamexp_version_compiler(), - lamexp_version_arch(), + versionDate.toString(Qt::ISODate).toLatin1().constData(), + MUtils::Version::compiler_version(), + MUtils::Version::compiler_arch(), qVersion() ); const QString copyrightStr = QString().sprintf ( "Copyright (C) 2004-%04d LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.", - qMax(lamexp_version_date().year(), lamexp_current_date_safe().year()) + qMax(versionDate.year(), MUtils::OS::current_date().year()) ); QString aboutText; @@ -504,8 +565,8 @@ void AboutDialog::initInformationTab(void) aboutText += QString("%1
").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url())))); #if QT_VERSION < QT_VERSION_CHECK(5,0,0) - const QDate currentDate = lamexp_current_date_safe(); - if(LAMEXP_DEBUG) + const QDate currentDate = MUtils::OS::current_date(); + if(MUTILS_DEBUG) { int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0); aboutText += QString("
%1").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 · Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)))); @@ -566,7 +627,7 @@ void AboutDialog::initContributorsTab(void) QString icon = QString("").arg("user_gray"); contributorsAboutText += QString("%1%2").arg(icon, spaces); contributorsAboutText += QString("%1%2").arg(tr("Project Leader"), spaces); - contributorsAboutText += QString("%1%2<%3>").arg("LoRd_MuldeR", spaces, "MuldeR2@GMX.de"); + contributorsAboutText += QString("%1%2<%3>").arg("LoRd_MuldeR", spaces, "MuldeR2@GMX.de"); contributorsAboutText += QString(" "); contributorsAboutText += QString("%1%2").arg(tr("Translators:"), extraVSpace); @@ -574,36 +635,29 @@ void AboutDialog::initContributorsTab(void) { QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("").arg(g_lamexp_translators[i].pcFlag) : QString(); contributorsAboutText += QString("%1%2").arg(flagIcon, spaces); - contributorsAboutText += QString("%1%2").arg(WCHAR2QSTR(g_lamexp_translators[i].pcLanguage), spaces); - contributorsAboutText += QString("%1%2<%3>").arg(WCHAR2QSTR(g_lamexp_translators[i].pcName), spaces, g_lamexp_translators[i].pcMail); + contributorsAboutText += QString("%1%2").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces); + contributorsAboutText += QString("%1%2<%3>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcName), spaces, g_lamexp_translators[i].pcMail); } contributorsAboutText += QString(" "); contributorsAboutText += QString("%1%2").arg(tr("Special thanks to:"), extraVSpace); QString webIcon = QString("").arg("world"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("Doom9's Forum"), spaces, "http://forum.doom9.org/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("Gleitz | German Doom9"), spaces, "http://forum.gleitz.info/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("Hydrogenaudio Forums"), spaces, "http://www.hydrogenaudio.org/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("RareWares"), spaces, "http://www.rarewares.org/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("GitHub"), spaces, "http://github.com/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("SourceForge"), spaces, "http://sourceforge.net/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("Qt Developer Network"), spaces, "http://qt-project.org/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("BerliOS Developer"), spaces, "http://developer.berlios.de/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("CodePlex"), spaces, "http://www.codeplex.com/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("Marius Hudea"), spaces, "http://savedonthe.net/"); - contributorsAboutText += QString("%1%2").arg(webIcon, spaces); - contributorsAboutText += QString("%1%2%3").arg(tr("Codecs.com"), spaces, "http://www.codecs.com/"); + for(int i = 0; g_lamexp_specialThanks[i].pcName; i++) + { + contributorsAboutText += QString("%1%2").arg(webIcon, spaces); + contributorsAboutText += QString("%1%2%3").arg(QString::fromLatin1(g_lamexp_specialThanks[i].pcName), spaces, QString::fromLatin1(g_lamexp_specialThanks[i].pcAddress)); + } + + contributorsAboutText += QString(" "); + contributorsAboutText += QString("%1%2").arg(tr("Official Mirrors:"), extraVSpace); + + QString serverIcon = QString("").arg("server_database"); + for(int i = 0; g_lamexp_mirrors[i].pcName; i++) + { + contributorsAboutText += QString("%1%2").arg(serverIcon, spaces); + contributorsAboutText += QString("%1%2%3").arg(QString::fromLatin1(g_lamexp_mirrors[i].pcName), spaces, QString::fromLatin1(g_lamexp_mirrors[i].pcAddress)); + } contributorsAboutText += "


"; contributorsAboutText += QString("%1
").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!"))); @@ -629,10 +683,10 @@ void AboutDialog::initSoftwareTab(void) ); moreAboutText += makeToolText ( - tr("OggEnc - Ogg Vorbis Encoder"), - "oggenc2.exe", "v?.??, aoTuV #-?.??", + tr("OggEnc - Vorbis Encoder"), + "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#", tr("Completely open and patent-free audio encoding technology."), - "http://www.vorbis.com/" + "http://www.rarewares.org/ogg-oggenc.php" ); moreAboutText += makeToolText ( @@ -679,6 +733,13 @@ void AboutDialog::initSoftwareTab(void) ); moreAboutText += makeToolText ( + tr("OggDec - Vorbis Decoder"), + "oggdec.exe", "v?.??.?", + tr("Command line Ogg Vorbis decoder created by John33."), + "http://www.rarewares.org/ogg-oggdec.php" + ); + moreAboutText += makeToolText + ( tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"), "valdec.exe", "v?.??#", tr("Released under the terms of the GNU Lesser General Public License."), @@ -726,13 +787,6 @@ void AboutDialog::initSoftwareTab(void) tr("Released under the terms of the GNU Lesser General Public License."), "http://tta.sourceforge.net/" ); - //moreAboutText += makeToolText - //( - // tr("ALAC Decoder"), - // "alac.exe", "v?.?.?", - // tr("Copyright (c) 2004 David Hammerton. Contributions by Cody Brocious."), - // "http://craz.net/programs/itunes/alac.html" - //); moreAboutText += makeToolText ( tr("refalac - Win32 command line ALAC encoder/decoder"), @@ -759,7 +813,7 @@ void AboutDialog::initSoftwareTab(void) tr("dcaenc"), "dcaenc.exe", "????-??-??", tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."), - "http://gitorious.org/dtsenc/dtsenc/trees/master" + "https://gitlab.com/patrakov/dcaenc" ); moreAboutText += makeToolText ( @@ -860,8 +914,8 @@ QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBi if(!toolBin.isEmpty()) { - const unsigned int version = lamexp_tool_version(toolBin, &toolTag); - verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), &toolTag); + const unsigned int version = lamexp_tools_version(toolBin, &toolTag); + verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), toolTag); } toolText += QString("
  • %1
    ").arg(NOBR(QString("%1 (%2)").arg(toolName, verStr)));