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,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CServerDlgBase</class>
<widget class="QDialog" name="CServerDlgBase">
@ -6,14 +7,15 @@
<x>0</x>
<y>0</y>
<width>588</width>
<height>386</height>
<height>415</height>
</rect>
</property>
<property name="windowTitle">
<string></string>
<string/>
</property>
<property name="windowIcon">
<iconset resource="resources.qrc" >:/png/main/res/fronticon.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/png/main/res/fronticon.png</normaloff>:/png/main/res/fronticon.png</iconset>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
@ -53,6 +55,13 @@
</property>
</widget>
</item>
<item>
<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">
@ -163,7 +172,7 @@
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
@ -175,6 +184,17 @@
</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"/>
</resources>

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