Revision: 4417
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4417&view=rev
Author:   ossman_
Date:     2011-05-16 12:18:08 +0000 (Mon, 16 May 2011)

Log Message:
-----------
Add connection information dialog based on the one in the unix viewer.

Modified Paths:
--------------
    trunk/vncviewer/CConn.cxx
    trunk/vncviewer/CConn.h
    trunk/vncviewer/Viewport.cxx

Modified: trunk/vncviewer/CConn.cxx
===================================================================
--- trunk/vncviewer/CConn.cxx   2011-05-16 12:04:43 UTC (rev 4416)
+++ trunk/vncviewer/CConn.cxx   2011-05-16 12:18:08 UTC (rev 4417)
@@ -107,6 +107,39 @@
     forceNonincremental = true;
 }
 
+const char *CConn::connectionInfo()
+{
+  static char infoText[1024] = "";
+
+  char pfStr[100];
+  char spfStr[100];
+
+  cp.pf().print(pfStr, 100);
+  serverPF.print(spfStr, 100);
+
+  int secType = csecurity->getType();
+
+  snprintf(infoText, sizeof(infoText),
+           _("Desktop name: %.80s\n"
+             "Host: %.80s port: %d\n"
+             "Size: %d x %d\n"
+             "Pixel format: %s\n"
+             "(server default %s)\n"
+             "Requested encoding: %s\n"
+             "Last used encoding: %s\n"
+             "Line speed estimate: %d kbit/s\n"
+             "Protocol version: %d.%d\n"
+             "Security method: %s\n"),
+           cp.name(), serverHost, serverPort, cp.width, cp.height,
+           pfStr, spfStr, encodingName(currentEncoding),
+           encodingName(lastServerEncoding),
+           sock->inStream().kbitsPerSecond(),
+           cp.majorVersion, cp.minorVersion,
+           secTypeName(secType));
+
+  return infoText;
+}
+
 // The RFB core is not properly asynchronous, so it calls this callback
 // whenever it needs to block to wait for more data. Since FLTK is
 // monitoring the socket, we just make sure FLTK gets to run.

Modified: trunk/vncviewer/CConn.h
===================================================================
--- trunk/vncviewer/CConn.h     2011-05-16 12:04:43 UTC (rev 4416)
+++ trunk/vncviewer/CConn.h     2011-05-16 12:18:08 UTC (rev 4417)
@@ -34,6 +34,8 @@
 
   void refreshFramebuffer();
 
+  const char *connectionInfo();
+
   // FdInStreamBlockCallback methods
   void blockCallback();
 

Modified: trunk/vncviewer/Viewport.cxx
===================================================================
--- trunk/vncviewer/Viewport.cxx        2011-05-16 12:04:43 UTC (rev 4416)
+++ trunk/vncviewer/Viewport.cxx        2011-05-16 12:18:08 UTC (rev 4417)
@@ -22,6 +22,7 @@
 #include <string.h>
 
 #include <FL/fl_draw.H>
+#include <FL/fl_ask.H>
 
 #include <rfb/CMsgWriter.h>
 #include <rfb/LogWriter.h>
@@ -54,7 +55,7 @@
 // Menu constants
 
 enum { ID_EXIT, ID_CTRL, ID_ALT, ID_MENUKEY, ID_CTRLALTDEL,
-       ID_REFRESH, ID_OPTIONS, ID_ABOUT, ID_DISMISS };
+       ID_REFRESH, ID_OPTIONS, ID_INFO, ID_ABOUT, ID_DISMISS };
 
 Viewport::Viewport(int w, int h, const rfb::PixelFormat& serverPF, CConn* cc_)
   : Fl_Widget(0, 0, w, h), cc(cc_), frameBuffer(NULL), pixelTrans(NULL),
@@ -452,6 +453,7 @@
   contextMenu->add(_("Refresh screen"), 0, NULL, (void*)ID_REFRESH, 
FL_MENU_DIVIDER);
 
   contextMenu->add(_("Options..."), 0, NULL, (void*)ID_OPTIONS, 0);
+  contextMenu->add(_("Connection info..."), 0, NULL, (void*)ID_INFO, 0);
   contextMenu->add(_("About TigerVNC viewer..."), 0, NULL, (void*)ID_ABOUT, 
FL_MENU_DIVIDER);
 
   contextMenu->add(_("Dismiss menu"), 0, NULL, (void*)ID_DISMISS, 0);
@@ -503,6 +505,10 @@
   case ID_OPTIONS:
     OptionsDialog::showDialog();
     break;
+  case ID_INFO:
+    fl_message_title(_("VNC connection info"));
+    fl_message(cc->connectionInfo());
+    break;
   case ID_ABOUT:
     about_vncviewer();
     break;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to