File indexing completed on 2024-05-12 15:27:51

0001 /***************************************************************************
0002     File                 : JsonOptionsWidget.h
0003     Project              : LabPlot
0004     Description          : Widget providing options for the import of json data.
0005     --------------------------------------------------------------------
0006     --------------------------------------------------------------------
0007     Copyright            : (C) 2018 Andrey Cygankov (craftplace.ms@gmail.com)
0008     Copyright            : (C) 2018-2020 by Alexander Semke (alexander.semke@web.de)
0009 
0010  ***************************************************************************/
0011 
0012 /***************************************************************************
0013  *                                                                         *
0014  *  This program is free software; you can redistribute it and/or modify   *
0015  *  it under the terms of the GNU General Public License as published by   *
0016  *  the Free Software Foundation; either version 2 of the License, or      *
0017  *  (at your option) any later version.                                    *
0018  *                                                                         *
0019  *  This program is distributed in the hope that it will be useful,        *
0020  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0021  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0022  *  GNU General Public License for more details.                           *
0023  *                                                                         *
0024  *   You should have received a copy of the GNU General Public License     *
0025  *   along with this program; if not, write to the Free Software           *
0026  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0027  *   Boston, MA  02110-1301  USA                                           *
0028  *                                                                         *
0029  ***************************************************************************/
0030 
0031 #ifndef JSONOPTIONSWIDGET_H
0032 #define JSONOPTIONSWIDGET_H
0033 
0034 #include "ui_jsonoptionswidget.h"
0035 
0036 class ImportFileWidget;
0037 class JsonFilter;
0038 class QAbstractItemModel;
0039 class QJsonModel;
0040 class QJsonTreeItem;
0041 
0042 class JsonOptionsWidget : public QWidget {
0043     Q_OBJECT
0044 
0045 public:
0046     explicit JsonOptionsWidget(QWidget*, ImportFileWidget*);
0047 
0048     void applyFilterSettings(JsonFilter*, const QModelIndex&) const;
0049     void clearModel();
0050     void loadSettings() const;
0051     void saveSettings();
0052     void loadDocument(const QString& filename);
0053     QAbstractItemModel* model();
0054 
0055 private:
0056     void setTooltips();
0057     QVector<int> getIndexRows(const QModelIndex&) const;
0058 
0059     QString m_filename;
0060     Ui::JsonOptionsWidget ui;
0061     ImportFileWidget* m_fileWidget;
0062     QPointer<QJsonModel> m_model;
0063 };
0064 
0065 #endif