/* * @RDE_HEADER@ * * $Id$ * $HeadURL$ * $Author$ * Created by Malte Schröder, SLSE, 2016-06-08 */ #include "showLogFile.h" #include "ui_showLogFile.h" #include namespace DBAdministration { ShowLogFile::ShowLogFile(QWidget *parent) : QWidget(parent) , m_ui(new Ui::ShowLogFile) , m_logger(getLogger("ShowLogFile")) { m_ui->setupUi(this); connect(m_ui->pbClose, &QPushButton::clicked, this, &ShowLogFile::onClosedClicked); } ShowLogFile::~ShowLogFile() { delete m_ui; } bool ShowLogFile::init() { QString logFile = NGL::Settings::logPath() + QStringLiteral("/") + QString::fromLatin1(qgetenv("USER")) + QStringLiteral("_scm.log"); ERROR_LOG(m_logger) << "Logfile: " << logFile; QFile file(logFile); if (!file.open(QIODevice::ReadOnly)) { ERROR_LOG(m_logger) << "Cannot open file " << logFile; return false; } QByteArray output = file.readAll(); m_ui->plainTextEdit->setPlainText(QString::fromLocal8Bit(output)); return true; } void ShowLogFile::onClosedClicked() { close(); } } // namespace DBAdministration