summaryrefslogtreecommitdiff
path: root/src/frontend/bookshelfmanager/installpage/btinstallpage.h
blob: 0cb6724fd62070379b3968e22ea0f35a3e1e9cef (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
87
88
89
90
91
92
93
94
95
96
97
98
99
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2011 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#ifndef BTINSTALLPAGE_H
#define BTINSTALLPAGE_H

#include "frontend/bookshelfmanager/btconfigdialog.h"

#include "backend/bookshelfmodel/btbookshelftreemodel.h"


namespace sword {
class InstallSource;
}

class BtInstallPageWorksWidget;
class BtModuleManagerDialog;
class QComboBox;
class QGroupBox;
class QLabel;
class QPushButton;
class QStackedLayout;
class QToolButton;

/**
* The Install page includes module path chooser, source/module handler and install button.
*/
class BtInstallPage: public BtConfigDialog::Page {

        Q_OBJECT

    public:

        BtInstallPage(BtModuleManagerDialog *parent = 0);

        void setInstallEnabled(bool b);

        QString selectedInstallPath();

    public slots:
        void slotSwordSetupChanged();

    protected:

        void retranslateUi();

    private:
        void initView();
        void initConnections();
        void initPathCombo();
        void initSourcesCombo();

        void activateSource(const sword::InstallSource &src);
        void retranslateInstallGroupBox();

    private slots:
        void slotGroupingOrderChanged(const BtBookshelfTreeModel::Grouping &g);
        void slotHeaderChanged();
        void slotInstall();
        void slotPathChanged(const QString& pathText);
        void slotEditPaths();
        void slotSourceAdd();
        void slotSourceDelete();
        void slotSourceIndexChanged(int index);
        void slotSelectedModulesChanged();

    private:
        BtBookshelfTreeModel::Grouping m_groupingOrder;
        QByteArray m_headerState;

        QMap<QString, BtInstallPageWorksWidget*> m_sourceMap;

        QLabel *m_warningLabel;

        QGroupBox *m_sourceGroupBox;
            QComboBox   *m_sourceComboBox;
            QPushButton *m_sourceAddButton;
            QPushButton *m_sourceDeleteButton;

        QGroupBox *m_worksGroupBox;
            QStackedLayout *m_worksLayout;

        QGroupBox *m_installGroupBox;
            QLabel      *m_pathLabel;
            QComboBox   *m_pathCombo;
            QToolButton *m_configurePathButton;
            QPushButton *m_installButton;

        unsigned m_modulesSelected;
        unsigned m_modulesSelectedSources;
};

#endif