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

0001 /***************************************************************************
0002 File                 : ROOTOptionsWidget.h
0003 Project              : LabPlot
0004 Description          : widget providing options for the import of ROOT data
0005 --------------------------------------------------------------------
0006 Copyright            : (C) 2018 Christoph Roick (chrisito@gmx.de)
0007 **************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *  This program is free software; you can redistribute it and/or modify   *
0012  *  it under the terms of the GNU General Public License as published by   *
0013  *  the Free Software Foundation; either version 2 of the License, or      *
0014  *  (at your option) any later version.                                    *
0015  *                                                                         *
0016  *  This program is distributed in the hope that it will be useful,        *
0017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0019  *  GNU General Public License for more details.                           *
0020  *                                                                         *
0021  *   You should have received a copy of the GNU General Public License     *
0022  *   along with this program; if not, write to the Free Software           *
0023  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0024  *   Boston, MA  02110-1301  USA                                           *
0025  *                                                                         *
0026  ***************************************************************************/
0027 
0028 #ifndef ROOTOPTIONSWIDGET_H
0029 #define ROOTOPTIONSWIDGET_H
0030 
0031 #include "ui_rootoptionswidget.h"
0032 
0033 class ImportFileWidget;
0034 class ROOTFilter;
0035 
0036 /// Widget providing options for the import of ROOT data
0037 class ROOTOptionsWidget : public QWidget {
0038     Q_OBJECT
0039 
0040 public:
0041     explicit ROOTOptionsWidget(QWidget*, ImportFileWidget*);
0042     void clear();
0043     /// Fill the list of available histograms
0044     void updateContent(ROOTFilter* filter, const QString &fileName);
0045     /// Return a list of selected histograms
0046     const QStringList selectedNames() const;
0047     int lines() const { return ui.sbPreviewLines->value(); }
0048     int startRow() const { return ui.sbFirst->value(); }
0049     int endRow() const { return ui.sbLast->value(); }
0050     QVector<QStringList> columns() const;
0051     void setNRows(int nrows);
0052     QTableWidget* previewWidget() const { return ui.twPreview; }
0053 
0054 private:
0055     Ui::ROOTOptionsWidget ui;
0056     QTreeWidgetItem* histItem;
0057     QTreeWidgetItem* treeItem;
0058     QHash<QStringList, QVector<QStringList> > leaves;
0059 
0060     ImportFileWidget* m_fileWidget;
0061     bool histselected = false;
0062 
0063 private slots:
0064     /// Updates the selected data set of a ROOT file when a new item is selected
0065     void rootObjectSelectionChanged();
0066 };
0067 
0068 #endif