Example #1
0
void DisplayWindow::likeIt()
{
	if (m_qpbLike->text() == "Like")
	{
		if (g_umUserManager.Commend(m_mvModel.m_sVideoID) == SUCCESS)
		{
			g_umUserManager.GetLastVideo(m_mvModel);
			emit updateModel(m_mvModel);

			m_qpbLike->setIcon(QIcon(g_sImgRoot + "liked.png"));
			m_qpbLike->setText("Liked");
		}
		else
		{
			m_qlMsg->setText("Commend Fail, please try again.");
			QTimer *timer = new QTimer();
			timer->start(1000);
			connect(timer, SIGNAL(timeout()), m_qwMessage, SLOT(close()));
			connect(timer, SIGNAL(timeout()), timer, SLOT(stop()));
		}
	}
	else if (m_qpbLike->text() == "Liked")
	{
		if (g_umUserManager.UnCommend(m_mvModel.m_sVideoID) == SUCCESS)
		{
			g_umUserManager.GetLastVideo(m_mvModel);
			emit updateModel(m_mvModel);

			m_qpbLike->setIcon(QIcon(g_sImgRoot + "like.png"));
			m_qpbLike->setText("Like");
		}
		else
		{
			m_qlMsg->setText("Uncommend Fail, please try again.");
			QTimer *timer = new QTimer();
			timer->start(1000);
			connect(timer, SIGNAL(timeout()), m_qwMessage, SLOT(close()));
			connect(timer, SIGNAL(timeout()), timer, SLOT(stop()));
		}
	}
}
Example #2
0
void CommentWindow::comment()
{
	if (g_umUserManager.Comment(m_mvModel.m_sVideoID, m_qteComment->toPlainText().toStdString()) == SUCCESS)
	{
		g_umUserManager.GetLastVideo(m_mvModel);
		emit updateModel(m_mvModel);

		m_qteComment->clear();
		m_qmbMsg->setText("Comment Successfully");
		m_qmbMsg->setWindowModality(Qt::WindowModal);
		m_qmbMsg->show();
		connect(m_qmbMsg, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(toComment()));
	}