1 /*
2     SPDX-FileCopyrightText: 2007 Henrique Pinto <henrique.pinto@kdemail.net>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef INFOPANEL_H
8 #define INFOPANEL_H
9 
10 #include "archivemodel.h"
11 #include "ui_infopanel.h"
12 
13 #include <QFrame>
14 
15 class InfoPanel: public QFrame, Ui::InformationPanel
16 {
17     Q_OBJECT
18 public:
19     explicit InfoPanel(ArchiveModel *model, QWidget *parent = nullptr);
20     ~InfoPanel() override;
21 
22     void setIndex(const QModelIndex &);
23     void setIndexes(const QModelIndexList &list);
24 
25     /**
26      * Returns the file name that is displayed on the info panel.
27      *
28      * @return The current file name. If no pretty name has been
29      *         set, it returns the name of the loaded archive.
30      */
31     QString prettyFileName() const;
32 
33     /**
34      * Sets a different file name for the current open archive.
35      *
36      * This is particularly useful when a temporary archive (from
37      * a remote location) is loaded, and the window title shows the
38      * remote file name and the info panel, by default, would show
39      * the name of the temporary downloaded file.
40      *
41      * @param fileName The new file name.
42      */
43     void setPrettyFileName(const QString& fileName);
44 
45     void updateWithDefaults();
46 
47 private:
48     void showMetaData();
49     void hideMetaData();
50 
51     void showMetaDataFor(const QModelIndex &index);
52 
53     QPixmap getPixmap(const QString& name);
54 
55     ArchiveModel *m_model;
56     QString m_prettyFileName;
57 };
58 
59 #endif // INFOPANEL_H
60