Improved processing dialog + setup a proper "big" window icon for application windows (improves the look on the taskbar in Windows 7+)
This commit is contained in:
parent
187fac2949
commit
9b5334ba27
@ -205,6 +205,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>6</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -261,7 +261,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>6</width>
|
<width>9</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 76 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 11 KiB |
@ -35,7 +35,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 9
|
#define VER_LAMEXP_MINOR_LO 9
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 8
|
#define VER_LAMEXP_PATCH 8
|
||||||
#define VER_LAMEXP_BUILD 1475
|
#define VER_LAMEXP_BUILD 1476
|
||||||
#define VER_LAMEXP_CONFG 1348
|
#define VER_LAMEXP_CONFG 1348
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -919,7 +919,7 @@ void MainWindow::showEvent(QShowEvent *event)
|
|||||||
m_accepted = false;
|
m_accepted = false;
|
||||||
resizeEvent(NULL);
|
resizeEvent(NULL);
|
||||||
sourceModelChanged();
|
sourceModelChanged();
|
||||||
|
|
||||||
if(!event->spontaneous())
|
if(!event->spontaneous())
|
||||||
{
|
{
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
@ -928,6 +928,7 @@ void MainWindow::showEvent(QShowEvent *event)
|
|||||||
if(m_firstTimeShown)
|
if(m_firstTimeShown)
|
||||||
{
|
{
|
||||||
m_firstTimeShown = false;
|
m_firstTimeShown = false;
|
||||||
|
lamexp_set_window_icon(this, lamexp_app_icon(), true);
|
||||||
QTimer::singleShot(0, this, SLOT(windowShown()));
|
QTimer::singleShot(0, this, SLOT(windowShown()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -145,6 +145,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
|
|||||||
m_cpuObserver(NULL),
|
m_cpuObserver(NULL),
|
||||||
m_ramObserver(NULL),
|
m_ramObserver(NULL),
|
||||||
m_progressViewFilter(-1),
|
m_progressViewFilter(-1),
|
||||||
|
m_initThreads(0),
|
||||||
m_firstShow(true)
|
m_firstShow(true)
|
||||||
{
|
{
|
||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
@ -173,7 +174,6 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
|
|||||||
//Init progress indicator
|
//Init progress indicator
|
||||||
m_progressIndicator = new QMovie(":/images/Working.gif");
|
m_progressIndicator = new QMovie(":/images/Working.gif");
|
||||||
m_progressIndicator->setCacheMode(QMovie::CacheAll);
|
m_progressIndicator->setCacheMode(QMovie::CacheAll);
|
||||||
m_progressIndicator->setSpeed(50);
|
|
||||||
ui->label_headerWorking->setMovie(m_progressIndicator);
|
ui->label_headerWorking->setMovie(m_progressIndicator);
|
||||||
ui->progressBar->setValue(0);
|
ui->progressBar->setValue(0);
|
||||||
|
|
||||||
@ -356,18 +356,22 @@ void ProcessingDialog::showEvent(QShowEvent *event)
|
|||||||
{
|
{
|
||||||
static const char *NA = " N/A";
|
static const char *NA = " N/A";
|
||||||
|
|
||||||
|
//Update the window icon
|
||||||
|
lamexp_set_window_icon(this, lamexp_app_icon(), true);
|
||||||
|
|
||||||
lamexp_enable_close_button(this, false);
|
lamexp_enable_close_button(this, false);
|
||||||
ui->button_closeDialog->setEnabled(false);
|
ui->button_closeDialog->setEnabled(false);
|
||||||
ui->button_AbortProcess->setEnabled(false);
|
ui->button_AbortProcess->setEnabled(false);
|
||||||
|
m_progressIndicator->start();
|
||||||
m_systemTray->setVisible(true);
|
m_systemTray->setVisible(true);
|
||||||
|
|
||||||
lamexp_change_process_priority(1);
|
lamexp_change_process_priority(1);
|
||||||
|
|
||||||
ui->label_cpu->setText(NA);
|
ui->label_cpu->setText(NA);
|
||||||
ui->label_disk->setText(NA);
|
ui->label_disk->setText(NA);
|
||||||
ui->label_ram->setText(NA);
|
ui->label_ram->setText(NA);
|
||||||
|
|
||||||
QTimer::singleShot(1000, this, SLOT(initEncoding()));
|
QTimer::singleShot(500, this, SLOT(initEncoding()));
|
||||||
m_firstShow = false;
|
m_firstShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +487,6 @@ void ProcessingDialog::initEncoding(void)
|
|||||||
|
|
||||||
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor(Qt::white));
|
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor(Qt::white));
|
||||||
SET_PROGRESS_TEXT(tr("Encoding files, please wait..."));
|
SET_PROGRESS_TEXT(tr("Encoding files, please wait..."));
|
||||||
m_progressIndicator->start();
|
|
||||||
|
|
||||||
ui->button_closeDialog->setEnabled(false);
|
ui->button_closeDialog->setEnabled(false);
|
||||||
ui->button_AbortProcess->setEnabled(true);
|
ui->button_AbortProcess->setEnabled(true);
|
||||||
@ -534,14 +537,28 @@ void ProcessingDialog::initEncoding(void)
|
|||||||
m_threadPool->setMaxThreadCount(maximumInstances);
|
m_threadPool->setMaxThreadCount(maximumInstances);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < m_threadPool->maxThreadCount(); i++)
|
//for(int i = 0; i < m_threadPool->maxThreadCount(); i++)
|
||||||
|
//{
|
||||||
|
// startNextJob();
|
||||||
|
// qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
|
// QThread::yieldCurrentThread();
|
||||||
|
//}
|
||||||
|
|
||||||
|
m_initThreads = m_threadPool->maxThreadCount();
|
||||||
|
QTimer::singleShot(100, this, SLOT(initNextJob()));
|
||||||
|
m_timerStart = lamexp_perfcounter_value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessingDialog::initNextJob(void)
|
||||||
|
{
|
||||||
|
if((m_initThreads > 0) && (!m_userAborted))
|
||||||
{
|
{
|
||||||
startNextJob();
|
startNextJob();
|
||||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
if(--m_initThreads > 0)
|
||||||
QThread::yieldCurrentThread();
|
{
|
||||||
|
QTimer::singleShot(100, this, SLOT(initNextJob()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_timerStart = lamexp_perfcounter_value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessingDialog::startNextJob(void)
|
void ProcessingDialog::startNextJob(void)
|
||||||
@ -616,9 +633,6 @@ void ProcessingDialog::startNextJob(void)
|
|||||||
qFatal("Fatal Error: Thread initialization has failed!");
|
qFatal("Fatal Error: Thread initialization has failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update GUI
|
|
||||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
|
||||||
|
|
||||||
//Give it a go!
|
//Give it a go!
|
||||||
if(!thread->start(m_threadPool))
|
if(!thread->start(m_threadPool))
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initEncoding(void);
|
void initEncoding(void);
|
||||||
|
void initNextJob(void);
|
||||||
void startNextJob(void);
|
void startNextJob(void);
|
||||||
void doneEncoding(void);
|
void doneEncoding(void);
|
||||||
void abortEncoding(bool force = false);
|
void abortEncoding(bool force = false);
|
||||||
@ -116,6 +117,7 @@ private:
|
|||||||
QActionGroup *m_progressViewFilterGroup;
|
QActionGroup *m_progressViewFilterGroup;
|
||||||
QLabel *m_filterInfoLabel;
|
QLabel *m_filterInfoLabel;
|
||||||
QLabel *m_filterInfoLabelIcon;
|
QLabel *m_filterInfoLabelIcon;
|
||||||
|
unsigned int m_initThreads;
|
||||||
unsigned int m_runningThreads;
|
unsigned int m_runningThreads;
|
||||||
unsigned int m_currentFile;
|
unsigned int m_currentFile;
|
||||||
QList<QUuid> m_allJobs;
|
QList<QUuid> m_allJobs;
|
||||||
|
@ -139,7 +139,7 @@ lamexp_syscolor_t;
|
|||||||
// GLOBAL FUNCTIONS
|
// GLOBAL FUNCTIONS
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QIcon lamexp_app_icon(const QDate *date = NULL, const QTime *time = NULL);
|
const QIcon &lamexp_app_icon(void);
|
||||||
bool lamexp_append_sysmenu(const QWidget *win, const unsigned int identifier, const QString &text);
|
bool lamexp_append_sysmenu(const QWidget *win, const unsigned int identifier, const QString &text);
|
||||||
const QStringList &lamexp_arguments(void);
|
const QStringList &lamexp_arguments(void);
|
||||||
QStringList lamexp_available_codepages(bool noAliases = true);
|
QStringList lamexp_available_codepages(bool noAliases = true);
|
||||||
@ -204,6 +204,7 @@ QString lamexp_rand_str(const bool bLong = false);
|
|||||||
void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0, const QString *tag = NULL);
|
void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0, const QString *tag = NULL);
|
||||||
bool lamexp_remove_file(const QString &filename);
|
bool lamexp_remove_file(const QString &filename);
|
||||||
void lamexp_seed_rand(void);
|
void lamexp_seed_rand(void);
|
||||||
|
bool lamexp_set_window_icon(QWidget *window, const QIcon &icon, const bool bIsBigIcon);
|
||||||
bool lamexp_sheet_of_glass(QWidget *window);
|
bool lamexp_sheet_of_glass(QWidget *window);
|
||||||
bool lamexp_sheet_of_glass_update(QWidget *window);
|
bool lamexp_sheet_of_glass_update(QWidget *window);
|
||||||
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
|
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
|
||||||
|
@ -54,6 +54,13 @@ static struct
|
|||||||
}
|
}
|
||||||
g_lamexp_temp_folder;
|
g_lamexp_temp_folder;
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
QIcon *appIcon;
|
||||||
|
QReadWriteLock lock;
|
||||||
|
}
|
||||||
|
g_lamexp_app_icon;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// GLOBAL FUNCTIONS
|
// GLOBAL FUNCTIONS
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -516,35 +523,51 @@ static bool lamexp_thanksgiving(const QDate &date)
|
|||||||
/*
|
/*
|
||||||
* Initialize app icon
|
* Initialize app icon
|
||||||
*/
|
*/
|
||||||
QIcon lamexp_app_icon(const QDate *date, const QTime *time)
|
const QIcon &lamexp_app_icon(void)
|
||||||
{
|
{
|
||||||
QDate currentDate = (date) ? QDate(*date) : QDate::currentDate();
|
QReadLocker readLock(&g_lamexp_app_icon.lock);
|
||||||
QTime currentTime = (time) ? QTime(*time) : QTime::currentTime();
|
|
||||||
|
//Already initialized?
|
||||||
|
if(g_lamexp_app_icon.appIcon)
|
||||||
|
{
|
||||||
|
return *g_lamexp_app_icon.appIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
readLock.unlock();
|
||||||
|
QWriteLocker writeLock(&g_lamexp_app_icon.lock);
|
||||||
|
|
||||||
|
while(!g_lamexp_app_icon.appIcon)
|
||||||
|
{
|
||||||
|
QDate currentDate = QDate::currentDate();
|
||||||
|
QTime currentTime = QTime::currentTime();
|
||||||
|
|
||||||
if(lamexp_thanksgiving(currentDate))
|
if(lamexp_thanksgiving(currentDate))
|
||||||
{
|
{
|
||||||
return QIcon(":/MainIcon6.png");
|
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon6.png");
|
||||||
}
|
}
|
||||||
else if(((currentDate.month() == 12) && (currentDate.day() == 31) && (currentTime.hour() >= 20)) || ((currentDate.month() == 1) && (currentDate.day() == 1) && (currentTime.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");
|
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon5.png");
|
||||||
}
|
}
|
||||||
else if(((currentDate.month() == 10) && (currentDate.day() == 31) && (currentTime.hour() >= 12)) || ((currentDate.month() == 11) && (currentDate.day() == 1) && (currentTime.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");
|
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon4.png");
|
||||||
}
|
}
|
||||||
else if((currentDate.month() == 12) && (currentDate.day() >= 24) && (currentDate.day() <= 26))
|
else if((currentDate.month() == 12) && (currentDate.day() >= 24) && (currentDate.day() <= 26))
|
||||||
{
|
{
|
||||||
return QIcon(":/MainIcon3.png");
|
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon3.png");
|
||||||
}
|
}
|
||||||
else if(lamexp_computus(currentDate))
|
else if(lamexp_computus(currentDate))
|
||||||
{
|
{
|
||||||
return QIcon(":/MainIcon2.png");
|
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon2.png");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QIcon(":/MainIcon1.png");
|
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon1.png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *g_lamexp_app_icon.appIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -589,4 +612,5 @@ bool lamexp_broadcast(int eventType, bool onlyToVisible)
|
|||||||
extern "C" void _lamexp_global_init_utils(void)
|
extern "C" void _lamexp_global_init_utils(void)
|
||||||
{
|
{
|
||||||
LAMEXP_ZERO_MEMORY(g_lamexp_temp_folder);
|
LAMEXP_ZERO_MEMORY(g_lamexp_temp_folder);
|
||||||
|
LAMEXP_ZERO_MEMORY(g_lamexp_app_icon);
|
||||||
}
|
}
|
||||||
|
@ -915,6 +915,22 @@ static bool lamexp_check_elevation(void)
|
|||||||
return !bIsProcessElevated;
|
return !bIsProcessElevated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert QIcon to HICON -> caller is responsible for destroying the HICON!
|
||||||
|
*/
|
||||||
|
static HICON lamexp_qicon2hicon(const QIcon &icon, const int w, const int h)
|
||||||
|
{
|
||||||
|
if(!icon.isNull())
|
||||||
|
{
|
||||||
|
QPixmap pixmap = icon.pixmap(w, h);
|
||||||
|
if(!pixmap.isNull())
|
||||||
|
{
|
||||||
|
return pixmap.toWinHICON();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize Qt framework
|
* Initialize Qt framework
|
||||||
*/
|
*/
|
||||||
@ -1079,14 +1095,18 @@ bool lamexp_init_qt(int argc, char* argv[])
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||||
if(g_lamexp_console_attached && (!lamexp_detect_wine()))
|
if(g_lamexp_console_attached && (!lamexp_detect_wine()))
|
||||||
{
|
{
|
||||||
typedef DWORD (__stdcall *SetConsoleIconFun)(HICON);
|
|
||||||
QLibrary kernel32("kernel32.dll");
|
QLibrary kernel32("kernel32.dll");
|
||||||
if(kernel32.load())
|
if(kernel32.load())
|
||||||
{
|
{
|
||||||
SetConsoleIconFun SetConsoleIconPtr = (SetConsoleIconFun) kernel32.resolve("SetConsoleIcon");
|
typedef DWORD (__stdcall *SetConsoleIconFun)(HICON);
|
||||||
QPixmap pixmap = QIcon(":/icons/sound.png").pixmap(16, 16);
|
if(SetConsoleIconFun SetConsoleIconPtr = (SetConsoleIconFun) kernel32.resolve("SetConsoleIcon"))
|
||||||
if((SetConsoleIconPtr != NULL) && (!pixmap.isNull())) SetConsoleIconPtr(pixmap.toWinHICON());
|
{
|
||||||
kernel32.unload();
|
if(HICON hIcon = lamexp_qicon2hicon(QIcon(":/icons/sound.png"), 16, 16))
|
||||||
|
{
|
||||||
|
SetConsoleIconPtr(hIcon);
|
||||||
|
DestroyIcon(hIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2004,6 +2024,24 @@ bool lamexp_sheet_of_glass_update(QWidget *window)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update the window icon
|
||||||
|
*/
|
||||||
|
bool 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));
|
||||||
|
//DestroyIcon(hIcon); /*FIXME: Destroying the icon here will remove it from the window*/
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get system color info
|
* Get system color info
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user