2013-01-23 11:41:13 +01:00
|
|
|
/******************************************************************************\
|
2020-01-01 15:41:43 +01:00
|
|
|
* Copyright (c) 2004-2020
|
2013-01-23 11:41:13 +01:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
2020-06-08 22:58:11 +02:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2013-01-23 11:41:13 +01:00
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
2020-06-24 17:26:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QWhatsThis>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QLocale>
|
|
|
|
#include "global.h"
|
|
|
|
#include "client.h"
|
2014-01-05 19:26:38 +01:00
|
|
|
#include "multicolorled.h"
|
2013-01-23 11:41:13 +01:00
|
|
|
#include "ui_connectdlgbase.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Definitions ****************************************************************/
|
|
|
|
// defines the time interval at which the request server list message is re-
|
|
|
|
// transmitted until it is received
|
|
|
|
#define SERV_LIST_REQ_UPDATE_TIME_MS 2000 // ms
|
|
|
|
|
|
|
|
|
|
|
|
/* Classes ********************************************************************/
|
|
|
|
class CConnectDlg : public QDialog, private Ui_CConnectDlgBase
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-05-16 17:35:38 +02:00
|
|
|
CConnectDlg ( CClient* pNCliP,
|
|
|
|
const bool bNewShowCompleteRegList,
|
|
|
|
QWidget* parent = nullptr,
|
2019-05-17 22:55:46 +02:00
|
|
|
Qt::WindowFlags f = nullptr );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-04-12 12:33:50 +02:00
|
|
|
void Init ( const CVector<QString>& vstrIPAddresses );
|
|
|
|
void SetCentralServerAddress ( const QString strNewCentralServerAddr ) { strCentralServerAddress = strNewCentralServerAddr; }
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2020-04-19 10:04:19 +02:00
|
|
|
void SetShowAllMusicians ( const bool bState ) { ShowAllMusicians ( bState ); }
|
|
|
|
bool GetShowAllMusicians() { return bShowAllMusicians; }
|
|
|
|
|
2013-01-23 11:41:13 +01:00
|
|
|
void SetServerList ( const CHostAddress& InetAddr,
|
|
|
|
const CVector<CServerInfo>& vecServerInfo );
|
|
|
|
|
2015-12-09 16:50:30 +01:00
|
|
|
void SetConnClientsList ( const CHostAddress& InetAddr,
|
|
|
|
const CVector<CChannelInfo>& vecChanInfo );
|
|
|
|
|
2020-04-16 22:22:53 +02:00
|
|
|
void SetPingTimeAndNumClientsResult ( const CHostAddress& InetAddr,
|
|
|
|
const int iPingTime,
|
|
|
|
const int iNumClients );
|
2013-01-23 11:41:13 +01:00
|
|
|
|
2014-02-23 10:46:25 +01:00
|
|
|
#ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING
|
2014-02-21 22:25:26 +01:00
|
|
|
void SetVersionAndOSType ( CHostAddress InetAddr,
|
|
|
|
COSUtil::EOpSystemType eOSType,
|
|
|
|
QString strVersion );
|
2014-02-23 10:46:25 +01:00
|
|
|
#endif
|
2014-02-21 22:25:26 +01:00
|
|
|
|
2020-04-12 12:33:50 +02:00
|
|
|
bool GetServerListItemWasChosen() const { return bServerListItemWasChosen; }
|
2013-01-23 11:41:13 +01:00
|
|
|
QString GetSelectedAddress() const { return strSelectedAddress; }
|
|
|
|
QString GetSelectedServerName() const { return strSelectedServerName; }
|
2020-04-12 12:33:50 +02:00
|
|
|
void RequestServerList();
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void showEvent ( QShowEvent* );
|
|
|
|
virtual void hideEvent ( QHideEvent* );
|
|
|
|
|
2015-12-09 16:50:30 +01:00
|
|
|
QTreeWidgetItem* FindListViewItem ( const CHostAddress& InetAddr );
|
|
|
|
QTreeWidgetItem* GetParentListViewItem ( QTreeWidgetItem* pItem );
|
|
|
|
void DeleteAllListViewItemChilds ( QTreeWidgetItem* pItem );
|
2020-04-14 16:51:44 +02:00
|
|
|
void UpdateListFilter();
|
2020-04-19 09:39:58 +02:00
|
|
|
void ShowAllMusicians ( const bool bState );
|
2015-12-09 16:50:30 +01:00
|
|
|
|
2020-05-16 17:35:38 +02:00
|
|
|
CClient* pClient;
|
|
|
|
|
2020-04-12 12:33:50 +02:00
|
|
|
QTimer TimerPing;
|
|
|
|
QTimer TimerReRequestServList;
|
|
|
|
QString strCentralServerAddress;
|
|
|
|
CHostAddress CentralServerAddress;
|
|
|
|
QString strSelectedAddress;
|
|
|
|
QString strSelectedServerName;
|
|
|
|
bool bShowCompleteRegList;
|
|
|
|
bool bServerListReceived;
|
|
|
|
bool bServerListItemWasChosen;
|
2020-04-14 16:51:44 +02:00
|
|
|
bool bListFilterWasActive;
|
2020-04-19 09:39:58 +02:00
|
|
|
bool bShowAllMusicians;
|
2013-01-23 11:41:13 +01:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void OnServerListItemSelectionChanged();
|
|
|
|
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
|
|
|
|
void OnServerAddrEditTextChanged ( const QString& );
|
2020-05-16 17:35:38 +02:00
|
|
|
void OnCentServAddrTypeChanged ( int iTypeIdx ) { pClient->SetCentralServerAddressType ( static_cast<ECSAddType> ( iTypeIdx ) ); }
|
2020-04-14 16:51:44 +02:00
|
|
|
void OnFilterTextEdited ( const QString& ) { UpdateListFilter(); }
|
2020-04-19 09:39:58 +02:00
|
|
|
void OnExpandAllStateChanged ( int value ) { ShowAllMusicians ( value == Qt::Checked ); }
|
2013-01-23 11:41:13 +01:00
|
|
|
void OnConnectClicked();
|
|
|
|
void OnTimerPing();
|
|
|
|
void OnTimerReRequestServList();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void ReqServerListQuery ( CHostAddress InetAddr );
|
|
|
|
void CreateCLServerListPingMes ( CHostAddress InetAddr );
|
2014-02-21 22:25:26 +01:00
|
|
|
void CreateCLServerListReqVerAndOSMes ( CHostAddress InetAddr );
|
2015-12-09 16:50:30 +01:00
|
|
|
void CreateCLServerListReqConnClientsListMes ( CHostAddress InetAddr );
|
2013-01-23 11:41:13 +01:00
|
|
|
};
|