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

0001 /***************************************************************************
0002     File                 : ImportProjectDialog.h
0003     Project              : LabPlot
0004     Description          : import project dialog
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2017-2021 Alexander Semke (alexander.semke@web.de)
0007 
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *  This program is free software; you can redistribute it and/or modify   *
0013  *  it under the terms of the GNU General Public License as published by   *
0014  *  the Free Software Foundation; either version 2 of the License, or      *
0015  *  (at your option) any later version.                                    *
0016  *                                                                         *
0017  *  This program is distributed in the hope that it will be useful,        *
0018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0020  *  GNU General Public License for more details.                           *
0021  *                                                                         *
0022  *   You should have received a copy of the GNU General Public License     *
0023  *   along with this program; if not, write to the Free Software           *
0024  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0025  *   Boston, MA  02110-1301  USA                                           *
0026  *                                                                         *
0027  ***************************************************************************/
0028 
0029 #ifndef IMPORTPROJECTDIALOG_H
0030 #define IMPORTPROJECTDIALOG_H
0031 
0032 #include <QDialog>
0033 #include "ui_importprojectwidget.h"
0034 
0035 class AbstractAspect;
0036 class AspectTreeModel;
0037 class Folder;
0038 class ProjectParser;
0039 class TreeViewComboBox;
0040 class MainWin;
0041 class QDialogButtonBox;
0042 class QStatusBar;
0043 class KUrlComboBox;
0044 
0045 class ImportProjectDialog : public QDialog {
0046     Q_OBJECT
0047 
0048 public:
0049     enum class ProjectType {LabPlot, Origin};
0050 
0051     explicit ImportProjectDialog(MainWin*, ProjectType);
0052     ~ImportProjectDialog() override;
0053 
0054     void setCurrentFolder(const Folder*);
0055     void importTo(QStatusBar*) const;
0056 
0057 private:
0058     Ui::ImportProjectWidget ui;
0059     MainWin* m_mainWin;
0060     KUrlComboBox* m_cbFileName;
0061     ProjectParser* m_projectParser{nullptr};
0062     ProjectType m_projectType;
0063     AspectTreeModel* m_aspectTreeModel;
0064     TreeViewComboBox* m_cbAddTo;
0065     QPushButton* m_bNewFolder;
0066     QDialogButtonBox* m_buttonBox;
0067 
0068     void showTopLevelOnly(const QModelIndex&);
0069     bool isTopLevel(const AbstractAspect*) const;
0070 
0071 private slots:
0072     void fileNameChanged(const QString&);
0073     void refreshPreview();
0074     void selectionChanged(const QItemSelection&, const QItemSelection&);
0075     void selectFile();
0076     void newFolder();
0077 };
0078 
0079 #endif //IMPORTPROJECTDIALOG_H