Some refactoring of the icon initialization code.

This commit is contained in:
LoRd_MuldeR 2011-12-26 21:02:55 +01:00
parent 6add306741
commit a96237e6b2
8 changed files with 91 additions and 92 deletions

View File

@ -2694,141 +2694,141 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="154"/>
<location filename="../../src/Dialog_Processing.cpp" line="157"/>
<source>Show details for selected job</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="155"/>
<location filename="../../src/Dialog_Processing.cpp" line="158"/>
<source>Browse Output File Location</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="173"/>
<location filename="../../src/Dialog_Processing.cpp" line="176"/>
<source>Encoding Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="173"/>
<location filename="../../src/Dialog_Processing.cpp" line="176"/>
<source>Your files are being encoded, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="335"/>
<location filename="../../src/Dialog_Processing.cpp" line="338"/>
<source>Encoding files, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="378"/>
<location filename="../../src/Dialog_Processing.cpp" line="381"/>
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="398"/>
<location filename="../../src/Dialog_Processing.cpp" line="401"/>
<source>Aborted! Waiting for running jobs to terminate...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="413"/>
<location filename="../../src/Dialog_Processing.cpp" line="416"/>
<source>Encoding: %1 files of %2 completed so far, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="441"/>
<location filename="../../src/Dialog_Processing.cpp" line="444"/>
<source>Creating the playlist file, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="451"/>
<location filename="../../src/Dialog_Processing.cpp" line="454"/>
<source>Process was aborted by the user after %1 file(s)!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="451"/>
<location filename="../../src/Dialog_Processing.cpp" line="454"/>
<source>Process was aborted prematurely by the user!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="452"/>
<location filename="../../src/Dialog_Processing.cpp" line="455"/>
<source>LameXP - Aborted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="452"/>
<location filename="../../src/Dialog_Processing.cpp" line="455"/>
<source>Process was aborted by the user.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="465"/>
<location filename="../../src/Dialog_Processing.cpp" line="468"/>
<source>Process finished after %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="474"/>
<location filename="../../src/Dialog_Processing.cpp" line="477"/>
<source>Error: %1 of %2 files failed. Double-click failed items for detailed information!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="475"/>
<location filename="../../src/Dialog_Processing.cpp" line="478"/>
<source>LameXP - Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="475"/>
<location filename="../../src/Dialog_Processing.cpp" line="478"/>
<source>At least one file has failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="485"/>
<location filename="../../src/Dialog_Processing.cpp" line="486"/>
<location filename="../../src/Dialog_Processing.cpp" line="488"/>
<location filename="../../src/Dialog_Processing.cpp" line="489"/>
<source>All files completed successfully.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="486"/>
<location filename="../../src/Dialog_Processing.cpp" line="489"/>
<source>LameXP - Done</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="900"/>
<location filename="../../src/Dialog_Processing.cpp" line="903"/>
<source>Playlist creation failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="900"/>
<location filename="../../src/Dialog_Processing.cpp" line="903"/>
<source>The playlist file could not be created:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="970"/>
<location filename="../../src/Dialog_Processing.cpp" line="973"/>
<source>Warning: Computer will shutdown in %1 seconds...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="974"/>
<location filename="../../src/Dialog_Processing.cpp" line="975"/>
<location filename="../../src/Dialog_Processing.cpp" line="977"/>
<location filename="../../src/Dialog_Processing.cpp" line="978"/>
<source>Cancel Shutdown</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1030"/>
<location filename="../../src/Dialog_Processing.cpp" line="1033"/>
<source>hour(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1031"/>
<location filename="../../src/Dialog_Processing.cpp" line="1035"/>
<location filename="../../src/Dialog_Processing.cpp" line="1034"/>
<location filename="../../src/Dialog_Processing.cpp" line="1038"/>
<source>minute(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1036"/>
<location filename="../../src/Dialog_Processing.cpp" line="1040"/>
<location filename="../../src/Dialog_Processing.cpp" line="1039"/>
<location filename="../../src/Dialog_Processing.cpp" line="1043"/>
<source>second(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1041"/>
<location filename="../../src/Dialog_Processing.cpp" line="1044"/>
<source>millisecond(s)</source>
<translation type="unfinished"></translation>
</message>
@ -2854,17 +2854,17 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="843"/>
<location filename="../../src/Global.cpp" line="871"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="848"/>
<location filename="../../src/Global.cpp" line="876"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="857"/>
<location filename="../../src/Global.cpp" line="885"/>
<source>Executable &apos;%1&apos; requires Windows 2000 or later.</source>
<translation type="unfinished"></translation>
</message>

View File

@ -2694,141 +2694,141 @@
<translation type="unfinished">Powrót</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="154"/>
<location filename="../../src/Dialog_Processing.cpp" line="157"/>
<source>Show details for selected job</source>
<translation type="unfinished">Pokaż szczegóły wybranego zadania</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="155"/>
<location filename="../../src/Dialog_Processing.cpp" line="158"/>
<source>Browse Output File Location</source>
<translation type="unfinished">Wybierz lokalizację dla plików wyjściowych</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="173"/>
<location filename="../../src/Dialog_Processing.cpp" line="176"/>
<source>Encoding Files</source>
<translation type="unfinished">Kompresowanie plików</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="173"/>
<location filename="../../src/Dialog_Processing.cpp" line="176"/>
<source>Your files are being encoded, please be patient...</source>
<translation type="unfinished">Twoje pliki właśnie kompresowane, prosze być cierpliwy...</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="335"/>
<location filename="../../src/Dialog_Processing.cpp" line="338"/>
<source>Encoding files, please wait...</source>
<translation type="unfinished">Kompresowanie plików, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="378"/>
<location filename="../../src/Dialog_Processing.cpp" line="381"/>
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
<translation type="unfinished">Wielowątkowosć włączona: Równolegle wykonywanych jest %1 kodowań!</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="398"/>
<location filename="../../src/Dialog_Processing.cpp" line="401"/>
<source>Aborted! Waiting for running jobs to terminate...</source>
<translation type="unfinished">Przerwano! Czekanie na wyłączenie procesu...</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="413"/>
<location filename="../../src/Dialog_Processing.cpp" line="416"/>
<source>Encoding: %1 files of %2 completed so far, please wait...</source>
<translation type="unfinished">Kompresja: Prosze czekać, jak dotąd wykonano %1 z %2 plików...</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="441"/>
<location filename="../../src/Dialog_Processing.cpp" line="444"/>
<source>Creating the playlist file, please wait...</source>
<translation type="unfinished">Tworzenie pliku playlisty, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="451"/>
<location filename="../../src/Dialog_Processing.cpp" line="454"/>
<source>Process was aborted by the user after %1 file(s)!</source>
<translation type="unfinished">Proces został przerwany przez użytkownika po wykonaniu %1 plików!</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="451"/>
<location filename="../../src/Dialog_Processing.cpp" line="454"/>
<source>Process was aborted prematurely by the user!</source>
<translation type="unfinished">Proces został przedwcześnie zakończony przez użytkownika!</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="452"/>
<location filename="../../src/Dialog_Processing.cpp" line="455"/>
<source>LameXP - Aborted</source>
<translation type="unfinished">LameXP - Przerwano</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="452"/>
<location filename="../../src/Dialog_Processing.cpp" line="455"/>
<source>Process was aborted by the user.</source>
<translation type="unfinished">Proces został przerwany przez użytkownika.</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="465"/>
<location filename="../../src/Dialog_Processing.cpp" line="468"/>
<source>Process finished after %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="474"/>
<location filename="../../src/Dialog_Processing.cpp" line="477"/>
<source>Error: %1 of %2 files failed. Double-click failed items for detailed information!</source>
<translation type="unfinished">Błąd: %1 z %2 plików nie zostało skompresowanych. Kliknij dwukrotnie na plik aby zobaczyć szczegóły!</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="475"/>
<location filename="../../src/Dialog_Processing.cpp" line="478"/>
<source>LameXP - Error</source>
<translation type="unfinished">LameXP - Błąd</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="475"/>
<location filename="../../src/Dialog_Processing.cpp" line="478"/>
<source>At least one file has failed!</source>
<translation type="unfinished">Przynajmniej jeden plik nie został skompresowany!</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="485"/>
<location filename="../../src/Dialog_Processing.cpp" line="486"/>
<location filename="../../src/Dialog_Processing.cpp" line="488"/>
<location filename="../../src/Dialog_Processing.cpp" line="489"/>
<source>All files completed successfully.</source>
<translation type="unfinished">Kompresja wszystkich plików zakończona powodzeniem.</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="486"/>
<location filename="../../src/Dialog_Processing.cpp" line="489"/>
<source>LameXP - Done</source>
<translation type="unfinished">LameXP - Zrobione</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="900"/>
<location filename="../../src/Dialog_Processing.cpp" line="903"/>
<source>Playlist creation failed</source>
<translation type="unfinished">Tworzenie playlisty zakończone niepowodzeniem</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="900"/>
<location filename="../../src/Dialog_Processing.cpp" line="903"/>
<source>The playlist file could not be created:</source>
<translation type="unfinished">Playlista nie mogła zostać utworzona:</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="970"/>
<location filename="../../src/Dialog_Processing.cpp" line="973"/>
<source>Warning: Computer will shutdown in %1 seconds...</source>
<translation type="unfinished">Ostrzeżenie: Komputer zostanie zamknięty za %1 sekund/y...</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="974"/>
<location filename="../../src/Dialog_Processing.cpp" line="975"/>
<location filename="../../src/Dialog_Processing.cpp" line="977"/>
<location filename="../../src/Dialog_Processing.cpp" line="978"/>
<source>Cancel Shutdown</source>
<translation type="unfinished">Anuluj wyłączenie komputera</translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1030"/>
<location filename="../../src/Dialog_Processing.cpp" line="1033"/>
<source>hour(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1031"/>
<location filename="../../src/Dialog_Processing.cpp" line="1035"/>
<location filename="../../src/Dialog_Processing.cpp" line="1034"/>
<location filename="../../src/Dialog_Processing.cpp" line="1038"/>
<source>minute(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1036"/>
<location filename="../../src/Dialog_Processing.cpp" line="1040"/>
<location filename="../../src/Dialog_Processing.cpp" line="1039"/>
<location filename="../../src/Dialog_Processing.cpp" line="1043"/>
<source>second(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Processing.cpp" line="1041"/>
<location filename="../../src/Dialog_Processing.cpp" line="1044"/>
<source>millisecond(s)</source>
<translation type="unfinished"></translation>
</message>
@ -2854,17 +2854,17 @@
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; nie działa w trybie kompatybilności z Windows.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="843"/>
<location filename="../../src/Global.cpp" line="871"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="848"/>
<location filename="../../src/Global.cpp" line="876"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Global.cpp" line="857"/>
<location filename="../../src/Global.cpp" line="885"/>
<source>Executable &apos;%1&apos; requires Windows 2000 or later.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga do uruchomienia Windows 2000 lub nowszego.</translation>
</message>

View File

@ -222,11 +222,11 @@
</message>
<message>
<source>dcaenc</source>
<translation>dcaenc</translation>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL.</source>
<translation>Всі права належать 2008-2011 Alexander E. Patrakov. Розповсюджується під ліцензією LGPL.</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -1728,11 +1728,11 @@
</message>
<message>
<source>Skipping update check this time, please be patient...</source>
<translation>Наразі йде переривання перевірки оновлень, будь ласка, зачекайте...</translation>
<translation type="unfinished"></translation>
</message>
<message>
<source>DCA Enc</source>
<translation>DCA Enc</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -2048,7 +2048,7 @@
</message>
<message>
<source>Analyzing</source>
<translation>Аналізування</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -2221,7 +2221,7 @@
</message>
<message>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation>Додаток &apos;%1&apos; був створений для Qt &apos;%2&apos;, але знайдено Qt &apos;%3&apos;.</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>

View File

@ -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!)

View File

@ -146,7 +146,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
aboutText += QString("%1<br>").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*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
setIconPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
setWindowTitle(tr("About LameXP"));
if(firstStart)

View File

@ -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

View File

@ -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"));

View File

@ -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);