Added support for Windows 7 taskbar features (progress and overlay icons).

This commit is contained in:
LoRd_MuldeR 2010-12-05 23:11:03 +01:00
parent be4ce0d81c
commit c2f132007f
17 changed files with 328 additions and 17 deletions

View File

@ -130,7 +130,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui""
AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"C:\Program Files\Microsoft SDKs\Windows\v7.1""
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;QT_LARGEFILE_SUPPORT;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG"
MinimalRebuild="false"
BasicRuntimeChecks="0"
@ -422,6 +422,10 @@
RelativePath=".\src\Tool_Abstract.cpp"
>
</File>
<File
RelativePath=".\src\WinSevenTaskbar.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@ -759,7 +763,7 @@
<Tool
Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
@ -769,7 +773,7 @@
<Tool
Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
@ -779,7 +783,7 @@
<Tool
Name="VCCustomBuildTool"
Description="MOC &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -o &quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\MOC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
@ -1228,6 +1232,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\WinSevenTaskbar.h"
>
</File>
</Filter>
<Filter
Name="Generated Files"
@ -1351,7 +1359,7 @@
<Tool
Name="VCCustomBuildTool"
Description="RCC &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
@ -1361,7 +1369,7 @@
<Tool
Name="VCCustomBuildTool"
Description="RCC &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>
@ -1371,7 +1379,7 @@
<Tool
Name="VCCustomBuildTool"
Description="RCC &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;"
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -o &quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot; -name &quot;$(SafeInputName)&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(SolutionDir)tmp\RCC_$(SafeInputName).cpp&quot;"
/>
</FileConfiguration>

View File

@ -901,7 +901,7 @@
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="cursor">
<cursorShape>ForbiddenCursor</cursorShape>
@ -923,7 +923,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -949,7 +949,7 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<item row="2" column="0">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -962,7 +962,7 @@
</property>
</spacer>
</item>
<item row="1" column="2">
<item row="2" column="2">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -975,6 +975,25 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label">
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>More options will be added in a later version, stay tuned!</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -1396,6 +1415,12 @@
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -114,7 +114,7 @@
</palette>
</property>
<property name="windowTitle">
<string>Frame</string>
<string>LameXP is launching...</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
@ -261,6 +261,7 @@
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -25,6 +25,7 @@
<file>icons/computer.png</file>
<file>icons/controller.png</file>
<file>icons/control_pause_blue.png</file>
<file>icons/control_play_blue.png</file>
<file>icons/cross.png</file>
<file>icons/date.png</file>
<file>icons/delete.png</file>
@ -32,12 +33,14 @@
<file>icons/door_out.png</file>
<file>icons/drive_cd.png</file>
<file>icons/exclamation.png</file>
<file>icons/error.png</file>
<file>icons/feed.png</file>
<file>icons/folder_add.png</file>
<file>icons/folder_go.png</file>
<file>icons/folder_image.png</file>
<file>icons/folder_page.png</file>
<file>icons/house.png</file>
<file>icons/hourglass.png</file>
<file>icons/information.png</file>
<file>icons/media_play.png</file>
<file>icons/monitor.png</file>

View File

