Esempio n. 1
0
void Posture::toPosture(const QString &name)
{
	if (modelList.size() == 0)
		m_iListPage = 0;
	if ((m_iListPage >= modelList.size() / MAXATONCE && modelList.size() % MAXATONCE == 0) || 
		(modelList.size() % MAXATONCE != 0 && m_iListPage > modelList.size() / MAXATONCE))
	{
		if (name != "")
			m_pmPageManager.GetModelByUserID(modelList, name.toStdString(), m_iListPage*MAXATONCE);
		else
			m_pmPageManager.GetModelByUserID(modelList, g_umUserManager.GetUsername(), m_iListPage*MAXATONCE);
	}
	int end = (m_iListPage + 1)*MAXATONCE < modelList.size() ? (m_iListPage + 1)*MAXATONCE : modelList.size();
	m_iListPage = (end - 1) / MAXATONCE;
	m_plwPosWin = new PostureListWindow(this, name, m_iListPage*MAXATONCE, end, modelList);
	CloseCurrentWindow();
	m_wtCurrentWin = POSTURELIST;
	this->setCentralWidget(m_plwPosWin);
	connect(m_plwPosWin, SIGNAL(toHome()), this, SLOT(toHomeWin()));
	connect(m_plwPosWin, SIGNAL(toProfileMode(const QString&)), this, SLOT(toProfileMode(const QString&)));
	connect(m_plwPosWin, SIGNAL(toUpload()), this, SLOT(toUploadMode()));
	connect(m_plwPosWin, SIGNAL(logout()), this, SLOT(logout()));
	connect(m_plwPosWin, SIGNAL(display(const ModelVideo&)), this, SLOT(toDisplay(const ModelVideo&)));
	connect(m_plwPosWin, SIGNAL(prev(const QString&)), this, SLOT(prevList(const QString&)));
	connect(m_plwPosWin, SIGNAL(next(const QString&)), this, SLOT(nextList(const QString&)));
}
Esempio n. 2
0
void ProfileEditWindow::InitWidgets()
{
	SourceManager sm;
	UserPro up;
	sm.GetUserProfile(up, g_umUserManager.GetUsername());
	m_qlName = new QLabel("Username", m_qwBottomRight);
	m_qlName->setObjectName("uploadInfo");
	m_qlName->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
	m_qleName = new QLineEdit(m_qwBottomRight);
	m_qleName->setObjectName("editProfile");
	m_qleName->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
	m_qleName->setText(up.m_sUserName.c_str());
	m_qleName->setReadOnly(true);

	m_qlPwd = new QLabel("Password", m_qwBottomRight);
	m_qlPwd->setObjectName("uploadInfo");
	m_qlPwd->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
	m_qlePwd = new QLineEdit(m_qwBottomRight);
	m_qlePwd->setEchoMode(QLineEdit::Password);
	m_qlePwd->setObjectName("editProfile");
	m_qlePwd->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);

	m_qlPwdc = new QLabel("Password Confirm", m_qwBottomRight);
	m_qlPwdc->setObjectName("uploadInfo");
	m_qlPwdc->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
	m_qlePwdc = new QLineEdit(m_qwBottomRight);
	m_qlePwdc->setEchoMode(QLineEdit::Password);
	m_qlePwdc->setObjectName("editProfile");
	m_qlePwdc->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);

	m_qlEmail = new QLabel("Email", m_qwBottomRight);
	m_qlEmail->setObjectName("uploadInfo");
	m_qlEmail->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
	m_qleEmail = new QLineEdit(m_qwBottomRight);
	m_qleEmail->setText(up.m_sEmail.c_str());
	m_qleEmail->setObjectName("editProfile");
	m_qleEmail->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);

	m_qlError = new QLabel(m_qwBottomRight);

	m_qpbCancel = new QPushButton("Cancel", m_qwBottomRight);
	m_qpbCancel->setObjectName("detail");
	m_qpbCancel->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
	m_qpbSubmit = new QPushButton("Submit", m_qwBottomRight);
	m_qpbSubmit->setObjectName("detail");
	m_qpbSubmit->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
	connect(m_qpbCancel, SIGNAL(clicked()), this, SLOT(cancel()));
	connect(m_qpbSubmit, SIGNAL(clicked()), this, SLOT(submit()));
}
Esempio n. 3
0
void DisplayWindow::BuildBottomRight()
{
	QHBoxLayout *mainLayout = new QHBoxLayout();
	QVBoxLayout *rightLayout = new QVBoxLayout();
	m_qlOutline = new QLabel(QString(m_mvModel.m_sOutLine.c_str()), this);
	m_qlOutline->setObjectName("displayOutline");
	m_qlOutline->setWordWrap(true);
	m_qlOutline->setMinimumSize(DISPLAYOUTLINE_W*xscale, DISPLAYOUTLINE_H*yscale);
	rightLayout->addStretch();
	rightLayout->addWidget(m_qlOutline);
	rightLayout->addSpacing(SPACE);

	QHBoxLayout *favorLayout = new QHBoxLayout();
	srand(time(NULL));
	m_qpbTag = new QPushButton(m_mvModel.m_sFavor.c_str(), this);//[TODO] change the fixed favor into the info of the video
	m_qpbTag->setObjectName("tag");
	m_qpbTag->setFixedSize(TAG_W*xscale, TAG_H*yscale);
	m_qpbTag->setStyleSheet(QString("background-color:rgba(%1,%2,%3,0.5)")
							.arg(rand() % 255).arg(rand() % 255).arg(rand() % 255));
	if (QString(m_mvModel.m_sFavor.c_str()) == "")
		m_qpbTag->hide();
	favorLayout->addWidget(m_qpbTag);
	favorLayout->addStretch();
	rightLayout->addLayout(favorLayout);

	QHBoxLayout *funcLayout = new QHBoxLayout();
	m_qpbLike = new QPushButton("Like", this);
	m_qpbLike->setObjectName("like");
	m_qpbLike->setFixedSize(LIKE_W*xscale, LIKE_H*yscale);
	if (m_mvModel.ifCommend(g_umUserManager.GetUsername()))
	{
		m_qpbLike->setIcon(QIcon(g_sImgRoot + "liked.png"));
		m_qpbLike->setText("Liked");
	}
	else
		m_qpbLike->setIcon(QIcon(g_sImgRoot + "like.png"));
	m_qpbLike->setIconSize(QSize(ICONWIDTH*xscale/2, ICONHEIGHT*yscale/2));
	m_qpbForward = new QPushButton("Forward", this);
	m_qpbForward->setObjectName("like");
	m_qpbForward->setFixedSize(LIKE_W*xscale, LIKE_H*yscale);
	m_qpbForward->setIcon(QIcon(g_sImgRoot + "forward.png"));
	m_qpbForward->setIconSize(QSize(ICONWIDTH*xscale / 2, ICONHEIGHT*yscale / 2));
	if (m_mvModel.m_sPublisher == g_umUserManager.GetUsername())
		m_qpbForward->hide();
	m_qpbComment = new QPushButton("Comment", this);
	m_qpbComment->setObjectName("like");
	m_qpbComment->setFixedSize(LIKE_W*xscale, LIKE_H*yscale);
	m_qpbComment->setIcon(QIcon(g_sImgRoot + "comment.png"));
	m_qpbComment->setIconSize(QSize(ICONWIDTH*xscale / 2, ICONHEIGHT*yscale / 2));
	
	funcLayout->addStretch();
	funcLayout->addWidget(m_qpbLike);
	funcLayout->addWidget(m_qpbForward);
	funcLayout->addWidget(m_qpbComment);
	funcLayout->addSpacing(SPACE);

	//m_dwDisplay = new DisplayWidget("display/demo.ms3d", "1", m_qwBottomRight);
	m_dwDisplay = new DisplayWidget(g_sModel + QString(m_mvModel.m_sVideoID.c_str()),m_mvModel.m_sMode.c_str(), m_qwBottomRight);
	m_dwDisplay->setObjectName("display");
	m_dwDisplay->setFixedSize(DISPLAY_W*xscale, DISPLAY_H*yscale);
	m_qlUser = new QLabel("Uploader: ", m_qwBottomRight);
	m_qlUser->setObjectName("name");
	m_qlUser->setFixedSize(NAME_W*3*xscale, NAME_H*yscale);
	m_qpbUser = new QPushButton(m_mvModel.m_sPublisher.c_str(), m_qwBottomRight);
	m_qpbUser->setObjectName("toProfile");
	m_qpbUser->setFixedSize(TOPROFILE_W*xscale, TOPROFILE_H*yscale);
	m_qtbDesc = new QTextBrowser(this);
	m_qtbDesc->setObjectName("desc");
	m_qtbDesc->setFixedSize(DESC_W*xscale, DESC_H*yscale);
	m_qtbDesc->setText(QString("Description: ") + m_mvModel.m_sDescribe.c_str());
	QHBoxLayout *nameLayout = new QHBoxLayout();
	nameLayout->addWidget(m_qlUser);
	nameLayout->addWidget(m_qpbUser);
	nameLayout->addStretch();
	rightLayout->addStretch();
	rightLayout->addLayout(nameLayout);
	rightLayout->addWidget(m_qtbDesc);
	rightLayout->addStretch();
	rightLayout->addLayout(funcLayout);
	rightLayout->addStretch();

	mainLayout->addWidget(m_dwDisplay);
	mainLayout->addSpacing(SPACE);
	mainLayout->addLayout(rightLayout);
	m_qwBottomRight->setLayout(mainLayout);
}