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:
parent
eaccbf3da9
commit
08229735b2
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user