1 | /*
|
---|
2 | * psiactionlist.cpp - the customizeable action list for Psi
|
---|
3 | * Copyright (C) 2004 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 | #include "psiactionlist.h"
|
---|
22 |
|
---|
23 | #include <qobject.h>
|
---|
24 |
|
---|
25 | #include "mainwin_p.h"
|
---|
26 |
|
---|
27 | //----------------------------------------------------------------------------
|
---|
28 | // PsiActionList::Private
|
---|
29 | //----------------------------------------------------------------------------
|
---|
30 |
|
---|
31 | class PsiActionList::Private : public QObject
|
---|
32 | {
|
---|
33 | Q_OBJECT
|
---|
34 | public:
|
---|
35 | Private(PsiActionList *_list, PsiCon *_psi);
|
---|
36 | ~Private();
|
---|
37 |
|
---|
38 | private:
|
---|
39 | PsiActionList *list;
|
---|
40 | PsiCon *psi;
|
---|
41 |
|
---|
42 | void createCommon();
|
---|
43 | void createMainWin();
|
---|
44 | void createMessageChatGroupchat();
|
---|
45 | void createMessageChat();
|
---|
46 | void createChatGroupchat();
|
---|
47 | void createMessage();
|
---|
48 | void createChat();
|
---|
49 | void createGroupchat();
|
---|
50 |
|
---|
51 | struct ActionNames {
|
---|
52 | const char *name;
|
---|
53 | IconAction *action;
|
---|
54 | };
|
---|
55 |
|
---|
56 | void createActionList( QString name, int id, ActionNames * );
|
---|
57 | };
|
---|
58 |
|
---|
59 | PsiActionList::Private::Private(PsiActionList *_list, PsiCon *_psi)
|
---|
60 | {
|
---|
61 | list = _list;
|
---|
62 | psi = _psi;
|
---|
63 |
|
---|
64 | createCommon();
|
---|
65 | createMainWin();
|
---|
66 | createMessageChatGroupchat();
|
---|
67 | createMessageChat();
|
---|
68 | createChatGroupchat();
|
---|
69 | createMessage();
|
---|
70 | createChat();
|
---|
71 | createGroupchat();
|
---|
72 | }
|
---|
73 |
|
---|
74 | PsiActionList::Private::~Private()
|
---|
75 | {
|
---|
76 | list->clear();
|
---|
77 | }
|
---|
78 |
|
---|
79 | void PsiActionList::Private::createActionList( QString name, int id, ActionNames *actionlist )
|
---|
80 | {
|
---|
81 | ActionList *actions = new ActionList( name, id, false );
|
---|
82 |
|
---|
83 | QString aName;
|
---|
84 | for ( int i = 0; !(aName = QString(actionlist[i].name)).isEmpty(); i++ ) {
|
---|
85 | actions->addAction( aName, actionlist[i].action );
|
---|
86 | }
|
---|
87 |
|
---|
88 | list->addList( actions );
|
---|
89 | }
|
---|
90 |
|
---|
91 | void PsiActionList::Private::createCommon()
|
---|
92 | {
|
---|
93 | IconAction *separatorAction = new SeparatorAction(this);
|
---|
94 | IconAction *spacerAction = new SpacerAction(this);
|
---|
95 |
|
---|
96 | ActionNames actions[] = {
|
---|
97 | { "separator", separatorAction },
|
---|
98 | { "spacer", spacerAction },
|
---|
99 | { "", 0 }
|
---|
100 | };
|
---|
101 |
|
---|
102 | createActionList( tr( "Common Actions" ), Actions_Common, actions );
|
---|
103 | }
|
---|
104 |
|
---|
105 | void PsiActionList::Private::createMainWin()
|
---|
106 | {
|
---|
107 | {
|
---|
108 | IconActionGroup *viewGroups = new IconActionGroup ( this );
|
---|
109 | viewGroups->setMenuText (tr("View Groups"));
|
---|
110 | viewGroups->setWhatsThis (tr("Toggle visibility of special roster groups"));
|
---|
111 | viewGroups->setUsesDropDown (true);
|
---|
112 | viewGroups->setExclusive (false);
|
---|
113 |
|
---|
114 | IconAction *showOffline = new IconAction (tr("Show Offline Contacts"), "psi/show_offline", tr("Show Offline Contacts"), 0, viewGroups, 0, true);
|
---|
115 | showOffline->setWhatsThis (tr("Toggles visibility of offline contacts in roster"));
|
---|
116 |
|
---|
117 | IconAction *showAway = new IconAction (tr("Show Away/XA/DnD"), "psi/show_away", tr("Show Away/XA/DnD"), 0, viewGroups, 0, true);
|
---|
118 | showAway->setWhatsThis (tr("Toggles visibility of away/xa/dnd contacts in roster"));
|
---|
119 |
|
---|
120 | IconAction *showHidden = new IconAction (tr("Show Hidden"), "psi/show_hidden", tr("Show Hidden"), 0, viewGroups, 0, true);
|
---|
121 | showHidden->setWhatsThis (tr("Toggles visibility of hidden contacts in roster"));
|
---|
122 |
|
---|
123 | IconAction *showAgents = new IconAction (tr("Show Agents/Transports"), "psi/disco", tr("Show Agents/Transports"), 0, viewGroups, 0, true);
|
---|
124 | showAgents->setWhatsThis (tr("Toggles visibility of agents/transports in roster"));
|
---|
125 |
|
---|
126 | IconAction *showSelf = new IconAction (tr("Show Self Contact"), "psi/show_self", tr("Show Self Contact"), 0, viewGroups, 0, true);
|
---|
127 | showSelf->setWhatsThis (tr("Toggles visibility of self contact in roster"));
|
---|
128 |
|
---|
129 | ActionNames actions[] = {
|
---|
130 | { "view_groups", viewGroups },
|
---|
131 | { "show_offline", showOffline },
|
---|
132 | { "show_away", showAway },
|
---|
133 | { "show_hidden", showHidden },
|
---|
134 | { "show_agents", showAgents },
|
---|
135 | { "show_self", showSelf },
|
---|
136 | { "", 0 }
|
---|
137 | };
|
---|
138 |
|
---|
139 | createActionList( tr( "Show Contacts" ), Actions_MainWin, actions );
|
---|
140 | }
|
---|
141 |
|
---|
142 | {
|
---|
143 | PopupAction *optionsButton = new PopupAction (tr("&Psi"), 0, this, "optionsButton");
|
---|
144 | optionsButton->setWhatsThis (tr("The main Psi button, that provides access to many actions"));
|
---|
145 | optionsButton->setSizePolicy ( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
|
---|
146 | optionsButton->setIcon ( IconsetFactory::iconPtr("psi/psiMain"), false );
|
---|
147 |
|
---|
148 | PopupAction *statusButton = new PopupAction (tr("&Status"), 0, this, "statusButton");
|
---|
149 | statusButton->setWhatsThis (tr("Provides a convenient way to change and to get information about current status"));
|
---|
150 | statusButton->setSizePolicy ( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
|
---|
151 |
|
---|
152 | IconAction *eventNotifier = new EventNotifierAction(this, "EventNotifierAction");
|
---|
153 | eventNotifier->setWhatsThis (tr("Special item that displays number of pending events"));
|
---|
154 |
|
---|
155 | ActionNames actions[] = {
|
---|
156 | { "button_options", optionsButton },
|
---|
157 | { "button_status", statusButton },
|
---|
158 | { "event_notifier", eventNotifier },
|
---|
159 | { "", 0 }
|
---|
160 | };
|
---|
161 |
|
---|
162 | createActionList( tr( "Buttons" ), Actions_MainWin, actions );
|
---|
163 | }
|
---|
164 |
|
---|
165 |
|
---|
166 | {
|
---|
167 | IconAction *add_act = new MAction(IconsetFactory::icon("psi/addContact"), tr("&Add a contact"), 0, psi, this);
|
---|
168 |
|
---|
169 | IconAction *lw_act = new MAction(IconsetFactory::icon("psi/xml"), tr("&XML Console"), 2, psi, this);
|
---|
170 |
|
---|
171 | IconAction *actDisco = new MAction(IconsetFactory::icon("psi/disco"), tr("Service &Discovery"), 3, psi, this);
|
---|
172 |
|
---|
173 | // IconAction *actReadme = new IconAction (tr("ReadMe"), tr("&ReadMe"), 0, this);
|
---|
174 | // actReadme->setWhatsThis (tr("Show Read Me file"));
|
---|
175 | //
|
---|
176 | // IconAction *actOnlineHelp = new IconAction (tr("User Guide (Online)"), tr("User Guide (Online)"), 0, this);
|
---|
177 | // actOnlineHelp->setWhatsThis (tr("User Guide (Online)"));
|
---|
178 | //
|
---|
179 | // IconAction *actOnlineWiki = new IconAction (tr("Wiki (Online)"), tr("Wiki (Online)"), 0, this);
|
---|
180 | // actOnlineWiki->setWhatsThis (tr("Wiki (Online)"));
|
---|
181 | //
|
---|
182 | // IconAction *actOnlineHome = new IconAction (tr("Home Page (Online)"), tr("Home Page (Online)"), 0, this);
|
---|
183 | // actOnlineHome->setWhatsThis (tr("Home Page (Online)"));
|
---|
184 | //
|
---|
185 | // IconAction *actBugReport = new IconAction (tr("Report a Bug"), tr("Report a &Bug"), 0, this);
|
---|
186 | // actBugReport->setWhatsThis (tr("Report a Bug"));
|
---|
187 |
|
---|
188 | IconAction *actNewMessage = new IconAction (tr("New blank message"), "psi/sendMessage", tr("New &blank message"), 0, this);
|
---|
189 | IconAction *actJoinGroupchat = new IconAction (tr("Join Groupchat"), "psi/groupChat", tr("Join &Groupchat"), 0, this);
|
---|
190 | IconAction *actAccountSetup = new IconAction (tr("Account Setup"), "psi/account", tr("Acc&ount Setup"), 0, this);
|
---|
191 | IconAction *actOptions = new IconAction (tr("Options"), "psi/options", tr("&Options"), 0, this);
|
---|
192 | IconAction *actToolbars = new IconAction(tr("Configure Toolbars"), "psi/toolbars", tr("Configure Tool&bars"), 0, this);
|
---|
193 | IconAction *actChangeProfile = new IconAction (tr("Change Profile"), "psi/profile", tr("&Change profile"), 0, this);
|
---|
194 |
|
---|
195 | IconAction *actPlaySounds = new IconAction (tr("Play sounds"), "psi/playSounds", tr("Play &sounds"), 0, this, 0, true);
|
---|
196 | actPlaySounds->setWhatsThis (tr("Toggles whether sound should be played or not"));
|
---|
197 |
|
---|
198 | IconAction *actQuit = new IconAction (tr("Quit"), "psi/quit", tr("&Quit"), 0, this);
|
---|
199 | actQuit->setWhatsThis (tr("Quits Psi"));
|
---|
200 |
|
---|
201 | IconAction *actTip = new IconAction (tr("Tip of the Day"), "psi/tip", tr("&Tip of the Day"), 0, this);
|
---|
202 | actTip->setWhatsThis (tr("See many useful tips"));
|
---|
203 |
|
---|
204 | IconAction *actFileTrans = new IconAction (tr("Transfer Manager"), "psi/filemanager", tr("Trans&fer Manager"), 0, this);
|
---|
205 | actFileTrans->setWhatsThis (tr("Opens the Transfer Manager dialog"));
|
---|
206 |
|
---|
207 | ActionNames actions[] = {
|
---|
208 | { "menu_disco", actDisco },
|
---|
209 | { "menu_add_contact", add_act },
|
---|
210 | { "menu_new_message", actNewMessage },
|
---|
211 | { "menu_join_groupchat", actJoinGroupchat },
|
---|
212 | { "menu_account_setup", actAccountSetup },
|
---|
213 | { "menu_options", actOptions },
|
---|
214 | { "menu_file_transfer", actFileTrans },
|
---|
215 | { "menu_toolbars", actToolbars },
|
---|
216 | { "menu_xml_console", lw_act },
|
---|
217 | { "menu_change_profile", actChangeProfile },
|
---|
218 | { "menu_play_sounds", actPlaySounds },
|
---|
219 | { "menu_quit", actQuit },
|
---|
220 | { "", 0 }
|
---|
221 | };
|
---|
222 |
|
---|
223 | createActionList( tr( "Menu Items" ), Actions_MainWin, actions );
|
---|
224 | }
|
---|
225 |
|
---|
226 | {
|
---|
227 | // status actions
|
---|
228 | IconActionGroup *statusGroup = new IconActionGroup ( this );
|
---|
229 | statusGroup->setMenuText (tr("Set status"));
|
---|
230 | statusGroup->setWhatsThis (tr("Smaller alternative to the Status Button"));
|
---|
231 | statusGroup->setExclusive(false);
|
---|
232 | statusGroup->setUsesDropDown (true);
|
---|
233 |
|
---|
234 | QString setStatusStr = tr("Changes your global status to '%1'");
|
---|
235 |
|
---|
236 | bool statusExl = true;
|
---|
237 | IconAction *statusOnline = new IconAction (status2txt(STATUS_ONLINE), "status/online", status2txt(STATUS_ONLINE), 0, statusGroup, QString::number(STATUS_ONLINE), statusExl);
|
---|
238 | statusOnline->setWhatsThis (setStatusStr.arg(tr("Online")));
|
---|
239 |
|
---|
240 | IconAction *statusChat = new IconAction (status2txt(STATUS_CHAT), "status/chat", status2txt(STATUS_CHAT), 0, statusGroup, QString::number(STATUS_CHAT), true);
|
---|
241 | statusChat->setWhatsThis (setStatusStr.arg(tr("Free for Chat")));
|
---|
242 |
|
---|
243 | statusGroup->addSeparator();
|
---|
244 |
|
---|
245 | IconAction *statusAway = new IconAction (status2txt(STATUS_AWAY), "status/away", status2txt(STATUS_AWAY), 0, statusGroup, QString::number(STATUS_AWAY), statusExl);
|
---|
246 | statusAway->setWhatsThis (setStatusStr.arg(tr("Away")));
|
---|
247 |
|
---|
248 | IconAction *statusXa = new IconAction (status2txt(STATUS_XA), "status/xa", status2txt(STATUS_XA), 0, statusGroup, QString::number(STATUS_XA), statusExl);
|
---|
249 | statusXa->setWhatsThis (setStatusStr.arg(tr("XA")));
|
---|
250 |
|
---|
251 | IconAction *statusDnd = new IconAction (status2txt(STATUS_DND), "status/dnd", status2txt(STATUS_DND), 0, statusGroup, QString::number(STATUS_DND), statusExl);
|
---|
252 | statusDnd->setWhatsThis (setStatusStr.arg(tr("DND")));
|
---|
253 |
|
---|
254 | statusGroup->addSeparator();
|
---|
255 |
|
---|
256 | IconAction *statusInvisible = new IconAction (status2txt(STATUS_INVISIBLE), "status/invisible", status2txt(STATUS_INVISIBLE), 0, statusGroup, QString::number(STATUS_INVISIBLE), statusExl);
|
---|
257 | statusInvisible->setWhatsThis (setStatusStr.arg(tr("Invisible")));
|
---|
258 |
|
---|
259 | statusGroup->addSeparator();
|
---|
260 |
|
---|
261 | IconAction *statusOffline = new IconAction (status2txt(STATUS_OFFLINE), "status/offline", status2txt(STATUS_OFFLINE), 0, statusGroup, QString::number(STATUS_OFFLINE), statusExl);
|
---|
262 | statusOffline->setWhatsThis (setStatusStr.arg(tr("Offline")));
|
---|
263 |
|
---|
264 | ActionNames actions[] = {
|
---|
265 | { "status_all", statusGroup },
|
---|
266 | { "status_chat", statusChat },
|
---|
267 | { "status_online", statusOnline },
|
---|
268 | { "status_away", statusAway },
|
---|
269 | { "status_xa", statusXa },
|
---|
270 | { "status_dnd", statusDnd },
|
---|
271 | { "status_invisible", statusInvisible },
|
---|
272 | { "status_offline", statusOffline },
|
---|
273 | { "", 0 }
|
---|
274 | };
|
---|
275 |
|
---|
276 | createActionList( tr( "Status" ), Actions_MainWin, actions );
|
---|
277 | }
|
---|
278 |
|
---|
279 | {
|
---|
280 | IconAction *actReadme = new IconAction (tr("ReadMe"), tr("&ReadMe"), 0, this);
|
---|
281 | actReadme->setWhatsThis (tr("Show Read Me file"));
|
---|
282 |
|
---|
283 | IconAction *actTip = new IconAction (tr("Tip of the Day"), "psi/tip", tr("&Tip of the Day"), 0, this);
|
---|
284 | actTip->setWhatsThis (tr("See many useful tips"));
|
---|
285 |
|
---|
286 | IconAction *actOnlineHelp = new IconAction (tr("User Guide (Online)"), tr("&User Guide (Online)"), 0, this);
|
---|
287 | actOnlineHelp->setWhatsThis (tr("User Guide (Online)"));
|
---|
288 |
|
---|
289 | IconAction *actOnlineWiki = new IconAction (tr("Wiki (Online)"), tr("&Wiki (Online)"), 0, this);
|
---|
290 | actOnlineWiki->setWhatsThis (tr("Wiki (Online)"));
|
---|
291 |
|
---|
292 | IconAction *actOnlineHome = new IconAction (tr("Home Page (Online)"), tr("&Home Page (Online)"), 0, this);
|
---|
293 | actOnlineHome->setWhatsThis (tr("Home Page (Online)"));
|
---|
294 |
|
---|
295 | IconAction *actBugReport = new IconAction (tr("Report a Bug (Online)"), tr("Report a &Bug (Online)"), 0, this);
|
---|
296 | actBugReport->setWhatsThis (tr("Report a Bug (Online)"));
|
---|
297 |
|
---|
298 | IconAction *actAbout = new IconAction (tr("About"), "psi/psi16", tr("&About"), 0, this);
|
---|
299 |
|
---|
300 | IconAction *actAboutQt = new IconAction (tr("About Qt"), tr("About &Qt"), 0, this);
|
---|
301 |
|
---|
302 | ActionNames actions[] = {
|
---|
303 | { "help_readme", actReadme },
|
---|
304 | { "help_tip", actTip },
|
---|
305 | { "help_online_help", actOnlineHelp },
|
---|
306 | { "help_online_wiki", actOnlineWiki },
|
---|
307 | { "help_online_home", actOnlineHome },
|
---|
308 | { "help_report_bug", actBugReport },
|
---|
309 | { "help_about", actAbout },
|
---|
310 | { "help_about_qt", actAboutQt },
|
---|
311 | { "", 0 }
|
---|
312 | };
|
---|
313 |
|
---|
314 | createActionList( tr( "Help" ), Actions_MainWin, actions );
|
---|
315 | }
|
---|
316 | }
|
---|
317 |
|
---|
318 | void PsiActionList::Private::createMessageChatGroupchat()
|
---|
319 | {
|
---|
320 | }
|
---|
321 |
|
---|
322 | void PsiActionList::Private::createMessageChat()
|
---|
323 | {
|
---|
324 | }
|
---|
325 |
|
---|
326 | void PsiActionList::Private::createChatGroupchat()
|
---|
327 | {
|
---|
328 | }
|
---|
329 |
|
---|
330 | void PsiActionList::Private::createMessage()
|
---|
331 | {
|
---|
332 | }
|
---|
333 |
|
---|
334 | void PsiActionList::Private::createChat()
|
---|
335 | {
|
---|
336 | }
|
---|
337 |
|
---|
338 | void PsiActionList::Private::createGroupchat()
|
---|
339 | {
|
---|
340 | }
|
---|
341 |
|
---|
342 | //----------------------------------------------------------------------------
|
---|
343 | // PsiActionList
|
---|
344 | //----------------------------------------------------------------------------
|
---|
345 |
|
---|
346 | PsiActionList::PsiActionList( PsiCon *psi )
|
---|
347 | {
|
---|
348 | d = new Private( this, psi );
|
---|
349 | }
|
---|
350 |
|
---|
351 | PsiActionList::~PsiActionList()
|
---|
352 | {
|
---|
353 | delete d;
|
---|
354 | }
|
---|
355 |
|
---|
356 | #include "psiactionlist.moc"
|
---|