@ -7,6 +7,8 @@
<file>images/Label.png</file>
<file>images/Loading.gif</file>
<file>images/Logo.png</file>
<file>images/Logo_Contributors.png</file>
<file>images/Logo_Software.png</file>
<file>images/Splash.png</file>
<file>images/Thumb.png</file>
<file>images/Construction.gif</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 120
#define VER_LAMEXP_BUILD 124
#define VER_LAMEXP_SUFFIX TechPreview
/*

View File

@ -190,7 +190,9 @@ void AboutDialog::showAboutContributors(void)
contributorsAboutText += "<table style=\"margin-top:5px\">";
contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;", ":/flags/gb.png");
contributorsAboutText += CONTRIBUTOR("Deutsch", "LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;", ":/flags/de.png");
contributorsAboutText += "</table><br>";
contributorsAboutText += "</table>";
contributorsAboutText += "<br><br>";
contributorsAboutText += "<i>If you are willing to contribute a LameXP translation, feel free to contact us!</i><br>";
QMessageBox *contributorsAboutBox = new QMessageBox(this);
contributorsAboutBox->setText(contributorsAboutText);
@ -201,6 +203,7 @@ void AboutDialog::showAboutContributors(void)
closeButton->setMinimumWidth(90);
contributorsAboutBox->setWindowTitle("About Contributors");
contributorsAboutBox->setIconPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(64,74)));
contributorsAboutBox->setWindowIcon(QIcon(":/icons/user_suit.png"));
contributorsAboutBox->exec();
@ -239,6 +242,7 @@ void AboutDialog::showMoreAbout(void)
closeButton->setMinimumWidth(90);
moreAboutBox->setWindowTitle("About Third-party Software");
moreAboutBox->setIconPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(64,71)));
moreAboutBox->setWindowIcon(QIcon(":/icons/page_white_cplusplus.png"));
moreAboutBox->exec();

View File

@ -34,6 +34,7 @@
#include "Model_Settings.h"
#include "Model_FileList.h"
#include "Model_FileSystem.h"
#include "WinSevenTaskbar.h"
//Qt includes
#include <QMessageBox>
@ -152,6 +153,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
outputFolderView->setAnimated(true);
outputFolderView->installEventFilter(this);
outputFolderView->setMouseTracking(false);
outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu);
while(saveToSourceFolderCheckBox->isChecked() != m_settings->outputToSourceDir()) saveToSourceFolderCheckBox->click();
connect(outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
connect(outputFolderView, SIGNAL(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
@ -163,6 +165,10 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(buttonGotoDesktop, SIGNAL(clicked()), this, SLOT(gotoDesktopButtonClicked()));
connect(buttonGotoMusic, SIGNAL(clicked()), this, SLOT(gotoMusicFolderButtonClicked()));
connect(saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged()));
m_outputFolderContextMenu = new QMenu();
QAction *showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "Browse Selected Folder");
connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint)));
connect(showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered()));
//Setup "Meta Data" tab
m_metaInfoModel = new MetaInfoModel(m_metaData, 6);
@ -1275,6 +1281,22 @@ void MainWindow::findFileContextActionTriggered(void)
}
}
/*
* Show context menu for output folder
*/
void MainWindow::outputFolderContextMenu(const QPoint &pos)
{
m_outputFolderContextMenu->popup(outputFolderView->mapToGlobal(pos));
}
/*
* Show selected folder in explorer
*/
void MainWindow::showFolderContextActionTriggered(void)
{
QDesktopServices::openUrl(QUrl::fromLocalFile(m_fileSystemModel->filePath(outputFolderView->currentIndex())));
}
/*
* Disable update reminder action
*/

View File

@ -85,6 +85,8 @@ private slots:
void findFileContextActionTriggered(void);
void disableUpdateReminderActionTriggered(bool checked);
void disableSoundsActionTriggered(bool checked);
void outputFolderContextMenu(const QPoint &pos);
void showFolderContextActionTriggered(void);
protected:
void showEvent(QShowEvent *event);
@ -114,4 +116,5 @@ private:
SettingsModel *m_settings;
QLabel *m_dropNoteLabel;
QMenu *m_sourceFilesContextMenu;
QMenu *m_outputFolderContextMenu;
};

View File

