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

0001 /*************************************************************************************
0002  *  Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org>                               *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 #ifndef KALGEBRAMOBILE_H
0020 #define KALGEBRAMOBILE_H
0021 
0022 #include <QObject>
0023 #include <QSharedPointer>
0024 #include <analitza/variables.h>
0025 
0026 class QModelIndex;
0027 namespace Analitza
0028 {
0029 class PlotsModel;
0030 }
0031 
0032 class KAlgebraMobile : public QObject
0033 {
0034     Q_OBJECT
0035     Q_PROPERTY(QSharedPointer<Analitza::Variables> variables READ variables NOTIFY variablesChanged)
0036 public:
0037     explicit KAlgebraMobile(QObject *parent = nullptr);
0038 
0039     static KAlgebraMobile *self();
0040     void notifyVariablesChanged()
0041     {
0042         variablesChanged();
0043     }
0044 
0045 public Q_SLOTS:
0046     Analitza::PlotsModel *functionsModel();
0047     QSharedPointer<Analitza::Variables> variables() const;
0048 
0049 private Q_SLOTS:
0050     void functionRemoved(const QModelIndex &parent, int start, int end);
0051     void functionModified(const QModelIndex &idxA, const QModelIndex &idxB);
0052     void functionInserted(const QModelIndex &parent, int start, int end);
0053 
0054 Q_SIGNALS:
0055     void variablesChanged();
0056 
0057 private:
0058     static KAlgebraMobile *s_self;
0059 
0060     Analitza::PlotsModel *m_functionsModel;
0061     QSharedPointer<Analitza::Variables> m_vars;
0062 };
0063 
0064 #endif // KALGEBRAMOBILE_H