mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
* all usrs including home usr shown on refresh()
* for testing debugging purposes at the moment git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@570 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
452d664b2a
commit
e83a76c38a
@ -51,7 +51,6 @@ BlogDialog::BlogDialog(QWidget *parent)
|
|||||||
void BlogDialog::sendBlog()
|
void BlogDialog::sendBlog()
|
||||||
{
|
{
|
||||||
QString blogMsg = lineEdit->toPlainText();
|
QString blogMsg = lineEdit->toPlainText();
|
||||||
QString blogUsr = "Usr1"; // will always be Usr1
|
|
||||||
|
|
||||||
if(blogMsg == "")
|
if(blogMsg == "")
|
||||||
{
|
{
|
||||||
@ -64,7 +63,6 @@ void BlogDialog::sendBlog()
|
|||||||
/* note: timing will be handled by core */
|
/* note: timing will be handled by core */
|
||||||
std::string blog = blogMsg.toStdString();
|
std::string blog = blogMsg.toStdString();
|
||||||
rsQblog->sendBlog(blog);
|
rsQblog->sendBlog(blog);
|
||||||
update(); // call update to display new blog
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lineEdit->clear();//Clear lineEdit
|
lineEdit->clear();//Clear lineEdit
|
||||||
@ -86,19 +84,11 @@ void BlogDialog::setFont()
|
|||||||
void BlogDialog::setStatus()
|
void BlogDialog::setStatus()
|
||||||
{
|
{
|
||||||
QString statusMsg = lineEdit->toPlainText();
|
QString statusMsg = lineEdit->toPlainText();
|
||||||
QString debug = "unsuccessful";
|
|
||||||
QString blogUsr;
|
|
||||||
|
|
||||||
std::list<std::string> UsrList;
|
std::list<std::string> UsrList;
|
||||||
|
|
||||||
/* test to see if load dummy data worked ! */
|
/* 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 == "")
|
if(statusMsg == "")
|
||||||
{
|
{
|
||||||
QMessageBox::information(this, tr("No message"),
|
QMessageBox::information(this, tr("No message"),
|
||||||
@ -107,18 +97,13 @@ void BlogDialog::setStatus()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
blogUsr = UsrList.begin()->c_str();
|
rsQblog->setStatus("whatsup");
|
||||||
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 */
|
/* Clear lineEdit */
|
||||||
lineEdit->clear();
|
lineEdit->clear();
|
||||||
|
|
||||||
/* setFocus on lineEdit */
|
/* setFocus on lineEdit **/
|
||||||
lineEdit->setFocus();
|
lineEdit->setFocus();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,6 +123,13 @@ void BlogDialog::clear(void)
|
|||||||
|
|
||||||
void BlogDialog::update(void)
|
void BlogDialog::update(void)
|
||||||
{
|
{
|
||||||
|
rsQblog->getFilterSwitch();
|
||||||
|
|
||||||
|
std::map<std::string, std::string> UsrStatus;
|
||||||
|
|
||||||
|
if(!rsQblog->getStatus(UsrStatus))
|
||||||
|
std::cerr << "failed to get usr status" << std::endl;
|
||||||
|
|
||||||
clear(); //create a clear screen
|
clear(); //create a clear screen
|
||||||
|
|
||||||
/* retrieve usr names and populate usr list bar */
|
/* retrieve usr names and populate usr list bar */
|
||||||
@ -145,36 +137,48 @@ void BlogDialog::update(void)
|
|||||||
std::list<std::string> usrList;
|
std::list<std::string> usrList;
|
||||||
QString TempVar; // to convert numerics to string note: tbd find way to avoid temporary
|
QString TempVar; // to convert numerics to string note: tbd find way to avoid temporary
|
||||||
|
|
||||||
|
if (!rsPeers)
|
||||||
|
{
|
||||||
|
/* not ready yet! */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!rsQblog->getFriendList(usrList))
|
if(!rsPeers->getFriendList(usrList))
|
||||||
std::cerr << "failed to get friend list";
|
std::cerr << "failed to get friend list";
|
||||||
|
|
||||||
|
|
||||||
|
usrList.push_back(rsPeers->getOwnId()); // add your id
|
||||||
|
|
||||||
/* populate the blog msgs screen */
|
/* populate the blog msgs screen */
|
||||||
|
|
||||||
std::map< std::string, std::multimap<long int, std::string> > blogs; // to store blogs
|
std::map< std::string, std::multimap<long int, std::string> > blogs; // to store blogs
|
||||||
|
|
||||||
if(!rsQblog->getBlogs(blogs))
|
if(!rsQblog->getBlogs(blogs))
|
||||||
std::cerr << "failed to get blogs";
|
std::cerr << "failed to get blogs" << std::endl;
|
||||||
|
|
||||||
/* print usr name and their blogs to screen */
|
/* print usr name and their blogs to screen */
|
||||||
for(std::list<std::string>::iterator it = usrList.begin(); it !=usrList.end(); it++)
|
for(std::list<std::string>::iterator it = usrList.begin(); it !=usrList.end(); it++)
|
||||||
{
|
{
|
||||||
TempVar = it->c_str(); // store usr name in temporary
|
TempVar = rsPeers->getPeerName(*it).c_str(); // store usr name in temporary
|
||||||
blogText->setTextColor(QColor(255, 0, 0, 255));
|
blogText->setTextColor(QColor(255, 0, 0, 255));
|
||||||
blogText->setCurrentFont(mUsrFont); // make bold for username
|
blogText->setCurrentFont(mUsrFont); // make bold for username
|
||||||
blogText->append("\n" + TempVar); // write usr name to screen
|
blogText->append("\n" + TempVar); // write usr name to screen
|
||||||
|
std::cerr << "creating usr tree" << std::endl;
|
||||||
|
|
||||||
/*print blog time-posted/msgs to screen*/
|
/*print blog time-posted/msgs to screen*/
|
||||||
|
|
||||||
std::multimap<long int, std::string>::reverse_iterator blogIt = blogs[*it].rbegin();
|
std::multimap<long int, std::string>::reverse_iterator blogIt = blogs[*it].rbegin();
|
||||||
addUser(*it); // add usr to Qwidget tree
|
addUser(rsPeers->getPeerName(*it)); // add usr to Qwidget tree
|
||||||
|
|
||||||
if(blogs[*it].empty())
|
if(blogs[*it].empty())
|
||||||
|
{
|
||||||
|
std::cerr << "usr blog empty!" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for( ; blogIt != blogs[*it].rend(); blogIt++)
|
for( ; blogIt != blogs[*it].rend(); blogIt++)
|
||||||
{
|
{
|
||||||
|
std::cerr << "now printing blogs" << std::endl;
|
||||||
time_t postedTime = blogIt->first;
|
time_t postedTime = blogIt->first;
|
||||||
time(&postedTime); //convert to human readable time
|
time(&postedTime); //convert to human readable time
|
||||||
blogText->setTextColor(QColor(255, 0, 0, 255)); //
|
blogText->setTextColor(QColor(255, 0, 0, 255)); //
|
||||||
@ -184,6 +188,7 @@ void BlogDialog::update(void)
|
|||||||
blogText->setTextColor(QColor(0, 0, 0, 255)); // set back color to black
|
blogText->setTextColor(QColor(0, 0, 0, 255)); // set back color to black
|
||||||
blogText->append(blogIt->second.c_str()); // print blog msg to screen
|
blogText->append(blogIt->second.c_str()); // print blog msg to screen
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user