~mateo-salta/nitroshare/nitroshare

« back to all changes in this revision

Viewing changes to src/main/CTrayIcon.cpp

  • Committer: Nathan Osman
  • Date: 2012-06-27 15:40:35 UTC
  • Revision ID: admin@quickmediasolutions.com-20120627154035-0w97b4ul89memnkp
Improved handling of share boxes that were not available when the app loaded.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
 
72
72
    if(dialog.exec())
73
73
    {
74
 
        CreateShareBox(dialog.GetMachineID());
 
74
        QByteArray name;
 
75
 
 
76
        MachineMap machines = m_broadcast_server.GetMachineMap();
 
77
        if(machines.contains(dialog.GetMachineID()))
 
78
            name = machines[dialog.GetMachineID()].name;
 
79
 
 
80
        CreateShareBox(dialog.GetMachineID(), name);
75
81
        UpdateShareBoxes();
76
82
    }
77
83
}
168
174
    foreach(CShareBox * box, m_shareboxes)
169
175
    {
170
176
        QVariantMap map;
171
 
        map["id"]  = box->GetMachineID();
172
 
        map["pos"] = box->pos();
 
177
        map["id"]   = box->GetMachineID();
 
178
        map["name"] = box->GetMachineName();
 
179
        map["pos"]  = box->pos();
173
180
 
174
181
        boxes << QVariant(map);
175
182
    }
194
201
    setContextMenu(menu);
195
202
}
196
203
 
197
 
CShareBox * CTrayIcon::CreateShareBox(QString id)
 
204
CShareBox * CTrayIcon::CreateShareBox(QString id, QByteArray name)
198
205
{
199
206
    CShareBox * box = new CShareBox();
200
 
 
201
 
    MachineMap machines = m_broadcast_server.GetMachineMap();
202
 
    if(machines.contains(id))
203
 
        box->SetMachineInfo(id, machines[id].name);
 
207
    box->SetMachineInfo(id, name);
204
208
 
205
209
    connect(box, SIGNAL(AddShareBox()), SLOT(OnAddShareBox()));
206
210
    connect(box, SIGNAL(FilesDropped(QStringList,QString)),
225
229
 
226
230
        /* Each entry contains the position of the box and the unique ID
227
231
           of the machine it is for. */
228
 
        CreateShareBox(map["id"].toString())->move(map["pos"].toPoint());
 
232
        CreateShareBox(map["id"].toString(), map["name"].toByteArray())->move(map["pos"].toPoint());
229
233
    }
230
234
}