Subversion Repositories tpanel

Rev

Rev 484 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 484 Rev 485
Line 514... Line 514...
514
    return QString::fromNSString(documentDirectory);
514
    return QString::fromNSString(documentDirectory);
515
}
515
}
516
 
516
 
517
QMargins QASettings::getNotchSize()
517
QMargins QASettings::getNotchSize()
518
{
518
{
519
//    NSArray<UIWindow *> *windows = [[UIApplication sharedApplication] windows];   // deprecated!
519
    DECL_TRACER("QASettings::getNotchSize()");
-
 
520
 
520
    NSArray *scenes=[[[UIApplication sharedApplication] connectedScenes] allObjects];
521
    NSArray *scenes = [[[UIApplication sharedApplication] connectedScenes] allObjects];
-
 
522
 
-
 
523
    if (scenes == nil || scenes.count <= 0)
-
 
524
    {
-
 
525
        MSG_WARNING("Found no scenes. Can't get the size of the notch, if there is any.");
-
 
526
        return QMargins();
-
 
527
    }
-
 
528
 
521
    NSArray<UIWindow *> *windows=[[scenes objectAtIndex:0] windows];
529
    NSArray<UIWindow *> *windows = [[scenes objectAtIndex:0] windows];
-
 
530
 
-
 
531
    if (windows == nil || windows.count <= 0)
-
 
532
    {
-
 
533
        MSG_WARNING("Found no windows! Can't calculate notch size.");
-
 
534
        return QMargins();
-
 
535
    }
-
 
536
 
522
    UIWindow* window = nil;
537
    UIWindow* window = nil;
523
 
538
 
524
    for (UIWindow *w in windows)
539
    for (UIWindow *w in windows)
525
    {
540
    {
526
        if (w.isKeyWindow)
541
        if (w.isKeyWindow)
Line 529... Line 544...
529
            break;
544
            break;
530
        }
545
        }
531
    }
546
    }
532
 
547
 
533
    if (window == nil)
548
    if (window == nil)
-
 
549
    {
-
 
550
        MSG_WARNING("No key window detected! Will take 1st window instead ...");
-
 
551
        window = [windows objectAtIndex:0];
-
 
552
 
-
 
553
        if (window == nil)
-
 
554
        {
-
 
555
            MSG_WARNING("No window found! Can't get the notch size, if any.");
534
        return QMargins();
556
            return QMargins();
-
 
557
        }
-
 
558
 
-
 
559
        MSG_DEBUG("Found first window to be a valid one.");
-
 
560
    }
535
 
561
 
536
//    UIWindow* window = [[UIApplication sharedApplication] keyWindow];
-
 
537
    QMargins rect;
562
    QMargins rect;
538
 
563
 
539
    float reservedTop = window.safeAreaInsets.top;
564
    float reservedTop = window.safeAreaInsets.top;
540
    float reservedBottom = window.safeAreaInsets.bottom;
565
    float reservedBottom = window.safeAreaInsets.bottom;
541
    float reservedLeft = window.safeAreaInsets.left;
566
    float reservedLeft = window.safeAreaInsets.left;