kernel/qplatformdialoghelper.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4QPlatformDialogHelper::QPlatformDialogHelper() -
5{ -
6} -
7 -
8QPlatformDialogHelper::~QPlatformDialogHelper() -
9{ -
10} -
11 -
12QVariant QPlatformDialogHelper::styleHint(StyleHint hint) const -
13{ -
14 return QPlatformDialogHelper::defaultStyleHint(hint);
never executed: return QPlatformDialogHelper::defaultStyleHint(hint);
0
15} -
16 -
17QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHint hint) -
18{ -
19 switch (hint) { -
20 case QPlatformDialogHelper::SnapToDefaultButton: -
21 return QVariant(false);
never executed: return QVariant(false);
0
22 } -
23 return QVariant();
never executed: return QVariant();
0
24} -
25 -
26 -
27 -
28class QFontDialogOptionsPrivate : public QSharedData -
29{ -
30public: -
31 QFontDialogOptionsPrivate() : options(0) {}
executed: }
Execution Count:3
3
32 -
33 QFontDialogOptions::FontDialogOptions options; -
34 QString windowTitle; -
35}; -
36 -
37QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate) -
38{ -
39}
executed: }
Execution Count:3
3
40 -
41QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d) -
42{ -
43}
never executed: }
0
44 -
45QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs) -
46{ -
47 if (this != &rhs)
never evaluated: this != &rhs
0
48 d = rhs.d;
never executed: d = rhs.d;
0
49 return *this;
never executed: return *this;
0
50} -
51 -
52QFontDialogOptions::~QFontDialogOptions() -
53{ -
54} -
55 -
56QString QFontDialogOptions::windowTitle() const -
57{ -
58 return d->windowTitle;
never executed: return d->windowTitle;
0
59} -
60 -
61void QFontDialogOptions::setWindowTitle(const QString &title) -
62{ -
63 d->windowTitle = title; -
64}
never executed: }
0
65 -
66void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on) -
67{ -
68 if (!(d->options & option) != !on)
never evaluated: !(d->options & option) != !on
0
69 setOptions(d->options ^ option);
never executed: setOptions(d->options ^ option);
0
70}
never executed: }
0
71 -
72bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const -
73{ -
74 return d->options & option;
never executed: return d->options & option;
0
75} -
76 -
77void QFontDialogOptions::setOptions(FontDialogOptions options) -
78{ -
79 if (options != d->options)
partially evaluated: options != d->options
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
80 d->options = options;
executed: d->options = options;
Execution Count:1
1
81}
executed: }
Execution Count:1
1
82 -
83QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const -
84{ -
85 return d->options;
executed: return d->options;
Execution Count:103
103
86} -
87const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const -
88{ -
89 return m_options;
never executed: return m_options;
0
90} -
91 -
92void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options) -
93{ -
94 m_options = options; -
95}
never executed: }
0
96 -
97 -
98 -
99class QColorDialogStaticData -
100{ -
101public: -
102 enum { CustomColorCount = 16, StandardColorCount = 6 * 8 }; -
103 -
104 QColorDialogStaticData(); -
105 inline void readSettings(); -
106 inline void writeSettings() const; -
107 -
108 QRgb customRgb[CustomColorCount]; -
109 QRgb standardRgb[StandardColorCount]; -
110 bool customSet; -
111}; -
112 -
113QColorDialogStaticData::QColorDialogStaticData() : customSet(false) -
114{ -
115 int i = 0; -
116 for (int g = 0; g < 4; ++g)
evaluated: g < 4
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
117 for (int r = 0; r < 4; ++r)
evaluated: r < 4
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:4
4-16
118 for (int b = 0; b < 3; ++b)
evaluated: b < 3
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:16
16-48
119 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
120 qFill(customRgb, customRgb + CustomColorCount, 0xffffffff); -
121 readSettings(); -
122}
executed: }
Execution Count:1
1
123 -
124void QColorDialogStaticData::readSettings() -
125{ -
126 -
127 const QSettings settings(QSettings::UserScope, QString::fromUtf8("" "QtProject" "", sizeof("QtProject") - 1)); -
128 for (int i = 0; i < int(CustomColorCount); ++i) {
evaluated: i < int(CustomColorCount)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1
1-16
129 const QVariant v = settings.value(QString::fromUtf8("" "Qt/customColors/" "", sizeof("Qt/customColors/") - 1) + QString::number(i)); -
130 if (v.isValid())
partially evaluated: v.isValid()
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
131 customRgb[i] = v.toUInt();
executed: customRgb[i] = v.toUInt();
Execution Count:16
16
132 }
executed: }
Execution Count:16
16
133 -
134}
executed: }
Execution Count:1
1
135 -
136void QColorDialogStaticData::writeSettings() const -
137{ -
138 -
139 if (!customSet) {
partially evaluated: !customSet
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
140 QSettings settings(QSettings::UserScope, QString::fromUtf8("" "QtProject" "", sizeof("QtProject") - 1)); -
141 for (int i = 0; i < int(CustomColorCount); ++i)
evaluated: i < int(CustomColorCount)
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:3
3-48
142 settings.setValue(QString::fromUtf8("" "Qt/customColors/" "", sizeof("Qt/customColors/") - 1) + 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
143 }
executed: }
Execution Count:3
3
144 -
145}
executed: }
Execution Count:3
3
146 -
147static QColorDialogStaticData *qColorDialogStaticData() { static QGlobalStatic<QColorDialogStaticData > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QColorDialogStaticData *x = new QColorDialogStaticData; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QColorDialogStaticData > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:22
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:23
0-23
148 -
149class QColorDialogOptionsPrivate : public QSharedData -
150{ -
151public: -
152 QColorDialogOptionsPrivate() : options(0) {}
executed: }
Execution Count:3
3
153 -
154 ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); }
executed: }
Execution Count:3
3
155 -
156 QColorDialogOptions::ColorDialogOptions options; -
157 QString windowTitle; -
158}; -
159 -
160QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate) -
161{ -
162}
executed: }
Execution Count:3
3
163 -
164QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d) -
165{ -
166}
never executed: }
0
167 -
168QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs) -
169{ -
170 if (this != &rhs)
never evaluated: this != &rhs
0
171 d = rhs.d;
never executed: d = rhs.d;
0
172 return *this;
never executed: return *this;
0
173} -
174 -
175QColorDialogOptions::~QColorDialogOptions() -
176{ -
177} -
178 -
179QString QColorDialogOptions::windowTitle() const -
180{ -
181 return d->windowTitle;
never executed: return d->windowTitle;
0
182} -
183 -
184void QColorDialogOptions::setWindowTitle(const QString &title) -
185{ -
186 d->windowTitle = title; -
187}
never executed: }
0
188 -
189void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on) -
190{ -
191 if (!(d->options & option) != !on)
never evaluated: !(d->options & option) != !on
0
192 setOptions(d->options ^ option);
never executed: setOptions(d->options ^ option);
0
193}
never executed: }
0
194 -
195bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const -
196{ -
197 return d->options & option;
executed: return d->options & option;
Execution Count:8
8
198} -
199 -
200void QColorDialogOptions::setOptions(ColorDialogOptions options) -
201{ -
202 if (options != d->options)
partially evaluated: options != d->options
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
203 d->options = options;
executed: d->options = options;
Execution Count:2
2
204}
executed: }
Execution Count:2
2
205 -
206QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const -
207{ -
208 return d->options;
executed: return d->options;
Execution Count:30
30
209} -
210 -
211int QColorDialogOptions::customColorCount() -
212{ -
213 return QColorDialogStaticData::CustomColorCount;
never executed: return QColorDialogStaticData::CustomColorCount;
0
214} -
215 -
216QRgb QColorDialogOptions::customColor(int index) -
217{ -
218 if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
never evaluated: uint(index) >= uint(QColorDialogStaticData::CustomColorCount)
0
219 return qRgb(255, 255, 255);
never executed: return qRgb(255, 255, 255);
0
220 return qColorDialogStaticData()->customRgb[index];
never executed: return qColorDialogStaticData()->customRgb[index];
0
221} -
222 -
223QRgb *QColorDialogOptions::customColors() -
224{ -
225 return qColorDialogStaticData()->customRgb;
executed: return qColorDialogStaticData()->customRgb;
Execution Count:4
4
226} -
227 -
228void QColorDialogOptions::setCustomColor(int index, QRgb color) -
229{ -
230 if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
never evaluated: uint(index) >= uint(QColorDialogStaticData::CustomColorCount)
0
231 return;
never executed: return;
0
232 qColorDialogStaticData()->customSet = true; -
233 qColorDialogStaticData()->customRgb[index] = color; -
234}
never executed: }
0
235 -
236QRgb *QColorDialogOptions::standardColors() -
237{ -
238 return qColorDialogStaticData()->standardRgb;
executed: return qColorDialogStaticData()->standardRgb;
Execution Count:8
8
239} -
240 -
241QRgb QColorDialogOptions::standardColor(int index) -
242{ -
243 if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
partially evaluated: uint(index) >= uint(QColorDialogStaticData::StandardColorCount)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
244 return qRgb(255, 255, 255);
never executed: return qRgb(255, 255, 255);
0
245 return qColorDialogStaticData()->standardRgb[index];
executed: return qColorDialogStaticData()->standardRgb[index];
Execution Count:8
8
246} -
247 -
248void QColorDialogOptions::setStandardColor(int index, QRgb color) -
249{ -
250 if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
never evaluated: uint(index) >= uint(QColorDialogStaticData::StandardColorCount)
0
251 return;
never executed: return;
0
252 qColorDialogStaticData()->standardRgb[index] = color; -
253}
never executed: }
0
254const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const -
255{ -
256 return m_options;
never executed: return m_options;
0
257} -
258 -
259void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options) -
260{ -
261 m_options = options; -
262}
never executed: }
0
263 -
264 -
265 -
266class QFileDialogOptionsPrivate : public QSharedData -
267{ -
268public: -
269 QFileDialogOptionsPrivate() : options(0), -
270 viewMode(QFileDialogOptions::Detail), -
271 fileMode(QFileDialogOptions::AnyFile), -
272 acceptMode(QFileDialogOptions::AcceptOpen), -
273 filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs) -
274 {}
executed: }
Execution Count:189
189
275 -
276 QFileDialogOptions::FileDialogOptions options; -
277 QString windowTitle; -
278 -
279 QFileDialogOptions::ViewMode viewMode; -
280 QFileDialogOptions::FileMode fileMode; -
281 QFileDialogOptions::AcceptMode acceptMode; -
282 QString labels[QFileDialogOptions::DialogLabelCount]; -
283 QDir::Filters filters; -
284 QList<QUrl> sidebarUrls; -
285 QStringList nameFilters; -
286 QString defaultSuffix; -
287 QStringList history; -
288 QString initialDirectory; -
289 QString initiallySelectedNameFilter; -
290 QStringList initiallySelectedFiles; -
291}; -
292 -
293QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) -
294{ -
295}
executed: }
Execution Count:189
189
296 -
297QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d) -
298{ -
299}
never executed: }
0
300 -
301QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs) -
302{ -
303 if (this != &rhs)
never evaluated: this != &rhs
0
304 d = rhs.d;
never executed: d = rhs.d;
0
305 return *this;
never executed: return *this;
0
306} -
307 -
308QFileDialogOptions::~QFileDialogOptions() -
309{ -
310} -
311 -
312QString QFileDialogOptions::windowTitle() const -
313{ -
314 return d->windowTitle;
never executed: return d->windowTitle;
0
315} -
316 -
317void QFileDialogOptions::setWindowTitle(const QString &title) -
318{ -
319 d->windowTitle = title; -
320}
never executed: }
0
321 -
322void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on) -
323{ -
324 if (!(d->options & option) != !on)
never evaluated: !(d->options & option) != !on
0
325 setOptions(d->options ^ option);
never executed: setOptions(d->options ^ option);
0
326}
never executed: }
0
327 -
328bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const -
329{ -
330 return d->options & option;
executed: return d->options & option;
Execution Count:459
459
331} -
332 -
333void QFileDialogOptions::setOptions(FileDialogOptions options) -
334{ -
335 if (options != d->options)
partially evaluated: options != d->options
TRUEFALSE
yes
Evaluation Count:212
no
Evaluation Count:0
0-212
336 d->options = options;
executed: d->options = options;
Execution Count:212
212
337}
executed: }
Execution Count:212
212
338 -
339QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const -
340{ -
341 return d->options;
executed: return d->options;
Execution Count:709
709
342} -
343 -
344QDir::Filters QFileDialogOptions::filter() const -
345{ -
346 return d->filters;
never executed: return d->filters;
0
347} -
348 -
349void QFileDialogOptions::setFilter(QDir::Filters filters) -
350{ -
351 d->filters = filters; -
352}
executed: }
Execution Count:198
198
353 -
354void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode) -
355{ -
356 d->viewMode = mode; -
357}
never executed: }
0
358 -
359QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const -
360{ -
361 return d->viewMode;
never executed: return d->viewMode;
0
362} -
363 -
364void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode) -
365{ -
366 d->fileMode = mode; -
367}
executed: }
Execution Count:211
211
368 -
369QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const -
370{ -
371 return d->fileMode;
executed: return d->fileMode;
Execution Count:2778
2778
372} -
373 -
374void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode) -
375{ -
376 d->acceptMode = mode; -
377}
executed: }
Execution Count:217
217
378 -
379QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const -
380{ -
381 return d->acceptMode;
executed: return d->acceptMode;
Execution Count:2858
2858
382} -
383 -
384void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls) -
385{ -
386 d->sidebarUrls = urls; -
387}
never executed: }
0
388 -
389QList<QUrl> QFileDialogOptions::sidebarUrls() const -
390{ -
391 return d->sidebarUrls;
never executed: return d->sidebarUrls;
0
392} -
393 -
394void QFileDialogOptions::setNameFilters(const QStringList &filters) -
395{ -
396 d->nameFilters = filters; -
397}
executed: }
Execution Count:223
223
398 -
399QStringList QFileDialogOptions::nameFilters() const -
400{ -
401 return d->nameFilters;
executed: return d->nameFilters;
Execution Count:244
244
402} -
403 -
404void QFileDialogOptions::setDefaultSuffix(const QString &suffix) -
405{ -
406 d->defaultSuffix = suffix; -
407}
executed: }
Execution Count:2
2
408 -
409QString QFileDialogOptions::defaultSuffix() const -
410{ -
411 return d->defaultSuffix;
executed: return d->defaultSuffix;
Execution Count:196
196
412} -
413 -
414void QFileDialogOptions::setHistory(const QStringList &paths) -
415{ -
416 d->history = paths; -
417}
never executed: }
0
418 -
419QStringList QFileDialogOptions::history() const -
420{ -
421 return d->history;
never executed: return d->history;
0
422} -
423 -
424void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text) -
425{ -
426 if (label >= 0 && label < DialogLabelCount)
partially evaluated: label >= 0
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
partially evaluated: label < DialogLabelCount
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
427 d->labels[label] = text;
executed: d->labels[label] = text;
Execution Count:7
7
428}
executed: }
Execution Count:7
7
429 -
430QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const -
431{ -
432 return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
executed: return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
Execution Count:1
1
433} -
434 -
435bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label) -
436{ -
437 return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
executed: return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
Execution Count:1162
1162
438} -
439 -
440QString QFileDialogOptions::initialDirectory() const -
441{ -
442 return d->initialDirectory;
never executed: return d->initialDirectory;
0
443} -
444 -
445void QFileDialogOptions::setInitialDirectory(const QString &directory) -
446{ -
447 d->initialDirectory = directory; -
448}
never executed: }
0
449 -
450QString QFileDialogOptions::initiallySelectedNameFilter() const -
451{ -
452 return d->initiallySelectedNameFilter;
never executed: return d->initiallySelectedNameFilter;
0
453} -
454 -
455void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter) -
456{ -
457 d->initiallySelectedNameFilter = filter; -
458}
never executed: }
0
459 -
460QStringList QFileDialogOptions::initiallySelectedFiles() const -
461{ -
462 return d->initiallySelectedFiles;
never executed: return d->initiallySelectedFiles;
0
463} -
464 -
465void QFileDialogOptions::setInitiallySelectedFiles(const QStringList &files) -
466{ -
467 d->initiallySelectedFiles = files; -
468}
never executed: }
0
469const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const -
470{ -
471 return m_options;
never executed: return m_options;
0
472} -
473 -
474void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options) -
475{ -
476 m_options = options; -
477}
never executed: }
0
478 -
479const char *QPlatformFileDialogHelper::filterRegExp = -
480"^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"; -
481 -
482 -
483QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) -
484{ -
485 QRegExp regexp(QString::fromLatin1(filterRegExp)); -
486 QString f = filter; -
487 int i = regexp.indexIn(f); -
488 if (i >= 0)
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:222
yes
Evaluation Count:3
3-222
489 f = regexp.cap(2);
executed: f = regexp.cap(2);
Execution Count:222
222
490 return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
executed: return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
Execution Count:225
225
491} -
492 -
493 -
494 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial