summaryrefslogtreecommitdiff
path: root/apps/windoze/CBuilder4/InstallMgr/MainFrm.h
blob: a6f7cd872af61025b708256321d4afa886da18d0 (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
//---------------------------------------------------------------------------
#ifndef MainFrmH
#define MainFrmH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
#include <Menus.hpp>
#include <ExtCtrls.hpp>
#include <MPlayer.hpp>
#include <Graphics.hpp>
#include <ComCtrls.hpp>
#include <swmgr.h>
#include <ImgList.hpp>
#include <Buttons.hpp>
#include <NMFtp.hpp>
#include <NMHttp.hpp>
#include <Psock.hpp>


class VersionInfo {
	public:
	int major, minor, minor2, minor3;
	
	VersionInfo(const char *version);
	int compare(const VersionInfo &vi) const;
	bool operator>(const VersionInfo &vi) const {return (compare(vi) > 0);}
	bool operator<(const VersionInfo &vi) const {return (compare(vi) < 0);}
	bool operator==(const VersionInfo &vi) const {return (compare(vi) == 0);}
};
		

class InstallSourceTab : public TControl {
public:
	__fastcall InstallSourceTab(TComponent *Owner, const char *confEnt, const char *type);
	__fastcall ~InstallSourceTab();
	string Type;
	string Source;
	string Directory;
	string Caption;
	TTreeView *tree;
	SWMgr *mgr;
};


//---------------------------------------------------------------------------
class TMainForm : public TForm
{
	class TWebThread;
	friend class TWebThread;
__published:	// IDE-managed Components
	TMainMenu *MainMenu1;
	TMenuItem *File1;
	TMenuItem *Exit1;
	TMenuItem *Option1;
	TMenuItem *LocalPath1;
	TOpenDialog *localPathDlg;
	TPanel *Panel1;
	TMediaPlayer *MediaPlayer1;
	TImage *Image1;
	TPanel *pnlAvailable;
	TPanel *pnlInstalled;
	TSplitter *Splitter1;
	TPanel *Panel2;
	TPanel *Panel5;
	TPageControl *PageControl1;
	TTabSheet *TabSheet1;
	TTreeView *localTree;
	TPanel *Panel8;
	TPanel *Panel7;
	TPanel *Panel6;
	TTreeView *installTree;
	TTimer *Timer1;
	TLabel *Label1;
	TImageList *ImageList1;
	TPanel *Panel3;
	TImageList *ImageList2;
	TPanel *statusBar;
	TPanel *Panel4;
	TProgressBar *progressBar;
	TSpeedButton *SpeedButton2;
	TImage *Image2;
	TLabel *Label2;
	TMenuItem *ManageRemoteSources1;
	TSpeedButton *SpeedButton1;
	TSpeedButton *SpeedButton3;
	TSpeedButton *SpeedButton4;
	TSpeedButton *SpeedButton5;
	TSpeedButton *SpeedButton6;
	TSpeedButton *SpeedButton7;
	void __fastcall LocalPath1Click(TObject *Sender);
	void __fastcall FormCreate(TObject *Sender);
	void __fastcall Button5Click(TObject *Sender);
	void __fastcall localTreeDblClick(TObject *Sender);
	void __fastcall Button6Click(TObject *Sender);
	void __fastcall Image1Click(TObject *Sender);
	void __fastcall Button4Click(TObject *Sender);
	void __fastcall Button2Click(TObject *Sender);
	void __fastcall SpeedButton1Click(TObject *Sender);
	void __fastcall SpeedButton5Click(TObject *Sender);
	void __fastcall Exit1Click(TObject *Sender);
	void __fastcall FormShow(TObject *Sender);

private:	// User declarations

	SWMgr *manager;
	SWConfig *installConf;
	const char *getLocalDir();
	void setLocalDir(const char *idir);
	void refreshPageControl();
	void addSource(InstallSourceTab *ist);
	void	fillAllSourceTrees();
	void deleteAllModules();
	
public:		// User declarations
	__fastcall TMainForm(TComponent* Owner);
	__fastcall ~TMainForm();
	void __fastcall RefreshRemoteSource(TObject *Sender);
	int selectAll(TTreeView *tree, bool sel);
	int removeModule(const char *modName);
	int installModule(const char *modName, InstallSourceTab *ist = 0);
	static int createParent(const char *pName);
	int createPathAndFile(const char *fName);
	int copyFile(const char *sourceFile, const char *targetFile);
	int copyFileToCWD(const char *sourceDir, const char *fName);
	int FTPCopy(InstallSourceTab *ist, const char *src, const char *dest, bool dirTransfer = false);
	SWMgr *localMgr;

protected:
	virtual void fillInstallTree();
	virtual void fillSourceTree(const char *sourceConf, TTreeView *tree);
};

//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif