#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
-#define VER_LAMEXP_BUILD 252
+#define VER_LAMEXP_BUILD 253
#define VER_LAMEXP_SUFFIX Beta-1
/*
#include <QCryptographicHash>
#include <QTranslator>
#include <QResource>
+#include <QScrollBar>
//Win32 includes
#include <Windows.h>
else
{
radioButtonEncoderAAC->setEnabled(false);
+ QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
+ if(appPath.isEmpty()) appPath = QCoreApplication::applicationDirPath();
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("%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("<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 += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
QMessageBox::information(this, tr("AAC Support Disabled"), messageText);
comboBoxNeroAACProfile->setCurrentIndex(m_settings->neroAACProfileDefault());
while(checkBoxBitrateManagement->isChecked() != m_settings->bitrateManagementEnabledDefault()) checkBoxBitrateManagement->click();
while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2PassDefault()) checkBoxNeroAAC2PassMode->click();
+ scrollArea->verticalScrollBar()->setValue(0);
}
/*
}
/*
+ * 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
*/
QString lamexp_rand_str(void)
void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
void lamexp_ipc_send(unsigned int command, const char* message);
lamexp_cpu_t lamexp_detect_cpu_features(void);
+bool lamexp_portable_mode(void);
//Translation support
QStringList lamexp_query_translations(void);
#include <QApplication>
#include <QString>
#include <QFileInfo>
+#include <QDir>
#include <QStringList>
#include <QLocale>
:
m_defaultLanguage(NULL)
{
- QString appPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- m_settings = new QSettings(appPath.append("/config.ini"), QSettings::IniFormat);
+ QString configPath;
+
+ 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->setValue(g_settingsId_versionNumber, QApplication::applicationVersion());
m_settings->sync();