serverlistcontextmenu.h
1 //------------------------------------------------------------------------------
2 // serverlistcontextmenu.h
3 //------------------------------------------------------------------------------
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 program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __SERVER_LIST_CONTEXT_MENU_H_
24 #define __SERVER_LIST_CONTEXT_MENU_H_
25 
26 #include <QObject>
27 #include "serverapi/serverptr.h"
28 #include "dptr.h"
29 
30 class Server;
33 class ServerListHandler;
34 class QAction;
35 class QMenu;
36 class QModelIndex;
37 class QPoint;
38 
39 class ServerListContextMenu : public QObject
40 {
41  Q_OBJECT
42 
43  public:
44  enum Result
45  {
48  Join,
49  OpenRemoteConsole,
50  OpenURL,
51  Refresh,
52  ShowJoinCommandLine,
53  SortAdditionallyAscending,
54  SortAdditionallyDescending,
55  ClearAdditionalSorting,
56  RemoveAdditionalSortingForColumn,
57  FindMissingWADs,
58 
61  };
62 
63  ServerListContextMenu(ServerPtr server, const ServerListFilterInfo& filter,
64  const QModelIndex &modelIndex, ServerListHandler *parent);
66 
67  const QModelIndex &modelIndex() const;
68  void popup(const QPoint& point);
69  ServerPtr server() const;
70  const ServerListFilterInfo& serverFilter() const;
71  Result translateQMenuResult(QAction* resultAction);
72 
73  signals:
74  void aboutToHide();
75  void triggered(QAction* action);
76 
77  private:
79 
80  QMenu* createCopyMenu(QWidget* parent);
81  void createMembers();
82  void initializeMembers();
83 };
84 
85 #endif
Structure describing server filter.
A representation of a server for a given game.
Definition: server.h:93
This is returned when something was copied to clipboard.