[X2Go-Commits] [x2goclient] 01/01: Implement different view modes for sessions explorer: Favorite sessions, running sessions, all sessions.
git-admin at x2go.org
git-admin at x2go.org
Thu Nov 4 17:15:51 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 94872d2319b91b69cdc5223c50581949f317fb42
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Thu Nov 4 10:15:37 2021 -0600
Implement different view modes for sessions explorer: Favorite sessions, running sessions, all sessions.
---
debian/changelog | 2 +
res/img/icons/16x16/fav.png | Bin 0 -> 897 bytes
res/img/icons/16x16/fav1.png | Bin 0 -> 1020 bytes
res/img/svg/fav.svg | 76 ++++++++++++++++++++++++++++++
res/img/svg/fav1.svg | 76 ++++++++++++++++++++++++++++++
res/resources.qrc | 2 +
src/onmainwindow.cpp | 1 +
src/sessionbutton.cpp | 84 ++++++++++++++++++++++++++++++++-
src/sessionbutton.h | 20 ++++++++
src/sessionexplorer.cpp | 108 +++++++++++++++++++++++++++++++++++++++++--
src/sessionexplorer.h | 15 ++++++
11 files changed, 379 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ed4343b..5423307 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,8 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium
- Fix loading session icon to system tray when using broker.
- Add --debug argument to x2gokdriveclient in debug mode.
- Setting debug filter rules for QT>=5.2
+ - Implement different view modes for sessions explorer:
+ Favorite sessions, running sessions, all sessions.
[ Ryan Schmidt ]
* New upstream version (4.1.2.3):
diff --git a/res/img/icons/16x16/fav.png b/res/img/icons/16x16/fav.png
new file mode 100644
index 0000000..39747d0
Binary files /dev/null and b/res/img/icons/16x16/fav.png differ
diff --git a/res/img/icons/16x16/fav1.png b/res/img/icons/16x16/fav1.png
new file mode 100644
index 0000000..03bb285
Binary files /dev/null and b/res/img/icons/16x16/fav1.png differ
diff --git a/res/img/svg/fav.svg b/res/img/svg/fav.svg
new file mode 100644
index 0000000..2f22795
--- /dev/null
+++ b/res/img/svg/fav.svg
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ viewBox="0 0 210 297"
+ version="1.1"
+ id="svg8"
+ inkscape:export-filename="/usr/src.cur/GIT/x2goclient/res/img/icons/16x16/fav.png"
+ inkscape:export-xdpi="4.3711381"
+ inkscape:export-ydpi="4.3711381"
+ inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
+ sodipodi:docname="fav.svg">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4257762"
+ inkscape:cx="389.81701"
+ inkscape:cy="533.96979"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ inkscape:window-width="2560"
+ inkscape:window-height="1058"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ sodipodi:type="star"
+ style="opacity:0.996;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#397cdc;stroke-width:6.96354;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path855"
+ sodipodi:sides="5"
+ sodipodi:cx="109.69393"
+ sodipodi:cy="148.25699"
+ sodipodi:r1="69.414932"
+ sodipodi:r2="36.455986"
+ sodipodi:arg1="0.94140643"
+ sodipodi:arg2="1.569725"
+ inkscape:flatsided="false"
+ inkscape:rounded="0.11"
+ inkscape:randomized="0"
+ d="m 150.55515,204.3711 c -4.02898,2.93383 -35.83819,-19.66349 -40.82216,-19.65815 -4.98397,0.005 -36.744688,22.67076 -40.779943,19.74558 -4.035255,-2.92519 7.62648,-40.1605 6.08127,-44.89888 -1.545209,-4.73839 -32.915906,-27.94063 -31.380852,-32.68231 1.535053,-4.74169 40.551613,-5.15707 44.580591,-8.09089 4.028978,-2.93382 16.401534,-39.939014 21.385504,-39.944354 4.98397,-0.0053 17.4358,36.973254 21.47105,39.898444 4.03526,2.92518 43.05262,3.25695 44.59783,7.99534 1.54521,4.738 [...]
+ inkscape:transform-center-x="-0.032059244"
+ inkscape:transform-center-y="-6.3851549"
+ transform="matrix(1.0040637,0,0,1.054415,-0.17716926,-4.2901915)" />
+ </g>
+</svg>
diff --git a/res/img/svg/fav1.svg b/res/img/svg/fav1.svg
new file mode 100644
index 0000000..06dd299
--- /dev/null
+++ b/res/img/svg/fav1.svg
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ viewBox="0 0 210 297"
+ version="1.1"
+ id="svg8"
+ inkscape:export-filename="/usr/src.cur/GIT/x2goclient/res/img/icons/16x16/fav1.png"
+ inkscape:export-xdpi="4.3711381"
+ inkscape:export-ydpi="4.3711381"
+ inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
+ sodipodi:docname="fav1.svg">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4128293"
+ inkscape:cx="389.81701"
+ inkscape:cy="534.67116"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ inkscape:window-width="2560"
+ inkscape:window-height="1058"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ sodipodi:type="star"
+ style="opacity:0.996;fill:#ffd700;fill-opacity:1;fill-rule:nonzero;stroke:#397cdc;stroke-width:6.96354;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path855"
+ sodipodi:sides="5"
+ sodipodi:cx="109.69393"
+ sodipodi:cy="148.25699"
+ sodipodi:r1="69.414932"
+ sodipodi:r2="36.455986"
+ sodipodi:arg1="0.94140643"
+ sodipodi:arg2="1.569725"
+ inkscape:flatsided="false"
+ inkscape:rounded="0.11"
+ inkscape:randomized="0"
+ d="m 150.55515,204.3711 c -4.02898,2.93383 -35.83819,-19.66349 -40.82216,-19.65815 -4.98397,0.005 -36.744688,22.67076 -40.779943,19.74558 -4.035255,-2.92519 7.62648,-40.1605 6.08127,-44.89888 -1.545209,-4.73839 -32.915906,-27.94063 -31.380852,-32.68231 1.535053,-4.74169 40.551613,-5.15707 44.580591,-8.09089 4.028978,-2.93382 16.401534,-39.939014 21.385504,-39.944354 4.98397,-0.0053 17.4358,36.973254 21.47105,39.898444 4.03526,2.92518 43.05262,3.25695 44.59783,7.99534 1.54521,4.738 [...]
+ inkscape:transform-center-x="-0.032059244"
+ inkscape:transform-center-y="-6.3851549"
+ transform="matrix(1.0040637,0,0,1.054415,-0.17716926,-4.2901915)" />
+ </g>
+</svg>
diff --git a/res/resources.qrc b/res/resources.qrc
index cdacfe5..6f66467 100644
--- a/res/resources.qrc
+++ b/res/resources.qrc
@@ -62,6 +62,8 @@
<file>img/icons/16x16/file-open.png</file>
<file>img/icons/16x16/delete.png</file>
<file>img/icons/16x16/edit.png</file>
+ <file>img/icons/16x16/fav.png</file>
+ <file>img/icons/16x16/fav1.png</file>
<file>img/icons/16x16/gnome.png</file>
<file>img/icons/16x16/unity.png</file>
<file>img/icons/16x16/xfce.png</file>
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index f1febcb..349bc20 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -840,6 +840,7 @@ void ONMainWindow::initWidgetsNormal()
users=new QScrollArea ( fr );
+ vblay->addLayout(sessionExplorer->getSelectLayout());
vblay->addLayout(sessionExplorer->getNavigationLayout());
vblay->addWidget(users);
diff --git a/src/sessionbutton.cpp b/src/sessionbutton.cpp
index bfccf2a..1cacf1a 100644
--- a/src/sessionbutton.cpp
+++ b/src/sessionbutton.cpp
@@ -46,6 +46,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
{
editable=mw->sessionEditEnabled();
+ running=suspended=0;
QPalette pal=palette();
pal.setColor ( QPalette::Active, QPalette::WindowText, QPalette::Mid );
@@ -59,6 +60,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
updated=false;
+ fav=false;
QFont fnt=font();
if ( mw->retMiniMode() )
@@ -146,6 +148,15 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
editBut->setPalette ( cpal );
sessMenu=new QMenu ( this );
+
+ favButton=new QPushButton (this);
+ favButton->setIcon(QIcon(mw->iconsPath ( "/16x16/fav.png" )));
+ favButton->setFlat(true);
+ favButton->setFixedSize(24,24);
+ favButton->setMouseTracking(true);
+ favButton->setPalette ( cpal );
+ connect( favButton, SIGNAL(clicked()), this, SLOT(slotFavClick()));
+
connect ( sessMenu,SIGNAL ( aboutToHide() ),this,
SLOT ( slotMenuHide() ) );
@@ -175,6 +186,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
#endif
editBut->setToolTip ( tr ( "Session actions" ) );
+ favButton->setToolTip(tr("Add to favorites"));
cmdBox->setToolTip ( tr ( "Select type" ) );
geomBox->setToolTip ( tr ( "Select resolution" ) );
@@ -186,6 +198,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
sessName->move ( 80,34 );
sessStatus->move(80,50);
editBut->move ( 307,156 );
+ favButton->move ( 307,10 );
serverIcon->move ( 58,84 );
server->move ( 80,84 );
cmdIcon->move ( 58,108 );
@@ -200,6 +213,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
else
{
editBut->move ( 218,113 );
+ favButton->move ( 218,10 );
sessName->move ( 64,11 );
sessStatus->hide();
serverIcon->move ( 66,44 );
@@ -248,6 +262,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
SLOT ( slot_geom_change ( const QString& ) ) );
editBut->setFocusPolicy ( Qt::NoFocus );
+ favButton->setFocusPolicy ( Qt::NoFocus );
sound->setFocusPolicy ( Qt::NoFocus );
cmdBox->setFocusPolicy ( Qt::NoFocus );
geomBox->setFocusPolicy ( Qt::NoFocus );
@@ -277,6 +292,52 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id )
SessionButton::~SessionButton()
{}
+bool SessionButton::getFavFromConfig()
+{
+ X2goSettings st( "favorits" );
+ return st.setting()->value("favorites").toStringList().contains(sid);
+}
+
+void SessionButton::slotFavClick()
+{
+ setFav(!fav);
+ X2goSettings st( "favorits" );
+ QStringList favs=st.setting()->value("favorites").toStringList();
+ if(fav)
+ {
+ if(! favs.contains(sid))
+ {
+ favs.append(sid);
+ st.setting()->setValue("favorites",favs);
+ }
+ }
+ else
+ {
+ if(favs.contains(sid))
+ {
+ favs.removeAll(sid);
+ st.setting()->setValue("favorites",favs);
+ }
+ }
+ st.setting()->sync();
+ emit favClicked();
+}
+
+void SessionButton::setFav(bool fav)
+{
+ this->fav=fav;
+ if(fav)
+ {
+ favButton->setIcon(QIcon(par->iconsPath ( "/16x16/fav1.png" )));
+ favButton->setToolTip(tr("Remove from favorites"));
+ }
+ else
+ {
+ favButton->setIcon(QIcon(par->iconsPath ( "/16x16/fav.png" )));
+ favButton->setToolTip(tr("Add to favorites"));
+ }
+}
+
void SessionButton::slotClicked()
{
emit sessionSelected ( this );
@@ -338,10 +399,10 @@ void SessionButton::redraw()
sessStatus->setText("("+tr("suspended")+")");
}
- int suspended=st->setting()->value ( sid+"/suspended",
+ suspended=st->setting()->value ( sid+"/suspended",
( QVariant ) QString::null ).toUInt();
- int running=st->setting()->value ( sid+"/running",
+ running=st->setting()->value ( sid+"/running",
( QVariant ) QString::null ).toUInt();
if(suspended || running)
{
@@ -637,6 +698,7 @@ void SessionButton::redraw()
cmd->setMinimumSize ( cmd->sizeHint() );
server->setMinimumSize ( server->sizeHint() );
delete st;
+ setFav(getFavFromConfig());
}
void SessionButton::mousePressEvent ( QMouseEvent * event )
@@ -770,6 +832,24 @@ 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() &&
diff --git a/src/sessionbutton.h b/src/sessionbutton.h
index d831e61..fb31d06 100644
--- a/src/sessionbutton.h
+++ b/src/sessionbutton.h
@@ -60,8 +60,22 @@ public:
{
return updated;
}
+ bool isFav()
+ {
+ return fav;
+ }
+ int getRunning()
+ {
+ return running;
+ }
+ int getSuspended()
+ {
+ return suspended;
+ }
private:
+ void setFav(bool fav);
+ bool getFavFromConfig();
QString nameofSession;
QString sid;
QString path;
@@ -75,6 +89,7 @@ private:
QLabel* cmdIcon;
QLabel* server;
QPushButton* editBut;
+ QPushButton* favButton;
QLabel* geom;
QMenu* sessMenu;
QComboBox* geomBox;
@@ -88,6 +103,9 @@ private:
bool published;
bool editable;
bool updated;
+ bool fav;
+ int running;
+ int suspended;
private slots:
void slotClicked();
@@ -99,11 +117,13 @@ private slots:
void slotMenuHide();
void slotShowMenu();
void slotCreateSessionIcon();
+ void slotFavClick();
signals:
void sessionSelected ( SessionButton* );
void signal_edit ( SessionButton* );
void signal_remove ( SessionButton* );
void clicked();
+ void favClicked();
protected:
virtual void mouseMoveEvent ( QMouseEvent * event );
virtual void mousePressEvent ( QMouseEvent * event );
diff --git a/src/sessionexplorer.cpp b/src/sessionexplorer.cpp
index d163aa6..3bb42b0 100644
--- a/src/sessionexplorer.cpp
+++ b/src/sessionexplorer.cpp
@@ -33,11 +33,25 @@
#include "x2gologdebug.h"
#include <QBuffer>
#include <QDir>
+#include <QPushButton>
SessionExplorer::SessionExplorer(ONMainWindow* p):QObject(p)
{
parent=p;
lastSession=0;
+ initUpdate=true;
+ viewMode=ALL;
+ runButton=new QPushButton(tr("Running"),parent->getCentralFrame());
+ favButton=new QPushButton(tr("Favorites"),parent->getCentralFrame());
+ allButton=new QPushButton(tr("All Sessions"),parent->getCentralFrame());
+ allButton->setFlat(true);
+ runButton->setFocusPolicy ( Qt::NoFocus );
+ favButton->setFocusPolicy ( Qt::NoFocus );
+ allButton->setFocusPolicy ( Qt::NoFocus );
+ selectLayout=new QHBoxLayout();
+ selectLayout->addWidget(runButton);
+ selectLayout->addWidget(favButton);
+ selectLayout->addWidget(allButton);
backButton=new QToolButton(parent->getCentralFrame());
backButton->setIcon(QIcon( parent->iconsPath ( "/32x32/tbhide.png" )));
backButton->setAutoRaise(true);
@@ -54,6 +68,14 @@ SessionExplorer::SessionExplorer(ONMainWindow* p):QObject(p)
backButton->setPalette(pal);
backButton->setAutoFillBackground(true);
+
+ runButton->setPalette(pal);
+ runButton->setAutoFillBackground(true);
+ favButton->setPalette(pal);
+ favButton->setAutoFillBackground(true);
+ allButton->setPalette(pal);
+ allButton->setAutoFillBackground(true);
+
pal=pathLabel->palette();
pal.setBrush ( QPalette::Window, QColor ( 110,112,127,255 ) );
pal.setBrush ( QPalette::WindowText, QColor ( 200,200,200,255 ) );
@@ -61,6 +83,9 @@ SessionExplorer::SessionExplorer(ONMainWindow* p):QObject(p)
pathLabel->setAutoFillBackground(true);
setNavigationVisible(false);
connect(backButton,SIGNAL(clicked(bool)), this, SLOT(slotLevelUp()));
+ connect(runButton,SIGNAL(clicked(bool)), this, SLOT(slotShowRun()));
+ connect(allButton,SIGNAL(clicked(bool)), this, SLOT(slotShowAll()));
+ connect(favButton,SIGNAL(clicked(bool)), this, SLOT(slotShowFav()));
}
SessionExplorer::~SessionExplorer()
@@ -111,11 +136,44 @@ void SessionExplorer::updateSessions(QStringList slst)
delete s;
}
}
+ updateView();
+}
+void SessionExplorer::updateView()
+{
+ bool hasFavs=false;
+ bool hasRun=0;
+ foreach (SessionButton* s, sessions)
+ {
+ if(s->isFav())
+ {
+ hasFavs=true;
+ }
+ if(s->getRunning()||s->getSuspended())
+ hasRun=true;
+ }
+ runButton->setVisible(hasRun);
+ favButton->setVisible(hasFavs);
+ allButton->setVisible(hasRun||hasFavs);
+ if(initUpdate)
+ {
+ initUpdate=false;
+ if(hasRun)
+ {
+ viewMode=RUN;
+ }
+ else if(hasFavs)
+ {
+ viewMode=FAV;
+ }
+ }
+ if((!hasRun && viewMode==RUN)||(!hasFavs && viewMode==FAV))
+ {
+ viewMode=ALL;
+ }
placeButtons();
}
-
void SessionExplorer::resize()
{
pathLabel->setMaximumWidth(parent->getUsersArea()->width()-backButton->width());
@@ -316,6 +374,7 @@ SessionButton* SessionExplorer::createBut ( const QString& id )
connect ( l,SIGNAL ( sessionSelected ( SessionButton* ) ),parent,
SLOT ( slotSelectedFromList ( SessionButton* ) ) );
+ connect(l, SIGNAL( favClicked()), this, SLOT(updateView()));
checkPath(l);
@@ -325,9 +384,10 @@ SessionButton* SessionExplorer::createBut ( const QString& id )
void SessionExplorer::placeButtons()
{
+
getFoldersFromConfig();
- setNavigationVisible(currentPath.length()>0);
+ setNavigationVisible((currentPath.length()>0)&&(viewMode==ALL));
resize();
int currentVerticalPosition=0;
qSort ( sessions.begin(),sessions.end(),SessionButton::lessThen );
@@ -335,6 +395,11 @@ void SessionExplorer::placeButtons()
for ( int i=0; i<folders.size(); ++i )
{
+ if(viewMode!=ALL)
+ {
+ folders[i]->hide();
+ continue;
+ }
if((folders[i]->getPath() != currentPath)||(getFolderChildren(folders[i]).length()<=0))
{
folders[i]->hide();
@@ -366,7 +431,17 @@ void SessionExplorer::placeButtons()
for ( int i=0; i<sessions.size(); ++i )
{
- if(sessions[i]->getPath() != currentPath)
+ if((viewMode==ALL) && ( sessions[i]->getPath() != currentPath))
+ {
+ sessions[i]->hide();
+ continue;
+ }
+ if((viewMode==FAV) && (! sessions[i]->isFav()))
+ {
+ sessions[i]->hide();
+ continue;
+ }
+ if((viewMode==RUN) && (! (sessions[i]->getRunning() || sessions[i]->getSuspended())))
{
sessions[i]->hide();
continue;
@@ -689,3 +764,30 @@ void SessionExplorer::setEnable(bool enable)
{
backButton->setEnabled(enable);
}
+
+void SessionExplorer::slotShowAll()
+{
+ viewMode=ALL;
+ allButton->setFlat(true);
+ runButton->setFlat(false);
+ favButton->setFlat(false);
+ updateView();
+}
+
+void SessionExplorer::slotShowRun()
+{
+ viewMode=RUN;
+ allButton->setFlat(false);
+ runButton->setFlat(true);
+ favButton->setFlat(false);
+ updateView();
+}
+
+void SessionExplorer::slotShowFav()
+{
+ viewMode=FAV;
+ allButton->setFlat(false);
+ runButton->setFlat(false);
+ favButton->setFlat(true);
+ updateView();
+}
diff --git a/src/sessionexplorer.h b/src/sessionexplorer.h
index a1ec64e..917a5de 100644
--- a/src/sessionexplorer.h
+++ b/src/sessionexplorer.h
@@ -26,6 +26,7 @@ class SessionButton;
class FolderButton;
class ONMainWindow;
class QToolButton;
+class QPushButton;
class QLabel;
class QHBoxLayout;
@@ -57,6 +58,10 @@ public:
{
return navigationLayout;
}
+ QHBoxLayout* getSelectLayout()
+ {
+ return selectLayout;
+ }
bool isFolderEmpty(QString path);
void resize();
void setFolderIcon(QString path, QString icon);
@@ -85,9 +90,15 @@ private:
SessionButton* lastSession;
ONMainWindow* parent;
QToolButton* backButton;
+ QPushButton* favButton;
+ QPushButton* runButton;
+ QPushButton* allButton;
QLabel* pathLabel;
QHBoxLayout* navigationLayout;
+ QHBoxLayout* selectLayout;
QString currentPath;
+ enum {ALL, FAV, RUN} viewMode;
+ bool initUpdate;
//functions
private:
@@ -107,6 +118,10 @@ private slots:
void slotFolderSelected(FolderButton* bt);
void slotLevelUp();
QStringList getFolderChildren(FolderButton* folder);
+ void slotShowAll();
+ void slotShowRun();
+ void slotShowFav();
+ void updateView();
};
#endif
--
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