added show licence switch in the server GUI

This commit is contained in:
Volker Fischer 2020-04-08 15:30:32 +02:00
parent e7bb2ad1c6
commit 5824855252
7 changed files with 125 additions and 58 deletions

View File

@ -6,13 +6,13 @@
- added support for channel meters, coded by pljones
- added show licence switch in the server GUI
- store fader mute state in the ini file, coded by doloopuntil
- fixed low-res icon issue (Ticket #28)
TODO insert licence setting in server dialog -> on per default
TODO support OPUS 64 in the server as a first step towards official 64 samples frame size support
TODO in CreateLevelsForAllConChannels we should call CStereoSignalLevelMeter::CalcLogResult instead -> make it public and static

View File

@ -541,6 +541,10 @@ const bool bUseDoubleSystemFrameSize = true; // TODO for now this value is fixed
// settings file)
Server.SetUseDefaultCentralServerAddress ( true );
// special case for the GUI mode: we want the licenct type to be
// creative commons per default (if not given in the settings file)
Server.SetLicenceType ( LT_CREATIVECOMMONS );
// load settings from init-file
CSettings Settings ( &Server, strIniFileName );
Settings.Load();

View File

@ -191,11 +191,12 @@ public:
// GUI settings ------------------------------------------------------------
void SetAutoRunMinimized ( const bool NAuRuMin )
{ bAutoRunMinimized = NAuRuMin; }
void SetAutoRunMinimized ( const bool NAuRuMin ) { bAutoRunMinimized = NAuRuMin; }
bool GetAutoRunMinimized() { return bAutoRunMinimized; }
void SetLicenceType ( const ELicenceType NLiType ) { eLicenceType = NLiType; }
ELicenceType GetLicenceType() { return eLicenceType; }
protected:
// access functions for actual channels
bool IsConnected ( const int iChanNum )

View File

@ -56,6 +56,11 @@ CServerDlg::CServerDlg ( CServer* pNServP,
"started when the operating system starts up and is automatically "
"minimized to a system task bar icon." ) );
// CC licence dialog switch
chbUseCCLicence->setWhatsThis ( tr ( "<b>Show Creative Commons Licence "
"Dialog:</b> If enabled, a Creative Commons Licence dialog is shown "
"each time a new user connects the server." ) );
// register server flag
chbRegisterServer->setWhatsThis ( tr ( "<b>Register Server Status:</b> If "
"the register server check box is checked, this server registers "
@ -229,6 +234,16 @@ lvwClients->setMinimumHeight ( 140 );
chbRegisterServer->setCheckState ( Qt::Unchecked );
}
// update show Creative Commons licence check box
if ( pServer->GetLicenceType() == LT_CREATIVECOMMONS )
{
chbUseCCLicence->setCheckState ( Qt::Checked );
}
else
{
chbUseCCLicence->setCheckState ( Qt::Unchecked );
}
// update start minimized check box (only available for Windows)
#ifndef _WIN32
chbStartOnOSStart->setVisible ( false );
@ -284,6 +299,9 @@ lvwClients->setMinimumHeight ( 140 );
QObject::connect ( chbStartOnOSStart, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnStartOnOSStartStateChanged ( int ) ) );
QObject::connect ( chbUseCCLicence, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnUseCCLicenceStateChanged ( int ) ) );
// line edits
QObject::connect ( edtCentralServerAddress, SIGNAL ( editingFinished() ),
this, SLOT ( OnCentralServerAddressEditingFinished() ) );
@ -342,6 +360,18 @@ void CServerDlg::OnStartOnOSStartStateChanged ( int value )
ModifyAutoStartEntry ( bCurAutoStartMinState );
}
void CServerDlg::OnUseCCLicenceStateChanged ( int value )
{
if ( value == Qt::Checked )
{
pServer->SetLicenceType ( LT_CREATIVECOMMONS );
}
else
{
pServer->SetLicenceType ( LT_NO_LICENCE );
}
}
void CServerDlg::OnDefaultCentralServerStateChanged ( int value )
{
// apply new setting to the server and update it

View File

@ -86,6 +86,7 @@ public slots:
void OnRegisterServerStateChanged ( int value );
void OnDefaultCentralServerStateChanged ( int value );
void OnStartOnOSStartStateChanged ( int value );
void OnUseCCLicenceStateChanged ( int value );
void OnCentralServerAddressEditingFinished();
void OnServerNameTextChanged ( const QString& strNewName );
void OnLocationCityTextChanged ( const QString& strNewCity );

View File

@ -1,80 +1,89 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CServerDlgBase</class>
<widget class="QDialog" name="CServerDlgBase" >
<property name="geometry" >
<widget class="QDialog" name="CServerDlgBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>588</width>
<height>386</height>
<height>415</height>
</rect>
</property>
<property name="windowTitle" >
<string></string>
<property name="windowTitle">
<string/>
</property>
<property name="windowIcon" >
<iconset resource="resources.qrc" >:/png/main/res/fronticon.png</iconset>
<property name="windowIcon">
<iconset resource="resources.qrc">
<normaloff>:/png/main/res/fronticon.png</normaloff>:/png/main/res/fronticon.png</iconset>
</property>
<property name="sizeGripEnabled" >
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QTreeWidget" name="lvwClients" >
<property name="rootIsDecorated" >
<widget class="QTreeWidget" name="lvwClients">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text" >
<property name="text">
<string>Client IP:Port</string>
</property>
</column>
<column>
<property name="text" >
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text" >
<property name="text">
<string>Jitter Buffer Size</string>
</property>
</column>
<column>
<property name="text" >
<property name="text">
<string>Block Size Out/ms</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chbStartOnOSStart" >
<property name="text" >
<widget class="QCheckBox" name="chbStartOnOSStart">
<property name="text">
<string>Start Minimized on Windows Start</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chbRegisterServer" >
<property name="text" >
<widget class="QCheckBox" name="chbUseCCLicence">
<property name="text">
<string>Show Creative Commons Licence Dialog</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chbRegisterServer">
<property name="text">
<string>Register My Server in the Server List at the Central Server</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="lblCentralServerAddress" >
<property name="text" >
<widget class="QLabel" name="lblCentralServerAddress">
<property name="text">
<string>Central Server Address:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="edtCentralServerAddress" />
<widget class="QLineEdit" name="edtCentralServerAddress"/>
</item>
<item>
<widget class="QCheckBox" name="chbDefaultCentralServer" >
<property name="text" >
<widget class="QCheckBox" name="chbDefaultCentralServer">
<property name="text">
<string>Default</string>
</property>
</widget>
@ -82,30 +91,30 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="grbServerInfo" >
<property name="title" >
<widget class="QGroupBox" name="grbServerInfo">
<property name="title">
<string>My Server Info</string>
</property>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="lblServerName" >
<property name="text" >
<widget class="QLabel" name="lblServerName">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblLocationCity" >
<property name="text" >
<widget class="QLabel" name="lblLocationCity">
<property name="text">
<string>Location: City</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblLocationCountry" >
<property name="text" >
<widget class="QLabel" name="lblLocationCountry">
<property name="text">
<string>Location: Country</string>
</property>
</widget>
@ -113,15 +122,15 @@
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QLineEdit" name="edtServerName" />
<widget class="QLineEdit" name="edtServerName"/>
</item>
<item>
<widget class="QLineEdit" name="edtLocationCity" />
<widget class="QLineEdit" name="edtLocationCity"/>
</item>
<item>
<widget class="QComboBox" name="cbxLocationCountry" />
<widget class="QComboBox" name="cbxLocationCountry"/>
</item>
</layout>
</item>
@ -129,41 +138,41 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin" >
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin" >
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin" >
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lblNameVersion" >
<property name="text" >
<widget class="QLabel" name="lblNameVersion">
<property name="text">
<string>TextLabelNameVersion</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
@ -175,8 +184,19 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>lvwClients</tabstop>
<tabstop>chbStartOnOSStart</tabstop>
<tabstop>chbUseCCLicence</tabstop>
<tabstop>chbRegisterServer</tabstop>
<tabstop>edtCentralServerAddress</tabstop>
<tabstop>chbDefaultCentralServer</tabstop>
<tabstop>edtServerName</tabstop>
<tabstop>edtLocationCity</tabstop>
<tabstop>cbxLocationCountry</tabstop>
</tabstops>
<resources>
<include location="resources.qrc" />
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -364,6 +364,13 @@ void CSettings::Load()
{
pServer->SetAutoRunMinimized ( bValue );
}
// licence type
if ( GetNumericIniSet ( IniXMLDocument, "server", "licencetype",
0, 1 /* LT_CREATIVECOMMONS */, iValue ) )
{
pServer->SetLicenceType ( static_cast<ELicenceType> ( iValue ) );
}
}
}
@ -583,6 +590,10 @@ void CSettings::Save()
// start minimized on OS start
SetFlagIniSet ( IniXMLDocument, "server", "autostartmin",
pServer->GetAutoRunMinimized() );
// licence type
SetNumericIniSet ( IniXMLDocument, "server", "licencetype",
static_cast<int> ( pServer->GetLicenceType() ) );
}
// prepare file name for storing initialization data in XML file and store