Save log files to the same directory where the output file is located.
This commit is contained in:
parent
882c6df144
commit
a34a9b8b61
@ -5,6 +5,7 @@ Simple x264/x265 Launcher version history
|
|||||||
Version 2.81 [2017-??-??]
|
Version 2.81 [2017-??-??]
|
||||||
* Updated x265 to version 2.3+32
|
* Updated x265 to version 2.3+32
|
||||||
* Updated NVEncC to version 3.07
|
* Updated NVEncC to version 3.07
|
||||||
|
* Save log files to the same directory as the output file
|
||||||
|
|
||||||
Version 2.80 [2017-04-01]
|
Version 2.80 [2017-04-01]
|
||||||
* Another attempt to fix application startup error "0xc0000005"
|
* Another attempt to fix application startup error "0xc0000005"
|
||||||
|
@ -172,7 +172,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelSaveLogFiles">
|
<widget class="QLabel" name="labelSaveLogFiles">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically save output to log file when a job has finished</string>
|
<string>Automatically create a log file when the job has finished</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -101,7 +101,7 @@ QVariant LogFileModel::data(const QModelIndex &index, int role) const
|
|||||||
// Public API
|
// Public API
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void LogFileModel::copyToClipboard(void)
|
void LogFileModel::copyToClipboard(void) const
|
||||||
{
|
{
|
||||||
QClipboard *const clipboard = QApplication::clipboard();
|
QClipboard *const clipboard = QApplication::clipboard();
|
||||||
QStringList buffer;
|
QStringList buffer;
|
||||||
@ -113,7 +113,7 @@ void LogFileModel::copyToClipboard(void)
|
|||||||
clipboard->setText(buffer.join("\r\n"));
|
clipboard->setText(buffer.join("\r\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LogFileModel::saveToLocalFile(const QString &fileName)
|
bool LogFileModel::saveToLocalFile(const QString &fileName) const
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||||
|
@ -43,8 +43,8 @@ public:
|
|||||||
virtual QModelIndex parent (const QModelIndex &index) const;
|
virtual QModelIndex parent (const QModelIndex &index) const;
|
||||||
virtual QVariant data(const QModelIndex &index, int role) const;
|
virtual QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
|
||||||
void copyToClipboard(void);
|
void copyToClipboard(void) const;
|
||||||
bool saveToLocalFile(const QString &fileName);
|
bool saveToLocalFile(const QString &fileName) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_firstLine;
|
bool m_firstLine;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 8
|
#define VER_X264_MINOR 8
|
||||||
#define VER_X264_PATCH 0
|
#define VER_X264_PATCH 0
|
||||||
#define VER_X264_BUILD 1106
|
#define VER_X264_BUILD 1107
|
||||||
|
|
||||||
#define VER_X264_PORTABLE_EDITION (0)
|
#define VER_X264_PORTABLE_EDITION (0)
|
||||||
|
|
||||||
|
@ -733,22 +733,33 @@ void MainWindow::saveLogFile(const QModelIndex &index)
|
|||||||
{
|
{
|
||||||
if(index.isValid())
|
if(index.isValid())
|
||||||
{
|
{
|
||||||
if(LogFileModel *log = m_jobList->getLogFile(index))
|
const LogFileModel *const logData = m_jobList->getLogFile(index);
|
||||||
|
const QString &outputFilePath = m_jobList->getJobOutputFile(index);
|
||||||
|
if(logData && (!outputFilePath.isEmpty()))
|
||||||
{
|
{
|
||||||
const QString outputDir = QString("%1/logs").arg(x264_data_path());
|
const QFileInfo outputFileInfo(outputFilePath);
|
||||||
const QString timeStamp = QDateTime::currentDateTime().toString("yyyy-MM-dd.HH-mm-ss");
|
if (outputFileInfo.absoluteDir().exists())
|
||||||
QDir(outputDir).mkpath(".");
|
|
||||||
const QString logFilePath = MUtils::make_unique_file(outputDir, QString("LOG.%1").arg(timeStamp), QLatin1String("txt"));
|
|
||||||
if(logFilePath.isEmpty())
|
|
||||||
{
|
{
|
||||||
qWarning("Failed to generate log file name. Giving up!");
|
const QString outputDir = outputFileInfo.absolutePath(), outputName = outputFileInfo.fileName();
|
||||||
return;
|
const QString logFilePath = MUtils::make_unique_file(outputDir, outputName, QLatin1String("log"), true);
|
||||||
}
|
if (!logFilePath.isEmpty())
|
||||||
if(!log->saveToLocalFile(logFilePath))
|
{
|
||||||
|
qDebug("Saving log file to: \"%s\"", MUTILS_UTF8(logFilePath));
|
||||||
|
if (!logData->saveToLocalFile(logFilePath))
|
||||||
{
|
{
|
||||||
qWarning("Failed to open log file for writing:\n%s", logFilePath.toUtf8().constData());
|
qWarning("Failed to open log file for writing:\n%s", logFilePath.toUtf8().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("Failed to generate log file name. Giving up!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("Output directory does not seem to exist. Giving up!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user