File indexing completed on 2024-04-21 05:46:24

0001 /*
0002     SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 // KDE includes
0010 #include <KConfig>
0011 #include <kxmlguiwindow.h>
0012 
0013 #include "logModeAction.h"
0014 
0015 class LogManager;
0016 class LogMode;
0017 
0018 class View;
0019 
0020 class TabLogViewsWidget;
0021 class QPrinter;
0022 class DetailDialog;
0023 class LoggerDialog;
0024 class ConfigurationDialog;
0025 namespace KSystemLog
0026 {
0027 class StatusBar;
0028 /**
0029  * This class serves as the main window for ksystemlog.  It handles the
0030  * menus, toolbars, and status bars.
0031  */
0032 class MainWindow : public KXmlGuiWindow
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     /**
0038      * Default Constructor
0039      */
0040     MainWindow();
0041 
0042     /**
0043      * Default Destructor
0044      */
0045     ~MainWindow() override;
0046 
0047     TabLogViewsWidget *tabs();
0048 
0049 protected:
0050     /**
0051      * This function is called when it is time for the app to save its
0052      * properties for session management purposes.
0053      */
0054     void saveProperties(KConfigGroup &configuration) override;
0055 
0056     /**
0057      * This function is called when this app is restored.  The KConfig
0058      * object points to the session management config file that was saved
0059      * with @ref saveProperties
0060      */
0061     void readProperties(const KConfigGroup &configuration) override;
0062 
0063     /**
0064      * Reimplemented to save configuration when closing.
0065      */
0066     void closeEvent(QCloseEvent *event) override;
0067 
0068 public Q_SLOTS:
0069     void changeStatusBar(const QString &text);
0070     void changeWindowTitle(const QString &text);
0071 
0072     void updateStatusBar();
0073 
0074     void prepareCreatedLogManager(LogManager *logManager);
0075 
0076 private Q_SLOTS:
0077     void fileOpen();
0078 
0079     void showConfigurationDialog();
0080     void showDetailsDialog();
0081     void showLogMessageDialog();
0082 
0083     // Transmits signals to active LogManager
0084     void showSearchBar();
0085     void findNext();
0086     void findPrevious();
0087 
0088     void updateSelection();
0089     void updateReloading();
0090 
0091     void toggleFilterBar();
0092 
0093     void toggleItemTooltip(bool enabled);
0094     void toggleNewLinesDisplaying(bool displayed);
0095     void toggleResumePauseParsing(bool paused);
0096 
0097     void changeCurrentTab();
0098 
0099     void changeResumePauseAction(bool paused);
0100     void selectLogModeAction(bool);
0101     void recreateActions();
0102 
0103 private:
0104     void loadLogModePlugins();
0105 
0106     void setupStatusBar();
0107 
0108     void setupTabLogViews();
0109 
0110     void setupActions();
0111     void setupLogModeMenu();
0112     void setupLogActions();
0113 
0114     void updateDetailDialog();
0115 
0116     QAction *mSaveAction = nullptr;
0117     QAction *mCopyAction = nullptr;
0118 
0119     QAction *mReloadAction = nullptr;
0120 
0121     QAction *mSendMailAction = nullptr;
0122     QAction *mLogMessageAction = nullptr;
0123 
0124     QAction *mFilterBarAction = nullptr;
0125 
0126     QAction *mSelectAllAction = nullptr;
0127 
0128     QAction *mExpandAllAction = nullptr;
0129     QAction *mCollapseAllAction = nullptr;
0130 
0131     QAction *mResumePauseAction = nullptr;
0132     QAction *mDetailAction = nullptr;
0133     QAction *mPrintAction = nullptr;
0134     QAction *mPrintPreviewAction = nullptr;
0135 
0136     QAction *mFindAction = nullptr;
0137     QAction *mFindNextAction = nullptr;
0138     QAction *mFindPreviousAction = nullptr;
0139 
0140     QAction *mTooltipEnabledAction = nullptr;
0141     QAction *mNewLinesDisplayedAction = nullptr;
0142 
0143     /**
0144      * Action groups which stores all Log Mode Actions
0145      */
0146     QActionGroup *mLogModesActionGroup = nullptr;
0147 
0148     QPrinter *mPrinter = nullptr;
0149 
0150     /**
0151      * Detail dialog
0152      */
0153     DetailDialog *mDetailDialog = nullptr;
0154 
0155     /**
0156      * Logged Dialog
0157      */
0158     LoggerDialog *mLoggedDialog = nullptr;
0159 
0160     ConfigurationDialog *mConfigurationDialog = nullptr;
0161 
0162     /**
0163      * Tab widget managing different views
0164      */
0165     TabLogViewsWidget *mTabs = nullptr;
0166 
0167     KSystemLog::StatusBar *mStatusBar = nullptr;
0168 };
0169 }