[X2Go-Commits] x2goclient2.git - master (branch) updated: fd0ba68dad5db7ecd7608623c64811ee58d64895

X2Go dev team git-admin at x2go.org
Wed Mar 13 18:49:09 CET 2013


The branch, master has been updated
       via  fd0ba68dad5db7ecd7608623c64811ee58d64895 (commit)
      from  ca94e0810266761b80454a616d68b0f06bad10c7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fd0ba68dad5db7ecd7608623c64811ee58d64895
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Wed Mar 13 18:48:38 2013 +0100

    add select session dialog, continue development

-----------------------------------------------------------------------

Summary of changes:
 messagebox.cpp                                     |    2 +-
 messagebox.h                                       |    6 +-
 messagebox.ui                                      |    4 +-
 ...usframeapplications.cpp => sessionlistframe.cpp |   30 +++-
 ...atusframeapplications.cpp => sessionlistframe.h |   26 ++--
 sessionlistframe.ui                                |  144 ++++++++++++++++++++
 sessionselecter.cpp                                |   95 +++++++++++++
 ...tatusframeapplications.cpp => sessionselecter.h |   35 ++---
 sshconnection.cpp                                  |    2 +-
 x2goclient2.pro                                    |    7 +
 x2gosession.cpp                                    |   66 +++++++++
 x2gosession.h                                      |    9 +-
 x2gosessiondata.cpp                                |   87 ++++++++++++
 sessionstatusframe.h => x2gosessiondata.h          |   49 +++----
 14 files changed, 492 insertions(+), 70 deletions(-)
 copy sessionstatusframeapplications.cpp => sessionlistframe.cpp (50%)
 copy sessionstatusframeapplications.cpp => sessionlistframe.h (79%)
 create mode 100644 sessionlistframe.ui
 create mode 100644 sessionselecter.cpp
 copy sessionstatusframeapplications.cpp => sessionselecter.h (72%)
 create mode 100644 x2gosessiondata.cpp
 copy sessionstatusframe.h => x2gosessiondata.h (62%)

The diff of changes is:
diff --git a/messagebox.cpp b/messagebox.cpp
index ca2291d..fcba505 100644
--- a/messagebox.cpp
+++ b/messagebox.cpp
@@ -1,5 +1,5 @@
 /**************************************************************************
-*   Copyright (C) 2005-2012 by Oleksandr Shneyder                         *
+*   Copyright (C) 2005-2013 by Oleksandr Shneyder                         *
 *   o.shneyder at phoca-gmbh.de                                              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
diff --git a/messagebox.h b/messagebox.h
index 7b216dd..da40703 100644
--- a/messagebox.h
+++ b/messagebox.h
@@ -1,5 +1,5 @@
 /**************************************************************************
-*   Copyright (C) 2005-2012 by Oleksandr Shneyder                         *
+*   Copyright (C) 2005-2013 by Oleksandr Shneyder                         *
 *   o.shneyder at phoca-gmbh.de                                              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
@@ -34,7 +34,7 @@ public:
     X2GO_PROPERTY_GETTER(QPushButton*, pbCancel)
     X2GO_PROPERTY_GETTER(QPushButton*, pbOk)
     enum Buttons {YES=1,NO=2,OK=8,CANCEL=16};
-private:
+protected:
     QEventLoop* loop;
 private slots:
     void slotResize(QResizeEvent* event);
@@ -50,7 +50,7 @@ public:
                          QString pixPath=QString::null);
     MessageBox();
     virtual ~MessageBox();
-    Buttons exec();
+    virtual Buttons exec();
     void setupDialog(QString pix, QString text, int buttons, QString inputLabel = QString::null,
                      QLineEdit::EchoMode echoMode = QLineEdit::Normal);
 };
diff --git a/messagebox.ui b/messagebox.ui
index d18f5e6..635c03f 100644
--- a/messagebox.ui
+++ b/messagebox.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>577</width>
-    <height>227</height>
+    <width>623</width>
+    <height>206</height>
    </rect>
   </property>
   <property name="windowTitle">
diff --git a/sessionstatusframeapplications.cpp b/sessionlistframe.cpp
similarity index 50%
copy from sessionstatusframeapplications.cpp
copy to sessionlistframe.cpp
index f6a827e..923347a 100644
--- a/sessionstatusframeapplications.cpp
+++ b/sessionlistframe.cpp
@@ -19,20 +19,36 @@
 ***************************************************************************/
 
 
