From 769119c79515d3be386f469724629fd02d31d277 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Tue, 13 Jun 2017 22:32:32 +0300 Subject: [PATCH] video settings (untested) --- toxygen/menu.py | 46 +++++++++++++++++++++++++++++++++++++++++++++ toxygen/settings.py | 1 + 2 files changed, 47 insertions(+) diff --git a/toxygen/menu.py b/toxygen/menu.py index c3958e9..3e9696f 100644 --- a/toxygen/menu.py +++ b/toxygen/menu.py @@ -795,6 +795,52 @@ class AudioSettings(CenteredWidget): settings.save() +class VideoSettings(CenteredWidget): + """ + Audio calls settings form + """ + + def __init__(self): + super().__init__() + self.initUI() + self.retranslateUi() + self.center() + + def initUI(self): + self.setObjectName("videoSettingsForm") + self.resize(400, 100) + self.setMinimumSize(QtCore.QSize(400, 100)) + self.setMaximumSize(QtCore.QSize(400, 100)) + self.in_label = QtWidgets.QLabel(self) + self.in_label.setGeometry(QtCore.QRect(25, 5, 350, 20)) + settings = Settings.get_instance() + font = QtGui.QFont() + font.setPointSize(16) + font.setBold(True) + font.setFamily(settings['font']) + self.in_label.setFont(font) + self.input = QtWidgets.QComboBox(self) + self.input.setGeometry(QtCore.QRect(25, 30, 350, 30)) + import cv2 + self.devices = [] + for i in range(15): + v = cv2.VideoCapture(i) + if v.isOpened(): + del v + self.devices.append(i) + self.input.addItem('Device #' + str(i)) + self.input.setCurrentIndex(self.in_indexes.index(settings.video['device'])) + + def retranslateUi(self): + self.setWindowTitle(QtWidgets.QApplication.translate("videoSettingsForm", "Video settings")) + self.in_label.setText(QtWidgets.QApplication.translate("videoSettingsForm", "Device:")) + + def closeEvent(self, event): + settings = Settings.get_instance() + settings.video['device'] = self.devices[self.input.currentIndex()] + settings.save() + + class PluginsSettings(CenteredWidget): """ Plugins settings form diff --git a/toxygen/settings.py b/toxygen/settings.py index 9604250..c007d3a 100644 --- a/toxygen/settings.py +++ b/toxygen/settings.py @@ -47,6 +47,7 @@ class Settings(dict, Singleton): self.audio = {'input': p.get_default_input_device_info()['index'] if input_devices else -1, 'output': p.get_default_output_device_info()['index'] if output_devices else -1, 'enabled': input_devices and output_devices} + self.video = {'device': 0} @staticmethod def get_auto_profile():