1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(avform): Added automatic screen rescan

This commit is contained in:
Diadlo 2016-07-29 23:57:46 +03:00
parent eaccbf3da9
commit 08229735b2
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 15 additions and 7 deletions

View File

@ -30,8 +30,9 @@
#include "src/core/coreav.h"
#include "src/core/recursivesignalblocker.h"
#include <QScreen>
#include <QDesktopWidget>
#include <QDebug>
#include <QScreen>
#include <QShowEvent>
#include <map>
@ -57,12 +58,7 @@ AVForm::AVForm()
btnPlayTestSound->setToolTip(
tr("Play a test sound while changing the output volume."));
connect(rescanButton, &QPushButton::clicked, this, [=]()
{
getAudioInDevices();
getAudioOutDevices();
getVideoDevices();
});
connect(rescanButton, &QPushButton::clicked, this, &AVForm::rescanDevices);
playbackSlider->setTracking(false);
playbackSlider->setValue(s.getOutVolume());
@ -87,6 +83,10 @@ AVForm::AVForm()
cb->setFocusPolicy(Qt::StrongFocus);
}
QDesktopWidget *desktop = QApplication::desktop();
connect(desktop, &QDesktopWidget::resized, this, &AVForm::rescanDevices);
connect(desktop, &QDesktopWidget::screenCountChanged, this, &AVForm::rescanDevices);
Translator::registerHandler(std::bind(&AVForm::retranslateUi, this), this);
}
@ -138,6 +138,13 @@ void AVForm::open(const QString &devName, const VideoMode &mode)
camera.open(devName, mode);
}
void AVForm::rescanDevices()
{
getAudioInDevices();
getAudioOutDevices();
getVideoDevices();
}
void AVForm::on_videoModescomboBox_currentIndexChanged(int index)
{
if (index < 0 || index >= videoModes.size())

View File

@ -68,6 +68,7 @@ private slots:
void on_videoDevCombobox_currentIndexChanged(int index);
void on_videoModescomboBox_currentIndexChanged(int index);
void rescanDevices();
protected:
void updateVideoModes(int curIndex);