digiKam
Loading...
Searching...
No Matches
dconfigdlgwidgets_p.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2009-11-03
7 * Description : A dialog base class which can handle multiple pages.
8 *
9 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2007 by Matthias Kretz <kretz at kde dot org>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18#include "dconfigdlgwidgets.h"
19#include "dconfigdlgview_p.h"
20
21// Qt includes
22
23#include <QLabel>
24#include <QApplication>
25
26namespace Digikam
27{
28
29class DConfigDlgWdgModel;
30
31class Q_DECL_HIDDEN DConfigDlgWdgPrivate : public DConfigDlgViewPrivate
32{
33 Q_DECLARE_PUBLIC(DConfigDlgWdg)
34
35protected:
36
37 explicit DConfigDlgWdgPrivate(DConfigDlgWdg* const q);
38
40 {
41 return static_cast<DConfigDlgWdgModel*>(DConfigDlgViewPrivate::model);
42 }
43
44 void _k_slotCurrentPageChanged(const QModelIndex&, const QModelIndex&);
45};
46
47// -----------------------------------------------------------------------------------
48
49class Q_DECL_HIDDEN DConfigDlgTitle::Private
50{
51public:
52
53 explicit Private(DConfigDlgTitle* const parent)
54 : q(parent)
55 {
56 }
57
58 QString textStyleSheet() const
59 {
60 const int fontSize = qRound(QApplication::font().pointSize() * 1.4);
61
62 return (QString::fromLatin1("QLabel { font-size: %1pt; color: %2 }")
63 .arg(fontSize).arg(q->palette().color(QPalette::WindowText).name()));
64 }
65
66 QString commentStyleSheet() const
67 {
68 QString styleSheet;
69
70 switch (messageType)
71 {
72 // FIXME: we need the usability color styles to implement different
73 // yet palette appropriate colours for the different use cases!
74 // also .. should we include an icon here,
75 // perhaps using the imageLabel?
76
77 case InfoMessage:
78 case WarningMessage:
79 case ErrorMessage:
80 {
81 styleSheet = QString::fromLatin1("QLabel { color: palette(%1); background: palette(%2); }")
82 .arg(q->palette().color(QPalette::HighlightedText).name())
83 .arg(q->palette().color(QPalette::Highlight).name());
84 break;
85 }
86
87 case PlainMessage:
88 default:
89 {
90 break;
91 }
92 }
93
94 return styleSheet;
95 }
96
103 {
104 switch (type)
105 {
106 case DConfigDlgTitle::InfoMessage:
107 {
108 return QLatin1String("dialog-information");
109 }
110
111 case DConfigDlgTitle::ErrorMessage:
112 {
113 return QLatin1String("dialog-error");
114 }
115
116 case DConfigDlgTitle::WarningMessage:
117 {
118 return QLatin1String("dialog-warning");
119 }
120
121 case DConfigDlgTitle::PlainMessage:
122 {
123 break;
124 }
125 }
126
127 return QString();
128 }
129
131 {
132 q->setVisible(false);
133 }
134
135public:
136
137 DConfigDlgTitle* q = nullptr;
138 QGridLayout* headerLayout = nullptr;
139 QLabel* imageLabel = nullptr;
140 QLabel* textLabel = nullptr;
141 QLabel* commentLabel = nullptr;
142 int autoHideTimeout = 0;
143 MessageType messageType = InfoMessage;
144};
145
146} // namespace Digikam
Definition dconfigdlgwidgets_p.h:50
QString commentStyleSheet() const
Definition dconfigdlgwidgets_p.h:66
QString textStyleSheet() const
Definition dconfigdlgwidgets_p.h:58
Private(DConfigDlgTitle *const parent)
Definition dconfigdlgwidgets_p.h:53
void _k_timeoutFinished()
Definition dconfigdlgwidgets_p.h:130
QString iconTypeToIconName(DConfigDlgTitle::MessageType type)
Get the icon name from the icon type.
Definition dconfigdlgwidgets_p.h:102
Definition dconfigdlgwidgets.h:175
MessageType
Definition dconfigdlgwidgets.h:201
Definition dconfigdlgview_p.h:67
Definition dconfigdlgmodels.h:238
Definition dconfigdlgwidgets_p.h:32
DConfigDlgWdgModel * model() const
Definition dconfigdlgwidgets_p.h:39
Page widget with many layouts (faces).
Definition dconfigdlgwidgets.h:38
Definition datefolderview.cpp:34