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>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -261,7 +261,7 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<width>9</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</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_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 8
|
||||
#define VER_LAMEXP_BUILD 1475
|
||||
#define VER_LAMEXP_BUILD 1476
|
||||
#define VER_LAMEXP_CONFG 1348
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -919,7 +919,7 @@ void MainWindow::showEvent(QShowEvent *event)
|
||||
m_accepted = false;
|
||||
resizeEvent(NULL);
|
||||
sourceModelChanged();
|
||||
|
||||
|
||||
if(!event->spontaneous())
|
||||
{
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
@ -928,6 +928,7 @@ void MainWindow::showEvent(QShowEvent *event)
|
||||
if(m_firstTimeShown)
|
||||
{
|
||||
m_firstTimeShown = false;
|
||||
lamexp_set_window_icon(this, lamexp_app_icon(), true);
|
||||
QTimer::singleShot(0, this, SLOT(windowShown()));
|
||||
}
|
||||
else
|
||||
|
@ -145,6 +145,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
|
||||
m_cpuObserver(NULL),
|
||||
m_ramObserver(NULL),
|
||||
m_progressViewFilter(-1),
|
||||
m_initThreads(0),
|
||||
m_firstShow(true)
|
||||
{
|
||||
//Init the dialog, from the .ui file
|
||||
@ -173,7 +174,6 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
|
||||
//Init progress indicator
|
||||
m_progressIndicator = new QMovie(":/images/Working.gif");
|
||||
m_progressIndicator->setCacheMode(QMovie::CacheAll);
|
||||
m_progressIndicator->setSpeed(50);
|
||||
ui->label_headerWorking->setMovie(m_progressIndicator);
|
||||
ui->progressBar->setValue(0);
|
||||
|
||||
@ -356,18 +356,22 @@ void ProcessingDialog::showEvent(QShowEvent *event)
|
||||
{
|
||||
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);
|
||||
ui->button_closeDialog->setEnabled(false);
|
||||
ui->button_AbortProcess->setEnabled(false);
|
||||
m_progressIndicator->start();
|
||||
m_systemTray->setVisible(true);
|
||||
|
||||
lamexp_change_process_priority(1);
|
||||
|
||||
|
||||
ui->label_cpu->setText(NA);
|
||||
ui->label_disk->setText(NA);
|
||||
ui->label_ram->setText(NA);
|
||||
|
||||
QTimer::singleShot(1000, this, SLOT(initEncoding()));
|
||||
QTimer::singleShot(500, this, SLOT(initEncoding()));
|
||||
m_firstShow = false;
|
||||
}
|
||||
|
||||
@ -483,7 +487,6 @@ void ProcessingDialog::initEncoding(void)
|
||||
|
||||
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor(Qt::white));
|
||||
SET_PROGRESS_TEXT(tr("Encoding files, please wait..."));
|
||||
m_progressIndicator->start();
|
||||
|
||||
ui->button_closeDialog->setEnabled(false);
|
||||
ui->button_AbortProcess->setEnabled(true);
|
||||
@ -534,14 +537,28 @@ void ProcessingDialog::initEncoding(void)
|
||||
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();
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QThread::yieldCurrentThread();
|
||||
if(--m_initThreads > 0)
|
||||
{
|
||||
QTimer::singleShot(100, this, SLOT(initNextJob()));
|
||||
}
|
||||
}
|
||||
|
||||
m_timerStart = lamexp_perfcounter_value();
|
||||
}
|
||||
|
||||
void ProcessingDialog::startNextJob(void)
|
||||
@ -616,9 +633,6 @@ void ProcessingDialog::startNextJob(void)
|
||||
qFatal("Fatal Error: Thread initialization has failed!");
|
||||
}
|
||||
|
||||
//Update GUI
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
//Give it a go!
|
||||
if(!thread->start(m_threadPool))
|
||||
{
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void initEncoding(void);
|
||||
void initNextJob(void);
|
||||
void startNextJob(void);
|
||||
void doneEncoding(void);
|
||||
void abortEncoding(bool force = false);
|
||||
@ -116,6 +117,7 @@ private:
|
||||
QActionGroup *m_progressViewFilterGroup;
|
||||
QLabel *m_filterInfoLabel;
|
||||
QLabel *m_filterInfoLabelIcon;
|
||||
unsigned int m_initThreads;
|
||||
unsigned int m_runningThreads;
|
||||
unsigned int m_currentFile;
|
||||
QList<QUuid> m_allJobs;
|
||||
|
@ -139,7 +139,7 @@ lamexp_syscolor_t;
|
||||
// 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);
|
||||
const QStringList &lamexp_arguments(void);
|
||||
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);
|
||||
bool lamexp_remove_file(const QString &filename);
|
||||
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_update(QWidget *window);
|
||||
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;
|
||||
|
||||
static struct
|
||||
{
|
||||
QIcon *appIcon;
|
||||
QReadWriteLock lock;
|
||||
}
|
||||
g_lamexp_app_icon;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GLOBAL FUNCTIONS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -516,35 +523,51 @@ static bool lamexp_thanksgiving(const QDate &date)
|
||||
/*
|
||||
* 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();
|
||||
QTime currentTime = (time) ? QTime(*time) : QTime::currentTime();
|
||||
QReadLocker readLock(&g_lamexp_app_icon.lock);
|
||||
|
||||
//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))
|
||||
{
|
||||
return QIcon(":/MainIcon6.png");
|
||||
}
|
||||
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(((currentDate.month() == 10) && (currentDate.day() == 31) && (currentTime.hour() >= 12)) || ((currentDate.month() == 11) && (currentDate.day() == 1) && (currentTime.hour() <= 11)))
|
||||
{
|
||||
return QIcon(":/MainIcon4.png");
|
||||
}
|
||||
else if((currentDate.month() == 12) && (currentDate.day() >= 24) && (currentDate.day() <= 26))
|
||||
{
|
||||
return QIcon(":/MainIcon3.png");
|
||||
}
|
||||
else if(lamexp_computus(currentDate))
|
||||
{
|
||||
return QIcon(":/MainIcon2.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
return QIcon(":/MainIcon1.png");
|
||||
if(lamexp_thanksgiving(currentDate))
|
||||
{
|
||||
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)))
|
||||
{
|
||||
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)))
|
||||
{
|
||||
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon4.png");
|
||||
}
|
||||
else if((currentDate.month() == 12) && (currentDate.day() >= 24) && (currentDate.day() <= 26))
|
||||
{
|
||||
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon3.png");
|
||||
}
|
||||
else if(lamexp_computus(currentDate))
|
||||
{
|
||||
g_lamexp_app_icon.appIcon = new QIcon(":/MainIcon2.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
@ -1079,14 +1095,18 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
if(g_lamexp_console_attached && (!lamexp_detect_wine()))
|
||||
{
|
||||
typedef DWORD (__stdcall *SetConsoleIconFun)(HICON);
|
||||
QLibrary kernel32("kernel32.dll");
|
||||
if(kernel32.load())
|
||||
{
|
||||
SetConsoleIconFun SetConsoleIconPtr = (SetConsoleIconFun) kernel32.resolve("SetConsoleIcon");
|
||||
QPixmap pixmap = QIcon(":/icons/sound.png").pixmap(16, 16);
|
||||
if((SetConsoleIconPtr != NULL) && (!pixmap.isNull())) SetConsoleIconPtr(pixmap.toWinHICON());
|
||||
kernel32.unload();
|
||||
typedef DWORD (__stdcall *SetConsoleIconFun)(HICON);
|
||||
if(SetConsoleIconFun SetConsoleIconPtr = (SetConsoleIconFun) kernel32.resolve("SetConsoleIcon"))
|
||||
{
|
||||
if(HICON hIcon = lamexp_qicon2hicon(QIcon(":/icons/sound.png"), 16, 16))
|
||||
{
|
||||
SetConsoleIconPtr(hIcon);
|
||||
DestroyIcon(hIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -2004,6 +2024,24 @@ bool lamexp_sheet_of_glass_update(QWidget *window)
|
||||
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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user