1 #ifndef ARCHIVEWIDGET_H
2 #define ARCHIVEWIDGET_H
3 
4 #include "filetablemodel.h"
5 #include "persistentmodel/archive.h"
6 #include "ui_archivewidget.h"
7 
8 #include <QMenu>
9 #include <QWidget>
10 
11 /*!
12  * \ingroup widgets-specialized
13  * \brief The ArchiveWidget is a QWidget which displays detailed
14  * information about a single Archive.
15  */
16 class ArchiveWidget : public QWidget
17 {
18     Q_OBJECT
19 
20 public:
21     //! Constructor
22     explicit ArchiveWidget(QWidget *parent = nullptr);
23     ~ArchiveWidget();
24 
25 public slots:
26     //! Sets the Archive whose details this widget should display.
27     void setArchive(ArchivePtr archive);
28 
29 signals:
30     //! The user clicked on the Job label.
31     //! \param jobRef: a string which identifies the Job.
32     void jobClicked(QString jobRef);
33     //! The user wants to restore some or all of the files in this Archive.
34     //! \param archive: the Archive this widget is displaying.
35     //! \param options: contains the list of files to restore.
36     void restoreArchive(ArchivePtr archive, ArchiveRestoreOptions options);
37 
38 protected:
39     //! This widget is closing; release memory.
40     void closeEvent(QCloseEvent *event);
41     //! Allow ESC to close the filename filter box.
42     void keyPressEvent(QKeyEvent *event);
43     //! Handles translation change of language.
44     void changeEvent(QEvent *event);
45 
46 private slots:
47     void showContextMenu(const QPoint &pos);
48     void restoreFiles();
49     void updateDetails();
50 
51 private:
52     Ui::ArchiveWidget     _ui;
53     ArchivePtr            _archive;
54     FileTableModel        _contentsModel;
55     QSortFilterProxyModel _proxyModel;
56     QMenu                 _fileMenu;
57 
58     void updateUi();
59 };
60 
61 #endif // ARCHIVEWIDGET_H
62