foreach (const Login::UserInfo &user, userInfos) {
     if (!userIsBot(user)) {
         Geo::Location userLocation = mainController->getGeoLocation(user.getIp());
         QLabel *label = new PlayerLabel(ui->usersPanel, user, userLocation);
         ui->usersPanel->layout()->addWidget(label);
         ui->usersPanel->layout()->setAlignment(Qt::AlignTop);
     }
 }
Beispiel #2
0
    foreach (const Login::UserInfo &user, userInfos) {
        if (!userIsBot(user)) {
            QLabel *label = new QLabel(ui->usersPanel);
            label->setTextFormat(Qt::RichText);
            Geo::Location userLocation = mainController->getGeoLocation(user.getIp());
            QString userString = user.getName();
            QString imageString = "";
            if (!userLocation.isUnknown()) {
                userString += " <i>(" + userLocation.getCountryName() + ")</i>";
                QString countryCode = userLocation.getCountryCode().toLower();
                imageString = "<img src=:/flags/flags/" + countryCode +".png> ";
                label->setToolTip("");
            } else {
                imageString = "<img src=:/images/warning.png> ";
                label->setToolTip(user.getName() + " location is not available at moment!");
            }
            label->setText(imageString + userString);

            ui->usersPanel->layout()->addWidget(label);
            ui->usersPanel->layout()->setAlignment(Qt::AlignTop);
        }
    }