Skip to content

Commit 0b4770a

Browse files
committed
feat: Upload dialog in podcast preferences
The upload dialog contains options related to uploading the recorded videos.
1 parent 4027f40 commit 0b4770a

3 files changed

Lines changed: 70 additions & 16 deletions

File tree

src/podcast/UBPodcastController.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ void UBPodcastController::openPodcastPreferencesDialog()
186186
const QList<int> podcastVerticalResolution = QList({viewportSize.height(), 768, 480});
187187
const QList<int> podcastHorizontalResolution = QList({viewportSize.width(), 1024, 640});
188188

189+
const bool podcastPublishToIntranet = settings->podcastPublishToIntranet->get().toBool();
190+
const bool podcastPublishToYoutube = settings->podcastPublishToYoutube->get().toBool();
191+
189192
mPodcastPreferencesDialog = new UBPodcastPreferencesDialog(UBApplication::mainWindow,
190193
audioRecordingDevices(),
191194
podcastAudioRecordingDevice,
@@ -195,7 +198,9 @@ void UBPodcastController::openPodcastPreferencesDialog()
195198
fullBitRate,
196199
podcastBitRateDivisors,
197200
podcastVerticalResolution,
198-
podcastHorizontalResolution);
201+
podcastHorizontalResolution,
202+
podcastPublishToIntranet,
203+
podcastPublishToYoutube);
199204
mPodcastPreferencesDialog->setAttribute(Qt::WA_DeleteOnClose);
200205
connect(mPodcastPreferencesDialog, SIGNAL(accepted()), this, SLOT(podcastPreferencesDialogAccepted()));
201206
mPodcastPreferencesDialog->open();
@@ -219,6 +224,11 @@ void UBPodcastController::podcastPreferencesDialogAccepted()
219224

220225
mVideoFramesPerSecondAtStart = dialog->podcastFrameRate();
221226
settings->podcastFramesPerSecond->set(mVideoFramesPerSecondAtStart);
227+
228+
const bool podcastPublishToIntranet = dialog->podcastPublishToIntranet();
229+
UBSettings::settings()->podcastPublishToIntranet->set(podcastPublishToIntranet);
230+
const bool podcastPublishToYoutube = dialog->podcastPublishToYoutube();
231+
UBSettings::settings()->podcastPublishToYoutube->set(podcastPublishToYoutube);
222232
}
223233

224234
void UBPodcastController::updateActionState()
@@ -432,7 +442,7 @@ void UBPodcastController::start()
432442

433443
QString videoFileName;
434444

