e0fac9c4aacdab840f8defbdfe96438f0f2cbd3e
[quassel.git] / src / qtui / qtui.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-08 by the Quassel Project                          *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) version 3.                                           *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #include "qtui.h"
22
23 #ifdef SPUTDEV
24 # include "chatlinemodel.h"
25 #endif
26 #include "mainwin.h"
27 #include "chatline-old.h"
28
29 QtUiStyle *QtUi::_style;
30
31 QtUi::QtUi()
32   : AbstractUi()
33 {
34   mainWin = new MainWin(this);
35   _style = new QtUiStyle;
36
37   connect(mainWin, SIGNAL(connectToCore(const QVariantMap &)), this, SIGNAL(connectToCore(const QVariantMap &)));
38   connect(mainWin, SIGNAL(disconnectFromCore()), this, SIGNAL(disconnectFromCore()));
39 }
40
41 QtUi::~QtUi() {
42   delete _style;
43   delete mainWin;
44 }
45
46 void QtUi::init() {
47   mainWin->init();
48 }
49
50 QtUiStyle *QtUi::style() {
51   return _style;
52 }
53
54 MessageModel *QtUi::createMessageModel(QObject *parent) {
55 #ifndef SPUTDEV
56   Q_UNUSED(parent)
57   return 0;
58 #else
59   return new ChatlineModel(parent);
60 #endif
61 }
62
63 AbstractUiMsg *QtUi::layoutMsg(const Message &msg) {
64   return new ChatLineOld(msg);
65 }
66
67 void QtUi::connectedToCore() {
68   mainWin->connectedToCore();
69 }
70
71 void QtUi::disconnectedFromCore() {
72   mainWin->disconnectedFromCore();
73 }