-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsofgameplugin.h
More file actions
118 lines (105 loc) · 3.84 KB
/
sofgameplugin.h
File metadata and controls
118 lines (105 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* sof_game.h - Sof Game Psi plugin
* Copyright (C) 2010 Aleksey Andreev
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* You can also redistribute and/or modify this program under the
* terms of the Psi License, specified in the accompanied COPYING
* file, as published by the Psi Project; either dated January 1st,
* 2005, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef PLUGIN_MAIN_H
#define PLUGIN_MAIN_H
#include <QtGui>
#include "psiplugin.h"
#include "optionaccessor.h"
#include "shortcutaccessor.h"
#include "shortcutaccessinghost.h"
#include "stanzasender.h"
#include "stanzasendinghost.h"
#include "stanzafilter.h"
#include "plugininfoprovider.h"
#include "accountinfoaccessor.h"
#include "accountinfoaccessinghost.h"
#include "applicationinfoaccessor.h"
#include "popupaccessor.h"
#include "iconfactoryaccessor.h"
#define constGameJids "game-jids"
#define constChatJids "chat-jids"
#define constShortCut "shortcut"
#define constGameAccount "game-account"
class SofGamePlugin: public QObject, public PsiPlugin, public OptionAccessor, public StanzaSender, public ShortcutAccessor, public StanzaFilter, public ApplicationInfoAccessor, public AccountInfoAccessor, public PopupAccessor, public PluginInfoProvider, public IconFactoryAccessor
{
Q_OBJECT
Q_INTERFACES(PsiPlugin OptionAccessor StanzaSender ShortcutAccessor StanzaFilter ApplicationInfoAccessor AccountInfoAccessor PopupAccessor PluginInfoProvider IconFactoryAccessor)
public:
SofGamePlugin();
~SofGamePlugin();
virtual QString name() const;
virtual QString shortName() const;
virtual QString version() const;
virtual bool enable();
virtual bool disable();
virtual QWidget* options();
virtual void applyOptions();
virtual void restoreOptions();
virtual QString pluginInfo();
// OptionAccessor
virtual void setOptionAccessingHost(OptionAccessingHost*);
virtual void optionChanged(const QString&);
// StanzaSender
virtual void setStanzaSendingHost(StanzaSendingHost*);
// ShortcutsAccessor
virtual void setShortcutAccessingHost(ShortcutAccessingHost*);
virtual void setShortcuts();
// ApplicationInfoAccessor
virtual void setApplicationInfoAccessingHost(ApplicationInfoAccessingHost*);
// AccountInfoAccessor
virtual void setAccountInfoAccessingHost(AccountInfoAccessingHost*);
// StanzaFilter
virtual bool incomingStanza(int, const QDomElement&);
virtual bool outgoingStanza(int, QDomElement&);
// PopupAccessor
virtual void setPopupAccessingHost(PopupAccessingHost*);
// IconFactoryAccessor
virtual void setIconFactoryAccessingHost(IconFactoryAccessingHost*);
//---
private:
bool enabled;
int currentAccount;
bool currAccActive;
QString accountJid;
QString shortCut;
QTextEdit* gameJidsWid;
QTextEdit* chatJidsWid;
QLineEdit* shortCutWid;
QComboBox* accountsWid;
//StanzaSendingHost* sender;
ShortcutAccessingHost* psiShortcuts;
AccountInfoAccessingHost *accInfoHost;
//PopupAccessingHost* myPopupHost;
private:
QList< QPair<QString, QString> > getAccounts() const;
int getAccountByJid(const QString &) const;
void sendLastActiveQuery(const QString &, const QString &);
private slots:
void doShortCut();
void selectShortCut();
void onNewShortcutKey(QKeySequence ks);
};
//Q_EXPORT_PLUGIN(SofGamePlugin);
#endif