mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(avform): Changed combobox index checks on asserts
This commit is contained in:
parent
9478377868
commit
ef70b20a2b
|
@ -34,6 +34,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
#include <cassert>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,17 +148,10 @@ void AVForm::rescanDevices()
|
||||||
|
|
||||||
void AVForm::on_videoModescomboBox_currentIndexChanged(int index)
|
void AVForm::on_videoModescomboBox_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= videoModes.size())
|
assert(0 <= index && index < videoModes.size());
|
||||||
{
|
|
||||||
qWarning() << "Invalid mode index:" << index;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int devIndex = videoDevCombobox->currentIndex();
|
int devIndex = videoDevCombobox->currentIndex();
|
||||||
if (devIndex < 0 || devIndex >= videoDeviceList.size())
|
assert(0 <= devIndex && devIndex < videoDeviceList.size());
|
||||||
{
|
|
||||||
qWarning() << "Invalid device index:" << devIndex;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QString devName = videoDeviceList[devIndex].first;
|
QString devName = videoDeviceList[devIndex].first;
|
||||||
VideoMode mode = videoModes[index];
|
VideoMode mode = videoModes[index];
|
||||||
|
|
||||||
|
@ -409,11 +403,7 @@ void AVForm::updateVideoModes(int curIndex)
|
||||||
|
|
||||||
void AVForm::on_videoDevCombobox_currentIndexChanged(int index)
|
void AVForm::on_videoDevCombobox_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= videoDeviceList.size())
|
assert(0 <= index && index < videoDeviceList.size());
|
||||||
{
|
|
||||||
qWarning() << "Invalid index:" << index;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings::getInstance().setScreenGrabbed(false);
|
Settings::getInstance().setScreenGrabbed(false);
|
||||||
QString dev = videoDeviceList[index].first;
|
QString dev = videoDeviceList[index].first;
|
||||||
|
@ -555,6 +545,7 @@ void AVForm::createVideoSurface()
|
||||||
{
|
{
|
||||||
if (camVideoSurface)
|
if (camVideoSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
camVideoSurface = new VideoSurface(QPixmap(), CamFrame);
|
camVideoSurface = new VideoSurface(QPixmap(), CamFrame);
|
||||||
camVideoSurface->setObjectName(QStringLiteral("CamVideoSurface"));
|
camVideoSurface->setObjectName(QStringLiteral("CamVideoSurface"));
|
||||||
camVideoSurface->setMinimumSize(QSize(160, 120));
|
camVideoSurface->setMinimumSize(QSize(160, 120));
|
||||||
|
@ -566,6 +557,7 @@ void AVForm::killVideoSurface()
|
||||||
{
|
{
|
||||||
if (!camVideoSurface)
|
if (!camVideoSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QLayoutItem *child;
|
QLayoutItem *child;
|
||||||
while ((child = gridLayout->takeAt(0)) != 0)
|
while ((child = gridLayout->takeAt(0)) != 0)
|
||||||
delete child;
|
delete child;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user