summaryrefslogtreecommitdiffstats
path: root/bibletime/frontend/cswordsetupdialog.h
blob: 612e91e945bdea7e09a48aa64bbbfb71f261dc33 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2006 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/



#ifndef CSWORDSETUPDIALOG_H
#define CSWORDSETUPDIALOG_H

#include "cbtconfig.h"
#include "util/cpointers.h"
#include "btinstallmgr.h"

//QT includes
#include <tqstring.h>
#include <tqmap.h>

//KDE includes
#include <kdialogbase.h>

class TQWidget;
class TQLabel;
class TQComboBox;
class TQWidgetStack;
class TQButton;
class TQPushButton;
class TQLineEdit;
class TQListView;

class KProgressDialog;

namespace BookshelfManager {

	class CSwordSetupModuleListView;

	/**
	 * The Sword configuration dialog of BibleTime
	  * @author The BibleTime Team
	  */
class CSwordSetupDialog : public KDialogBase, public CPointers  {
		Q_OBJECT

public:
		CSwordSetupDialog(TQWidget *parent=0, const char *name=0);

		enum Parts {
			Sword,
			Install,
			Remove
		};

		/** Opens the page which contaisn the given part ID. */
		const bool showPart( CSwordSetupDialog::Parts ID );

private:
		void initSwordConfig();
		void initInstall();
		void initRemove();
		void initManageIndices();

		void writeSwordConfig();

		void setupSwordPathListBox();
		void populateInstallCombos();

		const TQString currentInstallSource();

		TQFrame* m_swordConfigPage;
		TQListView* m_swordPathListBox;
		TQPushButton* m_swordEditPathButton;
		TQPushButton* m_swordAddPathButton;
		TQPushButton* m_swordRemovePathButton;
		TQStringList m_swordPathList;
		bool m_swordSetupChanged;

		TQFrame* m_removePage;
		TQFrame* m_manageIndiciesPage;

		TQFrame* m_installPage;
		TQWidgetStack* m_installWidgetStack;

		TQString source;
		TQString target;

		TQLabel* m_sourceLabel;
		TQLabel* m_targetLabel;
		TQComboBox* m_sourceCombo;
		TQComboBox* m_targetCombo;

		TQMap<TQString, TQString> m_targetMap;

		CSwordSetupModuleListView* m_removeModuleListView;
		TQPushButton* m_removeRemoveButton;

		const bool refreshRemoteModuleCache( const TQString& sourceName );
		void populateRemoveModuleListView();
		bool populateInstallModuleListView(const TQString& sourceName);

		//install module stuff
		TQPushButton* m_installBackButton;
		TQPushButton* m_installContinueButton;

		TQWidget* m_installModuleListPage;
		TQWidget* m_installSourcePage;

		CSwordSetupModuleListView* m_installModuleListView;
		KProgressDialog* m_progressDialog;
		TQString m_installingModule;
		bool m_refreshedRemoteSources;
		unsigned int m_installedModuleCount;

		BTInstallMgr* m_currentInstallMgr; //pointer to the current installmgr object so we can access it in the cancel install slot

private slots:
		void slot_sourceSelected(const TQString &sourceName);
		void slot_targetSelected(const TQString &targetName);

		void slot_doRemoveModules();

		void slotOk();

		void slot_connectToSource();
		void slot_moduleRefreshProgressCancelClicked();
		void slot_moduleRefreshCompleted(const int, const int);

		void slot_installAddSource();
		void slot_installDeleteSource();
		void slot_installModules();
		void slot_installModulesChanged();
		void slot_installProgressCancelClicked();
		void slot_showInstallSourcePage();

		void installCompleted( const int, const int );
		void slot_swordRemoveClicked();
		void slot_swordAddClicked();
		void slot_swordEditClicked();
		void slot_swordPathSelected();

signals: // Signals
		void signalSwordSetupChanged();
	};

}

#endif //CSWORDSETUPDIALOG_H