File indexing completed on 2024-05-12 05:48:41

0001 /*
0002     KApacheLog, a apache log viewer tool
0003     SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "xorgConfigurationWidget.h"
0009 
0010 XorgConfigurationWidget::XorgConfigurationWidget()
0011     : LogModeConfigurationWidget(i18n("X.org Log"), QStringLiteral(XORG_MODE_ICON), i18n("X.org Log"))
0012 {
0013     auto layout = new QHBoxLayout(this);
0014 
0015     mFileList = new FileList(this, i18n("<p>These files will be analyzed to show the <b>X.org log</b>.</p>"));
0016     connect(mFileList, &FileList::fileListChanged, this, &LogModeConfigurationWidget::configurationChanged);
0017     layout->addWidget(mFileList);
0018 }
0019 
0020 void XorgConfigurationWidget::saveConfig()
0021 {
0022     auto *xorgConfiguration = Globals::instance().findLogMode(QStringLiteral(XORG_LOG_MODE_ID))->logModeConfiguration<XorgConfiguration *>();
0023 
0024     xorgConfiguration->setXorgPaths(mFileList->paths());
0025 }
0026 
0027 void XorgConfigurationWidget::readConfig()
0028 {
0029     auto *xorgConfiguration = Globals::instance().findLogMode(QStringLiteral(XORG_LOG_MODE_ID))->logModeConfiguration<XorgConfiguration *>();
0030 
0031     mFileList->removeAllItems();
0032 
0033     mFileList->addPaths(xorgConfiguration->xorgPaths());
0034 }
0035 
0036 void XorgConfigurationWidget::defaultConfig()
0037 {
0038     // TODO Find a way to read the configuration per default
0039     readConfig();
0040 }
0041 
0042 bool XorgConfigurationWidget::isValid() const
0043 {
0044     if (!mFileList->isEmpty()) {
0045         return true;
0046     }
0047 
0048     return false;
0049 }
0050 
0051 #include "moc_xorgConfigurationWidget.cpp"