mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Initialize WinSock and hide the information about the local device
On Windows we cannot select a device or show information about the local device. Therefore we disable the UI section related to local device details. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									2af14ba445
								
							
						
					
					
						commit
						74187657e5
					
				
					 1 changed files with 18 additions and 1 deletions
				
			
		|  | @ -25,7 +25,23 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) : | ||||||
| 		this, SLOT(itemClicked(QListWidgetItem*))); | 		this, SLOT(itemClicked(QListWidgetItem*))); | ||||||
| 
 | 
 | ||||||
| #if defined(Q_OS_WIN) | #if defined(Q_OS_WIN) | ||||||
| 	// TODO do the initialization
 | 	ULONG       ulRetCode = SUCCESS; | ||||||
|  | 	WSADATA     WSAData = { 0 }; | ||||||
|  | 
 | ||||||
|  | 	// Initialize WinSock and ask for version 2.2.
 | ||||||
|  | 	ulRetCode = WSAStartup(MAKEWORD(2, 2), &WSAData); | ||||||
|  | 	if (ulRetCode != SUCCESS) { | ||||||
|  | 		QMessageBox::StandardButton warningBox; | ||||||
|  | 		warningBox = QMessageBox::critical(this, "Bluetooth", | ||||||
|  | 						   "Could not initialize the Winsock version 2.2", QMessageBox::Ok); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	// Initialize the device discovery agent
 | ||||||
|  | 	initializeDeviceDiscoveryAgent(); | ||||||
|  | 
 | ||||||
|  | 	// On Windows we cannot select a device or show information about the local device
 | ||||||
|  | 	ui->localDeviceDetails->hide(); | ||||||
| #else | #else | ||||||
| 	// Initialize the local Bluetooth device
 | 	// Initialize the local Bluetooth device
 | ||||||
| 	localDevice = new QBluetoothLocalDevice(); | 	localDevice = new QBluetoothLocalDevice(); | ||||||
|  | @ -71,6 +87,7 @@ BtDeviceSelectionDialog::~BtDeviceSelectionDialog() | ||||||
| 
 | 
 | ||||||
| #if defined(Q_OS_WIN) | #if defined(Q_OS_WIN) | ||||||
| 	// Terminate the use of Winsock 2 DLL
 | 	// Terminate the use of Winsock 2 DLL
 | ||||||
|  | 	WSACleanup(); | ||||||
| #else | #else | ||||||
| 	// Clean the local device
 | 	// Clean the local device
 | ||||||
| 	delete localDevice; | 	delete localDevice; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue