~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/jabber_whiteboard/pedrogui.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __PEDROGUI_H__
 
2
#define __PEDROGUI_H__
 
3
/*
 
4
 * Simple demo GUI for the Pedro mini-XMPP client.
 
5
 *
 
6
 * Authors:
 
7
 *   Bob Jamison
 
8
 *
 
9
 * Copyright (C) 2005 Bob Jamison
 
10
 *
 
11
 *  This library is free software; you can redistribute it and/or
 
12
 *  modify it under the terms of the GNU Lesser General Public
 
13
 *  License as published by the Free Software Foundation; either
 
14
 *  version 2.1 of the License, or (at your option) any later version.
 
15
 *
 
16
 *  This library is distributed in the hope that it will be useful,
 
17
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
19
 *  Lesser General Public License for more details.
 
20
 *
 
21
 *  You should have received a copy of the GNU Lesser General Public
 
22
 *  License along with this library; if not, write to the Free Software
 
23
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
24
 */
 
25
 
 
26
 
 
27
 
 
28
#include <gtkmm.h>
 
29
 
 
30
#include "pedro/pedroxmpp.h"
 
31
#include "pedro/pedroconfig.h"
 
32
 
 
33
 
 
34
namespace Pedro
 
35
{
 
36
 
 
37
 
 
38
class PedroGui;
 
39
class GroupChatWindow;
 
40
 
 
41
//#########################################################################
 
42
//# R O S T E R
 
43
//#########################################################################
 
44
class Roster : public Gtk::ScrolledWindow
 
45
{
 
46
public:
 
47
 
 
48
    Roster()
 
49
        { doSetup(); }
 
50
 
 
51
    virtual ~Roster()
 
52
        {}
 
53
 
 
54
    /**
 
55
     * Clear all roster items from the list
 
56
     */
 
57
    virtual void clear();
 
58
 
 
59
    /**
 
60
     * Regenerate the roster
 
61
     */
 
62
    virtual void refresh();
 
63
 
 
64
 
 
65
    void setParent(PedroGui *val)
 
66
        { parent = val; }
 
67
 
 
68
private:
 
69
 
 
70
    class CustomTreeView : public Gtk::TreeView
 
71
    {
 
72
    public:
 
73
        CustomTreeView()
 
74
           { parent = NULL; }
 
75
        virtual ~CustomTreeView()
 
76
           {}
 
77
 
 
78
        bool on_button_press_event(GdkEventButton* event)
 
79
            {
 
80
            Gtk::TreeView::on_button_press_event(event);
 
81
            if (parent)
 
82
                parent->buttonPressCallback(event);
 
83
            return true;
 
84
            }
 
85
        void setParent(Roster *val)
 
86
            { parent = val; }
 
87
 
 
88
    private:
 
89
        Roster *parent;
 
90
    };
 
91
 
 
92
    void doubleClickCallback(const Gtk::TreeModel::Path &path,
 
93
                   Gtk::TreeViewColumn *col);
 
94
 
 
95
    void sendFileCallback();
 
96
    void chatCallback();
 
97
    void shareCallback();
 
98
    bool buttonPressCallback(GdkEventButton* event);
 
99
 
 
100
    bool doSetup();
 
101
 
 
102
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_available;
 
103
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_away;
 
104
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_chat;
 
105
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_dnd;
 
106
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_error;
 
107
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_offline;
 
108
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_xa;
 
109
 
 
110
    class RosterColumns : public Gtk::TreeModel::ColumnRecord
 
111
    {
 
112
    public:
 
113
        RosterColumns()
 
114
           {
 
115
           add(groupColumn);
 
116
           add(statusColumn); add(userColumn);
 
117
           add(nameColumn);   add(subColumn);
 
118
           }
 
119
 
 
120
        Gtk::TreeModelColumn<Glib::ustring> groupColumn;
 
121
        Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > statusColumn;
 
122
        Gtk::TreeModelColumn<Glib::ustring> userColumn;
 
123
        Gtk::TreeModelColumn<Glib::ustring> nameColumn;
 
124
        Gtk::TreeModelColumn<Glib::ustring> subColumn;
 
125
    };
 
126
 
 
127
    RosterColumns rosterColumns;
 
128
 
 
129
    Glib::RefPtr<Gtk::UIManager> uiManager;
 
130
 
 
131
    Glib::RefPtr<Gtk::TreeStore> treeStore;
 
132
    CustomTreeView rosterView;
 
133
 
 
134
    PedroGui *parent;
 
135
};
 
136
 
 
137
//#########################################################################
 
138
//# M E S S A G E    L I S T
 
139
//#########################################################################
 
140
class MessageList : public Gtk::ScrolledWindow
 
141
{
 
142
public:
 
143
 
 
144
    MessageList()
 
145
        { doSetup(); }
 
146
 
 
147
    virtual ~MessageList()
 
148
        {}
 
149
 
 
150
    /**
 
151
     * Clear all messages from the list
 
152
     */
 
153
    virtual void clear();
 
154
 
 
155
    /**
 
156
     * Post a message to the list
 
157
     */
 
158
    virtual void postMessage(const DOMString &from, const DOMString &msg);
 
159
 
 
160
private:
 
161
 
 
162
    bool doSetup();
 
163
 
 
164
    Gtk::TextView messageList;
 
165
    Glib::RefPtr<Gtk::TextBuffer> messageListBuffer;
 
166
 
 
167
};
 
168
 
 
169
//#########################################################################
 
170
//# U S E R    L I S T
 
171
//#########################################################################
 
172
class UserList : public Gtk::ScrolledWindow
 
173
{
 
174
public:
 
175
 
 
176
    UserList()
 
177
        { doSetup(); }
 
178
 
 
179
    virtual ~UserList()
 
180
        {}
 
181
 
 
182
    /**
 
183
     * Clear all messages from the list
 
184
     */
 
185
    virtual void clear();
 
186
 
 
187
    /**
 
188
     * Post a message to the list
 
189
     */
 
190
    virtual void addUser(const DOMString &user, const DOMString &show);
 
191
 
 
192
 
 
193
    void setParent(GroupChatWindow *val)
 
194
        { parent = val; }
 
195
 
 
196
private:
 
197
 
 
198
    class CustomTreeView : public Gtk::TreeView
 
199
    {
 
200
    public:
 
201
        CustomTreeView()
 
202
           { parent = NULL; }
 
203
        virtual ~CustomTreeView()
 
204
           {}
 
205
 
 
206
        bool on_button_press_event(GdkEventButton* event)
 
207
            {
 
208
            Gtk::TreeView::on_button_press_event(event);
 
209
            if (parent)
 
210
                parent->buttonPressCallback(event);
 
211
            return true;
 
212
            }
 
213
        void setParent(UserList *val)
 
214
            { parent = val; }
 
215
 
 
216
    private:
 
217
        UserList *parent;
 
218
    };
 
219
 
 
220
    void doubleClickCallback(const Gtk::TreeModel::Path &path,
 
221
                   Gtk::TreeViewColumn *col);
 
222
 
 
223
    void sendFileCallback();
 
224
    void chatCallback();
 
225
    void shareCallback();
 
226
    bool buttonPressCallback(GdkEventButton* event);
 
227
 
 
228
    bool doSetup();
 
229
 
 
230
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_available;
 
231
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_away;
 
232
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_chat;
 
233
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_dnd;
 
234
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_error;
 
235
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_offline;
 
236
    Glib::RefPtr<Gdk::Pixbuf> pixbuf_xa;
 
237
 
 
238
    class UserListColumns : public Gtk::TreeModel::ColumnRecord
 
239
    {
 
240
    public:
 
241
        UserListColumns()
 
242
           { add(statusColumn); add(userColumn);  }
 
243
 
 
244
        Gtk::TreeModelColumn<Glib::ustring> userColumn;
 
245
        Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > statusColumn;
 
246
    };
 
247
 
 
248
    UserListColumns userListColumns;
 
249
 
 
250
    Glib::RefPtr<Gtk::UIManager> uiManager;
 
251
 
 
252
    Glib::RefPtr<Gtk::ListStore> userListStore;
 
253
    CustomTreeView userList;
 
254
 
 
255
    GroupChatWindow *parent;
 
256
};
 
257
 
 
258
 
 
259
//#########################################################################
 
260
//# C H A T    W I N D O W
 
261
//#########################################################################
 
262
class ChatWindow : public Gtk::Window
 
263
{
 
264
public:
 
265
 
 
266
    ChatWindow(PedroGui &par, const DOMString jid);
 
267
 
 
268
    virtual ~ChatWindow();
 
269
 
 
270
    virtual DOMString getJid()
 
271
        { return jid; }
 
272
 
 
273
    virtual void setJid(const DOMString &val)
 
274
        { jid = val; }
 
275
 
 
276
    virtual bool postMessage(const DOMString &data);
 
277
 
 
278
private:
 
279
 
 
280
    DOMString jid;
 
281
 
 
282
    void leaveCallback();
 
283
    void hideCallback();
 
284
    void shareCallback();
 
285
    void textEnterCallback();
 
286
 
 
287
    bool doSetup();
 
288
 
 
289
    Gtk::VBox   vbox;
 
290
    Gtk::VPaned vPaned;
 
291
 
 
292
    MessageList messageList;
 
293
 
 
294
    Gtk::Entry inputTxt;
 
295
 
 
296
    PedroGui &parent;
 
297
};
 
298
 
 
299
 
 
300
//#########################################################################
 
301
//# G R O U P    C H A T    W I N D O W
 
302
//#########################################################################
 
303
class GroupChatWindow : public Gtk::Window
 
304
{
 
305
public:
 
306
 
 
307
    GroupChatWindow(PedroGui &par, const DOMString &groupJid,
 
308
                                   const DOMString &nick);
 
309
 
 
310
    virtual ~GroupChatWindow();
 
311
 
 
312
 
 
313
    virtual DOMString getGroupJid()
 
314
        { return groupJid; }
 
315
 
 
316
    virtual void setGroupJid(const DOMString &val)
 
317
        { groupJid = val; }
 
318
 
 
319
    virtual DOMString getNick()
 
320
        { return nick; }
 
321
 
 
322
    virtual void setNick(const DOMString &val)
 
323
        { nick = val; }
 
324
 
 
325
    virtual bool receiveMessage(const DOMString &from,
 
326
                                const DOMString &data);
 
327
 
 
328
    virtual bool receivePresence(const DOMString &nick,
 
329
                                 bool presence,
 
330
                                 const DOMString &show,
 
331
                                 const DOMString &status);
 
332
 
 
333
    virtual void doSendFile(const DOMString &nick);
 
334
 
 
335
    virtual void doChat(const DOMString &nick);
 
336
    virtual void doShare(const DOMString &nick);
 
337
 
 
338
 
 
339
private:
 
340
 
 
341
    void textEnterCallback();
 
342
    void leaveCallback();
 
343
    void hideCallback();
 
344
    void shareCallback();
 
345
 
 
346
    bool doSetup();
 
347
 
 
348
    Gtk::VBox   vbox;
 
349
    Gtk::VPaned vPaned;
 
350
    Gtk::HPaned hPaned;
 
351
 
 
352
    MessageList messageList;
 
353
 
 
354
    UserList userList;
 
355
 
 
356
    Gtk::Entry inputTxt;
 
357
 
 
358
    DOMString groupJid;
 
359
    DOMString nick;
 
360
 
 
361
    PedroGui &parent;
 
362
 };
 
363
 
 
364
 
 
365
 
 
366
//#########################################################################
 
367
//# C O N F I G    D I A L O G
 
368
//#########################################################################
 
369
 
 
370
class ConfigDialog : public Gtk::Dialog
 
371
{
 
372
public:
 
373
 
 
374
    ConfigDialog (PedroGui &par) : parent(par)
 
375
        { doSetup(); }
 
376
 
 
377
    virtual ~ConfigDialog ()
 
378
        {}
 
379
 
 
380
   DOMString getPass()
 
381
       { return passField.get_text(); }
 
382
   DOMString getNewPass()
 
383
       { return newField.get_text(); }
 
384
   DOMString getConfirm()
 
385
       { return confField.get_text(); }
 
386
 
 
387
protected:
 
388
 
 
389
    //Overloaded from Gtk::Dialog
 
390
    virtual void on_response(int response_id);
 
391
 
 
392
private:
 
393
 
 
394
    void okCallback();
 
395
    void cancelCallback();
 
396
 
 
397
    bool doSetup();
 
398
 
 
399
    Gtk::Table       table;
 
400
 
 
401
    Gtk::Label       passLabel;
 
402
    Gtk::Entry       passField;
 
403
    Gtk::Label       newLabel;
 
404
    Gtk::Entry       newField;
 
405
    Gtk::Label       confLabel;
 
406
    Gtk::Entry       confField;
 
407
 
 
408
    PedroGui &parent;
 
409
};
 
410
 
 
411
 
 
412
//#########################################################################
 
413
//# P A S S W O R D    D I A L O G
 
414
//#########################################################################
 
415
class PasswordDialog : public Gtk::Dialog
 
416
{
 
417
public:
 
418
 
 
419
    PasswordDialog (PedroGui &par) : parent(par)
 
420
        { doSetup(); }
 
421
 
 
422
    virtual ~PasswordDialog ()
 
423
        {}
 
424
 
 
425
   DOMString getPass()
 
426
       { return passField.get_text(); }
 
427
   DOMString getNewPass()
 
428
       { return newField.get_text(); }
 
429
   DOMString getConfirm()
 
430
       { return confField.get_text(); }
 
431
 
 
432
protected:
 
433
 
 
434
    //Overloaded from Gtk::Dialog
 
435
    virtual void on_response(int response_id);
 
436
 
 
437
private:
 
438
 
 
439
    void okCallback();
 
440
    void cancelCallback();
 
441
 
 
442
    bool doSetup();
 
443
 
 
444
    Gtk::Table       table;
 
445
 
 
446
    Gtk::Label       passLabel;
 
447
    Gtk::Entry       passField;
 
448
    Gtk::Label       newLabel;
 
449
    Gtk::Entry       newField;
 
450
    Gtk::Label       confLabel;
 
451
    Gtk::Entry       confField;
 
452
 
 
453
    PedroGui &parent;
 
454
};
 
455
 
 
456
 
 
457
 
 
458
//#########################################################################
 
459
//# C H A T   D I A L O G
 
460
//#########################################################################
 
461
class ChatDialog : public Gtk::Dialog
 
462
{
 
463
public:
 
464
 
 
465
    ChatDialog(PedroGui &par) : parent(par)
 
466
        { doSetup(); }
 
467
 
 
468
    virtual ~ChatDialog()
 
469
        {}
 
470
 
 
471
   DOMString getUser()
 
472
       { return userField.get_text(); }
 
473
 
 
474
   DOMString getText()
 
475
       { return textField.get_text(); }
 
476
 
 
477
private:
 
478
 
 
479
    void okCallback();
 
480
    void cancelCallback();
 
481
 
 
482
    bool doSetup();
 
483
 
 
484
    Gtk::Table table;
 
485
 
 
486
    Gtk::Label userLabel;
 
487
    Gtk::Entry userField;
 
488
    Gtk::Entry textField;
 
489
 
 
490
    PedroGui &parent;
 
491
};
 
492
 
 
493
 
 
494
 
 
495
//#########################################################################
 
496
//# G R O U P    C H A T   D I A L O G
 
497
//#########################################################################
 
498
 
 
499
class GroupChatDialog : public Gtk::Dialog
 
500
{
 
501
public:
 
502
 
 
503
    GroupChatDialog(PedroGui &par) : parent(par)
 
504
        { doSetup(); }
 
505
 
 
506
    virtual ~GroupChatDialog()
 
507
        {}
 
508
 
 
509
   DOMString getGroup()
 
510
       { return groupField.get_text(); }
 
511
   DOMString getHost()
 
512
       { return hostField.get_text(); }
 
513
   DOMString getPass()
 
514
       { return passField.get_text(); }
 
515
   DOMString getNick()
 
516
       { return nickField.get_text(); }
 
517
 
 
518
private:
 
519
 
 
520
    void okCallback();
 
521
    void cancelCallback();
 
522
 
 
523
    bool doSetup();
 
524
 
 
525
    Gtk::Table table;
 
526
 
 
527
    Gtk::Label groupLabel;
 
528
    Gtk::Entry groupField;
 
529
    Gtk::Label hostLabel;
 
530
    Gtk::Entry hostField;
 
531
    Gtk::Label passLabel;
 
532
    Gtk::Entry passField;
 
533
    Gtk::Label nickLabel;
 
534
    Gtk::Entry nickField;
 
535
 
 
536
    PedroGui &parent;
 
537
};
 
538
 
 
539
 
 
540
//#########################################################################
 
541
//#  C O N N E C T    D I A L O G
 
542
//#########################################################################
 
543
class ConnectDialog : public Gtk::Dialog
 
544
{
 
545
public:
 
546
 
 
547
    ConnectDialog (PedroGui &par) : parent(par)
 
548
        { doSetup(); }
 
549
 
 
550
    virtual ~ConnectDialog ()
 
551
        {}
 
552
 
 
553
   DOMString getHost()
 
554
       { return hostField.get_text(); }
 
555
   void setHost(const DOMString &val)
 
556
       { hostField.set_text(val); }
 
557
   int getPort()
 
558
       { return (int)portSpinner.get_value(); }
 
559
   void setPort(int val)
 
560
       { portSpinner.set_value(val); }
 
561
   DOMString getUser()
 
562
       { return userField.get_text(); }
 
563
   void setUser(const DOMString &val)
 
564
       { userField.set_text(val); }
 
565
   DOMString getPass()
 
566
       { return passField.get_text(); }
 
567
   void setPass(const DOMString &val)
 
568
       { passField.set_text(val); }
 
569
   DOMString getResource()
 
570
       { return resourceField.get_text(); }
 
571
   void setResource(const DOMString &val)
 
572
       { resourceField.set_text(val); }
 
573
   bool getRegister()
 
574
       { return registerButton.get_active(); }
 
575
 
 
576
    /**
 
577
     * Regenerate the account list
 
578
     */
 
579
    virtual void refresh();
 
580
 
 
581
private:
 
582
 
 
583
    void okCallback();
 
584
    void saveCallback();
 
585
    void cancelCallback();
 
586
    void doubleClickCallback(
 
587
                   const Gtk::TreeModel::Path &path,
 
588
                   Gtk::TreeViewColumn *col);
 
589
    void selectedCallback();
 
590
 
 
591
    bool doSetup();
 
592
 
 
593
    Gtk::Table       table;
 
594
 
 
595
    Gtk::Label       hostLabel;
 
596
    Gtk::Entry       hostField;
 
597
    Gtk::Label       portLabel;
 
598
    Gtk::SpinButton  portSpinner;
 
599
    Gtk::Label       userLabel;
 
600
    Gtk::Entry       userField;
 
601
    Gtk::Label       passLabel;
 
602
    Gtk::Entry       passField;
 
603
    Gtk::Label       resourceLabel;
 
604
    Gtk::Entry       resourceField;
 
605
    Gtk::Label       registerLabel;
 
606
    Gtk::CheckButton registerButton;
 
607
 
 
608
    Glib::RefPtr<Gtk::UIManager> uiManager;
 
609
 
 
610
 
 
611
    //##  Account list
 
612
 
 
613
    void buttonPressCallback(GdkEventButton* event);
 
614
 
 
615
    Gtk::ScrolledWindow accountScroll;
 
616
 
 
617
    void connectCallback();
 
618
 
 
619
    void modifyCallback();
 
620
 
 
621
    void deleteCallback();
 
622
 
 
623
 
 
624
    class AccountColumns : public Gtk::TreeModel::ColumnRecord
 
625
        {
 
626
        public:
 
627
            AccountColumns()
 
628
                {
 
629
                add(nameColumn);
 
630
                add(hostColumn);
 
631
                }
 
632
 
 
633
            Gtk::TreeModelColumn<Glib::ustring> nameColumn;
 
634
            Gtk::TreeModelColumn<Glib::ustring> hostColumn;
 
635
        };
 
636
 
 
637
    AccountColumns accountColumns;
 
638
 
 
639
    Glib::RefPtr<Gtk::UIManager> accountUiManager;
 
640
 
 
641
    Glib::RefPtr<Gtk::ListStore> accountListStore;
 
642
    Gtk::TreeView accountView;
 
643
 
 
644
 
 
645
    PedroGui &parent;
 
646
};
 
647
 
 
648
 
 
649
 
 
650
 
 
651
//#########################################################################
 
652
//# F I L E    S E N D    D I A L O G
 
653
//#########################################################################
 
654
 
 
655
class FileSendDialog : public Gtk::Dialog
 
656
{
 
657
public:
 
658
 
 
659
    FileSendDialog(PedroGui &par) : parent(par)
 
660
        { doSetup(); }
 
661
 
 
662
    virtual ~FileSendDialog()
 
663
        {}
 
664
 
 
665
   DOMString getFileName()
 
666
       { return fileName; }
 
667
   DOMString getJid()
 
668
       { return jidField.get_text(); }
 
669
  void setJid(const DOMString &val)
 
670
       { return jidField.set_text(val); }
 
671
 
 
672
private:
 
673
 
 
674
    void okCallback();
 
675
    void cancelCallback();
 
676
    void buttonCallback();
 
677
 
 
678
    bool doSetup();
 
679
 
 
680
    Gtk::Table table;
 
681
 
 
682
    Gtk::Label jidLabel;
 
683
    Gtk::Entry jidField;
 
684
 
 
685
    DOMString fileName;
 
686
    Gtk::Entry fileNameField;
 
687
 
 
688
    Gtk::Button selectFileButton;
 
689
 
 
690
    PedroGui &parent;
 
691
};
 
692
 
 
693
//#########################################################################
 
694
//# F I L E    R E C E I V E    D I A L O G
 
695
//#########################################################################
 
696
 
 
697
class FileReceiveDialog : public Gtk::Dialog
 
698
{
 
699
public:
 
700
 
 
701
    FileReceiveDialog(PedroGui &par,
 
702
                      const DOMString &jidArg,
 
703
                      const DOMString &iqIdArg,
 
704
                      const DOMString &streamIdArg,
 
705
                      const DOMString &offeredNameArg,
 
706
                      const DOMString &descArg,
 
707
                      long  sizeArg,
 
708
                      const DOMString &hashArg
 
709
                      ) : parent(par)
 
710
        {
 
711
        jid         = jidArg;
 
712
        iqId        = iqIdArg;
 
713
        streamId    = streamIdArg;
 
714
        offeredName = offeredNameArg;
 
715
        desc        = descArg;
 
716
        fileSize    = sizeArg;
 
717
        hash        = hashArg;
 
718
        doSetup();
 
719
        }
 
720
 
 
721
    virtual ~FileReceiveDialog()
 
722
        {}
 
723
 
 
724
   DOMString getJid()
 
725
       { return jid; }
 
726
   DOMString getIq()
 
727
       { return iqId; }
 
728
   DOMString getStreamId()
 
729
       { return streamId; }
 
730
   DOMString getOfferedName()
 
731
       { return offeredName; }
 
732
   DOMString getFileName()
 
733
       { return fileName; }
 
734
   DOMString getDescription()
 
735
       { return desc; }
 
736
   long getSize()
 
737
       { return fileSize; }
 
738
   DOMString getHash()
 
739
       { return hash; }
 
740
 
 
741
private:
 
742
 
 
743
    void okCallback();
 
744
    void cancelCallback();
 
745
    void buttonCallback();
 
746
 
 
747
    bool doSetup();
 
748
 
 
749
    Gtk::Table table;
 
750
 
 
751
    Gtk::Label jidLabel;
 
752
    Gtk::Entry jidField;
 
753
    Gtk::Label offeredLabel;
 
754
    Gtk::Entry offeredField;
 
755
    Gtk::Label descLabel;
 
756
    Gtk::Entry descField;
 
757
    Gtk::Label sizeLabel;
 
758
    Gtk::Entry sizeField;
 
759
    Gtk::Label hashLabel;
 
760
    Gtk::Entry hashField;
 
761
 
 
762
    Gtk::Entry fileNameField;
 
763
 
 
764
    Gtk::Button selectFileButton;
 
765
 
 
766
    DOMString jid;
 
767
    DOMString iqId;
 
768
    DOMString streamId;
 
769
    DOMString offeredName;
 
770
    DOMString desc;
 
771
    long      fileSize;
 
772
    DOMString hash;
 
773
 
 
774
    DOMString fileName;
 
775
 
 
776
    PedroGui &parent;
 
777
};
 
778
 
 
779
 
 
780
 
 
781
//#########################################################################
 
782
//# M A I N    W I N D O W
 
783
//#########################################################################
 
784
 
 
785
class PedroGui : public Gtk::Window
 
786
{
 
787
public:
 
788
 
 
789
    PedroGui();
 
790
 
 
791
    virtual ~PedroGui();
 
792
 
 
793
    //Let everyone share these
 
794
    XmppClient client;
 
795
    XmppConfig config;
 
796
 
 
797
 
 
798
    virtual void error(const char *fmt, ...) G_GNUC_PRINTF(2,3);
 
799
 
 
800
    virtual void status(const char *fmt, ...) G_GNUC_PRINTF(2,3);
 
801
 
 
802
 
 
803
 
 
804
    void handleConnectEvent();
 
805
 
 
806
    void handleDisconnectEvent();
 
807
 
 
808
    /**
 
809
     *
 
810
     */
 
811
    virtual void doEvent(const XmppEvent &event);
 
812
 
 
813
    /**
 
814
     *
 
815
     */
 
816
    bool checkEventQueue();
 
817
 
 
818
 
 
819
    bool chatCreate(const DOMString &userJid);
 
820
    bool chatDelete(const DOMString &userJid);
 
821
    bool chatDeleteAll();
 
822
    bool chatMessage(const DOMString &jid, const DOMString &data);
 
823
 
 
824
    bool groupChatCreate(const DOMString &groupJid,
 
825
                         const DOMString &nick);
 
826
    bool groupChatDelete(const DOMString &groupJid,
 
827
                         const DOMString &nick);
 
828
    bool groupChatDeleteAll();
 
829
    bool groupChatMessage(const DOMString &groupJid,
 
830
              const DOMString &from, const DOMString &data);
 
831
    bool groupChatPresence(const DOMString &groupJid,
 
832
                           const DOMString &nick,
 
833
                           bool presence,
 
834
                           const DOMString &show,
 
835
                           const DOMString &status);
 
836
 
 
837
    void doChat(const DOMString &jid);
 
838
    void doSendFile(const DOMString &jid);
 
839
    void doReceiveFile(const DOMString &jid,
 
840
                       const DOMString &iqId,
 
841
                       const DOMString &streamId,
 
842
                       const DOMString &offeredName,
 
843
                       const DOMString &desc,
 
844
                       long  size,
 
845
                       const DOMString &hash);
 
846
 
 
847
    void doShare(const DOMString &jid);
 
848
    void doGroupShare(const DOMString &groupJid);
 
849
 
 
850
    //# File menu
 
851
    void connectCallback();
 
852
    void chatCallback();
 
853
    void groupChatCallback();
 
854
    void disconnectCallback();
 
855
    void quitCallback();
 
856
 
 
857
    //# Edit menu
 
858
    void fontCallback();
 
859
    void colorCallback();
 
860
 
 
861
    //# Transfer menu
 
862
    void sendFileCallback();
 
863
 
 
864
    //# Registration menu
 
865
    void regPassCallback();
 
866
    void regCancelCallback();
 
867
 
 
868
    //# Help menu
 
869
    void aboutCallback();
 
870
 
 
871
    //# Configuration file
 
872
    bool configLoad();
 
873
    bool configSave();
 
874
 
 
875
 
 
876
private:
 
877
 
 
878
    bool doSetup();
 
879
 
 
880
    Gtk::VBox mainBox;
 
881
 
 
882
    Gtk::HBox menuBarBox;
 
883
 
 
884
    Gtk::Image padlockIcon;
 
885
    void padlockEnable();
 
886
    void padlockDisable();
 
887
 
 
888
 
 
889
    Pango::FontDescription fontDesc;
 
890
    Gdk::Color foregroundColor;
 
891
    Gdk::Color backgroundColor;
 
892
 
 
893
    Gtk::VPaned vPaned;
 
894
    MessageList messageList;
 
895
    Roster      roster;
 
896
 
 
897
    Glib::RefPtr<Gtk::UIManager> uiManager;
 
898
    void actionEnable(const DOMString &name, bool val);
 
899
 
 
900
    std::vector<ChatWindow *>chats;
 
901
 
 
902
    std::vector<GroupChatWindow *>groupChats;
 
903
};
 
904
 
 
905
 
 
906
} //namespace Pedro
 
907
 
 
908
#endif /* __PEDROGUI_H__ */
 
909
//#########################################################################
 
910
//# E N D    O F    F I L E
 
911
//#########################################################################
 
912
 
 
913