Moved Taskbar progress into MUtilities library.
This commit is contained in:
parent
d3917b5233
commit
cc45c1a904
@ -343,7 +343,6 @@ copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\Win32\*.manifest
|
||||
<ClCompile Include="src\Thread_RAMObserver.cpp" />
|
||||
<ClCompile Include="src\Tool_Abstract.cpp" />
|
||||
<ClCompile Include="src\Tool_WaveProperties.cpp" />
|
||||
<ClCompile Include="src\WinSevenTaskbar.cpp" />
|
||||
<ClCompile Include="tmp\LameXP\MOC_CustomEventFilter.cpp" />
|
||||
<ClCompile Include="tmp\LameXP\MOC_Decoder_Abstract.cpp" />
|
||||
<ClCompile Include="tmp\LameXP\MOC_Dialog_About.cpp" />
|
||||
@ -943,7 +942,6 @@ copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\Win32\*.manifest
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="src\WinSevenTaskbar.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="res\Documents.qrc">
|
||||
|
@ -151,9 +151,6 @@
|
||||
<ClCompile Include="src\Thread_MessageProducer.cpp">
|
||||
<Filter>Source Files\Threads</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WinSevenTaskbar.cpp">
|
||||
<Filter>Source Files\Misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\LockedFile.cpp">
|
||||
<Filter>Source Files\Misc</Filter>
|
||||
</ClCompile>
|
||||
@ -495,9 +492,6 @@
|
||||
<ClInclude Include="src\PlaylistImporter.h">
|
||||
<Filter>Header Files\Misc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WinSevenTaskbar.h">
|
||||
<Filter>Header Files\Misc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Global.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -34,8 +34,8 @@
|
||||
#define VER_LAMEXP_MINOR_HI 1
|
||||
#define VER_LAMEXP_MINOR_LO 1
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 8
|
||||
#define VER_LAMEXP_BUILD 1632
|
||||
#define VER_LAMEXP_PATCH 9
|
||||
#define VER_LAMEXP_BUILD 1636
|
||||
#define VER_LAMEXP_CONFG 1558
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "Model_Settings.h"
|
||||
#include "Model_FileList.h"
|
||||
#include "Model_FileSystem.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
#include "Registry_Encoder.h"
|
||||
#include "Registry_Decoder.h"
|
||||
#include "Encoder_Abstract.h"
|
||||
@ -1269,7 +1268,7 @@ bool MainWindow::winEvent(MSG *message, long *result)
|
||||
*result = 0;
|
||||
return true;
|
||||
}
|
||||
return WinSevenTaskbar::handleWinEvent(message, result);
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "Filter_Normalize.h"
|
||||
#include "Filter_Resample.h"
|
||||
#include "Filter_ToneAdjust.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
@ -49,6 +48,7 @@
|
||||
#include <MUtils/GUI.h>
|
||||
#include <MUtils/CPUFeatures.h>
|
||||
#include <MUtils/Sound.h>
|
||||
#include <MUtils/Taskbar7.h>
|
||||
|
||||
//Qt
|
||||
#include <QApplication>
|
||||
@ -153,6 +153,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
|
||||
QDialog(parent),
|
||||
ui(new Ui::ProcessingDialog),
|
||||
m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
|
||||
m_taskbar(new MUtils::Taskbar7(this)),
|
||||
m_settings(settings),
|
||||
m_metaInfo(metaInfo),
|
||||
m_shutdownFlag(SHUTDOWN_FLAG_NONE),
|
||||
@ -360,8 +361,8 @@ ProcessingDialog::~ProcessingDialog(void)
|
||||
MUTILS_DELETE(m_threadPool);
|
||||
MUTILS_DELETE(m_defaultColor);
|
||||
|
||||
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
m_taskbar->setOverlayIcon(NULL);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NONE);
|
||||
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
@ -477,11 +478,6 @@ void ProcessingDialog::resizeEvent(QResizeEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
bool ProcessingDialog::winEvent(MSG *message, long *result)
|
||||
{
|
||||
return WinSevenTaskbar::handleWinEvent(message, result);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// SLOTS
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -511,9 +507,9 @@ void ProcessingDialog::initEncoding(void)
|
||||
ui->checkBox_shutdownComputer->setEnabled(true);
|
||||
ui->checkBox_shutdownComputer->setChecked(false);
|
||||
|
||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
|
||||
WinSevenTaskbar::setTaskbarProgress(this, 0, m_pendingJobs.count());
|
||||
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/control_play_blue.png"));
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NORMAL);
|
||||
m_taskbar->setTaskbarProgress(0, m_pendingJobs.count());
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/control_play_blue.png"));
|
||||
|
||||
if(!m_diskObserver)
|
||||
{
|
||||
@ -669,7 +665,7 @@ void ProcessingDialog::doneEncoding(void)
|
||||
if(!m_userAborted)
|
||||
{
|
||||
SET_PROGRESS_TEXT(tr("Encoding: %n file(s) of %1 completed so far, please wait...", "", ui->progressBar->value()).arg(QString::number(ui->progressBar->maximum())));
|
||||
WinSevenTaskbar::setTaskbarProgress(this, ui->progressBar->value(), ui->progressBar->maximum());
|
||||
m_taskbar->setTaskbarProgress(ui->progressBar->value(), ui->progressBar->maximum());
|
||||
}
|
||||
|
||||
if((!m_pendingJobs.isEmpty()) && (!m_userAborted))
|
||||
@ -698,8 +694,8 @@ void ProcessingDialog::doneEncoding(void)
|
||||
if(m_userAborted)
|
||||
{
|
||||
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFFFE0"));
|
||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
||||
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png"));
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_ERROR);
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/error.png"));
|
||||
SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? tr("Process was aborted by the user after %n file(s)!", "", m_succeededJobs.count()) : tr("Process was aborted prematurely by the user!"));
|
||||
m_systemTray->showMessage(tr("LameXP - Aborted"), tr("Process was aborted by the user."), QSystemTrayIcon::Warning);
|
||||
m_systemTray->setIcon(QIcon(":/icons/cd_delete.png"));
|
||||
@ -717,8 +713,8 @@ void ProcessingDialog::doneEncoding(void)
|
||||
if(m_failedJobs.count() > 0)
|
||||
{
|
||||
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFF0F0"));
|
||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
||||
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png"));
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_ERROR);
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/exclamation.png"));
|
||||
if(m_skippedJobs.count() > 0)
|
||||
{
|
||||
SET_PROGRESS_TEXT(tr("Error: %1 of %n file(s) failed (%2). Double-click failed items for detailed information!", "", m_failedJobs.count() + m_succeededJobs.count() + m_skippedJobs.count()).arg(QString::number(m_failedJobs.count()), tr("%n file(s) skipped", "", m_skippedJobs.count())));
|
||||
@ -735,8 +731,8 @@ void ProcessingDialog::doneEncoding(void)
|
||||
else
|
||||
{
|
||||
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#F0FFF0"));
|
||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
|
||||
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png"));
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NORMAL);
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/accept.png"));
|
||||
if(m_skippedJobs.count() > 0)
|
||||
{
|
||||
SET_PROGRESS_TEXT(tr("All files completed successfully. Skipped %n file(s).", "", m_skippedJobs.count()));
|
||||
@ -761,7 +757,7 @@ void ProcessingDialog::doneEncoding(void)
|
||||
ui->view_log->scrollToBottom();
|
||||
m_progressIndicator->stop();
|
||||
ui->progressBar->setValue(ui->progressBar->maximum());
|
||||
WinSevenTaskbar::setTaskbarProgress(this, ui->progressBar->value(), ui->progressBar->maximum());
|
||||
m_taskbar->setTaskbarProgress(ui->progressBar->value(), ui->progressBar->maximum());
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
|
@ -53,10 +53,17 @@ enum lamexp_shutdownFlag_t
|
||||
};
|
||||
|
||||
//UIC forward declartion
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class ProcessingDialog;
|
||||
}
|
||||
|
||||
//MUtils forward declartion
|
||||
namespace MUtils
|
||||
{
|
||||
class Taskbar7;
|
||||
}
|
||||
|
||||
//ProcessingDialog class
|
||||
class ProcessingDialog : public QDialog
|
||||
{
|
||||
@ -96,7 +103,6 @@ protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
virtual bool event(QEvent *e);
|
||||
virtual bool winEvent(MSG *message, long *result);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
@ -136,4 +142,5 @@ private:
|
||||
QScopedPointer<QElapsedTimer> m_totalTime;
|
||||
int m_progressViewFilter;
|
||||
QColor *m_defaultColor;
|
||||
QScopedPointer<MUtils::Taskbar7> m_taskbar;
|
||||
};
|
||||
|
@ -22,13 +22,16 @@
|
||||
|
||||
#include "Dialog_SplashScreen.h"
|
||||
|
||||
//UIC includes
|
||||
#include "UIC_SplashScreen.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/GUI.h>
|
||||
#include <MUtils/Taskbar7.h>
|
||||
|
||||
//Qt
|
||||
#include <QThread>
|
||||
@ -40,15 +43,14 @@
|
||||
#define OPACITY_DELTA 0.04
|
||||
|
||||
//Setup taskbar indicator
|
||||
#define SET_TASKBAR_STATE(WIDGET,VAR,FLAG) do \
|
||||
#define SET_TASKBAR_STATE(WIDGET,FLAG) do \
|
||||
{ \
|
||||
if(FLAG) \
|
||||
if((WIDGET)->m_taskBarFlag != (FLAG)) \
|
||||
{ \
|
||||
if(!(VAR)) (VAR) = WinSevenTaskbar::setTaskbarState((WIDGET), WinSevenTaskbar::WinSevenTaskbarIndeterminateState); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if((VAR)) (VAR) = (!WinSevenTaskbar::setTaskbarState((WIDGET), WinSevenTaskbar::WinSevenTaskbarNoState)); \
|
||||
if((WIDGET)->m_taskbar->setTaskbarState((FLAG) ? MUtils::Taskbar7::TASKBAR_STATE_INTERMEDIATE : MUtils::Taskbar7::TASKBAR_STATE_NONE)) \
|
||||
{ \
|
||||
(WIDGET)->m_taskBarFlag = (FLAG); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
@ -59,25 +61,27 @@ while(0)
|
||||
|
||||
SplashScreen::SplashScreen(QWidget *parent)
|
||||
:
|
||||
QFrame(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint),
|
||||
ui(new Ui::SplashScreen),
|
||||
m_opacitySteps(qRound(1.0 / OPACITY_DELTA)),
|
||||
QFrame(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint)
|
||||
m_taskbar(new MUtils::Taskbar7(this))
|
||||
{
|
||||
//Init the dialog, from the .ui file
|
||||
setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
//Make size fixed
|
||||
setFixedSize(this->size());
|
||||
|
||||
//Create event loop
|
||||
m_loop = new QEventLoop(this);
|
||||
m_loop.reset(new QEventLoop(this));
|
||||
|
||||
//Create timer
|
||||
m_timer = new QTimer(this);
|
||||
m_timer.reset(new QTimer(this));
|
||||
m_timer->setInterval(FADE_DELAY);
|
||||
m_timer->setSingleShot(false);
|
||||
|
||||
//Connect timer to slot
|
||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateHandler()));
|
||||
connect(m_timer.data(), SIGNAL(timeout()), this, SLOT(updateHandler()));
|
||||
|
||||
//Enable "sheet of glass" effect on splash screen
|
||||
if(!MUtils::GUI::sheet_of_glass(this))
|
||||
@ -86,16 +90,16 @@ SplashScreen::SplashScreen(QWidget *parent)
|
||||
}
|
||||
|
||||
//Start animation
|
||||
m_working = new QMovie(":/images/Loading4.gif");
|
||||
m_working.reset(new QMovie(":/images/Loading4.gif"));
|
||||
m_working->setCacheMode(QMovie::CacheAll);
|
||||
labelLoading->setMovie(m_working);
|
||||
ui->labelLoading->setMovie(m_working.data());
|
||||
m_working->start();
|
||||
|
||||
//Init status
|
||||
m_canClose = false;
|
||||
m_status = STATUS_FADE_IN;
|
||||
m_fadeValue = 0;
|
||||
m_taskBarInit = false;
|
||||
m_taskBarFlag = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -109,9 +113,7 @@ SplashScreen::~SplashScreen(void)
|
||||
m_working->stop();
|
||||
}
|
||||
|
||||
MUTILS_DELETE(m_working);
|
||||
MUTILS_DELETE(m_loop);
|
||||
MUTILS_DELETE(m_timer);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -120,7 +122,7 @@ SplashScreen::~SplashScreen(void)
|
||||
|
||||
void SplashScreen::showSplash(QThread *thread)
|
||||
{
|
||||
SplashScreen *splashScreen = new SplashScreen();
|
||||
QScopedPointer<SplashScreen> splashScreen(new SplashScreen());
|
||||
|
||||
//Show splash
|
||||
splashScreen->setWindowOpacity(OPACITY_DELTA);
|
||||
@ -131,19 +133,19 @@ void SplashScreen::showSplash(QThread *thread)
|
||||
|
||||
//Wait for window to show
|
||||
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
splashScreen->repaint(); MUtils::GUI::bring_to_front(splashScreen);
|
||||
splashScreen->repaint(); MUtils::GUI::bring_to_front(splashScreen.data());
|
||||
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
//Connect thread signals
|
||||
connect(thread, SIGNAL(terminated()), splashScreen, SLOT(threadComplete()), Qt::QueuedConnection);
|
||||
connect(thread, SIGNAL(finished()), splashScreen, SLOT(threadComplete()), Qt::QueuedConnection);
|
||||
connect(thread, SIGNAL(terminated()), splashScreen.data(), SLOT(threadComplete()), Qt::QueuedConnection);
|
||||
connect(thread, SIGNAL(finished()), splashScreen.data(), SLOT(threadComplete()), Qt::QueuedConnection);
|
||||
|
||||
//Init taskbar
|
||||
SET_TASKBAR_STATE(splashScreen, splashScreen->m_taskBarInit, true);
|
||||
SET_TASKBAR_STATE(splashScreen, true);
|
||||
|
||||
//Start the thread
|
||||
splashScreen->m_timer->start(FADE_DELAY);
|
||||
QTimer::singleShot(8*60*1000, splashScreen->m_loop, SLOT(quit()));
|
||||
QTimer::singleShot(8*60*1000, splashScreen->m_loop.data(), SLOT(quit()));
|
||||
QTimer::singleShot(333, thread, SLOT(start()));
|
||||
|
||||
//Start event handling!
|
||||
@ -157,7 +159,7 @@ void SplashScreen::showSplash(QThread *thread)
|
||||
}
|
||||
|
||||
//Restore taskbar
|
||||
SET_TASKBAR_STATE(splashScreen, splashScreen->m_taskBarInit, false);
|
||||
SET_TASKBAR_STATE(splashScreen, false);
|
||||
|
||||
//Restore cursor
|
||||
QApplication::restoreOverrideCursor();
|
||||
@ -165,9 +167,6 @@ void SplashScreen::showSplash(QThread *thread)
|
||||
//Hide splash
|
||||
splashScreen->m_canClose = true;
|
||||
splashScreen->close();
|
||||
|
||||
//Free
|
||||
MUTILS_DELETE(splashScreen);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -181,7 +180,7 @@ void SplashScreen::updateHandler(void)
|
||||
if(m_fadeValue < m_opacitySteps)
|
||||
{
|
||||
setWindowOpacity(OPACITY_DELTA * static_cast<double>(++m_fadeValue));
|
||||
SET_TASKBAR_STATE(this, m_taskBarInit, true);
|
||||
SET_TASKBAR_STATE(this, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -196,7 +195,7 @@ void SplashScreen::updateHandler(void)
|
||||
if(m_fadeValue > 0)
|
||||
{
|
||||
setWindowOpacity(OPACITY_DELTA * static_cast<double>(--m_fadeValue));
|
||||
SET_TASKBAR_STATE(this, m_taskBarInit, true);
|
||||
SET_TASKBAR_STATE(this, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -236,8 +235,3 @@ void SplashScreen::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if(!m_canClose) event->ignore();
|
||||
}
|
||||
|
||||
bool SplashScreen::winEvent(MSG *message, long *result)
|
||||
{
|
||||
return WinSevenTaskbar::handleWinEvent(message, result);
|
||||
}
|
||||
|
@ -24,21 +24,33 @@
|
||||
|
||||
#include "UIC_SplashScreen.h"
|
||||
|
||||
//MUtils forward declaration
|
||||
namespace MUtils
|
||||
{
|
||||
class Taskbar7;
|
||||
}
|
||||
|
||||
//UIC forward declartion
|
||||
namespace Ui
|
||||
{
|
||||
class SplashScreen;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Splash Frame
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
class SplashScreen: public QFrame, private Ui::SplashScreen
|
||||
class SplashScreen: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void showSplash(QThread *thread);
|
||||
|
||||
private:
|
||||
SplashScreen(QWidget *parent = 0);
|
||||
~SplashScreen(void);
|
||||
|
||||
static void showSplash(QThread *thread);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
STATUS_FADE_IN = 0,
|
||||
@ -48,9 +60,12 @@ private:
|
||||
}
|
||||
status_t;
|
||||
|
||||
QMovie *m_working;
|
||||
QEventLoop *m_loop;
|
||||
QTimer *m_timer;
|
||||
Ui::SplashScreen *ui; //for Qt UIC
|
||||
|
||||
QScopedPointer<QMovie> m_working;
|
||||
QScopedPointer<QEventLoop> m_loop;
|
||||
QScopedPointer<QTimer> m_timer;
|
||||
QScopedPointer<MUtils::Taskbar7> m_taskbar;
|
||||
|
||||
const unsigned int m_opacitySteps;
|
||||
|
||||
@ -58,7 +73,7 @@ private:
|
||||
unsigned int m_fadeValue;
|
||||
|
||||
volatile bool m_canClose;
|
||||
volatile bool m_taskBarInit;
|
||||
volatile bool m_taskBarFlag;
|
||||
|
||||
private slots:
|
||||
void updateHandler(void);
|
||||
@ -68,5 +83,4 @@ protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
bool winEvent(MSG *message, long *result);
|
||||
};
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "Global.h"
|
||||
#include "Dialog_LogView.h"
|
||||
#include "Model_Settings.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/UpdateChecker.h>
|
||||
@ -38,7 +37,7 @@
|
||||
#include <MUtils/Sound.h>
|
||||
#include <MUtils/GUI.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
#include <MUtils/Taskbar7.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QClipboard>
|
||||
@ -64,18 +63,18 @@ while(0)
|
||||
|
||||
#define UPDATE_TASKBAR(STATE, ICON) do \
|
||||
{ \
|
||||
WinSevenTaskbar::setTaskbarState(this->parentWidget(), (STATE)); \
|
||||
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon((ICON))); \
|
||||
m_taskbar->setTaskbarState((STATE)); \
|
||||
m_taskbar->setOverlayIcon(&QIcon((ICON))); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UpdateDialog::UpdateDialog(SettingsModel *settings, QWidget *parent)
|
||||
UpdateDialog::UpdateDialog(const SettingsModel *const settings, QWidget *parent)
|
||||
:
|
||||
QDialog(parent),
|
||||
ui(new Ui::UpdateDialog),
|
||||
m_thread(NULL),
|
||||
m_taskbar(new MUtils::Taskbar7(parent)),
|
||||
m_settings(settings),
|
||||
m_logFile(new QStringList()),
|
||||
m_betaUpdates(settings ? (settings->autoUpdateCheckBeta() || lamexp_version_demo()) : lamexp_version_demo()),
|
||||
@ -101,8 +100,8 @@ UpdateDialog::UpdateDialog(SettingsModel *settings, QWidget *parent)
|
||||
MUtils::GUI::enable_close_button(this, false);
|
||||
|
||||
//Init animation
|
||||
m_animator = new QMovie(":/images/Loading3.gif");
|
||||
ui->labelAnimationCenter->setMovie(m_animator);
|
||||
m_animator.reset(new QMovie(":/images/Loading3.gif"));
|
||||
ui->labelAnimationCenter->setMovie(m_animator.data());
|
||||
m_animator->start();
|
||||
|
||||
//Indicate beta updates
|
||||
@ -128,7 +127,7 @@ UpdateDialog::~UpdateDialog(void)
|
||||
m_animator->stop();
|
||||
}
|
||||
|
||||
if(m_thread)
|
||||
if(!m_thread.isNull())
|
||||
{
|
||||
if(!m_thread->wait(1000))
|
||||
{
|
||||
@ -137,14 +136,10 @@ UpdateDialog::~UpdateDialog(void)
|
||||
}
|
||||
}
|
||||
|
||||
MUTILS_DELETE(m_thread);
|
||||
MUTILS_DELETE(m_logFile);
|
||||
MUTILS_DELETE(m_animator);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NONE);
|
||||
m_taskbar->setOverlayIcon(NULL);
|
||||
|
||||
WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), NULL);
|
||||
|
||||
MUTILS_DELETE(ui);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void UpdateDialog::showEvent(QShowEvent *event)
|
||||
@ -153,14 +148,14 @@ void UpdateDialog::showEvent(QShowEvent *event)
|
||||
|
||||
if(m_firstShow)
|
||||
{
|
||||
if(!m_thread)
|
||||
if(m_thread.isNull())
|
||||
{
|
||||
m_thread = new MUtils::UpdateChecker(m_binaryWGet, m_binaryGnuPG, m_binaryKeys, QLatin1String("LameXP"), lamexp_version_build(), m_betaUpdates);
|
||||
connect(m_thread, SIGNAL(statusChanged(int)), this, SLOT(threadStatusChanged(int)));
|
||||
connect(m_thread, SIGNAL(progressChanged(int)), this, SLOT(threadProgressChanged(int)));
|
||||
connect(m_thread, SIGNAL(messageLogged(QString)), this, SLOT(threadMessageLogged(QString)));
|
||||
connect(m_thread, SIGNAL(finished()), this, SLOT(threadFinished()));
|
||||
connect(m_thread, SIGNAL(terminated()), this, SLOT(threadFinished()));
|
||||
m_thread.reset(new MUtils::UpdateChecker(m_binaryWGet, m_binaryGnuPG, m_binaryKeys, QLatin1String("LameXP"), lamexp_version_build(), m_betaUpdates));
|
||||
connect(m_thread.data(), SIGNAL(statusChanged(int)), this, SLOT(threadStatusChanged(int)));
|
||||
connect(m_thread.data(), SIGNAL(progressChanged(int)), this, SLOT(threadProgressChanged(int)));
|
||||
connect(m_thread.data(), SIGNAL(messageLogged(QString)), this, SLOT(threadMessageLogged(QString)));
|
||||
connect(m_thread.data(), SIGNAL(finished()), this, SLOT(threadFinished()));
|
||||
connect(m_thread.data(), SIGNAL(terminated()), this, SLOT(threadFinished()));
|
||||
}
|
||||
|
||||
threadStatusChanged(m_thread->getUpdateStatus());
|
||||
@ -196,8 +191,8 @@ void UpdateDialog::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
else
|
||||
{
|
||||
WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), NULL);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NONE);
|
||||
m_taskbar->setOverlayIcon(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,11 +221,6 @@ bool UpdateDialog::event(QEvent *e)
|
||||
return QDialog::event(e);
|
||||
}
|
||||
|
||||
bool UpdateDialog::winEvent(MSG *message, long *result)
|
||||
{
|
||||
return WinSevenTaskbar::handleWinEvent(message, result);
|
||||
}
|
||||
|
||||
void UpdateDialog::updateInit(void)
|
||||
{
|
||||
setMinimumSize(size());
|
||||
@ -258,8 +248,8 @@ void UpdateDialog::checkForUpdates(void)
|
||||
}
|
||||
}
|
||||
|
||||
WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNormalState);
|
||||
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/transmit_blue.png"));
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NORMAL);
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/transmit_blue.png"));
|
||||
|
||||
ui->progressBar->setValue(0);
|
||||
ui->installButton->setEnabled(false);
|
||||
@ -294,32 +284,32 @@ void UpdateDialog::threadStatusChanged(const int status)
|
||||
case MUtils::UpdateChecker::UpdateStatus_CompletedUpdateAvailable:
|
||||
ui->statusLabel->setText(tr("A new version of LameXP is available!"));
|
||||
SHOW_HINT(tr("We highly recommend all users to install this update as soon as possible."), ":/icons/shield_exclamation.png");
|
||||
UPDATE_TASKBAR(WinSevenTaskbar::WinSevenTaskbarNormalState, ":/icons/shield_exclamation.png");
|
||||
UPDATE_TASKBAR(MUtils::Taskbar7::TASKBAR_STATE_NORMAL, ":/icons/shield_exclamation.png");
|
||||
break;
|
||||
case MUtils::UpdateChecker::UpdateStatus_CompletedNoUpdates:
|
||||
ui->statusLabel->setText(tr("No new updates available at this time."));
|
||||
SHOW_HINT(tr("Your version of LameXP is still up-to-date. Please check for updates regularly!"), ":/icons/shield_green.png");
|
||||
UPDATE_TASKBAR(WinSevenTaskbar::WinSevenTaskbarNormalState, ":/icons/shield_green.png");
|
||||
UPDATE_TASKBAR(MUtils::Taskbar7::TASKBAR_STATE_NORMAL, ":/icons/shield_green.png");
|
||||
break;
|
||||
case MUtils::UpdateChecker::UpdateStatus_CompletedNewVersionOlder:
|
||||
ui->statusLabel->setText(tr("Your version appears to be newer than the latest release."));
|
||||
SHOW_HINT(tr("This usually indicates your are currently using a pre-release version of LameXP."), ":/icons/shield_blue.png");
|
||||
UPDATE_TASKBAR(WinSevenTaskbar::WinSevenTaskbarNormalState, ":/icons/shield_error.png");
|
||||
UPDATE_TASKBAR(MUtils::Taskbar7::TASKBAR_STATE_NORMAL, ":/icons/shield_error.png");
|
||||
break;
|
||||
case MUtils::UpdateChecker::UpdateStatus_ErrorNoConnection:
|
||||
ui->statusLabel->setText(tr("It appears that the computer currently is offline!"));
|
||||
SHOW_HINT(tr("Please make sure your computer is connected to the internet and try again."), ":/icons/network_error.png");
|
||||
UPDATE_TASKBAR(WinSevenTaskbar::WinSevenTaskbarErrorState, ":/icons/exclamation.png");
|
||||
UPDATE_TASKBAR(MUtils::Taskbar7::TASKBAR_STATE_NORMAL, ":/icons/exclamation.png");
|
||||
break;
|
||||
case MUtils::UpdateChecker::UpdateStatus_ErrorConnectionTestFailed:
|
||||
ui->statusLabel->setText(tr("Network connectivity test has failed!"));
|
||||
SHOW_HINT(tr("Please make sure your computer is connected to the internet and try again."), ":/icons/network_error.png");
|
||||
UPDATE_TASKBAR(WinSevenTaskbar::WinSevenTaskbarErrorState, ":/icons/exclamation.png");
|
||||
UPDATE_TASKBAR(MUtils::Taskbar7::TASKBAR_STATE_NORMAL, ":/icons/exclamation.png");
|
||||
break;
|
||||
case MUtils::UpdateChecker::UpdateStatus_ErrorFetchUpdateInfo:
|
||||
ui->statusLabel->setText(tr("Failed to fetch update information from server!"));
|
||||
SHOW_HINT(tr("Sorry, the update server might be busy at this time. Plase try again later."), ":/icons/server_error.png");
|
||||
UPDATE_TASKBAR(WinSevenTaskbar::WinSevenTaskbarErrorState, ":/icons/exclamation.png");
|
||||
UPDATE_TASKBAR(MUtils::Taskbar7::TASKBAR_STATE_NORMAL, ":/icons/exclamation.png");
|
||||
break;
|
||||
default:
|
||||
qWarning("Unknown status %d !!!", int(status));
|
||||
@ -411,7 +401,7 @@ void UpdateDialog::applyUpdate(void)
|
||||
args << QString("/AppTitle=LameXP (Build #%1)").arg(QString::number(updateInfo->getBuildNo()));
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
UPDATE_TASKBAR(WinSevenTaskbar::WinSevenTaskbarIndeterminateState, ":/icons/transmit_blue.png");
|
||||
UPDATE_TASKBAR(MUtils::Taskbar7::TASKBAR_STATE_INTERMEDIATE, ":/icons/transmit_blue.png");
|
||||
|
||||
process.start(m_binaryUpdater, args);
|
||||
bool updateStarted = process.waitForStarted();
|
||||
@ -434,16 +424,16 @@ void UpdateDialog::applyUpdate(void)
|
||||
{
|
||||
ui->statusLabel->setText(tr("Update ready to install. Applicaion will quit..."));
|
||||
m_updateReadyToInstall = true;
|
||||
WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), NULL);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NONE);
|
||||
m_taskbar->setOverlayIcon(NULL);
|
||||
accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->statusLabel->setText(tr("Update failed. Please try again or download manually!"));
|
||||
WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarErrorState);
|
||||
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/exclamation.png"));
|
||||
WinSevenTaskbar::setTaskbarProgress(this->parentWidget(), 100, 100);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_ERROR);
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/exclamation.png"));
|
||||
m_taskbar->setTaskbarProgress(100, 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -460,7 +450,7 @@ void UpdateDialog::logButtonClicked(void)
|
||||
|
||||
void UpdateDialog::progressBarValueChanged(int value)
|
||||
{
|
||||
WinSevenTaskbar::setTaskbarProgress(this->parentWidget(), value, ui->progressBar->maximum());
|
||||
m_taskbar->setTaskbarProgress(value, ui->progressBar->maximum());
|
||||
}
|
||||
|
||||
void UpdateDialog::testKnownHosts(void)
|
||||
|
@ -31,10 +31,12 @@ class QMovie;
|
||||
namespace MUtils
|
||||
{
|
||||
class UpdateChecker;
|
||||
class Taskbar7;
|
||||
}
|
||||
|
||||
//UIC forward declartion
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class UpdateDialog;
|
||||
}
|
||||
|
||||
@ -44,7 +46,7 @@ class UpdateDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UpdateDialog(SettingsModel *settings, QWidget *parent = 0);
|
||||
UpdateDialog(const SettingsModel *const settings, QWidget *parent = 0);
|
||||
~UpdateDialog(void);
|
||||
|
||||
bool getSuccess(void) { return m_success; }
|
||||
@ -67,23 +69,23 @@ protected:
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void keyPressEvent(QKeyEvent *e);
|
||||
virtual bool winEvent(MSG *message, long *result);
|
||||
virtual bool event(QEvent *e);
|
||||
|
||||
const bool m_betaUpdates;
|
||||
|
||||
private:
|
||||
Ui::UpdateDialog *ui; //for Qt UIC
|
||||
Ui::UpdateDialog *const ui; //for Qt UIC
|
||||
const SettingsModel *const m_settings;
|
||||
|
||||
const QString m_binaryWGet;
|
||||
const QString m_binaryGnuPG;
|
||||
const QString m_binaryKeys;
|
||||
const QString m_binaryUpdater;
|
||||
|
||||
MUtils::UpdateChecker *m_thread;
|
||||
QStringList *m_logFile;
|
||||
SettingsModel *m_settings;
|
||||
QMovie *m_animator;
|
||||
QScopedPointer<MUtils::Taskbar7> m_taskbar;
|
||||
QScopedPointer<MUtils::UpdateChecker> m_thread;
|
||||
QScopedPointer<QStringList> m_logFile;
|
||||
QScopedPointer<QMovie> m_animator;
|
||||
|
||||
unsigned long m_updaterProcess;
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/GUI.h>
|
||||
#include <MUtils/Taskbar7.h>
|
||||
|
||||
//Qt
|
||||
#include <QThread>
|
||||
@ -84,7 +84,9 @@ static inline void UPDATE_MARGINS(QWidget *control, int l = 0, int r = 0, int t
|
||||
WorkingBanner::WorkingBanner(QWidget *parent)
|
||||
:
|
||||
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint),
|
||||
ui(new Ui::WorkingBanner()), m_metrics(NULL), m_working(NULL), m_style(NULL)
|
||||
ui(new Ui::WorkingBanner()),
|
||||
m_taskbar(new MUtils::Taskbar7(parent)),
|
||||
m_metrics(NULL), m_working(NULL), m_style(NULL)
|
||||
{
|
||||
//Init the dialog, from the .ui file
|
||||
ui->setupUi(this);
|
||||
@ -93,18 +95,18 @@ WorkingBanner::WorkingBanner(QWidget *parent)
|
||||
//Enable the "sheet of glass" effect
|
||||
if(MUtils::GUI::sheet_of_glass(this))
|
||||
{
|
||||
m_style = new QWindowsVistaStyle();
|
||||
this->setStyle(m_style);
|
||||
ui->progressBar->setStyle(m_style);
|
||||
ui->labelStatus->setStyle(m_style);
|
||||
m_style.reset(new QWindowsVistaStyle());
|
||||
this->setStyle(m_style.data());
|
||||
ui->progressBar->setStyle(m_style.data());
|
||||
ui->labelStatus->setStyle(m_style.data());
|
||||
ui->labelStatus->setStyleSheet("background-color: #FFFFFF;");
|
||||
}
|
||||
else
|
||||
{
|
||||
UPDATE_MARGINS(this, 5);
|
||||
m_working = new QMovie(":/images/Busy.gif");
|
||||
m_working.reset(new QMovie(":/images/Busy.gif"));
|
||||
m_working->setCacheMode(QMovie::CacheAll);
|
||||
ui->labelWorking->setMovie(m_working);
|
||||
ui->labelWorking->setMovie(m_working.data());
|
||||
}
|
||||
|
||||
//Set Opacity
|
||||
@ -123,14 +125,11 @@ WorkingBanner::WorkingBanner(QWidget *parent)
|
||||
|
||||
WorkingBanner::~WorkingBanner(void)
|
||||
{
|
||||
if(m_working)
|
||||
if(!m_working.isNull())
|
||||
{
|
||||
m_working->stop();
|
||||
MUTILS_DELETE(m_working);
|
||||
}
|
||||
|
||||
MUTILS_DELETE(m_style);
|
||||
MUTILS_DELETE(m_metrics);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -163,8 +162,8 @@ void WorkingBanner::show(const QString &text, QThread *thread)
|
||||
connect(thread, SIGNAL(terminated()), loop, SLOT(quit()));
|
||||
|
||||
//Set taskbar state
|
||||
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), &QIcon(":/icons/hourglass.png"));
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/hourglass.png"));
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_INTERMEDIATE);
|
||||
|
||||
//Start the thread
|
||||
thread->start();
|
||||
@ -182,8 +181,8 @@ void WorkingBanner::show(const QString &text, QThread *thread)
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
//Set taskbar state
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NONE);
|
||||
m_taskbar->setOverlayIcon(NULL);
|
||||
|
||||
//Free memory
|
||||
MUTILS_DELETE(loop);
|
||||
@ -198,8 +197,8 @@ void WorkingBanner::show(const QString &text, QEventLoop *loop)
|
||||
this->show(text);
|
||||
|
||||
//Set taskbar state
|
||||
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), &QIcon(":/icons/hourglass.png"));
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
|
||||
m_taskbar->setOverlayIcon(&QIcon(":/icons/hourglass.png"));
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_INTERMEDIATE);
|
||||
|
||||
//Update cursor
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
@ -211,8 +210,8 @@ void WorkingBanner::show(const QString &text, QEventLoop *loop)
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
//Set taskbar state
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NONE);
|
||||
m_taskbar->setOverlayIcon(NULL);
|
||||
|
||||
//Hide splash
|
||||
this->close();
|
||||
@ -254,11 +253,6 @@ void WorkingBanner::closeEvent(QCloseEvent *event)
|
||||
if(!m_canClose) event->ignore();
|
||||
}
|
||||
|
||||
bool WorkingBanner::winEvent(MSG *message, long *result)
|
||||
{
|
||||
return WinSevenTaskbar::handleWinEvent(message, result);
|
||||
}
|
||||
|
||||
void WorkingBanner::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent(event);
|
||||
@ -295,9 +289,9 @@ void WorkingBanner::windowShown(void)
|
||||
|
||||
void WorkingBanner::setText(const QString &text)
|
||||
{
|
||||
if(!m_metrics)
|
||||
if(m_metrics.isNull())
|
||||
{
|
||||
m_metrics = new QFontMetrics(ui->labelStatus->font());
|
||||
m_metrics.reset(new QFontMetrics(ui->labelStatus->font()));
|
||||
}
|
||||
|
||||
if(m_metrics->width(text) <= ui->labelStatus->width() - 16)
|
||||
@ -322,12 +316,12 @@ void WorkingBanner::setProgressMax(unsigned int max)
|
||||
ui->progressBar->setMaximum(max);
|
||||
if(ui->progressBar->maximum() > ui->progressBar->minimum())
|
||||
{
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setTaskbarProgress(dynamic_cast<QWidget*>(this->parent()), ui->progressBar->value(), ui->progressBar->maximum());
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_NONE);
|
||||
m_taskbar->setTaskbarProgress(ui->progressBar->value(), ui->progressBar->maximum());
|
||||
}
|
||||
else
|
||||
{
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
|
||||
m_taskbar->setTaskbarState(MUtils::Taskbar7::TASKBAR_STATE_INTERMEDIATE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +330,7 @@ void WorkingBanner::setProgressVal(unsigned int val)
|
||||
ui->progressBar->setValue(val);
|
||||
if(ui->progressBar->maximum() > ui->progressBar->minimum())
|
||||
{
|
||||
WinSevenTaskbar::setTaskbarProgress(dynamic_cast<QWidget*>(this->parent()), ui->progressBar->value(), ui->progressBar->maximum());
|
||||
m_taskbar->setTaskbarProgress(ui->progressBar->value(), ui->progressBar->maximum());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,11 @@ namespace Ui
|
||||
class WorkingBanner;
|
||||
}
|
||||
|
||||
namespace MUtils
|
||||
{
|
||||
class Taskbar7;
|
||||
}
|
||||
|
||||
class QEventLoop;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -50,7 +55,9 @@ public:
|
||||
private:
|
||||
Ui::WorkingBanner *const ui;
|
||||
|
||||
QMovie *m_working;
|
||||
QScopedPointer<MUtils::Taskbar7> m_taskbar;
|
||||
QScopedPointer<QMovie> m_working;
|
||||
|
||||
bool m_canClose;
|
||||
|
||||
public slots:
|
||||
@ -67,10 +74,9 @@ protected:
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
virtual void keyReleaseEvent(QKeyEvent *event);
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual bool winEvent(MSG *message, long *result);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
virtual void hideEvent(QHideEvent *event);
|
||||
|
||||
QFontMetrics *m_metrics;
|
||||
QStyle *m_style;
|
||||
QScopedPointer<QFontMetrics> m_metrics;
|
||||
QScopedPointer<QStyle> m_style;
|
||||
};
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "Model_FileList.h"
|
||||
#include "Model_AudioFile.h"
|
||||
#include "Encoder_Abstract.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUitls
|
||||
#include <MUtils/Global.h>
|
||||
@ -243,15 +242,9 @@ static int lamexp_main(int &argc, char **argv)
|
||||
InitializationThread::selfTest();
|
||||
}
|
||||
|
||||
//Taskbar init
|
||||
WinSevenTaskbar::init();
|
||||
|
||||
//Main application loop
|
||||
iResult = lamexp_main_loop(cpuFeatures, ipcChannel.data(), iShutdown);
|
||||
|
||||
//Taskbar un-init
|
||||
WinSevenTaskbar::uninit();
|
||||
|
||||
//Final clean-up
|
||||
qDebug("Shutting down, please wait...\n");
|
||||
|
||||
|
@ -1,173 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2014 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, but always including the *additional*
|
||||
// restrictions defined in the "License.txt" file.
|
||||
//
|
||||
// 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"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Exception.h>
|
||||
|
||||
//Qt
|
||||
#include <QWidget>
|
||||
#include <QIcon>
|
||||
|
||||
//Windows includes
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <ShObjIdl.h>
|
||||
|
||||
static UINT s_winMsg = 0;
|
||||
static ITaskbarList3 *s_ptbl = NULL;
|
||||
|
||||
WinSevenTaskbar::WinSevenTaskbar(void)
|
||||
{
|
||||
MUTILS_THROW("Cannot create instance of this class!");
|
||||
}
|
||||
|
||||
WinSevenTaskbar::~WinSevenTaskbar(void)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
|
||||
|
||||
void WinSevenTaskbar::init(void)
|
||||
{
|
||||
s_winMsg = RegisterWindowMessageW(L"TaskbarButtonCreated");
|
||||
s_ptbl = NULL;
|
||||
}
|
||||
|
||||
void WinSevenTaskbar::uninit(void)
|
||||
{
|
||||
if(s_ptbl)
|
||||
{
|
||||
s_ptbl->Release();
|
||||
s_ptbl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool WinSevenTaskbar::handleWinEvent(void *message, long *result)
|
||||
{
|
||||
bool stopEvent = false;
|
||||
|
||||
if(((MSG*)message)->message == s_winMsg)
|
||||
{
|
||||
if(!s_ptbl) createInterface();
|
||||
*result = (s_ptbl) ? S_OK : S_FALSE;
|
||||
stopEvent = true;
|
||||
}
|
||||
|
||||
return stopEvent;
|
||||
}
|
||||
|
||||
void WinSevenTaskbar::createInterface(void)
|
||||
{
|
||||
if(!s_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))
|
||||
{
|
||||
s_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(s_ptbl && window)
|
||||
{
|
||||
HRESULT hr = HRESULT(-1);
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case WinSevenTaskbarNoState:
|
||||
hr = s_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_NOPROGRESS);
|
||||
break;
|
||||
case WinSevenTaskbarNormalState:
|
||||
hr = s_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_NORMAL);
|
||||
break;
|
||||
case WinSevenTaskbarIndeterminateState:
|
||||
hr = s_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_INDETERMINATE);
|
||||
break;
|
||||
case WinSevenTaskbarErrorState:
|
||||
hr = s_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_ERROR);
|
||||
break;
|
||||
case WinSevenTaskbarPausedState:
|
||||
hr = s_ptbl->SetProgressState(reinterpret_cast<HWND>(window->winId()), TBPF_PAUSED);
|
||||
break;
|
||||
}
|
||||
|
||||
result = SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void WinSevenTaskbar::setTaskbarProgress(QWidget *window, unsigned __int64 currentValue, unsigned __int64 maximumValue)
|
||||
{
|
||||
if(s_ptbl && window)
|
||||
{
|
||||
s_ptbl->SetProgressValue(reinterpret_cast<HWND>(window->winId()), currentValue, maximumValue);
|
||||
}
|
||||
}
|
||||
|
||||
void WinSevenTaskbar::setOverlayIcon(QWidget *window, QIcon *icon)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
if(s_ptbl && window)
|
||||
{
|
||||
s_ptbl->SetOverlayIcon(window->winId(), (icon ? icon->pixmap(16,16).toWinHICON() : NULL), L"LameXP");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#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__
|
@ -1,57 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2014 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, but always including the *additional*
|
||||
// restrictions defined in the "License.txt" file.
|
||||
//
|
||||
// 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 "Global.h"
|
||||
|
||||
class QWidget;
|
||||
class QIcon;
|
||||
|
||||
class WinSevenTaskbar
|
||||
{
|
||||
public:
|
||||
WinSevenTaskbar(void);
|
||||
~WinSevenTaskbar(void);
|
||||
|
||||
//Taskbar states
|
||||
enum WinSevenTaskbarState
|
||||
{
|
||||
WinSevenTaskbarNoState = 0,
|
||||
WinSevenTaskbarNormalState = 1,
|
||||
WinSevenTaskbarIndeterminateState = 2,
|
||||
WinSevenTaskbarPausedState = 3,
|
||||
WinSevenTaskbarErrorState = 4
|
||||
};
|
||||
|
||||
//Public interface
|
||||
static bool handleWinEvent(void *message, long *result);
|
||||
static bool setTaskbarState(QWidget *window, WinSevenTaskbarState state);
|
||||
static void setTaskbarProgress(QWidget *window, unsigned __int64 currentValue, unsigned __int64 maximumValue);
|
||||
static void setOverlayIcon(QWidget *window, QIcon *icon);
|
||||
|
||||
static void init(void);
|
||||
static void uninit(void);
|
||||
|
||||
private:
|
||||
static void createInterface(void);
|
||||
};
|
Loading…
Reference in New Issue
Block a user