summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/EventViewer')
-rw-r--r--Swift/QtUI/EventViewer/EventModel.cpp4
-rw-r--r--Swift/QtUI/EventViewer/EventModel.h1
-rw-r--r--Swift/QtUI/EventViewer/QtEventWindow.cpp2
-rw-r--r--Swift/QtUI/EventViewer/QtEventWindow.h2
4 files changed, 9 insertions, 0 deletions
diff --git a/Swift/QtUI/EventViewer/EventModel.cpp b/Swift/QtUI/EventViewer/EventModel.cpp
index 902004b..b895c8d 100644
--- a/Swift/QtUI/EventViewer/EventModel.cpp
+++ b/Swift/QtUI/EventViewer/EventModel.cpp
@@ -20,6 +20,10 @@ QtEvent* EventModel::getItem(int row) const {
return row < activeEvents_.size() ? activeEvents_[row] : inactiveEvents_[row - activeEvents_.size()];
}
+int EventModel::getNewEventCount() {
+ return activeEvents_.size();
+}
+
QVariant EventModel::data(const QModelIndex& index, int role) const {
if (!index.isValid()) {
return QVariant();
diff --git a/Swift/QtUI/EventViewer/EventModel.h b/Swift/QtUI/EventViewer/EventModel.h
index 7882c6b..660ce61 100644
--- a/Swift/QtUI/EventViewer/EventModel.h
+++ b/Swift/QtUI/EventViewer/EventModel.h
@@ -20,6 +20,7 @@ public:
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
int rowCount(const QModelIndex& parent = QModelIndex()) const;
QtEvent* getItem(int row) const;
+ int getNewEventCount();
private:
QList<QtEvent*> activeEvents_;
QList<QtEvent*> inactiveEvents_;
diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp
index def124a..162f13f 100644
--- a/Swift/QtUI/EventViewer/QtEventWindow.cpp
+++ b/Swift/QtUI/EventViewer/QtEventWindow.cpp
@@ -52,10 +52,12 @@ void QtEventWindow::handleItemActivated(const QModelIndex& item) {
void QtEventWindow::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) {
model_->addEvent(event, active);
+ emit onNewEventCountUpdated(model_->getNewEventCount());
}
void QtEventWindow::removeEvent(boost::shared_ptr<StanzaEvent> event) {
model_->removeEvent(event);
+ emit onNewEventCountUpdated(model_->getNewEventCount());
}
}
diff --git a/Swift/QtUI/EventViewer/QtEventWindow.h b/Swift/QtUI/EventViewer/QtEventWindow.h
index 283ba52..17ff019 100644
--- a/Swift/QtUI/EventViewer/QtEventWindow.h
+++ b/Swift/QtUI/EventViewer/QtEventWindow.h
@@ -18,6 +18,8 @@ namespace Swift {
~QtEventWindow();
void addEvent(boost::shared_ptr<StanzaEvent> event, bool active);
void removeEvent(boost::shared_ptr<StanzaEvent> event);
+ signals:
+ void onNewEventCountUpdated(int count);
private slots:
void handleItemActivated(const QModelIndex& item);
private: