File indexing completed on 2024-04-14 14:32:07
0001 // 0002 // C++ Interface: cSessionManager 0003 // 0004 // Description: Session manager. 0005 // 0006 /* 0007 Copyright 2002-2011 Tomas Mecir <kmuddy@kmuddy.com> 0008 0009 This program is free software; you can redistribute it and/or 0010 modify it under the terms of the GNU General Public License as 0011 published by the Free Software Foundation; either version 2 of 0012 the License, or (at your option) any later version. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #ifndef CSESSIONMANAGER_H 0024 #define CSESSIONMANAGER_H 0025 0026 struct cSessionManagerPrivate; 0027 class cTabWidget; 0028 0029 #include "cactionbase.h" 0030 0031 #include <qstring.h> 0032 0033 /** 0034 This class manages the open sessions. 0035 0036 @author Tomas Mecir 0037 */ 0038 class cSessionManager : public cActionBase { 0039 public: 0040 /** returns pointer to instance */ 0041 static cSessionManager *self(); 0042 /** destructor */ 0043 ~cSessionManager () override; 0044 0045 /** session count */ 0046 int count (); 0047 0048 int getSessionByTab (int tabnumber); 0049 int getTabBySession (int sess); 0050 0051 int addSession (bool profile = true); 0052 bool removeSession (int which, bool dontClose = false); 0053 void setSession (int which); 0054 int activeSession (); 0055 bool isProfileSession (int sess); 0056 void setSessionName (int which, QString name, bool defName = true); 0057 void changeSession (int id); 0058 0059 /** should the tab bar be displayed even if there is only one connection? */ 0060 bool alwaysTabBar (); 0061 void setAlwaysTabBar (bool value); 0062 0063 /** set notify flag for the given tab */ 0064 void setNotifyFlag (int sess); 0065 0066 /** The main widget. */ 0067 void setMainWidget (cTabWidget *widget); 0068 private: 0069 /** constructor */ 0070 cSessionManager (); 0071 0072 void eventNothingHandler (QString event, int session) override; 0073 0074 enum ProfileIcon { 0075 IconOk, IconNo, IconFlag 0076 }; 0077 /** Set an icon for the session. */ 0078 void setIcon (int sess, ProfileIcon icon); 0079 0080 static cSessionManager *_self; 0081 cSessionManagerPrivate *d; 0082 }; 0083 0084 #endif