filebrowser.h 1.01 KB
Newer Older
Tobias WEBER's avatar
Tobias WEBER committed
1
2
3
4
5
6
7
8
9
10
/**
 * data file browser
 * @author Tobias Weber <tweber@ill.fr>
 * @date 9-Apr-2018
 * @license see 'LICENSE' file
 */

#ifndef __FILEBROWSER_H__
#define __FILEBROWSER_H__

Tobias WEBER's avatar
Tobias WEBER committed
11
#include <QtCore/QSettings>
Tobias WEBER's avatar
Tobias WEBER committed
12
13
#include <QtWidgets/QWidget>
#include <QtWidgets/QDockWidget>
Tobias WEBER's avatar
Tobias WEBER committed
14
15
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QListWidget>
Tobias WEBER's avatar
Tobias WEBER committed
16
17
18
19
20
21
22
23
24
25

#include <memory>


/**
 * file browser widget
 */
class FileBrowserWidget : public QWidget
{
private:
Tobias WEBER's avatar
Tobias WEBER committed
26
27
28
29
	QSettings *m_pSettings = nullptr;

	QLineEdit *m_pEditFolder = new QLineEdit(this);
	QListWidget *m_pListFiles = new QListWidget(this);
Tobias WEBER's avatar
Tobias WEBER committed
30
31

public:
Tobias WEBER's avatar
Tobias WEBER committed
32
	FileBrowserWidget(QWidget *pParent = nullptr, QSettings *pSettings = nullptr);
Tobias WEBER's avatar
Tobias WEBER committed
33
	virtual ~FileBrowserWidget();
Tobias WEBER's avatar
Tobias WEBER committed
34
35
36
37

public:
	void SelectFolder();
	void SetFolder(const QString& str);
Tobias WEBER's avatar
Tobias WEBER committed
38
39
40
};


Tobias WEBER's avatar
Tobias WEBER committed
41

Tobias WEBER's avatar
Tobias WEBER committed
42
43
44
45
46
47
48
49
50
/**
 * the dock which contains the file browser widget
 */
class FileBrowser : public QDockWidget
{
private:
	std::unique_ptr<FileBrowserWidget> m_pBrowser;

public:
Tobias WEBER's avatar
Tobias WEBER committed
51
	FileBrowser(QWidget* pParent = nullptr, QSettings *pSettings = nullptr);
Tobias WEBER's avatar
Tobias WEBER committed
52
53
54
55
	virtual ~FileBrowser();
};

#endif