File indexing completed on 2024-04-28 17:06:10
0001 /* 0002 SPDX-FileCopyrightText: 2005 Dirk Eschler <deschler@users.sourceforge.net> 0003 SPDX-FileCopyrightText: 2005-2022 Krusader Krew <https://krusader.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KRRESULTTABLE_H 0009 #define KRRESULTTABLE_H 0010 0011 // QtCore 0012 #include <QList> 0013 #include <QString> 0014 #include <QStringList> 0015 // QtWidgets 0016 #include <QGridLayout> 0017 #include <QLabel> 0018 #include <QLayout> 0019 0020 #include <KIOWidgets/KRun> 0021 #include <KWidgetsAddons/KSeparator> 0022 #include <KWidgetsAddons/KUrlLabel> 0023 0024 #include "searchobject.h" 0025 0026 class KrResultTable : public QWidget 0027 { 0028 public: 0029 explicit KrResultTable(QWidget *parent); 0030 ~KrResultTable() override; 0031 0032 /** 0033 * Adds a row of search results to the end of a QGridLayout 0034 * Each KrResultTable has to implement it 0035 * 0036 * @param search Name of the SearchObject 0037 * @param grid The GridLayout where the row is inserted 0038 * 0039 * @return bool True if row was added successfully to rows, else false 0040 */ 0041 virtual bool addRow(SearchObject *search, QGridLayout *grid) = 0; 0042 0043 protected: 0044 QStringList _supported; 0045 QStringList _tableHeaders; 0046 int _numColumns; 0047 int _numRows; 0048 0049 QGridLayout *_grid; 0050 QLabel *_label; // generic label 0051 0052 /** 0053 * Creates the main grid layout and attaches the table header 0054 * 0055 * @return bool Pointer to the main grid layout 0056 */ 0057 QGridLayout *initTable(); 0058 0059 /** 0060 * Applies settings to each cell of the grid layout 0061 * Supposed to be run after a row was added 0062 * 0063 * @param grid The GridLayout 0064 */ 0065 void adjustRow(QGridLayout *grid); 0066 }; 0067 0068 // ----------------------------------------------------------------------------- 0069 // ----------------------------------------------------------------------------- 0070 0071 class KrArchiverResultTable : public KrResultTable 0072 { 0073 Q_OBJECT 0074 public: 0075 explicit KrArchiverResultTable(QWidget *parent); 0076 ~KrArchiverResultTable() override; 0077 0078 bool addRow(SearchObject *search, QGridLayout *grid) override; 0079 0080 protected: 0081 KUrlLabel *_nameLabel; 0082 0083 protected slots: 0084 void website(const QString &); 0085 }; 0086 0087 // ----------------------------------------------------------------------------- 0088 // ----------------------------------------------------------------------------- 0089 0090 class KrToolResultTable : public KrResultTable 0091 { 0092 Q_OBJECT 0093 public: 0094 explicit KrToolResultTable(QWidget *parent); 0095 ~KrToolResultTable() override; 0096 0097 bool addRow(SearchObject *search, QGridLayout *grid) override; 0098 0099 protected: 0100 QList<Application *> _apps; 0101 0102 protected slots: 0103 void website(const QString &); 0104 }; 0105 0106 #endif