diff --git a/LameXP.rc b/LameXP.rc index 2b6612dd..c6d92c4a 100644 --- a/LameXP.rc +++ b/LameXP.rc @@ -112,6 +112,8 @@ IDR_WAVE_ABORTED WAVE "res\\sounds\\aborted.wav" IDR_WAVE_WHAMMY WAVE "res\\sounds\\whammy.wav" IDR_WAVE_WOOHOO WAVE "res\\sounds\\woohoo.wav" IDR_WAVE_SHUTDOWN WAVE "res\\sounds\\shutdown.wav" +IDR_WAVE_BEEP WAVE "res\\sounds\\beep.wav" +IDR_WAVE_BEEP_LONG WAVE "res\\sounds\\beep2.wav" ///////////////////////////////////////////////////////////////////////////// // diff --git a/res/sounds/beep.wav b/res/sounds/beep.wav new file mode 100644 index 00000000..2c740dd7 Binary files /dev/null and b/res/sounds/beep.wav differ diff --git a/res/sounds/beep2.wav b/res/sounds/beep2.wav new file mode 100644 index 00000000..3be5e9fb Binary files /dev/null and b/res/sounds/beep2.wav differ diff --git a/src/Config.h b/src/Config.h index e39bc953..ad93ad63 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 1 -#define VER_LAMEXP_BUILD 372 +#define VER_LAMEXP_BUILD 373 #define VER_LAMEXP_SUFFIX Beta-9 /* diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index e4dd2b05..e7957fdb 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -402,8 +402,11 @@ void ProcessingDialog::doneEncoding(void) if(!m_userAborted && checkBox_shutdownComputer->isChecked()) { - qWarning("Initiating shutdown sequence!"); - shutdownComputer(); + if(shutdownComputer()) + { + m_shutdownFlag = true; + accept(); + } } } @@ -711,12 +714,14 @@ void ProcessingDialog::systemTrayActivated(QSystemTrayIcon::ActivationReason rea } } -void ProcessingDialog::shutdownComputer(void) +bool ProcessingDialog::shutdownComputer(void) { const int iTimeout = 30; const Qt::WindowFlags flags = Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowSystemMenuHint; const QString text = QString("%1%2%1").arg(QString().fill(' ', 18), tr("Warning: Computer will shutdown in %1 seconds...")); + qWarning("Initiating shutdown sequence!"); + QProgressDialog progressDialog(text.arg(iTimeout), tr("Cancel Shutdown"), 0, iTimeout + 1, this, flags); progressDialog.setModal(true); progressDialog.setAutoClose(false); @@ -728,7 +733,9 @@ void ProcessingDialog::shutdownComputer(void) if(m_settings->soundsEnabled()) { + QApplication::setOverrideCursor(Qt::WaitCursor); PlaySound(MAKEINTRESOURCE(IDR_WAVE_SHUTDOWN), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); + QApplication::restoreOverrideCursor(); } QTimer timer; @@ -742,19 +749,18 @@ void ProcessingDialog::shutdownComputer(void) for(int i = 1; i <= iTimeout; i++) { eventLoop.exec(); - if(progressDialog.wasCanceled()) break; + if(progressDialog.wasCanceled()) + { + progressDialog.close(); + return false; + } progressDialog.setValue(i+1); progressDialog.setLabelText(text.arg(iTimeout-i)); if(iTimeout-i == 3) progressDialog.setCancelButtonText(QString()); QApplication::processEvents(); - Beep(4000, (i < iTimeout) ? 100 : 1000); + PlaySound(MAKEINTRESOURCE((i < iTimeout) ? IDR_WAVE_BEEP : IDR_WAVE_BEEP_LONG), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC); } - if(!progressDialog.wasCanceled()) - { - m_shutdownFlag = true; - accept(); - } - progressDialog.close(); + return true; } diff --git a/src/Dialog_Processing.h b/src/Dialog_Processing.h index 96647b93..c83e9b3c 100644 --- a/src/Dialog_Processing.h +++ b/src/Dialog_Processing.h @@ -66,7 +66,7 @@ private: void startNextJob(void); AudioFileModel updateMetaInfo(const AudioFileModel &audioFile); void writePlayList(void); - void shutdownComputer(void); + bool shutdownComputer(void); QList m_pendingJobs; SettingsModel *m_settings; diff --git a/src/Main.cpp b/src/Main.cpp index 060de100..936bdbb3 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -162,7 +162,7 @@ int lamexp_main(int argc, char* argv[]) //Shotdown computer if(bShutdown) { - if(!lamexp_shutdown_computer("LameXP planned computer shutdown!", 12)) + if(!lamexp_shutdown_computer(QApplication::applicationFilePath(), 12)) { QMessageBox messageBox(QMessageBox::Critical, "LameXP", "Sorry, LameXP was unable to shutdown your computer!", QMessageBox::NoButton, NULL, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint); } diff --git a/src/Resource.h b/src/Resource.h index 0572fac9..048b55b0 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -33,6 +33,8 @@ #define IDR_WAVE_WHAMMY 670 #define IDR_WAVE_WOOHOO 671 #define IDR_WAVE_SHUTDOWN 672 +#define IDR_WAVE_BEEP 673 +#define IDR_WAVE_BEEP_LONG 674 /* * Next default values for new objects