1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
/* ============================================================
 *
 * This file is a part of digiKam project
 * https://www.digikam.org
 *
 * Date        : 2010-05-22
 * Description : database key selector.
 *
 * SPDX-FileCopyrightText: 2010-2012 by Andi Clemens <andi dot clemens at gmail dot com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * ============================================================ */

#pragma once

// Qt includes

#include <QTreeWidgetItem>
#include <QTreeWidget>
#include <QStringList>

// Local includes

#include "searchtextbar.h"
#include "databaseoption.h"

namespace Digikam
{
class DbHeaderListItem;

class DbKeySelectorItem : public QTreeWidgetItem
{

public:

    explicit DbKeySelectorItem(DbHeaderListItem* const parent, const QString& title, const QString& desc);
    ~DbKeySelectorItem() override = default;

    QString key()         const;<--- Function 'key()' should return member 'm_key' by const reference.
    QString description() const;<--- Function 'description()' should return member 'm_description' by const reference.

private:

    QString m_key;
    QString m_description;

private:

    // Disable
    DbKeySelectorItem(const DbKeySelectorItem&)            = delete;
    DbKeySelectorItem& operator=(const DbKeySelectorItem&) = delete;
};

// ------------------------------------------------------------------------------------

class DbKeySelector : public QTreeWidget
{
    Q_OBJECT

public:

    explicit DbKeySelector(QWidget* const parent);
    ~DbKeySelector() override = default;

    void setKeysMap(const DbOptionKeysMap& map);
    QStringList checkedKeysList();

private:

    // Disable
    DbKeySelector(const DbKeySelector&)            = delete;
    DbKeySelector& operator=(const DbKeySelector&) = delete;
};

// ------------------------------------------------------------------------------------

class DbKeySelectorView : public QWidget
{
    Q_OBJECT

public:

    explicit DbKeySelectorView(QWidget* const parent);
    ~DbKeySelectorView() override;

    void setKeysMap(const DbOptionKeysMap& map);
    QStringList checkedKeysList() const;

private Q_SLOTS:

    void slotSearchTextChanged(const SearchTextSettings&);

private:

    void removeChildlessHeaders();

private:

    // Disable
    DbKeySelectorView(const DbKeySelectorView&)            = delete;
    DbKeySelectorView& operator=(const DbKeySelectorView&) = delete;

private:

    class Private;
    Private* const d = nullptr;
};

} // namespace Digikam