| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -89,13 +89,11 @@ void Networking::connectToNetwork(const Network &n) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void Networking::wrongPassword(const QString &ssid) { | 
					 | 
					 | 
					 | 
					void Networking::wrongPassword(const QString &ssid) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for (Network n : wifi->seen_networks) { | 
					 | 
					 | 
					 | 
					  if (wifi->seenNetworks.contains(ssid)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (n.ssid == ssid) { | 
					 | 
					 | 
					 | 
					    const Network &n = wifi->seenNetworks.value(ssid); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      QString pass = InputDialog::getText("Wrong password", this, "for \"" + n.ssid +"\"", true, 8); | 
					 | 
					 | 
					 | 
					    QString pass = InputDialog::getText("Wrong password", this, "for \"" + n.ssid +"\"", true, 8); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (!pass.isEmpty()) { | 
					 | 
					 | 
					 | 
					    if (!pass.isEmpty()) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        wifi->connect(n, pass); | 
					 | 
					 | 
					 | 
					      wifi->connect(n, pass); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      return; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -228,16 +226,18 @@ void WifiUI::refresh() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // TODO: don't rebuild this every time
 | 
					 | 
					 | 
					 | 
					  // TODO: don't rebuild this every time
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  clearLayout(main_layout); | 
					 | 
					 | 
					 | 
					  clearLayout(main_layout); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (wifi->seen_networks.size() == 0) { | 
					 | 
					 | 
					 | 
					  if (wifi->seenNetworks.size() == 0) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    QLabel *scanning = new QLabel("Scanning for networks..."); | 
					 | 
					 | 
					 | 
					    QLabel *scanning = new QLabel("Scanning for networks..."); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    scanning->setStyleSheet("font-size: 65px;"); | 
					 | 
					 | 
					 | 
					    scanning->setStyleSheet("font-size: 65px;"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    main_layout->addWidget(scanning, 0, Qt::AlignCenter); | 
					 | 
					 | 
					 | 
					    main_layout->addWidget(scanning, 0, Qt::AlignCenter); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return; | 
					 | 
					 | 
					 | 
					    return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  QList<Network> sortedNetworks = wifi->seenNetworks.values(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  std::sort(sortedNetworks.begin(), sortedNetworks.end(), compare_by_strength); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // add networks
 | 
					 | 
					 | 
					 | 
					  // add networks
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  int i = 0; | 
					 | 
					 | 
					 | 
					  int i = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for (Network &network : wifi->seen_networks) { | 
					 | 
					 | 
					 | 
					  for (Network &network : sortedNetworks) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    QHBoxLayout *hlayout = new QHBoxLayout; | 
					 | 
					 | 
					 | 
					    QHBoxLayout *hlayout = new QHBoxLayout; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    hlayout->setContentsMargins(44, 0, 73, 0); | 
					 | 
					 | 
					 | 
					    hlayout->setContentsMargins(44, 0, 73, 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    hlayout->setSpacing(50); | 
					 | 
					 | 
					 | 
					    hlayout->setSpacing(50); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -284,13 +284,13 @@ void WifiUI::refresh() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // Strength indicator
 | 
					 | 
					 | 
					 | 
					    // Strength indicator
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    QLabel *strength = new QLabel(); | 
					 | 
					 | 
					 | 
					    QLabel *strength = new QLabel(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    strength->setPixmap(strengths[std::clamp((int)network.strength/26, 0, 3)]); | 
					 | 
					 | 
					 | 
					    strength->setPixmap(strengths[std::clamp((int)round(network.strength / 33.), 0, 3)]); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    hlayout->addWidget(strength, 0, Qt::AlignRight); | 
					 | 
					 | 
					 | 
					    hlayout->addWidget(strength, 0, Qt::AlignRight); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    main_layout->addLayout(hlayout); | 
					 | 
					 | 
					 | 
					    main_layout->addLayout(hlayout); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // Don't add the last horizontal line
 | 
					 | 
					 | 
					 | 
					    // Don't add the last horizontal line
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (i+1 < wifi->seen_networks.size()) { | 
					 | 
					 | 
					 | 
					    if (i+1 < wifi->seenNetworks.size()) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      main_layout->addWidget(horizontal_line(), 0); | 
					 | 
					 | 
					 | 
					      main_layout->addWidget(horizontal_line(), 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    i++; | 
					 | 
					 | 
					 | 
					    i++; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |