2014-09-15 18:45:59 +08:00
|
|
|
/*
|
2019-06-24 22:01:18 +08:00
|
|
|
Copyright © 2014-2019 by The qTox Project Contributors
|
2015-06-06 09:40:08 +08:00
|
|
|
|
2014-09-15 18:45:59 +08:00
|
|
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
|
|
|
|
2015-06-06 09:40:08 +08:00
|
|
|
qTox is libre software: you can redistribute it and/or modify
|
2014-09-15 18:45:59 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2015-06-06 09:40:08 +08:00
|
|
|
|
|
|
|
qTox is distributed in the hope that it will be useful,
|
2014-09-15 18:45:59 +08:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-06-06 09:40:08 +08:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2014-09-15 18:45:59 +08:00
|
|
|
|
2015-06-06 09:40:08 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
2014-09-15 18:45:59 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AVFORM_H
|
|
|
|
#define AVFORM_H
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
#include <QList>
|
2015-05-14 10:46:28 +08:00
|
|
|
#include <QObject>
|
2015-06-06 03:37:01 +08:00
|
|
|
#include <QString>
|
2016-07-14 16:53:53 +08:00
|
|
|
|
2014-09-15 18:45:59 +08:00
|
|
|
#include "genericsettings.h"
|
2016-07-14 16:53:53 +08:00
|
|
|
#include "ui_avform.h"
|
2016-12-19 10:26:26 +08:00
|
|
|
#include "src/video/videomode.h"
|
2014-10-06 00:17:01 +08:00
|
|
|
|
2019-04-05 07:29:21 +08:00
|
|
|
#include <memory>
|
|
|
|
|
2019-05-19 01:08:58 +08:00
|
|
|
class IAudioControl;
|
2019-05-02 03:45:18 +08:00
|
|
|
class IAudioSettings;
|
|
|
|
class IAudioSink;
|
|
|
|
class IAudioSource;
|
2015-05-14 10:46:28 +08:00
|
|
|
class CameraSource;
|
2017-10-23 00:57:24 +08:00
|
|
|
class CoreAV;
|
|
|
|
class IVideoSettings;
|
2015-05-14 10:46:28 +08:00
|
|
|
class VideoSurface;
|
2016-07-14 16:53:53 +08:00
|
|
|
class AVForm : public GenericForm, private Ui::AVForm
|
2014-09-15 18:45:59 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2019-05-19 01:08:58 +08:00
|
|
|
AVForm(IAudioControl& audio, CoreAV* coreAV, CameraSource& camera,
|
|
|
|
IAudioSettings* audioSettings, IVideoSettings* videoSettings);
|
2017-10-23 00:57:24 +08:00
|
|
|
~AVForm() override;
|
2019-10-14 09:07:57 +08:00
|
|
|
QString getFormName() final
|
2017-02-26 19:52:45 +08:00
|
|
|
{
|
|
|
|
return tr("Audio/Video");
|
|
|
|
}
|
2014-09-15 18:45:59 +08:00
|
|
|
|
2014-10-29 03:47:20 +08:00
|
|
|
private:
|
|
|
|
void getAudioInDevices();
|
|
|
|
void getAudioOutDevices();
|
2015-05-14 10:46:28 +08:00
|
|
|
void getVideoDevices();
|
2014-10-06 00:17:01 +08:00
|
|
|
|
2016-07-24 05:48:00 +08:00
|
|
|
static int getModeSize(VideoMode mode);
|
2017-02-26 19:52:45 +08:00
|
|
|
void selectBestModes(QVector<VideoMode>& allVideoModes);
|
2016-06-15 07:04:39 +08:00
|
|
|
void fillCameraModesComboBox();
|
|
|
|
void fillScreenModesComboBox();
|
2017-09-28 22:11:10 +08:00
|
|
|
void fillAudioQualityComboBox();
|
2016-06-14 04:22:36 +08:00
|
|
|
int searchPreferredIndex();
|
2016-06-14 00:15:35 +08:00
|
|
|
|
2015-05-10 06:03:05 +08:00
|
|
|
void createVideoSurface();
|
|
|
|
void killVideoSurface();
|
|
|
|
|
2015-06-06 03:37:01 +08:00
|
|
|
void retranslateUi();
|
|
|
|
|
2014-10-29 03:47:20 +08:00
|
|
|
private slots:
|
2014-10-29 04:21:37 +08:00
|
|
|
// audio
|
2016-07-15 10:59:35 +08:00
|
|
|
void on_inDevCombobox_currentIndexChanged(int deviceIndex);
|
|
|
|
void on_outDevCombobox_currentIndexChanged(int deviceIndex);
|
2018-04-11 13:39:50 +08:00
|
|
|
void on_playbackSlider_valueChanged(int sliderSteps);
|
2016-10-11 08:51:54 +08:00
|
|
|
void on_cbEnableTestSound_stateChanged();
|
2018-04-11 13:39:50 +08:00
|
|
|
void on_microphoneSlider_valueChanged(int sliderSteps);
|
|
|
|
void on_audioThresholdSlider_valueChanged(int sliderSteps);
|
2017-09-28 22:11:10 +08:00
|
|
|
void on_audioQualityComboBox_currentIndexChanged(int index);
|
2014-10-29 04:21:37 +08:00
|
|
|
|
2014-10-22 18:59:48 +08:00
|
|
|
// camera
|
2016-07-15 10:59:35 +08:00
|
|
|
void on_videoDevCombobox_currentIndexChanged(int index);
|
|
|
|
void on_videoModescomboBox_currentIndexChanged(int index);
|
2014-10-06 00:17:01 +08:00
|
|
|
|
2016-07-30 04:57:46 +08:00
|
|
|
void rescanDevices();
|
2017-10-11 08:58:04 +08:00
|
|
|
void setVolume(float value);
|
2016-01-17 18:34:50 +08:00
|
|
|
|
2017-05-06 06:50:15 +08:00
|
|
|
void on_cbEnableBackend2_stateChanged();
|
|
|
|
|
2015-03-16 04:29:23 +08:00
|
|
|
protected:
|
2015-05-16 10:01:38 +08:00
|
|
|
void updateVideoModes(int curIndex);
|
2014-12-25 20:29:42 +08:00
|
|
|
|
2015-12-10 13:48:28 +08:00
|
|
|
private:
|
2019-10-14 09:07:57 +08:00
|
|
|
void hideEvent(QHideEvent* event) final;
|
|
|
|
void showEvent(QShowEvent* event) final;
|
2017-02-26 19:52:45 +08:00
|
|
|
void open(const QString& devName, const VideoMode& mode);
|
2018-04-11 13:39:50 +08:00
|
|
|
int getStepsFromValue(qreal val, qreal valMin, qreal valMax);
|
|
|
|
qreal getValueFromSteps(int steps, qreal valMin, qreal valMax);
|
2019-07-13 16:27:02 +08:00
|
|
|
void trackNewScreenGeometry(QScreen* qScreen);
|
2015-12-10 13:48:28 +08:00
|
|
|
|
2014-09-15 18:45:59 +08:00
|
|
|
private:
|
2019-05-19 01:08:58 +08:00
|
|
|
IAudioControl& audio;
|
2017-10-23 00:57:24 +08:00
|
|
|
CoreAV* coreAV;
|
|
|
|
IAudioSettings* audioSettings;
|
|
|
|
IVideoSettings* videoSettings;
|
|
|
|
|
2015-12-10 13:48:28 +08:00
|
|
|
bool subscribedToAudioIn;
|
2019-04-05 07:29:21 +08:00
|
|
|
std::unique_ptr<IAudioSink> audioSink = nullptr;
|
2019-05-02 03:45:18 +08:00
|
|
|
std::unique_ptr<IAudioSource> audioSrc = nullptr;
|
2017-02-26 19:52:45 +08:00
|
|
|
VideoSurface* camVideoSurface;
|
|
|
|
CameraSource& camera;
|
2015-05-14 10:46:28 +08:00
|
|
|
QVector<QPair<QString, QString>> videoDeviceList;
|
2015-05-16 10:01:38 +08:00
|
|
|
QVector<VideoMode> videoModes;
|
2018-01-16 06:59:53 +08:00
|
|
|
uint alSource;
|
2018-04-11 13:39:50 +08:00
|
|
|
const uint totalSliderSteps = 100; // arbitrary number of steps to give slider a good "feel"
|
2014-09-15 18:45:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|