Added support for Windows 7 Taskbar progress indicator + include version info in resources.

This commit is contained in:
LoRd_MuldeR 2012-02-08 00:29:47 +01:00
parent f07f8bcb13
commit c1d4d1d589
14 changed files with 291 additions and 26 deletions

BIN
res/images/movie.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
res/images/update.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

View File

@ -32,6 +32,8 @@
<file>buttons/trash.png</file> <file>buttons/trash.png</file>
<file>buttons/world_link.png</file> <file>buttons/world_link.png</file>
<file>buttons/wrench.png</file> <file>buttons/wrench.png</file>
<file>images/movie.png</file>
<file>images/update.png</file>
<file>images/x264.png</file> <file>images/x264.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -74,13 +74,15 @@ static const struct
{ {
unsigned int ver_major; unsigned int ver_major;
unsigned int ver_minor; unsigned int ver_minor;
unsigned int ver_patch;
const char* ver_date; const char* ver_date;
const char* ver_time; const char* ver_time;
} }
g_x264_version = g_x264_version =
{ {
VER_X264_MAJOR, (VER_X264_MAJOR),
VER_X264_MINOR, (VER_X264_MINOR),
(VER_X264_PATCH),
__DATE__, __DATE__,
__TIME__ __TIME__
}; };
@ -264,7 +266,7 @@ void x264_message_handler(QtMsgType type, const char *msg)
*/ */
void x264_init_console(int argc, char* argv[]) void x264_init_console(int argc, char* argv[])
{ {
bool enableConsole = x264_is_prerelease() || X264_DEBUG; bool enableConsole = x264_is_prerelease() || (X264_DEBUG);
if(_environ) if(_environ)
{ {
@ -355,6 +357,11 @@ unsigned int x264_version_minor(void)
return g_x264_version.ver_minor; return g_x264_version.ver_minor;
} }
unsigned int x264_version_patch(void)
{
return g_x264_version.ver_patch;
}
const char *x264_version_compiler(void) const char *x264_version_compiler(void)
{ {
return g_x264_version_compiler; return g_x264_version_compiler;

View File

@ -97,6 +97,7 @@ void x264_invalid_param_handler(const wchar_t*, const wchar_t*, const wchar_t*,
void x264_message_handler(QtMsgType type, const char *msg); void x264_message_handler(QtMsgType type, const char *msg);
unsigned int x264_version_major(void); unsigned int x264_version_major(void);
unsigned int x264_version_minor(void); unsigned int x264_version_minor(void);
unsigned int x264_version_patch(void);
const QDate &x264_version_date(void); const QDate &x264_version_date(void);
bool x264_is_prerelease(void); bool x264_is_prerelease(void);
const char *x264_version_time(void); const char *x264_version_time(void);

View File

@ -21,6 +21,7 @@
#include "global.h" #include "global.h"
#include "win_main.h" #include "win_main.h"
#include "taskbar7.h"
//Qt includes //Qt includes
#include <QCoreApplication> #include <QCoreApplication>
@ -37,7 +38,7 @@ static int x264_main(int argc, char* argv[])
x264_init_console(argc, argv); x264_init_console(argc, argv);
//Print version info //Print version info
qDebug("Simple x264 Launcher v%u.%02u - use 64-Bit x264 with 32-Bit Avisynth", x264_version_major(), x264_version_minor()); qDebug("Simple x264 Launcher v%u.%02u.%u - use 64-Bit x264 with 32-Bit Avisynth", x264_version_major(), x264_version_minor(), x264_version_patch());
qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.", qMax(x264_version_date().year(),QDate::currentDate().year())); qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.", qMax(x264_version_date().year(),QDate::currentDate().year()));
qDebug("Built on %s at %s with %s for Win-%s.\n", x264_version_date().toString(Qt::ISODate).toLatin1().constData(), x264_version_time(), x264_version_compiler(), x264_version_arch()); qDebug("Built on %s at %s with %s for Win-%s.\n", x264_version_date().toString(Qt::ISODate).toLatin1().constData(), x264_version_time(), x264_version_compiler(), x264_version_arch());
@ -67,6 +68,9 @@ static int x264_main(int argc, char* argv[])
{ {
return -1; return -1;
} }
//Taskbar init
WinSevenTaskbar::init();
//Set style //Set style
qApp->setStyle(new QPlastiqueStyle()); qApp->setStyle(new QPlastiqueStyle());
@ -77,6 +81,9 @@ static int x264_main(int argc, char* argv[])
//Run application //Run application
int ret = qApp->exec(); int ret = qApp->exec();
//Taskbar uninit
WinSevenTaskbar::init();
X264_DELETE(mainWin); X264_DELETE(mainWin);
return ret; return ret;

161
src/taskbar7.cpp Normal file
View File

@ -0,0 +1,161 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#include "taskbar7.h"
#include <QWidget>
#include <QIcon>
#include <ShObjIdl.h>
UINT WinSevenTaskbar::m_winMsg = 0;
ITaskbarList3 *WinSevenTaskbar::m_ptbl = NULL;
WinSevenTaskbar::WinSevenTaskbar(void)
{
throw "Cannot create instance of this class!";
}
WinSevenTaskbar::~WinSevenTaskbar(void)
{
}
////////////////////////////////////////////////////////////
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
void WinSevenTaskbar::init(void)
{
m_winMsg = RegisterWindowMessageW(L"TaskbarButtonCreated");
m_ptbl = NULL;
}
void WinSevenTaskbar::uninit(void)
{
if(m_ptbl)
{
m_ptbl->Release();
m_ptbl = NULL;
}
}
bool WinSevenTaskbar::handleWinEvent(MSG *message, long *result)
{
bool stopEvent = false;
if(message->message == m_winMsg)
{
if(!m_ptbl) createInterface();
*result = (m_ptbl) ? S_OK : S_FALSE;
stopEvent = true;
}
return stopEvent;
}
void WinSevenTaskbar::createInterface(void)
{
if(!m_ptbl)
{
ITaskbarList3 *ptbl = NULL;
HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&ptbl));
if (SUCCEEDED(hr))
{
HRESULT hr2 = ptbl->HrInit();
if(SUCCEEDED(hr2))
{
m_ptbl = ptbl;
/*qDebug("ITaskbarList3::HrInit() succeeded.");*/
}
else
{
ptbl->Release();
qWarning("ITaskbarList3::HrInit() has failed.");
}
}
else
{
qWarning("ITaskbarList3 could not be created.");
}
}
}
bool WinSevenTaskbar::setTaskbarState(QWidget *window, WinSevenTaskbarState state)
{
bool result = false;
if(m_ptbl && window)
{
HRESULT hr = HRESULT(-1);
switch(state)
{
case WinSevenTaskbarNoState:
hr = m_ptbl->SetProgressState(window->winId(), TBPF_NOPROGRESS);
break;
case WinSevenTaskbarNormalState:
hr = m_ptbl->SetProgressState(window->winId(), TBPF_NORMAL);
break;
case WinSevenTaskbarIndeterminateState:
hr = m_ptbl->SetProgressState(window->winId(), TBPF_INDETERMINATE);
break;
case WinSevenTaskbarErrorState:
hr = m_ptbl->SetProgressState(window->winId(), TBPF_ERROR);
break;
case WinSevenTaskbarPausedState:
hr = m_ptbl->SetProgressState(window->winId(), TBPF_PAUSED);
break;
}
result = SUCCEEDED(hr);
}
return result;
}
void WinSevenTaskbar::setTaskbarProgress(QWidget *window, unsigned __int64 currentValue, unsigned __int64 maximumValue)
{
if(m_ptbl && window)
{
m_ptbl->SetProgressValue(window->winId(), currentValue, maximumValue);
}
}
void WinSevenTaskbar::setOverlayIcon(QWidget *window, const QIcon *icon)
{
if(m_ptbl && window)
{
m_ptbl->SetOverlayIcon(window->winId(), (icon ? icon->pixmap(16,16).toWinHICON() : NULL), L"LameXP");
}
}
#else //__ITaskbarList3_INTERFACE_DEFINED__
LAMEXP_COMPILER_WARNING("ITaskbarList3 not defined. Compiling *without* support for Win7 taskbar!")
void WinSevenTaskbar::init(void) {}
void WinSevenTaskbar::uninit(void) {}
bool WinSevenTaskbar::handleWinEvent(MSG *message, long *result) { return false; }
void WinSevenTaskbar::createInterface(void) {}
bool WinSevenTaskbar::setTaskbarState(QWidget *window, WinSevenTaskbarState state) { return false; }
void WinSevenTaskbar::setTaskbarProgress(QWidget *window, unsigned __int64 currentValue, unsigned __int64 maximumValue) {}
void WinSevenTaskbar::setOverlayIcon(QWidget *window, QIcon *icon) {}
#endif //__ITaskbarList3_INTERFACE_DEFINED__

View File

@ -213,18 +213,18 @@ void EncodeThread::encode(void)
if(revision_avs2yuv != UINT_MAX) log(tr("Avs2YUV version: %1.%2.%3").arg(QString::number(revision_avs2yuv / REV_MULT), QString::number((revision_avs2yuv % REV_MULT) / 10),QString::number((revision_avs2yuv % REV_MULT) % 10))); if(revision_avs2yuv != UINT_MAX) log(tr("Avs2YUV version: %1.%2.%3").arg(QString::number(revision_avs2yuv / REV_MULT), QString::number((revision_avs2yuv % REV_MULT) / 10),QString::number((revision_avs2yuv % REV_MULT) % 10)));
//Is x264 revision supported? //Is x264 revision supported?
if((revision_x264 % REV_MULT) < VER_X264_MINIMUM_REV) if((revision_x264 % REV_MULT) < (VER_X264_MINIMUM_REV))
{ {
log(tr("\nERROR: Your revision of x264 is too old! (Minimum required revision is %2)").arg(QString::number(VER_X264_MINIMUM_REV))); log(tr("\nERROR: Your revision of x264 is too old! (Minimum required revision is %2)").arg(QString::number(VER_X264_MINIMUM_REV)));
setStatus(JobStatus_Failed); setStatus(JobStatus_Failed);
return; return;
} }
if((revision_x264 / REV_MULT) != VER_X264_CURRENT_API) if((revision_x264 / REV_MULT) != (VER_X264_CURRENT_API))
{ {
log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!")); log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!"));
log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(VER_X264_CURRENT_API))); log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(VER_X264_CURRENT_API)));
} }
if((revision_avs2yuv != UINT_MAX) && ((revision_avs2yuv % REV_MULT) != VER_X264_AVS2YUV_VER)) if((revision_avs2yuv != UINT_MAX) && ((revision_avs2yuv % REV_MULT) != (VER_X264_AVS2YUV_VER)))
{ {
log(tr("\nERROR: Your version of avs2yuv is unsupported (Required version: v0.24 BugMaster's mod 2)")); log(tr("\nERROR: Your version of avs2yuv is unsupported (Required version: v0.24 BugMaster's mod 2)"));
log(tr("You can find the required version at: http://komisar.gin.by/tools/avs2yuv/")); log(tr("You can find the required version at: http://komisar.gin.by/tools/avs2yuv/"));

View File

@ -19,11 +19,12 @@
// http://www.gnu.org/licenses/gpl-2.0.txt // http://www.gnu.org/licenses/gpl-2.0.txt
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define VER_X264_MAJOR (2) #define VER_X264_MAJOR 2
#define VER_X264_MINOR (0) #define VER_X264_MINOR 0
#define VER_X264_PATCH 52
#define VER_X264_MINIMUM_REV (2146) #define VER_X264_MINIMUM_REV 2146
#define VER_X264_CURRENT_API (120) #define VER_X264_CURRENT_API 120
#define VER_X264_AVS2YUV_VER (242) #define VER_X264_AVS2YUV_VER 242
#define VER_X264_PRE_RELEASE (0) #define VER_X264_PRE_RELEASE (0)

View File

@ -25,6 +25,7 @@
#include "model_options.h" #include "model_options.h"
#include "win_addJob.h" #include "win_addJob.h"
#include "win_preferences.h" #include "win_preferences.h"
#include "taskbar7.h"
#include "resource.h" #include "resource.h"
#include <QDate> #include <QDate>
@ -41,6 +42,7 @@
#include <Mmsystem.h> #include <Mmsystem.h>
const char *home_url = "http://mulder.brhack.net/"; const char *home_url = "http://mulder.brhack.net/";
const char *update_url = "http://code.google.com/p/mulder/downloads/list";
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); } #define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); } #define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
@ -259,10 +261,11 @@ void MainWindow::jobSelected(const QModelIndex & current, const QModelIndex & pr
connect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int))); connect(logView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(jobLogExtended(QModelIndex, int, int)));
logView->actions().first()->setEnabled(true); logView->actions().first()->setEnabled(true);
QTimer::singleShot(0, logView, SLOT(scrollToBottom())); QTimer::singleShot(0, logView, SLOT(scrollToBottom()));
progressBar->setValue(m_jobList->getJobProgress(current)); progressBar->setValue(m_jobList->getJobProgress(current));
editDetails->setText(m_jobList->data(m_jobList->index(current.row(), 3, QModelIndex()), Qt::DisplayRole).toString()); editDetails->setText(m_jobList->data(m_jobList->index(current.row(), 3, QModelIndex()), Qt::DisplayRole).toString());
updateButtons(m_jobList->getJobStatus(current)); updateButtons(m_jobList->getJobStatus(current));
updateTaskbar(m_jobList->getJobStatus(current), m_jobList->data(m_jobList->index(current.row(), 0, QModelIndex()), Qt::DecorationRole).value<QIcon>());
} }
else else
{ {
@ -271,6 +274,7 @@ void MainWindow::jobSelected(const QModelIndex & current, const QModelIndex & pr
progressBar->setValue(0); progressBar->setValue(0);
editDetails->clear(); editDetails->clear();
updateButtons(EncodeThread::JobStatus_Undefined); updateButtons(EncodeThread::JobStatus_Undefined);
updateTaskbar(EncodeThread::JobStatus_Undefined, QIcon());
} }
progressBar->repaint(); progressBar->repaint();
@ -289,6 +293,7 @@ void MainWindow::jobChangedData(const QModelIndex &topLeft, const QModelIndex &
{ {
qDebug("Current job changed status!"); qDebug("Current job changed status!");
updateButtons(status); updateButtons(status);
updateTaskbar(status, m_jobList->data(m_jobList->index(i, 0, QModelIndex()), Qt::DecorationRole).value<QIcon>());
} }
if((status == EncodeThread::JobStatus_Completed) || (status == EncodeThread::JobStatus_Failed)) if((status == EncodeThread::JobStatus_Completed) || (status == EncodeThread::JobStatus_Failed))
{ {
@ -297,18 +302,19 @@ void MainWindow::jobChangedData(const QModelIndex &topLeft, const QModelIndex &
} }
} }
} }
else if(topLeft.column() <= 2 && bottomRight.column() >= 2) /*PROGRESS*/ if(topLeft.column() <= 2 && bottomRight.column() >= 2) /*PROGRESS*/
{ {
for(int i = topLeft.row(); i <= bottomRight.row(); i++) for(int i = topLeft.row(); i <= bottomRight.row(); i++)
{ {
if(i == selected) if(i == selected)
{ {
progressBar->setValue(m_jobList->getJobProgress(m_jobList->index(i, 0, QModelIndex()))); progressBar->setValue(m_jobList->getJobProgress(m_jobList->index(i, 0, QModelIndex())));
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
break; break;
} }
} }
} }
else if(topLeft.column() <= 3 && bottomRight.column() >= 3) /*DETAILS*/ if(topLeft.column() <= 3 && bottomRight.column() >= 3) /*DETAILS*/
{ {
for(int i = topLeft.row(); i <= bottomRight.row(); i++) for(int i = topLeft.row(); i <= bottomRight.row(); i++)
{ {
@ -330,7 +336,7 @@ void MainWindow::showAbout(void)
{ {
QString text; QString text;
text += QString().sprintf("<nobr><tt>Simple x264 Launcher v%u.%02u - use 64-Bit x264 with 32-Bit Avisynth<br>", x264_version_major(), x264_version_minor()); text += QString().sprintf("<nobr><tt>Simple x264 Launcher v%u.%02u.%u - use 64-Bit x264 with 32-Bit Avisynth<br>", x264_version_major(), x264_version_minor(), x264_version_patch());
text += QString().sprintf("Copyright (c) 2004-%04d LoRd_MuldeR &lt;mulder2@gmx.de&gt;. Some rights reserved.<br>", qMax(x264_version_date().year(),QDate::currentDate().year())); text += QString().sprintf("Copyright (c) 2004-%04d LoRd_MuldeR &lt;mulder2@gmx.de&gt;. Some rights reserved.<br>", qMax(x264_version_date().year(),QDate::currentDate().year()));
text += QString().sprintf("Built on %s at %s with %s for Win-%s.<br><br>", x264_version_date().toString(Qt::ISODate).toLatin1().constData(), x264_version_time(), x264_version_compiler(), x264_version_arch()); text += QString().sprintf("Built on %s at %s with %s for Win-%s.<br><br>", x264_version_date().toString(Qt::ISODate).toLatin1().constData(), x264_version_time(), x264_version_compiler(), x264_version_arch());
text += QString().sprintf("This program is free software: you can redistribute it and/or modify<br>"); text += QString().sprintf("This program is free software: you can redistribute it and/or modify<br>");
@ -338,11 +344,18 @@ void MainWindow::showAbout(void)
text += QString().sprintf("Note that this program is distributed with ABSOLUTELY NO WARRANTY.<br><br>"); text += QString().sprintf("Note that this program is distributed with ABSOLUTELY NO WARRANTY.<br><br>");
text += QString().sprintf("Please check the web-site at <a href=\"%s\">%s</a> for updates !!!<br></tt></nobr>", home_url, home_url); text += QString().sprintf("Please check the web-site at <a href=\"%s\">%s</a> for updates !!!<br></tt></nobr>", home_url, home_url);
QMessageBox aboutBox(this);
aboutBox.setIconPixmap(QIcon(":/images/movie.png").pixmap(64,64));
aboutBox.setWindowTitle(tr("About..."));
aboutBox.setText(text.replace("-", "&minus;"));
aboutBox.addButton(tr("About x264"), QMessageBox::NoRole);
aboutBox.addButton(tr("About Qt"), QMessageBox::NoRole);
aboutBox.setEscapeButton(aboutBox.addButton(tr("Close"), QMessageBox::NoRole));
forever forever
{ {
int ret = QMessageBox::information(this, tr("About..."), text.replace("-", "&minus;"), tr("About x264"), tr("About Qt"), tr("Close"), 0, 2); MessageBeep(MB_ICONINFORMATION);
switch(aboutBox.exec())
switch(ret)
{ {
case 0: case 0:
{ {
@ -351,7 +364,14 @@ void MainWindow::showAbout(void)
text2 += tr("Free software library for encoding video streams into the H.264/MPEG-4 AVC format.<br>"); text2 += tr("Free software library for encoding video streams into the H.264/MPEG-4 AVC format.<br>");
text2 += tr("Released under the terms of the GNU General Public License.<br><br>"); text2 += tr("Released under the terms of the GNU General Public License.<br><br>");
text2 += tr("Please visit <a href=\"%1\">%1</a> for obtaining a <u>commercial</u> x264 license!<br></tt></nobr>").arg("http://x264licensing.com/"); text2 += tr("Please visit <a href=\"%1\">%1</a> for obtaining a <u>commercial</u> x264 license!<br></tt></nobr>").arg("http://x264licensing.com/");
QMessageBox::information(this, tr("About x264"), text2.replace("-", "&minus;"), tr("Close"));
QMessageBox x264Box(this);
x264Box.setIconPixmap(QIcon(":/images/x264.png").pixmap(48,48));
x264Box.setWindowTitle(tr("About x264"));
x264Box.setText(text2.replace("-", "&minus;"));
x264Box.setEscapeButton(x264Box.addButton(tr("Close"), QMessageBox::NoRole));
MessageBeep(MB_ICONINFORMATION);
x264Box.exec();
} }
break; break;
case 1: case 1:
@ -557,10 +577,10 @@ void MainWindow::init(void)
if(x264_version_date().addMonths(6) < QDate::currentDate()) if(x264_version_date().addMonths(6) < QDate::currentDate())
{ {
QMessageBox msgBox(this); QMessageBox msgBox(this);
msgBox.setIcon(QMessageBox::Information); msgBox.setIconPixmap(QIcon(":/images/update.png").pixmap(56,56));
msgBox.setWindowTitle(tr("Update Notification")); msgBox.setWindowTitle(tr("Update Notification"));
msgBox.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); msgBox.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
msgBox.setText(tr("<nobr><tt>Oups, this version of 'Simple x264 Launcher' is more than 6 months old.<br><br>Please check the official web-site at <a href=\"%1\">%1</a> for updates!<br></tt></nobr>").replace("-", "&minus;").arg(home_url)); msgBox.setText(tr("<nobr><tt>Your version of 'Simple x264 Launcher' is more than 6 months old!<br><br>Please download the most recent version from the official web-site at:<br><a href=\"%1\">%1</a><br></tt></nobr>").replace("-", "&minus;").arg(update_url));
QPushButton *btn1 = msgBox.addButton(tr("Discard"), QMessageBox::NoRole); QPushButton *btn1 = msgBox.addButton(tr("Discard"), QMessageBox::NoRole);
QPushButton *btn2 = msgBox.addButton(tr("Discard"), QMessageBox::AcceptRole); QPushButton *btn2 = msgBox.addButton(tr("Discard"), QMessageBox::AcceptRole);
btn1->setEnabled(false); btn1->setEnabled(false);
@ -670,6 +690,9 @@ void MainWindow::resizeEvent(QResizeEvent *e)
updateLabelPos(); updateLabelPos();
} }
/*
* Event filter
*/
bool MainWindow::eventFilter(QObject *o, QEvent *e) bool MainWindow::eventFilter(QObject *o, QEvent *e)
{ {
if((o == labelBuildDate) && (e->type() == QEvent::MouseButtonPress)) if((o == labelBuildDate) && (e->type() == QEvent::MouseButtonPress))
@ -680,6 +703,14 @@ bool MainWindow::eventFilter(QObject *o, QEvent *e)
return false; return false;
} }
/*
* Win32 message filter
*/
bool MainWindow::winEvent(MSG *message, long *result)
{
return WinSevenTaskbar::handleWinEvent(message, result);
}
/* /*
* File dragged over window * File dragged over window
*/ */
@ -783,3 +814,46 @@ void MainWindow::updateButtons(EncodeThread::JobStatus status)
editDetails->setEnabled(status != EncodeThread::JobStatus_Paused); editDetails->setEnabled(status != EncodeThread::JobStatus_Paused);
} }
void MainWindow::updateTaskbar(EncodeThread::JobStatus status, const QIcon &icon)
{
qDebug("MainWindow::updateTaskbar(void)");
switch(status)
{
case EncodeThread::JobStatus_Undefined:
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
break;
case EncodeThread::JobStatus_Aborting:
case EncodeThread::JobStatus_Starting:
case EncodeThread::JobStatus_Pausing:
case EncodeThread::JobStatus_Resuming:
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
break;
case EncodeThread::JobStatus_Aborted:
case EncodeThread::JobStatus_Failed:
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
break;
case EncodeThread::JobStatus_Paused:
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarPausedState);
break;
default:
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
break;
}
switch(status)
{
case EncodeThread::JobStatus_Aborting:
case EncodeThread::JobStatus_Starting:
case EncodeThread::JobStatus_Pausing:
case EncodeThread::JobStatus_Resuming:
break;
default:
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
break;
}
WinSevenTaskbar::setOverlayIcon(this, icon.isNull() ? NULL : &icon);
}

View File

@ -45,6 +45,7 @@ protected:
virtual bool eventFilter(QObject *o, QEvent *e); virtual bool eventFilter(QObject *o, QEvent *e);
virtual void dragEnterEvent(QDragEnterEvent *event); virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event); virtual void dropEvent(QDropEvent *event);
virtual bool winEvent(MSG *message, long *result);
private: private:
bool m_firstShow; bool m_firstShow;
@ -60,6 +61,7 @@ private:
const QString m_appDir; const QString m_appDir;
void updateButtons(EncodeThread::JobStatus status); void updateButtons(EncodeThread::JobStatus status);
void updateTaskbar(EncodeThread::JobStatus status, const QIcon &icon);
unsigned int countPendingJobs(void); unsigned int countPendingJobs(void);
unsigned int countRunningJobs(void); unsigned int countRunningJobs(void);

Binary file not shown.

View File

@ -71,6 +71,10 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<PostBuildEvent> <PostBuildEvent>
<Message>Copy Toolset</Message> <Message>Copy Toolset</Message>
</PostBuildEvent> </PostBuildEvent>
<PreBuildEvent>
<Command>"$(SolutionDir)etc\auto_inc.exe" VER_X264_PATCH "$(SolutionDir)src\version.h" 5</Command>
<Message>Update Build Number</Message>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
@ -101,12 +105,10 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command> <Command>"$(SolutionDir)etc\auto_inc.exe" VER_X264_PATCH "$(SolutionDir)src\version.h" 5</Command>
</Command>
</PreBuildEvent> </PreBuildEvent>
<PreBuildEvent> <PreBuildEvent>
<Message> <Message>Update Build Number</Message>
</Message>
</PreBuildEvent> </PreBuildEvent>
<PreLinkEvent> <PreLinkEvent>
<Command> <Command>
@ -227,6 +229,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
</CustomBuild> </CustomBuild>
<ClInclude Include="src\model_options.h" /> <ClInclude Include="src\model_options.h" />
<ClInclude Include="src\targetver.h" /> <ClInclude Include="src\targetver.h" />
<ClInclude Include="src\taskbar7.h" />
<ClInclude Include="src\version.h" /> <ClInclude Include="src\version.h" />
<CustomBuild Include="src\win_main.h"> <CustomBuild Include="src\win_main.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
@ -241,6 +244,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<ClCompile Include="src\model_jobList.cpp" /> <ClCompile Include="src\model_jobList.cpp" />
<ClCompile Include="src\model_logFile.cpp" /> <ClCompile Include="src\model_logFile.cpp" />
<ClCompile Include="src\model_options.cpp" /> <ClCompile Include="src\model_options.cpp" />
<ClCompile Include="src\taskbar7.cpp" />
<ClCompile Include="src\thread_encode.cpp" /> <ClCompile Include="src\thread_encode.cpp" />
<ClCompile Include="src\global.cpp" /> <ClCompile Include="src\global.cpp" />
<ClCompile Include="src\main.cpp" /> <ClCompile Include="src\main.cpp" />

View File

@ -45,6 +45,9 @@
<ClInclude Include="src\model_options.h"> <ClInclude Include="src\model_options.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\taskbar7.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\main.cpp"> <ClCompile Include="src\main.cpp">
@ -101,6 +104,9 @@
<ClCompile Include="tmp\moc\moc_win_preferences.cpp"> <ClCompile Include="tmp\moc\moc_win_preferences.cpp">
<Filter>Generated Files</Filter> <Filter>Generated Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\taskbar7.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="src\win_main.h"> <CustomBuild Include="src\win_main.h">