diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 070dc78f..56d6c098 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -1755,7 +1755,7 @@ - + Access Denied @@ -1942,8 +1942,8 @@ - - + + Discard @@ -2158,9 +2158,9 @@ - - - + + + Yes @@ -2169,9 +2169,9 @@ - - - + + + No @@ -2268,321 +2268,321 @@ - - - + + + 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! - + Current Encoder: %1 - - + + Quality Level %1 - + Compression %1 - + Uncompressed - + Best Quality (Slow) - + High Quality (Recommended) - + Acceptable 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 - + %n Instance(s) - + Cannot write to the selected directory. Please choose another directory! - + Overwrite Mode - + Warning: This mode may overwrite existing files with no way to revert! - + Continue - + Revert - + Already Running - + LameXP is already running, please use the running instance! @@ -3290,22 +3290,22 @@ QApplication - + Executable '%1' doesn't support Windows compatibility mode. - + Executable '%1' requires Qt v%2, but found Qt v%3. - + Executable '%1' was built for Qt '%2', but found Qt '%3'. - + Executable '%1' requires Windows XP or later. diff --git a/etc/Translation/LameXP_EN.ts b/etc/Translation/LameXP_EN.ts index 8ef4aac2..8e476cbf 100644 --- a/etc/Translation/LameXP_EN.ts +++ b/etc/Translation/LameXP_EN.ts @@ -63,7 +63,7 @@ - + %n Instance(s) %n Instance diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index 9e2128ca..864713c8 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -1762,7 +1762,7 @@ - + Access Denied Dostęp zablokowany @@ -1891,8 +1891,8 @@ - - + + Discard Zamknij @@ -2173,9 +2173,9 @@ - - - + + + Yes Tak @@ -2184,9 +2184,9 @@ - - - + + + No Nie @@ -2283,284 +2283,284 @@ 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 Zapisz plik CSV - - - - + + + + CSV File Plik CSV - - - + + + CSV Export Eksportowanie CSV - + Sorry, there are no meta tags that can be exported! Nie ma żadnych tagów, które można eksportować! - + Sorry, failed to open CSV file for writing! Nie można otworzyć pliku CSV aby go zapisać! - + Sorry, failed to write to the CSV file! Nie można zapisać do pliku CSV! - + The CSV files was created successfully! Pliki CSV utworzone pomyślnie! - - + + Open CSV file Otwórz plik CSV - + Sorry, failed to open CSV file for reading! Nie można otworzyć pliku CSV aby go wczytać! - - - + + + CSV Import Importowanie CSV - + Sorry, failed to read from the CSV file! Próba odczytania pliku CSV zakończona niepowodzeniem! - + Sorry, the CSV file does not contain any known fields! Plik CSV nie zawiera żadnych znanych pól! - + CSV file is incomplete. Not all files were updated! Plik CSV nie jest kompletny. Nie wszystkie pliki zostały zaktualizowane! - + The CSV files was imported successfully! Pliki CSV zaimportowano pomyślnie! - - + + 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 (Slow) Najlepsza jakość (Powoli) - + Acceptable Quality (Fast) Akceptowalna jakość (Szybko) - + High Quality (Recommended) Wysoka jakość (Zalecane) - + Current Encoder: %1 - + 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 - + %n Instance(s) %n wątek @@ -2569,37 +2569,37 @@ - + Cannot write to the selected directory. Please choose another directory! Nie można zapisać do wybranej lokalizacji. Prosze wybierz inną lokalizację! - + Overwrite Mode Tryb nadpisywania - + Warning: This mode may overwrite existing files with no way to revert! Ostrzeżenie: W tym trybie istniejące pliki będą nadpisywane bez możliwości ich odzyskania! - + Continue Kontynuuj - + Revert Cofnij - + Already Running Już działa - + LameXP is already running, please use the running instance! LameXP już działa, przejdź do działającego procesu! @@ -3327,22 +3327,22 @@ QApplication - + Executable '%1' doesn't support Windows compatibility mode. Plik wykonywalny '%1' nie działa w trybie kompatybilności z Windows. - + Executable '%1' requires Qt v%2, but found Qt v%3. Plik wykonywalny '%1' wymaga Qt v%2, znaleziono jednak Qt v%3. - + Executable '%1' was built for Qt '%2', but found Qt '%3'. Plik wykonywalny "%1" został skompilowany dla Qt "%2", znaleziono "%3". - + Executable '%1' requires Windows XP or later. diff --git a/etc/Translation/LameXP_SV.ts b/etc/Translation/LameXP_SV.ts index c6dd1c9d..5e8e8173 100644 --- a/etc/Translation/LameXP_SV.ts +++ b/etc/Translation/LameXP_SV.ts @@ -1759,7 +1759,7 @@ - + Access Denied Åtkomst nekad @@ -1950,8 +1950,8 @@ - - + + Discard Stäng @@ -2166,9 +2166,9 @@ - - - + + + Yes Ja @@ -2177,9 +2177,9 @@ - - - + + + No Nej @@ -2276,284 +2276,284 @@ Cue-fil - - - + + + Beta Updates Beta-uppdateringar - + Do you really want LameXP to check for Beta (pre-release) updates? Vill du verkligen att LameXP skall söka efter beta-uppdateringar? - + LameXP will check for Beta (pre-release) updates from now on. LameXP kommer i fortsättningen att söka efter beta-uppdatyeringar. - + Check Now Sök nu - + LameXP will <i>not</i> check for Beta (pre-release) updates from now on. LameXP kommer i fortsättningen <i>inte</i> att söka efter beta-uppdateringar. - - - + + + Hibernate Computer Viloläge - + Do you really want the computer to be hibernated on shutdown? Vill du verkligen att datorn skall försättas i viloläge vid avslut? - + LameXP will hibernate the computer on shutdown from now on. LameXP kommer i fortsättningen att försätta datorn i viloläge vid avslut. - + LameXP will <i>not</i> hibernate the computer on shutdown from now on. LameXP kommer i fortsättningen <i>inte</i> att försätta datorn i viloläge vid avslut. - - - + + + Shell Integration Utforskarintegrering - + Do you really want to disable the LameXP shell integration? Vill du verkligen inaktivera LameXPs utforskarintegration? - + The LameXP shell integration has been disabled. LameXPs utforskarintegration har inaktiverats. - + The LameXP shell integration has been re-enabled. LameXPs utforskarintegration har återaktiverats. - + Add file(s) Lägg till fil(er) - - + + Add Folder Lägg till mapp - - + + Save CSV file Spara CSV-fil - - - - + + + + CSV File CSV-fil - - - + + + CSV Export CSV-export - + Sorry, there are no meta tags that can be exported! Det finns ingen meta-data som kan exporteras! - + Sorry, failed to open CSV file for writing! Kunde inte öppna CSV-filen för skrivning! - + Sorry, failed to write to the CSV file! Kunde inte skriva till CSV-filen! - + The CSV files was created successfully! CSV-filen skapades korrekt! - - + + Open CSV file Öppna CSV-fil - - - + + + CSV Import CSV-import - + Sorry, failed to open CSV file for reading! Kunde inte öppna CSV-filen för läsning! - + Sorry, failed to read from the CSV file! Kunde inte läsa från CSV-filen! - + Sorry, the CSV file does not contain any known fields! CSV-filen innehåller inga kända fält! - + CSV file is incomplete. Not all files were updated! CSV-filen är inte komplett. Alla filer uppdaterades inte! - + The CSV files was imported successfully! CSV-filen importerades korrekt! - - + + New Folder Ny mapp - + Enter the name of the new folder: Namn på den nya mappen: - + Failed to create folder Kunde inte skapa någon mapp - + The new folder could not be created: Den nya mappen kunde inte skapas: - + Drive is read-only or insufficient access rights! Diskenheten är skrivskyddad eller åtkomsträttigheter saknas! - - + + Quality Level %1 Kvallitetsnivå %1 - + Compression %1 Kompression %1 - + Uncompressed Okomprimerad - + Best Quality (Slow) Bäst kvalitet (Långsam) - + Acceptable Quality (Fast) Acceptabel kvalitet (Snabb) - + High Quality (Recommended) Hög kvallitet (rekommenderas) - + Current Encoder: %1 - + Poor Quality (Very Fast) Dålig kvallitet (mycket snabb) - + File name without extension Filnamn utan filtillägg - + Track number with leading zero Spårnummer med inledande nolla - + Track title Spårtitel - + Artist name Artistnamn - + Album name Albumnamn - + Year with (at least) four digits Årtal med (minst) fyra siffror - + Comment Kommentar - + Characters forbidden in file names: Förbjudna tecken i filnamn: - + Rename Macros Namnändra macron - + %n Instance(s) %n instans @@ -2561,37 +2561,37 @@ - + Cannot write to the selected directory. Please choose another directory! Kan inte skriva till den specificerade mappen. Välj en annan destination! - + Overwrite Mode Överskrivningsläge - + Warning: This mode may overwrite existing files with no way to revert! Varning! Det här läget kan skriva över befintliga filer, utan möjlighet att återskapa! - + Continue Fortsätt - + Revert Återställ - + Already Running Körs redan - + LameXP is already running, please use the running instance! LameXP körs redan, använd den redan startade instansen! @@ -3310,22 +3310,22 @@ QApplication - + Executable '%1' doesn't support Windows compatibility mode. EXE-filen '%1' stöder inte Windows kompatibilitetsläge. - + Executable '%1' requires Qt v%2, but found Qt v%3. EXE-filen '%1' kräver Qt v%2, du har Qt v%3. - + Executable '%1' was built for Qt '%2', but found Qt '%3'. EXE-filen '%1' är byggd för Qt '%2', du har Qt '%3'. - + Executable '%1' requires Windows XP or later. diff --git a/src/Config.h b/src/Config.h index 35cee53e..b61a47ee 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 4 -#define VER_LAMEXP_BUILD 1420 +#define VER_LAMEXP_BUILD 1424 #define VER_LAMEXP_CONFG 1348 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 4cb7d7d8..7ef6c9b4 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -1962,6 +1962,15 @@ void MainWindow::importCueSheetActionTriggered(bool checked) LAMEXP_DELETE(cueImporter); } + if(result == QDialog::Accepted) + { + qApp->processEvents(QEventLoop::ExcludeUserInputEvents); + ui->sourceFileView->update(); + qApp->processEvents(QEventLoop::ExcludeUserInputEvents); + ui->sourceFileView->scrollToBottom(); + qApp->processEvents(QEventLoop::ExcludeUserInputEvents); + } + if(result != (-1)) break; } ); diff --git a/src/Global.cpp b/src/Global.cpp index c8dc2fad..1f2f5e57 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -103,6 +103,28 @@ Q_IMPORT_PLUGIN(QICOPlugin) #define _LAMEXP_MAKE_STR(STR) #STR #define LAMEXP_MAKE_STR(STR) _LAMEXP_MAKE_STR(STR) +//String helper +#define CLEAN_OUTPUT_STRING(STR) do \ +{ \ + const char CTRL_CHARS[3] = { '\r', '\n', '\t' }; \ + for(size_t i = 0; i < 3; i++) \ + { \ + while(char *pos = strchr((STR), CTRL_CHARS[i])) *pos = char(0x20); \ + } \ +} \ +while(0) + +//String helper +#define TRIM_LEFT(STR) do \ +{ \ + const char WHITE_SPACE[4] = { char(0x20), '\r', '\n', '\t' }; \ + for(size_t i = 0; i < 4; i++) \ + { \ + while(*(STR) == WHITE_SPACE[i]) (STR)++; \ + } \ +} \ +while(0) + /////////////////////////////////////////////////////////////////////////////// // TYPES /////////////////////////////////////////////////////////////////////////////// @@ -301,6 +323,9 @@ const lamexp_os_version_t lamexp_winver_win70 = {6,1}; const lamexp_os_version_t lamexp_winver_win80 = {6,2}; const lamexp_os_version_t lamexp_winver_win81 = {6,3}; +//GURU MEDITATION +static const char *GURU_MEDITATION = "\n\nGURU MEDITATION !!!\n\n"; + /////////////////////////////////////////////////////////////////////////////// // COMPILER INFO /////////////////////////////////////////////////////////////////////////////// @@ -685,77 +710,152 @@ static void lamexp_console_color(FILE* file, WORD attributes) } /* - * Qt message handler + * Output logging message to console */ -void lamexp_message_handler(QtMsgType type, const char *msg) -{ - static const char *GURU_MEDITATION = "\n\nGURU MEDITATION !!!\n\n"; - - if(msg == NULL) return; - - QMutexLocker lock(&g_lamexp_message_mutex); - - if(g_lamexp_log_file) +static void lamexp_write_console(const int type, const char *msg) +{ + __try { - static char prefix[] = "DWCF"; - int index = qBound(0, static_cast(type), 3); - unsigned int timestamp = static_cast(_time64(NULL) % 3600I64); - QString str = QString::fromUtf8(msg).trimmed().replace('\n', '\t'); - fprintf(g_lamexp_log_file, "[%c][%04u] %s\r\n", prefix[index], timestamp, QUTF8(str)); - fflush(g_lamexp_log_file); - } - - if(g_lamexp_console_attached) - { - UINT oldOutputCP = GetConsoleOutputCP(); - if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(CP_UTF8); - - switch(type) + if(_isatty(_fileno(stderr))) { - case QtCriticalMsg: - case QtFatalMsg: - fflush(stdout); - fflush(stderr); - lamexp_console_color(stderr, FOREGROUND_RED | FOREGROUND_INTENSITY); - fprintf(stderr, GURU_MEDITATION); - fprintf(stderr, "%s\n", msg); - fflush(stderr); - break; - case QtWarningMsg: - lamexp_console_color(stderr, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); - fprintf(stderr, "%s\n", msg); - fflush(stderr); - break; - default: - lamexp_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); - fprintf(stderr, "%s\n", msg); - fflush(stderr); - break; - } + UINT oldOutputCP = GetConsoleOutputCP(); + if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(CP_UTF8); + + switch(type) + { + case QtCriticalMsg: + case QtFatalMsg: + lamexp_console_color(stderr, FOREGROUND_RED | FOREGROUND_INTENSITY); + fprintf(stderr, GURU_MEDITATION); + fprintf(stderr, "%s\n", msg); + fflush(stderr); + break; + case QtWarningMsg: + lamexp_console_color(stderr, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); + fprintf(stderr, "%s\n", msg); + fflush(stderr); + break; + default: + lamexp_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); + fprintf(stderr, "%s\n", msg); + fflush(stderr); + break; + } - lamexp_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED); - if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(oldOutputCP); + lamexp_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED); + if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(oldOutputCP); + } } - else + __except(1) { - QString temp("[LameXP][%1] %2"); + /*ignore any exception that might occur here!*/ + } +} + +/* + * Output logging message to debugger + */ +static void lamexp_write_dbg_out(const int type, const char *msg) +{ + const char *FORMAT = "[LameXP][%c] %s\n"; + + __try + { + char buffer[512]; + const char* input = msg; + TRIM_LEFT(input); switch(type) { case QtCriticalMsg: case QtFatalMsg: - temp = temp.arg("C", QString::fromUtf8(msg)); + _snprintf_s(buffer, 512, _TRUNCATE, FORMAT, 'C', input); break; case QtWarningMsg: - temp = temp.arg("W", QString::fromUtf8(msg)); + _snprintf_s(buffer, 512, _TRUNCATE, FORMAT, 'W', input); break; default: - temp = temp.arg("I", QString::fromUtf8(msg)); + _snprintf_s(buffer, 512, _TRUNCATE, FORMAT, 'I', input); break; } - temp.replace("\n", "\t").append("\n"); - OutputDebugStringA(temp.toLatin1().constData()); + char *temp = &buffer[0]; + CLEAN_OUTPUT_STRING(temp); + OutputDebugStringA(temp); + } + __except(1) + { + /*ignore any exception that might occur here!*/ + } +} + +/* + * Output logging message to logfile + */ +static void lamexp_write_logfile(const int type, const char *msg) +{ + const char *FORMAT = "[%c][%04u] %s\r\n"; + + __try + { + if(g_lamexp_log_file) + { + char buffer[512]; + strncpy_s(buffer, 512, msg, _TRUNCATE); + + char *temp = &buffer[0]; + TRIM_LEFT(temp); + CLEAN_OUTPUT_STRING(temp); + + const unsigned int timestamp = static_cast(_time64(NULL) % 3600I64); + + switch(type) + { + case QtCriticalMsg: + case QtFatalMsg: + fprintf(g_lamexp_log_file, FORMAT, 'C', timestamp, temp); + break; + case QtWarningMsg: + fprintf(g_lamexp_log_file, FORMAT, 'W', timestamp, temp); + break; + default: + fprintf(g_lamexp_log_file, FORMAT, 'I', timestamp, temp); + break; + } + + fflush(g_lamexp_log_file); + } + } + __except(1) + { + /*ignore any exception that might occur here!*/ + } +} + +/* + * Qt message handler + */ +void lamexp_message_handler(QtMsgType type, const char *msg) +{ + if((!msg) || (!(msg[0]))) + { + return; + } + + QMutexLocker lock(&g_lamexp_message_mutex); + + if(g_lamexp_log_file) + { + lamexp_write_logfile(type, msg); + } + + if(g_lamexp_console_attached) + { + lamexp_write_console(type, msg); + } + else + { + lamexp_write_dbg_out(type, msg); } if((type == QtCriticalMsg) || (type == QtFatalMsg)) @@ -783,7 +883,7 @@ void lamexp_init_console(const QStringList &argv) FILE *temp = NULL; if(!_wfopen_s(&temp, logfile, L"wb")) { - fprintf(temp, "%c%c%c", 0xEF, 0xBB, 0xBF); + fprintf(temp, "%c%c%c", char(0xEF), char(0xBB), char(0xBF)); g_lamexp_log_file = temp; } free(logfile); @@ -993,7 +1093,7 @@ static unsigned int __stdcall lamexp_debug_thread_proc(LPVOID lpParameter) { while(!lamexp_check_for_debugger()) { - Sleep(250); + Sleep(1250); } lamexp_fatal_exit(L"Not a debug build. Please unload debugger and try again!"); return 666;