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