serverlistcontextmenu.h
1 //------------------------------------------------------------------------------
2 // serverlistcontextmenu.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; 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 <QList>
28 #include "serverapi/serverptr.h"
29 #include "dptr.h"
30 
31 class Server;
34 class ServerList;
35 class QAction;
36 class QMenu;
37 class QModelIndex;
38 class QPoint;
39 
40 class ServerListContextMenu : public QObject
41 {
42  Q_OBJECT
43 
44  public:
45  enum Result
46  {
49 
50  Join,
51  OpenRemoteConsole,
52  OpenURL,
53  Refresh,
54  ShowJoinCommandLine,
55  SortAdditionallyAscending,
56  SortAdditionallyDescending,
57  ClearAdditionalSorting,
58  RemoveAdditionalSortingForColumn,
59  FindMissingWADs,
60  TogglePinServers,
61 
64  };
65 
66  ServerListContextMenu(ServerPtr serverAtIndex,
67  const ServerListFilterInfo& filter,
68  const QModelIndex &modelIndex,
69  const QList<ServerPtr> &servers,
70  ServerList *parent);
72 
73  const QModelIndex &modelIndex() const;
74  void popup(const QPoint& point);
75  ServerPtr server() const;
76  const QList<ServerPtr> &servers() const;
77  const ServerListFilterInfo& serverFilter() const;
78  Result translateQMenuResult(QAction* resultAction);
79 
80  signals:
81  void aboutToHide();
82  void triggered(QAction* action);
83 
84  private:
86 
87  QMenu* createCopyMenu(QWidget* parent);
88  void createMembers();
89  void initializeMembers();
90 };
91 
92 #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.