[X2Go-Commits] [x2goclient] 02/02: Show session path in session button in Favorite and Running views.

git-admin at x2go.org git-admin at x2go.org
Thu Nov 4 20:02:25 CET 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 0b715052e38cc601c94347fc5947bb81e3513e37
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Thu Nov 4 13:02:14 2021 -0600

    Show session path in session button in Favorite and Running views.
---
 debian/changelog        |  1 +
 src/sessionbutton.cpp   | 68 ++++++++++++++++++++++++++++++++-----------------
 src/sessionbutton.h     |  2 ++
 src/sessionexplorer.cpp |  1 +
 4 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5cd3422..175e5e6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,7 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium
       Favorite sessions, running sessions, all sessions.
     - Improve view modes in broker mode.
     - Set toolTip with detailed information for session button.
+    - Show session path in session button in Favorite and Running views.
 
   [ Ryan Schmidt ]
   * New upstream version (4.1.2.3):
diff --git a/src/sessionbutton.cpp b/src/sessionbutton.cpp
index ce2a54c..588f706 100644
--- a/src/sessionbutton.cpp
+++ b/src/sessionbutton.cpp
@@ -100,6 +100,12 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
     geomBox->update();
     geomBox->setPalette ( cpal );
 
+    pathLabel=new QLabel ( this );
+    QFont lfnt=fnt;
+    lfnt.setWeight(QFont::Thin);
+    lfnt.setPointSize(lfnt.pointSize()-2);
+    pathLabel->setFont(lfnt);
+
     sessName=new QLabel ( this );
     sessStatus=new QLabel ( this );
     fnt=sessName->font();
@@ -194,6 +200,8 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
 
     if ( !miniMode )
     {
+        pathLabel->move(80,10);
+        pathLabel->setMaximumWidth(224);
         sessName->move ( 80,34 );
         sessStatus->move(80,50);
         editBut->move ( 307,156 );
@@ -211,10 +219,11 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
     }
     else
     {
+        pathLabel->move(64,6);
+        pathLabel->setMaximumWidth(154);
         editBut->move ( 218,113 );
         favButton->move ( 218,10 );
-        sessName->move ( 64,11 );
-        sessStatus->hide();
+        sessName->move ( 64,22 );
         serverIcon->move ( 66,44 );
         server->move ( 88,44 );
         cmdIcon->move ( 66,68 );
@@ -229,6 +238,11 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
 
     if (mw->brokerMode)
     {
+        pathLabel->move(10,10);
+        if(miniMode)
+            pathLabel->setMaximumWidth(204);
+        else
+            pathLabel->setMaximumWidth(294);
         icon->move(10,30);
         sessName->move(90,50);
         sessStatus->move(90,70);
@@ -378,9 +392,12 @@ void SessionButton::redraw()
         name=tails.last();
         tails.pop_back();
         path=tails.join("/");
+        if(path.length())
+        {
+            toolTip<<path;
+        }
     }
 
-    toolTip<<path;
     QFontMetrics metr(sessName->font());
     nameofSession=name;
 
@@ -771,6 +788,23 @@ void SessionButton::mouseMoveEvent ( QMouseEvent * event )
 {
 
     SVGFrame::mouseMoveEvent ( event );
+    if ( favButton->isFlat() )
+    {
+        if ( event->x() > favButton->x() && event->x() < favButton->x() +
+            favButton->width() &&
+            event->y() >favButton->y() && event->y() <favButton->y() +
+            favButton->height() )
+            favButton->setFlat ( false );
+    }
+    else
+    {
+        if ( event->x() < favButton->x() || event->x() > favButton->x() +
+            favButton->width() ||
+            event->y() <favButton->y() || event->y() >favButton->y() +
+            favButton->height() )
+            favButton->setFlat ( true );
+    }
+
     if (!editable)
         return;
     if ( cmd->isVisible() )
@@ -836,24 +870,6 @@ void SessionButton::mouseMoveEvent ( QMouseEvent * event )
             editBut->setFlat ( true );
     }
 
-
-    if ( favButton->isFlat() )
-    {
-        if ( event->x() > favButton->x() && event->x() < favButton->x() +
-            favButton->width() &&
-            event->y() >favButton->y() && event->y() <favButton->y() +
-            favButton->height() )
-            favButton->setFlat ( false );
-    }
-    else
-    {
-        if ( event->x() < favButton->x() || event->x() > favButton->x() +
-            favButton->width() ||
-            event->y() <favButton->y() || event->y() >favButton->y() +
-            favButton->height() )
-            favButton->setFlat ( true );
-    }
-
     if ( geom->isVisible() )
         if ( event->x() > geom->x() && event->x() < geom->x() +
                 geom->width() &&
@@ -1086,8 +1102,8 @@ void SessionButton::slot_geom_change ( const QString& new_g )
 bool SessionButton::lessThen ( const SessionButton* b1,
                                const SessionButton* b2 )
 {
-    return b1->sessName->text().toLower().localeAwareCompare (
-               b2->sessName->text().toLower() ) <0;
+    return (b1->path+"/"+b1->sessName->text()).toLower().localeAwareCompare (
+               (b2->path+"/"+b2->sessName->text()).toLower() ) <0;
 }
 
 QString SessionButton::name()
@@ -1108,6 +1124,12 @@ void SessionButton::slotShowMenu()
                                     editBut->y() +editBut->height() ) ) );
 }
 
+void SessionButton::showAdvInfo(bool show)
+{
+    pathLabel->setText(path);
+    pathLabel->setVisible((show && path.length()));
+}
+
 
 void SessionButton::slotCreateSessionIcon()
 {
diff --git a/src/sessionbutton.h b/src/sessionbutton.h
index fb31d06..f7cf393 100644
--- a/src/sessionbutton.h
+++ b/src/sessionbutton.h
@@ -72,6 +72,7 @@ public:
     {
         return suspended;
     }
+    void showAdvInfo(bool show);
 
 private:
     void setFav(bool fav);
@@ -79,6 +80,7 @@ private:
     QString nameofSession;
     QString sid;
     QString path;
+    QLabel* pathLabel;
     QLabel* sessName;
     QLabel* sessStatus;
     QLabel* icon;
diff --git a/src/sessionexplorer.cpp b/src/sessionexplorer.cpp
index c57779d..ac8c1cc 100644
--- a/src/sessionexplorer.cpp
+++ b/src/sessionexplorer.cpp
@@ -458,6 +458,7 @@ void SessionExplorer::placeButtons()
 
         sessions[i]->move ( horizontalPosition,
                             currentVerticalPosition+5 );
+        sessions[i]->showAdvInfo(viewMode!=ALL);
 
         if(parent->getBrokerMode())
         {

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list