onmainwindow.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Oleksandr Shneyder   *
00003  *   oleksandr.shneyder@obviously-nice.de   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef ONMAINWINDOW_H
00021 #define ONMAINWINDOW_H
00022 
00023 //#include "CallbackInterface.h"
00024 #include <QMainWindow>
00025 #include <QList>
00026 #include <QPushButton>
00027 #include <QPixmap>
00028 #include "LDAPSession.h"
00029 
00034 class QLineEdit;
00035 class QFrame;
00036 class QVBoxLayout;
00037 class QHBoxLayout;
00038 class QScrollArea;
00039 class UserButton;
00040 class SessionButton;
00041 class QLabel;
00042 class QProcess;
00043 class QFile;
00044 class SVGFrame;
00045 class SessionButton;
00046 class QAction;
00047 
00048 struct user
00049 {
00050    int uin;
00051    QString uid;
00052    QString name;
00053    QPixmap foto;
00054    static bool lessThen (user u1,user u2){return u1.uid < u2.uid;}
00055 };
00056 
00057 
00058 struct serv
00059 {
00060    QString name;
00061    int sess;
00062    bool operator < (struct serv it){return (it.sess < sess);}
00063 };
00064 
00065 
00066 class ONMainWindow : public QMainWindow
00067 {
00068 Q_OBJECT
00069 public:
00070     ONMainWindow(QWidget *parent = 0);
00071     ~ONMainWindow();
00072     QString iconsPath(QString fname);
00073     const QList<SessionButton*> * getSessionsList(){return &sessions;}
00074 //    virtual void Callback(unsigned int iMsg, void *ptr);
00075 
00076 private:
00077     SVGFrame* fr;
00078     SVGFrame *bgFrame;
00079     QLineEdit* uname;
00080     QLineEdit* pass;
00081     QFrame* uframe;
00082     SVGFrame *passForm;
00083     QLabel* u;
00084     QLabel* fotoLabel;
00085     QLabel* nameLabel;
00086     QLabel* passPrompt;
00087     QPushButton* ok;
00088     QPushButton* cancel;    
00089     QString resolution;
00090 //    int i;
00091     QString kdeIconsPath;
00092     QScrollArea* users;
00093     QVBoxLayout* userl;
00094     QHBoxLayout* mainL;
00095     QList<UserButton*> names;
00096     QList<SessionButton*> sessions;
00097     UserButton* lastUser;
00098     QString prevText;
00099     QString onserver;
00100     QString id;
00101     QString sndport;
00102     QString qpass;    
00103     bool direct;
00104     QString sessionStatus;
00105     QString sessionRes;
00106     QHBoxLayout* username;
00107     QList <user> userList;
00108     QString nick;
00109     QString nfsPort;
00110     QString mntPort;
00111     QProcess* ssh;
00112     QProcess* soundServer;
00113     LDAPSession* ld;
00114     bool useLdap;
00115     bool showToolBar;
00116     QString ldapServer;
00117     int ldapPort;
00118     QString ldapDn;
00119     QString sessionCmd;
00120     QString netSound;
00121     QAction *act_edit;
00122     QAction *act_new;
00123     QString lastFreeServer;
00124     SVGFrame* ln;
00125     bool startSound;
00126     int firstUid;
00127     int lastUid;
00128     void loadSettings();
00129     void showPass(UserButton* user);
00130     void stopExport();
00131     void clean();
00132     void createTmpXconf(QString);
00133     void saveSettings();
00134     void nxrun(QString);
00135     void startDirect(QFile&);
00136     int numOfSessions(QString);
00137     SessionButton* createBut(const QString& id);
00138     void placeButtons();
00139     QString getFreeServer(QString server=QString());
00140     QString getKdeIconsPath();
00141     QString findTheme(QString theme);
00142     void findSession();
00143     bool initLdapSession();
00144 
00145 protected:
00146     virtual void closeEvent(QCloseEvent* event);
00147 
00148 private slots:
00149     void displayUsers();
00150     void slot_showWidgets();
00151     void slot_resize(const QSize sz);
00152 /*    void slotSshStderr();
00153     void slotSshStdout();
00154     void slotSshStderrDirect();
00155     void slotSshStdoutDirect();*/
00156     void slotUnameChanged(const QString& text);
00157 /*    void slotPassEnter(QString last=QString());
00158     void slotEnablePass();
00159 */
00160     void readUsers();    
00161     void slotSelectedFromList(UserButton* user);
00162     void slotUnameEntered();
00163     void slotClosePass();
00164     void slot_readSessions();
00165     void slot_manage();
00166     void displayToolBar(bool);
00167 
00168 public slots:
00169     void slot_config();
00170     void slotNewSession();
00171     void slotDeleteButton(SessionButton * bt);
00172     void slot_edit(SessionButton*);
00173 };
00174 
00175 #endif

Generated on Tue Dec 5 09:15:56 2006 for x2goclient.kdevelop by  doxygen 1.4.7