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 QAbstractButton;
36 class QModelIndex;
37 
38 class DockBuddiesList : public QDockWidget
39 {
40  Q_OBJECT
41 
42 public:
43  enum ColumnId
44  {
45  BLCID_ID,
46  BLCID_BUDDY,
47  BLCID_LOCATION,
48 
49  HOW_MANY_BUDDIESLIST_COLUMNS
50  };
51 
52  DockBuddiesList(QWidget *parent = nullptr);
53  ~DockBuddiesList() override;
54 
55  bool hasBuddy(const ServerPtr &server);
56 
57 public slots:
58  void addBuddy();
59  void scan(const MasterManager *master = nullptr);
60 
61 signals:
62  void joinServer(const ServerPtr &server);
63  void scanCompleted();
64 
65 protected slots:
66  void deleteBuddy();
67  void followBuddy(const QModelIndex &index);
68  void patternsListContextMenu(const QPoint &pos) const;
69 
70 private:
72 
73  const MasterManager *masterClient;
74  bool save;
75 };
76 
77 class AddBuddyDlg : public QDialog
78 {
79  Q_OBJECT
80 
81 public:
82  AddBuddyDlg(QWidget *parent = nullptr);
83  ~AddBuddyDlg() override;
84 
85  Pattern pattern() const;
86 
87 protected slots:
88  void buttonBoxClicked(QAbstractButton *button);
89 
90 private:
92 
93 private slots:
94  void updateTip();
95 };
96 
97 #endif /* __DOCKBUDDIESLIST_H__ */