-#include "sessionstatusframeapplications.h"
-
-SessionStatusFrameApplications::SessionStatusFrameApplications(QWidget* parent, Qt::WindowFlags f): QFrame(parent, f)
+#include "sessionlistframe.h"
+#include <QScrollBar>
+SessionListFrame::SessionListFrame(QWidget* parent, Qt::WindowFlags f): QFrame(parent, f)
 {
-    session=0;
     setupUi(this);
+    treeWidget->header()->setStyleSheet("border-image: url(:/svg/transparent.svg);border-top: 0px transparent; "
+                                        "border-bottom: 0px transparent;border-right: 0px transparent; border-left: 0px transparent");
+    treeWidget->horizontalScrollBar()->setStyleSheet("border-image: url(:/svg/transparent.svg);border-top: 0px transparent; "
+            "border-bottom: 0px transparent;border-right: 0px transparent; border-left: 0px transparent");
+    treeWidget->verticalScrollBar()->setStyleSheet("border-image: url(:/svg/transparent.svg);border-top: 0px transparent; "
+            "border-bottom: 0px transparent;border-right: 0px transparent; border-left: 0px transparent");
+    for(int i=0; i<treeWidget->header()->count(); ++i)
+        treeWidget->headerItem()->setBackgroundColor(i,QColor(0xed,0xed,0xed,255));
+    checkBox->setChecked(false);
+    slotShowAdvanced(false);
 }
 
-SessionStatusFrameApplications::~SessionStatusFrameApplications()
+void SessionListFrame::slotShowAdvanced(bool show)
 {
+    treeWidget->header()->setSectionHidden(3,!show);
+    treeWidget->header()->setSectionHidden(4,!show);
+    treeWidget->header()->setSectionHidden(5,!show);
+    treeWidget->header()->setSectionHidden(6,!show);
+    for(int i=0; i<treeWidget->header()->count(); ++i)
+        treeWidget->resizeColumnToContents(i);
 
 }
 
-void SessionStatusFrameApplications::setSession(X2GoSession* session)
+SessionListFrame::~SessionListFrame()
 {
-    this->session=session;
+
 }
+
diff --git a/sessionstatusframeapplications.cpp b/sessionlistframe.h
similarity index 79%
copy from sessionstatusframeapplications.cpp
copy to sessionlistframe.h
index f6a827e..d564fc9 100644
--- a/sessionstatusframeapplications.cpp
+++ b/sessionlistframe.h
@@ -19,20 +19,18 @@
 ***************************************************************************/
 
 
-#include "sessionstatusframeapplications.h"
+#ifndef SESSIONLISTFRAME_H
+#define SESSIONLISTFRAME_H
+#include "ui_sessionlistframe.h"
 
-SessionStatusFrameApplications::SessionStatusFrameApplications(QWidget* parent, Qt::WindowFlags f): QFrame(parent, f)
+class SessionListFrame: public QFrame, public Ui_SessionListFrame
 {
-    session=0;
-    setupUi(this);
-}
+    Q_OBJECT
+public:
+    explicit SessionListFrame(QWidget* parent = 0, Qt::WindowFlags f = 0);
+    ~SessionListFrame();
+private slots:
+    void slotShowAdvanced(bool show);
+};
 
