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: Geographic column
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_GEO_H
0017 #define DIGIKAM_TABLE_VIEW_COLUMN_GEO_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 ColumnGeoProperties : public TableViewColumn
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     enum SubColumn
0042     {
0043         SubColumnHasCoordinates = 0,
0044         SubColumnCoordinates    = 1,
0045         SubColumnAltitude       = 2
0046     } subColumn;
0047 
0048 public:
0049 
0050     explicit ColumnGeoProperties(TableViewShared* const tableViewShared,
0051                                  const TableViewColumnConfiguration& pConfiguration,
0052                                  const SubColumn pSubColumn,
0053                                  QObject* const parent = nullptr);
0054     ~ColumnGeoProperties() override;
0055 
0056     QString getTitle()                                                                                const override;
0057     ColumnFlags getColumnFlags()                                                                      const override;
0058     QVariant data(TableViewModel::Item* const item, const int role)                                   const override;
0059     ColumnCompareResult compare(TableViewModel::Item* const itemA, TableViewModel::Item* const itemB) const override;
0060     TableViewColumnConfigurationWidget* getConfigurationWidget(QWidget* const parentWidget)           const override;
0061     void setConfiguration(const TableViewColumnConfiguration& newConfiguration) override;
0062 
0063     static QStringList getSubColumns();
0064     static TableViewColumnDescription getDescription();
0065 };
0066 
0067 // -----------------------------------------------------------------------------------------------
0068 
0069 class ColumnGeoConfigurationWidget : public TableViewColumnConfigurationWidget
0070 {
0071     Q_OBJECT
0072 
0073 public:
0074     explicit ColumnGeoConfigurationWidget(TableViewShared* const sharedObject,
0075                                           const TableViewColumnConfiguration& columnConfiguration,
0076                                           QWidget* const parentWidget);
0077     ~ColumnGeoConfigurationWidget() override;
0078 
0079     TableViewColumnConfiguration getNewConfiguration() override;
0080 
0081 private:
0082 
0083     ColumnGeoProperties::SubColumn subColumn;
0084     QComboBox*                     selectorAltitudeUnit;
0085 };
0086 
0087 } // namespace TableViewColumns
0088 
0089 } // namespace Digikam
0090 
0091 #endif // DIGIKAM_TABLE_VIEW_COLUMN_GEO_H
0092