Added support for a true "portable" mode: If you rename the LameXP executable to 'LameXP-Portable.exe' it will store the configuration file in the same folder where the executable is located. This might be helpful if you put LameXP onto your USB stick and use it on different computers regularly. Important: In "portable" mode the user is responsible to make sure that write-access to LameXP folder is available!
This commit is contained in:
parent
dcf4181974
commit
fb707cb257
@ -25,7 +25,7 @@
|
|||||||
#define VER_LAMEXP_MAJOR 4
|
#define VER_LAMEXP_MAJOR 4
|
||||||
#define VER_LAMEXP_MINOR_HI 0
|
#define VER_LAMEXP_MINOR_HI 0
|
||||||
#define VER_LAMEXP_MINOR_LO 0
|
#define VER_LAMEXP_MINOR_LO 0
|
||||||
#define VER_LAMEXP_BUILD 252
|
#define VER_LAMEXP_BUILD 253
|
||||||
#define VER_LAMEXP_SUFFIX Beta-1
|
#define VER_LAMEXP_SUFFIX Beta-1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QResource>
|
#include <QResource>
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
//Win32 includes
|
//Win32 includes
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@ -693,11 +694,13 @@ void MainWindow::windowShown(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
radioButtonEncoderAAC->setEnabled(false);
|
radioButtonEncoderAAC->setEnabled(false);
|
||||||
|
QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
||||||
|
if(appPath.isEmpty()) appPath = QCoreApplication::applicationDirPath();
|
||||||
QString messageText;
|
QString messageText;
|
||||||
messageText += QString("<nobr>%1<br>").arg(tr("The Nero AAC encoder could not be found. AAC encoding support will be disabled."));
|
messageText += QString("<nobr>%1<br>").arg(tr("The Nero AAC encoder could not be found. AAC encoding support will be disabled."));
|
||||||
messageText += QString("%1<br><br>").arg(tr("Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!"));
|
messageText += QString("%1<br><br>").arg(tr("Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!"));
|
||||||
messageText += QString("%1<br>").arg(tr("Your LameXP directory is located here:"));
|
messageText += QString("%1<br>").arg(tr("Your LameXP directory is located here:"));
|
||||||
messageText += QString("<i><nobr><a href=\"file:///%1\">%1</a></nobr></i><br><br>").arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath()));
|
messageText += QString("<i><nobr><a href=\"file:///%1\">%1</a></nobr></i><br><br>").arg(QDir::toNativeSeparators(appPath));
|
||||||
messageText += QString("%1<br>").arg(tr("You can download the Nero AAC encoder for free from the official Nero website at:"));
|
messageText += QString("%1<br>").arg(tr("You can download the Nero AAC encoder for free from the official Nero website at:"));
|
||||||
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
|
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
|
||||||
QMessageBox::information(this, tr("AAC Support Disabled"), messageText);
|
QMessageBox::information(this, tr("AAC Support Disabled"), messageText);
|
||||||
@ -1702,6 +1705,7 @@ void MainWindow::resetAdvancedOptionsButtonClicked()
|
|||||||
comboBoxNeroAACProfile->setCurrentIndex(m_settings->neroAACProfileDefault());
|
comboBoxNeroAACProfile->setCurrentIndex(m_settings->neroAACProfileDefault());
|
||||||
while(checkBoxBitrateManagement->isChecked() != m_settings->bitrateManagementEnabledDefault()) checkBoxBitrateManagement->click();
|
while(checkBoxBitrateManagement->isChecked() != m_settings->bitrateManagementEnabledDefault()) checkBoxBitrateManagement->click();
|
||||||
while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2PassDefault()) checkBoxNeroAAC2PassMode->click();
|
while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2PassDefault()) checkBoxNeroAAC2PassMode->click();
|
||||||
|
scrollArea->verticalScrollBar()->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -715,6 +715,15 @@ void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize)
|
|||||||
LAMEXP_DELETE(lamexp_ipc);
|
LAMEXP_DELETE(lamexp_ipc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for LameXP "portable" mode
|
||||||
|
*/
|
||||||
|
bool lamexp_portable_mode(void)
|
||||||
|
{
|
||||||
|
QString baseName = QFileInfo(QApplication::applicationFilePath()).completeBaseName();
|
||||||
|
return baseName.contains("lamexp", Qt::CaseInsensitive) && baseName.contains("portable", Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a random string
|
* Get a random string
|
||||||
*/
|
*/
|
||||||
|
@ -92,6 +92,7 @@ const QString &lamexp_temp_folder(void);
|
|||||||
void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
|
void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
|
||||||
void lamexp_ipc_send(unsigned int command, const char* message);
|
void lamexp_ipc_send(unsigned int command, const char* message);
|
||||||
lamexp_cpu_t lamexp_detect_cpu_features(void);
|
lamexp_cpu_t lamexp_detect_cpu_features(void);
|
||||||
|
bool lamexp_portable_mode(void);
|
||||||
|
|
||||||
//Translation support
|
//Translation support
|
||||||
QStringList lamexp_query_translations(void);
|
QStringList lamexp_query_translations(void);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QDir>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
|
||||||
@ -87,8 +88,24 @@ SettingsModel::SettingsModel(void)
|
|||||||
:
|
:
|
||||||
m_defaultLanguage(NULL)
|
m_defaultLanguage(NULL)
|
||||||
{
|
{
|
||||||
QString appPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
QString configPath;
|
||||||
m_settings = new QSettings(appPath.append("/config.ini"), QSettings::IniFormat);
|
|
||||||
|
if(!lamexp_portable_mode())
|
||||||
|
{
|
||||||
|
QString dataPath = QDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation)).canonicalPath();
|
||||||
|
if(dataPath.isEmpty()) dataPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||||
|
QDir(dataPath).mkpath(".");
|
||||||
|
configPath = QString("%1/config.ini").arg(dataPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("LameXP is running in \"portable\" mode -> config in application dir!\n");
|
||||||
|
QString appPath = QFileInfo(QApplication::applicationFilePath()).canonicalFilePath();
|
||||||
|
if(appPath.isEmpty()) appPath = QApplication::applicationFilePath();
|
||||||
|
configPath = QString("%1/%2.ini").arg(QFileInfo(appPath).absolutePath(), QFileInfo(appPath).completeBaseName());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings = new QSettings(configPath, QSettings::IniFormat);
|
||||||
m_settings->beginGroup(QString().sprintf("LameXP_%u%02u%05u", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build()));
|
m_settings->beginGroup(QString().sprintf("LameXP_%u%02u%05u", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build()));
|
||||||
m_settings->setValue(g_settingsId_versionNumber, QApplication::applicationVersion());
|
m_settings->setValue(g_settingsId_versionNumber, QApplication::applicationVersion());
|
||||||
m_settings->sync();
|
m_settings->sync();
|
||||||
|
Loading…
Reference in New Issue
Block a user