Initial commit
[tietoopcom] / src / TocUi / TocBaseMainWindow.cpp
1 /** \file TocBaseMainWindow.cpp
2  * \brief Implementation of TocBaseMainWindow class
3  * 
4  * Tieto Open Communicator - Client for the Telepathy communications framework.
5  * Copyright (c) 2010, Tieto Corporation
6  *
7  * All rights reserved.
8  * Redistribution and use in source and binary forms, with or without modification,
9  * are permitted provided that the following conditions are met:
10  *
11  *      Redistributions of source code must retain the above copyright notice,
12  *      this list of conditions and the following disclaimer.
13  *      Redistributions in binary form must reproduce the above copyright notice,
14  *      this list of conditions and the following disclaimer in the documentation
15  *      and/or other materials provided with the distribution.
16  *      Neither the name of the Tieto Corporation nor the names of its contributors 
17  *      may be used to endorse or promote products derived from this software without
18  *      specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  * 
30  */
31  
32 #include "TocBaseMainWindow"
33 #include "TocBaseEngine"
34 #include "macros.h"
35
36 TocBaseMainWindow::TocBaseMainWindow(TocBaseEngine* engine, QWidget *parent, Qt::WindowFlags flags)
37     : QMainWindow(parent, flags)
38 {
39         if(!engine)
40                 return;
41
42         qRegisterMetaType<Status>();
43         qRegisterMetaType<Reason>();
44         qRegisterMetaType<Presence>();
45         qRegisterMetaType<Message>();
46         qRegisterMetaType<TocContactList>();
47         qRegisterMetaType<Gender>();
48
49         //Connections from Engine
50         CONNECT(engine, SIGNAL(statusChanged(Status,Reason)), this, SLOT(onStatusChange(Status,Reason)));
51         CONNECT(engine, SIGNAL(presenceUpdated(Presence,QString)), this, SLOT(onPresenceUpdate(Presence,QString)));
52         CONNECT(engine, SIGNAL(contactPresenceUpdated(QString,Presence,QString)), this, SLOT(onContactPresenceUpdate(QString,Presence,QString)));
53         CONNECT(engine, SIGNAL(incomingMessage(QString,Message)), this, SLOT(onIncomingMessage(QString,Message)));
54         CONNECT(engine, SIGNAL(contactListReceived(TocContactList)), this, SLOT(onContactListReceived(TocContactList)));
55         CONNECT(engine, SIGNAL(subscriptionAccepted(QString)), this, SLOT(onSubscriptionAccepted(QString)));
56         CONNECT(engine, SIGNAL(authorizationRequest(QString)), this, SLOT(onAuthorizationRequest(QString)));
57         
58         //Connections to engine
59         CONNECT(this, SIGNAL(presenceChanged(Presence,QString)), engine, SLOT(onPresenceChange(Presence,QString)));
60         CONNECT(this, SIGNAL(sessionClosed(QString)), engine, SLOT(onSessionClosed(QString)));
61         CONNECT(this, SIGNAL(newMessageReady(QString,Message)), engine, SLOT(onNewMessageReady(QString,Message)));
62         CONNECT(this, SIGNAL(addContact(TocContact*)), engine, SLOT(onAddContactRequest(TocContact*)));
63         CONNECT(this, SIGNAL(editContact(TocContact*,QString)), engine, SLOT(onEditContactRequest(TocContact*,QString)));
64         CONNECT(this, SIGNAL(removeContact(QString)), engine, SLOT(onRemoveContactRequest(QString)));
65         CONNECT(this, SIGNAL(subscriptionAccepted(QString,bool)), engine, SLOT(onSubscriptionAccepted(QString,bool)));
66 }
67
68 TocBaseMainWindow::~TocBaseMainWindow()
69 {
70
71 }