~ubuntu-branches/ubuntu/hoary/psi/hoary

« back to all changes in this revision

Viewing changes to src/mainwin.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2002-04-19 02:28:44 UTC
  • Revision ID: james.westby@ubuntu.com-20020419022844-za7xgai5qyfd9xv6
Tags: upstream-0.8.5
ImportĀ upstreamĀ versionĀ 0.8.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
** mainwin.h - the main window.  holds contactlist and buttons.
 
3
** Copyright (C) 2001, 2002  Justin Karneges
 
4
**
 
5
** This program is free software; you can redistribute it and/or
 
6
** modify it under the terms of the GNU General Public License
 
7
** as published by the Free Software Foundation; either version 2
 
8
** of the License, or (at your option) any later version.
 
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 Free Software
 
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
 
18
**
 
19
****************************************************************************/
 
20
 
 
21
#ifndef MAINWIN_H
 
22
#define MAINWIN_H
 
23
 
 
24
#include<qwidget.h>
 
25
#include<qpushbutton.h>
 
26
#include<qtoolbutton.h>
 
27
#include<qpopupmenu.h>
 
28
#include<qlayout.h>
 
29
#include<qlabel.h>
 
30
#include<qptrvector.h>
 
31
#include<qtooltip.h>
 
32
#include"jabcommon.h"
 
33
#include"contactview.h"
 
34
#include"userlist.h"
 
35
#include"trayicon.h"
 
36
 
 
37
 
 
38
class AboutDlg : public QDialog
 
39
{
 
40
        Q_OBJECT
 
41
public:
 
42
        AboutDlg(const QPixmap &icon, const QString &content, QWidget *par=0);
 
43
};
 
44
 
 
45
class MPushButton : public QPushButton
 
46
{
 
47
        Q_OBJECT
 
48
public:
 
49
        MPushButton(QWidget *parent=0, const char *name=0);
 
50
 
 
51
        void setText(const QString &);
 
52
 
 
53
protected:
 
54
        // reimplemented
 
55
        void drawButtonLabel(QPainter *);
 
56
 
 
57
private:
 
58
        bool hasTip;
 
59
};
 
60
 
 
61
 
 
62
class MToolButton : public QToolButton
 
63
{
 
64
        Q_OBJECT
 
65
public:
 
66
        MToolButton(QWidget *parent=0, const char *name=0);
 
67
 
 
68
public slots:
 
69
        void setPressed(bool);
 
70
};
 
71
 
 
72
 
 
73
class MLabel : public QLabel
 
74
{
 
75
        Q_OBJECT
 
76
public:
 
77
        MLabel(QWidget *parent=0, const char *name=0);
 
78
 
 
79
protected:
 
80
        // reimplemented
 
81
        void mouseReleaseEvent(QMouseEvent *);
 
82
        void mouseDoubleClickEvent(QMouseEvent *);
 
83
 
 
84
signals:
 
85
        void clicked(int);
 
86
        void doubleClicked();
 
87
};
 
88
 
 
89
 
 
90
class MainWin : public QWidget
 
91
{
 
92
        Q_OBJECT
 
93
public:
 
94
        MainWin(bool onTop, QWidget *parent=0, const char *name=0);
 
95
        ~MainWin();
 
96
 
 
97
        void setAlwaysOnTop(bool);
 
98
        void setUseDock(bool);
 
99
        void setInfo(const QString &);
 
100
        void setUsingSSL(bool);
 
101
 
 
102
        QVBoxLayout *vb_main;
 
103
        QHBoxLayout *hb_status;
 
104
 
 
105
        ContactView *cvlist;
 
106
        MLabel *lb_info;
 
107
        QLabel *lb_ssl;
 
108
        bool usingSSL;
 
109
        QPushButton *pb_options;
 
110
        MPushButton *pb_status;
 
111
 
 
112
        int nextType, nextAmount;
 
113
 
 
114
        UserList *userlist;
 
115
 
 
116
private:
 
117
        bool onTop;
 
118
        QPopupMenu *statusMenu, *optionsMenu;
 
119
        int localStatus;
 
120
        QString localJid;
 
121
        MToolButton *tb_offline, *tb_away, *tb_agents;
 
122
        TrayIcon *tray;
 
123
        QPopupMenu *trayMenu;
 
124
        QString statusTip;
 
125
 
 
126
        bool askQuit();
 
127
 
 
128
        void updateCaption();
 
129
        void setToolBarIcons();
 
130
        QString makeToolTip(const JabRosterEntry &e);
 
131
        QPixmap makeTrayIcon(const QImage &);
 
132
 
 
133
        QString infoString;
 
134
 
 
135
        // tray animation
 
136
        QTimer *trayTimer;
 
137
        Anim *anim;
 
138
        bool v_isActive;
 
139
        int animStep;
 
140
        void traySetAnim(Anim *_anim);
 
141
 
 
142
        QImage wmdock[2];
 
143
 
 
144
protected:
 
145
        virtual void closeEvent(QCloseEvent *);
 
146
 
 
147
signals:
 
148
        void statusChanged(int);
 
149
        void changeProfile();
 
150
        void blankMessage();
 
151
        void closeProgram();
 
152
        void doOptions();
 
153
        void doManageServices();
 
154
        void doManageAccounts();
 
155
        void doFileSharing();
 
156
        void accountInfo();
 
157
        void addUser();
 
158
        void recvNextEvent();
 
159
 
 
160
private slots:
 
161
        void buildStatusMenu();
 
162
        void activatedStatusMenu(int);
 
163
        void buildOptionsMenu();
 
164
        void activatedOptionsMenu(int);
 
165
        void buildTrayMenu();
 
166
        void trayClicked(const QPoint &, int);
 
167
        void trayDoubleClicked();
 
168
        void trayAnimate();
 
169
        void doRecvNextEvent();
 
170
        void statusClicked(int);
 
171
        void trayShow();
 
172
        void trayHide();
 
173
        void tryCloseProgram();
 
174
 
 
175
public slots:
 
176
        void decorateButton(int);
 
177
        void localUpdate(const JabRosterEntry &);
 
178
        void updateReadNext(int nextType, int amount);
 
179
 
 
180
        void optionsUpdate();
 
181
};
 
182
 
 
183
#endif