@ -31,6 +31,7 @@
#include "Encoder_MP3.h"
#include "Encoder_Vorbis.h"
#include "Encoder_AAC.h"
#include "WinSevenTaskbar.h"
#include <QApplication>
#include <QRect>
@ -137,6 +138,9 @@ ProcessingDialog::~ProcessingDialog(void)
LAMEXP_DELETE(m_progressModel);
LAMEXP_DELETE(m_contextMenu);
WinSevenTaskbar::setOverlayIcon(this, NULL);
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
while(!m_threadList.isEmpty())
{
ProcessThread *thread = m_threadList.takeFirst();
@ -219,6 +223,11 @@ void ProcessingDialog::initEncoding(void)
button_AbortProcess->setEnabled(true);
progressBar->setRange(0, m_pendingJobs.count());
WinSevenTaskbar::initTaskbar();
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
WinSevenTaskbar::setTaskbarProgress(this, 0, m_pendingJobs.count());
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/control_play_blue.png"));
lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features();
for(int i = 0; i < min(max(cpuFeatures.count, 1), 4); i++)
@ -248,6 +257,7 @@ void ProcessingDialog::doneEncoding(void)
if(!m_userAborted)
{
label_progress->setText(QString("Encoding: %1 files of %2 completed so far, please wait...").arg(QString::number(progressBar->value()), QString::number(progressBar->maximum())));
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
}
int index = m_threadList.indexOf(dynamic_cast<ProcessThread*>(QWidget::sender()));
@ -282,6 +292,8 @@ void ProcessingDialog::doneEncoding(void)
if(m_userAborted)
{
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFF3BA"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png"));
label_progress->setText((m_succeededFiles > 0) ? QString("Process was aborted by the user after %1 file(s)!").arg(QString::number(m_succeededFiles)) : "Process was aborted prematurely by the user!");
QApplication::processEvents();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABORTED), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
@ -291,6 +303,8 @@ void ProcessingDialog::doneEncoding(void)
if(m_failedFiles)
{
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFBABA"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png"));
label_progress->setText(QString("Error: %1 of %2 files failed. Double-click failed items for detailed information!").arg(QString::number(m_failedFiles), QString::number(m_failedFiles + m_succeededFiles)));
QApplication::processEvents();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ERROR), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
@ -298,6 +312,8 @@ void ProcessingDialog::doneEncoding(void)
else
{
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#D1FFD5"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png"));
label_progress->setText("Alle files completed successfully.");
QApplication::processEvents();
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_SUCCESS), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
@ -310,7 +326,8 @@ void ProcessingDialog::doneEncoding(void)
view_log->scrollToBottom();
m_progressIndicator->stop();
progressBar->setValue(100);
progressBar->setValue(progressBar->maximum());
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
QApplication::restoreOverrideCursor();
}

View File

@ -22,6 +22,7 @@
#include "Dialog_WorkingBanner.h"
#include "Global.h"
#include "WinSevenTaskbar.h"
#include <QThread>
#include <QMovie>
@ -36,7 +37,8 @@
////////////////////////////////////////////////////////////
WorkingBanner::WorkingBanner(QWidget *parent)
: QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint)
:
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint)
{
//Init the dialog, from the .ui file
setupUi(this);
@ -49,6 +51,9 @@ WorkingBanner::WorkingBanner(QWidget *parent)
//Set wait cursor
setCursor(Qt::WaitCursor);
//Init taskbar
WinSevenTaskbar::initTaskbar();
}
////////////////////////////////////////////////////////////
@ -91,12 +96,20 @@ void WorkingBanner::show(const QString &text, QThread *thread)
//Start the thread
thread->start();
//Set taskbar state
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), &QIcon(":/icons/hourglass.png"));
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
//Loop while thread is running
while(thread->isRunning())
{
QApplication::processEvents(QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents);
}
//Set taskbar state
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
//Hide splash
this->close();
}

View File

