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;
31enum class AudiocomTrace;
32
34{
35class UserPanel;
36
37struct UploadFailedPayload;
38struct UploadSuccessfulPayload;
39
40class ShareAudioDialog final :
41 public wxDialogWrapper
42{
43public:
45 AudacityProject& project, AudiocomTrace, wxWindow* parent = nullptr);
46 ~ShareAudioDialog() override;
47
48private:
49 void Populate(ShuttleGui& s);
50
51 void OnCancel();
52 void OnContinue();
53
54 wxString ExportProject();
55
56 void StartUploadProcess();
58 void HandleUploadFailed(const UploadFailedPayload& payload);
60
61 void ResetProgress();
62 void UpdateProgress(uint64_t current, uint64_t total);
63
65
66 struct InitialStatePanel final
67 {
69
71
72 wxWindow* root { nullptr };
73
74 UserPanel* userPanel { nullptr };
75 wxPanel* anonInfoPanel { nullptr };
76 wxPanel* authorizedInfoPanel { nullptr };
77 wxTextCtrl* trackTitle { nullptr };
78
80
82
83 void UpdateUserData(bool authorized);
84
85 wxString GetTrackTitle() const;
86 bool HasValidTitle() const;
88
89 struct ProgressPanel final
90 {
91 wxWindow* root { nullptr };
92
93 wxStaticText* title { nullptr };
94 wxGauge* progress { nullptr };
95
96 wxWindow* timePanel { nullptr };
97 wxStaticText* elapsedTime { nullptr };
98 wxStaticText* remainingTime { nullptr };
99
100 wxStaticText* info { nullptr };
101
103
105
106 wxButton* mContinueButton { nullptr };
107 wxButton* mCancelButton { nullptr };
108
109 struct Services;
110 std::unique_ptr<Services> mServices;
112
114 std::unique_ptr<ExportProgressUpdater> mExportProgressUpdater;
115
116 using Clock = std::chrono::steady_clock;
117
118 Clock::time_point mStageStartTime;
119 Clock::time_point mLastUIUpdateTime;
121
122 wxString mFilePath;
123
124 std::function<void()> mContinueAction;
125
126 bool mIsAuthorised { false };
127 bool mInProgress { false };
128};
129} // namespace audacity::cloud::audiocom
AudiocomTrace
Definition: ExportUtils.h:27
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
void HandleUploadFailed(const UploadFailedPayload &payload)
ShareAudioDialog(AudacityProject &project, AudiocomTrace, wxWindow *parent=nullptr)
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:31
This structure represents the payload associated with successful upload.
Definition: UploadService.h:44