Audacity 3.2.0
ShareAudioDialog.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 ShareAudioDialog.h
7
8 Dmitry Vedenko
9
10**********************************************************************/
11#pragma once
12
13#include <chrono>
14#include <memory>
15
17#include "Prefs.h"
18#include "Observer.h"
19
20class AudacityProject;
21
22class ShuttleGui;
23
24class wxBitmapButton;
25class wxButton;
26class wxGauge;
27class wxStaticText;
28class wxTextCtrl;
29
30namespace BasicUI
31{
32class ProgressDialog;
33}
34
35namespace cloud::audiocom
36{
37class UserImage;
38
39class ShareAudioDialog final :
40 public wxDialogWrapper
41{
42public:
43 ShareAudioDialog(AudacityProject& project, wxWindow* parent = nullptr);
44 ~ShareAudioDialog() override;
45
46private:
47 void Populate(ShuttleGui& s);
48
49 void OnCancel();
50 void OnContinue();
51 void OnClose();
52
53 wxString ExportProject();
54
55 void StartUploadProcess();
56 void HandleUploadSucceeded(std::string_view finishUploadURL, std::string_view audioSlug);
57 void HandleUploadFailed(std::string_view errorMessage);
59
60 void ResetProgress();
61 void UpdateProgress(uint64_t current, uint64_t total);
62
64
65 struct InitialStatePanel final
66 {
68
69 wxWindow* root { nullptr };
70
71 UserImage* avatar { nullptr };
72 wxStaticText* name { nullptr };
73 wxButton* oauthButton { nullptr };
74
76
79
80 void UpdateUserData();
82
84
85 struct ProgressPanel final
86 {
87 wxWindow* root { nullptr };
88
89 wxStaticText* title { nullptr };
90 wxGauge* progress { nullptr };
91
92 wxWindow* timePanel { nullptr };
93 wxStaticText* elapsedTime { nullptr };
94 wxStaticText* remainingTime { nullptr };
95
96 wxWindow* linkPanel { nullptr };
97 wxTextCtrl* link { nullptr };
98 wxButton* copyButton { nullptr };
99
100 wxStaticText* info { nullptr };
101
103
105
106 wxButton* mContinueButton { nullptr };
107 wxButton* mCancelButton { nullptr };
108 wxButton* mCloseButton { nullptr };
109 wxButton* mGotoButton { nullptr };
110
111 struct Services;
112 std::unique_ptr<Services> mServices;
113
115 std::unique_ptr<BasicUI::ProgressDialog> mExportProgressHelper;
116
117 using Clock = std::chrono::steady_clock;
118
119 Clock::time_point mStageStartTime;
120 Clock::time_point mLastUIUpdateTime;
122
123 wxString mFilePath;
124
125 std::function<void()> mContinueAction;
126
127 bool mInProgress { false };
128};
129} // namespace cloud::audiocom
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
Abstraction of a progress dialog with well defined time-to-completion estimate.
Definition: BasicUI.h:154
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
void HandleUploadFailed(std::string_view errorMessage)
void HandleUploadSucceeded(std::string_view finishUploadURL, std::string_view audioSlug)
void UpdateProgress(uint64_t current, uint64_t total)
struct cloud::audiocom::ShareAudioDialog::InitialStatePanel mInitialStatePanel
ShareAudioDialog(AudacityProject &project, wxWindow *parent=nullptr)
struct cloud::audiocom::ShareAudioDialog::ProgressPanel mProgressPanel
std::function< void()> mContinueAction
std::unique_ptr< BasicUI::ProgressDialog > mExportProgressHelper
std::chrono::steady_clock Clock
std::unique_ptr< Services > mServices