mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Used Dummy data for the message sending. Works well.
Added some coloring and a timestamp. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@550 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b763bd5ae9
commit
ffe371c4e5
@ -21,6 +21,7 @@
|
||||
#include <QtGui>
|
||||
|
||||
#include "BlogDialog.h"
|
||||
|
||||
#include "rsiface/rsQblog.h"
|
||||
|
||||
/** Constructor */
|
||||
@ -38,34 +39,56 @@ BlogDialog::BlogDialog(QWidget *parent)
|
||||
|
||||
/* Current Font */
|
||||
mCurrentFont = QFont("Comic Sans MS", 8);
|
||||
|
||||
/* Font for username and timestamp */
|
||||
mUsrFont = QFont("Comic Sans MS", 8);
|
||||
|
||||
}
|
||||
|
||||
/* Currently both status and message are the same, will soon be changed
|
||||
* Status will stay the same, well relatively.
|
||||
* However the blog will only display when the user is clicked
|
||||
* and will have multiple messages from the same user.
|
||||
*/
|
||||
|
||||
void BlogDialog::sendBlog()
|
||||
{
|
||||
QString blogMsg = lineEdit->toPlainText();
|
||||
QString debug = "unsuccessful";
|
||||
|
||||
blogText->setCurrentFont(mCurrentFont);
|
||||
|
||||
/* Write blog message to window */
|
||||
blogText->append(blogMsg);
|
||||
QString blogUsr;
|
||||
|
||||
std::list<std::string> UsrList;
|
||||
|
||||
/* test to see if load dummy data worked ! */
|
||||
|
||||
QString blogMsg2;
|
||||
|
||||
if(!rsQblog->getFriendList(UsrList))
|
||||
{
|
||||
blogText->append(debug); // put error on screen if problem getting usr list
|
||||
}
|
||||
else
|
||||
{
|
||||
blogMsg2 = UsrList.begin()->c_str();
|
||||
blogText->append(blogMsg2); // past the first usr list to blog screen
|
||||
}
|
||||
if(blogMsg == "")
|
||||
{
|
||||
QMessageBox::information(this, tr("No message entered"),
|
||||
tr("Please enter a message."),QMessageBox::Ok,
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* I know its messy, I will clean it up */
|
||||
blogUsr = UsrList.begin()->c_str();
|
||||
blogText->setCurrentFont(mUsrFont); // make bold for username
|
||||
blogText->setTextColor(QColor(255, 0, 0, 255));
|
||||
QTime qtime;
|
||||
qtime = qtime.currentTime();
|
||||
QString timestamp = qtime.toString("H:m:s");
|
||||
blogText->append("[" + timestamp + "] " + blogUsr); // past the first usr list to blog screen
|
||||
blogText->setCurrentFont(mCurrentFont); // reset the font for blog message
|
||||
blogText->setTextColor(QColor(0, 0, 0, 255));
|
||||
blogText->append(blogMsg); // append the users message
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear lineEdit */
|
||||
lineEdit->clear();
|
||||
@ -83,20 +106,47 @@ void BlogDialog::setFont()
|
||||
lineEdit->setFocus();
|
||||
}
|
||||
|
||||
|
||||
/* Currently both status and message are the same, will soon be changed
|
||||
* Status will stay the same, well relatively.
|
||||
* However the blog will only display when the user is clicked
|
||||
* and will have multiple messages from the same user.
|
||||
*/
|
||||
void BlogDialog::setStatus()
|
||||
{
|
||||
QString statusMsg = lineEdit->toPlainText();
|
||||
QString debug = "unsuccessful";
|
||||
QString blogUsr;
|
||||
|
||||
blogText->setCurrentFont(mCurrentFont);
|
||||
std::list<std::string> UsrList;
|
||||
|
||||
/* Write status to window */
|
||||
blogText->append(statusMsg);
|
||||
/* test to see if load dummy data worked ! */
|
||||
|
||||
if(!rsQblog->getFriendList(UsrList))
|
||||
{
|
||||
blogText->append(debug); // put error on screen if problem getting usr list
|
||||
}
|
||||
else
|
||||
{
|
||||
if(statusMsg == "")
|
||||
{
|
||||
QMessageBox::information(this, tr("No message"),
|
||||
tr("Please enter a message."),QMessageBox::Ok,
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
blogUsr = UsrList.begin()->c_str();
|
||||
blogText->setCurrentFont(mUsrFont); // make bold for username
|
||||
blogText->append(blogUsr + ": "); // past the first usr list to blog screen
|
||||
blogText->setCurrentFont(mCurrentFont); // reset the font for blog message
|
||||
blogText->append(statusMsg); // append the users message
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear lineEdit */
|
||||
lineEdit->clear();
|
||||
|
||||
/* set focus on lineEdit */
|
||||
/* setFocus on lineEdit */
|
||||
lineEdit->setFocus();
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,9 @@ private:
|
||||
/* Current Font */
|
||||
QFont mCurrentFont;
|
||||
|
||||
/* Font to be used for username (bold) */
|
||||
QFont mUsrFont;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user