File indexing completed on 2024-05-19 11:21:24

0001 /*
0002     SPDX-FileCopyrightText: 2020-2022 by Alexander Semke (alexander.semke@web.de)
0003     SPDX-FileCopyrightText: 2020-2022 by 2020 Shubham <aryan100jangid@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "maximasettingswidget.h"
0009 #include <QTimer>
0010 
0011 MaximaSettingsWidget::MaximaSettingsWidget(QWidget* parent, const QString& id) : BackendSettingsWidget(parent, id)
0012 {
0013     setupUi(this);
0014 
0015     m_tabWidget = tabWidget;
0016     m_tabDocumentation = tabDocumentation;
0017     m_urlRequester = kcfg_Path;
0018 
0019     connect(tabWidget, &QTabWidget::currentChanged, this, &BackendSettingsWidget::tabChanged);
0020     connect(kcfg_Path, &KUrlRequester::textChanged, this, &MaximaSettingsWidget::fileNameChanged);
0021     connect(kcfg_integratePlots, &QCheckBox::clicked, this, &MaximaSettingsWidget::integratePlotsChanged);
0022 
0023     kcfg_inlinePlotFormat->setItemIcon(0, QIcon::fromTheme(QLatin1String("application-pdf")));
0024     kcfg_inlinePlotFormat->setItemIcon(1, QIcon::fromTheme(QLatin1String("image-svg+xml")));
0025     kcfg_inlinePlotFormat->setItemIcon(2, QIcon::fromTheme(QLatin1String("image-png")));
0026 
0027     // return to the event loop to show the settings
0028     // and then call the slot to update the state of the widgets
0029     QTimer::singleShot(0, this, [=]() {
0030         integratePlotsChanged(kcfg_integratePlots->isChecked());
0031     });
0032 }
0033 
0034 void MaximaSettingsWidget::integratePlotsChanged(bool state)
0035 {
0036     lPlotWidth->setEnabled(state);
0037     kcfg_plotWidth->setEnabled(state);
0038     lPlotHeight->setEnabled(state);
0039     kcfg_plotHeight->setEnabled(state);
0040     kcfg_inlinePlotFormat->setEnabled(state);
0041 }