bug fix for server list filter, reported by pljones

This commit is contained in:
Volker Fischer 2020-04-19 09:39:58 +02:00
parent 8e86908d92
commit 6b1dac7ac8
3 changed files with 38 additions and 25 deletions

View file

@ -3,18 +3,16 @@
3.5.2git 3.5.2git
TODO offer the Jamulus ASIO settingspanel in case of an ASIO ERROR to fix, e.g., incorrect sample rate (https://sourceforge.net/p/llcon/discussion/533517/thread/777663cf94/#035f) TODO store Show All Musicians setting in the ini-file
TODO try to find a way to catch Windows exceptions in case a 64 bit Jamulus tries to load a 32 bit Jack Audio ASIO dll TODO if you select server list filter all text and delete, the filter is not updated
TODO improve audio drop out behaviour with OPUS64 by tuning the coding rate (it seems that for some coding rates we get loud artifacts TODO improve audio drop out behaviour with OPUS64 by tuning the coding rate (it seems that for some coding rates we get loud artifacts
on audio drop outs whereas for slightly different rates the behavior is much more pleasent) on audio drop outs whereas for slightly different rates the behavior is much more pleasent)
TODO store Show All Musicians setting in the ini-file TODO offer the Jamulus ASIO settingspanel in case of an ASIO ERROR to fix, e.g., incorrect sample rate (https://sourceforge.net/p/llcon/discussion/533517/thread/777663cf94/#035f)
TODO bug fix: "Start up the new version with the Connection Setup showing. "Show all musicians" is on (as I say). Switch it off before the list is displayed. The TODO try to find a way to catch Windows exceptions in case a 64 bit Jamulus tries to load a 32 bit Jack Audio ASIO dll
checkbox is off - but the list displays all musicians! You need to turn it on and off again to get it to do its thing. (If you wait a little, it's fine -
i.e. before it's populated the musicians but after it's displayed the list, turn it off.)", see https://github.com/corrados/jamulus/issues/78
TODO the server list filter seems not to work if --showallservers is used TODO the server list filter seems not to work if --showallservers is used

View file

@ -36,7 +36,8 @@ CConnectDlg::CConnectDlg ( const bool bNewShowCompleteRegList,
bShowCompleteRegList ( bNewShowCompleteRegList ), bShowCompleteRegList ( bNewShowCompleteRegList ),
bServerListReceived ( false ), bServerListReceived ( false ),
bServerListItemWasChosen ( false ), bServerListItemWasChosen ( false ),
bListFilterWasActive ( false ) bListFilterWasActive ( false ),
bShowAllMusicians ( true )
{ {
setupUi ( this ); setupUi ( this );
@ -219,11 +220,8 @@ void CConnectDlg::RequestServerList()
// clear filter edit box // clear filter edit box
edtFilter->setText ( "" ); edtFilter->setText ( "" );
// per default we expand all list items (not for the show all servers mode) // update Show All Musicians check box (this will call ShowAllMusicians())
if ( !bShowCompleteRegList ) chbExpandAll->setCheckState ( bShowAllMusicians ? Qt::Checked : Qt::Unchecked );
{
chbExpandAll->setCheckState ( Qt::Checked );
}
// get the IP address of the central server (using the ParseNetworAddress // get the IP address of the central server (using the ParseNetworAddress
// function) when the connect dialog is opened, this seems to be the correct // function) when the connect dialog is opened, this seems to be the correct
@ -385,7 +383,7 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
pNewListViewItem->setData ( 0, Qt::UserRole, CurHostAddress.toString() ); pNewListViewItem->setData ( 0, Qt::UserRole, CurHostAddress.toString() );
// per default expand the list item (if not "show all servers") // per default expand the list item (if not "show all servers")
if ( !bShowCompleteRegList ) if ( bShowAllMusicians )
{ {
lvwServers->expandItem ( pNewListViewItem ); lvwServers->expandItem ( pNewListViewItem );
} }
@ -514,9 +512,11 @@ void CConnectDlg::OnServerAddrEditTextChanged ( const QString& )
lvwServers->clearSelection(); lvwServers->clearSelection();
} }
void CConnectDlg::OnExpandAllStateChanged ( int value ) void CConnectDlg::ShowAllMusicians ( const bool bState )
{ {
if ( value == Qt::Checked ) bShowAllMusicians = bState;
if ( bState )
{ {
lvwServers->expandAll(); lvwServers->expandAll();
} }
@ -537,33 +537,41 @@ void CConnectDlg::UpdateListFilter()
for ( int iIdx = 0; iIdx < iServerListLen; iIdx++ ) for ( int iIdx = 0; iIdx < iServerListLen; iIdx++ )
{ {
QTreeWidgetItem* pCurListViewItem = lvwServers->topLevelItem ( iIdx );
bool bFilterFound = false; bool bFilterFound = false;
// search server name // search server name
if ( lvwServers->topLevelItem ( iIdx )->text ( 0 ).indexOf ( sFilterText, 0, Qt::CaseInsensitive ) >= 0 ) if ( pCurListViewItem->text ( 0 ).indexOf ( sFilterText, 0, Qt::CaseInsensitive ) >= 0 )
{ {
bFilterFound = true; bFilterFound = true;
} }
// search location // search location
if ( lvwServers->topLevelItem ( iIdx )->text ( 3 ).indexOf ( sFilterText, 0, Qt::CaseInsensitive ) >= 0 ) if ( pCurListViewItem->text ( 3 ).indexOf ( sFilterText, 0, Qt::CaseInsensitive ) >= 0 )
{ {
bFilterFound = true; bFilterFound = true;
} }
// search childs // search childs
for ( int iCCnt = 0; iCCnt < lvwServers->topLevelItem ( iIdx )->childCount(); iCCnt++ ) for ( int iCCnt = 0; iCCnt < pCurListViewItem->childCount(); iCCnt++ )
{ {
if ( lvwServers->topLevelItem ( iIdx )->child ( iCCnt )->text ( 0 ).indexOf ( sFilterText, 0, Qt::CaseInsensitive ) >= 0 ) if ( pCurListViewItem->child ( iCCnt )->text ( 0 ).indexOf ( sFilterText, 0, Qt::CaseInsensitive ) >= 0 )
{ {
bFilterFound = true; bFilterFound = true;
} }
} }
// only update Hide state if ping time was received // only update Hide state if ping time was received
if ( !lvwServers->topLevelItem ( iIdx )->text ( 1 ).isEmpty() ) if ( !pCurListViewItem->text ( 1 ).isEmpty() )
{ {
lvwServers->topLevelItem ( iIdx )->setHidden ( !bFilterFound ); // only update hide and expand status if the hide state has to be changed to
// preserve if user clicked on expand icon manually
if ( ( pCurListViewItem->isHidden() && bFilterFound ) ||
( !pCurListViewItem->isHidden() && !bFilterFound ) )
{
pCurListViewItem->setHidden ( !bFilterFound );
pCurListViewItem->setExpanded ( bShowAllMusicians );
}
} }
} }
} }
@ -577,8 +585,13 @@ void CConnectDlg::UpdateListFilter()
for ( int iIdx = 0; iIdx < iServerListLen; iIdx++ ) for ( int iIdx = 0; iIdx < iServerListLen; iIdx++ )
{ {
// if ping time is empty, hide item QTreeWidgetItem* pCurListViewItem = lvwServers->topLevelItem ( iIdx );
lvwServers->topLevelItem ( iIdx )->setHidden ( lvwServers->topLevelItem ( iIdx )->text ( 1 ).isEmpty() );
// if ping time is empty, hide item (if not already hidden)
if ( pCurListViewItem->text ( 1 ).isEmpty() && !pCurListViewItem->isHidden() )
{
pCurListViewItem->setHidden ( true );
}
} }
bListFilterWasActive = false; bListFilterWasActive = false;

View file

@ -83,6 +83,7 @@ protected:
QTreeWidgetItem* GetParentListViewItem ( QTreeWidgetItem* pItem ); QTreeWidgetItem* GetParentListViewItem ( QTreeWidgetItem* pItem );
void DeleteAllListViewItemChilds ( QTreeWidgetItem* pItem ); void DeleteAllListViewItemChilds ( QTreeWidgetItem* pItem );
void UpdateListFilter(); void UpdateListFilter();
void ShowAllMusicians ( const bool bState );
QTimer TimerPing; QTimer TimerPing;
QTimer TimerReRequestServList; QTimer TimerReRequestServList;
@ -94,13 +95,14 @@ protected:
bool bServerListReceived; bool bServerListReceived;
bool bServerListItemWasChosen; bool bServerListItemWasChosen;
bool bListFilterWasActive; bool bListFilterWasActive;
bool bShowAllMusicians;
public slots: public slots:
void OnServerListItemSelectionChanged(); void OnServerListItemSelectionChanged();
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
void OnServerAddrEditTextChanged ( const QString& ); void OnServerAddrEditTextChanged ( const QString& );
void OnFilterTextEdited ( const QString& ) { UpdateListFilter(); } void OnFilterTextEdited ( const QString& ) { UpdateListFilter(); }
void OnExpandAllStateChanged ( int value ); void OnExpandAllStateChanged ( int value ) { ShowAllMusicians ( value == Qt::Checked ); }
void OnConnectClicked(); void OnConnectClicked();
void OnTimerPing(); void OnTimerPing();
void OnTimerReRequestServList(); void OnTimerReRequestServList();