File indexing completed on 2024-03-24 17:26:05
0001 /* 0002 SPDX-FileCopyrightText: 2000 Shie Erlich <krusader@users.sourceforge.net> 0003 SPDX-FileCopyrightText: 2000 Rafi Yanai <krusader@users.sourceforge.net> 0004 SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KRGLOBAL_H 0010 #define KRGLOBAL_H 0011 0012 // QtGui 0013 #include <QKeySequence> 0014 0015 #include <KConfigCore/KConfigGroup> 0016 0017 class KConfig; 0018 class KMountMan; 0019 class KrArcHandler; 0020 class KrBookmarkHandler; 0021 class KrSlots; 0022 class KrusaderView; 0023 class UserAction; 0024 class JobMan; 0025 class QWidget; 0026 class KrPanel; 0027 0028 // global references to frequently used objects 0029 0030 class KrGlobal 0031 { 0032 public: 0033 static KConfig *config; // allow everyone to access the config 0034 static KMountMan *mountMan; // krusader's Mount Manager 0035 static KrArcHandler *arcMan; //! Manages archives in several parts of the code 0036 static KrBookmarkHandler *bookman; 0037 static KrSlots *slot; 0038 static KrusaderView *mainView; // The GUI 0039 static QWidget *mainWindow; 0040 static UserAction *userAction; 0041 static JobMan *jobMan; 0042 static KrPanel *activePanel(); 0043 0044 // HACK - used by [ListerTextArea|KrSearchDialog|LocateDlg]:keyPressEvent() 0045 static QKeySequence copyShortcut; 0046 0047 /** Version of saved configuration. Use this to detect configuration updates. */ 0048 static const int sConfigVersion = 1; 0049 static int sCurrentConfigVersion; 0050 }; 0051 0052 #define krConfig KrGlobal::config 0053 #define krMtMan (*(KrGlobal::mountMan)) 0054 #define krArcMan (*(KrGlobal::arcMan)) 0055 #define krBookMan KrGlobal::bookman 0056 #define SLOTS KrGlobal::slot 0057 #define MAIN_VIEW KrGlobal::mainView 0058 #define krMainWindow KrGlobal::mainWindow 0059 #define krUserAction KrGlobal::userAction 0060 #define krJobMan KrGlobal::jobMan 0061 0062 #define ACTIVE_PANEL (KrGlobal::activePanel()) 0063 0064 #define ACTIVE_MNG (MAIN_VIEW->activeManager()) 0065 #define ACTIVE_FUNC (ACTIVE_PANEL->func) 0066 #define OTHER_MNG (MAIN_VIEW->inactiveManager()) 0067 #define OTHER_PANEL (ACTIVE_PANEL->otherPanel()) 0068 #define OTHER_FUNC (OTHER_PANEL->func) 0069 #define LEFT_PANEL (MAIN_VIEW->leftPanel()) 0070 #define LEFT_FUNC (LEFT_PANEL->func) 0071 #define LEFT_MNG (MAIN_VIEW->leftManager()) 0072 #define RIGHT_PANEL (MAIN_VIEW->rightPanel()) 0073 #define RIGHT_FUNC (RIGHT_PANEL->func) 0074 #define RIGHT_MNG (MAIN_VIEW->rightManager()) 0075 0076 // #define krEnableAction(name, enable) (KrGlobal::enableAction(#name, (enable))) 0077 // #define krGetAction(name) (KrGlobal::getAction(#name)) 0078 0079 #endif