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
33{
34class UserPanel;
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 UserPanel* userPanel { nullptr };
73 wxPanel* anonInfoPanel { nullptr };
74 wxPanel* authorizedInfoPanel { nullptr };
75 wxTextCtrl* trackTitle { nullptr };
76
78
80
81 void UpdateUserData(bool authorized);
82
83 wxString GetTrackTitle() const;
84 bool HasValidTitle() const;
86
87 struct ProgressPanel final
88 {
89 wxWindow* root { nullptr };
90
91 wxStaticText* title { nullptr };
92 wxGauge* progress { nullptr };
93
94 wxWindow* timePanel { nullptr };
95 wxStaticText* elapsedTime { nullptr };
96 wxStaticText* remainingTime { nullptr };
97
98 wxStaticText* info { nullptr };
99
101
103
104 wxButton* mContinueButton { nullptr };
105 wxButton* mCancelButton { nullptr };
106
107 struct Services;
108 std::unique_ptr<Services> mServices;
109
111 std::unique_ptr<ExportProgressUpdater> mExportProgressUpdater;
112
113 using Clock = std::chrono::steady_clock;
114
115 Clock::time_point mStageStartTime;
116 Clock::time_point mLastUIUpdateTime;
118
119 wxString mFilePath;
120
121 std::function<void()> mContinueAction;
122
123 bool mIsAuthorised { false };
124 bool mInProgress { false };
125};
126} // namespace audacity::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:640
ShareAudioDialog(AudacityProject &project, wxWindow *parent=nullptr)
void HandleUploadFailed(const UploadFailedPayload &payload)
void UpdateProgress(uint64_t current, uint64_t total)
void HandleUploadSucceeded(const UploadSuccessfulPayload &payload)
struct audacity::cloud::audiocom::ShareAudioDialog::InitialStatePanel mInitialStatePanel
struct audacity::cloud::audiocom::ShareAudioDialog::ProgressPanel mProgressPanel
std::unique_ptr< ExportProgressUpdater > mExportProgressUpdater
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