void Maze::resize(float width, float heigth) { mWidth = width; mHeigth = heigth; updateRatio(); };
NetCamView::NetCamView(int friendId, QWidget* parent) : GenericNetCamView(parent) , selfFrame{nullptr} , friendId{friendId} { QString id = FriendList::findFriend(friendId)->getToxId().toString(); videoSurface = new VideoSurface(Nexus::getProfile()->loadAvatar(id), this); videoSurface->setMinimumHeight(256); videoSurface->setContentsMargins(6, 6, 6, 6); verLayout->insertWidget(0, videoSurface, 1); selfVideoSurface = new VideoSurface(Nexus::getProfile()->loadAvatar(), this, true); selfVideoSurface->setObjectName(QStringLiteral("CamVideoSurface")); selfVideoSurface->setMouseTracking(true); selfVideoSurface->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); selfFrame = new MovableWidget(videoSurface); selfFrame->show(); QHBoxLayout* frameLayout = new QHBoxLayout(selfFrame); frameLayout->addWidget(selfVideoSurface); frameLayout->setMargin(0); updateRatio(); connect(selfVideoSurface, &VideoSurface::ratioChanged, this, &NetCamView::updateRatio); connect(videoSurface, &VideoSurface::boundaryChanged, [this]() { QRect boundingRect = videoSurface->getBoundingRect(); updateFrameSize(boundingRect.size()); selfFrame->setBoundary(boundingRect); }); connect(videoSurface, &VideoSurface::ratioChanged, [this]() { selfFrame->setMinimumWidth(selfFrame->minimumHeight() * selfVideoSurface->getRatio()); QRect boundingRect = videoSurface->getBoundingRect(); updateFrameSize(boundingRect.size()); selfFrame->resetBoundary(boundingRect); }); connect(Core::getInstance(), &Core::selfAvatarChanged, [this](const QPixmap& pixmap) { selfVideoSurface->setAvatar(pixmap); }); connect(Core::getInstance(), &Core::friendAvatarChanged, [this](int FriendId, const QPixmap& pixmap) { if (this->friendId == FriendId) videoSurface->setAvatar(pixmap); }); VideoMode videoMode; QSize videoSize = Settings::getInstance().getCamVideoRes(); videoMode.width = videoSize.width(); videoMode.height = videoSize.height(); qDebug() << "SIZER" << videoSize; videoMode.FPS = Settings::getInstance().getCamVideoFPS(); }
static void addStats(tr_session_stats* setme, tr_session_stats const* a, tr_session_stats const* b) { setme->uploadedBytes = a->uploadedBytes + b->uploadedBytes; setme->downloadedBytes = a->downloadedBytes + b->downloadedBytes; setme->filesAdded = a->filesAdded + b->filesAdded; setme->sessionCount = a->sessionCount + b->sessionCount; setme->secondsActive = a->secondsActive + b->secondsActive; updateRatio(setme); }
Maze::Maze(std::string filename, int width, int heigth) { mFilename = filename; mWidth = width; mHeigth = heigth; loadMaze(); updateRatio(); }
void tr_sessionGetStats(tr_session const* session, tr_session_stats* setme) { struct tr_stats_handle const* stats = getStats(session); if (stats != NULL) { *setme = stats->single; setme->secondsActive = tr_time() - stats->startTime; updateRatio(setme); } }
NetCamView::NetCamView(int friendId, QWidget* parent) : GenericNetCamView(parent) , selfFrame{nullptr} , friendPk{FriendList::findFriend(friendId)->getPublicKey()} , e(false) { videoSurface = new VideoSurface(Nexus::getProfile()->loadAvatar(friendPk), this); videoSurface->setMinimumHeight(256); verLayout->insertWidget(0, videoSurface, 1); selfVideoSurface = new VideoSurface(Nexus::getProfile()->loadAvatar(), this, true); selfVideoSurface->setObjectName(QStringLiteral("CamVideoSurface")); selfVideoSurface->setMouseTracking(true); selfVideoSurface->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); selfFrame = new MovableWidget(videoSurface); selfFrame->show(); QHBoxLayout* frameLayout = new QHBoxLayout(selfFrame); frameLayout->addWidget(selfVideoSurface); frameLayout->setMargin(0); updateRatio(); connections += connect(selfVideoSurface, &VideoSurface::ratioChanged, this, &NetCamView::updateRatio); connections += connect(videoSurface, &VideoSurface::boundaryChanged, [this]() { QRect boundingRect = videoSurface->getBoundingRect(); updateFrameSize(boundingRect.size()); selfFrame->setBoundary(boundingRect); }); connections += connect(videoSurface, &VideoSurface::ratioChanged, [this]() { selfFrame->setMinimumWidth(selfFrame->minimumHeight() * selfVideoSurface->getRatio()); QRect boundingRect = videoSurface->getBoundingRect(); updateFrameSize(boundingRect.size()); selfFrame->resetBoundary(boundingRect); }); connections += connect(Nexus::getProfile(), &Profile::selfAvatarChanged, [this](const QPixmap& pixmap) { selfVideoSurface->setAvatar(pixmap); }); connections += connect(Nexus::getProfile(), &Profile::friendAvatarChanged, [this](ToxPk friendPk, const QPixmap& pixmap) { if (this->friendPk == friendPk) videoSurface->setAvatar(pixmap); }); QRect videoSize = Settings::getInstance().getCamVideoRes(); qDebug() << "SIZER" << videoSize; }
Mode(int i) { DisplayMode_Native_GetMode(i, this); updateRatio(); }