summaryrefslogtreecommitdiff
path: root/src/frontend/bookshelfmanager/installpage/btsourcewidget.h
blob: fbe842601571ded156821850467cb74fd6275587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2008 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
#ifndef BTSOURCEWIDGET_H
#define BTSOURCEWIDGET_H

#include <QTabWidget>

#include <QMap>
#include <QString>


class BtInstallMgr;
class BtInstallPage;
class BtSourceArea;
class CSwordModuleInfo;
class QProgressDialog;
class QTreeWidget;

/**
* Tabwidget which holds the source widgets.
* This widget implements the slots for the source action buttons and
* applies the actions to the proper source(s).
*/
class BtSourceWidget : public QTabWidget {
        Q_OBJECT
    public:
        friend class BtInstallPage;

        BtSourceWidget(BtInstallPage* parent);
        virtual ~BtSourceWidget() {}

        BtSourceArea* area();
        QString currentSourceName();

    public slots:
        /** Install button has been clicked. */
        void slotInstall();
        /** "Stop All" button clicked */
        void slotStopInstall(QTreeWidget* treeWidget);

    private:
        void initSourceConnections();

        /** Add one source to tabs/stack. */
        void addSource(const QString& sourceName);

    private slots:
        /** Add tabs/views for each source. */
        void initSources();

        void slotRefresh();

        void slotRefreshCanceled();

        void slotRefreshCompleted(int, int);

        /** Edit button clicked. */
        void slotEdit();
        /** Delete button clicked. */
        void slotDelete();
        /** Add button clicked. */
        void slotAdd();
        /** Modules have been checked/unchecked in the view. */
        void slotModuleSelectionChanged(QString sourceName, int selectedCount);

        void slotTabSelected(int index);
        void slotInstallAccepted(QList<CSwordModuleInfo*> mi, QTreeWidget* treeWidget);

    signals:
        void sigInitSources();

    private:
        QStringList m_sourceNameList;
        BtInstallPage* m_page;
        QProgressDialog* m_progressDialog; // for refreshing
        BtInstallMgr* m_currentInstallMgr; // for refreshing
        QMap<QString, int> m_selectedModulesCountMap;
};

#endif