Commits

Anonymous committed 33248d3

Add GUI placeholders for redrawStatusLine/Ruler

  • Participants
  • Parent commits aa26bb4
  • Branches tb-gui

Comments (0)

Files changed (5)

File src/gui/basegui.cpp

 
 	emit redrawCursor(col, row);
 }
+
+/**
+ * FIXME: What are the valid attributes for the ruler?
+ */
 void BaseGui::handleRedrawRuler(const QVariantMap& m)
 {
-	// FIXME: do something w/ the ruler
+	if (!m.value("window_id").canConvert<quint64>()) {
+		qWarning() << "Received redraw:ruler event with invalid window_id";
+		return;
+	}
+	uint64_t window = m.value("window_id").toLongLong();
+	if (hasWindow(window)) {
+		getWindow(window)->redrawRuler(m);
+	} else {
+		qWarning() << "Received event" << __func__ << "for unknown window";
+	}
+}
+
+void BaseGui::handleRedrawStatusLine(const QVariantMap& m)
+{
+	if (!m.value("window_id").canConvert<quint64>()) {
+		qWarning() << "Received redraw:status_line event with invalid window_id";
+		return;
+	}
+	uint64_t window = m.value("window_id").toLongLong();
+	if (hasWindow(window)) {
+		getWindow(window)->redrawStatusLine(m);
+	} else {
+		qWarning() << "Received event" << __func__ << "for unknown window";
+	}
 }
 
 void BaseGui::handleRedrawUpdateLine(const QVariantMap& m)
 	} else if (name == "redraw:ruler") {
 		handleRedrawRuler(args.toMap());
 		return;
+	} else if (name == "redraw:status_line") {
+		handleRedrawStatusLine(args.toMap());
+		return;
 	} else if (name == "redraw:update_line") {
 		handleRedrawUpdateLine(args.toMap());
 		return;

File src/gui/basegui.h

 protected:
 	void handleRedrawCursor(const QVariantMap&);
 	void handleRedrawRuler(const QVariantMap&);
+	void handleRedrawStatusLine(const QVariantMap&);
 	void handleRedrawUpdateLine(const QVariantMap&);
 	void handleRedrawInsertLine(const QVariantMap&);
 	void handleRedrawDeleteLine(const QVariantMap&);

File src/gui/basewindow.h

 
 	virtual uint64_t windowId()=0;
 	virtual void redrawCursor(uint64_t col, uint64_t row)=0;
+	virtual void redrawRuler(const QVariantMap& m)=0;
+	virtual void redrawStatusLine(const QVariantMap& m)=0;
 	virtual void updateLine(uint64_t row, const QVariantList& line,
 		 		const QVariantMap& attrs)=0;
 	virtual void insertLine(uint64_t row_index, uint64_t count)=0;

File src/gui/windowwidget.cpp

 
 }
 
+void WindowWidget::redrawRuler(const QVariantMap& m)
+{
+	qDebug() << __func__ << windowId() << m;
+}
+
+void WindowWidget::redrawStatusLine(const QVariantMap& m)
+{
+	qDebug() << __func__ << windowId() << m;
+}
+
 void WindowWidget::updateLine(uint64_t row, const QVariantList& line, const QVariantMap& attrs)
 {
 	QString text;

File src/gui/windowwidget.h

 public:
 	virtual uint64_t windowId() {return m_window_id;}
 	void redrawCursor(uint64_t col, uint64_t row);
+	virtual void redrawRuler(const QVariantMap& m);
+	virtual void redrawStatusLine(const QVariantMap& m);
 	virtual void updateLine(uint64_t row, const QVariantList& line, const QVariantMap& attrs);
 	virtual void insertLine(uint64_t row_index, uint64_t count);
 	virtual void deleteLine(uint64_t row_index, uint64_t count);