sources/interface.cpp

branch
protocol5
changeset 80
f992b027374b
parent 78
c1d43ade656e
child 84
3bd32eec3d57
--- a/sources/interface.cpp	Sun May 17 17:22:20 2015 +0300
+++ b/sources/interface.cpp	Sun May 17 22:07:48 2015 +0300
@@ -155,7 +155,6 @@
 	InputHistory << "";
 	OutputLines.clear();
 	OutputLines << ColoredLine();
-	Title = format (APPNAME " %1 (%2)", full_version_string(), changeset_date_string());
 
 	for (int i = 0; i < NUM_COLORS; ++i)
 	for (int j = 0; j < NUM_COLORS; ++j)
@@ -174,13 +173,18 @@
 //
 void Interface::render_titlebar()
 {
-	if (Title.length() <= COLS)
+	String message = Title;
+
+	if (Title.is_empty())
+		message = format (APPNAME " %1 (%2)", full_version_string(), changeset_date_string());
+
+	if (message.length() <= COLS)
 	{
 		int pair = color_pair (WHITE, BLUE);
-		int startx = (COLS - Title.length()) / 2;
-		int endx = startx + Title.length();
+		int startx = (COLS - message.length()) / 2;
+		int endx = startx + message.length();
 		attron (pair);
-		mvprintw (0, startx, "%s", Title.chars());
+		mvprintw (0, startx, "%s", message.chars());
 		mvhline (0, 0, ' ', startx);
 		mvhline (0, endx, ' ', COLS - endx);
 		attroff (pair);
@@ -955,3 +959,12 @@
 		NeedInputRender = true;
 	}
 }
+
+// -------------------------------------------------------------------------------------------------
+//
+void Interface::disconnected()
+{
+	Title = "";
+	update_statusbar();
+	render_titlebar();
+}

mercurial