OpenCPN Partial API docs
download_mgr.h
1 /******************************************************************************
2  *
3  * Project: OpenCPN
4  *
5  ***************************************************************************
6  * Copyright (C) 2019 Alec Leamas *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22  ***************************************************************************
23  */
24 
25 #ifndef DOWNLOAD_MGR_H__
26 #define DOWNLOAD_MGR_H__
27 
28 #include <wx/dialog.h>
29 #include <wx/progdlg.h>
30 #include <wx/window.h>
31 
32 #include "model/downloader.h"
33 #include "model/catalog_parser.h"
34 
35 // Accepted by PluginDownloadDialog, reloads plugin list.
36 wxDECLARE_EVENT(EVT_PLUGINS_RELOAD, wxCommandEvent);
37 
38 class PluginDownloadDialog : public wxDialog {
39 public:
40  PluginDownloadDialog(wxWindow* parent);
41 
42  wxWindow* GetRealParent() { return m_parent; }
43 };
44 
47 class GuiDownloader : public Downloader {
48 private:
49  long m_downloaded;
50  wxProgressDialog* m_dialog;
51  PluginMetadata m_plugin;
52  wxWindow* m_parent;
53 
54 public:
55  GuiDownloader(wxWindow* parent, PluginMetadata plugin);
56  std::string run(wxWindow* parent, bool remove_current);
57  void on_chunk(const char* buff, unsigned bytes) override;
58  void showErrorDialog(const char* msg);
59 };
60 
61 #endif // DOWNLOAD_MGR_H__
Handle downloading of files from remote urls.
Definition: downloader.h:34
Add progress and final message dialogs to the basic Downloader.
Definition: download_mgr.h:47
void on_chunk(const char *buff, unsigned bytes) override
Called when given bytes has been transferred from remote.
GuiDownloader(wxWindow *parent, PluginMetadata plugin)
Add progress and final message dialogs to the basic Downloader.
PluginDownloadDialog(wxWindow *parent)
Top-level install plugins dialog.
Plugin metadata, reflects the xml format directly.