MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), network_(new QNetworkAccessManager(this)), timer_(new QTimer(this)), agentRunning_(false) { ui->setupUi(this); config_ = std::make_shared<Config>(); //QString logfile, const QString& clientEmailAddr, const QString& clientSenderName, const QString& clientGmailPassw, QList<QString> recipients log_ = std::make_shared<ApplicationLogger>("log.log", config_->agentInfoConfig().ClientEmailAddr_, config_->agentInfoConfig().ClientName_, config_->agentInfoConfig().SmtpPassw_, config_->agentInfoConfig().receiversEmail_); transLog_ = std::make_shared<TransactionLogger>("transaction.log", config_->agentInfoConfig().ClientEmailAddr_, config_->agentInfoConfig().ClientName_,config_->agentInfoConfig().SmtpPassw_, config_->agentInfoConfig().receiversEmail_, config_); assets_ = std::make_shared<AssetsManager>(config_, transLog_); neurnet_ = std::make_shared<NeuralNet>(config_, log_, ui); assets_->setMoney(config_->assetsConfig().money()); assets_->setEnergy(config_->assetsConfig().energy()); assets_->setRealSystemPrice(config_->assetsConfig().lastSysPrice()); agentController_ = std::unique_ptr<AgentController>(new AgentController(config_, log_, neurnet_, assets_)); QObject::connect(network_.get(), SIGNAL(finished(QNetworkReply*)), this, SLOT(onReply(QNetworkReply*))); QObject::connect(timer_.get(), SIGNAL(timeout()), this, SLOT(onTimerUpdate())); QObject::connect(log_.get(), SIGNAL(valueChanged(QString)), this, SLOT(appendWindowLog(QString))); QObject::connect(transLog_.get(), SIGNAL(valueChanged(QString)), this, SLOT(appendWindowLog(QString))); ui->txtbxOverviewLog->setReadOnly(true); ui->pbTrainingProgress->setMinimum(0); ui->pbTrainingProgress->setMaximum(config_->neuralConfig().MaxEpochs_); ui->pbTrainingProgress->hide(); ui->txtTrainingStatus->setReadOnly(true); ui->cmbDatasets->clear(); ui->txtTrainerFileName->setText(config_->miscConfig().DefaultTrainSetName_); reloadDatasetFiles(); fetchLatestSpotPrice(); fetchFreshPrices(); updateAll(); // TODO: add mails on own line in config. }
void PetDetailInfoLayer::resetUI() { auto pet = getCurrBag()->getPetByID(getUserID());//-----得到用户点击的宠物 _islock = pet->isLocked(); if (_islock) { _imglock->loadTexture("pet_look_b.png", Widget::TextureResType::PLIST); } else { _imglock->loadTexture("pet_look_a.png", Widget::TextureResType::PLIST); } auto stTimer = StrengthTimerManager::getInstance()->getTaskByPetID(pet->getUserId()); stTimer->onTimerUpdate(); //-----------------------------------宠物图表信息-------------------------------------// _icon->loadTexture(_X(pet->getBigFrontIcon(), _icon)); //------获取宠物的头像 UIHelper::setStars(_stars[0]->getParent(), pet->getStarNum(), pet->getStarMax()); _evaluate->loadTexture(pet->getUintIcon(), Widget::TextureResType::PLIST); //------品种(S, SS, A, 等待) //-----------------------------宠物数据信息--------------------------------------------// _petName->setString(StringUtils::format("Bahamu")); //----宠物名字 _attr->loadTexture(StringUtils::format("base_property%d.png", pet->getKeyPet()->attr), Widget::TextureResType::PLIST); //----宠物的属性(火、水.....) _lv->setString(StringUtils::format("%s.%d", "Lv", pet->getLevel())); //----等级显示 auto monster = MonsterExpConfig::getMonsterExpBy(pet->getLevel()); _lv_Text->setString(StringUtils::format("%d/%d", pet->getExp(), monster->expLvup)); //升级经验数值 _lv_LoadingBar->setPercent(pet->getExp() * 100.0 / monster->expLvup); //经验条 _hp_Text->setString(StringUtils::format("%d/%d", pet->getHP(), pet->getHpMax())); //hp数值 _hp_LoadingBar->setPercent(pet->getHP() * 100.0 / pet->getHpMax()); _energy_Text->setString(_T("%d/100", pet->getStrength())); //------能量值 _energy_Text->runAction(UserPetTimer::create(_uid)); _energy_LoadingBar->setPercent(pet->getStrength()); //------能量条显示为0 _energy_LoadingBar->runAction(UserPetTimer::create(_uid)); _hp_Value->setString(StringUtils::format("%d", pet->getBaseHp())); //-------血量 _hp_add->setString(StringUtils::format("+%d", pet->getAddedHp())); //-------额外增加的 _atk_Value->setString(StringUtils::format("%d", pet->getBaseAttack())); //-------攻击 _atk_add->setString(StringUtils::format("+%d", pet->getAddedAttack())); //-------额外增加的 _def_Value->setString(StringUtils::format("%d", pet->getBaseDefense())); //-------防御力 _def_add->setString(StringUtils::format("+%d", pet->getAddedDefense())); _atc_Value->setString(StringUtils::format("%d", pet->getBaseMAttack())); //------魔攻 _atc_add->setString(StringUtils::format("+%d", pet->getAddedMAttack())); _dec_Value->setString(StringUtils::format("%d", pet->getBaseMDefense())); //------魔防 _dec_add->setString(StringUtils::format("+%d", pet->getAddedMDefense())); _spe_Value->setString(StringUtils::format("%d", pet->getBaseSpeed())); //------速度 _spe_add->setString(StringUtils::format("+%d", pet->getAddedSpeed())); }