MagicSmoke  $VERSION$
login.h
Go to the documentation of this file.
1 //
2 // C++ Interface: mainwindow
3 //
4 // Description:
5 //
6 //
7 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2016
8 //
9 // Copyright: See README/COPYING.GPL files that come with this distribution
10 //
11 //
12 
13 #ifndef MAGICSMOKE_LOGIN_H
14 #define MAGICSMOKE_LOGIN_H
15 
16 #include <QDialog>
17 #include <QMap>
18 #include <QPair>
19 #include <QWidget>
20 
21 class QComboBox;
22 class QLineEdit;
23 class QSizeGrip;
24 class QCheckBox;
25 
26 class MSessionManager;
27 
29 class MLogin:public QWidget
30 {
31  Q_OBJECT
32  public:
33  explicit MLogin(MSessionManager*);
34 
35  QString getCurrentClient()const;
36  private:
37  QString sessionid;
38  QLineEdit*username,*password;
39  QComboBox*profiles,*clients;
40  QSizeGrip*resizer;
41 
42  protected:
43  void resizeEvent(QResizeEvent *);
44 
45  private slots:
46  void initProfiles();
47  void loadProfile();
48  void initClients(MSessionManager*);
49 
50  public slots:
51  void configwin();
52  void relogin();
53  void clientConfig();
54  void setProfile(QString);
55  void setUsername(QString);
56  void setPassword(QString);
57  void startLogin();
58 
59  signals:
60  void loginSucceeded();
61  void lostSession();
62 };
63 
65 class MClientConfig:public QDialog
66 {
67  Q_OBJECT
68 public:
69  explicit MClientConfig ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
70 
71  static bool selectable(QString client);
72  static bool inMenu(QString client);
73  static bool inClientMenu(QString client);
74 
75  static bool preselectLast();
76  static QString preselection();
77  static bool selectionChangeable();
78 
79 private slots:
80  void saveData();
81 
82 private:
83  QCheckBox*mallowchange;
84  QComboBox*mpresel;
85  struct s_checkbox{
86  QCheckBox*presel=nullptr,*menu=nullptr,*client=nullptr;
87  s_checkbox(){}
88  s_checkbox(QCheckBox*m,QCheckBox*p,QCheckBox*c):presel(p),menu(m),client(c){}
89  s_checkbox(const s_checkbox&)=default;
90  s_checkbox(s_checkbox&&)=default;
91  s_checkbox& operator=(const s_checkbox&)=default;
92  s_checkbox& operator=(s_checkbox&&)=default;
93  };
94  QMap<QString,s_checkbox>mclients;
95 };
96 
97 #endif
static QString preselection()
Definition: login.cpp:364
MLogin(MSessionManager *)
Definition: login.cpp:39
Configures which client is available for selection.
Definition: login.h:65
void setProfile(QString)
Definition: login.cpp:234
void relogin()
Definition: login.cpp:224
void loginSucceeded()
Definition: sman.h:26
void resizeEvent(QResizeEvent *)
Definition: login.cpp:214
static bool inMenu(QString client)
Definition: login.cpp:354
static bool preselectLast()
Definition: login.cpp:344
static bool selectionChangeable()
Definition: login.cpp:369
void startLogin()
Definition: login.cpp:159
MClientConfig(QWidget *parent=0, Qt::WindowFlags f=0)
Definition: login.cpp:260
void lostSession()
login and profile configuration window
Definition: login.h:29
QString getCurrentClient() const
Definition: login.cpp:154
static bool selectable(QString client)
Definition: login.cpp:349
static bool inClientMenu(QString client)
Definition: login.cpp:359
void setUsername(QString)
Definition: login.cpp:242
void clientConfig()
Definition: login.cpp:252
void setPassword(QString)
Definition: login.cpp:247
void configwin()
Definition: login.cpp:206