~ubuntu-branches/ubuntu/jaunty/psi/jaunty

« back to all changes in this revision

Viewing changes to src/mainwin.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2005-01-10 17:41:43 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050110174143-ltocv5zapl6blf5d
Tags: 0.9.3-1
* New upstream release
* Cleaned up debian/rules (some things are done by upstream Makefiles now)
* Fixed some lintian warnings:
  - removed executable bit from some .png files
  - moved psi.desktop to /usr/share/applications
* Updated menu files

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
 
****************************************************************************/
 
1
/*
 
2
 * mainwin.h - the main window.  holds contactlist and buttons.
 
3
 * Copyright (C) 2001-2003  Justin Karneges, Michail Pishchagin
 
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 library; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
20
20
 
21
21
#ifndef MAINWIN_H
22
22
#define MAINWIN_H
23
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"
 
24
#include<qmainwindow.h>
 
25
#include<qmap.h>
 
26
#include"im.h"
33
27
#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);
 
28
#include"psitoolbar.h"
 
29
 
 
30
class PsiCon;
 
31
class PsiAccount;
 
32
class QIconSet;
 
33
class IconLabel;
 
34
 
 
35
class QAction;
 
36
class QActionGroup;
 
37
class IconAction;
 
38
class QLabel;
 
39
class QVBoxLayout;
 
40
class QMenuBar;
 
41
 
 
42
class MainWin : public QMainWindow
 
43
{
 
44
        Q_OBJECT
 
45
public:
 
46
        MainWin(bool onTop, bool asTool, PsiCon *, const char *name=0);
95
47
        ~MainWin();
96
48
 
97
 
        void setAlwaysOnTop(bool);
 
49
        void setWindowOpts(bool onTop, bool asTool);
98
50
        void setUseDock(bool);
99
51
        void setInfo(const QString &);
100
 
        void setUsingSSL(bool);
101
52
 
102
 
        QVBoxLayout *vb_main;
103
 
        QHBoxLayout *hb_status;
 
53
        // evil stuff! remove ASAP!!
 
54
        QStringList actionList;
 
55
        QMap<QString, QAction*> actions;
104
56
 
105
57
        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];
 
58
        QPtrList<PsiToolBar> toolbars;
 
59
 
 
60
        void buildToolbars();
 
61
        void saveToolbarsPositions();
 
62
        PsiCon *psiCon() const;
143
63
 
144
64
protected:
145
 
        virtual void closeEvent(QCloseEvent *);
 
65
        void closeEvent(QCloseEvent *);
 
66
        void keyPressEvent(QKeyEvent *);
146
67
 
147
68
signals:
148
69
        void statusChanged(int);
150
71
        void blankMessage();
151
72
        void closeProgram();
152
73
        void doOptions();
153
 
        void doManageServices();
 
74
        void doToolbars();
154
75
        void doManageAccounts();
155
 
        void doFileSharing();
 
76
        void doGroupChat();
 
77
        void doFileTransDlg();
156
78
        void accountInfo();
157
 
        void addUser();
158
79
        void recvNextEvent();
159
80
 
 
81
        void geomChanged(int x, int y, int w, int h);
 
82
 
160
83
private slots:
161
84
        void buildStatusMenu();
162
 
        void activatedStatusMenu(int);
163
85
        void buildOptionsMenu();
164
 
        void activatedOptionsMenu(int);
165
86
        void buildTrayMenu();
 
87
        void buildMainMenu();
 
88
        void buildToolsMenu();
 
89
 
 
90
        void setTrayToolTip(int);
 
91
 
 
92
        void activatedStatusAction(int);
 
93
 
166
94
        void trayClicked(const QPoint &, int);
167
95
        void trayDoubleClicked();
168
 
        void trayAnimate();
 
96
        void trayShow();
 
97
        void trayHide();
 
98
 
169
99
        void doRecvNextEvent();
170
100
        void statusClicked(int);
171
 
        void trayShow();
172
 
        void trayHide();
 
101
        void try2tryCloseProgram();
173
102
        void tryCloseProgram();
174
103
 
 
104
        void numAccountsChanged();
 
105
        void testme();
 
106
        void activatedAccOption(PsiAccount *, int);
 
107
 
 
108
        void actReadmeActivated ();
 
109
        void actOnlineHelpActivated ();
 
110
        void actBugReportActivated ();
 
111
        void actAboutActivated ();
 
112
        void actAboutQtActivated ();
 
113
        void actPlaySoundsActivated (bool);
 
114
        void actTipActivated();
 
115
 
 
116
        bool showDockMenu(const QPoint &);
 
117
        void dockActivated();
 
118
 
 
119
        void registerAction( IconAction * );
 
120
 
175
121
public slots:
 
122
        void setIcon(const QPixmap&);
 
123
        void showNoFocus();
 
124
 
176
125
        void decorateButton(int);
177
 
        void localUpdate(const JabRosterEntry &);
178
 
        void updateReadNext(int nextType, int amount);
 
126
        void updateReadNext(Icon *nextAnim, int nextAmount);
179
127
 
180
128
        void optionsUpdate();
 
129
 
 
130
        void setTrayToolTip(const Status &);
 
131
 
 
132
private:
 
133
        void buildGeneralMenu(QPopupMenu *);
 
134
        QString numEventsString(int) const;
 
135
 
 
136
        bool askQuit();
 
137
 
 
138
        void updateCaption();
 
139
        void updateTray();
 
140
 
 
141
private:
 
142
        class Private;
 
143
        Private *d;
 
144
        friend class Private;
181
145
};
182
146
 
183
147
#endif