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
16#include "wxPanelWrapper.h"
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;
29class wxRadioButton;
30
31namespace BasicUI
32{
33class ProgressDialog;
34}
35
36namespace cloud::audiocom
37{
38class UserImage;
39
40class ShareAudioDialog final :
41 public wxDialogWrapper
42{
43public:
44 ShareAudioDialog(AudacityProject& project, wxWindow* parent = nullptr);
45 ~ShareAudioDialog() override;
46
47private:
48 void Populate(ShuttleGui& s);
49
50 void OnCancel();
51 void OnContinue();
52 void OnClose();
53
54 wxString ExportProject();
55
56 void StartUploadProcess();
57 void HandleUploadSucceeded(std::string_view finishUploadURL, std::string_view audioSlug);
58 void HandleUploadFailed(std::string_view errorMessage);
60
61 void ResetProgress();
62 void UpdateProgress(uint64_t current, uint64_t total);
63
65
66 struct InitialStatePanel final
67 {
69
70 wxWindow* root { nullptr };
71
72 UserImage* avatar { nullptr };
73 wxStaticText* name { nullptr };
74 wxButton* oauthButton { nullptr };
75
76 wxRadioButton* isPublic { nullptr };
77
79
82
83 void UpdateUserData();
85
86 void SetAnonymousState();
87
89
90 struct ProgressPanel final
91 {
92 wxWindow* root { nullptr };
93
94 wxStaticText* title { nullptr };
95 wxGauge* progress { nullptr };
96
97 wxWindow* timePanel { nullptr };
98 wxStaticText* elapsedTime { nullptr };
99 wxStaticText* remainingTime { nullptr };
100
101 wxWindow* linkPanel { nullptr };
102 wxTextCtrl* link { nullptr };
103 wxButton* copyButton { nullptr };
104
105 wxStaticText* info { nullptr };
106
108
110
111 wxButton* mContinueButton { nullptr };
112 wxButton* mCancelButton { nullptr };
113 wxButton* mCloseButton { nullptr };
114 wxButton* mGotoButton { nullptr };
115
116 struct Services;
117 std::unique_ptr<Services> mServices;
118
120 std::unique_ptr<BasicUI::ProgressDialog> mExportProgressHelper;
121
122 using Clock = std::chrono::steady_clock;
123
124 Clock::time_point mStageStartTime;
125 Clock::time_point mLastUIUpdateTime;
127
128 wxString mFilePath;
129
130 std::function<void()> mContinueAction;
131
132 bool mInProgress { false };
133};
134} // 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:90
Abstraction of a progress dialog with well defined time-to-completion estimate.
Definition: BasicUI.h:156
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:625
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