wadseekersitestable.h
1 //------------------------------------------------------------------------------
2 // wadseekersitestable.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) 2011 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __WADSEEKERSITESTABLE_H__
24 #define __WADSEEKERSITESTABLE_H__
25 
26 #include <QSignalMapper>
27 #include "gui/widgets/tablewidgetmouseaware.h"
28 
30 {
31  Q_OBJECT;
32 
33  public:
34  static const int IDX_URL_COLUMN = 0;
35  static const int IDX_PROGRESS_COLUMN = 1;
36  static const int IDX_ABORT_COLUMN = 2;
37 
38  WadseekerSitesTable(QWidget* pParent = NULL);
39 
40  void addUrl(const QUrl& url);
41  void removeUrl(const QUrl& url);
42 
43  public slots:
44  void addService(const QString &service);
45  void removeService(const QString &service);
46  void setUrlProgress(const QUrl& url, qint64 current, qint64 total);
47 
48  signals:
49  void serviceAbortRequested(const QString &service);
50  void urlAbortRequested(const QUrl &url);
51 
52  protected:
53  void showEvent(QShowEvent* pEvent);
54 
55  private:
56  class PrivData
57  {
58  public:
59  bool bAlreadyShownOnce;
60  QSignalMapper serviceAborter;
61  QSignalMapper urlAborter;
62  };
63 
64  PrivData d;
65 
66  int findRow(const QString &text);
67  int findRow(const QUrl &url);
68 
69  private slots:
70  void requestUrlAbort(const QString &urlAsString);
71 };
72 
73 #endif