From 187f1bbfb86d80ebbb3f704c886606b261151a57 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Thu, 4 Dec 2014 22:59:30 +0100 Subject: [PATCH] Moved set_window_icon() function into MUtilities function. --- src/Config.h | 2 +- src/Dialog_MainWindow.cpp | 10 +--------- src/Dialog_MainWindow.h | 1 - src/Dialog_Processing.cpp | 9 +-------- src/Dialog_Processing.h | 1 - src/Global.h | 5 ----- src/Global_Version.cpp | 12 +----------- src/Global_Win32.cpp | 28 ---------------------------- src/Main.cpp | 2 +- 9 files changed, 5 insertions(+), 65 deletions(-) diff --git a/src/Config.h b/src/Config.h index afadf29f..77f8d8b2 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 1 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 4 -#define VER_LAMEXP_BUILD 1612 +#define VER_LAMEXP_BUILD 1613 #define VER_LAMEXP_CONFG 1558 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 8bb5a4d0..3e6df6bf 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -232,7 +232,6 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *me m_fileListModel(fileListModel), m_metaData(metaInfo), m_settings(settingsModel), - m_windowIcon(NULL), m_fileSystemModel(NULL), m_banner(NULL), m_accepted(false), @@ -245,7 +244,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *me setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint); //Create window icon - m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true); + MUtils::GUI::set_window_icon(this, lamexp_app_icon(), true); //Register meta types qRegisterMetaType("AudioFileModel"); @@ -749,13 +748,6 @@ MainWindow::~MainWindow(void) MUTILS_DELETE(m_evenFilterOutputFolderMouse); MUTILS_DELETE(m_evenFilterOutputFolderView); MUTILS_DELETE(m_evenFilterCompressionTab); - - //Free window icon - if(m_windowIcon) - { - lamexp_free_window_icon(m_windowIcon); - m_windowIcon = NULL; - } //Un-initialize the dialog MUTILS_DELETE(ui); diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index 21cd77d4..612fd3b7 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -197,7 +197,6 @@ private: bool m_firstTimeShown; uint m_outputFolderViewInitCounter; bool m_outputFolderViewCentering; - lamexp_icon_t *m_windowIcon; WorkingBanner *m_banner; QList *m_droppedFileList; diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index 04b00705..1a266cc7 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -149,7 +149,6 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile : QDialog(parent), ui(new Ui::ProcessingDialog), - m_windowIcon(NULL), m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)), m_settings(settings), m_metaInfo(metaInfo), @@ -168,7 +167,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); //Update the window icon - m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true); + MUtils::GUI::set_window_icon(this, lamexp_app_icon(), true); //Update header icon ui->label_headerIcon->setPixmap(lamexp_app_icon().pixmap(ui->label_headerIcon->size())); @@ -361,12 +360,6 @@ ProcessingDialog::~ProcessingDialog(void) WinSevenTaskbar::setOverlayIcon(this, NULL); WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState); - - if(m_windowIcon) - { - lamexp_free_window_icon(m_windowIcon); - m_windowIcon = NULL; - } MUTILS_DELETE(ui); } diff --git a/src/Dialog_Processing.h b/src/Dialog_Processing.h index 4f0281b9..3cee9c01 100644 --- a/src/Dialog_Processing.h +++ b/src/Dialog_Processing.h @@ -107,7 +107,6 @@ private: bool shutdownComputer(void); QString time2text(const double timeVal) const; - lamexp_icon_t *m_windowIcon; QThreadPool *m_threadPool; QList m_pendingJobs; SettingsModel *m_settings; diff --git a/src/Global.h b/src/Global.h index bec468ce..80b27040 100644 --- a/src/Global.h +++ b/src/Global.h @@ -72,9 +72,6 @@ typedef enum } lamexp_syscolor_t; -//Icon type -class lamexp_icon_t; - /////////////////////////////////////////////////////////////////////////////// // GLOBAL FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -95,7 +92,6 @@ const QString lamexp_clean_filepath(const QString &str); unsigned long lamexp_dbg_private_bytes(void); bool lamexp_enable_close_button(const QWidget *win, const bool bEnable = true); void lamexp_finalization(void); -void lamexp_free_window_icon(lamexp_icon_t *icon); int lamexp_init_ipc(void); bool lamexp_install_translator(const QString &language); bool lamexp_install_translator_from_file(const QString &qmFile); @@ -109,7 +105,6 @@ bool lamexp_play_sound_alias(const QString &alias, const bool bAsync); bool lamexp_portable_mode(void); QStringList lamexp_query_translations(void); void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0, const QString *tag = NULL); -lamexp_icon_t *lamexp_set_window_icon(QWidget *window, const QIcon &icon, const bool bIsBigIcon); bool lamexp_sheet_of_glass(QWidget *window); bool lamexp_sheet_of_glass_update(QWidget *window); QColor lamexp_system_color(const int color_id); diff --git a/src/Global_Version.cpp b/src/Global_Version.cpp index b16fa4db..d0ce35c2 100644 --- a/src/Global_Version.cpp +++ b/src/Global_Version.cpp @@ -109,17 +109,7 @@ const char *lamexp_tracker_url(void) { return g_lamexp_tracker_url; } */ bool lamexp_version_demo(void) { - char buffer[128]; - bool releaseVersion = false; - if(!strncpy_s(buffer, 128, g_lamexp_version.ver_release_name, _TRUNCATE)) - { - char *context, *prefix = strtok_s(buffer, "-,; ", &context); - if(prefix) - { - releaseVersion = (!_stricmp(prefix, "Final")) || (!_stricmp(prefix, "Hotfix")); - } - } - return (!releaseVersion); + return _strnicmp(g_lamexp_version.ver_release_name, "Final", 5) && _strnicmp(g_lamexp_version.ver_release_name, "Hotfix", 6); } /* diff --git a/src/Global_Win32.cpp b/src/Global_Win32.cpp index 503889c0..53d01b17 100644 --- a/src/Global_Win32.cpp +++ b/src/Global_Win32.cpp @@ -585,34 +585,6 @@ bool lamexp_sheet_of_glass_update(QWidget *window) return true; } -/* - * Update the window icon - */ -lamexp_icon_t *lamexp_set_window_icon(QWidget *window, const QIcon &icon, const bool bIsBigIcon) -{ - if(!icon.isNull()) - { - const int extend = (bIsBigIcon ? 32 : 16); - if(HICON hIcon = lamexp_qicon2hicon(icon, extend, extend)) - { - SendMessage(window->winId(), WM_SETICON, (bIsBigIcon ? ICON_BIG : ICON_SMALL), LPARAM(hIcon)); - return reinterpret_cast(hIcon); - } - } - return NULL; -} - -/* - * Free window icon - */ -void lamexp_free_window_icon(lamexp_icon_t *icon) -{ - if(HICON hIcon = reinterpret_cast(icon)) - { - DestroyIcon(hIcon); - } -} - /* * Get system color info */ diff --git a/src/Main.cpp b/src/Main.cpp index 90ab4eab..f41cdcd1 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -236,5 +236,5 @@ static int lamexp_main(int &argc, char **argv) int main(int argc, char* argv[]) { - return MUtils::Startup::startup(argc, argv, lamexp_main); + return MUtils::Startup::startup(argc, argv, lamexp_main, lamexp_version_demo()); }