File indexing completed on 2024-04-14 03:40:46

0001 /*
0002     KmPlot - a math. function plotter for the KDE-Desktop
0003 
0004     SPDX-FileCopyrightText: 2004 Fredrik Edemar <f_edemar@linux.se>
0005     SPDX-FileCopyrightText: 2006 David Saxton <david@bluehaze.org>
0006 
0007     This file is part of the KDE Project.
0008     KmPlot is part of the KDE-EDU Project.
0009 
0010     SPDX-License-Identifier: GPL-2.0-or-later
0011 
0012 */
0013 
0014 #ifndef KPARAMETEREDITOR_H
0015 #define KPARAMETEREDITOR_H
0016 
0017 #include "ui_qparametereditor.h"
0018 #include "xparser.h"
0019 
0020 #include <QDialog>
0021 #include <QList>
0022 
0023 class QParameterEditor;
0024 
0025 /**
0026 @author Fredrik Edemar
0027 */
0028 /// This class handles the parameter values: it can create, remove, edit and import values.
0029 class KParameterEditor : public QDialog
0030 {
0031     Q_OBJECT
0032 public:
0033     KParameterEditor(QList<Value> *, QWidget *parent);
0034     ~KParameterEditor();
0035 
0036 public slots:
0037     void moveUp();
0038     void moveDown();
0039     void prev();
0040     void next();
0041     void cmdNew_clicked();
0042     void cmdDelete_clicked();
0043     void cmdImport_clicked();
0044     void cmdExport_clicked();
0045 
0046     /// actions for the visible constant list
0047     void selectedConstantChanged(QListWidgetItem *current);
0048 
0049     /// updates whether or not the "value is invalid" label is shown, (and returns the validity of the current value)
0050     bool checkValueValid();
0051 
0052     /// saves the value being edited
0053     void saveCurrentValue();
0054 
0055     void accept() Q_DECL_OVERRIDE;
0056 
0057 private:
0058     /// Check so that it doesn't exist two equal values
0059     bool checkTwoOfIt(const QString &text);
0060     QList<Value> *m_parameter;
0061     QParameterEditor *m_mainWidget;
0062 };
0063 
0064 class QParameterEditor : public QWidget, public Ui::QParameterEditor
0065 {
0066 public:
0067     explicit QParameterEditor(QWidget *parent = nullptr)
0068         : QWidget(parent)
0069     {
0070         setupUi(this);
0071     }
0072 };
0073 
0074 #endif