1 /***************************************************************************
2 *                                                                         *
3 *   This program is free software; you can redistribute it and/or modify  *
4 *   it under the terms of the GNU General Public License as published by  *
5 *   the Free Software Foundation; either version 3 of the License, or     *
6 *   (at your option) any later version.                                   *
7 *                                                                         *
8 ***************************************************************************/
9 
10 #pragma once
11 
12 #include <QWidget>
13 #include <QCloseEvent>
14 
15 #include "dcpp/stdinc.h"
16 #include "dcpp/ClientManager.h"
17 #include "dcpp/Singleton.h"
18 
19 #include "WulforUtil.h"
20 #include "ArenaWidget.h"
21 #include "ui_UISpy.h"
22 
23 class SpyModel;
24 
25 class SpyFrame :
26         public QWidget,
27         public ArenaWidget,
28         public dcpp::Singleton<SpyFrame>,
29         private dcpp::ClientManagerListener,
30         private Ui::UISpy
31 {
32 Q_OBJECT
33 Q_INTERFACES(ArenaWidget)
34 
35 friend class dcpp::Singleton<SpyFrame>;
36 
37 public:
38 
getArenaShortTitle()39     QString getArenaShortTitle() { return tr("Search Spy"); }
getArenaTitle()40     QString getArenaTitle() {return getArenaShortTitle(); }
getMenu()41     QMenu *getMenu() {return NULL; }
getWidget()42     QWidget *getWidget() { return this; }
getPixmap()43     const QPixmap &getPixmap(){ return WICON(WulforUtil::eiSPY); }
role()44     ArenaWidget::Role role() const { return ArenaWidget::Spy; }
45 
46 protected:
47     virtual void closeEvent(QCloseEvent *);
48 
49 private Q_SLOTS:
50     void slotStartStop();
51     void slotClear();
52     void contextMenu();
53     void slotSettingsChanged(const QString&, const QString&);
54 
55 Q_SIGNALS:
56     void coreIncomingSearch(const QString&, bool);
57 
58 private:
59     explicit SpyFrame(QWidget *parent = 0);
60     ~SpyFrame();
61 
62     SpyModel *model;
63 
64     virtual void on(dcpp::ClientManagerListener::IncomingSearch, const std::string& s) noexcept;
65 };
66