Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformdialoghelper.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | static const int buttonRoleLayouts[2][5][14] = | - | ||||||
7 | { | - | ||||||
8 | - | |||||||
9 | { | - | ||||||
10 | - | |||||||
11 | { QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::YesRole, QPlatformDialogHelper::AcceptRole, | - | ||||||
12 | QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::NoRole, | - | ||||||
13 | QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::ApplyRole, | - | ||||||
14 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
15 | - | |||||||
16 | - | |||||||
17 | { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, | - | ||||||
18 | QPlatformDialogHelper::Stretch, QPlatformDialogHelper::DestructiveRole | QPlatformDialogHelper::Reverse, | - | ||||||
19 | QPlatformDialogHelper::AlternateRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::RejectRole | QPlatformDialogHelper::Reverse, | - | ||||||
20 | QPlatformDialogHelper::AcceptRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::NoRole | QPlatformDialogHelper::Reverse, | - | ||||||
21 | QPlatformDialogHelper::YesRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
22 | - | |||||||
23 | - | |||||||
24 | { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::YesRole, | - | ||||||
25 | QPlatformDialogHelper::NoRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole, | - | ||||||
26 | QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::EOL }, | - | ||||||
27 | - | |||||||
28 | - | |||||||
29 | { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ActionRole, | - | ||||||
30 | QPlatformDialogHelper::ApplyRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::DestructiveRole | QPlatformDialogHelper::Reverse, | - | ||||||
31 | QPlatformDialogHelper::AlternateRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::RejectRole | QPlatformDialogHelper::Reverse, | - | ||||||
32 | QPlatformDialogHelper::AcceptRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::NoRole | QPlatformDialogHelper::Reverse, | - | ||||||
33 | QPlatformDialogHelper::YesRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::EOL }, | - | ||||||
34 | - | |||||||
35 | - | |||||||
36 | { QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch, | - | ||||||
37 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, | - | ||||||
38 | QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL } | - | ||||||
39 | }, | - | ||||||
40 | - | |||||||
41 | - | |||||||
42 | { | - | ||||||
43 | - | |||||||
44 | { QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::YesRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole, | - | ||||||
45 | QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ResetRole, | - | ||||||
46 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
47 | - | |||||||
48 | - | |||||||
49 | { QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::RejectRole, | - | ||||||
50 | QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::ApplyRole, | - | ||||||
51 | QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
52 | - | |||||||
53 | - | |||||||
54 | { QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, | - | ||||||
55 | QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ResetRole, | - | ||||||
56 | QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL }, | - | ||||||
57 | - | |||||||
58 | - | |||||||
59 | { QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::RejectRole, | - | ||||||
60 | QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch, | - | ||||||
61 | QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
62 | - | |||||||
63 | - | |||||||
64 | { QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, | - | ||||||
65 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, | - | ||||||
66 | QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL } | - | ||||||
67 | } | - | ||||||
68 | }; | - | ||||||
69 | - | |||||||
70 | QPlatformDialogHelper::QPlatformDialogHelper() | - | ||||||
71 | { | - | ||||||
72 | qRegisterMetaType<StandardButton>(); | - | ||||||
73 | qRegisterMetaType<ButtonRole>(); | - | ||||||
74 | } | - | ||||||
75 | - | |||||||
76 | QPlatformDialogHelper::~QPlatformDialogHelper() | - | ||||||
77 | { | - | ||||||
78 | } | - | ||||||
79 | - | |||||||
80 | QVariant QPlatformDialogHelper::styleHint(StyleHint hint) const | - | ||||||
81 | { | - | ||||||
82 | return QPlatformDialogHelper::defaultStyleHint(hint); | - | ||||||
83 | } | - | ||||||
84 | - | |||||||
85 | QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHint hint) | - | ||||||
86 | { | - | ||||||
87 | (void)hint;; | - | ||||||
88 | return QVariant(); | - | ||||||
89 | } | - | ||||||
90 | - | |||||||
91 | - | |||||||
92 | - | |||||||
93 | class QFontDialogOptionsPrivate : public QSharedData | - | ||||||
94 | { | - | ||||||
95 | public: | - | ||||||
96 | QFontDialogOptionsPrivate() : options(0) {} | - | ||||||
97 | - | |||||||
98 | QFontDialogOptions::FontDialogOptions options; | - | ||||||
99 | QString windowTitle; | - | ||||||
100 | }; | - | ||||||
101 | - | |||||||
102 | QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate) | - | ||||||
103 | { | - | ||||||
104 | } | - | ||||||
105 | - | |||||||
106 | QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d) | - | ||||||
107 | { | - | ||||||
108 | } | - | ||||||
109 | - | |||||||
110 | QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs) | - | ||||||
111 | { | - | ||||||
112 | if (this != &rhs) | - | ||||||
113 | d = rhs.d; | - | ||||||
114 | return *this; | - | ||||||
115 | } | - | ||||||
116 | - | |||||||
117 | QFontDialogOptions::~QFontDialogOptions() | - | ||||||
118 | { | - | ||||||
119 | } | - | ||||||
120 | - | |||||||
121 | QString QFontDialogOptions::windowTitle() const | - | ||||||
122 | { | - | ||||||
123 | return d->windowTitle; | - | ||||||
124 | } | - | ||||||
125 | - | |||||||
126 | void QFontDialogOptions::setWindowTitle(const QString &title) | - | ||||||
127 | { | - | ||||||
128 | d->windowTitle = title; | - | ||||||
129 | } | - | ||||||
130 | - | |||||||
131 | void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on) | - | ||||||
132 | { | - | ||||||
133 | if (!(d->options & option) != !on) | - | ||||||
134 | setOptions(d->options ^ option); | - | ||||||
135 | } | - | ||||||
136 | - | |||||||
137 | bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const | - | ||||||
138 | { | - | ||||||
139 | return d->options & option; | - | ||||||
140 | } | - | ||||||
141 | - | |||||||
142 | void QFontDialogOptions::setOptions(FontDialogOptions options) | - | ||||||
143 | { | - | ||||||
144 | if (options != d->options) | - | ||||||
145 | d->options = options; | - | ||||||
146 | } | - | ||||||
147 | - | |||||||
148 | QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const | - | ||||||
149 | { | - | ||||||
150 | return d->options; | - | ||||||
151 | } | - | ||||||
152 | const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const | - | ||||||
153 | { | - | ||||||
154 | return m_options; | - | ||||||
155 | } | - | ||||||
156 | - | |||||||
157 | void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options) | - | ||||||
158 | { | - | ||||||
159 | m_options = options; | - | ||||||
160 | } | - | ||||||
161 | - | |||||||
162 | - | |||||||
163 | - | |||||||
164 | class QColorDialogStaticData | - | ||||||
165 | { | - | ||||||
166 | public: | - | ||||||
167 | enum { CustomColorCount = 16, StandardColorCount = 6 * 8 }; | - | ||||||
168 | - | |||||||
169 | QColorDialogStaticData(); | - | ||||||
170 | inline void readSettings(); | - | ||||||
171 | inline void writeSettings() const; | - | ||||||
172 | - | |||||||
173 | QRgb customRgb[CustomColorCount]; | - | ||||||
174 | QRgb standardRgb[StandardColorCount]; | - | ||||||
175 | bool customSet; | - | ||||||
176 | }; | - | ||||||
177 | - | |||||||
178 | QColorDialogStaticData::QColorDialogStaticData() : customSet(false) | - | ||||||
179 | { | - | ||||||
180 | int i = 0; | - | ||||||
181 | for (int g = 0; g < 4; ++g) | - | ||||||
182 | for (int r = 0; r < 4; ++r) | - | ||||||
183 | for (int b = 0; b < 3; ++b) | - | ||||||
184 | standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2); | - | ||||||
185 | std::fill(customRgb, customRgb + CustomColorCount, 0xffffffff); | - | ||||||
186 | readSettings(); | - | ||||||
187 | } | - | ||||||
188 | - | |||||||
189 | void QColorDialogStaticData::readSettings() | - | ||||||
190 | { | - | ||||||
191 | - | |||||||
192 | const QSettings settings(QSettings::UserScope, ([]() -> QString { enum { Size = sizeof(u"" "QtProject")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "QtProject" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | - | ||||||
193 | for (int i = 0; i < int(CustomColorCount)
| 0 | ||||||
194 | const QVariant v = settings.value(([]() -> QString { enum { Size = sizeof(u"" "Qt/customColors/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeofQLatin1String(QStringData) }, u"" "Qt/customColors/"}; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) + QString::number(i)); | - | ||||||
195 | if (v.isValid()
| 0 | ||||||
196 | customRgb[i] = v.toUInt(); never executed: customRgb[i] = v.toUInt(); | 0 | ||||||
197 | } never executed: end of block | 0 | ||||||
198 | - | |||||||
199 | } never executed: end of block | 0 | ||||||
200 | - | |||||||
201 | void QColorDialogStaticData::writeSettings() const | - | ||||||
202 | { | - | ||||||
203 | - | |||||||
204 | if (!customSet
| 0 | ||||||
205 | QSettings settings(QSettings::UserScope, ([]() -> QString { enum { Size = sizeof(u"" "QtProject")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "QtProject" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | - | ||||||
206 | for (int i = 0; i < int(CustomColorCount)
| 0 | ||||||
207 | settings.setValue(([]() -> QString { enum { Size = sizeof(u"" "Qt/customColors/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeofQLatin1String(QStringData) }, u"" "Qt/customColors/"}; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) + QString::number(i), customRgb[i]); never executed: settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]); | 0 | ||||||
208 | } never executed: end of block | 0 | ||||||
209 | - | |||||||
210 | } never executed: end of block | 0 | ||||||
211 | - | |||||||
212 | namespace { namespace Q_QGS_qColorDialogStaticData { typedef QColorDialogStaticData Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QColorDialogStaticData, Q_QGS_qColorDialogStaticData::innerFunction, Q_QGS_qColorDialogStaticData::guard> qColorDialogStaticData; | - | ||||||
213 | - | |||||||
214 | class QColorDialogOptionsPrivate : public QSharedData | - | ||||||
215 | { | - | ||||||
216 | public: | - | ||||||
217 | QColorDialogOptionsPrivate() : options(0) {} | - | ||||||
218 | - | |||||||
219 | ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); } | - | ||||||
220 | - | |||||||
221 | QColorDialogOptions::ColorDialogOptions options; | - | ||||||
222 | QString windowTitle; | - | ||||||
223 | }; | - | ||||||
224 | - | |||||||
225 | QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate) | - | ||||||
226 | { | - | ||||||
227 | } | - | ||||||
228 | - | |||||||
229 | QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d) | - | ||||||
230 | { | - | ||||||
231 | } | - | ||||||
232 | - | |||||||
233 | QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs) | - | ||||||
234 | { | - | ||||||
235 | if (this != &rhs) | - | ||||||
236 | d = rhs.d; | - | ||||||
237 | return *this; | - | ||||||
238 | } | - | ||||||
239 | - | |||||||
240 | QColorDialogOptions::~QColorDialogOptions() | - | ||||||
241 | { | - | ||||||
242 | } | - | ||||||
243 | - | |||||||
244 | QString QColorDialogOptions::windowTitle() const | - | ||||||
245 | { | - | ||||||
246 | return d->windowTitle; | - | ||||||
247 | } | - | ||||||
248 | - | |||||||
249 | void QColorDialogOptions::setWindowTitle(const QString &title) | - | ||||||
250 | { | - | ||||||
251 | d->windowTitle = title; | - | ||||||
252 | } | - | ||||||
253 | - | |||||||
254 | void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on) | - | ||||||
255 | { | - | ||||||
256 | if (!(d->options & option) != !on) | - | ||||||
257 | setOptions(d->options ^ option); | - | ||||||
258 | } | - | ||||||
259 | - | |||||||
260 | bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const | - | ||||||
261 | { | - | ||||||
262 | return d->options & option; | - | ||||||
263 | } | - | ||||||
264 | - | |||||||
265 | void QColorDialogOptions::setOptions(ColorDialogOptions options) | - | ||||||
266 | { | - | ||||||
267 | if (options != d->options) | - | ||||||
268 | d->options = options; | - | ||||||
269 | } | - | ||||||
270 | - | |||||||
271 | QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const | - | ||||||
272 | { | - | ||||||
273 | return d->options; | - | ||||||
274 | } | - | ||||||
275 | - | |||||||
276 | int QColorDialogOptions::customColorCount() | - | ||||||
277 | { | - | ||||||
278 | return QColorDialogStaticData::CustomColorCount; | - | ||||||
279 | } | - | ||||||
280 | - | |||||||
281 | QRgb QColorDialogOptions::customColor(int index) | - | ||||||
282 | { | - | ||||||
283 | if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount)) | - | ||||||
284 | return qRgb(255, 255, 255); | - | ||||||
285 | return qColorDialogStaticData()->customRgb[index]; | - | ||||||
286 | } | - | ||||||
287 | - | |||||||
288 | QRgb *QColorDialogOptions::customColors() | - | ||||||
289 | { | - | ||||||
290 | return qColorDialogStaticData()->customRgb; | - | ||||||
291 | } | - | ||||||
292 | - | |||||||
293 | void QColorDialogOptions::setCustomColor(int index, QRgb color) | - | ||||||
294 | { | - | ||||||
295 | if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount)) | - | ||||||
296 | return; | - | ||||||
297 | qColorDialogStaticData()->customSet = true; | - | ||||||
298 | qColorDialogStaticData()->customRgb[index] = color; | - | ||||||
299 | } | - | ||||||
300 | - | |||||||
301 | QRgb *QColorDialogOptions::standardColors() | - | ||||||
302 | { | - | ||||||
303 | return qColorDialogStaticData()->standardRgb; | - | ||||||
304 | } | - | ||||||
305 | - | |||||||
306 | QRgb QColorDialogOptions::standardColor(int index) | - | ||||||
307 | { | - | ||||||
308 | if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount)) | - | ||||||
309 | return qRgb(255, 255, 255); | - | ||||||
310 | return qColorDialogStaticData()->standardRgb[index]; | - | ||||||
311 | } | - | ||||||
312 | - | |||||||
313 | void QColorDialogOptions::setStandardColor(int index, QRgb color) | - | ||||||
314 | { | - | ||||||
315 | if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount)) | - | ||||||
316 | return; | - | ||||||
317 | qColorDialogStaticData()->standardRgb[index] = color; | - | ||||||
318 | } | - | ||||||
319 | const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const | - | ||||||
320 | { | - | ||||||
321 | return m_options; | - | ||||||
322 | } | - | ||||||
323 | - | |||||||
324 | void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options) | - | ||||||
325 | { | - | ||||||
326 | m_options = options; | - | ||||||
327 | } | - | ||||||
328 | - | |||||||
329 | - | |||||||
330 | - | |||||||
331 | class QFileDialogOptionsPrivate : public QSharedData | - | ||||||
332 | { | - | ||||||
333 | public: | - | ||||||
334 | QFileDialogOptionsPrivate() : options(0), | - | ||||||
335 | viewMode(QFileDialogOptions::Detail), | - | ||||||
336 | fileMode(QFileDialogOptions::AnyFile), | - | ||||||
337 | acceptMode(QFileDialogOptions::AcceptOpen), | - | ||||||
338 | filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs), | - | ||||||
339 | useDefaultNameFilters(true) | - | ||||||
340 | {} never executed: end of block | 0 | ||||||
341 | - | |||||||
342 | QFileDialogOptions::FileDialogOptions options; | - | ||||||
343 | QString windowTitle; | - | ||||||
344 | - | |||||||
345 | QFileDialogOptions::ViewMode viewMode; | - | ||||||
346 | QFileDialogOptions::FileMode fileMode; | - | ||||||
347 | QFileDialogOptions::AcceptMode acceptMode; | - | ||||||
348 | QString labels[QFileDialogOptions::DialogLabelCount]; | - | ||||||
349 | QDir::Filters filters; | - | ||||||
350 | QList<QUrl> sidebarUrls; | - | ||||||
351 | bool useDefaultNameFilters; | - | ||||||
352 | QStringList nameFilters; | - | ||||||
353 | QStringList mimeTypeFilters; | - | ||||||
354 | QString defaultSuffix; | - | ||||||
355 | QStringList history; | - | ||||||
356 | QUrl initialDirectory; | - | ||||||
357 | QString initiallySelectedNameFilter; | - | ||||||
358 | QList<QUrl> initiallySelectedFiles; | - | ||||||
359 | QStringList supportedSchemes; | - | ||||||
360 | }; | - | ||||||
361 | - | |||||||
362 | QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) | - | ||||||
363 | { | - | ||||||
364 | } | - | ||||||
365 | - | |||||||
366 | QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d) | - | ||||||
367 | { | - | ||||||
368 | } | - | ||||||
369 | - | |||||||
370 | QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs) | - | ||||||
371 | { | - | ||||||
372 | if (this != &rhs) | - | ||||||
373 | d = rhs.d; | - | ||||||
374 | return *this; | - | ||||||
375 | } | - | ||||||
376 | - | |||||||
377 | QFileDialogOptions::~QFileDialogOptions() | - | ||||||
378 | { | - | ||||||
379 | } | - | ||||||
380 | - | |||||||
381 | QString QFileDialogOptions::windowTitle() const | - | ||||||
382 | { | - | ||||||
383 | return d->windowTitle; | - | ||||||
384 | } | - | ||||||
385 | - | |||||||
386 | void QFileDialogOptions::setWindowTitle(const QString &title) | - | ||||||
387 | { | - | ||||||
388 | d->windowTitle = title; | - | ||||||
389 | } | - | ||||||
390 | - | |||||||
391 | void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on) | - | ||||||
392 | { | - | ||||||
393 | if (!(d->options & option) != !on) | - | ||||||
394 | setOptions(d->options ^ option); | - | ||||||
395 | } | - | ||||||
396 | - | |||||||
397 | bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const | - | ||||||
398 | { | - | ||||||
399 | return d->options & option; | - | ||||||
400 | } | - | ||||||
401 | - | |||||||
402 | void QFileDialogOptions::setOptions(FileDialogOptions options) | - | ||||||
403 | { | - | ||||||
404 | if (options != d->options) | - | ||||||
405 | d->options = options; | - | ||||||
406 | } | - | ||||||
407 | - | |||||||
408 | QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const | - | ||||||
409 | { | - | ||||||
410 | return d->options; | - | ||||||
411 | } | - | ||||||
412 | - | |||||||
413 | QDir::Filters QFileDialogOptions::filter() const | - | ||||||
414 | { | - | ||||||
415 | return d->filters; | - | ||||||
416 | } | - | ||||||
417 | - | |||||||
418 | void QFileDialogOptions::setFilter(QDir::Filters filters) | - | ||||||
419 | { | - | ||||||
420 | d->filters = filters; | - | ||||||
421 | } | - | ||||||
422 | - | |||||||
423 | void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode) | - | ||||||
424 | { | - | ||||||
425 | d->viewMode = mode; | - | ||||||
426 | } | - | ||||||
427 | - | |||||||
428 | QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const | - | ||||||
429 | { | - | ||||||
430 | return d->viewMode; | - | ||||||
431 | } | - | ||||||
432 | - | |||||||
433 | void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode) | - | ||||||
434 | { | - | ||||||
435 | d->fileMode = mode; | - | ||||||
436 | } | - | ||||||
437 | - | |||||||
438 | QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const | - | ||||||
439 | { | - | ||||||
440 | return d->fileMode; | - | ||||||
441 | } | - | ||||||
442 | - | |||||||
443 | void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode) | - | ||||||
444 | { | - | ||||||
445 | d->acceptMode = mode; | - | ||||||
446 | } | - | ||||||
447 | - | |||||||
448 | QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const | - | ||||||
449 | { | - | ||||||
450 | return d->acceptMode; | - | ||||||
451 | } | - | ||||||
452 | - | |||||||
453 | void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls) | - | ||||||
454 | { | - | ||||||
455 | d->sidebarUrls = urls; | - | ||||||
456 | } | - | ||||||
457 | - | |||||||
458 | QList<QUrl> QFileDialogOptions::sidebarUrls() const | - | ||||||
459 | { | - | ||||||
460 | return d->sidebarUrls; | - | ||||||
461 | } | - | ||||||
462 | bool QFileDialogOptions::useDefaultNameFilters() const | - | ||||||
463 | { | - | ||||||
464 | return never executed: d->useDefaultNameFilters;return d->useDefaultNameFilters; never executed: return d->useDefaultNameFilters; | 0 | ||||||
465 | } | - | ||||||
466 | - | |||||||
467 | void QFileDialogOptions::setUseDefaultNameFilters(bool dnf) | - | ||||||
468 | { | - | ||||||
469 | d->useDefaultNameFilters = dnf; | - | ||||||
470 | } never executed: end of block | 0 | ||||||
471 | - | |||||||
472 | void QFileDialogOptions::setNameFilters(const QStringList &filters) | - | ||||||
473 | { | - | ||||||
474 | d->useDefaultNameFilters = filters.size() == 1
| 0 | ||||||
475 | && filters.first() == QFileDialogOptions::defaultNameFilterString()
| 0 | ||||||
476 | d->nameFilters = filters; | - | ||||||
477 | } never executed: end of block | 0 | ||||||
478 | - | |||||||
479 | QStringList QFileDialogOptions::nameFilters() const | - | ||||||
480 | { | - | ||||||
481 | return never executed: d->useDefaultNameFilters ?return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; never executed: return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; | 0 | ||||||
482 | QStringList(QFileDialogOptions::defaultNameFilterString()) : never executed: return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; never executed: d->nameFilters;return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; never executed: return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; | 0 | ||||||
483 | } | - | ||||||
484 | QString QFileDialogOptions::defaultNameFilterString() | - | ||||||
485 | { | - | ||||||
486 | return never executed: QCoreApplication::translate("QFileDialog", "All Files (*)");return QCoreApplication::translate("QFileDialog", "All Files (*)"); never executed: return QCoreApplication::translate("QFileDialog", "All Files (*)"); | 0 | ||||||
487 | } | - | ||||||
488 | - | |||||||
489 | void QFileDialogOptions::setMimeTypeFilters(const QStringList &filters) | - | ||||||
490 | { | - | ||||||
491 | d->mimeTypeFilters = filters; | - | ||||||
492 | } | - | ||||||
493 | - | |||||||
494 | QStringList QFileDialogOptions::mimeTypeFilters() const | - | ||||||
495 | { | - | ||||||
496 | return d->mimeTypeFilters; | - | ||||||
497 | } | - | ||||||
498 | - | |||||||
499 | void QFileDialogOptions::setDefaultSuffix(const QString &suffix) | - | ||||||
500 | { | - | ||||||
501 | d->defaultSuffix = suffix; | - | ||||||
502 | if (d->defaultSuffix.size() > 1 && d->defaultSuffix.startsWith(QLatin1Char('.'))) | - | ||||||
503 | d->defaultSuffix.remove(0, 1); | - | ||||||
504 | } | - | ||||||
505 | - | |||||||
506 | QString QFileDialogOptions::defaultSuffix() const | - | ||||||
507 | { | - | ||||||
508 | return d->defaultSuffix; | - | ||||||
509 | } | - | ||||||
510 | - | |||||||
511 | void QFileDialogOptions::setHistory(const QStringList &paths) | - | ||||||
512 | { | - | ||||||
513 | d->history = paths; | - | ||||||
514 | } | - | ||||||
515 | - | |||||||
516 | QStringList QFileDialogOptions::history() const | - | ||||||
517 | { | - | ||||||
518 | return d->history; | - | ||||||
519 | } | - | ||||||
520 | - | |||||||
521 | void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text) | - | ||||||
522 | { | - | ||||||
523 | if (label >= 0 && label < DialogLabelCount) | - | ||||||
524 | d->labels[label] = text; | - | ||||||
525 | } | - | ||||||
526 | - | |||||||
527 | QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const | - | ||||||
528 | { | - | ||||||
529 | return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString(); | - | ||||||
530 | } | - | ||||||
531 | - | |||||||
532 | bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label) | - | ||||||
533 | { | - | ||||||
534 | return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty(); | - | ||||||
535 | } | - | ||||||
536 | - | |||||||
537 | QUrl QFileDialogOptions::initialDirectory() const | - | ||||||
538 | { | - | ||||||
539 | return d->initialDirectory; | - | ||||||
540 | } | - | ||||||
541 | - | |||||||
542 | void QFileDialogOptions::setInitialDirectory(const QUrl &directory) | - | ||||||
543 | { | - | ||||||
544 | d->initialDirectory = directory; | - | ||||||
545 | } | - | ||||||
546 | - | |||||||
547 | QString QFileDialogOptions::initiallySelectedNameFilter() const | - | ||||||
548 | { | - | ||||||
549 | return d->initiallySelectedNameFilter; | - | ||||||
550 | } | - | ||||||
551 | - | |||||||
552 | void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter) | - | ||||||
553 | { | - | ||||||
554 | d->initiallySelectedNameFilter = filter; | - | ||||||
555 | } | - | ||||||
556 | - | |||||||
557 | QList<QUrl> QFileDialogOptions::initiallySelectedFiles() const | - | ||||||
558 | { | - | ||||||
559 | return d->initiallySelectedFiles; | - | ||||||
560 | } | - | ||||||
561 | - | |||||||
562 | void QFileDialogOptions::setInitiallySelectedFiles(const QList<QUrl> &files) | - | ||||||
563 | { | - | ||||||
564 | d->initiallySelectedFiles = files; | - | ||||||
565 | } | - | ||||||
566 | - | |||||||
567 | - | |||||||
568 | void QFileDialogOptions::setSupportedSchemes(const QStringList &schemes) | - | ||||||
569 | { | - | ||||||
570 | d->supportedSchemes = schemes; | - | ||||||
571 | } | - | ||||||
572 | - | |||||||
573 | QStringList QFileDialogOptions::supportedSchemes() const | - | ||||||
574 | { | - | ||||||
575 | return d->supportedSchemes; | - | ||||||
576 | } | - | ||||||
577 | - | |||||||
578 | - | |||||||
579 | bool QPlatformFileDialogHelper::isSupportedUrl(const QUrl &url) const | - | ||||||
580 | { | - | ||||||
581 | return url.isLocalFile(); | - | ||||||
582 | } | - | ||||||
583 | const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const | - | ||||||
584 | { | - | ||||||
585 | return m_options; | - | ||||||
586 | } | - | ||||||
587 | - | |||||||
588 | void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options) | - | ||||||
589 | { | - | ||||||
590 | m_options = options; | - | ||||||
591 | } | - | ||||||
592 | - | |||||||
593 | const char *QPlatformFileDialogHelper::filterRegExp = | - | ||||||
594 | "^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"; | - | ||||||
595 | - | |||||||
596 | - | |||||||
597 | QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) | - | ||||||
598 | { | - | ||||||
599 | QRegExp regexp(QString::fromLatin1(filterRegExp)); | - | ||||||
600 | ((!(regexp.isValid())) ? qt_assert("regexp.isValid()",__FILE__,662705) : qt_noop()); | - | ||||||
601 | QString f = filter; | - | ||||||
602 | int i = regexp.indexIn(f); | - | ||||||
603 | if (i >= 0) | - | ||||||
604 | f = regexp.cap(2); | - | ||||||
605 | return f.split(QLatin1Char(' '), QString::SkipEmptyParts); | - | ||||||
606 | } | - | ||||||
607 | - | |||||||
608 | - | |||||||
609 | - | |||||||
610 | class QMessageDialogOptionsPrivate : public QSharedData | - | ||||||
611 | { | - | ||||||
612 | public: | - | ||||||
613 | QMessageDialogOptionsPrivate() : | - | ||||||
614 | icon(QMessageDialogOptions::NoIcon), | - | ||||||
615 | buttons(QPlatformDialogHelper::Ok) | - | ||||||
616 | {} | - | ||||||
617 | - | |||||||
618 | QString windowTitle; | - | ||||||
619 | QMessageDialogOptions::Icon icon; | - | ||||||
620 | QString text; | - | ||||||
621 | QString informativeText; | - | ||||||
622 | QString detailedText; | - | ||||||
623 | QPlatformDialogHelper::StandardButtons buttons; | - | ||||||
624 | }; | - | ||||||
625 | - | |||||||
626 | QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate) | - | ||||||
627 | { | - | ||||||
628 | } | - | ||||||
629 | - | |||||||
630 | QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d) | - | ||||||
631 | { | - | ||||||
632 | } | - | ||||||
633 | - | |||||||
634 | QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs) | - | ||||||
635 | { | - | ||||||
636 | if (this != &rhs) | - | ||||||
637 | d = rhs.d; | - | ||||||
638 | return *this; | - | ||||||
639 | } | - | ||||||
640 | - | |||||||
641 | QMessageDialogOptions::~QMessageDialogOptions() | - | ||||||
642 | { | - | ||||||
643 | } | - | ||||||
644 | - | |||||||
645 | QString QMessageDialogOptions::windowTitle() const | - | ||||||
646 | { | - | ||||||
647 | return d->windowTitle; | - | ||||||
648 | } | - | ||||||
649 | - | |||||||
650 | void QMessageDialogOptions::setWindowTitle(const QString &title) | - | ||||||
651 | { | - | ||||||
652 | d->windowTitle = title; | - | ||||||
653 | } | - | ||||||
654 | - | |||||||
655 | QMessageDialogOptions::Icon QMessageDialogOptions::icon() const | - | ||||||
656 | { | - | ||||||
657 | return d->icon; | - | ||||||
658 | } | - | ||||||
659 | - | |||||||
660 | void QMessageDialogOptions::setIcon(Icon icon) | - | ||||||
661 | { | - | ||||||
662 | d->icon = icon; | - | ||||||
663 | } | - | ||||||
664 | - | |||||||
665 | QString QMessageDialogOptions::text() const | - | ||||||
666 | { | - | ||||||
667 | return d->text; | - | ||||||
668 | } | - | ||||||
669 | - | |||||||
670 | void QMessageDialogOptions::setText(const QString &text) | - | ||||||
671 | { | - | ||||||
672 | d->text = text; | - | ||||||
673 | } | - | ||||||
674 | - | |||||||
675 | QString QMessageDialogOptions::informativeText() const | - | ||||||
676 | { | - | ||||||
677 | return d->informativeText; | - | ||||||
678 | } | - | ||||||
679 | - | |||||||
680 | void QMessageDialogOptions::setInformativeText(const QString &informativeText) | - | ||||||
681 | { | - | ||||||
682 | d->informativeText = informativeText; | - | ||||||
683 | } | - | ||||||
684 | - | |||||||
685 | QString QMessageDialogOptions::detailedText() const | - | ||||||
686 | { | - | ||||||
687 | return d->detailedText; | - | ||||||
688 | } | - | ||||||
689 | - | |||||||
690 | void QMessageDialogOptions::setDetailedText(const QString &detailedText) | - | ||||||
691 | { | - | ||||||
692 | d->detailedText = detailedText; | - | ||||||
693 | } | - | ||||||
694 | - | |||||||
695 | void QMessageDialogOptions::setStandardButtons(QPlatformDialogHelper::StandardButtons buttons) | - | ||||||
696 | { | - | ||||||
697 | d->buttons = buttons; | - | ||||||
698 | } | - | ||||||
699 | - | |||||||
700 | QPlatformDialogHelper::StandardButtons QMessageDialogOptions::standardButtons() const | - | ||||||
701 | { | - | ||||||
702 | return d->buttons; | - | ||||||
703 | } | - | ||||||
704 | - | |||||||
705 | QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDialogHelper::StandardButton button) | - | ||||||
706 | { | - | ||||||
707 | switch (button) { | - | ||||||
708 | case Ok: | - | ||||||
709 | case Save: | - | ||||||
710 | case Open: | - | ||||||
711 | case SaveAll: | - | ||||||
712 | case Retry: | - | ||||||
713 | case Ignore: | - | ||||||
714 | return AcceptRole; | - | ||||||
715 | - | |||||||
716 | case Cancel: | - | ||||||
717 | case Close: | - | ||||||
718 | case Abort: | - | ||||||
719 | return RejectRole; | - | ||||||
720 | - | |||||||
721 | case Discard: | - | ||||||
722 | return DestructiveRole; | - | ||||||
723 | - | |||||||
724 | case Help: | - | ||||||
725 | return HelpRole; | - | ||||||
726 | - | |||||||
727 | case Apply: | - | ||||||
728 | return ApplyRole; | - | ||||||
729 | - | |||||||
730 | case Yes: | - | ||||||
731 | case YesToAll: | - | ||||||
732 | return YesRole; | - | ||||||
733 | - | |||||||
734 | case No: | - | ||||||
735 | case NoToAll: | - | ||||||
736 | return NoRole; | - | ||||||
737 | - | |||||||
738 | case RestoreDefaults: | - | ||||||
739 | case Reset: | - | ||||||
740 | return ResetRole; | - | ||||||
741 | - | |||||||
742 | default: | - | ||||||
743 | break; | - | ||||||
744 | } | - | ||||||
745 | return InvalidRole; | - | ||||||
746 | } | - | ||||||
747 | - | |||||||
748 | const int *QPlatformDialogHelper::buttonLayout(Qt::Orientation orientation, ButtonLayout policy) | - | ||||||
749 | { | - | ||||||
750 | if (policy == UnknownLayout) { | - | ||||||
751 | - | |||||||
752 | - | |||||||
753 | - | |||||||
754 | policy = KdeLayout; | - | ||||||
755 | - | |||||||
756 | - | |||||||
757 | - | |||||||
758 | } | - | ||||||
759 | return buttonRoleLayouts[orientation == Qt::Vertical][policy]; | - | ||||||
760 | } | - | ||||||
761 | const QSharedPointer<QMessageDialogOptions> &QPlatformMessageDialogHelper::options() const | - | ||||||
762 | { | - | ||||||
763 | return m_options; | - | ||||||
764 | } | - | ||||||
765 | - | |||||||
766 | void QPlatformMessageDialogHelper::setOptions(const QSharedPointer<QMessageDialogOptions> &options) | - | ||||||
767 | { | - | ||||||
768 | m_options = options; | - | ||||||
769 | } | - | ||||||
770 | - | |||||||
771 | - | |||||||
Switch to Source code | Preprocessed file |