2013-03-07 02:00:59 +00:00
|
|
|
#ifndef FILEDIALOG_HPP
|
|
|
|
#define FILEDIALOG_HPP
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
2018-12-01 20:27:43 +00:00
|
|
|
#ifndef Q_MOC_RUN
|
|
|
|
|
2013-10-28 01:21:19 +00:00
|
|
|
#include "adjusterwidget.hpp"
|
2013-10-27 03:55:44 +00:00
|
|
|
|
2022-06-11 21:38:09 +00:00
|
|
|
#ifndef CS_QT_STD_FILESYSTEM_PATH_DECLARED
|
|
|
|
#define CS_QT_STD_FILESYSTEM_PATH_DECLARED
|
2022-09-22 18:26:05 +00:00
|
|
|
Q_DECLARE_METATYPE(std::filesystem::path)
|
2013-10-27 03:55:44 +00:00
|
|
|
#endif
|
|
|
|
|
2018-12-01 20:27:43 +00:00
|
|
|
#endif
|
|
|
|
|
2013-10-23 02:52:35 +00:00
|
|
|
#include "ui_filedialog.h"
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <filesystem>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class QModelIndex;
|
|
|
|
|
2013-09-22 04:06:29 +00:00
|
|
|
namespace ContentSelectorView
|
2013-08-18 22:11:23 +00:00
|
|
|
{
|
2013-10-23 02:52:35 +00:00
|
|
|
class ContentSelector;
|
2013-08-18 22:11:23 +00:00
|
|
|
}
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
namespace CSVDoc
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
2013-10-23 02:52:35 +00:00
|
|
|
class FileWidget;
|
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
class FileDialog : public QDialog
|
2013-08-18 20:11:29 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2013-09-23 04:52:53 +00:00
|
|
|
|
2013-10-23 02:52:35 +00:00
|
|
|
private:
|
2022-09-22 18:26:05 +00:00
|
|
|
ContentSelectorView::ContentSelector* mSelector;
|
2013-10-23 02:52:35 +00:00
|
|
|
Ui::FileDialog ui;
|
2013-10-28 01:21:19 +00:00
|
|
|
ContentAction mAction;
|
2022-09-22 18:26:05 +00:00
|
|
|
FileWidget* mFileWidget;
|
|
|
|
AdjusterWidget* mAdjusterWidget;
|
2014-09-09 21:14:01 +00:00
|
|
|
bool mDialogBuilt;
|
2013-09-23 04:52:53 +00:00
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
public:
|
2022-09-22 18:26:05 +00:00
|
|
|
explicit FileDialog(QWidget* parent = nullptr);
|
|
|
|
void showDialog(ContentAction action);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2022-06-08 21:25:50 +00:00
|
|
|
void addFiles(const std::vector<std::filesystem::path>& dataDirs);
|
2022-09-22 18:26:05 +00:00
|
|
|
void setEncoding(const QString& encoding);
|
|
|
|
void clearFiles();
|
2013-09-29 17:19:07 +00:00
|
|
|
|
2013-10-23 02:52:35 +00:00
|
|
|
QString filename() const;
|
2013-10-02 02:29:45 +00:00
|
|
|
QStringList selectedFilePaths();
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void setLocalData(const std::filesystem::path& localData);
|
2013-10-27 03:55:44 +00:00
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
private:
|
2013-10-23 02:52:35 +00:00
|
|
|
void buildNewFileView();
|
|
|
|
void buildOpenFileView();
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
signals:
|
2013-10-23 22:39:17 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void signalOpenFiles(const std::filesystem::path& path);
|
|
|
|
void signalCreateNewFile(const std::filesystem::path& path);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void signalUpdateAcceptButton(bool, int);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
private slots:
|
2013-09-29 17:19:07 +00:00
|
|
|
|
2013-10-27 03:55:44 +00:00
|
|
|
void slotNewFile();
|
|
|
|
void slotOpenFile();
|
2022-09-22 18:26:05 +00:00
|
|
|
void slotUpdateAcceptButton(int);
|
|
|
|
void slotUpdateAcceptButton(const QString&, bool);
|
2013-10-23 22:39:17 +00:00
|
|
|
void slotRejected();
|
2014-10-16 13:07:51 +00:00
|
|
|
void slotAddonDataChanged(const QModelIndex& topleft, const QModelIndex& bottomright);
|
2013-08-18 20:11:29 +00:00
|
|
|
};
|
|
|
|
}
|
2013-03-07 02:00:59 +00:00
|
|
|
#endif // FILEDIALOG_HPP
|