Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtestutil_macos.mm
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qtestutil_macos_p.h"
5
6#include "QtCore/private/qcore_mac_p.h"
7
8#import <AppKit/AppKit.h>
9
11
12namespace QTestPrivate {
13
21 {
22 [NSUserDefaults.standardUserDefaults registerDefaults:@{
23 @"ApplePersistenceIgnoreState" : @YES
24 }];
25 }
26
28 {
29 auto dialogType = QCFType<CFStringRef>(CFPreferencesCopyAppValue(
30 CFSTR("DialogType"), CFSTR("com.apple.CrashReporter")));
31
32 auto stringCompare = [](CFStringRef str1, CFStringRef str2) -> bool {
33 return CFStringCompare(str1, str2, kCFCompareCaseInsensitive) == kCFCompareEqualTo;
34 };
35
36 if (!dialogType || stringCompare(dialogType, CFSTR("basic"))) {
37 // The default (basic) dialog type only shows up if the
38 // application is 'user visible', as indicated by the
39 // activation policy.
40 auto *runningApp = NSRunningApplication.currentApplication;
41 return runningApp && runningApp.activationPolicy == NSApplicationActivationPolicyRegular;
42 } else if (stringCompare(dialogType, CFSTR("developer"))
43 || stringCompare(dialogType, CFSTR("crashreport"))) {
44 // While in developer mode the dialog will show for all
45 // crashed applications, including backgrounded ones.
46 return true;
47 } else {
48 // Finally, 'server' or 'none' will result in no dialog
49 return false;
50 }
51 }
52
65 {
66 m_activity = [[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityBackground
67 reason:@"Qt Auto Test"];
68 [m_activity retain];
69 }
70
75 {
76 [[NSProcessInfo processInfo] endActivity:m_activity];
77 [m_activity release];
78 }
79}
80
Combined button and popup list for selecting options.
void disableWindowRestore()
bool macCrashReporterWillShowDialog()
sem release()