| 1 |
/* ============================================================ |
| 2 |
* |
| 3 |
* This file is a part of digiKam project |
| 4 |
* https://www.digikam.org |
| 5 |
* |
| 6 |
* Date : 2014-05-17 |
| 7 |
* Description : Album Labels Tree View - Private containers and classes. |
| 8 |
* |
| 9 |
* SPDX-FileCopyrightText: 2014-2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com> |
| 10 |
* SPDX-FileCopyrightText: 2014-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 11 |
* |
| 12 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 13 |
* |
| 14 |
* ============================================================ */ |
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
#include "labelstreeview.h" |
| 19 |
|
| 20 |
// QT includes |
| 21 |
|
| 22 |
#include <QApplication> |
| 23 |
#include <QPainter> |
| 24 |
#include <QValidator> |
| 25 |
#include <QStyledItemDelegate> |
| 26 |
#include <QUrl> |
| 27 |
|
| 28 |
// KDE includes |
| 29 |
|
| 30 |
#include <kconfiggroup.h> |
| 31 |
#include <ksharedconfig.h> |
| 32 |
#include <klocalizedstring.h> |
| 33 |
|
| 34 |
// Local includes |
| 35 |
|
| 36 |
#include "digikam_debug.h" |
| 37 |
#include "digikam_globals.h" |
| 38 |
#include "coredbsearchxml.h" |
| 39 |
#include "searchtabheader.h" |
| 40 |
#include "thememanager.h" |
| 41 |
#include "albummanager.h" |
| 42 |
#include "albumtreeview.h" |
| 43 |
#include "itemlister.h" |
| 44 |
#include "coredbaccess.h" |
| 45 |
#include "coredb.h" |
| 46 |
#include "colorlabelfilter.h" |
| 47 |
#include "colorlabelwidget.h" |
| 48 |
#include "picklabelfilter.h" |
| 49 |
#include "tagscache.h" |
| 50 |
#include "applicationsettings.h" |
| 51 |
#include "dnotificationwrapper.h" |
| 52 |
#include "digikamapp.h" |
| 53 |
#include "tagsactionmngr.h" |
| 54 |
#include "ratingwidget.h" |
| 55 |
#include "dbjobsmanager.h" |
| 56 |
|
| 57 |
namespace Digikam |
| 58 |
{ |
| 59 |
|
| 60 |
class Q_DECL_HIDDEN ColorLabelValidator : public QValidator |
| 61 |
{ |
| 62 |
Q_OBJECT |
| 63 |
|
| 64 |
public: |
| 65 |
|
| 66 |
explicit ColorLabelValidator(int maxLength, QObject* const parent = nullptr); |
| 67 |
|
| 68 |
QValidator::State validate(QString& input, int& /*pos*/) const override; |
| 69 |
|
| 70 |
private: |
| 71 |
|
| 72 |
int m_maxLength = 32; |
| 73 |
}; |
| 74 |
|
| 75 |
// --- |
| 76 |
|
| 77 |
class Q_DECL_HIDDEN ColorLabelDelegate : public QStyledItemDelegate |
| 78 |
{ |
| 79 |
Q_OBJECT |
| 80 |
|
| 81 |
public: |
| 82 |
|
| 83 |
explicit ColorLabelDelegate(int maxLength, QObject* const parent = nullptr); |
| 84 |
|
| 85 |
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; |
| 86 |
|
| 87 |
void setEditorData(QWidget* editor, const QModelIndex& index) const override; |
| 88 |
|
| 89 |
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; |
| 90 |
|
| 91 |
private: |
| 92 |
|
| 93 |
int m_maxLength = 32; |
| 94 |
}; |
| 95 |
|
| 96 |
// --- |
| 97 |
|
| 98 |
class Q_DECL_HIDDEN LabelsTreeView::Private |
| 99 |
{ |
| 100 |
public: |
| 101 |
|
| 102 |
explicit Private(QTreeWidget* const w); |
| 103 |
|
| 104 |
public: |
| 105 |
|
| 106 |
QFont regularFont; |
| 107 |
QSize iconSize; |
| 108 |
|
| 109 |
QTreeWidgetItem* ratings = nullptr; |
| 110 |
QTreeWidgetItem* picks = nullptr; |
| 111 |
QTreeWidgetItem* colors = nullptr; |
| 112 |
|
| 113 |
QTreeWidgetItemIterator itemIterator; |
| 114 |
|
| 115 |
bool isCheckableTreeView = false; |
| 116 |
bool isLoadingState = false; |
| 117 |
int iconSizeFromSetting = 0; |
| 118 |
|
| 119 |
QHash<Labels, QList<int> > selectedLabels; |
| 120 |
|
| 121 |
public: |
| 122 |
|
| 123 |
const QString configRatingSelectionEntry = QLatin1String("RatingSelection"); |
| 124 |
const QString configPickSelectionEntry = QLatin1String("PickSelection"); |
| 125 |
const QString configColorSelectionEntry = QLatin1String("ColorSelection"); |
| 126 |
const QString configExpansionEntry = QLatin1String("Expansion"); |
| 127 |
}; |
| 128 |
|
| 129 |
} // namespace Digikam |