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 wxPanel;
28class wxStaticText;
29class wxTextCtrl;
30class wxRadioButton;
31
32namespace cloud::audiocom
33{
34class UserImage;
35
36struct UploadFailedPayload;
37struct UploadSuccessfulPayload;
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
52 wxString ExportProject();
53
54 void StartUploadProcess();
56 void HandleUploadFailed(const UploadFailedPayload& payload);
58
59 void ResetProgress();
60 void UpdateProgress(uint64_t current, uint64_t total);
61
63
64 struct InitialStatePanel final
65 {
67
69
70 wxWindow* root { nullptr };
71
72 UserImage* avatar { nullptr };
73 wxStaticText* name { nullptr };
74 wxButton* oauthButton { nullptr };
75 wxPanel* anonInfoPanel { nullptr };
76 wxPanel* authorizedInfoPanel { nullptr };
77 wxTextCtrl* trackTitle { nullptr };
78
80
82
83 void UpdateUserData();
85
86 void SetAnonymousState();
87
88 wxString GetTrackTitle() const;
89 bool HasValidTitle() const;
91
92 struct ProgressPanel final
93 {
94 wxWindow* root { nullptr };
95
96 wxStaticText* title { nullptr };
97 wxGauge* progress { nullptr };
98
99 wxWindow* timePanel { nullptr };
100 wxStaticText* elapsedTime { nullptr };
101 wxStaticText* remainingTime { nullptr };
102
103 wxStaticText* info { nullptr };
104
106
108
109 wxButton* mContinueButton { nullptr };
110 wxButton* mCancelButton { nullptr };
111
112 struct Services;
113 std::unique_ptr<Services> mServices;
114
116 std::unique_ptr<ExportProgressUpdater> mExportProgressUpdater;
117
118 using Clock = std::chrono::steady_clock;
119
120 Clock::time_point mStageStartTime;
121 Clock::time_point mLastUIUpdateTime;
123
124 wxString mFilePath;
125
126 std::function<void()> mContinueAction;
127
128 bool mIsAuthorised { false };
129 bool mInProgress { false };
130};
131} // namespace cloud::audiocom
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
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:630
std::unique_ptr< ExportProgressUpdater > mExportProgressUpdater
void UpdateProgress(uint64_t current, uint64_t total)
void HandleUploadFailed(const UploadFailedPayload &payload)
struct cloud::audiocom::ShareAudioDialog::InitialStatePanel mInitialStatePanel
ShareAudioDialog(AudacityProject &project, wxWindow *parent=nullptr)
struct cloud::audiocom::ShareAudioDialog::ProgressPanel mProgressPanel
void HandleUploadSucceeded(const UploadSuccessfulPayload &payload)
std::function< void()> mContinueAction
std::chrono::steady_clock Clock
std::unique_ptr< Services > mServices
This structure represents an upload error as returned by the server.
Definition: UploadService.h:28
This structure represents the payload associated with successful upload.
Definition: UploadService.h:41