File indexing completed on 2025-01-19 03:50:48

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2013-02-25
0007  * Description : Table view column helpers: File properties
0008  *
0009  * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2013      by Michael G. Hansen <mike at mghansen dot de>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_TABLE_VIEW_COLUMN_FILE_H
0017 #define DIGIKAM_TABLE_VIEW_COLUMN_FILE_H
0018 
0019 // Qt includes
0020 
0021 #include <QStringList>
0022 
0023 // Local includes
0024 
0025 #include "tableview_columnfactory.h"
0026 
0027 class QComboBox;
0028 
0029 namespace Digikam
0030 {
0031 
0032 namespace TableViewColumns
0033 {
0034 
0035 class ColumnFileProperties : public TableViewColumn
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     enum SubColumn
0042     {
0043         SubColumnName         = 0,
0044         SubColumnFilePath     = 1,
0045         SubColumnSize         = 2,
0046         SubColumnLastModified = 3
0047     };
0048 
0049 public:
0050 
0051     explicit ColumnFileProperties(TableViewShared* const tableViewShared,
0052                                   const TableViewColumnConfiguration& pConfiguration,
0053                                   const SubColumn pSubColumn,
0054                                   QObject* const parent = nullptr);
0055     ~ColumnFileProperties() override {};
0056 
0057     TableViewColumnConfigurationWidget* getConfigurationWidget(QWidget* const parentWidget)           const override;
0058     void setConfiguration(const TableViewColumnConfiguration& newConfiguration) override;
0059     QString getTitle()                                                                                const override;
0060     ColumnFlags getColumnFlags()                                                                      const override;
0061     QVariant data(TableViewModel::Item* const item, const int role)                                   const override;
0062     ColumnCompareResult compare(TableViewModel::Item* const itemA, TableViewModel::Item* const itemB) const override;
0063 
0064 public:
0065 
0066     static TableViewColumnDescription getDescription();
0067     static QStringList                getSubColumns();
0068 
0069 private:
0070 
0071     SubColumn subColumn;
0072 };
0073 
0074 // ---------------------------------------------------------------------------------------
0075 
0076 class ColumnFileConfigurationWidget : public TableViewColumnConfigurationWidget
0077 {
0078     Q_OBJECT
0079 
0080 public:
0081 
0082     explicit ColumnFileConfigurationWidget(TableViewShared* const sharedObject,
0083                                            const TableViewColumnConfiguration& columnConfiguration,
0084                                            QWidget* const parentWidget);
0085     ~ColumnFileConfigurationWidget() override;
0086 
0087     TableViewColumnConfiguration getNewConfiguration() override;
0088 
0089 private:
0090 
0091     ColumnFileProperties::SubColumn subColumn;
0092     QComboBox*                      selectorSizeType;
0093 };
0094 
0095 } // namespace TableViewColumns
0096 
0097 } // namespace Digikam
0098 
0099 #endif // DIGIKAM_TABLE_VIEW_COLUMN_FILE_H