From a96237e6b274ca07b6d6fd3c8b980048785b2187 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Mon, 26 Dec 2011 21:02:55 +0100 Subject: [PATCH] Some refactoring of the icon initialization code. --- etc/Translation/Blank.ts | 68 ++++++++++++++++++++++---------------------- etc/Translation/LameXP_PL.ts | 68 ++++++++++++++++++++++---------------------- etc/Translation/LameXP_UK.ts | 12 ++++---- src/Config.h | 2 +- src/Dialog_About.cpp | 2 +- src/Dialog_Processing.cpp | 4 +-- src/Global.cpp | 24 +++++++--------- src/Global.h | 3 ++ 8 files changed, 91 insertions(+), 92 deletions(-) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index e0e3ea02..e6c1f3c6 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -2694,141 +2694,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) @@ -2854,17 +2854,17 @@ - + 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 2000 or later. diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index 2bb87c85..d7e4c7fd 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -2694,141 +2694,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) @@ -2854,17 +2854,17 @@ 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'. - + Executable '%1' requires Windows 2000 or later. Plik wykonywalny '%1' wymaga do uruchomienia Windows 2000 lub nowszego. diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index 98ac9d99..afbe2c5c 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -222,11 +222,11 @@ dcaenc - dcaenc + Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL. - Всі права належать 2008-2011 Alexander E. Patrakov. Розповсюджується під ліцензією LGPL. + @@ -1728,11 +1728,11 @@ Skipping update check this time, please be patient... - Наразі йде переривання перевірки оновлень, будь ласка, зачекайте... + DCA Enc - DCA Enc + @@ -2048,7 +2048,7 @@ Analyzing - Аналізування + @@ -2221,7 +2221,7 @@ Executable '%1' was built for Qt '%2', but found Qt '%3'. - Додаток '%1' був створений для Qt '%2', але знайдено Qt '%3'. + diff --git a/src/Config.h b/src/Config.h index dc03962b..3ea80df1 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 12 -#define VER_LAMEXP_BUILD 844 +#define VER_LAMEXP_BUILD 845 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 8e47f89a..f36e8ddb 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -146,7 +146,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta aboutText += QString("%1
").arg(NOBR(tr("Special thanks go out to \"John33\" from %1 for his continuous support.")).arg(LINK("http://www.rarewares.org/"))); setText(aboutText); - setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); + setIconPixmap(lamexp_app_icon().pixmap(QSize(72,72))); setWindowTitle(tr("About LameXP")); if(firstStart) diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index c28fffb2..40f965f0 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -114,7 +114,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); //Update header icon - label_headerIcon->setPixmap(QApplication::windowIcon().pixmap(label_headerIcon->pixmap()->size())); + label_headerIcon->setPixmap(lamexp_app_icon().pixmap(label_headerIcon->size())); //Setup version info label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build())); @@ -549,7 +549,7 @@ void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index) } else { - MessageBeep(MB_ICONWARNING); + QMessageBox::information(this, windowTitle(), m_progressModel->data(m_progressModel->index(index.row(), 0)).toString()); } } else diff --git a/src/Global.cpp b/src/Global.cpp index 76f71458..cc590ca8 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -757,25 +757,28 @@ static bool lamexp_thanksgiving(const QDate &date) /* * Initialize app icon */ -static QIcon lamexp_init_icon(const QDate &date, const QTime &time) +QIcon lamexp_app_icon(const QDate *date, const QTime *time) { - if(lamexp_thanksgiving(date)) + QDate currentDate = (date) ? QDate(*date) : QDate::currentDate(); + QTime currentTime = (time) ? QTime(*time) : QTime::currentTime(); + + if(lamexp_thanksgiving(currentDate)) { return QIcon(":/MainIcon6.png"); } - else if(((date.month() == 12) && (date.day() == 31) && (time.hour() >= 20)) || ((date.month() == 1) && (date.day() == 1) && (time.hour() <= 19))) + else if(((currentDate.month() == 12) && (currentDate.day() == 31) && (currentTime.hour() >= 20)) || ((currentDate.month() == 1) && (currentDate.day() == 1) && (currentTime.hour() <= 19))) { return QIcon(":/MainIcon5.png"); } - else if(((date.month() == 10) && (date.day() == 31) && (time.hour() >= 12)) || ((date.month() == 11) && (date.day() == 1) && (time.hour() <= 11))) + else if(((currentDate.month() == 10) && (currentDate.day() == 31) && (currentTime.hour() >= 12)) || ((currentDate.month() == 11) && (currentDate.day() == 1) && (currentTime.hour() <= 11))) { return QIcon(":/MainIcon4.png"); } - else if((date.month() == 12) && (date.day() >= 24) && (date.day() <= 26)) + else if((currentDate.month() == 12) && (currentDate.day() >= 24) && (currentDate.day() <= 26)) { return QIcon(":/MainIcon3.png"); } - else if(lamexp_computus(date)) + else if(lamexp_computus(currentDate)) { return QIcon(":/MainIcon2.png"); } @@ -919,20 +922,13 @@ bool lamexp_init_qt(int argc, char* argv[]) ntdll.unload(); } - for(int test = 2000; test < 2031; test++) - { - lamexp_computus(QDate(test, 1, 1)); - } - //Create Qt application instance and setup version info - QDate date = QDate::currentDate(); - QTime time = QTime::currentTime(); QApplication *application = new QApplication(argc, argv); application->setApplicationName("LameXP - Audio Encoder Front-End"); application->setApplicationVersion(QString().sprintf("%d.%02d.%04d", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build())); application->setOrganizationName("LoRd_MuldeR"); application->setOrganizationDomain("mulder.at.gg"); - application->setWindowIcon(lamexp_init_icon(date, time)); + application->setWindowIcon(lamexp_app_icon()); //Set text Codec for locale QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); diff --git a/src/Global.h b/src/Global.h index 5e800279..fb20d623 100644 --- a/src/Global.h +++ b/src/Global.h @@ -37,6 +37,8 @@ class QString; class QStringList; class QDate; +class QTime; +class QIcon; class QWidget; class LockedFile; enum QtMsgType; @@ -108,6 +110,7 @@ lamexp_cpu_t lamexp_detect_cpu_features(int argc = 0, char **argv = NULL); bool lamexp_portable_mode(void); bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false); bool lamexp_is_hibernation_supported(void); +QIcon lamexp_app_icon(const QDate *date = NULL, const QTime *time = NULL); //Translation support QStringList lamexp_query_translations(void); -- 2.11.0