| 1 | /*
|
|---|
| 2 | * groupchatdlg.h - dialogs for handling groupchat
|
|---|
| 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 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 | #include<qlistview.h>
|
|---|
| 22 | #include<qlineedit.h>
|
|---|
| 23 | #include<qtooltip.h>
|
|---|
| 24 | #include"advwidget.h"
|
|---|
| 25 | #include"im.h"
|
|---|
| 26 | #include"ui_gcjoin.h"
|
|---|
| 27 |
|
|---|
| 28 | using namespace XMPP;
|
|---|
| 29 |
|
|---|
| 30 | class PsiCon;
|
|---|
| 31 | class PsiAccount;
|
|---|
| 32 |
|
|---|
| 33 | class GCJoinDlg : public GCJoinUI
|
|---|
| 34 | {
|
|---|
| 35 | Q_OBJECT
|
|---|
| 36 | public:
|
|---|
| 37 | GCJoinDlg(PsiCon *, PsiAccount *);
|
|---|
| 38 | ~GCJoinDlg();
|
|---|
| 39 |
|
|---|
| 40 | void joined();
|
|---|
| 41 | void error(int, const QString &);
|
|---|
| 42 |
|
|---|
| 43 | protected:
|
|---|
| 44 | //void closeEvent(QCloseEvent *);
|
|---|
| 45 |
|
|---|
| 46 | public slots:
|
|---|
| 47 | void done(int);
|
|---|
| 48 |
|
|---|
| 49 | private slots:
|
|---|
| 50 | void doJoin();
|
|---|
| 51 | void updateIdentity(PsiAccount *);
|
|---|
| 52 | void pa_disconnected();
|
|---|
| 53 | void recent_activated(int);
|
|---|
| 54 |
|
|---|
| 55 | private:
|
|---|
| 56 | class Private;
|
|---|
| 57 | Private *d;
|
|---|
| 58 |
|
|---|
| 59 | void disableWidgets();
|
|---|
| 60 | void enableWidgets();
|
|---|
| 61 | };
|
|---|
| 62 |
|
|---|
| 63 | class GCUserViewItem : public QListViewItem
|
|---|
| 64 | {
|
|---|
| 65 | public:
|
|---|
| 66 | GCUserViewItem(QListView *);
|
|---|
| 67 |
|
|---|
| 68 | Status s;
|
|---|
| 69 | };
|
|---|
| 70 |
|
|---|
| 71 | class GCUserView : public QListView, public QToolTip
|
|---|
| 72 | {
|
|---|
| 73 | Q_OBJECT
|
|---|
| 74 | public:
|
|---|
| 75 | GCUserView(QWidget *parent=0, const char *name=0);
|
|---|
| 76 | ~GCUserView();
|
|---|
| 77 |
|
|---|
| 78 | void updateAll();
|
|---|
| 79 | QListViewItem *findEntry(const QString &);
|
|---|
| 80 | void updateEntry(const QString &, const Status &);
|
|---|
| 81 | void removeEntry(const QString &);
|
|---|
| 82 | QStringList nickList() const;
|
|---|
| 83 |
|
|---|
| 84 | protected:
|
|---|
| 85 | // reimplemented
|
|---|
| 86 | void maybeTip(const QPoint &);
|
|---|
| 87 |
|
|---|
| 88 | signals:
|
|---|
| 89 | void action(const QString &, const Status &, int);
|
|---|
| 90 |
|
|---|
| 91 | private slots:
|
|---|
| 92 | void qlv_doubleClicked(QListViewItem *);
|
|---|
| 93 | void qlv_contextMenuRequested(QListViewItem *, const QPoint &, int);
|
|---|
| 94 | };
|
|---|
| 95 |
|
|---|
| 96 | /*class GCLineEdit : public QLineEdit
|
|---|
| 97 | {
|
|---|
| 98 | Q_OBJECT
|
|---|
| 99 | public:
|
|---|
| 100 | GCLineEdit(QWidget *parent=0, const char *name=0);
|
|---|
| 101 |
|
|---|
| 102 | signals:
|
|---|
| 103 | void upPressed();
|
|---|
| 104 | void downPressed();
|
|---|
| 105 |
|
|---|
| 106 | protected:
|
|---|
| 107 | void keyPressEvent(QKeyEvent *);
|
|---|
| 108 | };*/
|
|---|
| 109 |
|
|---|
| 110 | class GCMainDlg : public AdvancedWidget<QWidget>
|
|---|
| 111 | {
|
|---|
| 112 | Q_OBJECT
|
|---|
| 113 | public:
|
|---|
| 114 | GCMainDlg(PsiAccount *, const Jid &);
|
|---|
| 115 | ~GCMainDlg();
|
|---|
| 116 |
|
|---|
| 117 | Jid jid() const;
|
|---|
| 118 |
|
|---|
| 119 | void error(int, const QString &);
|
|---|
| 120 | void presence(const QString &, const Status &);
|
|---|
| 121 | void message(const Message &);
|
|---|
| 122 | void joined();
|
|---|
| 123 |
|
|---|
| 124 | protected:
|
|---|
| 125 | void keyPressEvent(QKeyEvent *);
|
|---|
| 126 | void closeEvent(QCloseEvent *);
|
|---|
| 127 | void windowActivationChange(bool);
|
|---|
| 128 |
|
|---|
| 129 | signals:
|
|---|
| 130 | void aSend(const Message &);
|
|---|
| 131 |
|
|---|
| 132 | public slots:
|
|---|
| 133 | void optionsUpdate();
|
|---|
| 134 |
|
|---|
| 135 | private slots:
|
|---|
| 136 | void mle_returnPressed();
|
|---|
| 137 | void doTopic();
|
|---|
| 138 | void openFind();
|
|---|
| 139 | void doFind(int, int, const QString &);
|
|---|
| 140 | void flashAnimate();
|
|---|
| 141 | void pa_updatedActivity();
|
|---|
| 142 | void goDisc();
|
|---|
| 143 | void goConn();
|
|---|
| 144 | void lv_action(const QString &, const Status &, int);
|
|---|
| 145 | void doClear();
|
|---|
| 146 | void doClearButton();
|
|---|
| 147 | void toggleSmallChat();
|
|---|
| 148 | void buildMenu();
|
|---|
| 149 | void logSelectionChanged();
|
|---|
| 150 |
|
|---|
| 151 | public:
|
|---|
| 152 | class Private;
|
|---|
| 153 | private:
|
|---|
| 154 | Private *d;
|
|---|
| 155 |
|
|---|
| 156 | void doFlash(bool);
|
|---|
| 157 | void doAlert();
|
|---|
| 158 | void updateCaption();
|
|---|
| 159 | void appendSysMsg(const QString &, bool, const QDateTime &ts=QDateTime());
|
|---|
| 160 | void appendMessage(const Message &, bool);
|
|---|
| 161 | void setLooks();
|
|---|
| 162 |
|
|---|
| 163 | void contextMenuEvent(QContextMenuEvent *);
|
|---|
| 164 |
|
|---|
| 165 | QString getNickColor(QString);
|
|---|
| 166 | QMap<QString,int> nicks;
|
|---|
| 167 | int nicknumber;
|
|---|
| 168 | };
|
|---|
| 169 |
|
|---|
| 170 | class GCFindDlg : public QDialog
|
|---|
| 171 | {
|
|---|
| 172 | Q_OBJECT
|
|---|
| 173 | public:
|
|---|
| 174 | GCFindDlg(int, int, const QString &, QWidget *parent=0, const char *name=0);
|
|---|
| 175 | ~GCFindDlg();
|
|---|
| 176 |
|
|---|
| 177 | void found(int, int);
|
|---|
| 178 | void error(const QString &);
|
|---|
| 179 |
|
|---|
| 180 | signals:
|
|---|
| 181 | void find(int, int, const QString &);
|
|---|
| 182 |
|
|---|
| 183 | private slots:
|
|---|
| 184 | void doFind();
|
|---|
| 185 |
|
|---|
| 186 | private:
|
|---|
| 187 | int para, index;
|
|---|
| 188 | QLineEdit *le_input;
|
|---|
| 189 | };
|
|---|