add roster list, half baked, need to go home
diff --git a/chatdialog.cpp b/chatdialog.cpp
index abf6005..89e1710 100644
--- a/chatdialog.cpp
+++ b/chatdialog.cpp
@@ -38,6 +38,9 @@
QRectF rect = m_scene->itemsBoundingRect();
m_scene->setSceneRect(rect);
+ m_rosterModel = new QStringListModel(this);
+ listView->setModel(m_rosterModel);
+
createActions();
createTrayIcon();
m_timer = new QTimer(this);
@@ -50,6 +53,7 @@
connect(m_scene, SIGNAL(replot()), this, SLOT(replot()));
connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showNormal()));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
+ connect(m_scene, SIGNAL(rosterChanged()), this, SLOT(updateRosterList()));
// create sync socket
if(!m_user.getChatroom().isEmpty()) {
@@ -89,6 +93,14 @@
m_scene->plot(m_sock->getRootDigest().c_str());
}
+void
+ChatDialog::updateRosterList()
+{
+ boost::mutex::scoped_lock lock(m_sceneMutex);
+ QStringList rosterList = m_scene->getRosterList();
+ m_rosterModel->setStringList(rosterList);
+}
+
void
ChatDialog::setVisible(bool visible)
{
diff --git a/chatdialog.h b/chatdialog.h
index 5662b7b..dc7b390 100644
--- a/chatdialog.h
+++ b/chatdialog.h
@@ -16,6 +16,7 @@
class QAction;
class QMenu;
+class QStringListModel;
class ChatDialog : public QDialog, private Ui::ChatDialog
{
@@ -62,6 +63,7 @@
void settingUpdated(QString, QString, QString);
void sendHello();
void replot();
+ void updateRosterList();
// icon related
void iconActivated(QSystemTrayIcon::ActivationReason reason);
@@ -83,6 +85,7 @@
time_t m_lastMsgTime;
int m_randomizedInterval;
QTimer *m_timer;
+ QStringListModel *m_rosterModel;
// icon related
QAction *minimizeAction;
diff --git a/digesttreescene.cpp b/digesttreescene.cpp
index 2bb1c53..b79962e 100644
--- a/digesttreescene.cpp
+++ b/digesttreescene.cpp
@@ -72,6 +72,11 @@
}
void
+DigestTreeScene::getRosterList()
+{
+}
+
+void
DigestTreeScene::msgReceived(QString prefix, QString nick)
{
#ifdef __DEBUG
@@ -172,6 +177,9 @@
}
}
+ // for simpicity here, whenever we replot, we also redo the roster list
+ emit rosterChanged();
+
int n = m_roster.size();
std::vector<TreeLayout::Coordinate> childNodesCo(n);
diff --git a/digesttreescene.h b/digesttreescene.h
index 0a385e0..7d30bac 100644
--- a/digesttreescene.h
+++ b/digesttreescene.h
@@ -35,9 +35,11 @@
void clearAll();
bool removeNode(const QString prefix);
void plot(QString digest);
+ QStringList getRosterList();
signals:
void replot();
+ void rosterChanged();
private slots:
void emitReplot();