435-
if (mIntranetPublicationAction && mIntranetPublicationAction->isChecked())
445+
if (settings->podcastPublishToIntranet->get().toBool())
436446
{
437447
videoFileName = mPodcastRecordingPath + "/" + "Podcast-"
438448
+ QDateTime::currentDateTime().toString("yyyyMMddhhmmss")
@@ -822,13 +832,13 @@ void UBPodcastController::encodingFinished(bool ok)
822832

823833
UBApplication::showMessage(tr("Podcast created %1").arg(location), false);
824834

825-
if (mIntranetPublicationAction && mIntranetPublicationAction->isChecked())
835+
if (UBSettings::settings()->podcastPublishToIntranet->get().toBool())
826836
{
827837
UBIntranetPodcastPublisher* intranet = new UBIntranetPodcastPublisher(this); // Self destroyed
828838
intranet->publishVideo(mVideoEncoder->videoFileName(), elapsedRecordingMs());
829839
}
830840

831-
if (mYoutubePublicationAction && mYoutubePublicationAction->isChecked())
841+
if (UBSettings::settings()->podcastPublishToYoutube->get().toBool())
832842
{
833843
UBYouTubePublisher* youTube = new UBYouTubePublisher(this); // Self destroyed
834844
youTube->uploadVideo(mVideoEncoder->videoFileName());

src/podcast/UBPodcastPreferencesDialog.cpp

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ UBPodcastPreferencesDialog::UBPodcastPreferencesDialog(QWidget* parent,
5050
const int podcastBitRate,
5151
const QList<int>& podcastBitRateDivisor,
5252
const QList<int>& podcastVerticalResolution,
53-
const QList<int>& podcastHorizontalResolution)
53+
const QList<int>& podcastHorizontalResolution,
54+
const bool podcastPublishToIntranet,
55+
const bool podcastPublishToYoutube)
5456
: QDialog(parent)
5557
, mPodcastAudioRecordingDevices(podcastAudioRecordingDevices)
5658
, mPodcastProfileNames(podcastProfileNames)
@@ -65,9 +67,14 @@ UBPodcastPreferencesDialog::UBPodcastPreferencesDialog(QWidget* parent,
6567
mainLayout->setContentsMargins(20, 18, 20, 18);
6668
mainLayout->setSpacing(16);
6769

70+
QWidget* recordingWidget = new QWidget(this);
71+
QVBoxLayout* recordingLayout = new QVBoxLayout(recordingWidget);
72+
recordingLayout->setContentsMargins(20, 18, 20, 18);
73+
recordingLayout->setSpacing(16);
74+
6875
const QString audioDeviceSelectorToolTip = tr("The selected audio device applies to all profiles.");
6976

70-
QWidget* audioWidget = new QWidget(this);
77+
QWidget* audioWidget = new QWidget(recordingWidget);
7178
audioWidget->setObjectName(QStringLiteral("podcastPreferencesHeader"));
7279
QHBoxLayout* audioLayout = new QHBoxLayout(audioWidget);
7380
audioLayout->setContentsMargins(14, 12, 14, 12);
@@ -101,11 +108,11 @@ UBPodcastPreferencesDialog::UBPodcastPreferencesDialog(QWidget* parent,
101108
audioLayout->addWidget(mNoAudioCheckBox);
102109
audioLayout->addWidget(mDefaultAudioCheckBox);
103110
audioLayout->addWidget(mAudioDeviceSelector);
104-
mainLayout->addWidget(audioWidget);
111+
recordingLayout->addWidget(audioWidget);
105112

106113
const QString frameRateFormToolTip = tr("The global frame rate applies to all profiles.");
107114

108-
QWidget* frameRateFormWidget = new QWidget(this);
115+
QWidget* frameRateFormWidget = new QWidget(recordingWidget);
109116
frameRateFormWidget->setObjectName(QStringLiteral("podcastPreferencesSpinBox"));
110117
QHBoxLayout* frameRateFormLayout = new QHBoxLayout(frameRateFormWidget);
111118
frameRateFormLayout->setContentsMargins(14, 12, 14, 12);
@@ -121,11 +128,11 @@ UBPodcastPreferencesDialog::UBPodcastPreferencesDialog(QWidget* parent,
121128
frameRateLabel->setToolTip(frameRateFormToolTip);
122129
frameRateFormLayout->addWidget(frameRateLabel);
123130
frameRateFormLayout->addWidget(mFrameRateSpinBox);
124-
mainLayout->addWidget(frameRateFormWidget);
131+
recordingLayout->addWidget(frameRateFormWidget);
125132

126133
const QString bitRateFormToolTip = tr("The base bit rate is scaled depending on the profile.");
127134

128-
QWidget* bitRateFormWidget = new QWidget(this);
135+
QWidget* bitRateFormWidget = new QWidget(recordingWidget);
129136
bitRateFormWidget->setObjectName(QStringLiteral("podcastPreferencesSpinBox"));
130137
QHBoxLayout* bitRateFormLayout = new QHBoxLayout(bitRateFormWidget);
131138
bitRateFormLayout->setContentsMargins(14, 12, 14, 12);
@@ -141,9 +148,9 @@ UBPodcastPreferencesDialog::UBPodcastPreferencesDialog(QWidget* parent,
141148
bitRateLabel->setToolTip(bitRateFormToolTip);
142149
bitRateFormLayout->addWidget(bitRateLabel);
143150
bitRateFormLayout->addWidget(mBitRateSpinBox);
144-
mainLayout->addWidget(bitRateFormWidget);
151+
recordingLayout->addWidget(bitRateFormWidget);
145152

146-
mTabWidget = new QTabWidget(this);
153+
mTabWidget = new QTabWidget(recordingWidget);
147154
mTabWidget->setObjectName(QStringLiteral("podcastPreferencesTabWidget"));
148155
mTabWidget->setIconSize(QSize(18, 18));
149156

@@ -163,9 +170,9 @@ UBPodcastPreferencesDialog::UBPodcastPreferencesDialog(QWidget* parent,
163170
mTabWidget->addTab(tab, tabLabel);
164171
}
165172
mTabWidget->setCurrentIndex(mPodcastProfileNames.indexOf(podcastProfile));
166-
mainLayout->addWidget(mTabWidget);
173+
recordingLayout->addWidget(mTabWidget);
167174

168-
QWidget* hintWidget = new QWidget(this);
175+
QWidget* hintWidget = new QWidget(recordingWidget);
169176
hintWidget->setObjectName(QStringLiteral("podcastPreferencesHint"));
170177
QHBoxLayout* hintLayout = new QHBoxLayout(hintWidget);
171178
hintLayout->setContentsMargins(14, 10, 14, 10);
@@ -184,7 +191,26 @@ UBPodcastPreferencesDialog::UBPodcastPreferencesDialog(QWidget* parent,
184191

185192
hintLayout->addWidget(hintIcon, 0, Qt::AlignTop);
186193
hintLayout->addWidget(hintLabel, 1);
187-
mainLayout->addWidget(hintWidget);
194+
recordingLayout->addWidget(hintWidget);
195+
196+
QWidget* publish = new QWidget(this);
197+
QVBoxLayout* publishLayout = new QVBoxLayout(publish);
198+
publishLayout->setContentsMargins(8, 14, 8, 6);
199+
publishLayout->setSpacing(14);
200+
201+
mPublishToIntranet = new QCheckBox(tr("Publish to Intranet"));
202+
mPublishToIntranet->setChecked(podcastPublishToIntranet);
203+
mPublishToYoutube = new QCheckBox(tr("Publish to Youtube"));
204+
mPublishToYoutube->setChecked(podcastPublishToYoutube);
205+
publishLayout->addWidget(mPublishToIntranet);
206+
publishLayout->addWidget(mPublishToYoutube);
207+
208+
publishLayout->addStretch();
209+
210+
QTabWidget* mainTabs = new QTabWidget(this);
211+
mainTabs->addTab(recordingWidget, tr("Recording"));
212+
mainTabs->addTab(publish, tr("Upload"));
213+
mainLayout->addWidget(mainTabs);
188214

189215
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
190216
buttons->setObjectName(QStringLiteral("colorPreferencesButtonBox"));
@@ -235,6 +261,16 @@ int UBPodcastPreferencesDialog::podcastFrameRate() const
235261
return mFrameRateSpinBox->value();
236262
}
237263

264+
bool UBPodcastPreferencesDialog::podcastPublishToIntranet() const
265+
{
266+
return mPublishToIntranet->isChecked();
267+
}
268+
269+
bool UBPodcastPreferencesDialog::podcastPublishToYoutube() const
270+
{
271+
return mPublishToYoutube->isChecked();
272+
}
273+
238274
void UBPodcastPreferencesDialog::bitRateChanged(int bitRate)
239275
{
240276
for (int i = 0; i < mBitRateProfileValues.size(); ++i)
@@ -299,6 +335,8 @@ void UBPodcastPreferencesDialog::resetDefaultSettings()
299335
mTabWidget->setCurrentIndex(mPodcastProfileNames.indexOf("Medium"));
300336
mBitRateSpinBox->setValue(1700000);
301337
mFrameRateSpinBox->setValue(10);
338+
mPublishToIntranet->setChecked(false);
339+
mPublishToYoutube->setChecked(false);
302340
}
303341

304342

src/podcast/UBPodcastPreferencesDialog.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ class UBPodcastPreferencesDialog : public QDialog
5757
const int podcastBitRate,
5858
const QList<int>& podcastBitRateDivisors,
5959
const QList<int>& podcastVerticalResolution,
60-
const QList<int>& podcastHorizontalResolution);
60+
const QList<int>& podcastHorizontalResolution,
61+
const bool podcastPublishToIntranet,
62+
const bool podcastPublishToYoutube);
6163

6264
QString podcastAudioRecordingOption() const;
6365
QString podcastProfile() const;
6466
int podcastBitRate() const;
6567
int podcastFrameRate() const;
68+
bool podcastPublishToIntranet() const;
69+
bool podcastPublishToYoutube() const;
6670

6771
private slots:
6872
void bitRateChanged(int bitRate);
@@ -87,6 +91,8 @@ class UBPodcastPreferencesDialog : public QDialog
8791
QSpinBox* mBitRateSpinBox{nullptr};
8892
QSpinBox* mFrameRateSpinBox{nullptr};
8993
QTabWidget* mTabWidget{nullptr};
94+
QCheckBox* mPublishToIntranet{nullptr};
95+
QCheckBox* mPublishToYoutube{nullptr};
9096
QPushButton* mResetPenButton{nullptr};
9197
QPushButton* mResetMarkerButton{nullptr};
9298
QList<QLabel*> mBitRateProfileValues;

0 commit comments

Comments
 (0)