renamed items in BlogsDialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3174 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-06-20 11:23:58 +00:00
parent 9c6a3a7781
commit 7e307af78b

View File

@ -52,6 +52,10 @@ BlogsDialog::BlogsDialog(QWidget *parent)
connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg())); connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeBlog ( void ) ) ); connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeBlog ( void ) ) );
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeBlog ( void ) ) ); connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeBlog ( void ) ) );
connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(selectBlog(const QModelIndex &)));
connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(toggleSelection(const QModelIndex &)));
connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( blogListCustomPopupMenu( QPoint ) ) );
mBlogId = ""; mBlogId = "";
mPeerId = rsPeers->getOwnId(); // add your id mPeerId = rsPeers->getOwnId(); // add your id
@ -64,51 +68,46 @@ BlogsDialog::BlogsDialog(QWidget *parent)
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers); treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
treeView->setItemDelegate(new ChanGroupDelegate()); treeView->setItemDelegate(new ChanGroupDelegate());
//treeView->setRootIsDecorated(false);
// hide header and id column // hide header and id column
treeView->setHeaderHidden(true); treeView->setHeaderHidden(true);
treeView->hideColumn(1); treeView->hideColumn(1);
itemFont = QFont("ARIAL", 10);
itemFont.setBold(true);
QStandardItem *item1 = new QStandardItem(tr("Own Blogs")); QStandardItem *OwnBlogs = new QStandardItem(tr("Own Blogs"));
QStandardItem *item2 = new QStandardItem(tr("Subscribed Blogs")); OwnBlogs->setForeground(QBrush(QColor(79, 79, 79)));
QStandardItem *item3 = new QStandardItem(tr("Popular Blogs")); OwnBlogs->setFont(itemFont);
QStandardItem *item4 = new QStandardItem(tr("Other Blogs"));
QStandardItem *SubscribedBlogs = new QStandardItem(tr("Subscribed Blogs"));
SubscribedBlogs->setForeground(QBrush(QColor(79, 79, 79)));
SubscribedBlogs->setFont(itemFont);
model->appendRow(item1); QStandardItem *PopularBlogs = new QStandardItem(tr("Popular Blogs"));
model->appendRow(item2); PopularBlogs->setForeground(QBrush(QColor(79, 79, 79)));
model->appendRow(item3); PopularBlogs->setFont(itemFont);
model->appendRow(item4);
connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(selectBlog(const QModelIndex &))); QStandardItem *OtherBlogs = new QStandardItem(tr("Other Blogs"));
connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(toggleSelection(const QModelIndex &))); OtherBlogs->setForeground(QBrush(QColor(79, 79, 79)));
connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( blogListCustomPopupMenu( QPoint ) ) ); OtherBlogs->setFont(itemFont);
model->appendRow(OwnBlogs);
model->appendRow(SubscribedBlogs);
model->appendRow(PopularBlogs);
model->appendRow(OtherBlogs);
//added from ahead //added from ahead
updateBlogList(); updateBlogList();
mBlogFont = QFont("MS SANS SERIF", 22); mBlogFont = QFont("MS SANS SERIF", 22);
nameLabel->setFont(mBlogFont); nameLabel->setFont(mBlogFont);
nameLabel->setMinimumWidth(20); nameLabel->setMinimumWidth(20);
itemFont = QFont("ARIAL", 10);
itemFont.setBold(true);
item1->setFont(itemFont);
item2->setFont(itemFont);
item3->setFont(itemFont);
item4->setFont(itemFont);
item1->setForeground(QBrush(QColor(79, 79, 79)));
item2->setForeground(QBrush(QColor(79, 79, 79)));
item3->setForeground(QBrush(QColor(79, 79, 79)));
item4->setForeground(QBrush(QColor(79, 79, 79)));
QMenu *blogmenu = new QMenu(); QMenu *blogmenu = new QMenu();
blogmenu->addAction(actionCreate_Blog); blogmenu->addAction(actionCreate_Blog);
blogmenu->addSeparator(); blogmenu->addSeparator();
blogpushButton->setMenu(blogmenu); blogpushButton->setMenu(blogmenu);
QTimer *timer = new QTimer(this); QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
@ -326,25 +325,25 @@ void BlogsDialog::updateBlogListOwn(std::list<std::string> &ids)
std::cerr << "BlogsDialog::updateBlogListOwn(): " << *iit << std::endl; std::cerr << "BlogsDialog::updateBlogListOwn(): " << *iit << std::endl;
#endif #endif
QStandardItem *ownGroup = model->item(OWN); QStandardItem *ownGroup = model->item(OWN);
QList<QStandardItem *> channel; QList<QStandardItem *> blog;
QStandardItem *item1 = new QStandardItem(); QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *item2 = new QStandardItem(); QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi; BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
item1->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
item1->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999)); ).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else { } else {
item1->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
item1->setToolTip("Unknown Blog\nNo Description"); blogNameitem->setToolTip("Unknown Blog\nNo Description");
} }
channel.append(item1); blog.append(blogNameitem);
channel.append(item2); blog.append(blogIditem);
ownGroup->appendRow(channel); ownGroup->appendRow(blog);
} }
} }
@ -360,25 +359,25 @@ void BlogsDialog::updateBlogListSub(std::list<std::string> &ids)
std::cerr << "BlogsDialog::updateBlogListSub(): " << *iit << std::endl; std::cerr << "BlogsDialog::updateBlogListSub(): " << *iit << std::endl;
#endif #endif
QStandardItem *ownGroup = model->item(SUBSCRIBED); QStandardItem *ownGroup = model->item(SUBSCRIBED);
QList<QStandardItem *> channel; QList<QStandardItem *> blog;
QStandardItem *item1 = new QStandardItem(); QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *item2 = new QStandardItem(); QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi; BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
item1->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
item1->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999)); ).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else { } else {
item1->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
item1->setToolTip("Unknown Blog\nNo Description"); blogNameitem->setToolTip("Unknown Blog\nNo Description");
} }
channel.append(item1); blog.append(blogNameitem);
channel.append(item2); blog.append(blogIditem);
ownGroup->appendRow(channel); ownGroup->appendRow(blog);
} }
} }
@ -395,25 +394,25 @@ void BlogsDialog::updateBlogListPop(std::list<std::string> &ids)
std::cerr << "BlogsDialog::updateBlogListPop(): " << *iit << std::endl; std::cerr << "BlogsDialog::updateBlogListPop(): " << *iit << std::endl;
#endif #endif
QStandardItem *ownGroup = model->item(POPULAR); QStandardItem *ownGroup = model->item(POPULAR);
QList<QStandardItem *> channel; QList<QStandardItem *> blog;
QStandardItem *item1 = new QStandardItem(); QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *item2 = new QStandardItem(); QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi; BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
item1->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
item1->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999)); ).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else { } else {
item1->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
item1->setToolTip("Unknown Blog\nNo Description"); blogNameitem->setToolTip("Unknown Blog\nNo Description");
} }
channel.append(item1); blog.append(blogNameitem);
channel.append(item2); blog.append(blogIditem);
ownGroup->appendRow(channel); ownGroup->appendRow(blog);
} }
} }
@ -429,25 +428,25 @@ void BlogsDialog::updateBlogListOther(std::list<std::string> &ids)
std::cerr << "BlogsDialog::updateBlogListOther(): " << *iit << std::endl; std::cerr << "BlogsDialog::updateBlogListOther(): " << *iit << std::endl;
#endif #endif
QStandardItem *ownGroup = model->item(OTHER); QStandardItem *ownGroup = model->item(OTHER);
QList<QStandardItem *> channel; QList<QStandardItem *> blog;
QStandardItem *item1 = new QStandardItem(); QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *item2 = new QStandardItem(); QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi; BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) { if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
item1->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole); blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
item1->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3" blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999)); ).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else { } else {
item1->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole); blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
item2->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole); blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
item1->setToolTip("Unknown Blog\nNo Description"); blogNameitem->setToolTip("Unknown Blog\nNo Description");
} }
channel.append(item1); blog.append(blogNameitem);
channel.append(item2); blog.append(blogIditem);
ownGroup->appendRow(channel); ownGroup->appendRow(blog);
} }
} }
@ -490,7 +489,7 @@ void BlogsDialog::updateBlogMsgs()
/* set Blog name */ /* set Blog name */
QString bname = QString::fromStdWString(bi.blogName); QString bname = QString::fromStdWString(bi.blogName);
nameLabel->setText(blogStr.arg(bname)); nameLabel->setText(blogStr.arg(bname));
/* do buttons */ /* do buttons */
if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED) if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED)