From e4d414b822e1dd1712b62ae57fcff79dcabeae25 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Thu, 1 Dec 2011 22:16:06 +0100 Subject: [PATCH] Added more "known hosts" to the list: We now use a list of 64 domains, taken (mostly) from the Alexa 'top 500 sites on the web' list, to test the Internet connectivity. Also added a self-test function to check all hosts (press CTRL+F12 in the update dialog). --- doc/FAQ.html | 2 +- etc/Translation/Blank.ts | 104 +++++++++++---------- etc/Translation/LameXP_PL.ts | 104 +++++++++++---------- src/Config.h | 4 +- src/Dialog_Update.cpp | 173 ++++++++++++++++++++++++++++++++++- src/Dialog_Update.h | 1 + 6 files changed, 281 insertions(+), 107 deletions(-) diff --git a/doc/FAQ.html b/doc/FAQ.html index 0726cf95..508ec58a 100644 --- a/doc/FAQ.html +++ b/doc/FAQ.html @@ -482,7 +482,7 @@ cores, the maximum number of parallel instances is six. On systems with 16 cores parallel instances is eight. On systems with 32 cores, the maximum number of parallel instances is eleven.
And on systems with 64 cores, the maximum number of parallel instances is 16. 16 is the upper limit.

-thumb
+thumb

