/*************************************************************************************** * * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. * * By downloading, copying, installing or using the software you agree to this license. * If you do not agree to this license, do not download, install, * copy or use the software. * * Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved. * * Redistribution and use in binary forms, with or without modification, are permitted. * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * ****************************************************************************************/ #include "SystemSetting.h" #include "utils.h" #include "video_decoder.h" #include #include #include #include #include SystemSetting::SystemSetting(SysConfig &config, QWidget *parent) : QDialog(parent) , m_syscfg(config) { ui.setupUi(this); initDialog(); connSignalSlot(); } SystemSetting::~SystemSetting() { } void SystemSetting::initDialog() { ui.cmbLogLevel->addItem(tr("TRACE")); ui.cmbLogLevel->addItem(tr("DEBUG")); ui.cmbLogLevel->addItem(tr("INFO")); ui.cmbLogLevel->addItem(tr("WARNING")); ui.cmbLogLevel->addItem(tr("ERROR")); ui.cmbLogLevel->addItem(tr("FATAL")); ui.cmbVideoRenderMode->addItem(tr("Keep the original aspect ratio")); ui.cmbVideoRenderMode->addItem(tr("Fill the whole window")); #if defined(ANDROID) ui.cmbHWDecoding->addItem(tr("Automatic"), HW_DECODING_AUTO); ui.cmbHWDecoding->addItem(tr("Media Codec"), HW_DECODING_MEDIACODEC); ui.cmbHWDecoding->addItem(tr("Disable"), HW_DECODING_DISABLE); #elif defined(IOS) ui.cmbHWDecoding->addItem(tr("Automatic"), HW_DECODING_AUTO); ui.cmbHWDecoding->addItem(tr("Videotoolbox"), HW_DECODING_VIDEOTOOLBOX); ui.cmbHWDecoding->addItem(tr("Disable"), HW_DECODING_DISABLE); #endif ui.chkEnableLog->setChecked(m_syscfg.enableLog); ui.chkRtpMulticast->setChecked(m_syscfg.rtpMulticast); ui.chkRtpOverUdp->setChecked(m_syscfg.rtpOverUdp); ui.chkRtspOverHttp->setChecked(m_syscfg.rtspOverHttp); ui.spinHttpPort->setValue(m_syscfg.rtspOverHttpPort); ui.chkRtspOverWs->setChecked(m_syscfg.rtspOverWs); ui.spinWsPort->setValue(m_syscfg.rtspOverWsPort); ui.cmbVideoRenderMode->setCurrentIndex(m_syscfg.videoRenderMode); ui.cmbLogLevel->setCurrentIndex(m_syscfg.logLevel); ui.timeRecordTime->setTime(QTime(0,0,0,0).addSecs(m_syscfg.recordTime)); ui.spinRecordSize->setValue(m_syscfg.recordSize); for (int i = 0; i < ui.cmbHWDecoding->count(); i++) { if (ui.cmbHWDecoding->itemData(i).toInt() == m_syscfg.hwDecoding) { ui.cmbHWDecoding->setCurrentIndex(i); break; } } showMaximized(); } void SystemSetting::connSignalSlot() { connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(close())); connect(ui.btnConfirm, SIGNAL(clicked()), this, SLOT(slotConfirm())); } void SystemSetting::slotConfirm() { m_syscfg.enableLog = ui.chkEnableLog->isChecked(); m_syscfg.logLevel = ui.cmbLogLevel->currentIndex(); m_syscfg.rtpMulticast = ui.chkRtpMulticast->isChecked(); m_syscfg.rtpOverUdp = ui.chkRtpOverUdp->isChecked(); m_syscfg.rtspOverHttp = ui.chkRtspOverHttp->isChecked(); m_syscfg.rtspOverHttpPort = ui.spinHttpPort->value(); m_syscfg.rtspOverWs = ui.chkRtspOverWs->isChecked(); m_syscfg.rtspOverWsPort = ui.spinWsPort->value(); m_syscfg.recordTime = QTime(0, 0, 0, 0).secsTo(ui.timeRecordTime->time()); m_syscfg.recordSize = ui.spinRecordSize->value(); m_syscfg.videoRenderMode = ui.cmbVideoRenderMode->currentIndex(); m_syscfg.hwDecoding = ui.cmbHWDecoding->currentData().toInt(); saveEnableLogFlag(m_syscfg.enableLog); saveLogLevel(m_syscfg.logLevel); saveRtpMulticast(m_syscfg.rtpMulticast); saveRtpOverUdp(m_syscfg.rtpOverUdp); saveRtspOverHttp(m_syscfg.rtspOverHttp); saveRtspOverHttpPort(m_syscfg.rtspOverHttpPort); saveRtspOverWs(m_syscfg.rtspOverWs); saveRtspOverWsPort(m_syscfg.rtspOverWsPort); saveRecordTime(m_syscfg.recordTime); saveRecordSize(m_syscfg.recordSize); saveVideoRenderMode(m_syscfg.videoRenderMode); saveHWDecoding(m_syscfg.hwDecoding); accept(); }