1 /* 2 SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #pragma once 8 9 #include <QList> 10 #include <QTabWidget> 11 #include <QVariant> 12 13 class QString; 14 class QIcon; 15 16 class LogManager; 17 class TabLogManager; 18 class View; 19 class LogMode; 20 class QMenu; 21 22 class TabLogViewsWidget : public QTabWidget 23 { 24 Q_OBJECT 25 26 public: 27 explicit TabLogViewsWidget(QWidget *parent = nullptr); 28 29 ~TabLogViewsWidget() override; 30 31 QList<LogManager *> logManagers() const; 32 33 LogManager *activeLogManager() const; 34 35 void load(LogMode *logMode, LogManager *manager, const QVariant &analyzerOptions = QVariant()); 36 37 public Q_SLOTS: 38 39 LogManager *createTab(); 40 LogManager *duplicateTab(); 41 42 void closeTab(); 43 44 void moveTabLeft(); 45 void moveTabRight(); 46 47 void reloadCurrent(); 48 void reloadAll(); 49 50 /** 51 * Display a reload icon on the specified view tab 52 */ 53 void changeReloadingTab(View *view, bool reloading); 54 55 // Methods that transmit a signal to the current logViewWidget 56 void expandAllCurrentView(); 57 void collapseAllCurrentView(); 58 void selectAllCurrentView(); 59 60 void fileSaveCurrentView(); 61 void copyToClipboardCurrentView(); 62 void sendMailCurrentView(); 63 void printSelectionCurrentView(); 64 void printPreviewSelectionCurrentView(); 65 66 private Q_SLOTS: 67 void changeTab(View *view, const QIcon &icon, const QString &label); 68 69 void changeCurrentTab(int index); 70 void changeTitleAddedLines(View *, int); 71 72 void showContextMenu(const QPoint &cursorPosition); 73 void showContextMenu(QWidget *tab, const QPoint &cursorPosition); 74 75 Q_SIGNALS: 76 77 void logManagerCreated(LogManager *manager); 78 79 void statusBarChanged(const QString &message); 80 81 private: 82 TabLogManager *newTabLogManager(); 83 84 void newTab(View *view); 85 86 LogManager *findRelatedLogManager(View *view); 87 88 QIcon logModeIcon(LogMode *icon) const; 89 90 TabLogManager *activeTabLogManager() const; 91 TabLogManager *findRelatedTabLogManager(View *view) const; 92 93 void prepareContextMenu(bool onTab); 94 QList<TabLogManager *> mTabLogManagers; 95 96 QMenu *mContextMenu = nullptr; 97 }; 98 99