added a GUI control to set the server Welcome Message in the server GUI
This commit is contained in:
parent
8cd4f5b3e8
commit
e7daf34063
6 changed files with 51 additions and 6 deletions
|
@ -19,9 +19,12 @@
|
||||||
|
|
||||||
- scale channel instrument picture in Compact skin mode
|
- scale channel instrument picture in Compact skin mode
|
||||||
|
|
||||||
|
- redesign of the server dialog
|
||||||
|
|
||||||
- bug fix: grouping faders in the client should be proportional (see discussion in #202, #419)
|
- bug fix: grouping faders in the client should be proportional (see discussion in #202, #419)
|
||||||
|
|
||||||
|
|
||||||
|
TODO store welcome message set in the GUI in the ini file
|
||||||
|
|
||||||
TODO improve settings management -> move settings class in client/server classes, move actual settings variables
|
TODO improve settings management -> move settings class in client/server classes, move actual settings variables
|
||||||
TODO improve interaction between use of inifile and command line parameters (edited) #120
|
TODO improve interaction between use of inifile and command line parameters (edited) #120
|
||||||
|
|
|
@ -404,7 +404,8 @@ CServer::CServer ( const int iNewMaxNumChan,
|
||||||
|
|
||||||
// manage welcome message: if the welcome message is a valid link to a local
|
// manage welcome message: if the welcome message is a valid link to a local
|
||||||
// file, the content of that file is used as the welcome message (#361)
|
// file, the content of that file is used as the welcome message (#361)
|
||||||
strWelcomeMessage = strNewWelcomeMessage; // first copy text, may be overwritten
|
SetWelcomeMessage ( strNewWelcomeMessage ); // first use given text, may be overwritten
|
||||||
|
|
||||||
if ( QFileInfo ( strNewWelcomeMessage ).exists() )
|
if ( QFileInfo ( strNewWelcomeMessage ).exists() )
|
||||||
{
|
{
|
||||||
QFile file ( strNewWelcomeMessage );
|
QFile file ( strNewWelcomeMessage );
|
||||||
|
@ -412,13 +413,10 @@ CServer::CServer ( const int iNewMaxNumChan,
|
||||||
if ( file.open ( QIODevice::ReadOnly | QIODevice::Text ) )
|
if ( file.open ( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
{
|
{
|
||||||
// use entire file content for the welcome message
|
// use entire file content for the welcome message
|
||||||
strWelcomeMessage = file.readAll();
|
SetWelcomeMessage ( file.readAll() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// restrict welcome message to maximum allowed length
|
|
||||||
strWelcomeMessage = strWelcomeMessage.left ( MAX_LEN_CHAT_TEXT );
|
|
||||||
|
|
||||||
// enable jam recording (if requested) - kicks off the thread (note
|
// enable jam recording (if requested) - kicks off the thread (note
|
||||||
// that jam recorder needs the frame size which is given to the jam
|
// that jam recorder needs the frame size which is given to the jam
|
||||||
// recorder in the SetRecordingDir() function)
|
// recorder in the SetRecordingDir() function)
|
||||||
|
@ -631,6 +629,7 @@ void CServer::OnNewConnection ( int iChID,
|
||||||
vecChannels[iChID].CreateReqChanInfoMes();
|
vecChannels[iChID].CreateReqChanInfoMes();
|
||||||
|
|
||||||
// send welcome message (if enabled)
|
// send welcome message (if enabled)
|
||||||
|
MutexWelcomeMessage.lock();
|
||||||
if ( !strWelcomeMessage.isEmpty() )
|
if ( !strWelcomeMessage.isEmpty() )
|
||||||
{
|
{
|
||||||
// create formatted server welcome message and send it just to
|
// create formatted server welcome message and send it just to
|
||||||
|
@ -640,6 +639,7 @@ void CServer::OnNewConnection ( int iChID,
|
||||||
|
|
||||||
vecChannels[iChID].CreateChatTextMes ( strWelcomeMessageFormated );
|
vecChannels[iChID].CreateChatTextMes ( strWelcomeMessageFormated );
|
||||||
}
|
}
|
||||||
|
MutexWelcomeMessage.unlock();
|
||||||
|
|
||||||
// send licence request message (if enabled)
|
// send licence request message (if enabled)
|
||||||
if ( eLicenceType != LT_NO_LICENCE )
|
if ( eLicenceType != LT_NO_LICENCE )
|
||||||
|
@ -1554,6 +1554,16 @@ void CServer::SetEnableRecording ( bool bNewEnableRecording )
|
||||||
CreateAndSendRecorderStateForAllConChannels();
|
CreateAndSendRecorderStateForAllConChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CServer::SetWelcomeMessage ( const QString& strNWelcMess )
|
||||||
|
{
|
||||||
|
// we need a mutex to secure access
|
||||||
|
QMutexLocker locker ( &MutexWelcomeMessage );
|
||||||
|
strWelcomeMessage = strNWelcMess;
|
||||||
|
|
||||||
|
// restrict welcome message to maximum allowed length
|
||||||
|
strWelcomeMessage = strWelcomeMessage.left ( MAX_LEN_CHAT_TEXT );
|
||||||
|
}
|
||||||
|
|
||||||
void CServer::StartStatusHTMLFileWriting ( const QString& strNewFileName,
|
void CServer::StartStatusHTMLFileWriting ( const QString& strNewFileName,
|
||||||
const QString& strNewServerNameWithPort )
|
const QString& strNewServerNameWithPort )
|
||||||
{
|
{
|
||||||
|
|
|
@ -254,6 +254,9 @@ public:
|
||||||
QLocale::Country GetServerCountry()
|
QLocale::Country GetServerCountry()
|
||||||
{ return ServerListManager.GetServerCountry(); }
|
{ return ServerListManager.GetServerCountry(); }
|
||||||
|
|
||||||
|
void SetWelcomeMessage ( const QString& strNWelcMess );
|
||||||
|
QString GetWelcomeMessage() { return strWelcomeMessage; }
|
||||||
|
|
||||||
ESvrRegStatus GetSvrRegStatus() { return ServerListManager.GetSvrRegStatus(); }
|
ESvrRegStatus GetSvrRegStatus() { return ServerListManager.GetSvrRegStatus(); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -323,6 +326,7 @@ protected:
|
||||||
int iMaxNumChannels;
|
int iMaxNumChannels;
|
||||||
CProtocol ConnLessProtocol;
|
CProtocol ConnLessProtocol;
|
||||||
QMutex Mutex;
|
QMutex Mutex;
|
||||||
|
QMutex MutexWelcomeMessage;
|
||||||
|
|
||||||
// audio encoder/decoder
|
// audio encoder/decoder
|
||||||
OpusCustomMode* Opus64Mode[MAX_NUM_CHANNELS];
|
OpusCustomMode* Opus64Mode[MAX_NUM_CHANNELS];
|
||||||
|
|
|
@ -333,6 +333,12 @@ lvwClients->setMinimumHeight ( 140 );
|
||||||
// language combo box (corrects the setting if language not found)
|
// language combo box (corrects the setting if language not found)
|
||||||
cbxLanguage->Init ( pSettings->strLanguage );
|
cbxLanguage->Init ( pSettings->strLanguage );
|
||||||
|
|
||||||
|
// setup welcome message GUI control
|
||||||
|
tedWelcomeMessage->setPlaceholderText ( tr (
|
||||||
|
"Type a message here. If no message is set, the server welcome is disabled." ) );
|
||||||
|
|
||||||
|
tedWelcomeMessage->setText ( pServer->GetWelcomeMessage() );
|
||||||
|
|
||||||
// update GUI dependencies
|
// update GUI dependencies
|
||||||
UpdateGUIDependencies();
|
UpdateGUIDependencies();
|
||||||
|
|
||||||
|
@ -415,6 +421,9 @@ lvwClients->setMinimumHeight ( 140 );
|
||||||
this, &CServerDlg::OnTimer );
|
this, &CServerDlg::OnTimer );
|
||||||
|
|
||||||
// other
|
// other
|
||||||
|
QObject::connect ( tedWelcomeMessage, &QTextEdit::textChanged,
|
||||||
|
this, &CServerDlg::OnWelcomeMessageChanged );
|
||||||
|
|
||||||
QObject::connect ( pServer, &CServer::Started,
|
QObject::connect ( pServer, &CServer::Started,
|
||||||
this, &CServerDlg::OnServerStarted );
|
this, &CServerDlg::OnServerStarted );
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ public slots:
|
||||||
void OnSysTrayMenuHide() { hide(); }
|
void OnSysTrayMenuHide() { hide(); }
|
||||||
void OnSysTrayMenuExit() { close(); }
|
void OnSysTrayMenuExit() { close(); }
|
||||||
void OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason );
|
void OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason );
|
||||||
|
void OnWelcomeMessageChanged() { pServer->SetWelcomeMessage ( tedWelcomeMessage->toPlainText() ); }
|
||||||
|
|
||||||
void keyPressEvent ( QKeyEvent *e ) // block escape key
|
void keyPressEvent ( QKeyEvent *e ) // block escape key
|
||||||
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
|
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>588</width>
|
<width>588</width>
|
||||||
<height>435</height>
|
<height>560</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -185,6 +185,23 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chat Window Welcome (HTML/CSS Supported)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="tedWelcomeMessage">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tabOptions">
|
<widget class="QWidget" name="tabOptions">
|
||||||
|
@ -279,6 +296,7 @@
|
||||||
<tabstop>chbEnableRecorder</tabstop>
|
<tabstop>chbEnableRecorder</tabstop>
|
||||||
<tabstop>edtCurrentSessionDir</tabstop>
|
<tabstop>edtCurrentSessionDir</tabstop>
|
||||||
<tabstop>pbtNewRecording</tabstop>
|
<tabstop>pbtNewRecording</tabstop>
|
||||||
|
<tabstop>tedWelcomeMessage</tabstop>
|
||||||
<tabstop>cbxLanguage</tabstop>
|
<tabstop>cbxLanguage</tabstop>
|
||||||
<tabstop>pbtRecordingDir</tabstop>
|
<tabstop>pbtRecordingDir</tabstop>
|
||||||
<tabstop>edtRecordingDir</tabstop>
|
<tabstop>edtRecordingDir</tabstop>
|
||||||
|
|
Loading…
Reference in a new issue