~mateo-salta/nitroshare/nitroshare

« back to all changes in this revision

Viewing changes to src/util/defaults.cpp

  • Committer: Nathan Osman
  • Date: 2012-06-26 15:47:03 UTC
  • Revision ID: admin@quickmediasolutions.com-20120626154703-z0fg5x8s143bkdkt
Moved the share box creation code around so that multiple share boxes can be loaded from the settings file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <QHostInfo>
21
21
#include <QPoint>
22
22
#include <QUuid>
 
23
#include <QVariantList>
23
24
 
24
25
#include <sharebox/CShareBox.h>
25
26
#include <util/defaults.h>
27
28
 
28
29
QVariantMap Defaults::Map;
29
30
 
30
 
QPoint CalculateShareBoxPosition()
 
31
QVariant GenerateDefaultShareBoxInstance()
31
32
{
32
33
    /* Get the dimensions of the primary screen. */
33
34
    QDesktopWidget * desktop = QApplication::desktop();
41
42
    pos /= 10;
42
43
    pos *= 10;
43
44
 
44
 
    return pos;
 
45
    /* Generate the map/list that we will return. */
 
46
    QVariantMap map;
 
47
    map["pos"] = pos;
 
48
 
 
49
    QVariantList list;
 
50
    list << map;
 
51
 
 
52
    return QVariant(list);
45
53
}
46
54
 
47
55
void Defaults::Init()
65
73
    Map["Network/TimeoutInterval"]   = 45;
66
74
    Map["Network/TransmissionPort"]  = 41721;
67
75
 
68
 
    Map["Internal/ID"]               = QUuid::createUuid().toString();
69
 
    Map["Internal/ShareBoxPosition"] = CalculateShareBoxPosition();
 
76
    Map["ShareBox/Instances"] = GenerateDefaultShareBoxInstance();
 
77
 
 
78
    Map["Internal/ID"] = QUuid::createUuid().toString();
70
79
}