dockBuddiesList.h
1 //------------------------------------------------------------------------------
2 // dockBuddiesList.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) 2009 Braden "Blzut3" Obrzut <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 
24 #ifndef __DOCKBUDDIESLIST_H__
25 #define __DOCKBUDDIESLIST_H__
26 
27 #include "dptr.h"
28 #include "serverapi/serverptr.h"
29 
30 #include <QDialog>
31 #include <QDockWidget>
32 
33 class MasterManager;
34 class Pattern;
35 class Player;
36 class QAbstractButton;
37 class QModelIndex;
38 
39 class DockBuddiesList : public QDockWidget
40 {
41  Q_OBJECT
42 
43 public:
44  enum ColumnId
45  {
46  BLCID_ID,
47  BLCID_BUDDY,
48  BLCID_LOCATION,
49 
50  HOW_MANY_BUDDIESLIST_COLUMNS
51  };
52 
53  DockBuddiesList(QWidget *parent = nullptr);
54  ~DockBuddiesList() override;
55 
56  bool hasBuddy(const ServerPtr &server) const;
57  bool isBuddy(const Player &player) const;
58 
59 public slots:
60  void addBuddy();
61  void scan(const MasterManager *master = nullptr);
62 
63 signals:
64  void joinServer(const ServerPtr &server);
65  void scanCompleted();
66 
67 protected slots:
68  void deleteBuddy();
69  void followBuddy(const QModelIndex &index);
70  void patternsListContextMenu(const QPoint &pos) const;
71 
72 private:
74 
75  const MasterManager *masterClient;
76  bool save;
77 };
78 
79 class AddBuddyDlg : public QDialog
80 {
81  Q_OBJECT
82 
83 public:
84  AddBuddyDlg(QWidget *parent = nullptr);
85  ~AddBuddyDlg() override;
86 
87  Pattern pattern() const;
88 
89 protected slots:
90  void buttonBoxClicked(QAbstractButton *button);
91 
92 private:
94 
95 private slots:
96  void updateTip();
97 };
98 
99 #endif /* __DOCKBUDDIESLIST_H__ */