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
|
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//---------------------------------------------------------------------------
#ifndef GUI_PluginH
#define GUI_PluginH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <ComCtrls.hpp>
#include <Controls.hpp>
#include <ImgList.hpp>
#include <StdCtrls.hpp>
#include <ToolWin.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <StdCtrls.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <ZenLib/Ztring.h>
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
enum plugin {
PLUGIN_GRAPH = 0,
PLUGIN_FFMPEG,
PLUGIN_MAX
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class TPluginF;
//---------------------------------------------------------------------------
//***************************************************************************
// DownloadInstallerThread Class
//***************************************************************************
class DownloadInstallerThread :public TThread
{
public:
__fastcall DownloadInstallerThread(TPluginF* Parent, ZenLib::Ztring Url, ZenLib::Ztring Dst);
void __fastcall Execute();
void __fastcall Error();
void __fastcall Finalize();
void __fastcall UpdateDownloadProgress();
void __fastcall OnReceiveData(TObject* const Sender, __int64 AContentLength, __int64 AReadCount, bool& Abort);
void __fastcall OnRequestError(TObject* const Sender, System::UnicodeString Message) { Synchronize(&Error); };
private:
TPluginF* Parent;
float Progress;
ZenLib::Ztring Url;
ZenLib::Ztring Dst;
};
//***************************************************************************
// RunInstallerThread Class
//***************************************************************************
class RunInstallerThread :public TThread
{
public:
__fastcall RunInstallerThread(TPluginF* Parent, ZenLib::Ztring Installer, ZenLib::Ztring Parameters);
void __fastcall Execute();
void __fastcall Error();
void __fastcall Finalize();
private:
TPluginF* Parent;
ZenLib::Ztring Installer;
ZenLib::Ztring Parameters;
};
//***************************************************************************
// Class
//***************************************************************************
class TPluginF : public TForm
{
__published: // IDE-managed Components
TLabel* InfoLabel;
TLabel* NameLabel;
TLabel* AskLabel;
TLabel* DownloadLabel;
TLabel* InstallLabel;
TButton* Cancel;
TButton* Install;
void __fastcall FormShow(TObject* Sender);
void __fastcall CancelClick(TObject* Sender);
void __fastcall InstallClick(TObject* Sender);
public: // User declarations
__fastcall TPluginF(TComponent* Owner, plugin Plugin);
bool __fastcall Configure(bool Update=false);
void __fastcall DownloadInstaller();
void __fastcall RunInstaller();
void __fastcall Error();
void __fastcall FinalizeDownload();
void __fastcall FinalizeInstall();
private: // User declarations
plugin Plugin;
ZenLib::Ztring InstallFolder;
ZenLib::Ztring SourceURL;
ZenLib::Ztring TempPath;
DownloadInstallerThread* DownloadThread;
RunInstallerThread* RunThread;
};
//---------------------------------------------------------------------------
extern PACKAGE TPluginF *PluginF;
//---------------------------------------------------------------------------
#endif
|