File indexing completed on 2024-04-28 05:47:44

0001 /*
0002     SPDX-FileCopyrightText: 2007 Henrique Pinto <henrique.pinto@kdemail.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef INFOPANEL_H
0008 #define INFOPANEL_H
0009 
0010 #include "archivemodel.h"
0011 #include "ui_infopanel.h"
0012 
0013 #include <QFrame>
0014 
0015 class InfoPanel : public QFrame, Ui::InformationPanel
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit InfoPanel(ArchiveModel *model, QWidget *parent = nullptr);
0020     ~InfoPanel() override;
0021 
0022     void setIndex(const QModelIndex &);
0023     void setIndexes(const QModelIndexList &list);
0024 
0025     /**
0026      * Returns the file name that is displayed on the info panel.
0027      *
0028      * @return The current file name. If no pretty name has been
0029      *         set, it returns the name of the loaded archive.
0030      */
0031     QString prettyFileName() const;
0032 
0033     /**
0034      * Sets a different file name for the current open archive.
0035      *
0036      * This is particularly useful when a temporary archive (from
0037      * a remote location) is loaded, and the window title shows the
0038      * remote file name and the info panel, by default, would show
0039      * the name of the temporary downloaded file.
0040      *
0041      * @param fileName The new file name.
0042      */
0043     void setPrettyFileName(const QString &fileName);
0044 
0045     void updateWithDefaults();
0046 
0047 private:
0048     void showMetaData();
0049     void hideMetaData();
0050 
0051     void showMetaDataFor(const QModelIndex &index);
0052 
0053     QPixmap getPixmap(const QString &name);
0054 
0055     ArchiveModel *m_model;
0056     QString m_prettyFileName;
0057 };
0058 
0059 #endif // INFOPANEL_H