Implemented function to download and install the WMA File Decoder. Support for WMA files has not been implemented yet though.
This commit is contained in:
parent
4650e02aac
commit
640fa19f09
@ -1159,8 +1159,19 @@
|
||||
<property name="title">
|
||||
<string>Tools</string>
|
||||
</property>
|
||||
<addaction name="actionDisableUpdateReminder"/>
|
||||
<widget class="QMenu" name="menuConfiguration">
|
||||
<property name="title">
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res/Icons.qrc">
|
||||
<normaloff>:/icons/wrench.png</normaloff>:/icons/wrench.png</iconset>
|
||||
</property>
|
||||
<addaction name="actionDisableSounds"/>
|
||||
<addaction name="actionDisableUpdateReminder"/>
|
||||
</widget>
|
||||
<addaction name="menuConfiguration"/>
|
||||
<addaction name="actionInstallWMADecoder"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
@ -1332,6 +1343,15 @@
|
||||
<string>Disable Sound Effects</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInstallWMADecoder">
|
||||
<property name="icon">
|
||||
<iconset resource="../res/Icons.qrc">
|
||||
<normaloff>:/icons/wma.png</normaloff>:/icons/wma.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Install WMA Decoder</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
@ -1421,6 +1441,8 @@
|
||||
<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>
|
||||
|
@ -64,7 +64,9 @@
|
||||
<file>icons/transmit_blue.png</file>
|
||||
<file>icons/user.png</file>
|
||||
<file>icons/user_suit.png</file>
|
||||
<file>icons/wma.png</file>
|
||||
<file>icons/world.png</file>
|
||||
<file>icons/wrench.png</file>
|
||||
<file>icons/zoom.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<RCC version="1.0">
|
||||
<qresource>
|
||||
<file>tools/alac.exe</file>
|
||||
<file>tools/elevator.exe</file>
|
||||
<file>tools/faad.exe</file>
|
||||
<file>tools/flac.exe</file>
|
||||
<file>tools/gpgv.exe</file>
|
||||
|
BIN
res/icons/wma.png
Normal file
BIN
res/icons/wma.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
res/tools/elevator.exe
Normal file
BIN
res/tools/elevator.exe
Normal file
Binary file not shown.
@ -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 142
|
||||
#define VER_LAMEXP_BUILD 144
|
||||
#define VER_LAMEXP_SUFFIX TechPreview
|
||||
|
||||
/*
|
||||
|
@ -250,6 +250,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
|
||||
actionDisableSounds->setChecked(!m_settings->soundsEnabled());
|
||||
connect(actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
|
||||
connect(actionDisableSounds, SIGNAL(triggered(bool)), this, SLOT(disableSoundsActionTriggered(bool)));
|
||||
connect(actionInstallWMADecoder, SIGNAL(triggered(bool)), this, SLOT(installWMADecoderActionTriggered(bool)));
|
||||
|
||||
//Activate help menu actions
|
||||
connect(actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
|
||||
@ -1399,3 +1400,49 @@ void MainWindow::disableSoundsActionTriggered(bool checked)
|
||||
|
||||
actionDisableSounds->setChecked(!m_settings->soundsEnabled());
|
||||
}
|
||||
|
||||
void MainWindow::installWMADecoderActionTriggered(bool checked)
|
||||
{
|
||||
static const char *download_url = "http://www.nch.com.au/components/wmawav.exe";
|
||||
|
||||
if(QMessageBox::question(this, "Install WMA Decoder", "Do you want to download and install the WMA File Deocder now?", "Download && Install", "Cancel") != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString binaryWGet = lamexp_lookup_tool("wget.exe");
|
||||
QString binaryElevator = lamexp_lookup_tool("elevator.exe");
|
||||
|
||||
if(binaryWGet.isEmpty() || binaryElevator.isEmpty())
|
||||
{
|
||||
throw "Required binary is not available!";
|
||||
}
|
||||
|
||||
QString setupFile = QString("%1/%2.exe").arg(lamexp_temp_folder(), lamexp_rand_str());
|
||||
|
||||
QProcess process;
|
||||
process.setWorkingDirectory(QFileInfo(setupFile).absolutePath());
|
||||
|
||||
QEventLoop loop;
|
||||
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
|
||||
connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit()));
|
||||
|
||||
process.start(binaryWGet, QStringList() << "-O" << QFileInfo(setupFile).fileName() << download_url);
|
||||
m_banner->show("Downloading WMA Decoder Setup, please wait...", &loop);
|
||||
|
||||
if(process.exitCode() != 0 || QFileInfo(setupFile).size() < 10240)
|
||||
{
|
||||
QFile::remove(setupFile);
|
||||
QMessageBox::critical(this, "Download Failed", "Failed to download the WMA Decoder. Check your internet connection!");
|
||||
return;
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
process.start(binaryElevator, QStringList() << QString("/exec=%1").arg(setupFile));
|
||||
loop.exec(QEventLoop::ExcludeUserInputEvents);
|
||||
QFile::remove(setupFile);
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
QMessageBox::information(this, "WMA Decoder", "The WMA Decoder has been installed. Please restart LameXP now!");
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,7 @@ private slots:
|
||||
void disableSoundsActionTriggered(bool checked);
|
||||
void outputFolderContextMenu(const QPoint &pos);
|
||||
void showFolderContextActionTriggered(void);
|
||||
void installWMADecoderActionTriggered(bool checked);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
|
@ -114,6 +114,26 @@ void WorkingBanner::show(const QString &text, QThread *thread)
|
||||
this->close();
|
||||
}
|
||||
|
||||
void WorkingBanner::show(const QString &text, QEventLoop *loop)
|
||||
{
|
||||
//Show splash
|
||||
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);
|
||||
|
||||
//Loop while thread is running
|
||||
loop->exec(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
//Set taskbar state
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
|
||||
|
||||
//Hide splash
|
||||
this->close();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// EVENTS
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
|
||||
void show(const QString &text);
|
||||
void show(const QString &text, QThread *thread);
|
||||
void show(const QString &text, QEventLoop *loop);
|
||||
void close(void);
|
||||
|
||||
private:
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <QFileInfo>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QMap>
|
||||
#include <QDir>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// TOOLS
|
||||
@ -41,6 +43,7 @@ struct lamexp_tool_t
|
||||
static const struct lamexp_tool_t g_lamexp_tools[] =
|
||||
{
|
||||
{"153f4274702f3629093b561a31dbf50e2c146305", "alac.exe"},
|
||||
{"4ecc017a66fe43092110f11494f384e57d99280d", "elevator.exe"},
|
||||
{"097dd004f44dbda57dbaeb5f15b34a220724ad60", "faad.exe"},
|
||||
{"070bf98f78e572a97e4703ef5720c682567a6a56", "flac.exe"},
|
||||
{"cf379081035ae6bfb6f7bc22f13bfb7ac6302ac5", "gpgv.exe"},
|
||||
@ -85,19 +88,34 @@ void InitializationThread::run()
|
||||
m_bSuccess = false;
|
||||
delay();
|
||||
|
||||
//Extract all files
|
||||
QMap<QString,QString> checksum;
|
||||
|
||||
//Init checksums
|
||||
for(int i = 0; i < INT_MAX; i++)
|
||||
{
|
||||
if(!g_lamexp_tools[i].pcName || !g_lamexp_tools[i].pcHash)
|
||||
if(g_lamexp_tools[i].pcName && g_lamexp_tools[i].pcHash)
|
||||
{
|
||||
checksum.insert(QString::fromLatin1(g_lamexp_tools[i].pcName), QString::fromLatin1(g_lamexp_tools[i].pcHash));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
QDir toolsDir(":/tools/");
|
||||
QList<QFileInfo> toolsList = toolsDir.entryInfoList(QStringList("*.*"), QDir::Files, QDir::Name);
|
||||
|
||||
//Extract all files
|
||||
for(int i = 0; i < toolsList.count(); i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
qDebug("Extracting file: %s", g_lamexp_tools[i].pcName);
|
||||
QString toolName = QString::fromLatin1(g_lamexp_tools[i].pcName);
|
||||
QByteArray toolHash = QString::fromLatin1(g_lamexp_tools[i].pcHash).toLatin1();
|
||||
QString toolName = toolsList.at(i).fileName();
|
||||
QByteArray toolHash = checksum.take(toolName).toLatin1();
|
||||
if(toolHash.size() != 40)
|
||||
{
|
||||
throw "The required checksum is missing, take care!";
|
||||
}
|
||||
LockedFile *lockedFile = new LockedFile(QString(":/tools/%1").arg(toolName), QString(lamexp_temp_folder()).append(QString("/tool_%1").arg(toolName)), toolHash);
|
||||
lamexp_register_tool(toolName, lockedFile);
|
||||
}
|
||||
@ -108,6 +126,12 @@ void InitializationThread::run()
|
||||
}
|
||||
}
|
||||
|
||||
if(!checksum.isEmpty())
|
||||
{
|
||||
qFatal("At least one required tool could not be found:\n%s", toolsDir.filePath(checksum.keys().first()).toLatin1().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("All extracted.\n");
|
||||
|
||||
//Look for Nero encoder
|
||||
|
Loading…
Reference in New Issue
Block a user