summaryrefslogtreecommitdiffstats
path: root/pica-client/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'pica-client/dialogs')
-rw-r--r--pica-client/dialogs/settingsdialog.cpp82
-rw-r--r--pica-client/dialogs/settingsdialog.h9
2 files changed, 91 insertions, 0 deletions
diff --git a/pica-client/dialogs/settingsdialog.cpp b/pica-client/dialogs/settingsdialog.cpp
index 661cf5b..1698a97 100644
--- a/pica-client/dialogs/settingsdialog.cpp
+++ b/pica-client/dialogs/settingsdialog.cpp
@@ -663,8 +663,69 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
"deliver them."), this);
lbCallHint->setWordWrap(true);
+ // The other direction: the largest video the peer is asked to send, which
+ // goes to it as the recommended resolution of 0x70/0x71.
+ QGroupBox *gbIncomingVideo = new QGroupBox(tr("Maximum incoming video resolution"), this);
+ gbIncomingVideo->setToolTip(tr("The largest video the other side is asked to send. If its "
+ "camera is set to a larger picture size, it steps down to the "
+ "largest one the camera offers that fits - or to the smallest "
+ "one it has, if none does."));
+
+ // Parented to the group box, for the same reason as the echo cancellation
+ // buttons.
+ const QSize screen = callScreenResolution(this);
+
+ rbIncomingVideoScreen = new QRadioButton(screen.isValid()
+ ? tr("Limit to my screen resolution (%1x%2)")
+ .arg(screen.width()).arg(screen.height())
+ : tr("Limit to my screen resolution"),
+ gbIncomingVideo);
+ rbIncomingVideoScreen->setToolTip(tr("The resolution of the screen the call window opens on, "
+ "taken when the call starts."));
+
+ // Only means something for the screen: the custom sizes are all landscape.
+ cbIncomingVideoLandscape = new QCheckBox(tr("Treat a portrait screen as landscape (I can rotate it)"),
+ gbIncomingVideo);
+ cbIncomingVideoLandscape->setToolTip(tr("A screen taller than it is wide is announced with its width "
+ "and height swapped, e.g. 1080x1920 as 1920x1080, so that "
+ "landscape video is not reduced to fit the screen's width."));
+ cbIncomingVideoLandscape->setEnabled(false);
+ connect(rbIncomingVideoScreen, SIGNAL(toggled(bool)), cbIncomingVideoLandscape, SLOT(setEnabled(bool)));
+
+ rbIncomingVideoCustom = new QRadioButton(tr("Custom limit:"), gbIncomingVideo);
+
+ incomingVideoLimit = new QComboBox(gbIncomingVideo);
+ incomingVideoLimit->addItem(tr("No limit"), QSize(0, 0));
+
+ for (int i = 0; i < kIncomingVideoLimitSizeCount; i++)
+ incomingVideoLimit->addItem(QString(QLatin1String("%1x%2"))
+ .arg(kIncomingVideoLimitSizes[i].width())
+ .arg(kIncomingVideoLimitSizes[i].height()),
+ kIncomingVideoLimitSizes[i]);
+
+ incomingVideoLimit->setEnabled(false);
+ connect(rbIncomingVideoCustom, SIGNAL(toggled(bool)), incomingVideoLimit, SLOT(setEnabled(bool)));
+
+ QHBoxLayout *incomingVideoCustomLayout = new QHBoxLayout();
+ incomingVideoCustomLayout->addWidget(rbIncomingVideoCustom);
+ incomingVideoCustomLayout->addWidget(incomingVideoLimit);
+ incomingVideoCustomLayout->addStretch(1);
+
+ QVBoxLayout *incomingVideoLayout = new QVBoxLayout();
+ // Indented under the screen option it belongs to.
+ QHBoxLayout *incomingVideoLandscapeLayout = new QHBoxLayout();
+ incomingVideoLandscapeLayout->addSpacing(style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth)
+ + style()->pixelMetric(QStyle::PM_RadioButtonLabelSpacing));
+ incomingVideoLandscapeLayout->addWidget(cbIncomingVideoLandscape);
+
+ incomingVideoLayout->addWidget(rbIncomingVideoScreen);
+ incomingVideoLayout->addLayout(incomingVideoLandscapeLayout);
+ incomingVideoLayout->addLayout(incomingVideoCustomLayout);
+ gbIncomingVideo->setLayout(incomingVideoLayout);
+
callLayout->addLayout(callFormLayout);
callLayout->addWidget(lbCallHint);
+ callLayout->addWidget(gbIncomingVideo);
callLayout->addStretch(1);
calltab->setLayout(callLayout);
@@ -2113,6 +2174,18 @@ void SettingsDialog::loadSettings()
// actually changes - and the stored codec is often the one already showing.
callAudioCodecChanged();
+ if (cs.incomingVideoLimit == IncomingVideoLimitCustom)
+ rbIncomingVideoCustom->setChecked(true);
+ else
+ rbIncomingVideoScreen->setChecked(true);
+
+ cbIncomingVideoLandscape->setChecked(cs.incomingVideoLandscape);
+
+ // A size stored by hand that is not in the list shows as no limit rather
+ // than as whatever happens to be first.
+ int incomingVideoLimitItem = incomingVideoLimit->findData(cs.incomingVideoLimitSize);
+ incomingVideoLimit->setCurrentIndex(incomingVideoLimitItem >= 0 ? incomingVideoLimitItem : 0);
+
#ifdef HAVE_VAAPI
cbVaapiEncoding->setChecked(st.loadValue("video.vaapi_encoding", 0).toBool());
cbVaapiDecoding->setChecked(st.loadValue("video.vaapi_decoding", 0).toBool());
@@ -2232,6 +2305,15 @@ void SettingsDialog::storeSettings()
audioBitrateKbps = callAudioBitrate->value();
st.storeValue("call.audio_bitrate_kbps", QString::number(audioBitrateKbps));
+
+ // The custom size is kept while the screen is selected, so that switching
+ // back finds it as it was.
+ const QSize incomingVideoLimitSize = incomingVideoLimit->itemData(incomingVideoLimit->currentIndex()).toSize();
+
+ st.storeValue("call.incoming_video_limit", rbIncomingVideoCustom->isChecked() ? "custom" : "screen");
+ st.storeValue("call.incoming_video_limit_width", QString::number(incomingVideoLimitSize.width()));
+ st.storeValue("call.incoming_video_limit_height", QString::number(incomingVideoLimitSize.height()));
+ st.storeValue("call.incoming_video_landscape", cbIncomingVideoLandscape->isChecked() ? "1" : "0");
#ifdef HAVE_VAAPI
st.storeValue("video.vaapi_encoding", cbVaapiEncoding->isChecked() ? "1" : "0");
st.storeValue("video.vaapi_decoding", cbVaapiDecoding->isChecked() ? "1" : "0");
diff --git a/pica-client/dialogs/settingsdialog.h b/pica-client/dialogs/settingsdialog.h
index ab1c7e7..d5b624c 100644
--- a/pica-client/dialogs/settingsdialog.h
+++ b/pica-client/dialogs/settingsdialog.h
@@ -148,6 +148,15 @@ private:
QSpinBox *callVideoBitrate;
QSpinBox *callAudioBitrate;
+ // "Maximum incoming video resolution": the recommended resolution a call
+ // sends to the peer in 0x70/0x71, see IncomingVideoLimit. The combo box
+ // carries the size as item data, 0x0 for "No limit".
+ QRadioButton *rbIncomingVideoScreen;
+ // see CallSettings::incomingVideoLandscape
+ QCheckBox *cbIncomingVideoLandscape;
+ QRadioButton *rbIncomingVideoCustom;
+ QComboBox *incomingVideoLimit;
+
// The audio bitrate the user chose, which is not always what
// callAudioBitrate shows: selecting a fixed rate codec puts that codec's
// rate in the box and disables it, and the chosen value has to survive