[X2Go-Commits] [x2goclient] 03/03: Format long names on session buttons.
git-admin at x2go.org
git-admin at x2go.org
Wed Dec 2 17:32:22 CET 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient.
commit aea2684a6a6a4afda235ae5a74213dbba1d2ffb8
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Wed Dec 2 17:31:42 2015 +0100
Format long names on session buttons.
---
debian/changelog | 1 +
src/sessionbutton.cpp | 12 +++++++++---
src/sessionbutton.h | 1 +
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index c406240..a4cd4d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,7 @@ x2goclient (4.0.5.1-0x2go1) UNRELEASED; urgency=low
- Reconnect ssh broker in case of IO Error.
- Reformat source onmainwindow.cpp.
- Disable settings editing if a directory with central settings is exists.
+ - Format long names on session buttons.
[ Mike Gabriel ]
* New upstream release (4.0.5.1):
diff --git a/src/sessionbutton.cpp b/src/sessionbutton.cpp
index 2d51a23..9d08cf5 100644
--- a/src/sessionbutton.cpp
+++ b/src/sessionbutton.cpp
@@ -289,6 +289,7 @@ void SessionButton::redraw()
QString name=st->setting()->value ( sid+"/name",
( QVariant ) tr ( "New Session" ) ).toString();
+
QStringList tails=name.split("/",QString::SkipEmptyParts);
if(tails.count()>0)
{
@@ -297,7 +298,12 @@ void SessionButton::redraw()
path=tails.join("/");
}
- sessName->setText (name);
+ QFontMetrics metr(sessName->font());
+ nameofSession=name;
+
+ QString elName=metr.elidedText(name, Qt::ElideRight, 250);
+ sessName->setText (elName);
+ sessName->setToolTip(nameofSession);
QString status=st->setting()->value ( sid+"/status",
( QVariant ) QString::null ).toString();
@@ -311,7 +317,7 @@ void SessionButton::redraw()
}
QString sessIcon = wrap_legacy_resource_URIs (st->setting()->value (sid+"/icon",
- (QVariant) ":/img/icons/128x128/x2gosession.png"
+ (QVariant) ":/img/icons/128x128/x2gosession.png"
).toString ());
sessIcon = expandHome(sessIcon);
QPixmap* pix;
@@ -873,7 +879,7 @@ bool SessionButton::lessThen ( const SessionButton* b1,
QString SessionButton::name()
{
- return sessName->text();
+ return nameofSession;
}
void SessionButton::slotMenuHide()
diff --git a/src/sessionbutton.h b/src/sessionbutton.h
index 7590591..876f0f3 100644
--- a/src/sessionbutton.h
+++ b/src/sessionbutton.h
@@ -54,6 +54,7 @@ public:
}
private:
+ QString nameofSession;
QString sid;
QString path;
QLabel* sessName;
--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list