#include "Resource.h"
#include "Dialog_LogView.h"
#include "Model_Settings.h"
+#include "WinSevenTaskbar.h"
#include <QClipboard>
#include <QFileDialog>
connect(installButton, SIGNAL(clicked()), this, SLOT(applyUpdate()));
connect(infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString)));
connect(logButton, SIGNAL(clicked()), this, SLOT(logButtonClicked()));
+
+ //Enable progress bar
+ connect(progressBar, SIGNAL(valueChanged(int)), this, SLOT(progressBarValueChanged(int)));
}
UpdateDialog::~UpdateDialog(void)
{
LAMEXP_DELETE(m_updateInfo);
LAMEXP_DELETE(m_logFile);
+
+ WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNoState);
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), NULL);
}
void UpdateDialog::showEvent(QShowEvent *event)
void UpdateDialog::closeEvent(QCloseEvent *event)
{
- if(!closeButton->isEnabled()) event->ignore();
+ if(!closeButton->isEnabled())
+ {
+ event->ignore();
+ }
+ else
+ {
+ WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNoState);
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), NULL);
+ }
}
void UpdateDialog::keyPressEvent(QKeyEvent *e)
m_updateInfo = new UpdateInfo;
progressBar->setValue(0);
+ WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNormalState);
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/transmit_blue.png"));
installButton->setEnabled(false);
closeButton->setEnabled(false);
retryButton->setEnabled(false);
if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_ERROR), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
QApplication::restoreOverrideCursor();
progressBar->setValue(progressBar->maximum());
+ WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarErrorState);
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/exclamation.png"));
return;
}
QApplication::restoreOverrideCursor();
progressBar->setValue(progressBar->maximum());
-
+
if(!success)
{
if(!retryButton->isVisible()) retryButton->show();
logButton->setEnabled(true);
statusLabel->setText(tr("Failed to fetch update information from server!"));
progressBar->setValue(progressBar->maximum());
+ WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarErrorState);
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/exclamation.png"));
hintIcon->setPixmap(QIcon(":/icons/server_error.png").pixmap(16,16));
hintLabel->setText(tr("Sorry, the update server might be busy at this time. Plase try again later."));
hintIcon->show();
hintLabel->setText(tr("We highly recommend all users to install this update as soon as possible."));
hintIcon->show();
hintLabel->show();
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/bell.png"));
MessageBeep(MB_ICONINFORMATION);
}
else if(m_updateInfo->m_buildNo == lamexp_version_build())
hintLabel->setText(tr("Your version of LameXP is still up-to-date. Please check for updates regularly!"));
hintIcon->show();
hintLabel->show();
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/information.png"));
MessageBeep(MB_ICONINFORMATION);
}
else
hintLabel->setText(tr("This usually indicates your are currently using a pre-release version of LameXP."));
hintIcon->show();
hintLabel->show();
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/bug.png"));
MessageBeep(MB_ICONEXCLAMATION);
}
args << QString("/AppTitle=LameXP (Build #%1)").arg(QString::number(m_updateInfo->m_buildNo));
QApplication::setOverrideCursor(Qt::WaitCursor);
+ WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), &QIcon(":/icons/transmit_blue.png"));
+
process.start(m_binaryUpdater, args);
loop.exec();
QApplication::restoreOverrideCursor();
-
+
if(process.exitCode() == 0)
{
statusLabel->setText("Update ready to install. Applicaion will quit...");
m_updateReadyToInstall = true;
+ WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNoState);
+ WinSevenTaskbar::setOverlayIcon(this->parentWidget(), NULL);
accept();
}
else
{
statusLabel->setText("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);
}
}
logView->exec(*m_logFile);
LAMEXP_DELETE(logView);
}
+
+void UpdateDialog::progressBarValueChanged(int value)
+{
+ WinSevenTaskbar::setTaskbarProgress(this->parentWidget(), value, progressBar->maximum());
+}