@ -77,6 +77,8 @@ AbstractTool::AbstractTool(void)
}
}
}
m_firstLaunch = true;
}
/*
@ -118,8 +120,15 @@ bool AbstractTool::startProcess(QProcess &process, const QString &program, const
{
SetPriorityClass(process.pid()->hProcess, IDLE_PRIORITY_CLASS);
}
lock.unlock();
emit statusUpdated(0);
if(m_firstLaunch)
{
emit statusUpdated(0);
m_firstLaunch = false;
}
return true;
}

View File

@ -45,4 +45,5 @@ signals:
private:
static QMutex *m_mutex_startProcess;
static void *m_handle_jobObject;
bool m_firstLaunch;
};

119
src/WinSevenTaskbar.cpp Normal file
View File

@ -0,0 +1,119 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2010 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 "WinSevenTaskbar.h"
#include <QWidget>
#include <QIcon>
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
ITaskbarList3 *WinSevenTaskbar::m_ptbl = NULL;
WinSevenTaskbar::WinSevenTaskbar(void)
{
}
WinSevenTaskbar::~WinSevenTaskbar(void)
{
}
void WinSevenTaskbar::initTaskbar(void)
{
OSVERSIONINFOW version;
memset(&version, 0, sizeof(OSVERSIONINFOW));
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
GetVersionEx(&version);
if(version.dwMajorVersion >= 6 && version.dwMinorVersion >= 1)
{
if(!m_ptbl)
{
ITaskbarList3 *ptbl;
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;
}
else
{
ptbl->Release();
qWarning("ITaskbarList3::HrInit() has failed.");
}
}
else
{
qWarning("ITaskbarList3 could not be created.");
}
}
}
else
{
qWarning("This OS doesn't support the ITaskbarList3 interface (needs NT 6.1 or later)");
}
}
void WinSevenTaskbar::setTaskbarState(QWidget *window, WinSevenTaskbarState state)
{
if(m_ptbl && window)
{
switch(state)
{
case WinSevenTaskbarNoState:
m_ptbl->SetProgressState(window->winId(), TBPF_NOPROGRESS);
break;
case WinSevenTaskbarNormalState:
m_ptbl->SetProgressState(window->winId(), TBPF_NORMAL);
break;
case WinSevenTaskbarIndeterminateState:
m_ptbl->SetProgressState(window->winId(), TBPF_INDETERMINATE);
break;
case WinSevenTaskbarErrorState:
m_ptbl->SetProgressState(window->winId(), TBPF_ERROR);
break;
case WinSevenTaskbarPausedState:
m_ptbl->SetProgressState(window->winId(), TBPF_PAUSED);
break;
}
}
}
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, QIcon *icon)
{
if(m_ptbl && window)
{
m_ptbl->SetOverlayIcon(window->winId(), (icon ? icon->pixmap(16,16).toWinHICON() : NULL), L"LameXP");
}
}
#endif //__ITaskbarList3_INTERFACE_DEFINED__

84
src/WinSevenTaskbar.h Normal file
View File

@ -0,0 +1,84 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2010 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
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <ShObjIdl.h>
class QWidget;
class QIcon;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
class WinSevenTaskbar
{
public:
WinSevenTaskbar(void);
~WinSevenTaskbar(void);
//Taskbar states
enum WinSevenTaskbarState
{
WinSevenTaskbarNoState = 0,
WinSevenTaskbarNormalState = 1,
WinSevenTaskbarIndeterminateState = 2,
WinSevenTaskbarPausedState = 3,
WinSevenTaskbarErrorState = 4
};
//Public interface
static void initTaskbar(void);
static void setTaskbarState(QWidget *window, WinSevenTaskbarState state);
static void setTaskbarProgress(QWidget *window, unsigned __int64 currentValue, unsigned __int64 maximumValue);
static void setOverlayIcon(QWidget *window, QIcon *icon);
private:
static ITaskbarList3 *m_ptbl;
};
#else //__ITaskbarList3_INTERFACE_DEFINED__
#pragma message("WARNING: ITaskbarList3 not defined. Compiling *without* support for Win7 taskbar!")
class WinSevenTaskbar
{
public:
WinSevenTaskbar(void);
~WinSevenTaskbar(void);
//Taskbar states
enum WinSevenTaskbarState
{
WinSevenTaskbarNoState = 0,
WinSevenTaskbarNormalState = 1,
WinSevenTaskbarIndeterminateState = 2,
WinSevenTaskbarPausedState = 3,
WinSevenTaskbarErrorState = 4
};
//Public interface
static void initTaskbar(void) {}
static void setTaskbarState(QWidget *window, WinSevenTaskbarState state) {}
static void setTaskbarProgress(QWidget *window, unsigned __int64 currentValue, unsigned __int64 maximumValue) {}
static void setOverlayIcon(QWidget *window, QIcon *icon) {}
};
#endif //__ITaskbarList3_INTERFACE_DEFINED__