Subversion Repositories tpanel

Rev

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

Rev 243 Rev 247
Line 16... Line 16...
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
17
 */
18
 
18
 
19
#include "QASettings.h"
19
#include "QASettings.h"
20
#import <Foundation/Foundation.h>
20
#import <Foundation/Foundation.h>
-
 
21
#import <UIKit/UIKit.h>
21
#include <QtCore>
22
#include <QtCore>
-
 
23
#include "terror.h"
22
 
24
 
23
void QASettings::registerDefaultPrefs()
25
void QASettings::registerDefaultPrefs()
24
{
26
{
25
    NSDictionary* appDefaultsRoot = [NSDictionary dictionaryWithObject:@"Root" forKey:@"StringsTable"];
27
    NSDictionary* appDefaultsRoot = [NSDictionary dictionaryWithObject:@"Root" forKey:@"StringsTable"];
26
    NSDictionary* appDefaultsSip = [NSDictionary dictionaryWithObject:@"SIP" forKey:@"StringsTable"];
28
    NSDictionary* appDefaultsSip = [NSDictionary dictionaryWithObject:@"SIP" forKey:@"StringsTable"];
Line 58... Line 60...
58
}
60
}
59
 
61
 
60
QString QASettings::getNetlinxIP()
62
QString QASettings::getNetlinxIP()
61
{
63
{
62
    NSString* netlinx_ip = [[NSUserDefaults standardUserDefaults] stringForKey:@"netlinx_ip"];
64
    NSString* netlinx_ip = [[NSUserDefaults standardUserDefaults] stringForKey:@"netlinx_ip"];
-
 
65
 
-
 
66
    if (!netlinx_ip)
-
 
67
        netlinx_ip = @"0.0.0.0";
-
 
68
 
63
    return QString::fromNSString(netlinx_ip);
69
    return QString::fromNSString(netlinx_ip);
64
}
70
}
65
 
71
 
66
int QASettings::getNetlinxPort()
72
int QASettings::getNetlinxPort()
67
{
73
{
Line 116... Line 122...
116
QString QASettings::getNetlinxSurface()
122
QString QASettings::getNetlinxSurface()
117
{
123
{
118
    NSString *netlinx_surface = [[ NSUserDefaults standardUserDefaults] stringForKey:@"netlinx_surface"];
124
    NSString *netlinx_surface = [[ NSUserDefaults standardUserDefaults] stringForKey:@"netlinx_surface"];
119
 
125
 
120
    if (!netlinx_surface)
126
    if (!netlinx_surface)
121
        netlinx_surface = @"tpanel.tp4";
127
        netlinx_surface = @"tpanel.TP4";
122
 
128
 
123
    return QString::fromNSString(netlinx_surface);
129
    return QString::fromNSString(netlinx_surface);
124
}
130
}
125
 
131
 
126
bool QASettings::getFTPPassive()
132
bool QASettings::getFTPPassive()
Line 138... Line 144...
138
}
144
}
139
 
145
 
140
int QASettings::getSipNetworkPort(void)
146
int QASettings::getSipNetworkPort(void)
141
{
147
{
142
    NSInteger number = [[ NSUserDefaults standardUserDefaults] integerForKey:@"sip_port"];
148
    NSInteger number = [[ NSUserDefaults standardUserDefaults] integerForKey:@"sip_port"];
-
 
149
 
-
 
150
    if (number <= 0)
-
 
151
        number = 5060;
-
 
152
 
143
    return number;
153
    return number;
144
}
154
}
145
 
155
 
146
int QASettings::getSipNetworkTlsPort(void)
156
int QASettings::getSipNetworkTlsPort(void)
147
{
157
{
Line 328... Line 338...
328
{
338
{
329
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
339
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
330
    NSString *documentDirectory = [paths objectAtIndex:0];
340
    NSString *documentDirectory = [paths objectAtIndex:0];
331
    return QString::fromNSString(documentDirectory);
341
    return QString::fromNSString(documentDirectory);
332
}
342
}
-
 
343
 
-
 
344
QRect QASettings::getNotchSize()
-
 
345
{
-
 
346
    UIWindow* window = [[UIApplication sharedApplication] keyWindow];
-
 
347
    QRect rect;
-
 
348
 
-
 
349
    float reservedTop = window.safeAreaInsets.top;
-
 
350
    float reservedBottom = [[[UIApplication sharedApplication] keyWindow] safeAreaInsets].bottom;
-
 
351
    float reservedLeft = window.safeAreaInsets.left;
-
 
352
    float reservedRight = window.safeAreaInsets.right;
-
 
353
MSG_DEBUG("Notch top: " << reservedTop << ", bottom: " << reservedBottom << ", left: " << reservedLeft << ", right: " << reservedRight);
-
 
354
    rect.setLeft(reservedLeft);
-
 
355
    rect.setTop(reservedTop);
-
 
356
    rect.setBottom(reservedBottom);
-
 
357
    rect.setRight(reservedRight);
-
 
358
    return rect;
-
 
359
}