summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/EventViewer')
-rw-r--r--Swift/QtUI/EventViewer/QtEventWindow.cpp14
-rw-r--r--Swift/QtUI/EventViewer/QtEventWindow.h4
2 files changed, 14 insertions, 4 deletions
diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp
index 9458f67..567ac94 100644
--- a/Swift/QtUI/EventViewer/QtEventWindow.cpp
+++ b/Swift/QtUI/EventViewer/QtEventWindow.cpp
@@ -42,11 +42,13 @@ QtEventWindow::QtEventWindow(UIEventStream* eventStream, QWidget* parent) : QWid
view_->setIndentation(0);
view_->setRootIsDecorated(true);
- QPushButton* readButton = new QPushButton("Read Notice", this);
- layout->addWidget(readButton);
- connect(readButton, SIGNAL(clicked()), this, SLOT(handleReadClicked()));
-
+ readButton_ = new QPushButton("Read Notice", this);
+ layout->addWidget(readButton_);
+ readButton_->setEnabled(false);
+ connect(readButton_, SIGNAL(clicked()), this, SLOT(handleReadClicked()));
+ connect(view_, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handleItemClicked(const QModelIndex&)));
connect(view_, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&)));
+
}
QtEventWindow::~QtEventWindow() {
@@ -55,6 +57,10 @@ QtEventWindow::~QtEventWindow() {
/* Not view_ because this is the parent */
}
+void QtEventWindow::handleItemClicked(const QModelIndex&) {
+ readButton_->setEnabled(true);
+}
+
void QtEventWindow::handleReadClicked() {
QModelIndex index = view_->currentIndex();
if (!index.isValid()) {
diff --git a/Swift/QtUI/EventViewer/QtEventWindow.h b/Swift/QtUI/EventViewer/QtEventWindow.h
index 1f7010e..b49660a 100644
--- a/Swift/QtUI/EventViewer/QtEventWindow.h
+++ b/Swift/QtUI/EventViewer/QtEventWindow.h
@@ -16,6 +16,8 @@
#include "Swift/QtUI/EventViewer/EventModel.h"
#include "Swift/QtUI/EventViewer/EventDelegate.h"
+class QPushButton;
+
namespace Swift {
class QtEventWindow : public QWidget, public EventWindow {
Q_OBJECT
@@ -28,12 +30,14 @@ namespace Swift {
void onNewEventCountUpdated(int count);
private slots:
void handleItemActivated(const QModelIndex& item);
+ void handleItemClicked(const QModelIndex& item);
void handleReadClicked();
private:
EventModel* model_;
EventDelegate* delegate_;
UIEventStream* eventStream_;
QTreeView* view_;
+ QPushButton* readButton_;
};
}