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"
/////////////////////////////////////////////////////////////////////////////
//
AdditionalOptions=""/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'""
AdditionalDependencies="qtmain.lib QtCore4.lib QtGui4.lib Winmm.lib Shlwapi.lib"
ShowProgress="2"
+ Version=""
LinkIncremental="1"
AdditionalLibraryDirectories=""$(QTDIR)\lib";"$(QTDIR)\plugins\imageformats""
GenerateDebugInformation="false"
AdditionalOptions=""/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'""
AdditionalDependencies="qtmain.lib QtCore.lib QtGui.lib QtSvg.lib qsvg.lib qico.lib Winmm.lib imm32.lib ws2_32.lib Shlwapi.lib"
ShowProgress="2"
- Version=""
LinkIncremental="1"
AdditionalLibraryDirectories=""$(SolutionDir)\etc\Prerequisites\qt4_static\lib";"$(SolutionDir)\etc\Prerequisites\qt4_static\plugins\imageformats""
IgnoreDefaultLibraryNames=""
<a name="4.01">Changes between v4.00 and v4.01:</a><br><ul>
<li>Added an option to manually specify the number of parallel instances
<li>Added an option to select a user-defined TEMP directory
+<li>Added an option to shutdown the computer as soon as all files are completed
<li>Updated Qt runtime libraries to v4.7.2
<li>Updated LAME encoder to v3.99.0.14 (2011-02-28), compiled with ICL 12.0.2
<li>Updated Vorbis encoder to v2.87 using aoTuV Beta-6.02 (2011-02-28), compiled with ICL 11.1 and MSVC 9.0
Millennium Edition or Windows NT 4.0. There is nothing you can do about that, except for updating to a less<br>
antiquated OS. Running an outdated/unsupported OS is a severe security risk anyway!<br>
<br>
-Remark: Executable files compiled with Microsoft Visual Studio 2005 (or later) won't load on Windows 9x.<br>
-<br><br>
+Remark: Executable files compiled with Microsoft Visual Studio 2005 (or later) won't load on Windows 9x.<br><br>
<br><br>
<translation type="unfinished"></translation>
</message>
<message>
+ <source>Shutdown the computer as soon as all files have been converted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>Abort</source>
<translation type="unfinished"></translation>
</message>
<source>The playlist file could not be created:</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Warning: Computer will shutdown in %1 seconds...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cancel Shutdown</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>ProgressModel</name>
<source>Browse Output File Location</source>
<translation>Ausgabedatei suchen</translation>
</message>
+ <message>
+ <source>Shutdown the computer as soon as all files have been converted</source>
+ <translation>Computer herunterfahren sobald alle Dateien fertiggestellt sind</translation>
+ </message>
+ <message>
+ <source>Warning: Computer will shutdown in %1 seconds...</source>
+ <translation>Achtung: Computer wird in %1 Sekunden heruntergefahren...</translation>
+ </message>
+ <message>
+ <source>Cancel Shutdown</source>
+ <translation>Herunterfahren abbrechen</translation>
+ </message>
</context>
<context>
<name>ProgressModel</name>
<source>Browse Output File Location</source>
<translation>Navegar hasta la ubicación del archivo de salida</translation>
</message>
+ <message>
+ <source>Shutdown the computer as soon as all files have been converted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Warning: Computer will shutdown in %1 seconds...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cancel Shutdown</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>ProgressModel</name>
<source>Browse Output File Location</source>
<translation>Rechercher l'emplacement du fichier de sortie</translation>
</message>
+ <message>
+ <source>Shutdown the computer as soon as all files have been converted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Warning: Computer will shutdown in %1 seconds...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cancel Shutdown</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>ProgressModel</name>
<source>Browse Output File Location</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Shutdown the computer as soon as all files have been converted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Warning: Computer will shutdown in %1 seconds...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cancel Shutdown</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>ProgressModel</name>
<source>The playlist file could not be created:</source>
<translation type="unfinished">Плэйлист неможет быть создан:</translation>
</message>
+ <message>
+ <source>Shutdown the computer as soon as all files have been converted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Warning: Computer will shutdown in %1 seconds...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cancel Shutdown</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>ProgressModel</name>
<source>Browse Output File Location</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Shutdown the computer as soon as all files have been converted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Warning: Computer will shutdown in %1 seconds...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cancel Shutdown</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>ProgressModel</name>
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="checkBox_shutdownComputer">
+ <property name="text">
+ <string>Shutdown the computer as soon as all files have been converted</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="layout_horizontal">
<item>
<widget class="QLabel" name="label_versionInfo">
<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>
<file>icons/house.png</file>
<file>icons/hourglass.png</file>
<file>icons/information.png</file>
+ <file>icons/lightning.png</file>
<file>icons/media_play.png</file>
<file>icons/money_dollar.png</file>
<file>icons/monitor.png</file>
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 1
-#define VER_LAMEXP_BUILD 367
-#define VER_LAMEXP_SUFFIX Beta-8
+#define VER_LAMEXP_BUILD 372
+#define VER_LAMEXP_SUFFIX Beta-9
/*
* Tools versions
#include <QMenu>
#include <QSystemTrayIcon>
#include <QProcess>
+#include <QProgressDialog>
#include <Windows.h>
QDialog(parent),
m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
m_settings(settings),
- m_metaInfo(metaInfo)
+ m_metaInfo(metaInfo),
+ m_shutdownFlag(false)
{
//Init the dialog, from the .ui file
setupUi(this);
button_closeDialog->setEnabled(false);
button_AbortProcess->setEnabled(true);
progressBar->setRange(0, m_pendingJobs.count());
+ checkBox_shutdownComputer->setEnabled(true);
+ checkBox_shutdownComputer->setChecked(false);
WinSevenTaskbar::initTaskbar();
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
setCloseButtonEnabled(true);
button_closeDialog->setEnabled(true);
button_AbortProcess->setEnabled(false);
+ checkBox_shutdownComputer->setEnabled(false);
view_log->scrollToBottom();
m_progressIndicator->stop();
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
QApplication::restoreOverrideCursor();
+
+ if(!m_userAborted && checkBox_shutdownComputer->isChecked())
+ {
+ qWarning("Initiating shutdown sequence!");
+ shutdownComputer();
+ }
}
void ProcessingDialog::processFinished(const QUuid &jobId, const QString &outFileName, bool success)
SetForegroundWindow(this->winId());
}
}
+
+void 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..."));
+
+ QProgressDialog progressDialog(text.arg(iTimeout), tr("Cancel Shutdown"), 0, iTimeout + 1, this, flags);
+ progressDialog.setModal(true);
+ progressDialog.setAutoClose(false);
+ progressDialog.setAutoReset(false);
+ progressDialog.setWindowIcon(QIcon(":/icons/lightning.png"));
+ progressDialog.show();
+
+ QApplication::processEvents();
+
+ if(m_settings->soundsEnabled())
+ {
+ PlaySound(MAKEINTRESOURCE(IDR_WAVE_SHUTDOWN), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
+ }
+
+ QTimer timer;
+ timer.setInterval(1000);
+ timer.start();
+
+ QEventLoop eventLoop(this);
+ connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
+ connect(&progressDialog, SIGNAL(canceled()), &eventLoop, SLOT(quit()));
+
+ for(int i = 1; i <= iTimeout; i++)
+ {
+ eventLoop.exec();
+ if(progressDialog.wasCanceled()) break;
+ 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);
+ }
+
+ if(!progressDialog.wasCanceled())
+ {
+ m_shutdownFlag = true;
+ accept();
+ }
+
+ progressDialog.close();
+}
public:
ProcessingDialog(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settings, QWidget *parent = 0);
~ProcessingDialog(void);
+
+ bool getShutdownFlag(void) { return m_shutdownFlag; }
private slots:
void initEncoding(void);
void startNextJob(void);
AudioFileModel updateMetaInfo(const AudioFileModel &audioFile);
void writePlayList(void);
+ void shutdownComputer(void);
QList<AudioFileModel> m_pendingJobs;
SettingsModel *m_settings;
QList<QUuid> m_failedJobs;
bool m_userAborted;
QSystemTrayIcon *m_systemTray;
+ bool m_shutdownFlag;
};
}
}
+ //Update console icon, if a console is attached
+ if(g_lamexp_console_attached)
+ {
+ typedef DWORD (__stdcall *SetConsoleIconFun)(HICON);
+ QLibrary kernel32("kernel32.dll");
+ SetConsoleIconFun SetConsoleIconPtr = (SetConsoleIconFun) kernel32.resolve("SetConsoleIcon");
+ if(SetConsoleIconPtr)
+ {
+ SetConsoleIconPtr(QIcon(":/icons/sound.png").pixmap(16, 16).toWinHICON());
+ }
+ }
+
//Done
qt_initialized = true;
return true;
}
}
+bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown)
+{
+ HANDLE hToken = NULL;
+
+ if(OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
+ {
+ TOKEN_PRIVILEGES privileges;
+ memset(&privileges, 0, sizeof(TOKEN_PRIVILEGES));
+ privileges.PrivilegeCount = 1;
+ privileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+ if(LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &privileges.Privileges[0].Luid))
+ {
+ if(AdjustTokenPrivileges(hToken, FALSE, &privileges, NULL, NULL, NULL))
+ {
+ const DWORD reason = SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_FLAG_PLANNED;
+ return InitiateSystemShutdownEx(NULL, const_cast<wchar_t*>(QWCHAR(message)), timeout, forceShutdown, FALSE, reason);
+ }
+ }
+ }
+
+ return false;
+}
+
/*
* Finalization function (final clean-up)
*/
void lamexp_ipc_send(unsigned int command, const char* message);
lamexp_cpu_t lamexp_detect_cpu_features(void);
bool lamexp_portable_mode(void);
+bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true);
//Translation support
QStringList lamexp_query_translations(void);
{
int iResult = -1;
bool bAccepted = true;
+ bool bShutdown = false;
//Init console
lamexp_init_console(argc, argv);
MainWindow *poMainWindow = new MainWindow(fileListModel, metaInfo, settingsModel);
//Main application loop
- while(bAccepted)
+ while(bAccepted && !bShutdown)
{
//Show main window
poMainWindow->show();
{
ProcessingDialog *processingDialog = new ProcessingDialog(fileListModel, metaInfo, settingsModel);
processingDialog->exec();
+ bShutdown = processingDialog->getShutdownFlag();
LAMEXP_DELETE(processingDialog);
}
}
//Final clean-up
qDebug("Shutting down, please wait...\n");
+ //Shotdown computer
+ if(bShutdown)
+ {
+ if(!lamexp_shutdown_computer("LameXP planned computer shutdown!", 12))
+ {
+ QMessageBox messageBox(QMessageBox::Critical, "LameXP", "Sorry, LameXP was unable to shutdown your computer!", QMessageBox::NoButton, NULL, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
+ }
+ }
+
//Terminate
return iResult;
}
#define IDR_WAVE_ABORTED 669
#define IDR_WAVE_WHAMMY 670
#define IDR_WAVE_WOOHOO 671
+#define IDR_WAVE_SHUTDOWN 672
/*
* Next default values for new objects