From 7d95f114a22adfab067f9cd78dc8a5caadb5f9ea Mon Sep 17 00:00:00 2001 From: lordmulder Date: Tue, 24 Jan 2012 02:46:29 +0100 Subject: [PATCH] Try to keep the window of the Web Updater tool focused. --- etc/Translation/Blank.ts | 351 +++++++++++++++++++++---------------------- etc/Translation/LameXP_PL.ts | 351 +++++++++++++++++++++---------------------- src/Config.h | 2 +- src/Dialog_Update.cpp | 39 ++++- src/Dialog_Update.h | 10 +- 5 files changed, 393 insertions(+), 360 deletions(-) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 11966b21..01dbf1d0 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -1475,13 +1475,13 @@ - + Disable Update Reminder - + Disable Sound Effects @@ -1567,7 +1567,7 @@ - + Access Denied @@ -1730,10 +1730,9 @@ - - - - + + + Discard @@ -1755,7 +1754,7 @@ - + Ignore @@ -1766,8 +1765,8 @@ - - + + Update Reminder @@ -1842,521 +1841,521 @@ - - - + + + LameXP - + You must add at least one file to the list before proceeding! - + Not Found - + Your currently selected TEMP folder does not exist anymore: - + Restore Default - + Cancel - + There are less than %1 GB of free diskspace available on your system's TEMP folder. - + It is highly recommend to free up more diskspace before proceeding with the encode! - + Your TEMP folder is located at: - + Low Diskspace Warning - + Abort Encoding Process - + Clean Disk Now - + Low Diskspace - + You are proceeding with low diskspace. Problems might occur! - + Sorry, an unsupported encoder has been chosen! - + Cannot write to the selected output directory. - + Please choose a different directory! - + Load Translation - + Translation Files - + Do you really want to disable the update reminder? - - - - - - - + + + + + + + Yes - - - - - - - + + + + + + + No - + The update reminder has been disabled. - + Please remember to check for updates at regular intervals! - + The update reminder has been re-enabled. - + Do you really want to disable all sound effects? - - + + Sound Effects - + All sound effects have been disabled. - + The sound effects have been re-enabled. - - - + + + Nero AAC Notifications - + Do you really want to disable all Nero AAC Encoder notifications? - + All Nero AAC Encoder notifications have been disabled. - + The Nero AAC Encoder notifications have been re-enabled. - - - + + + Slow Startup Notifications - + Do you really want to disable the slow startup notifications? - + The slow startup notifications have been disabled. - + The slow startup notifications have been re-enabled. - - + + Open Cue Sheet - - + + Cue Sheet File - - - + + + Beta Updates - + Do you really want LameXP to check for Beta (pre-release) updates? - + LameXP will check for Beta (pre-release) updates from now on. - + Check Now - + LameXP will <i>not</i> check for Beta (pre-release) updates from now on. - - - + + + Hibernate Computer - + Do you really want the computer to be hibernated on shutdown? - + LameXP will hibernate the computer on shutdown from now on. - + LameXP will <i>not</i> hibernate the computer on shutdown from now on. - - - + + + Shell Integration - + Do you really want to disable the LameXP shell integration? - + The LameXP shell integration has been disabled. - + The LameXP shell integration has been re-enabled. - - + + Add file(s) - - + + Add Folder - - + + Save CSV file - - - - + + + + CSV File - - - - + + + + CSV Export - + Sorry, there are no meta tags that can be exported! - + Sorry, failed to open CSV file for writing! - + Sorry, failed to write to the CSV file! - + The CSV files was created successfully! - - + + Open CSV file - - - - - + + + + + CSV Import - + Sorry, failed to open CSV file for reading! - + Sorry, failed to read from the CSV file! - + Sorry, the CSV file does not contain any known fields! - + CSV file is incomplete. Not all files were updated! - + The CSV files was imported successfully! - - + + New Folder - + Enter the name of the new folder: - + Failed to create folder - + The new folder could not be created: - + Drive is read-only or insufficient access rights! - - - - + + + + Quality Level %1 - - - + + + Compression %1 - - - + + + Uncompressed - + Best Quality (Very Slow) - + High Quality (Recommended) - + Average Quality (Default) - + Low Quality (Fast) - + Poor Quality (Very Fast) - + File name without extension - + Track number with leading zero - + Track title - + Artist name - + Album name - + Year with (at least) four digits - + Comment - + Characters forbidden in file names: - + Rename Macros - + %1 Instance(s) - + Cannot write to the selected directory. Please choose another directory! - + Already Running - + LameXP is already running, please use the running instance! @@ -3045,105 +3044,105 @@ - - + + 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 602565cf..81472257 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -1475,13 +1475,13 @@ - + Disable Update Reminder Wyłącz przypominanie o aktualizacji - + Disable Sound Effects Wyłącz efekty dźwiękowe @@ -1567,7 +1567,7 @@ - + Access Denied Dostęp zablokowany @@ -1715,10 +1715,9 @@ - - - - + + + Discard Zamknij @@ -1740,8 +1739,8 @@ - - + + Update Reminder Powiadomienie aktualizacji @@ -1811,44 +1810,44 @@ Wsparcie dla AAC wyłączone - - - + + + LameXP LameXP - + You must add at least one file to the list before proceeding! Powinienieś dodać przynajmniej jeden plik do listy aby zacząć działać! - + Not Found Nie znaleziono - + Your currently selected TEMP folder does not exist anymore: Wybrany przez Ciebie folder tymczasowy TEMP już nie istnieje: - + Restore Default Przywróć domyślne - + Cancel Anuluj - + Low Diskspace Warning Ostrzeżenie o małej ilości miejsca na dysku - + There are less than %1 GB of free diskspace available on your system's TEMP folder. Jest mniej niż %1 GB dostępnego miejsca w systemowym folderze TEMP. @@ -1863,28 +1862,28 @@ (Podpowiedź: Zignoruj nazwę pobranego pliku ZIP, w zamian sprawdż załączony w archiwum plik "changelog.txt"!) - + It is highly recommend to free up more diskspace before proceeding with the encode! Jest wysoce zalecane zwolnić miejsce na dysku zanim zaczniesz kompresję! - + Your TEMP folder is located at: Twój folder TEMP znajduję się: - + Abort Encoding Process Przerwij proces kompresji - + Clean Disk Now Wykonaj oczyszczanie dysku - + Ignore Ignoruj @@ -1904,459 +1903,459 @@ Pomijanie sprawdzania aktualizacji, prosze czekać... - + Low Diskspace Mało miejsca na dysku - + You are proceeding with low diskspace. Problems might occur! Chcesz zacząć działać z małą ilością miejsca na dysku. Mogą wystąpić problemy! - + Sorry, an unsupported encoder has been chosen! Został wybrany koder, który nie jest wspierany! - + Cannot write to the selected output directory. Nie można zapisać do wybranej lokalizacji. - + Please choose a different directory! Prosze wybrać inną lokalizację! - + Load Translation Zaladuj plik językowy - + Translation Files Pliki językowe - + Do you really want to disable the update reminder? Czy na pewno chcesz wyłączyć przypominanie o aktualizacjach? - - - - - - - + + + + + + + Yes Tak - - - - - - - + + + + + + + No Nie - + The update reminder has been disabled. Przypominanie o aktualizacjach wyłączone. - + Please remember to check for updates at regular intervals! Prosze pamiętać o okresowym sprawdzaniu aktualizacji! - + The update reminder has been re-enabled. Przypominanie o aktualizacjach ponownie włączone. - + Do you really want to disable all sound effects? Czy na pewno chcesz wyłączyć wszystkie dźwiękowe? - - + + Sound Effects Efekty dźwiękowe - + All sound effects have been disabled. Wszystkie efekty dźwiękowe zostały wyłączone. - + The sound effects have been re-enabled. Efekty dźwiękowe zostały ponownie włączone. - - - + + + Nero AAC Notifications Powiadomienia Nero AAC - + Do you really want to disable all Nero AAC Encoder notifications? Czy na pewno chcesz wyłączyć wszystkie powiadomienia Nero AAC? - + All Nero AAC Encoder notifications have been disabled. Wszystkie powiadomienia kodera Nero AAC zostały wyłączone. - + The Nero AAC Encoder notifications have been re-enabled. Powiadomienia Nero AAC zostały ponownie włączone. - - - + + + Slow Startup Notifications Powiadomienia o powolnym starcie - + Do you really want to disable the slow startup notifications? Czy na pewno chcesz wyłączyć powiadomienia o powolnym starcie? - + The slow startup notifications have been disabled. Powiadomienia o powolnym starcie zostały wyłączone. - + The slow startup notifications have been re-enabled. Powiadomienia o powolnym starcie zostały ponownie włączone. - - + + Open Cue Sheet Otwórz plik Cue Sheet - - + + Cue Sheet File Plik Cue Sheet - - - + + + Beta Updates Aktualizacje Beta - + Do you really want LameXP to check for Beta (pre-release) updates? Czy na pewno chcesz aby LameXP sprawdzał aktualizacje Beta? - + LameXP will check for Beta (pre-release) updates from now on. Od teraz LameXP będzie sprawdzał aktualizacje Beta. - + Check Now Sprawdź teraz - + LameXP will <i>not</i> check for Beta (pre-release) updates from now on. LameXP od teraz <i>nie będzie</i> sprawdzał aktualizacji Beta. - - - + + + Hibernate Computer Hibernuj komputer - + Do you really want the computer to be hibernated on shutdown? Czy na pewno chcesz aby komputer był hibernowany zamiast zamykany? - + LameXP will hibernate the computer on shutdown from now on. Od teraz LameXP będzie hibernował komputer zamiast zamykać. - + LameXP will <i>not</i> hibernate the computer on shutdown from now on. LameXP od teraz <i>nie</i> będzie hibernował komputera tylko zamykał. - - - + + + Shell Integration Integracja z systemem - + Do you really want to disable the LameXP shell integration? Czy na pewno chcesz wyłączyć integrację LameXP z systemem? - + The LameXP shell integration has been disabled. Integracja LameXP z systemem zostałą wyłączona. - + The LameXP shell integration has been re-enabled. Integracja LameXP z systemem została ponownie włączona. - - + + Add file(s) Dodaj plik(i) - - + + Add Folder Dodaj folder - - + + Save CSV file - - - - + + + + CSV File - - - - + + + + CSV Export - + Sorry, there are no meta tags that can be exported! - + Sorry, failed to open CSV file for writing! - + Sorry, failed to write to the CSV file! - + The CSV files was created successfully! - - + + Open CSV file - + Sorry, failed to open CSV file for reading! - - - - - + + + + + CSV Import - + Sorry, failed to read from the CSV file! - + Sorry, the CSV file does not contain any known fields! - + CSV file is incomplete. Not all files were updated! - + The CSV files was imported successfully! - - + + New Folder Nowy folder - + Enter the name of the new folder: Wprowadź nazwę nowego folderu: - + Failed to create folder Utworzenie folderu zakończone niepowodzeniem - + The new folder could not be created: Nowy folder nie mógł zostać stworzony: - + Drive is read-only or insufficient access rights! Dysk tylko do odczytu lub brak praw dostępu! - - - - + + + + Quality Level %1 Poziom jakości %1 - - - + + + Compression %1 Kompresja %1 - - - + + + Uncompressed Nieskompresowany - + Best Quality (Very Slow) Najlepsza jakość (Bardzo wolno) - + High Quality (Recommended) Wysoka jakość (Zalecane) - + Average Quality (Default) Średnia jakość (Domyślnie) - + Low Quality (Fast) Niska jakość (Szybko) - + Poor Quality (Very Fast) Najniższa jakość (Bardzo szybko) - + File name without extension Nazwa pliku bez rozszerzenia - + Track number with leading zero Numer ścieżki z zerem na początku - + Track title Nazwa ścieżki - + Artist name Nazwa Artysty - + Album name Nazwa Albumu - + Year with (at least) four digits Rok z (przynajmniej) czterema cyframi - + Comment Komentarz - + Characters forbidden in file names: Zabronione znaki w nazwach plików: - + Rename Macros Zmień nazwy makr - + %1 Instance(s) %1 wątek/ki - + Cannot write to the selected directory. Please choose another directory! Nie można zapisać do wybranej lokalizacji. Prosze wybierz inną lokalizację! - + Already Running Już działa - + LameXP is already running, please use the running instance! LameXP już działa, przejdź do działającego programu! @@ -3045,105 +3044,105 @@ Zamknij - - + + Build Build - + Unknown Nieznana - + 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 c0fb917d..18e1f0b6 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 16 -#define VER_LAMEXP_BUILD 881 +#define VER_LAMEXP_BUILD 882 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_Update.cpp b/src/Dialog_Update.cpp index ee6fcf8d..cb97b175 100644 --- a/src/Dialog_Update.cpp +++ b/src/Dialog_Update.cpp @@ -153,6 +153,21 @@ static BOOL getInternetConnectedState(void) return result; } +static BOOL CALLBACK focusUpdaterWindow(HWND hwnd, LPARAM lParam) +{ + DWORD processId = *reinterpret_cast(lParam); + DWORD windowProcessId = NULL; + GetWindowThreadProcessId(hwnd, &windowProcessId); + if(windowProcessId == processId) + { + SwitchToThisWindow(hwnd, TRUE); + SetForegroundWindow(hwnd); + return FALSE; + } + + return TRUE; +} + /////////////////////////////////////////////////////////////////////////////// class UpdateInfo @@ -192,7 +207,8 @@ UpdateDialog::UpdateDialog(SettingsModel *settings, QWidget *parent) m_logFile(new QStringList()), m_betaUpdates(settings ? (settings->autoUpdateCheckBeta() || lamexp_version_demo()) : lamexp_version_demo()), m_success(false), - m_updateReadyToInstall(false) + m_updateReadyToInstall(false), + m_updaterProcess(NULL) { if(m_binaryWGet.isEmpty() || m_binaryGnuPG.isEmpty() || m_binaryUpdater.isEmpty() || m_binaryKeys.isEmpty()) { @@ -265,6 +281,8 @@ void UpdateDialog::showEvent(QShowEvent *event) progressBar->setMaximum(counter); progressBar->setValue(0); + m_updaterProcess = NULL; + QTimer::singleShot(0, this, SLOT(updateInit())); } @@ -301,6 +319,15 @@ void UpdateDialog::keyPressEvent(QKeyEvent *e) } } +bool UpdateDialog::event(QEvent *e) +{ + if((e->type() == QEvent::ActivationChange) && (m_updaterProcess != NULL)) + { + EnumWindows(focusUpdaterWindow, reinterpret_cast(&m_updaterProcess)); + } + return QDialog::event(e); +} + bool UpdateDialog::winEvent(MSG *message, long *result) { return WinSevenTaskbar::handleWinEvent(message, result); @@ -857,7 +884,13 @@ void UpdateDialog::applyUpdate(void) WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/transmit_blue.png")); process.start(m_binaryUpdater, args); - loop.exec(); + bool updateStarted = process.waitForStarted(); + if(updateStarted) + { + m_updaterProcess = process.pid()->dwProcessId; + loop.exec(); + } + m_updaterProcess = NULL; QApplication::restoreOverrideCursor(); hintLabel->show(); @@ -866,7 +899,7 @@ void UpdateDialog::applyUpdate(void) progressBar->setValue(oldMax); frameAnimation->hide(); - if(process.exitCode() == 0) + if(updateStarted && (process.exitCode() == 0)) { statusLabel->setText(tr("Update ready to install. Applicaion will quit...")); m_updateReadyToInstall = true; diff --git a/src/Dialog_Update.h b/src/Dialog_Update.h index 75413149..d0ac48ac 100644 --- a/src/Dialog_Update.h +++ b/src/Dialog_Update.h @@ -49,10 +49,11 @@ private slots: void progressBarValueChanged(int value); protected: - void showEvent(QShowEvent *event); - void closeEvent(QCloseEvent *event); - void keyPressEvent(QKeyEvent *e); - bool winEvent(MSG *message, long *result); + virtual void showEvent(QShowEvent *event); + virtual void closeEvent(QCloseEvent *event); + virtual void keyPressEvent(QKeyEvent *e); + virtual bool winEvent(MSG *message, long *result); + virtual bool event(QEvent *e); const bool m_betaUpdates; @@ -72,6 +73,7 @@ private: const QString m_binaryGnuPG; const QString m_binaryUpdater; const QString m_binaryKeys; + unsigned long m_updaterProcess; bool m_success; bool m_updateReadyToInstall; -- 2.11.0