]> git.vomp.tv Git - vompclient.git/commitdiff
Add IP/port info to "connection failed" dialog
authorChris Tallon <chris@vomp.tv>
Wed, 15 Jun 2022 16:00:18 +0000 (16:00 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 15 Jun 2022 16:00:18 +0000 (16:00 +0000)
src/vconnect.cc
src/vinfo.cc
src/vinfo.h

index fc07c93dc3f193826b57357b9a0332ee771461a1..0755ccd21235d1db643ae99a7da19d76c7d6c112 100644 (file)
@@ -254,7 +254,9 @@ bool VConnect::attemptConnect(const VDRServer* vdrServer)
 
   if (!connectSuccess)
   {
-    setOneLiner(tr("Connection failed"));
+    std::stringstream connFailedString;
+    connFailedString << tr("Connection failed") << " to " << vdrServer->ip << " port " << vdrServer->port;
+    setOneLiner(connFailedString.str());
     draw();
     boxstack->update(this);
     {
index 262b02344f53dcae800036c71a84359e7d41a835..d1dae3004883ebe6956757d9b948c42c29f95a67 100644 (file)
@@ -27,7 +27,6 @@
 
 VInfo::VInfo()
 {
-  mainText = NULL;
   exitable = 0;
   dropThrough = 0;
 
@@ -40,7 +39,6 @@ VInfo::VInfo()
 VInfo::~VInfo()
 {
   MessageQueue::getInstance()->removeReceiver(this);
-  if (mainText) delete[] mainText;
 }
 
 void VInfo::setExitable()
@@ -55,19 +53,19 @@ void VInfo::setDropThrough()
 
 void VInfo::setMainText(const char* takeText)
 {
-  if (mainText) delete[] mainText;
-  int length = strlen(takeText);
-  mainText = new char[length + 1];
-  strcpy(mainText, takeText);
+  mainText = takeText;
   mainTextType = NORMAL;
 }
 
 void VInfo::setOneLiner(const char* takeText)
 {
-  if (mainText) delete[] mainText;
-  int length = strlen(takeText);
-  mainText = new char[length + 1];
-  strcpy(mainText, takeText);
+  mainText = takeText;
+  mainTextType = ONELINER;
+}
+
+void VInfo::setOneLiner(const std::string& takeText)
+{
+  mainText = takeText;
   mainTextType = ONELINER;
 }
 
@@ -75,11 +73,11 @@ void VInfo::draw()
 {
   TBBoxx::draw();
 
-  if (mainText)
+  if (mainText.size())
   {
     if (mainTextType == NORMAL)
     {
-      drawPara(mainText, 10, 45, DrawStyle::LIGHTTEXT);
+      drawPara(mainText.c_str() /* FIXME */, 10, 45, DrawStyle::LIGHTTEXT);
     }
 
     if (mainTextType == ONELINER)
index a13e7c7338c874bb5f5912203753b2fe4909468c..1f051ea15c59046b9d04e3d10acf131b74bab96d 100644 (file)
@@ -37,6 +37,7 @@ class VInfo : public TBBoxx, public MessageReceiver
 
     void setMainText(const char* title);
     void setOneLiner(const char* text);
+    void setOneLiner(const std::string& text);
     void setExitable();
     void setDropThrough();
     void okButton();
@@ -46,7 +47,7 @@ class VInfo : public TBBoxx, public MessageReceiver
     void draw();
 
   protected:
-    char* mainText;
+    std::string mainText;
     UCHAR exitable;
     UCHAR dropThrough;
     UCHAR mainTextType;