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

0001 /***************************************************************************
0002     File                 : ImportFileDialog.h
0003     Project              : LabPlot
0004     Description          : import data dialog
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2008-2020 Alexander Semke (alexander.semke@web.de)
0007     Copyright            : (C) 2008-2015 by Stefan Gerlach (stefan.gerlach@uni.kn)
0008 
0009  ***************************************************************************/
0010 
0011 /***************************************************************************
0012  *                                                                         *
0013  *  This program is free software; you can redistribute it and/or modify   *
0014  *  it under the terms of the GNU General Public License as published by   *
0015  *  the Free Software Foundation; either version 2 of the License, or      *
0016  *  (at your option) any later version.                                    *
0017  *                                                                         *
0018  *  This program is distributed in the hope that it will be useful,        *
0019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0021  *  GNU General Public License for more details.                           *
0022  *                                                                         *
0023  *   You should have received a copy of the GNU General Public License     *
0024  *   along with this program; if not, write to the Free Software           *
0025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0026  *   Boston, MA  02110-1301  USA                                           *
0027  *                                                                         *
0028  ***************************************************************************/
0029 
0030 #ifndef IMPORTFILEDIALOG_H
0031 #define IMPORTFILEDIALOG_H
0032 
0033 #include "ImportDialog.h"
0034 #include "backend/datasources/LiveDataSource.h"
0035 
0036 class MainWin;
0037 class ImportFileWidget;
0038 
0039 #ifdef HAVE_MQTT
0040 class MQTTClient;
0041 #endif
0042 
0043 class QStatusBar;
0044 class KMessageWidget;
0045 
0046 class ImportFileDialog : public ImportDialog {
0047     Q_OBJECT
0048 
0049 public:
0050     explicit ImportFileDialog(MainWin*, bool liveDataSource = false, const QString& fileName = QString());
0051     ~ImportFileDialog() override;
0052 
0053     QString selectedObject() const override;
0054     LiveDataSource::SourceType sourceType() const;
0055     void importToLiveDataSource(LiveDataSource*, QStatusBar*) const;
0056     void importTo(QStatusBar*) const override;
0057 #ifdef HAVE_MQTT
0058     void importToMQTT(MQTTClient*) const;
0059 #endif
0060 
0061 private:
0062     ImportFileWidget* m_importFileWidget;
0063     bool m_showOptions{false};
0064     QPushButton* m_optionsButton;
0065     KMessageWidget* m_messageWidget{nullptr};
0066 
0067 protected slots:
0068     void checkOkButton() override;
0069 
0070 private slots:
0071     void toggleOptions();
0072     void checkOnFitsTableToMatrix(const bool enable);
0073     void showErrorMessage(const QString&);
0074 };
0075 
0076 #endif //IMPORTFILEDIALOG_H