File indexing completed on 2024-04-14 14:32:11
0001 /*************************************************************************** 0002 kmuddy.h - main class that handles interface 0003 This file is a part of KMuddy distribution. 0004 ------------------- 0005 begin : Pi Jun 14 12:37:51 CEST 2002 0006 copyright : (C) 2002 by Tomas Mecir 0007 email : kmuddy@kmuddy.com 0008 ***************************************************************************/ 0009 0010 /*************************************************************************** 0011 * * 0012 * This program is free software; you can redistribute it and/or modify * 0013 * it under the terms of the GNU General Public License as published by * 0014 * the Free Software Foundation; either version 2 of the License, or * 0015 * (at your option) any later version. * 0016 * * 0017 ***************************************************************************/ 0018 0019 #ifndef KMUDDY_H 0020 #define KMUDDY_H 0021 0022 #include "cactionbase.h" 0023 #include "cactionmanager.h" 0024 0025 #include <KMainWindow> 0026 0027 class QMenu; 0028 class QTimer; 0029 class KHelpMenu; 0030 class QMenuBar; 0031 class KStatusNotifierItem; 0032 class KToolBar; 0033 0034 class dlgConnect; 0035 class dlgQuickConnect; 0036 class dlgEditProfile; 0037 class dlgGrabKey; 0038 class dlgObjects; 0039 class dlgStatistics; 0040 0041 class cActionManager; 0042 class cTabWidget; 0043 0044 /** KMuddy is the base class of the project */ 0045 class KMuddy : public KMainWindow, public cActionBase 0046 { 0047 Q_OBJECT 0048 public: 0049 /** destructor */ 0050 ~KMuddy() override; 0051 0052 static KMuddy *self(); 0053 0054 //these functions enable/disable menu/toolbar functions 0055 //they are called by cConnection 0056 0057 /** disables options valid only when we're connected */ 0058 void disableConnectedOptions (); 0059 /** enables all such options, advanced options are still disabled */ 0060 void enableConnectedOptions (); 0061 /** disables advanced options - all that require a standard (not quick) connection, 0062 as they need to store settings and so on; this includes aliases, macros, triggers, 0063 auto-mapper, ... */ 0064 void disableAdvancedOptions (); 0065 /** enables all advanced options */ 0066 void enableAdvancedOptions (); 0067 /** enable Close tab option */ 0068 void setClosedConn (bool canCT); 0069 /** disable Close tab option */ 0070 void unsetClosedConn (); 0071 0072 void focusChange (const QString &window, const QString &command); 0073 0074 static bool isGoingDown () { return goingDown; }; 0075 0076 /** flashing of window caption */ 0077 void setAllowGlobalNotify (bool notify); 0078 /** flashing of tabbar text */ 0079 void setAllowLocalNotify (bool notify); 0080 /** flashing always or triggers only? */ 0081 void setAlwaysNotify (bool notify); 0082 /** Enable system tray icon? */ 0083 void setSysTrayEnabled (bool enabled); 0084 /** Enable passive popup notification? */ 0085 void setPassivePopup (bool enabled); 0086 /** auto-connect? And where? */ 0087 void setAutoConnect (const QString & ac); 0088 0089 /** some trigger requested notification */ 0090 void requestNotify (int sess); 0091 0092 /** text of the reconnect message */ 0093 QString reconnectText (); 0094 0095 /** update alias groups, ... - called when switching session */ 0096 void updateWindows (); 0097 0098 /** called by cConnection::updateMenus() when switching tabs */ 0099 void setMenuAliasesEnabled (bool val); 0100 /** called by cConnection::updateMenus() when switching tabs */ 0101 void setMenuTriggersEnabled (bool val); 0102 /** called by cConnection::updateMenus() when switching tabs */ 0103 void setMenuTimersEnabled (bool val); 0104 /** called by cConnection::updateMenus() when switching tabs */ 0105 void setMenuShortcutsEnabled (bool val); 0106 0107 void setGrabDialog (dlgGrabKey *dlg) { grabdlg = dlg; }; 0108 0109 KToolBar *buttonBar() { return buttonbar; } 0110 0111 public slots: 0112 void showGauges (bool val); 0113 void setFullScreen (bool val); 0114 void toggleShowMenu (); 0115 protected slots: 0116 0117 /** close current tab - only valid if that connection has been closed */ 0118 void closeTab (); 0119 void showAndHandleConnectDialog (); 0120 void showAndHandleQuickConnectDialog (); 0121 /** called when user clicks Connect in dlgQuickConnect */ 0122 void doQuickConnect (); 0123 /** called when user clicks Connect in dlgConnect */ 0124 void doConnect (); 0125 /** called by doConnect and when auto-connecting on start-up */ 0126 void doProfileConnect (const QString &name, bool sendNothing); 0127 void doDisconnect (); 0128 void doReconnect (); 0129 0130 void pasteCommand (); 0131 void pasteInput (); 0132 0133 void changeSession (int tab); 0134 0135 /** lots of slots that handle menus; were handled by slots in objects, 0136 now we have cSession, so we have to handle them here */ 0137 void addSelectionToClipboard (); 0138 void setParsing (bool value); 0139 void clearCommandQueue (); 0140 void showObjectsDialog (); 0141 void handleWindowsDialog (); 0142 void saveProfile (); 0143 void switchAliases (bool value); 0144 void switchTriggers (bool value); 0145 void switchTimers (bool value); 0146 void switchShortcuts (bool value); 0147 void showSettingsDialog (); 0148 void showConnPrefsDialog (); 0149 void configureTranscript (); 0150 void dumpBuffer (); 0151 void makeDecision (); 0152 void importProfile (); 0153 void exportProfile (); 0154 void lineUp (); 0155 void lineDown (); 0156 void pageUp (); 0157 void pageDown (); 0158 void aconUp (); 0159 void aconDown (); 0160 0161 void prevTab (); 0162 void nextTab (); 0163 void switchTab1 () { switchTab(0); }; 0164 void switchTab2 () { switchTab(1); }; 0165 void switchTab3 () { switchTab(2); }; 0166 void switchTab4 () { switchTab(3); }; 0167 void switchTab5 () { switchTab(4); }; 0168 void switchTab6 () { switchTab(5); }; 0169 void switchTab7 () { switchTab(6); }; 0170 void switchTab8 () { switchTab(7); }; 0171 void switchTab9 () { switchTab(8); }; 0172 void switchTab10 () { switchTab(9); }; 0173 protected: 0174 /** protected constructor */ 0175 KMuddy (); 0176 static KMuddy *_self; 0177 0178 void eventNothingHandler (QString event, int session) override; 0179 void eventIntHandler (QString event, int session, int, int) override; 0180 void eventChunkHandler (QString event, int session, cTextChunk *) override; 0181 void eventStringHandler (QString event, int session, QString &par1, 0182 const QString &par2) override; 0183 0184 void prepareObjects (); 0185 void killObjects (); 0186 /** called when we try to close the window (Alt+F4 or the Close icon) */ 0187 bool queryClose () override; 0188 0189 /** calls cSessionManager::self()->activeSession. Provided for convenience. */ 0190 int activeSession (); 0191 0192 /** event filter, used to grab macro keys */ 0193 bool eventFilter (QObject *o, QEvent *e) override; 0194 0195 /** save session properties */ 0196 void saveProperties (KConfigGroup &config) override; 0197 /** read session properties */ 0198 void readProperties (const KConfigGroup &config) override; 0199 0200 dlgGrabKey *grabdlg; 0201 0202 /** switch to tab <which> */ 0203 void switchTab (int index); 0204 0205 /** True when the app is about to terminate */ 0206 static bool goingDown; 0207 0208 /**menus*/ 0209 QMenu *connectionMenu, *editMenu, *viewMenu, *profileMenu; 0210 QMenu *toolsMenu, *settingsMenu, *popup; 0211 KHelpMenu *helpMenu; 0212 0213 /**System Tray Icon*/ 0214 KStatusNotifierItem *sysIcon; 0215 0216 //notification 0217 bool globalnotify, localnotify, alwaysnotify, systrayenabled, passivepopup; 0218 0219 //auto-connect 0220 QString autoconnect; 0221 0222 // the central area 0223 cTabWidget *central; 0224 0225 // the button bar 0226 KToolBar *buttonbar; 0227 0228 cActionManager *am; 0229 0230 // some dialog boxes 0231 dlgConnect *cdlg; 0232 dlgQuickConnect *qdlg; 0233 dlgEditProfile *mdlg; 0234 dlgStatistics *statdlg; 0235 dlgObjects *objdlg; 0236 }; 0237 0238 #endif