~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/kvirc/kernel/KviActionManager.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _KVI_ACTIONMANAGER_H_
 
2
#define _KVI_ACTIONMANAGER_H_
 
3
//=============================================================================
 
4
//
 
5
//   File : KviActionManager.h
 
6
//   Creation date : Sun 21 Nov 2004 03:37:57 by Szymon Stefanek
 
7
//
 
8
//   This file is part of the KVIrc IRC Client distribution
 
9
//   Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net>
 
10
//
 
11
//   This program is FREE software. You can redistribute it and/or
 
12
//   modify it under the terms of the GNU General Public License
 
13
//   as published by the Free Software Foundation; either version 2
 
14
//   of the License, or (at your opinion) any later version.
 
15
//
 
16
//   This program is distributed in the HOPE that it will be USEFUL,
 
17
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
19
//   See the GNU General Public License for more details.
 
20
//
 
21
//   You should have received a copy of the GNU General Public License
 
22
//   along with this program. If not, write to the Free Software Foundation,
 
23
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
24
//
 
25
//=============================================================================
 
26
 
 
27
#include "kvi_settings.h"
 
28
#include "KviAction.h"
 
29
#include "KviPointerHashTable.h"
 
30
 
 
31
#include <QObject>
 
32
 
 
33
class KviActionDrawer;
 
34
class KviCustomToolBar;
 
35
 
 
36
class KVIRC_API KviActionManager : public QObject
 
37
{
 
38
        friend class KviActionDrawer;
 
39
        friend class CustomizeToolBarsDialog; // this resides in a module!
 
40
        friend class KviCustomToolBar;
 
41
        friend class KviMainWindow;
 
42
        Q_OBJECT
 
43
public:
 
44
        KviActionManager();
 
45
        ~KviActionManager();
 
46
protected:
 
47
        static KviActionManager * m_pInstance;
 
48
        KviPointerHashTable<QString,KviAction> * m_pActions;
 
49
        KviPointerHashTable<QString,KviActionCategory> * m_pCategories;
 
50
        static bool m_bCustomizingToolBars;
 
51
 
 
52
        // action categories
 
53
        static KviActionCategory * m_pCategoryIrc;
 
54
        static KviActionCategory * m_pCategoryGeneric;
 
55
        static KviActionCategory * m_pCategorySettings;
 
56
        static KviActionCategory * m_pCategoryScripting;
 
57
        static KviActionCategory * m_pCategoryGUI;
 
58
        static KviActionCategory * m_pCategoryChannel;
 
59
        static KviActionCategory * m_pCategoryTools;
 
60
        // internal, current toolbar to be edited (only when customizing)
 
61
        static KviCustomToolBar * m_pCurrentToolBar;
 
62
        bool m_bCoreActionsRegistered;
 
63
public:
 
64
        static void init();
 
65
        static void done();
 
66
        static KviActionManager * instance(){ return m_pInstance; };
 
67
        static void loadAllAvailableActions();
 
68
        static bool customizingToolBars(){ return m_bCustomizingToolBars; };
 
69
        static KviActionCategory * categoryIrc(){ return m_pCategoryIrc; };
 
70
        static KviActionCategory * categoryGeneric(){ return m_pCategoryGeneric; };
 
71
        static KviActionCategory * categorySettings(){ return m_pCategorySettings; };
 
72
        static KviActionCategory * categoryScripting(){ return m_pCategoryScripting; };
 
73
        static KviActionCategory * categoryGUI(){ return m_pCategoryGUI; };
 
74
        static KviActionCategory * categoryChannel(){ return m_pCategoryChannel; };
 
75
        static KviActionCategory * categoryTools(){ return m_pCategoryTools; };
 
76
 
 
77
        KviPointerHashTable<QString,KviAction> * actions(){ return m_pActions; };
 
78
        KviActionCategory * category(const QString &szName);
 
79
        KviPointerHashTable<QString,KviActionCategory> * categories(){ return m_pCategories; };
 
80
 
 
81
        void killAllKvsUserActions();
 
82
 
 
83
        static KviCustomToolBar * currentToolBar(){ return m_pCurrentToolBar; };
 
84
        KviAction * getAction(const QString &szName);
 
85
        void listActionsByCategory(const QString &szCatName,KviPointerList<KviAction> * pBuffer);
 
86
        QString nameForAutomaticAction(const QString &szTemplate);
 
87
        bool coreActionExists(const QString &szName);
 
88
 
 
89
        void load(const QString &szFileName);
 
90
        void save(const QString &szFileName);
 
91
 
 
92
        bool registerAction(KviAction * a);
 
93
        bool unregisterAction(const QString &szName);
 
94
 
 
95
        void emitRemoveActionsHintRequest();
 
96
protected:
 
97
        void setCurrentToolBar(KviCustomToolBar * t);
 
98
        KviAction * findAction(const QString &szName){ return m_pActions->find(szName); };
 
99
        void customizeToolBarsDialogCreated();
 
100
        void customizeToolBarsDialogDestroyed();
 
101
        void tryFindCurrentToolBar();
 
102
        void delayedRegisterAccelerators(); // this is called ONCE by KviMainWindow, at startup
 
103
protected slots:
 
104
        void actionDestroyed();
 
105
signals:
 
106
        void beginCustomizeToolBars();
 
107
        void endCustomizeToolBars();
 
108
        void currentToolBarChanged(); // emitted only when customizing!
 
109
        void removeActionsHintRequest(); // connected by the KviCustomToolBarDialog to flash the trashcan
 
110
                                         // when the user tries to remove an action from the toolbar
 
111
                                         // and it fails to drag it on the trashcan
 
112
};
 
113
 
 
114
#define ACTION_POPUP_ITEM(__name,__popup) \
 
115
        { KviAction * a = KviActionManager::instance()->getAction(__name); if(a)a->addToPopupMenu(__popup); }
 
116
 
 
117
 
 
118
#endif //!_KVI_ACTIONMANAGER_H_