You may wonder why LameXP doesn't always create one instance for each CPU core. In theory, the more instances
we run in parallel, the more CPU cores can be utilized - until all CPU cores are busy and the overall CPU
diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index b405f76b..88d63941 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -2633,141 +2633,141 @@ - + Show details for selected job - + Browse Output File Location - + Encoding Files - + Your files are being encoded, please be patient... - + Encoding files, please wait... - + Multi-threading enabled: Running %1 instances in parallel! - + Aborted! Waiting for running jobs to terminate... - + Encoding: %1 files of %2 completed so far, please wait... - + Creating the playlist file, please wait... - + Process was aborted by the user after %1 file(s)! - + Process was aborted prematurely by the user! - + LameXP - Aborted - + Process was aborted by the user. - + Process finished after %1. - + Error: %1 of %2 files failed. Double-click failed items for detailed information! - + LameXP - Error - + At least one file has failed! + - All files completed successfully. - + LameXP - Done - + Playlist creation failed - + The playlist file could not be created: - + Warning: Computer will shutdown in %1 seconds... + - Cancel Shutdown - + hour(s) - - + + minute(s) - - + + second(s) - + millisecond(s) @@ -2867,103 +2867,107 @@ - - + + Build - + Unknown - + Testing your internet connection, please wait... - + + It appears that the computer currently is offline! - + + Please make sure your computer is connected to the internet and try again. - + + Network connectivity test has failed! - + + Please make sure your internet connection is working properly and try again. - + Checking for new updates online, please wait... - + Failed to fetch update information from server! - + Sorry, the update server might be busy at this time. Plase try again later. - + More information available at: - + A new version of LameXP is available! - + We highly recommend all users to install this update as soon as possible. - + No new updates available at this time. - + Your version of LameXP is still up-to-date. Please check for updates regularly! - + Your version appears to be newer than the latest release. - + This usually indicates your are currently using a pre-release version of LameXP. - + Update is being downloaded, please be patient... - + Update ready to install. Applicaion will quit... - + Update failed. Please try again or download manually! diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index 70bf7861..d30868c2 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -2633,141 +2633,141 @@ Powrót - + Show details for selected job Pokaż szczegóły wybranego zadania - + Browse Output File Location Wybierz lokalizację dla plików wyjściowych - + Encoding Files Kompresowanie plików - + Your files are being encoded, please be patient... Twoje pliki są właśnie kompresowane, prosze być cierpliwy... - + Encoding files, please wait... Kompresowanie plików, prosze czekać... - + Multi-threading enabled: Running %1 instances in parallel! Wielowątkowosć włączona: Równolegle wykonywanych jest %1 kodowań! - + Aborted! Waiting for running jobs to terminate... Przerwano! Czekanie na wyłączenie procesu... - + Encoding: %1 files of %2 completed so far, please wait... Kompresja: Prosze czekać, jak dotąd wykonano %1 z %2 plików... - + Creating the playlist file, please wait... Tworzenie pliku playlisty, prosze czekać... - + Process was aborted by the user after %1 file(s)! Proces został przerwany przez użytkownika po wykonaniu %1 plików! - + Process was aborted prematurely by the user! Proces został przedwcześnie zakończony przez użytkownika! - + LameXP - Aborted LameXP - Przerwano - + Process was aborted by the user. Proces został przerwany przez użytkownika. - + Process finished after %1. - + Error: %1 of %2 files failed. Double-click failed items for detailed information! Błąd: %1 z %2 plików nie zostało skompresowanych. Kliknij dwukrotnie na plik aby zobaczyć szczegóły! - + LameXP - Error LameXP - Błąd - + At least one file has failed! Przynajmniej jeden plik nie został skompresowany! + - All files completed successfully. Kompresja wszystkich plików zakończona powodzeniem. - + LameXP - Done LameXP - Zrobione - + Playlist creation failed Tworzenie playlisty zakończone niepowodzeniem - + The playlist file could not be created: Playlista nie mogła zostać utworzona: - + Warning: Computer will shutdown in %1 seconds... Ostrzeżenie: Komputer zostanie zamknięty za %1 sekund/y... + - Cancel Shutdown Anuluj wyłączenie komputera - + hour(s) - - + + minute(s) - - + + second(s) - + millisecond(s) @@ -2867,103 +2867,107 @@ Zamknij - - + + Build Build - + Unknown Nieznany - + Testing your internet connection, please wait... Testowanie połączenia internetowego, prosze czekać... - + + It appears that the computer currently is offline! LameXP wykrył brak dostępu do internetu! - + + Please make sure your computer is connected to the internet and try again. Upewnij się że komputer jest podłączony do internetu i spróbuj ponownie. - + + Network connectivity test has failed! Test połączenia internetowego zakończony niepowodzeniem! - + + Please make sure your internet connection is working properly and try again. Upewnij się że połączenie internetowe działa prawidłowo i spróbuj ponownie. - + Checking for new updates online, please wait... Sprawdzanie aktualizacji online, prosze czekać... - + Failed to fetch update information from server! Pobieranie informacji z serwera zakończone niepowodzeniem! - + Sorry, the update server might be busy at this time. Plase try again later. Serwer aktualizacji wydaje się nie odpowiadać w tej chwili. Prosze spróbować później. - + More information available at: Więcej informacji tutaj: - + A new version of LameXP is available! Dostępna nowa wersja LameXP! - + We highly recommend all users to install this update as soon as possible. Jest wysoce zalecane aby zainstalować tę aktualizację jak najszybciej. - + No new updates available at this time. Nie ma nowych aktualizacji w tej chwili. - + Your version of LameXP is still up-to-date. Please check for updates regularly! Posiadasz najnowszą wersję LameXP. Sprawdzaj aktualizacje regularnie! - + Your version appears to be newer than the latest release. Posiadasz nowszą wersję LameXP niż ostatnie wydanie. - + This usually indicates your are currently using a pre-release version of LameXP. To wskazuje na to, że posiadasz wersję alfa LameXP. - + Update is being downloaded, please be patient... Pobieranie aktualizacji w toku, prosze czekać... - + Update ready to install. Applicaion will quit... Aktualizacja gotowa do instalacji. Teraz program zostanie zamknięty... - + Update failed. Please try again or download manually! Aktualizacja zakończona niepowodzeniem. Prosze spróbować ponownie lub zainstalować ręcznie! diff --git a/src/Config.h b/src/Config.h index 6dc4f194..1b484c35 100644 --- a/src/Config.h +++ b/src/Config.h @@ -29,8 +29,8 @@ #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE Alpha -#define VER_LAMEXP_PATCH 5 -#define VER_LAMEXP_BUILD 796 +#define VER_LAMEXP_PATCH 6 +#define VER_LAMEXP_BUILD 798 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_Update.cpp b/src/Dialog_Update.cpp index 6aca2152..0ee0dfbc 100644 --- a/src/Dialog_Update.cpp +++ b/src/Dialog_Update.cpp @@ -73,43 +73,72 @@ static const char *update_mirrors_back[] = NULL }; -static const char *known_hosts[] = +static const char *known_hosts[] = //Taken form: http://www.alexa.com/topsites { + "http://www.163.com/", + "http://www.360buy.com/", "http://www.amazon.com/", "http://www.aol.com/", "http://www.apache.org/", + "http://www.apple.com/", + "http://www.adobe.com/", "http://www.avidemux.org/", + "http://www.babylon.com/", + "http://www.baidu.com/", "http://www.bbc.co.uk/", "http://www.bing.com/", + "http://www.cnet.com/", + "http://cnzz.com/", "http://www.ebay.com/", "http://www.equation.com/", + "http://fc2.com/", "http://www.ffmpeg.org/", + "http://www.flickr.com/", "http://www.gitorious.org/", "http://www.gnome.org/", "http://www.gnu.org/", + "http://go.com/", "http://code.google.com/", - "http://haali.su/mkv/", "http://www.heise.de/", + "http://www.huffingtonpost.co.uk/", "http://www.iana.org/", + "http://www.imdb.com/", "http://www.imgburn.com/", + "http://imgur.com/", "http://www.kernel.org/", "http://www.libav.org/", + "http://www.linkedin.com/", + "http://www.livedoor.com/", + "http://www.livejournal.com/", + "http://mail.ru/", + "http://www.mediafire.com/", "http://www.mozilla.org/", "http://mplayerhq.hu/", "http://www.msn.com/?st=1", "http://oss.netfarm.it/", + "http://www.nytimes.com/", "http://www.opera.com/", "http://www.quakelive.com/", "http://www.seamonkey-project.org/", + "http://www.sina.com.cn/", + "http://www.sohu.com/", + "http://www.soso.com/", "http://sourceforge.net/", "http://www.spiegel.de/", "http://tdm-gcc.tdragon.net/", "http://www.tdrsmusic.com/", + "http://www.ubuntu.com/", + "http://twitter.com/", + "http://www.uol.com.br/", "http://www.videohelp.com/", "http://www.videolan.org/", + "http://www.weibo.com/", "http://www.wikipedia.org/", + "http://wordpress.com/", "http://www.yahoo.com/", + "http://www.yandex.ru/", "http://www.youtube.com/", + "http://www.zedo.com/", NULL }; @@ -259,6 +288,14 @@ void UpdateDialog::keyPressEvent(QKeyEvent *e) { if(closeButton->isEnabled()) logButtonClicked(); } + else if((e->key() == Qt::Key_F12) && e->modifiers().testFlag(Qt::ControlModifier)) + { + if(closeButton->isEnabled()) + { + testKnownWebSites(); + logButtonClicked(); + } + } else { QDialog::keyPressEvent(e); @@ -365,7 +402,7 @@ void UpdateDialog::checkForUpdates(void) else { QApplication::processEvents(); - Sleep(15); + Sleep(8); } } @@ -578,7 +615,7 @@ bool UpdateDialog::getFile(const QString &url, const QString &outFile, unsigned QTimer timer; timer.setSingleShot(true); - timer.setInterval(15000); + timer.setInterval(25000); connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); process.start(m_binaryWGet, args); @@ -844,3 +881,131 @@ void UpdateDialog::progressBarValueChanged(int value) { WinSevenTaskbar::setTaskbarProgress(this->parentWidget(), value, progressBar->maximum()); } + +void UpdateDialog::testKnownWebSites(void) +{ + int connectionScore = 0; + + // ----- Initialization ----- // + + progressBar->setValue(0); + WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNormalState); + WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/transmit_blue.png")); + installButton->setEnabled(false); + closeButton->setEnabled(false); + retryButton->setEnabled(false); + logButton->setEnabled(false); + if(infoLabel->isVisible()) infoLabel->hide(); + if(hintLabel->isVisible()) hintLabel->hide(); + if(hintIcon->isVisible()) hintIcon->hide(); + frameAnimation->show(); + + QApplication::processEvents(); + QApplication::setOverrideCursor(Qt::WaitCursor); + + // ----- Test Internet Connection ----- // + + statusLabel->setText("Testing all known hosts, this may take a few minutes..."); + + m_logFile->clear(); + m_logFile->append("Checking internet connection..."); + + QFuture connectedState = QtConcurrent::run(getInternetConnectedState); + while(!connectedState.isFinished()) + { + QApplication::processEvents(QEventLoop::WaitForMoreEvents); + } + + if(!connectedState.result()) + { + m_logFile->append(QStringList() << "" << "Operating system reports that the computer is currently offline !!!"); + if(!retryButton->isVisible()) retryButton->show(); + if(!logButton->isVisible()) logButton->show(); + closeButton->setEnabled(true); + retryButton->setEnabled(true); + logButton->setEnabled(true); + if(frameAnimation->isVisible()) frameAnimation->hide(); + statusLabel->setText(tr("It appears that the computer currently is offline!")); + progressBar->setValue(progressBar->maximum()); + hintIcon->setPixmap(QIcon(":/icons/network_error.png").pixmap(16,16)); + hintLabel->setText(tr("Please make sure your computer is connected to the internet and try again.")); + hintIcon->show(); + hintLabel->show(); + LAMEXP_DELETE(m_updateInfo); + if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ERROR), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); + QApplication::restoreOverrideCursor(); + progressBar->setValue(progressBar->maximum()); + WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarErrorState); + WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/exclamation.png")); + return; + } + + // ----- Test Known Hosts Connectivity ----- // + + QStringList hostList; + for(int i = 0; known_hosts[i]; i++) + { + hostList << QString::fromLatin1(known_hosts[i]); + } + + int maxScore = hostList.count(); + while(!hostList.isEmpty()) + { + progressBar->setValue(progressBar->value() + 1); + QString currentHost = hostList.takeFirst(); + qDebug("Testing: %s", currentHost.toLatin1().constData()); + m_logFile->append(QStringList() << "" << "Testing host:" << currentHost << ""); + QString outFile = QString("%1/%2.htm").arg(lamexp_temp_folder2(), lamexp_rand_str()); + if(getFile(currentHost, outFile, 0)) + { + connectionScore++; + } + else + { + qWarning("Connectivity test failed on the following site:\n%s", currentHost.toLatin1().constData()); + } + QFile::remove(outFile); + } + + if(connectionScore < maxScore) + { + if(!retryButton->isVisible()) retryButton->show(); + if(!logButton->isVisible()) logButton->show(); + closeButton->setEnabled(true); + retryButton->setEnabled(true); + logButton->setEnabled(true); + if(frameAnimation->isVisible()) frameAnimation->hide(); + statusLabel->setText(tr("Network connectivity test has failed!")); + progressBar->setValue(progressBar->maximum()); + hintIcon->setPixmap(QIcon(":/icons/network_error.png").pixmap(16,16)); + hintLabel->setText(tr("Please make sure your internet connection is working properly and try again.")); + hintIcon->show(); + hintLabel->show(); + LAMEXP_DELETE(m_updateInfo); + if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ERROR), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); + QApplication::restoreOverrideCursor(); + progressBar->setValue(progressBar->maximum()); + WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarErrorState); + WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/exclamation.png")); + return; + } + + // ----- Done ----- // + + QApplication::restoreOverrideCursor(); + progressBar->setValue(progressBar->maximum()); + + statusLabel->setText("Test completed."); + hintIcon->setPixmap(QIcon(":/icons/shield_green.png").pixmap(16,16)); + hintLabel->setText("Congratulations, the test has completed."); + if(frameAnimation->isVisible()) frameAnimation->hide(); + hintIcon->show(); + hintLabel->show(); + WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/shield_green.png")); + MessageBeep(MB_ICONINFORMATION); + + closeButton->setEnabled(true); + if(retryButton->isVisible()) retryButton->hide(); + if(logButton->isVisible()) logButton->hide(); + if(frameAnimation->isVisible()) frameAnimation->hide(); +} diff --git a/src/Dialog_Update.h b/src/Dialog_Update.h index bdd7ebb9..364e0475 100644 --- a/src/Dialog_Update.h +++ b/src/Dialog_Update.h @@ -61,6 +61,7 @@ private: bool getFile(const QString &url, const QString &outFile, unsigned int maxRedir = 5); bool checkSignature(const QString &file, const QString &signature); bool parseVersionInfo(const QString &file, UpdateInfo *updateInfo); + void testKnownWebSites(void); UpdateInfo *m_updateInfo; QStringList *m_logFile;