Skip to content
This repository was archived by the owner on Dec 14, 2021. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reflect changes immediately on FileLogger directory change
  • Loading branch information
Waqar144 committed Jan 28, 2020
commit bfed41b77224f29fac7ce759b2ccdb8a27322909
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "MessageSwitchColorScheme.h"
#include "ResourcePaths.h"
#include "logging.h"
#include "FileLogger.h"
#include "utility.h"
#include "utilityApp.h"
#include "utilityPathDetection.h"
Expand Down Expand Up @@ -238,14 +239,15 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
layout,
row);

m_logPath = new QtLocationPicker(this);
m_logPath->setPickDirectory(true);
addLabelAndWidget(QStringLiteral("Log Directory Path "), m_logPath, layout, row);
addHelpButton(
QStringLiteral("Log Directory Path"),
QStringLiteral("<p>Log file will be saved to this path.</p>"),
layout,
row);
m_logPath = new QtLocationPicker(this);
m_logPath->setPickDirectory(true);
addLabelAndWidget(QStringLiteral("Log Directory Path "), m_logPath, layout, row);
addHelpButton(
QStringLiteral("Log Directory Path"),
QStringLiteral("<p>Log file will be saved to this path.</p>"),
layout,
row);
row++;

addGap(layout, row);

Expand Down Expand Up @@ -498,10 +500,10 @@ void QtProjectWizardContentPreferences::load()
m_loggingEnabled->setChecked(appSettings->getLoggingEnabled());
m_verboseIndexerLoggingEnabled->setChecked(appSettings->getVerboseIndexerLoggingEnabled());
m_verboseIndexerLoggingEnabled->setEnabled(m_loggingEnabled->isChecked());
if (m_logPath)
{
m_logPath->setText(QString::fromStdWString(appSettings->getLogDirectoryPath().wstr()));
}
if (m_logPath)
{
m_logPath->setText(QString::fromStdWString(appSettings->getLogDirectoryPath().wstr()));
}

m_automaticUpdateCheck->setChecked(appSettings->getAutomaticUpdateCheck());

Expand Down Expand Up @@ -565,10 +567,13 @@ void QtProjectWizardContentPreferences::save()

appSettings->setLoggingEnabled(m_loggingEnabled->isChecked());
appSettings->setVerboseIndexerLoggingEnabled(m_verboseIndexerLoggingEnabled->isChecked());
if (m_logPath)
{
appSettings->setLogDirectoryPath(FilePath(m_logPath->getText().toStdWString()));
}
if (m_logPath &&
m_logPath->getText().toStdWString() != appSettings->getLogDirectoryPath().wstr()) {
appSettings->setLogDirectoryPath(FilePath(m_logPath->getText().toStdWString()));
Logger* logger = LogManager::getInstance()->getLoggerByType("FileLogger");
if (logger)
dynamic_cast<FileLogger*>(logger)->setLogDirectory(appSettings->getLogDirectoryPath());
}

appSettings->setAutomaticUpdateCheck(m_automaticUpdateCheck->isChecked());

Expand Down