On systems where the QDesktopServices::MoviesLocation cannot be determined, a bad output file path was generated, if no "recent" output directory had been stored yet. The initial output directory will now fall back to QDesktopServices::DesktopLocation or QDesktopServices::HomeLocation, if the QDesktopServices::MoviesLocation is not available. This should fix the issue.

This commit is contained in:
LoRd_MuldeR 2014-04-22 01:59:12 +02:00
parent 996bff4d94
commit 04b19f3ecc
4 changed files with 32 additions and 5 deletions

View File

@ -43,6 +43,33 @@ static void READ_INT(QSettings &settings, const QString &key, int default, int *
*value = (ok) ? temp : default;
}
static QString moviesLocation(void)
{
static const QDesktopServices::StandardLocation locations[3] =
{
QDesktopServices::MoviesLocation, QDesktopServices::DesktopLocation, QDesktopServices::HomeLocation
};
for(size_t i = 0; i < 3; i++)
{
const QString path = QDir::fromNativeSeparators(QDesktopServices::storageLocation(locations[i]));
if(!path.isEmpty())
{
QDir directory(path);
if(!directory.exists())
{
if(!directory.mkpath("."))
{
continue;
}
}
return directory.absolutePath();
}
}
return QDir::rootPath();
}
RecentlyUsed::RecentlyUsed(void)
{
initRecentlyUsed(this);
@ -55,8 +82,8 @@ RecentlyUsed::~RecentlyUsed(void)
void RecentlyUsed::initRecentlyUsed(RecentlyUsed *recentlyUsed)
{
recentlyUsed->m_sourceDirectory = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
recentlyUsed->m_outputDirectory = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
recentlyUsed->m_sourceDirectory = moviesLocation();
recentlyUsed->m_outputDirectory = moviesLocation();
recentlyUsed->m_filterIndex = 0;
recentlyUsed->m_lastUpdateCheck = QDate(1969, 8, 15).toJulianDay();
}

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 3
#define VER_X264_PATCH 7
#define VER_X264_BUILD 852
#define VER_X264_BUILD 853
#define VER_X264_PORTABLE_EDITION (0)

View File

@ -1335,7 +1335,7 @@ void MainWindow::dropEvent(QDropEvent *event)
{
if((m_status != STATUS_IDLE) && (m_status != STATUS_AWAITING))
{
qWarning("Cannot accept drooped files at this time -> discarding!");
qWarning("Cannot accept dropped files at this time -> discarding!");
return;
}

View File

@ -129,7 +129,7 @@ attrib +R "%PACK_PATH%\*.txt"
REM ///////////////////////////////////////////////////////////////////////////
REM // Setup install parameters
REM ///////////////////////////////////////////////////////////////////////////
set "OUT_PATH=%~dp0bin\x264_x64.%ISO_DATE%"
set "OUT_PATH=%~dp0bin\x264_launcher.%ISO_DATE%"
:GenerateOutfileName
if exist "%OUT_PATH%.exe" (
set "OUT_PATH=%OUT_PATH%.new"