| 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 |
|
|---|
| 21 | #ifndef MAINWIN_H
|
|---|
| 22 | #define MAINWIN_H
|
|---|
| 23 |
|
|---|
| 24 | #include<qmainwindow.h>
|
|---|
| 25 | #include<qmap.h>
|
|---|
| 26 | #include"im.h"
|
|---|
| 27 | #include"contactview.h"
|
|---|
| 28 | #include"psitoolbar.h"
|
|---|
| 29 | #include"advwidget.h"
|
|---|
| 30 |
|
|---|
| 31 | class PsiCon;
|
|---|
| 32 | class PsiAccount;
|
|---|
| 33 | class QIconSet;
|
|---|
| 34 | class IconLabel;
|
|---|
| 35 |
|
|---|
| 36 | class QAction;
|
|---|
| 37 | class QActionGroup;
|
|---|
| 38 | class IconAction;
|
|---|
| 39 | class QLabel;
|
|---|
| 40 | class QVBoxLayout;
|
|---|
| 41 | class QMenuBar;
|
|---|
| 42 |
|
|---|
| 43 | class MainWin : public AdvancedWidget<QMainWindow>
|
|---|
| 44 | {
|
|---|
| 45 | Q_OBJECT
|
|---|
| 46 | public:
|
|---|
| 47 | MainWin(bool onTop, bool asTool, PsiCon *, const char *name=0);
|
|---|
| 48 | ~MainWin();
|
|---|
| 49 |
|
|---|
| 50 | void setWindowOpts(bool onTop, bool asTool);
|
|---|
| 51 | void setUseDock(bool);
|
|---|
| 52 | void setInfo(const QString &);
|
|---|
| 53 |
|
|---|
| 54 | // evil stuff! remove ASAP!!
|
|---|
| 55 | QStringList actionList;
|
|---|
| 56 | QMap<QString, QAction*> actions;
|
|---|
| 57 |
|
|---|
| 58 | ContactView *cvlist;
|
|---|
| 59 | QPtrList<PsiToolBar> toolbars;
|
|---|
| 60 |
|
|---|
| 61 | void buildToolbars();
|
|---|
| 62 | void saveToolbarsPositions();
|
|---|
| 63 | PsiCon *psiCon() const;
|
|---|
| 64 |
|
|---|
| 65 | protected:
|
|---|
| 66 | void closeEvent(QCloseEvent *);
|
|---|
| 67 | void keyPressEvent(QKeyEvent *);
|
|---|
| 68 |
|
|---|
| 69 | signals:
|
|---|
| 70 | void statusChanged(int);
|
|---|
| 71 | void changeProfile();
|
|---|
| 72 | void blankMessage();
|
|---|
| 73 | void closeProgram();
|
|---|
| 74 | void doOptions();
|
|---|
| 75 | void doToolbars();
|
|---|
| 76 | void doManageAccounts();
|
|---|
| 77 | void doGroupChat();
|
|---|
| 78 | void doFileTransDlg();
|
|---|
| 79 | void accountInfo();
|
|---|
| 80 | void recvNextEvent();
|
|---|
| 81 |
|
|---|
| 82 | void geomChanged(int x, int y, int w, int h);
|
|---|
| 83 |
|
|---|
| 84 | private slots:
|
|---|
| 85 | void buildStatusMenu();
|
|---|
| 86 | void buildOptionsMenu();
|
|---|
| 87 | void buildTrayMenu();
|
|---|
| 88 | void buildMainMenu();
|
|---|
| 89 | void buildToolsMenu();
|
|---|
| 90 |
|
|---|
| 91 | void setTrayToolTip(int);
|
|---|
| 92 |
|
|---|
| 93 | void activatedStatusAction(int);
|
|---|
| 94 |
|
|---|
| 95 | void trayClicked(const QPoint &, int);
|
|---|
| 96 | void trayDoubleClicked();
|
|---|
| 97 | void trayShow();
|
|---|
| 98 | void trayHide();
|
|---|
| 99 |
|
|---|
| 100 | void doRecvNextEvent();
|
|---|
| 101 | void statusClicked(int);
|
|---|
| 102 | void try2tryCloseProgram();
|
|---|
| 103 | void tryCloseProgram();
|
|---|
| 104 |
|
|---|
| 105 | void numAccountsChanged();
|
|---|
| 106 | void testme();
|
|---|
| 107 | void activatedAccOption(PsiAccount *, int);
|
|---|
| 108 |
|
|---|
| 109 | void actReadmeActivated ();
|
|---|
| 110 | void actOnlineHelpActivated ();
|
|---|
| 111 | void actOnlineWikiActivated ();
|
|---|
| 112 | void actOnlineHomeActivated ();
|
|---|
| 113 | void actBugReportActivated ();
|
|---|
| 114 | void actAboutActivated ();
|
|---|
| 115 | void actAboutQtActivated ();
|
|---|
| 116 | void actPlaySoundsActivated (bool);
|
|---|
| 117 | void actTipActivated();
|
|---|
| 118 |
|
|---|
| 119 | bool showDockMenu(const QPoint &);
|
|---|
| 120 | void dockActivated();
|
|---|
| 121 |
|
|---|
| 122 | void registerAction( IconAction * );
|
|---|
| 123 |
|
|---|
| 124 | public slots:
|
|---|
| 125 | void setIcon(const QPixmap&);
|
|---|
| 126 | void showNoFocus();
|
|---|
| 127 |
|
|---|
| 128 | void decorateButton(int);
|
|---|
| 129 | void updateReadNext(Icon *nextAnim, int nextAmount);
|
|---|
| 130 |
|
|---|
| 131 | void optionsUpdate();
|
|---|
| 132 | void setTrayToolTip(const Status &);
|
|---|
| 133 |
|
|---|
| 134 | void toggleVisible();
|
|---|
| 135 |
|
|---|
| 136 | private:
|
|---|
| 137 | void buildGeneralMenu(QPopupMenu *);
|
|---|
| 138 | QString numEventsString(int) const;
|
|---|
| 139 |
|
|---|
| 140 | bool askQuit();
|
|---|
| 141 |
|
|---|
| 142 | void updateCaption();
|
|---|
| 143 | void updateTray();
|
|---|
| 144 |
|
|---|
| 145 | private:
|
|---|
| 146 | class Private;
|
|---|
| 147 | Private *d;
|
|---|
| 148 | friend class Private;
|
|---|
| 149 | };
|
|---|
| 150 |
|
|---|
| 151 | #endif
|
|---|