qplatformdialoghelper.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformdialoghelper.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qplatformdialoghelper.h"-
35-
36#include <QtCore/QVariant>-
37#include <QtCore/QSharedData>-
38#include <QtCore/QSettings>-
39#include <QtCore/QUrl>-
40#include <QtGui/QColor>-
41-
42#include <algorithm>-
43-
44QT_BEGIN_NAMESPACE-
45-
46/*!-
47 \class QPlatformDialogHelper-
48 \since 5.0-
49 \internal-
50 \ingroup qpa-
51-
52 \brief The QPlatformDialogHelper class allows for platform-specific customization of dialogs.-
53-
54*/-
55-
56static const int buttonRoleLayouts[2][5][14] =-
57{-
58 // Qt::Horizontal-
59 {-
60 // WinLayout-
61 { QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::YesRole, QPlatformDialogHelper::AcceptRole,-
62 QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::NoRole,-
63 QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::ApplyRole,-
64 QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },-
65-
66 // MacLayout-
67 { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole,-
68 QPlatformDialogHelper::Stretch, QPlatformDialogHelper::DestructiveRole | QPlatformDialogHelper::Reverse,-
69 QPlatformDialogHelper::AlternateRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::RejectRole | QPlatformDialogHelper::Reverse,-
70 QPlatformDialogHelper::AcceptRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::NoRole | QPlatformDialogHelper::Reverse,-
71 QPlatformDialogHelper::YesRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },-
72-
73 // KdeLayout-
74 { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::YesRole,-
75 QPlatformDialogHelper::NoRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole,-
76 QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::EOL },-
77-
78 // GnomeLayout-
79 { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ActionRole,-
80 QPlatformDialogHelper::ApplyRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::DestructiveRole | QPlatformDialogHelper::Reverse,-
81 QPlatformDialogHelper::AlternateRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::RejectRole | QPlatformDialogHelper::Reverse,-
82 QPlatformDialogHelper::AcceptRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::NoRole | QPlatformDialogHelper::Reverse,-
83 QPlatformDialogHelper::YesRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::EOL },-
84-
85 // MacModelessLayout-
86 { QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch,-
87 QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL,-
88 QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }-
89 },-
90-
91 // Qt::Vertical-
92 {-
93 // WinLayout-
94 { QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::YesRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole,-
95 QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ResetRole,-
96 QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },-
97-
98 // MacLayout-
99 { QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::RejectRole,-
100 QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::ApplyRole,-
101 QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },-
102-
103 // KdeLayout-
104 { QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole,-
105 QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ResetRole,-
106 QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL },-
107-
108 // GnomeLayout-
109 { QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::RejectRole,-
110 QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch,-
111 QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL },-
112-
113 // MacModelessLayout-
114 { QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch,-
115 QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL,-
116 QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }-
117 }-
118};-
119-
120QPlatformDialogHelper::QPlatformDialogHelper()-
121{-
122 qRegisterMetaType<StandardButton>();-
123 qRegisterMetaType<ButtonRole>();-
124}
never executed: end of block
0
125-
126QPlatformDialogHelper::~QPlatformDialogHelper()-
127{-
128}-
129-
130QVariant QPlatformDialogHelper::styleHint(StyleHint hint) const-
131{-
132 return QPlatformDialogHelper::defaultStyleHint(hint);
never executed: return QPlatformDialogHelper::defaultStyleHint(hint);
0
133}-
134-
135QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHint hint)-
136{-
137 Q_UNUSED(hint);-
138 return QVariant();
never executed: return QVariant();
0
139}-
140-
141// Font dialog-
142-
143class QFontDialogOptionsPrivate : public QSharedData-
144{-
145public:-
146 QFontDialogOptionsPrivate() : options(0) {}
never executed: end of block
0
147-
148 QFontDialogOptions::FontDialogOptions options;-
149 QString windowTitle;-
150};-
151-
152QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate)-
153{-
154}
never executed: end of block
0
155-
156QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d)-
157{-
158}
never executed: end of block
0
159-
160QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs)-
161{-
162 if (this != &rhs)
this != &rhsDescription
TRUEnever evaluated
FALSEnever evaluated
0
163 d = rhs.d;
never executed: d = rhs.d;
0
164 return *this;
never executed: return *this;
0
165}-
166-
167QFontDialogOptions::~QFontDialogOptions()-
168{-
169}-
170-
171QString QFontDialogOptions::windowTitle() const-
172{-
173 return d->windowTitle;
never executed: return d->windowTitle;
0
174}-
175-
176void QFontDialogOptions::setWindowTitle(const QString &title)-
177{-
178 d->windowTitle = title;-
179}
never executed: end of block
0
180-
181void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on)-
182{-
183 if (!(d->options & option) != !on)
!(d->options & option) != !onDescription
TRUEnever evaluated
FALSEnever evaluated
0
184 setOptions(d->options ^ option);
never executed: setOptions(d->options ^ option);
0
185}
never executed: end of block
0
186-
187bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const-
188{-
189 return d->options & option;
never executed: return d->options & option;
0
190}-
191-
192void QFontDialogOptions::setOptions(FontDialogOptions options)-
193{-
194 if (options != d->options)
options != d->optionsDescription
TRUEnever evaluated
FALSEnever evaluated
0
195 d->options = options;
never executed: d->options = options;
0
196}
never executed: end of block
0
197-
198QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const-
199{-
200 return d->options;
never executed: return d->options;
0
201}-
202-
203/*!-
204 \class QPlatformFontDialogHelper-
205 \since 5.0-
206 \internal-
207 \ingroup qpa-
208-
209 \brief The QPlatformFontDialogHelper class allows for platform-specific customization of font dialogs.-
210-
211*/-
212const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const-
213{-
214 return m_options;
never executed: return m_options;
0
215}-
216-
217void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options)-
218{-
219 m_options = options;-
220}
never executed: end of block
0
221-
222// Color dialog-
223-
224class QColorDialogStaticData-
225{-
226public:-
227 enum { CustomColorCount = 16, StandardColorCount = 6 * 8 };-
228-
229 QColorDialogStaticData();-
230 inline void readSettings();-
231 inline void writeSettings() const;-
232-
233 QRgb customRgb[CustomColorCount];-
234 QRgb standardRgb[StandardColorCount];-
235 bool customSet;-
236};-
237-
238QColorDialogStaticData::QColorDialogStaticData() : customSet(false)-
239{-
240 int i = 0;-
241 for (int g = 0; g < 4; ++g)
g < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
242 for (int r = 0; r < 4; ++r)
r < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
243 for (int b = 0; b < 3; ++b)
b < 3Description
TRUEnever evaluated
FALSEnever evaluated
0
244 standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2);
never executed: standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2);
0
245 std::fill(customRgb, customRgb + CustomColorCount, 0xffffffff);-
246 readSettings();-
247}
never executed: end of block
0
248-
249void QColorDialogStaticData::readSettings()-
250{-
251#ifndef QT_NO_SETTINGS-
252 const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
never executed: return qstring_literal_temp;
0
253 for (int i = 0; i < int(CustomColorCount); ++i) {
i < int(CustomColorCount)Description
TRUEnever evaluated
FALSEnever evaluated
0
254 const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i));
never executed: return qstring_literal_temp;
0
255 if (v.isValid())
v.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
256 customRgb[i] = v.toUInt();
never executed: customRgb[i] = v.toUInt();
0
257 }
never executed: end of block
0
258#endif-
259}
never executed: end of block
0
260-
261void QColorDialogStaticData::writeSettings() const-
262{-
263#ifndef QT_NO_SETTINGS-
264 if (!customSet) {
!customSetDescription
TRUEnever evaluated
FALSEnever evaluated
0
265 QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
never executed: return qstring_literal_temp;
0
266 for (int i = 0; i < int(CustomColorCount); ++i)
i < int(CustomColorCount)Description
TRUEnever evaluated
FALSEnever evaluated
0
267 settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]);
never executed: settings.setValue(([]() -> QString { enum { Size = sizeof(u"" "Qt/customColors/")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(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: return qstring_literal_temp;
0
268 }
never executed: end of block
0
269#endif-
270}
never executed: end of block
0
271-
272Q_GLOBAL_STATIC(QColorDialogStaticData, qColorDialogStaticData)
never executed: end of block
never executed: guard.store(QtGlobalStatic::Destroyed);
never executed: return &holder.value;
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
0
273-
274class QColorDialogOptionsPrivate : public QSharedData-
275{-
276public:-
277 QColorDialogOptionsPrivate() : options(0) {}
never executed: end of block
0
278 // Write out settings around destruction of dialogs-
279 ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); }
never executed: end of block
0
280-
281 QColorDialogOptions::ColorDialogOptions options;-
282 QString windowTitle;-
283};-
284-
285QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate)-
286{-
287}
never executed: end of block
0
288-
289QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d)-
290{-
291}
never executed: end of block
0
292-
293QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs)-
294{-
295 if (this != &rhs)
this != &rhsDescription
TRUEnever evaluated
FALSEnever evaluated
0
296 d = rhs.d;
never executed: d = rhs.d;
0
297 return *this;
never executed: return *this;
0
298}-
299-
300QColorDialogOptions::~QColorDialogOptions()-
301{-
302}-
303-
304QString QColorDialogOptions::windowTitle() const-
305{-
306 return d->windowTitle;
never executed: return d->windowTitle;
0
307}-
308-
309void QColorDialogOptions::setWindowTitle(const QString &title)-
310{-
311 d->windowTitle = title;-
312}
never executed: end of block
0
313-
314void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on)-
315{-
316 if (!(d->options & option) != !on)
!(d->options & option) != !onDescription
TRUEnever evaluated
FALSEnever evaluated
0
317 setOptions(d->options ^ option);
never executed: setOptions(d->options ^ option);
0
318}
never executed: end of block
0
319-
320bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const-
321{-
322 return d->options & option;
never executed: return d->options & option;
0
323}-
324-
325void QColorDialogOptions::setOptions(ColorDialogOptions options)-
326{-
327 if (options != d->options)
options != d->optionsDescription
TRUEnever evaluated
FALSEnever evaluated
0
328 d->options = options;
never executed: d->options = options;
0
329}
never executed: end of block
0
330-
331QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const-
332{-
333 return d->options;
never executed: return d->options;
0
334}-
335-
336int QColorDialogOptions::customColorCount()-
337{-
338 return QColorDialogStaticData::CustomColorCount;
never executed: return QColorDialogStaticData::CustomColorCount;
0
339}-
340-
341QRgb QColorDialogOptions::customColor(int index)-
342{-
343 if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
uint(index) >=...tomColorCount)Description
TRUEnever evaluated
FALSEnever evaluated
0
344 return qRgb(255, 255, 255);
never executed: return qRgb(255, 255, 255);
0
345 return qColorDialogStaticData()->customRgb[index];
never executed: return qColorDialogStaticData()->customRgb[index];
0
346}-
347-
348QRgb *QColorDialogOptions::customColors()-
349{-
350 return qColorDialogStaticData()->customRgb;
never executed: return qColorDialogStaticData()->customRgb;
0
351}-
352-
353void QColorDialogOptions::setCustomColor(int index, QRgb color)-
354{-
355 if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
uint(index) >=...tomColorCount)Description
TRUEnever evaluated
FALSEnever evaluated
0
356 return;
never executed: return;
0
357 qColorDialogStaticData()->customSet = true;-
358 qColorDialogStaticData()->customRgb[index] = color;-
359}
never executed: end of block
0
360-
361QRgb *QColorDialogOptions::standardColors()-
362{-
363 return qColorDialogStaticData()->standardRgb;
never executed: return qColorDialogStaticData()->standardRgb;
0
364}-
365-
366QRgb QColorDialogOptions::standardColor(int index)-
367{-
368 if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
uint(index) >=...ardColorCount)Description
TRUEnever evaluated
FALSEnever evaluated
0
369 return qRgb(255, 255, 255);
never executed: return qRgb(255, 255, 255);
0
370 return qColorDialogStaticData()->standardRgb[index];
never executed: return qColorDialogStaticData()->standardRgb[index];
0
371}-
372-
373void QColorDialogOptions::setStandardColor(int index, QRgb color)-
374{-
375 if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
uint(index) >=...ardColorCount)Description
TRUEnever evaluated
FALSEnever evaluated
0
376 return;
never executed: return;
0
377 qColorDialogStaticData()->standardRgb[index] = color;-
378}
never executed: end of block
0
379-
380/*!-
381 \class QPlatformColorDialogHelper-
382 \since 5.0-
383 \internal-
384 \ingroup qpa-
385-
386 \brief The QPlatformColorDialogHelper class allows for platform-specific customization of color dialogs.-
387-
388*/-
389const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const-
390{-
391 return m_options;
never executed: return m_options;
0
392}-
393-
394void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options)-
395{-
396 m_options = options;-
397}
never executed: end of block
0
398-
399// File dialog-
400-
401class QFileDialogOptionsPrivate : public QSharedData-
402{-
403public:-
404 QFileDialogOptionsPrivate() : options(0),-
405 viewMode(QFileDialogOptions::Detail),-
406 fileMode(QFileDialogOptions::AnyFile),-
407 acceptMode(QFileDialogOptions::AcceptOpen),-
408 filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs)-
409 {}
never executed: end of block
0
410-
411 QFileDialogOptions::FileDialogOptions options;-
412 QString windowTitle;-
413-
414 QFileDialogOptions::ViewMode viewMode;-
415 QFileDialogOptions::FileMode fileMode;-
416 QFileDialogOptions::AcceptMode acceptMode;-
417 QString labels[QFileDialogOptions::DialogLabelCount];-
418 QDir::Filters filters;-
419 QList<QUrl> sidebarUrls;-
420 QStringList nameFilters;-
421 QStringList mimeTypeFilters;-
422 QString defaultSuffix;-
423 QStringList history;-
424 QUrl initialDirectory;-
425 QString initiallySelectedNameFilter;-
426 QList<QUrl> initiallySelectedFiles;-
427 QStringList supportedSchemes;-
428};-
429-
430QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate)-
431{-
432}
never executed: end of block
0
433-
434QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d)-
435{-
436}
never executed: end of block
0
437-
438QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs)-
439{-
440 if (this != &rhs)
this != &rhsDescription
TRUEnever evaluated
FALSEnever evaluated
0
441 d = rhs.d;
never executed: d = rhs.d;
0
442 return *this;
never executed: return *this;
0
443}-
444-
445QFileDialogOptions::~QFileDialogOptions()-
446{-
447}-
448-
449QString QFileDialogOptions::windowTitle() const-
450{-
451 return d->windowTitle;
never executed: return d->windowTitle;
0
452}-
453-
454void QFileDialogOptions::setWindowTitle(const QString &title)-
455{-
456 d->windowTitle = title;-
457}
never executed: end of block
0
458-
459void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on)-
460{-
461 if (!(d->options & option) != !on)
!(d->options & option) != !onDescription
TRUEnever evaluated
FALSEnever evaluated
0
462 setOptions(d->options ^ option);
never executed: setOptions(d->options ^ option);
0
463}
never executed: end of block
0
464-
465bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const-
466{-
467 return d->options & option;
never executed: return d->options & option;
0
468}-
469-
470void QFileDialogOptions::setOptions(FileDialogOptions options)-
471{-
472 if (options != d->options)
options != d->optionsDescription
TRUEnever evaluated
FALSEnever evaluated
0
473 d->options = options;
never executed: d->options = options;
0
474}
never executed: end of block
0
475-
476QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const-
477{-
478 return d->options;
never executed: return d->options;
0
479}-
480-
481QDir::Filters QFileDialogOptions::filter() const-
482{-
483 return d->filters;
never executed: return d->filters;
0
484}-
485-
486void QFileDialogOptions::setFilter(QDir::Filters filters)-
487{-
488 d->filters = filters;-
489}
never executed: end of block
0
490-
491void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode)-
492{-
493 d->viewMode = mode;-
494}
never executed: end of block
0
495-
496QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const-
497{-
498 return d->viewMode;
never executed: return d->viewMode;
0
499}-
500-
501void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode)-
502{-
503 d->fileMode = mode;-
504}
never executed: end of block
0
505-
506QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const-
507{-
508 return d->fileMode;
never executed: return d->fileMode;
0
509}-
510-
511void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode)-
512{-
513 d->acceptMode = mode;-
514}
never executed: end of block
0
515-
516QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const-
517{-
518 return d->acceptMode;
never executed: return d->acceptMode;
0
519}-
520-
521void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls)-
522{-
523 d->sidebarUrls = urls;-
524}
never executed: end of block
0
525-
526QList<QUrl> QFileDialogOptions::sidebarUrls() const-
527{-
528 return d->sidebarUrls;
never executed: return d->sidebarUrls;
0
529}-
530-
531void QFileDialogOptions::setNameFilters(const QStringList &filters)-
532{-
533 d->nameFilters = filters;-
534}
never executed: end of block
0
535-
536QStringList QFileDialogOptions::nameFilters() const-
537{-
538 return d->nameFilters;
never executed: return d->nameFilters;
0
539}-
540-
541void QFileDialogOptions::setMimeTypeFilters(const QStringList &filters)-
542{-
543 d->mimeTypeFilters = filters;-
544}
never executed: end of block
0
545-
546QStringList QFileDialogOptions::mimeTypeFilters() const-
547{-
548 return d->mimeTypeFilters;
never executed: return d->mimeTypeFilters;
0
549}-
550-
551void QFileDialogOptions::setDefaultSuffix(const QString &suffix)-
552{-
553 d->defaultSuffix = suffix;-
554 if (d->defaultSuffix.size() > 1 && d->defaultSuffix.startsWith(QLatin1Char('.')))
d->defaultSuffix.size() > 1Description
TRUEnever evaluated
FALSEnever evaluated
d->defaultSuff...tin1Char('.'))Description
TRUEnever evaluated
FALSEnever evaluated
0
555 d->defaultSuffix.remove(0, 1); // Silently change ".txt" -> "txt".
never executed: d->defaultSuffix.remove(0, 1);
0
556}
never executed: end of block
0
557-
558QString QFileDialogOptions::defaultSuffix() const-
559{-
560 return d->defaultSuffix;
never executed: return d->defaultSuffix;
0
561}-
562-
563void QFileDialogOptions::setHistory(const QStringList &paths)-
564{-
565 d->history = paths;-
566}
never executed: end of block
0
567-
568QStringList QFileDialogOptions::history() const-
569{-
570 return d->history;
never executed: return d->history;
0
571}-
572-
573void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text)-
574{-
575 if (label >= 0 && label < DialogLabelCount)
label >= 0Description
TRUEnever evaluated
FALSEnever evaluated
label < DialogLabelCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
576 d->labels[label] = text;
never executed: d->labels[label] = text;
0
577}
never executed: end of block
0
578-
579QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const-
580{-
581 return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
never executed: return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
label >= 0Description
TRUEnever evaluated
FALSEnever evaluated
label < DialogLabelCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
582}-
583-
584bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label)-
585{-
586 return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
never executed: return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
label >= 0Description
TRUEnever evaluated
FALSEnever evaluated
label < DialogLabelCountDescription
TRUEnever evaluated
FALSEnever evaluated
!d->labels[label].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
587}-
588-
589QUrl QFileDialogOptions::initialDirectory() const-
590{-
591 return d->initialDirectory;
never executed: return d->initialDirectory;
0
592}-
593-
594void QFileDialogOptions::setInitialDirectory(const QUrl &directory)-
595{-
596 d->initialDirectory = directory;-
597}
never executed: end of block
0
598-
599QString QFileDialogOptions::initiallySelectedNameFilter() const-
600{-
601 return d->initiallySelectedNameFilter;
never executed: return d->initiallySelectedNameFilter;
0
602}-
603-
604void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter)-
605{-
606 d->initiallySelectedNameFilter = filter;-
607}
never executed: end of block
0
608-
609QList<QUrl> QFileDialogOptions::initiallySelectedFiles() const-
610{-
611 return d->initiallySelectedFiles;
never executed: return d->initiallySelectedFiles;
0
612}-
613-
614void QFileDialogOptions::setInitiallySelectedFiles(const QList<QUrl> &files)-
615{-
616 d->initiallySelectedFiles = files;-
617}
never executed: end of block
0
618-
619// Schemes supported by the application-
620void QFileDialogOptions::setSupportedSchemes(const QStringList &schemes)-
621{-
622 d->supportedSchemes = schemes;-
623}
never executed: end of block
0
624-
625QStringList QFileDialogOptions::supportedSchemes() const-
626{-
627 return d->supportedSchemes;
never executed: return d->supportedSchemes;
0
628}-
629-
630// Return true if the URL is supported by the filedialog implementation *and* by the application.-
631bool QPlatformFileDialogHelper::isSupportedUrl(const QUrl &url) const-
632{-
633 return url.isLocalFile();
never executed: return url.isLocalFile();
0
634}-
635-
636/*!-
637 \class QPlatformFileDialogHelper-
638 \since 5.0-
639 \internal-
640 \ingroup qpa-
641-
642 \brief The QPlatformFileDialogHelper class allows for platform-specific customization of file dialogs.-
643-
644*/-
645const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const-
646{-
647 return m_options;
never executed: return m_options;
0
648}-
649-
650void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options)-
651{-
652 m_options = options;-
653}
never executed: end of block
0
654-
655const char *QPlatformFileDialogHelper::filterRegExp =-
656"^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";-
657-
658// Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)"-
659QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter)-
660{-
661 QRegExp regexp(QString::fromLatin1(filterRegExp));-
662 Q_ASSERT(regexp.isValid());-
663 QString f = filter;-
664 int i = regexp.indexIn(f);-
665 if (i >= 0)
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
666 f = regexp.cap(2);
never executed: f = regexp.cap(2);
0
667 return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
never executed: return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
0
668}-
669-
670// Message dialog-
671-
672class QMessageDialogOptionsPrivate : public QSharedData-
673{-
674public:-
675 QMessageDialogOptionsPrivate() :-
676 icon(QMessageDialogOptions::NoIcon),-
677 buttons(QPlatformDialogHelper::Ok)-
678 {}
never executed: end of block
0
679-
680 QString windowTitle;-
681 QMessageDialogOptions::Icon icon;-
682 QString text;-
683 QString informativeText;-
684 QString detailedText;-
685 QPlatformDialogHelper::StandardButtons buttons;-
686};-
687-
688QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate)-
689{-
690}
never executed: end of block
0
691-
692QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d)-
693{-
694}
never executed: end of block
0
695-
696QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs)-
697{-
698 if (this != &rhs)
this != &rhsDescription
TRUEnever evaluated
FALSEnever evaluated
0
699 d = rhs.d;
never executed: d = rhs.d;
0
700 return *this;
never executed: return *this;
0
701}-
702-
703QMessageDialogOptions::~QMessageDialogOptions()-
704{-
705}-
706-
707QString QMessageDialogOptions::windowTitle() const-
708{-
709 return d->windowTitle;
never executed: return d->windowTitle;
0
710}-
711-
712void QMessageDialogOptions::setWindowTitle(const QString &title)-
713{-
714 d->windowTitle = title;-
715}
never executed: end of block
0
716-
717QMessageDialogOptions::Icon QMessageDialogOptions::icon() const-
718{-
719 return d->icon;
never executed: return d->icon;
0
720}-
721-
722void QMessageDialogOptions::setIcon(Icon icon)-
723{-
724 d->icon = icon;-
725}
never executed: end of block
0
726-
727QString QMessageDialogOptions::text() const-
728{-
729 return d->text;
never executed: return d->text;
0
730}-
731-
732void QMessageDialogOptions::setText(const QString &text)-
733{-
734 d->text = text;-
735}
never executed: end of block
0
736-
737QString QMessageDialogOptions::informativeText() const-
738{-
739 return d->informativeText;
never executed: return d->informativeText;
0
740}-
741-
742void QMessageDialogOptions::setInformativeText(const QString &informativeText)-
743{-
744 d->informativeText = informativeText;-
745}
never executed: end of block
0
746-
747QString QMessageDialogOptions::detailedText() const-
748{-
749 return d->detailedText;
never executed: return d->detailedText;
0
750}-
751-
752void QMessageDialogOptions::setDetailedText(const QString &detailedText)-
753{-
754 d->detailedText = detailedText;-
755}
never executed: end of block
0
756-
757void QMessageDialogOptions::setStandardButtons(QPlatformDialogHelper::StandardButtons buttons)-
758{-
759 d->buttons = buttons;-
760}
never executed: end of block
0
761-
762QPlatformDialogHelper::StandardButtons QMessageDialogOptions::standardButtons() const-
763{-
764 return d->buttons;
never executed: return d->buttons;
0
765}-
766-
767QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDialogHelper::StandardButton button)-
768{-
769 switch (button) {-
770 case Ok:
never executed: case Ok:
0
771 case Save:
never executed: case Save:
0
772 case Open:
never executed: case Open:
0
773 case SaveAll:
never executed: case SaveAll:
0
774 case Retry:
never executed: case Retry:
0
775 case Ignore:
never executed: case Ignore:
0
776 return AcceptRole;
never executed: return AcceptRole;
0
777-
778 case Cancel:
never executed: case Cancel:
0
779 case Close:
never executed: case Close:
0
780 case Abort:
never executed: case Abort:
0
781 return RejectRole;
never executed: return RejectRole;
0
782-
783 case Discard:
never executed: case Discard:
0
784 return DestructiveRole;
never executed: return DestructiveRole;
0
785-
786 case Help:
never executed: case Help:
0
787 return HelpRole;
never executed: return HelpRole;
0
788-
789 case Apply:
never executed: case Apply:
0
790 return ApplyRole;
never executed: return ApplyRole;
0
791-
792 case Yes:
never executed: case Yes:
0
793 case YesToAll:
never executed: case YesToAll:
0
794 return YesRole;
never executed: return YesRole;
0
795-
796 case No:
never executed: case No:
0
797 case NoToAll:
never executed: case NoToAll:
0
798 return NoRole;
never executed: return NoRole;
0
799-
800 case RestoreDefaults:
never executed: case RestoreDefaults:
0
801 case Reset:
never executed: case Reset:
0
802 return ResetRole;
never executed: return ResetRole;
0
803-
804 default:
never executed: default:
0
805 break;
never executed: break;
0
806 }-
807 return InvalidRole;
never executed: return InvalidRole;
0
808}-
809-
810const int *QPlatformDialogHelper::buttonLayout(Qt::Orientation orientation, ButtonLayout policy)-
811{-
812 if (policy == UnknownLayout) {
policy == UnknownLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
813#if defined (Q_OS_OSX)-
814 policy = MacLayout;-
815#elif defined (Q_OS_LINUX) || defined (Q_OS_UNIX)-
816 policy = KdeLayout;-
817#else-
818 policy = WinLayout;-
819#endif-
820 }
never executed: end of block
0
821 return buttonRoleLayouts[orientation == Qt::Vertical][policy];
never executed: return buttonRoleLayouts[orientation == Qt::Vertical][policy];
0
822}-
823-
824/*!-
825 \class QPlatformMessageDialogHelper-
826 \since 5.0-
827 \internal-
828 \ingroup qpa-
829-
830 \brief The QPlatformMessageDialogHelper class allows for platform-specific customization of Message dialogs.-
831-
832*/-
833const QSharedPointer<QMessageDialogOptions> &QPlatformMessageDialogHelper::options() const-
834{-
835 return m_options;
never executed: return m_options;
0
836}-
837-
838void QPlatformMessageDialogHelper::setOptions(const QSharedPointer<QMessageDialogOptions> &options)-
839{-
840 m_options = options;-
841}
never executed: end of block
0
842-
843QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9