structurelibraryview.hpp 1.13 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/*
 * <32021 by Stellaris. Copying Art is an act of love. Love is not subject to law.
 */
#ifndef STRUCTURELIBRARYVIEW_HPP
#define STRUCTURELIBRARYVIEW_HPP

#include <QFrame>

#include <QDir>
#include <QTreeWidgetItem>
11
#include <QFileSystemWatcher>
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

#include "structure.hpp"

namespace Ui {
class StructureLibraryView;
}

class StructureLibraryView : public QFrame
{
    Q_OBJECT

public:
    explicit StructureLibraryView(QWidget *parent = nullptr);
    ~StructureLibraryView();

27
28
29
protected:
    void mouseMoveEvent(QMouseEvent* event);

30
31
32
33
34
35
signals:
    void structure_copied(const Structure& s);

private:
    void load_structures();
    QTreeWidgetItem *add_directory_contents(const QDir& dir);
36
    bool try_load_structure(const QString& filename, Structure& s);
Yann Boucher's avatar
Yann Boucher committed
37
    void update_preview(const Structure& s);
38
39
    QImage create_preview_image(const Structure &s, QColor background);
    void create_drag(QTreeWidgetItem* item, int column);
40
41
42
43
44
45
46

private slots:
    void update_info(QTreeWidgetItem* item, int column);
    void copy_button_clicked();

private:
    Ui::StructureLibraryView *ui;
47
    QFileSystemWatcher m_watcher;
48
49
50
};

#endif // STRUCTURELIBRARYVIEW_HPP