Fixed a copy&paste bug that cause the output directory to be reset when actually the most recent input directory should be reset.

This commit is contained in:
LoRd_MuldeR 2013-07-09 22:34:06 +02:00
parent 9323260e32
commit 88142733d2
4 changed files with 34 additions and 15 deletions

View File

@ -33,8 +33,8 @@
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 8
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 5
#define VER_LAMEXP_BUILD 1310
#define VER_LAMEXP_PATCH 6
#define VER_LAMEXP_BUILD 1312
#define VER_LAMEXP_CONFG 1288
///////////////////////////////////////////////////////////////////////////////

View File

@ -152,9 +152,9 @@ while(0)
#define WITH_BLOCKED_SIGNALS(WIDGET, CMD, ...) do \
{ \
(WIDGET)->blockSignals(true); \
const bool _flag = (WIDGET)->blockSignals(true); \
(WIDGET)->CMD(__VA_ARGS__); \
(WIDGET)->blockSignals(false); \
if(!(_flag)) { (WIDGET)->blockSignals(false); } \
} \
while(0)

View File

@ -63,6 +63,8 @@ unsigned int SettingsModel::OPT##Default(void) { return DEF; }
#define LAMEXP_MAKE_ID(DEC,STR) static const char *g_settingsId_##DEC = STR
#define REMOVE_GROUP(OBJ,ID) OBJ->beginGroup(ID); OBJ->remove(""); OBJ->endGroup();
#define DIR_EXISTS(PATH) (QFileInfo(PATH).exists() && QFileInfo(PATH).isDir())
////////////////////////////////////////////////////////////
//Constants
////////////////////////////////////////////////////////////
@ -274,17 +276,16 @@ void SettingsModel::validate(void)
}
}
if(this->outputDir().isEmpty() || !QFileInfo(this->outputDir()).isDir())
if(this->outputDir().isEmpty() || (!DIR_EXISTS(this->outputDir())))
{
qWarning("Output directory not set yet or does NOT exist anymore -> Resetting to QDesktopServices::MusicLocation");
QString musicLocation = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
this->outputDir(musicLocation.isEmpty() ? QDesktopServices::storageLocation(QDesktopServices::HomeLocation) : musicLocation);
qWarning("Output directory not set yet or does NOT exist anymore -> Resetting");
this->outputDir(defaultDirectory());
}
if(this->mostRecentInputPath().isEmpty() || !QFileInfo(this->mostRecentInputPath()).isDir())
if(this->mostRecentInputPath().isEmpty() || (!DIR_EXISTS(this->mostRecentInputPath())))
{
QString musicLocation = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
this->outputDir(musicLocation.isEmpty() ? QDesktopServices::storageLocation(QDesktopServices::HomeLocation) : musicLocation);
qWarning("Most recent input directory not set yet or does NOT exist anymore -> Resetting");
this->mostRecentInputPath(defaultDirectory());
}
if(!this->currentLanguageFile().isEmpty())
@ -388,7 +389,24 @@ QString SettingsModel::defaultLanguage(void) const
return LAMEXP_DEFAULT_LANGID;
}
QString SettingsModel::initDirectory(const QString &path)
QString SettingsModel::defaultDirectory(void) const
{
QString defaultLocation = initDirectory(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
if(defaultLocation.isEmpty())
{
defaultLocation = initDirectory(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
if(defaultLocation.isEmpty())
{
defaultLocation = initDirectory(QDir::currentPath());
}
}
return defaultLocation;
}
QString SettingsModel::initDirectory(const QString &path) const
{
if(path.isEmpty())
{
@ -466,7 +484,7 @@ LAMEXP_MAKE_OPTION_I(lameChannelMode, 0)
LAMEXP_MAKE_OPTION_I(licenseAccepted, 0)
LAMEXP_MAKE_OPTION_U(maximumInstances, 0)
LAMEXP_MAKE_OPTION_U(metaInfoPosition, UINT_MAX)
LAMEXP_MAKE_OPTION_S(mostRecentInputPath, QDesktopServices::storageLocation(QDesktopServices::MusicLocation))
LAMEXP_MAKE_OPTION_S(mostRecentInputPath, defaultDirectory())
LAMEXP_MAKE_OPTION_B(neroAACEnable2Pass, true)
LAMEXP_MAKE_OPTION_B(neroAacNotificationsEnabled, true)
LAMEXP_MAKE_OPTION_B(normalizationFilterEnabled, false)
@ -476,7 +494,7 @@ LAMEXP_MAKE_OPTION_I(opusComplexity, 10)
LAMEXP_MAKE_OPTION_B(opusDisableResample, false)
LAMEXP_MAKE_OPTION_I(opusFramesize, 3)
LAMEXP_MAKE_OPTION_I(opusOptimizeFor, 0)
LAMEXP_MAKE_OPTION_S(outputDir, QDesktopServices::storageLocation(QDesktopServices::MusicLocation))
LAMEXP_MAKE_OPTION_S(outputDir, defaultDirectory())
LAMEXP_MAKE_OPTION_B(outputToSourceDir, false)
LAMEXP_MAKE_OPTION_I(overwriteMode, Overwrite_KeepBoth)
LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath, false)

View File

@ -169,9 +169,10 @@ public:
private:
QSettings *m_settings;
QString initDirectory(const QString &path);
static QString *m_defaultLanguage;
QString initDirectory(const QString &path) const;
QString defaultLanguage(void) const;
QString defaultDirectory(void) const;
};
///////////////////////////////////////////////////////////////////////////////