Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
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 Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/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 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qplatformdialoghelper.h" | - |
43 | | - |
44 | #include <QtCore/QVariant> | - |
45 | #include <QtCore/QSharedData> | - |
46 | #include <QtCore/QSettings> | - |
47 | #include <QtCore/QHash> | - |
48 | #include <QtCore/QUrl> | - |
49 | #include <QtGui/QColor> | - |
50 | | - |
51 | QT_BEGIN_NAMESPACE | - |
52 | | - |
53 | /*! | - |
54 | \class QPlatformDialogHelper | - |
55 | \since 5.0 | - |
56 | \internal | - |
57 | \ingroup qpa | - |
58 | | - |
59 | \brief The QPlatformDialogHelper class allows for platform-specific customization of dialogs. | - |
60 | | - |
61 | */ | - |
62 | | - |
63 | /*! | - |
64 | \enum QPlatformDialogHelper::StyleHint | - |
65 | | - |
66 | This enum type specifies platform-specific style hints. | - |
67 | | - |
68 | \value SnapToDefaultButton Snap the mouse to the center of the default | - |
69 | button. There is corresponding system | - |
70 | setting on Windows. | - |
71 | | - |
72 | \sa styleHint() | - |
73 | */ | - |
74 | | - |
75 | QPlatformDialogHelper::QPlatformDialogHelper() | - |
76 | { | - |
77 | } | - |
78 | | - |
79 | QPlatformDialogHelper::~QPlatformDialogHelper() | - |
80 | { | - |
81 | } | - |
82 | | - |
83 | QVariant QPlatformDialogHelper::styleHint(StyleHint hint) const | - |
84 | { | - |
85 | return QPlatformDialogHelper::defaultStyleHint(hint); never executed: return QPlatformDialogHelper::defaultStyleHint(hint); | 0 |
86 | } | - |
87 | | - |
88 | QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHint hint) | - |
89 | { | - |
90 | switch (hint) { | - |
91 | case QPlatformDialogHelper::SnapToDefaultButton: | - |
92 | return QVariant(false); never executed: return QVariant(false); | 0 |
93 | } | - |
94 | return QVariant(); never executed: return QVariant(); | 0 |
95 | } | - |
96 | | - |
97 | // Font dialog | - |
98 | | - |
99 | class QFontDialogOptionsPrivate : public QSharedData | - |
100 | { | - |
101 | public: | - |
102 | QFontDialogOptionsPrivate() : options(0) {} executed: } Execution Count:3 | 3 |
103 | | - |
104 | QFontDialogOptions::FontDialogOptions options; | - |
105 | QString windowTitle; | - |
106 | }; | - |
107 | | - |
108 | QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate) | - |
109 | { | - |
110 | } executed: } Execution Count:3 | 3 |
111 | | - |
112 | QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d) | - |
113 | { | - |
114 | } | 0 |
115 | | - |
116 | QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs) | - |
117 | { | - |
118 | if (this != &rhs) never evaluated: this != &rhs | 0 |
119 | d = rhs.d; never executed: d = rhs.d; | 0 |
120 | return *this; never executed: return *this; | 0 |
121 | } | - |
122 | | - |
123 | QFontDialogOptions::~QFontDialogOptions() | - |
124 | { | - |
125 | } | - |
126 | | - |
127 | QString QFontDialogOptions::windowTitle() const | - |
128 | { | - |
129 | return d->windowTitle; never executed: return d->windowTitle; | 0 |
130 | } | - |
131 | | - |
132 | void QFontDialogOptions::setWindowTitle(const QString &title) | - |
133 | { | - |
134 | d->windowTitle = title; never executed (the execution status of this line is deduced): d->windowTitle = title; | - |
135 | } | 0 |
136 | | - |
137 | void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on) | - |
138 | { | - |
139 | if (!(d->options & option) != !on) never evaluated: !(d->options & option) != !on | 0 |
140 | setOptions(d->options ^ option); never executed: setOptions(d->options ^ option); | 0 |
141 | } | 0 |
142 | | - |
143 | bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const | - |
144 | { | - |
145 | return d->options & option; never executed: return d->options & option; | 0 |
146 | } | - |
147 | | - |
148 | void QFontDialogOptions::setOptions(FontDialogOptions options) | - |
149 | { | - |
150 | if (options != d->options) partially evaluated: options != d->options yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
151 | d->options = options; executed: d->options = options; Execution Count:1 | 1 |
152 | } executed: } Execution Count:1 | 1 |
153 | | - |
154 | QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const | - |
155 | { | - |
156 | return d->options; executed: return d->options; Execution Count:103 | 103 |
157 | } | - |
158 | | - |
159 | /*! | - |
160 | \class QPlatformFontDialogHelper | - |
161 | \since 5.0 | - |
162 | \internal | - |
163 | \ingroup qpa | - |
164 | | - |
165 | \brief The QPlatformFontDialogHelper class allows for platform-specific customization of font dialogs. | - |
166 | | - |
167 | */ | - |
168 | const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const | - |
169 | { | - |
170 | return m_options; never executed: return m_options; | 0 |
171 | } | - |
172 | | - |
173 | void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options) | - |
174 | { | - |
175 | m_options = options; never executed (the execution status of this line is deduced): m_options = options; | - |
176 | } | 0 |
177 | | - |
178 | // Color dialog | - |
179 | | - |
180 | class QColorDialogStaticData | - |
181 | { | - |
182 | public: | - |
183 | enum { CustomColorCount = 16, StandardColorCount = 6 * 8 }; | - |
184 | | - |
185 | QColorDialogStaticData(); | - |
186 | inline void readSettings(); | - |
187 | inline void writeSettings() const; | - |
188 | | - |
189 | QRgb customRgb[CustomColorCount]; | - |
190 | QRgb standardRgb[StandardColorCount]; | - |
191 | bool customSet; | - |
192 | }; | - |
193 | | - |
194 | QColorDialogStaticData::QColorDialogStaticData() : customSet(false) | - |
195 | { | - |
196 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
197 | for (int g = 0; g < 4; ++g) evaluated: g < 4 yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
198 | for (int r = 0; r < 4; ++r) evaluated: r < 4 yes Evaluation Count:16 | yes Evaluation Count:4 |
| 4-16 |
199 | for (int b = 0; b < 3; ++b) evaluated: b < 3 yes Evaluation Count:48 | yes Evaluation Count:16 |
| 16-48 |
200 | standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2); executed: standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2); Execution Count:48 | 48 |
201 | qFill(customRgb, customRgb + CustomColorCount, 0xffffffff); executed (the execution status of this line is deduced): qFill(customRgb, customRgb + CustomColorCount, 0xffffffff); | - |
202 | readSettings(); executed (the execution status of this line is deduced): readSettings(); | - |
203 | } executed: } Execution Count:1 | 1 |
204 | | - |
205 | void QColorDialogStaticData::readSettings() | - |
206 | { | - |
207 | #ifndef QT_NO_SETTINGS | - |
208 | const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); executed (the execution status of this line is deduced): const QSettings settings(QSettings::UserScope, QString::fromUtf8("" "QtProject" "", sizeof("QtProject") - 1)); | - |
209 | for (int i = 0; i < int(CustomColorCount); ++i) { evaluated: i < int(CustomColorCount) yes Evaluation Count:16 | yes Evaluation Count:1 |
| 1-16 |
210 | const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i)); executed (the execution status of this line is deduced): const QVariant v = settings.value(QString::fromUtf8("" "Qt/customColors/" "", sizeof("Qt/customColors/") - 1) + QString::number(i)); | - |
211 | if (v.isValid()) partially evaluated: v.isValid() yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
212 | customRgb[i] = v.toUInt(); executed: customRgb[i] = v.toUInt(); Execution Count:16 | 16 |
213 | } executed: } Execution Count:16 | 16 |
214 | #endif | - |
215 | } executed: } Execution Count:1 | 1 |
216 | | - |
217 | void QColorDialogStaticData::writeSettings() const | - |
218 | { | - |
219 | #ifndef QT_NO_SETTINGS | - |
220 | if (!customSet) { partially evaluated: !customSet yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
221 | QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); executed (the execution status of this line is deduced): QSettings settings(QSettings::UserScope, QString::fromUtf8("" "QtProject" "", sizeof("QtProject") - 1)); | - |
222 | for (int i = 0; i < int(CustomColorCount); ++i) evaluated: i < int(CustomColorCount) yes Evaluation Count:48 | yes Evaluation Count:3 |
| 3-48 |
223 | settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]); executed: settings.setValue(QString::fromUtf8("" "Qt/customColors/" "", sizeof("Qt/customColors/") - 1) + QString::number(i), customRgb[i]); Execution Count:48 | 48 |
224 | } executed: } Execution Count:3 | 3 |
225 | #endif | - |
226 | } executed: } Execution Count:3 | 3 |
227 | | - |
228 | Q_GLOBAL_STATIC(QColorDialogStaticData, qColorDialogStaticData) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:23 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:1 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:1 | yes Evaluation Count:22 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-23 |
229 | | - |
230 | class QColorDialogOptionsPrivate : public QSharedData | - |
231 | { | - |
232 | public: | - |
233 | QColorDialogOptionsPrivate() : options(0) {} executed: } Execution Count:3 | 3 |
234 | // Write out settings around destruction of dialogs | - |
235 | ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); } executed: } Execution Count:3 | 3 |
236 | | - |
237 | QColorDialogOptions::ColorDialogOptions options; | - |
238 | QString windowTitle; | - |
239 | }; | - |
240 | | - |
241 | QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate) | - |
242 | { | - |
243 | } executed: } Execution Count:3 | 3 |
244 | | - |
245 | QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d) | - |
246 | { | - |
247 | } | 0 |
248 | | - |
249 | QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs) | - |
250 | { | - |
251 | if (this != &rhs) never evaluated: this != &rhs | 0 |
252 | d = rhs.d; never executed: d = rhs.d; | 0 |
253 | return *this; never executed: return *this; | 0 |
254 | } | - |
255 | | - |
256 | QColorDialogOptions::~QColorDialogOptions() | - |
257 | { | - |
258 | } | - |
259 | | - |
260 | QString QColorDialogOptions::windowTitle() const | - |
261 | { | - |
262 | return d->windowTitle; never executed: return d->windowTitle; | 0 |
263 | } | - |
264 | | - |
265 | void QColorDialogOptions::setWindowTitle(const QString &title) | - |
266 | { | - |
267 | d->windowTitle = title; never executed (the execution status of this line is deduced): d->windowTitle = title; | - |
268 | } | 0 |
269 | | - |
270 | void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on) | - |
271 | { | - |
272 | if (!(d->options & option) != !on) never evaluated: !(d->options & option) != !on | 0 |
273 | setOptions(d->options ^ option); never executed: setOptions(d->options ^ option); | 0 |
274 | } | 0 |
275 | | - |
276 | bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const | - |
277 | { | - |
278 | return d->options & option; executed: return d->options & option; Execution Count:8 | 8 |
279 | } | - |
280 | | - |
281 | void QColorDialogOptions::setOptions(ColorDialogOptions options) | - |
282 | { | - |
283 | if (options != d->options) partially evaluated: options != d->options yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
284 | d->options = options; executed: d->options = options; Execution Count:2 | 2 |
285 | } executed: } Execution Count:2 | 2 |
286 | | - |
287 | QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const | - |
288 | { | - |
289 | return d->options; executed: return d->options; Execution Count:30 | 30 |
290 | } | - |
291 | | - |
292 | int QColorDialogOptions::customColorCount() | - |
293 | { | - |
294 | return QColorDialogStaticData::CustomColorCount; never executed: return QColorDialogStaticData::CustomColorCount; | 0 |
295 | } | - |
296 | | - |
297 | QRgb QColorDialogOptions::customColor(int index) | - |
298 | { | - |
299 | if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount)) never evaluated: uint(index) >= uint(QColorDialogStaticData::CustomColorCount) | 0 |
300 | return qRgb(255, 255, 255); never executed: return qRgb(255, 255, 255); | 0 |
301 | return qColorDialogStaticData()->customRgb[index]; never executed: return qColorDialogStaticData()->customRgb[index]; | 0 |
302 | } | - |
303 | | - |
304 | QRgb *QColorDialogOptions::customColors() | - |
305 | { | - |
306 | return qColorDialogStaticData()->customRgb; executed: return qColorDialogStaticData()->customRgb; Execution Count:4 | 4 |
307 | } | - |
308 | | - |
309 | void QColorDialogOptions::setCustomColor(int index, QRgb color) | - |
310 | { | - |
311 | if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount)) never evaluated: uint(index) >= uint(QColorDialogStaticData::CustomColorCount) | 0 |
312 | return; | 0 |
313 | qColorDialogStaticData()->customSet = true; never executed (the execution status of this line is deduced): qColorDialogStaticData()->customSet = true; | - |
314 | qColorDialogStaticData()->customRgb[index] = color; never executed (the execution status of this line is deduced): qColorDialogStaticData()->customRgb[index] = color; | - |
315 | } | 0 |
316 | | - |
317 | QRgb *QColorDialogOptions::standardColors() | - |
318 | { | - |
319 | return qColorDialogStaticData()->standardRgb; executed: return qColorDialogStaticData()->standardRgb; Execution Count:8 | 8 |
320 | } | - |
321 | | - |
322 | QRgb QColorDialogOptions::standardColor(int index) | - |
323 | { | - |
324 | if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount)) partially evaluated: uint(index) >= uint(QColorDialogStaticData::StandardColorCount) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
325 | return qRgb(255, 255, 255); never executed: return qRgb(255, 255, 255); | 0 |
326 | return qColorDialogStaticData()->standardRgb[index]; executed: return qColorDialogStaticData()->standardRgb[index]; Execution Count:8 | 8 |
327 | } | - |
328 | | - |
329 | void QColorDialogOptions::setStandardColor(int index, QRgb color) | - |
330 | { | - |
331 | if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount)) never evaluated: uint(index) >= uint(QColorDialogStaticData::StandardColorCount) | 0 |
332 | return; | 0 |
333 | qColorDialogStaticData()->standardRgb[index] = color; never executed (the execution status of this line is deduced): qColorDialogStaticData()->standardRgb[index] = color; | - |
334 | } | 0 |
335 | | - |
336 | /*! | - |
337 | \class QPlatformColorDialogHelper | - |
338 | \since 5.0 | - |
339 | \internal | - |
340 | \ingroup qpa | - |
341 | | - |
342 | \brief The QPlatformColorDialogHelper class allows for platform-specific customization of color dialogs. | - |
343 | | - |
344 | */ | - |
345 | const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const | - |
346 | { | - |
347 | return m_options; never executed: return m_options; | 0 |
348 | } | - |
349 | | - |
350 | void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options) | - |
351 | { | - |
352 | m_options = options; never executed (the execution status of this line is deduced): m_options = options; | - |
353 | } | 0 |
354 | | - |
355 | // File dialog | - |
356 | | - |
357 | class QFileDialogOptionsPrivate : public QSharedData | - |
358 | { | - |
359 | public: | - |
360 | QFileDialogOptionsPrivate() : options(0), | - |
361 | viewMode(QFileDialogOptions::Detail), | - |
362 | fileMode(QFileDialogOptions::AnyFile), | - |
363 | acceptMode(QFileDialogOptions::AcceptOpen), | - |
364 | filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs) | - |
365 | {} executed: } Execution Count:189 | 189 |
366 | | - |
367 | QFileDialogOptions::FileDialogOptions options; | - |
368 | QString windowTitle; | - |
369 | | - |
370 | QFileDialogOptions::ViewMode viewMode; | - |
371 | QFileDialogOptions::FileMode fileMode; | - |
372 | QFileDialogOptions::AcceptMode acceptMode; | - |
373 | QString labels[QFileDialogOptions::DialogLabelCount]; | - |
374 | QDir::Filters filters; | - |
375 | QList<QUrl> sidebarUrls; | - |
376 | QStringList nameFilters; | - |
377 | QString defaultSuffix; | - |
378 | QStringList history; | - |
379 | QString initialDirectory; | - |
380 | QString initiallySelectedNameFilter; | - |
381 | QStringList initiallySelectedFiles; | - |
382 | }; | - |
383 | | - |
384 | QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) | - |
385 | { | - |
386 | } executed: } Execution Count:189 | 189 |
387 | | - |
388 | QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d) | - |
389 | { | - |
390 | } | 0 |
391 | | - |
392 | QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs) | - |
393 | { | - |
394 | if (this != &rhs) never evaluated: this != &rhs | 0 |
395 | d = rhs.d; never executed: d = rhs.d; | 0 |
396 | return *this; never executed: return *this; | 0 |
397 | } | - |
398 | | - |
399 | QFileDialogOptions::~QFileDialogOptions() | - |
400 | { | - |
401 | } | - |
402 | | - |
403 | QString QFileDialogOptions::windowTitle() const | - |
404 | { | - |
405 | return d->windowTitle; never executed: return d->windowTitle; | 0 |
406 | } | - |
407 | | - |
408 | void QFileDialogOptions::setWindowTitle(const QString &title) | - |
409 | { | - |
410 | d->windowTitle = title; never executed (the execution status of this line is deduced): d->windowTitle = title; | - |
411 | } | 0 |
412 | | - |
413 | void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on) | - |
414 | { | - |
415 | if (!(d->options & option) != !on) never evaluated: !(d->options & option) != !on | 0 |
416 | setOptions(d->options ^ option); never executed: setOptions(d->options ^ option); | 0 |
417 | } | 0 |
418 | | - |
419 | bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const | - |
420 | { | - |
421 | return d->options & option; executed: return d->options & option; Execution Count:459 | 459 |
422 | } | - |
423 | | - |
424 | void QFileDialogOptions::setOptions(FileDialogOptions options) | - |
425 | { | - |
426 | if (options != d->options) partially evaluated: options != d->options yes Evaluation Count:212 | no Evaluation Count:0 |
| 0-212 |
427 | d->options = options; executed: d->options = options; Execution Count:212 | 212 |
428 | } executed: } Execution Count:212 | 212 |
429 | | - |
430 | QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const | - |
431 | { | - |
432 | return d->options; executed: return d->options; Execution Count:709 | 709 |
433 | } | - |
434 | | - |
435 | QDir::Filters QFileDialogOptions::filter() const | - |
436 | { | - |
437 | return d->filters; never executed: return d->filters; | 0 |
438 | } | - |
439 | | - |
440 | void QFileDialogOptions::setFilter(QDir::Filters filters) | - |
441 | { | - |
442 | d->filters = filters; executed (the execution status of this line is deduced): d->filters = filters; | - |
443 | } executed: } Execution Count:198 | 198 |
444 | | - |
445 | void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode) | - |
446 | { | - |
447 | d->viewMode = mode; never executed (the execution status of this line is deduced): d->viewMode = mode; | - |
448 | } | 0 |
449 | | - |
450 | QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const | - |
451 | { | - |
452 | return d->viewMode; never executed: return d->viewMode; | 0 |
453 | } | - |
454 | | - |
455 | void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode) | - |
456 | { | - |
457 | d->fileMode = mode; executed (the execution status of this line is deduced): d->fileMode = mode; | - |
458 | } executed: } Execution Count:211 | 211 |
459 | | - |
460 | QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const | - |
461 | { | - |
462 | return d->fileMode; executed: return d->fileMode; Execution Count:2778 | 2778 |
463 | } | - |
464 | | - |
465 | void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode) | - |
466 | { | - |
467 | d->acceptMode = mode; executed (the execution status of this line is deduced): d->acceptMode = mode; | - |
468 | } executed: } Execution Count:217 | 217 |
469 | | - |
470 | QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const | - |
471 | { | - |
472 | return d->acceptMode; executed: return d->acceptMode; Execution Count:2858 | 2858 |
473 | } | - |
474 | | - |
475 | void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls) | - |
476 | { | - |
477 | d->sidebarUrls = urls; never executed (the execution status of this line is deduced): d->sidebarUrls = urls; | - |
478 | } | 0 |
479 | | - |
480 | QList<QUrl> QFileDialogOptions::sidebarUrls() const | - |
481 | { | - |
482 | return d->sidebarUrls; never executed: return d->sidebarUrls; | 0 |
483 | } | - |
484 | | - |
485 | void QFileDialogOptions::setNameFilters(const QStringList &filters) | - |
486 | { | - |
487 | d->nameFilters = filters; executed (the execution status of this line is deduced): d->nameFilters = filters; | - |
488 | } executed: } Execution Count:223 | 223 |
489 | | - |
490 | QStringList QFileDialogOptions::nameFilters() const | - |
491 | { | - |
492 | return d->nameFilters; executed: return d->nameFilters; Execution Count:244 | 244 |
493 | } | - |
494 | | - |
495 | void QFileDialogOptions::setDefaultSuffix(const QString &suffix) | - |
496 | { | - |
497 | d->defaultSuffix = suffix; executed (the execution status of this line is deduced): d->defaultSuffix = suffix; | - |
498 | } executed: } Execution Count:2 | 2 |
499 | | - |
500 | QString QFileDialogOptions::defaultSuffix() const | - |
501 | { | - |
502 | return d->defaultSuffix; executed: return d->defaultSuffix; Execution Count:196 | 196 |
503 | } | - |
504 | | - |
505 | void QFileDialogOptions::setHistory(const QStringList &paths) | - |
506 | { | - |
507 | d->history = paths; never executed (the execution status of this line is deduced): d->history = paths; | - |
508 | } | 0 |
509 | | - |
510 | QStringList QFileDialogOptions::history() const | - |
511 | { | - |
512 | return d->history; never executed: return d->history; | 0 |
513 | } | - |
514 | | - |
515 | void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text) | - |
516 | { | - |
517 | if (label >= 0 && label < DialogLabelCount) partially evaluated: label >= 0 yes Evaluation Count:7 | no Evaluation Count:0 |
partially evaluated: label < DialogLabelCount yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
518 | d->labels[label] = text; executed: d->labels[label] = text; Execution Count:7 | 7 |
519 | } executed: } Execution Count:7 | 7 |
520 | | - |
521 | QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const | - |
522 | { | - |
523 | return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString(); executed: return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString(); Execution Count:1 | 1 |
524 | } | - |
525 | | - |
526 | bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label) | - |
527 | { | - |
528 | return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty(); executed: return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty(); Execution Count:1162 | 1162 |
529 | } | - |
530 | | - |
531 | QString QFileDialogOptions::initialDirectory() const | - |
532 | { | - |
533 | return d->initialDirectory; never executed: return d->initialDirectory; | 0 |
534 | } | - |
535 | | - |
536 | void QFileDialogOptions::setInitialDirectory(const QString &directory) | - |
537 | { | - |
538 | d->initialDirectory = directory; never executed (the execution status of this line is deduced): d->initialDirectory = directory; | - |
539 | } | 0 |
540 | | - |
541 | QString QFileDialogOptions::initiallySelectedNameFilter() const | - |
542 | { | - |
543 | return d->initiallySelectedNameFilter; never executed: return d->initiallySelectedNameFilter; | 0 |
544 | } | - |
545 | | - |
546 | void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter) | - |
547 | { | - |
548 | d->initiallySelectedNameFilter = filter; never executed (the execution status of this line is deduced): d->initiallySelectedNameFilter = filter; | - |
549 | } | 0 |
550 | | - |
551 | QStringList QFileDialogOptions::initiallySelectedFiles() const | - |
552 | { | - |
553 | return d->initiallySelectedFiles; never executed: return d->initiallySelectedFiles; | 0 |
554 | } | - |
555 | | - |
556 | void QFileDialogOptions::setInitiallySelectedFiles(const QStringList &files) | - |
557 | { | - |
558 | d->initiallySelectedFiles = files; never executed (the execution status of this line is deduced): d->initiallySelectedFiles = files; | - |
559 | } | 0 |
560 | | - |
561 | /*! | - |
562 | \class QPlatformFileDialogHelper | - |
563 | \since 5.0 | - |
564 | \internal | - |
565 | \ingroup qpa | - |
566 | | - |
567 | \brief The QPlatformFileDialogHelper class allows for platform-specific customization of file dialogs. | - |
568 | | - |
569 | */ | - |
570 | const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const | - |
571 | { | - |
572 | return m_options; never executed: return m_options; | 0 |
573 | } | - |
574 | | - |
575 | void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options) | - |
576 | { | - |
577 | m_options = options; never executed (the execution status of this line is deduced): m_options = options; | - |
578 | } | 0 |
579 | | - |
580 | const char *QPlatformFileDialogHelper::filterRegExp = | - |
581 | "^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"; | - |
582 | | - |
583 | // Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)" | - |
584 | QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) | - |
585 | { | - |
586 | QRegExp regexp(QString::fromLatin1(filterRegExp)); executed (the execution status of this line is deduced): QRegExp regexp(QString::fromLatin1(filterRegExp)); | - |
587 | QString f = filter; executed (the execution status of this line is deduced): QString f = filter; | - |
588 | int i = regexp.indexIn(f); executed (the execution status of this line is deduced): int i = regexp.indexIn(f); | - |
589 | if (i >= 0) evaluated: i >= 0 yes Evaluation Count:222 | yes Evaluation Count:3 |
| 3-222 |
590 | f = regexp.cap(2); executed: f = regexp.cap(2); Execution Count:222 | 222 |
591 | return f.split(QLatin1Char(' '), QString::SkipEmptyParts); executed: return f.split(QLatin1Char(' '), QString::SkipEmptyParts); Execution Count:225 | 225 |
592 | } | - |
593 | | - |
594 | QT_END_NAMESPACE | - |
595 | | - |
| | |