void AdamantShopPlugin::loadShops(const QStringList ¤tLeagues) { _shops.clear(); QStringList leagues = currentLeagues; // NOTE(rory): Load leagues auto list = shopsPath().entryInfoList({"*.shop"}); for (QFileInfo info : list) { if (leagues.contains(info.baseName())) continue; leagues.append(info.baseName()); } // NOTE(rory): for (const QString& league : leagues) { if (_shops.contains(league)) continue; bool disabled = !currentLeagues.contains(league); auto shop = loadShop(shopsPath().absoluteFilePath(QString("%1.shop").arg(league))); if (!shop) { shop = new Shop(league); shop->setUnused(); } shop->setDisabled(disabled); _shops.insert(shop->league(), shop); _viewer->addShop(shop); } }
void LoginDialog::OnMainPageFinished() { QNetworkReply *reply = qobject_cast<QNetworkReply *>(QObject::sender()); QString html(reply->readAll()); QRegExp regexp("/account/view-profile/(.*)\""); regexp.setMinimal(true); int pos = regexp.indexIn(html); if (pos == -1) { DisplayError("Failed to find account name."); return; } QString account = regexp.cap(1); QLOG_DEBUG() << "Logged in as:" << account; std::string league(ui->leagueComboBox->currentText().toStdString()); app_->InitLogin(std::move(login_manager_), league, account.toStdString()); mw = new MainWindow(std::move(app_)); mw->setWindowTitle(QString("Acquisition - %1").arg(league.c_str())); mw->show(); close(); }