| 166 | } |
| 167 | |
| 168 | QString locationsString(const QList<IPC::CliCommands::IpcLocation> &locations) |
| 169 | { |
| 170 | QString msg; |
| 171 | |
| 172 | for(const IPC::CliCommands::IpcLocation &location : locations) { |
| 173 | QString locationStr; |
| 174 | |
| 175 | if (location.city.isEmpty()) { // Best Location |
| 176 | locationStr = QString("%1 - %2").arg(location.country, location.nickname); |
| 177 | } else if (location.country.isEmpty()) { // Static IP |
| 178 | locationStr = QString("%1 - %2").arg(location.city, location.nickname); |
| 179 | } else { |
| 180 | locationStr = QString("%1 - %2 - %3").arg(location.country, location.city, location.nickname); |
| 181 | } |
| 182 | |
| 183 | // Add pinned IP if present |
| 184 | if (!location.pinnedIp.isEmpty()) { |
| 185 | locationStr += QString(" [%1]").arg(location.pinnedIp); |
| 186 | } |
| 187 | |
| 188 | if (location.flags & (int)IPC::CliCommands::LocationFlags::kDisabled) { |
| 189 | if (location.flags & (int)IPC::CliCommands::LocationFlags::kPremium) { |
| 190 | locationStr += QObject::tr(" (Pro)"); |
| 191 | } else { |
| 192 | locationStr += QObject::tr(" (Disabled)"); |
| 193 | } |
| 194 | } |
| 195 | if (location.flags & (int)IPC::CliCommands::LocationFlags::k10Gbps) { |
| 196 | locationStr += QObject::tr(" (10 Gbps)"); |
| 197 | } |
| 198 | |
| 199 | msg += locationStr + "\n"; |
| 200 | } |
| 201 | |
| 202 | return msg.trimmed(); |
| 203 | } |
no test coverage detected