-SessionStatusFrameApplications::~SessionStatusFrameApplications()
-{
-
-}
-
-void SessionStatusFrameApplications::setSession(X2GoSession* session)
-{
-    this->session=session;
-}
+#endif // SESSIONLISTFRAME_H
diff --git a/sessionlistframe.ui b/sessionlistframe.ui
new file mode 100644
index 0000000..ec14d94
--- /dev/null
+++ b/sessionlistframe.ui
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SessionListFrame</class>
+ <widget class="QFrame" name="SessionListFrame">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>615</width>
+    <height>165</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Frame</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">border-image: url(:/svg/transparent.svg);border-top: 0px transparent; border-bottom: 0px transparent;border-right: 0px transparent; border-left: 0px transparent</string>
+  </property>
+  <property name="frameShape">
+   <enum>QFrame::StyledPanel</enum>
+  </property>
+  <property name="frameShadow">
+   <enum>QFrame::Raised</enum>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTreeWidget" name="treeWidget">
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="styleSheet">
+      <string notr="true">border-image: url(:/svg/messageboxbutton.svg);border-top: 2px transparent; border-bottom: 2px transparent;border-right: 2px transparent; border-left: 2px transparent</string>
+     </property>
+     <property name="alternatingRowColors">
+      <bool>false</bool>
+     </property>
+     <property name="rootIsDecorated">
+      <bool>false</bool>
+     </property>
+     <property name="itemsExpandable">
+      <bool>false</bool>
+     </property>
+     <property name="sortingEnabled">
+      <bool>true</bool>
+     </property>
+     <property name="allColumnsShowFocus">
+      <bool>true</bool>
+     </property>
+     <property name="headerHidden">
+      <bool>false</bool>
+     </property>
+     <property name="expandsOnDoubleClick">
+      <bool>false</bool>
+     </property>
+     <attribute name="headerVisible">
+      <bool>true</bool>
+     </attribute>
+     <attribute name="headerCascadingSectionResizes">
+      <bool>true</bool>
+     </attribute>
+     <attribute name="headerHighlightSections">
+      <bool>true</bool>
+     </attribute>
+     <attribute name="headerShowSortIndicator" stdset="0">
+      <bool>true</bool>
+     </attribute>
+     <attribute name="headerStretchLastSection">
+      <bool>false</bool>
+     </attribute>
+     <column>
+      <property name="text">
+       <string>Session</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Type</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Status</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Display</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Creation time</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Client IP</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Session ID</string>
+      </property>
+     </column>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="checkBox">
+     <property name="focusPolicy">
+      <enum>Qt::NoFocus</enum>
+     </property>
+     <property name="text">
+      <string>Adavnced</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>checkBox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>SessionListFrame</receiver>
+   <slot>slotShowAdvanced(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>88</x>
+     <y>146</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>4</x>
+     <y>10</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <slot>slotShowAdvanced(bool)</slot>
+ </slots>
+</ui>
diff --git a/sessionselecter.cpp b/sessionselecter.cpp
new file mode 100644
index 0000000..208c20e
--- /dev/null
+++ b/sessionselecter.cpp
@@ -0,0 +1,95 @@
+/**************************************************************************
+*   Copyright (C) 2005-2013 by Oleksandr Shneyder                         *
+*   o.shneyder at phoca-gmbh.de                                              *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+*   This program is distributed in the hope that it will be useful,       *
+*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+*   GNU General Public License for more details.                          *
+*                                                                         *
+*   You should have received a copy of the GNU General Public License     *
+*   along with this program; if not, write to the                         *
+*   Free Software Foundation, Inc.,                                       *
+*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+***************************************************************************/
+
+#include "sessionselecter.h"
+#include "sessionlistframe.h"
+
+#include "x2goapplication.h"
+#include "workarea.h"
+#include <QDateTime>
+
+SessionSelecter::SessionSelecter(const QList<X2GoSessionData>& sessions)
+{
+    pbNo->hide();
+    pbYes->setText(tr("Resume selected"));
+    pbYes->setEnabled(false);
+    pbOk->setText(tr("New session"));
+    lPixmap->hide();
+    listFrame=new SessionListFrame(frame);
+    vlDisplayLayout->insertWidget(1,listFrame);
+    foreach (X2GoSessionData data, sessions)
+    {
+        QTreeWidgetItem* item=new QTreeWidgetItem(listFrame->treeWidget);
+        QString name=X2GoApplication::instance()->getReadableDesktopName(data.get_command());
+        if(name.length()<=0)
+            name=X2GoApplication::instance()->getReadableAppName(data.get_command());
+        if(name.length()<=0)
+            name=data.get_command();
+        item->setText(0, name);
+        switch(data.get_sessionType())
+        {
+        case X2GoSessionData::DESKTOP:
+            item->setText(1, tr("Desktop"));
+            break;
+        case X2GoSessionData::ROOTLESS:
+            item->setText(1, tr("Single application"));
+            break;
+        case X2GoSessionData::SHADOW:
+            break;
+        }
+        if(data.get_status()=="S")
+        {
+            item->setText(2, tr("Suspended"));
+        }
+        else
+        {
+            item->setText(2, tr("Running"));
+        }
+        item->setText(3,data.get_display());
+
+        QDateTime dt=QDateTime::fromString(data.get_creationTime(), Qt::ISODate);
+        item->setText(4,dt.toString(Qt::SystemLocaleShortDate));
+        item->setText(5,data.get_clientIp());
+        item->setText(6,data.get_sessionId());
+    }
+    for(int i=0; i<listFrame->treeWidget->header()->count(); ++i)
+        listFrame->treeWidget->resizeColumnToContents(i);
+    connect(listFrame->treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(slotEnableButton()));
+}
+
+void SessionSelecter::slotEnableButton()
+{
+    pbYes->setEnabled(true);
+}
+
+
+SessionSelecter::~SessionSelecter()
+{
+
+}
+
+MessageBox::Buttons SessionSelecter::exec()
+{
+    lText->setFixedHeight(lText->sizeHint().height());
+    listFrame->setFixedHeight(listFrame->sizeHint().height());
+    setFixedHeight(sizeHint().height()+listFrame->sizeHint().height());
+    X2GoApplication::instance()->get_workArea()->setEnabled(false);
+    return (MessageBox::Buttons)loop->exec();
+}
diff --git a/sessionstatusframeapplications.cpp b/sessionselecter.h
similarity index 72%
copy from sessionstatusframeapplications.cpp
copy to sessionselecter.h
index f6a827e..4a333c7 100644
--- a/sessionstatusframeapplications.cpp
+++ b/sessionselecter.h
@@ -1,4 +1,5 @@
-/**************************************************************************
+
+class SessionListFrame;/**************************************************************************
 *   Copyright (C) 2005-2013 by Oleksandr Shneyder                         *
 *   o.shneyder at phoca-gmbh.de                                              *
 *                                                                         *
@@ -18,21 +19,23 @@
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
 
+#ifndef SESSIONSELECTER_H
+#define SESSIONSELECTER_H
 
-#include "sessionstatusframeapplications.h"
-
-SessionStatusFrameApplications::SessionStatusFrameApplications(QWidget* parent, Qt::WindowFlags f): QFrame(parent, f)
-{
-    session=0;
-    setupUi(this);
-}
-
-SessionStatusFrameApplications::~SessionStatusFrameApplications()
+#include "messagebox.h"
+#include "x2gosessiondata.h"
+class SessionListFrame;
+class SessionSelecter: public MessageBox
 {
+    Q_OBJECT
+public:
+    SessionSelecter(const QList< X2GoSessionData >& sessions);
+    ~SessionSelecter();
+    virtual Buttons exec();
+private:
+    SessionListFrame* listFrame;
+public slots:
+    void slotEnableButton();
+};
 
-}
-
-void SessionStatusFrameApplications::setSession(X2GoSession* session)
-{
-    this->session=session;
-}
+#endif // SESSIONSELECTER_H
diff --git a/sshconnection.cpp b/sshconnection.cpp
index f5680ae..835464e 100644
--- a/sshconnection.cpp
+++ b/sshconnection.cpp
@@ -25,7 +25,7 @@
 #define PROXYTUNNELPORT 44444
 
 #undef DEBUG
-#define DEBUG
+// #define DEBUG
 
 #undef SSH_DEBUG
 // #define SSH_DEBUG
diff --git a/x2goclient2.pro b/x2goclient2.pro
index bbd5e5e..35d6041 100755
--- a/x2goclient2.pro
+++ b/x2goclient2.pro
@@ -30,6 +30,7 @@ FORMS += mainwindow.ui \
          sessionstatusframe.ui \
          sessionstatusframestatus.ui \
          sessionstatusframeapplications.ui \
+         sessionlistframe.ui \
          profile.ui
 
 SOURCES += main.cpp \
@@ -64,7 +65,10 @@ SOURCES += main.cpp \
            sessionstatusframe.cpp \
            sessionstatusframestatus.cpp \
            sessionstatusframeapplications.cpp \
+           sessionselecter.cpp \
            profile.cpp \
+           x2gosessiondata.cpp \
+           sessionlistframe.cpp \
            x2gosession.cpp
 
 HEADERS += mainwindow.h \
@@ -98,7 +102,10 @@ HEADERS += mainwindow.h \
            sessionstatusframe.h \
            sessionstatusframestatus.h \
            sessionstatusframeapplications.h \
+           sessionselecter.h \
            profile.h \
+           x2gosessiondata.h \
+           sessionlistframe.h \
            x2gosession.h
 
 LIBS += -lssh
diff --git a/x2gosession.cpp b/x2gosession.cpp
index 3db3356..bce8864 100644
--- a/x2gosession.cpp
+++ b/x2gosession.cpp
@@ -26,6 +26,7 @@
 #include "workarea.h"
 #include "sessionform.h"
 #include "x2gobroker.h"
+#include "sessionselecter.h"
 
 X2GoSession::X2GoSession(Profile* profile)
 {
@@ -85,8 +86,73 @@ void X2GoSession::slotSshConnectionFailed(int, QString)
     }
 }
 
+void X2GoSession::slotListSessions(bool success, QString answer, int id)
+{
+    if(!success)
+    {
+        slotSshConnectionFailed(id, answer);
+        return;
+    }
+    QList<X2GoSessionData> sessions;
+    foreach ( QString str, answer.trimmed().split ('\n', QString::SkipEmptyParts ))
+    {
+        X2GoSessionData data=X2GoSessionData::getSessionFromString(str);
+        if(data.get_sessionType()!=X2GoSessionData::SHADOW && data.get_status()!="F")
+            sessions<<data;
+    }
+    if(sessions.size()==0)
+    {
+        createNewSession();
+        return;
+    }
+    if(sessions.size()==1)
+    {
+        if(sessions[0].get_status()=="S")
+        {
+            resumeSession(sessions[0]);
+            return;
+        }
+    }
+    selectSession(sessions);
+
+
+}
+void X2GoSession::selectSession(const QList<X2GoSessionData>& sessions)
+{
+    SessionSelecter* sel=new SessionSelecter(sessions);
+    sel->exec();
+    delete sel;
+
+}
+
+
+void X2GoSession::resumeSession(const X2GoSessionData& sessionData)
+{
+
+}
+
+void X2GoSession::createNewSession()
+{
+
+}
 
 void X2GoSession::slotSshConnectionOk(QString)
 {
     qDebug()<<"SSH Connection established";
+    if(profile->get_desktop()=="SHADOW")
+    {
+        //get desktops
+        return;
+    }
+    if(profile->get_desktop()=="RDP" && profile->get_directRDP())
+    {
+        //start rdp session
+        return;
+    }
+    if(X2GoApplication::instance()->get_broker())
+    {
+        //start broker session;
+        return;
+    }
+    sshConnection->executeCommand("export HOSTNAME && x2golistsessions", this,SLOT (slotListSessions(bool, QString, int)));
 }
diff --git a/x2gosession.h b/x2gosession.h
index bc43fdc..81589c0 100644
--- a/x2gosession.h
+++ b/x2gosession.h
@@ -24,6 +24,7 @@
 #include <QObject>
 #include "x2goapplication.h"
 #include "sshconnection.h"
+#include "x2gosessiondata.h"
 
 class Profile;
 class X2GoSession : public QObject
@@ -31,19 +32,23 @@ class X2GoSession : public QObject
     Q_OBJECT
 public:
     typedef enum {NOTRUNNING, STARTING, RESUMING, TERMINATING, SUSPENDING, RUNNING} SessionStatus;
-private:
     X2GO_RO_PROPERTY(Profile*, profile)
     X2GO_RO_PROPERTY(SessionStatus, status)
     X2GO_RO_PROPERTY(SshConnection*, sshConnection)
-public:
+    X2GO_PROPERTY(X2GoSessionData, sessionData)
     X2GoSession(Profile* profile);
     virtual ~X2GoSession();
     void startSession();
+    void resumeSession(const X2GoSessionData& sessionData);
+    void createNewSession();
+private:
+    void selectSession(const QList<X2GoSessionData> & sessions);
 public slots:
     void slotStartSession();
 private slots:
     void slotSshConnectionOk(QString);
     void slotSshConnectionFailed(int, QString errorMessage);
+    void slotListSessions(bool success, QString answer, int);
 signals:
     void signalStatusChanged(X2GoSession::SessionStatus status);
 };
diff --git a/x2gosessiondata.cpp b/x2gosessiondata.cpp
new file mode 100644
index 0000000..164fb5b
--- /dev/null
+++ b/x2gosessiondata.cpp
@@ -0,0 +1,87 @@
+/**************************************************************************
+*   Copyright (C) 2005-2013 by Oleksandr Shneyder                         *
+*   o.shneyder at phoca-gmbh.de                                              *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+*   This program is distributed in the hope that it will be useful,       *
+*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+*   GNU General Public License for more details.                          *
+*                                                                         *
+*   You should have received a copy of the GNU General Public License     *
+*   along with this program; if not, write to the                         *
+*   Free Software Foundation, Inc.,                                       *
+*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+***************************************************************************/
+
+#include "x2gosessiondata.h"
+#include <QStringList>
+#include <QObject>
+X2GoSessionData::X2GoSessionData()
+{
+    published=false;
+    colorDepth=0;
+    fullscreen=false;
+    sessionType=DESKTOP;
+}
+
+void X2GoSessionData::operator=(const X2GoSessionData& s)
+{
+    agentPid=s.agentPid;
+    sessionId=s.sessionId;
+    display=s.display;
+    server=s.server;
+    status=s.status;
+    creationTime=s.creationTime;
+    cookie=s.cookie;
+    clientIp=s.clientIp;
+    grPort=s.grPort;
+    sndPort=s.sndPort;
+    fsPort=s.fsPort;
+    command=s.command;
+    published=s.published;
+    colorDepth=s.colorDepth;
+    fullscreen=s.fullscreen;
+    sessionType=s.sessionType;
+}
+
+X2GoSessionData X2GoSessionData::getSessionFromString(const QString& string)
+{
+    QStringList lst=string.split ( '|' );
+    X2GoSessionData s;
+    s.set_agentPid(lst[0]);
+    s.set_sessionId(lst[1]);
+    s.set_display(lst[2]);
+    s.set_server(lst[3]);
+    s.set_server(lst[4]);
+    s.set_creationTime(lst[5]);
+    s.set_cookie(lst[6]);
+    s.set_clientIp(lst[7]);
+    s.set_grPort(lst[8]);
+    s.set_sndPort(lst[9]);
+    if ( lst.count() >13 )
+        s.set_fsPort(lst[13]);
+    if ( s.get_sessionId().indexOf ( "_dp" ) !=-1 )
+    {
+        s.set_colorDepth(s.get_sessionId().split ( "_dp" ) [1].toInt());
+    }
+    s.set_command(QObject::tr ( "unknown" ));
+    if ( s.get_sessionId().indexOf ( "_st" ) !=-1 )
+    {
+        QString cmdinfo=s.get_sessionId().split ( "_st" ) [1];
+        cmdinfo=cmdinfo.split ( "_" ) [0];
+        QChar st=cmdinfo[0];
+        if ( st=='R' )
+            s.set_sessionType(X2GoSessionData::ROOTLESS);
+        if ( st=='S' )
+            s.set_sessionType(X2GoSessionData::SHADOW);
+        QString command=cmdinfo.mid ( 1 );
+        if ( command.length() >0 )
+            s.set_command(command);
+    }
+    return s;
+}
diff --git a/sessionstatusframe.h b/x2gosessiondata.h
similarity index 62%
copy from sessionstatusframe.h
copy to x2gosessiondata.h
index 9845544..d96603d 100644
--- a/sessionstatusframe.h
+++ b/x2gosessiondata.h
@@ -18,33 +18,34 @@
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
 
-#ifndef SESSIONSTATUSFRAME_H
-#define SESSIONSTATUSFRAME_H
 
-#include "x2goapplication.h"
-#include "x2gosession.h"
-#include <QFrame>
-#include "ui_sessionstatusframe.h"
-
-class SessionStatusFrameStatus;
-class SessionStatusFrameApplications;
+#ifndef X2GOSESSIONDATA_H
+#define X2GOSESSIONDATA_H
 
-class SessionStatusFrame : public QFrame, public Ui_SessionStatusFrame
+#include "x2goapplication.h"
+class X2GoSessionData
 {
-    Q_OBJECT
-    X2GO_RO_PROPERTY(X2GoSession*, session)
 public:
-    explicit SessionStatusFrame(QWidget* parent = 0, Qt::WindowFlags f = 0);
-    virtual ~SessionStatusFrame();
-    void setSession(X2GoSession* session);
-private slots:
-    void slotSetTabFrames();
-    void slotSessionStatusChanged(X2GoSession::SessionStatus status);
-private:
-    void setFrame(QPushButton* button);
-private:
-    SessionStatusFrameStatus* frStatus;
-    SessionStatusFrameApplications* frApps;
+    typedef enum {DESKTOP,ROOTLESS,SHADOW} SessionType;
+    X2GO_PROPERTY(QString, agentPid);
+    X2GO_PROPERTY(QString, sessionId);
+    X2GO_PROPERTY(QString, display);
+    X2GO_PROPERTY(QString, server);
+    X2GO_PROPERTY(QString, status);
+    X2GO_PROPERTY(QString, creationTime);
+    X2GO_PROPERTY(QString, cookie);
+    X2GO_PROPERTY(QString, clientIp);
+    X2GO_PROPERTY(QString, grPort);
+    X2GO_PROPERTY(QString, sndPort);
+    X2GO_PROPERTY(QString, fsPort);
+    X2GO_PROPERTY(QString, command);
+    X2GO_PROPERTY(bool, published);
+    X2GO_PROPERTY(int, colorDepth);
+    X2GO_PROPERTY(bool, fullscreen);
+    X2GO_PROPERTY(SessionType, sessionType);
+    X2GoSessionData();
+    void operator = ( const X2GoSessionData& s );
+    static X2GoSessionData getSessionFromString( const QString& string);
 };
 
-#endif // SESSIONSTATUSFRAME_H
+#endif // X2GOSESSIONDATA_H


hooks/post-receive
-- 
x2goclient2.git (X2Go Client 2 (rewrite of x2goclient.git))

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goclient2.git" (X2Go Client 2 (rewrite of x2goclient.git)).




More information about the x2go-commits mailing list