1 /**************************************************************************
2 *   Copyright (C) 2005-2020 by Oleksandr Shneyder                         *
3 *                              <o.shneyder@phoca-gmbh.de>                 *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 *   This program is distributed in the hope that it will be useful,       *
10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12 *   GNU General Public License for more details.                          *
13 *                                                                         *
14 *   You should have received a copy of the GNU General Public License     *
15 *   along with this program.  If not, see <https://www.gnu.org/licenses/>. *
16 ***************************************************************************/
17 
18 #ifndef SESSIONBUTTON_H
19 #define SESSIONBUTTON_H
20 
21 #include "SVGFrame.h"
22 #include <QPushButton>
23 #include <QLabel>
24 class ONMainWindow;
25 class QComboBox;
26 class QPushButton;
27 
28 /**
29 	@author Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de>
30 */
31 class SessionButton : public SVGFrame
32 {
33     Q_OBJECT
34 public:
35     enum {KDE,GNOME,LXDE, LXQt, XFCE,MATE,UNITY,CINNAMON,TRINITY,OPENBOX,ICEWM,RDP,XDMCP,SHADOW,PUBLISHED,OTHER,APPLICATION};
36     SessionButton ( ONMainWindow* mw, QWidget* parent,QString id );
37     ~SessionButton();
id()38     QString id() {
39         return sid;
40     }
41     void redraw();
sessIcon()42     const QPixmap* sessIcon() {
43         return icon->pixmap();
44     }
45     static bool lessThen ( const SessionButton* b1, const SessionButton* b2 );
46     QString name();
getPath()47     QString getPath()
48     {
49         return path;
50     }
setPath(QString path)51     void setPath(QString path)
52     {
53         this->path=path;
54     }
55 
56 private:
57     QString nameofSession;
58     QString sid;
59     QString path;
60     QLabel* sessName;
61     QLabel* sessStatus;
62     QLabel* icon;
63     QComboBox* cmdBox;
64     QLabel* cmd;
65     QLabel* serverIcon;
66     QLabel* geomIcon;
67     QLabel* cmdIcon;
68     QLabel* server;
69     QPushButton* editBut;
70     QLabel* geom;
71     QMenu* sessMenu;
72     QComboBox* geomBox;
73     QPushButton* sound;
74     QLabel* soundIcon;
75     ONMainWindow* par;
76     QAction* act_edit;
77     QAction* act_createIcon;
78     QAction* act_remove;
79     bool rootless;
80     bool published;
81     bool editable;
82 
83 private slots:
84     void slotClicked();
85     void slotEdit();
86     void slot_soundClicked();
87     void slot_cmd_change ( const QString& command );
88     void slot_geom_change ( const QString& new_g );
89     void slotRemove();
90     void slotMenuHide();
91     void slotShowMenu();
92     void slotCreateSessionIcon();
93 signals:
94     void sessionSelected ( SessionButton* );
95     void signal_edit ( SessionButton* );
96     void signal_remove ( SessionButton* );
97     void clicked();
98 protected:
99     virtual void mouseMoveEvent ( QMouseEvent * event );
100     virtual void mousePressEvent ( QMouseEvent * event );
101     virtual void mouseReleaseEvent ( QMouseEvent * event );
102 };
103 
104 #endif
105