File indexing completed on 2024-04-28 05:50:55

0001 /*
0002  *  SPDX-FileCopyrightText: 2019 Tomaz Canabrava <tcanabrava@kde.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef TERMINAL_HEADER_BAR_H
0008 #define TERMINAL_HEADER_BAR_H
0009 
0010 #include "session/Session.h"
0011 #include <QPoint>
0012 #include <QWidget>
0013 
0014 class QLabel;
0015 class QToolButton;
0016 class QBoxLayout;
0017 class QSplitter;
0018 
0019 namespace Konsole
0020 {
0021 class TerminalDisplay;
0022 class ViewProperties;
0023 
0024 class TerminalHeaderBar : public QWidget
0025 {
0026     Q_OBJECT
0027 public:
0028     // TODO: Verify if the terminalDisplay is needed, or some other thing like SessionController.
0029     explicit TerminalHeaderBar(QWidget *parent = nullptr);
0030     void finishHeaderSetup(ViewProperties *properties);
0031     QSize minimumSizeHint() const override;
0032     void applyVisibilitySettings();
0033     QSplitter *getTopLevelSplitter();
0034     void setExpandedMode(bool expand);
0035 
0036 public Q_SLOTS:
0037     void setFocusIndicatorState(bool focused);
0038     /** Shows/hide notification status icon */
0039     void updateNotification(ViewProperties *item, Konsole::Session::Notification notification, bool enabled);
0040     /** Shows/hide special state status icon (copy input or read-only) */
0041     void updateSpecialState(ViewProperties *item);
0042 
0043 protected:
0044     void paintEvent(QPaintEvent *paintEvent) override;
0045     void mousePressEvent(QMouseEvent *ev) override;
0046     void mouseReleaseEvent(QMouseEvent *ev) override;
0047     void mouseMoveEvent(QMouseEvent *ev) override;
0048     void mouseDoubleClickEvent(QMouseEvent *ev) override;
0049 
0050 Q_SIGNALS:
0051     void requestToggleExpansion();
0052     void requestMoveToNewTab();
0053 
0054 private:
0055     QBoxLayout *m_boxLayout;
0056     QLabel *m_terminalTitle;
0057     QLabel *m_terminalIcon;
0058     QLabel *m_statusIconReadOnly;
0059     QLabel *m_statusIconCopyInput;
0060     QLabel *m_statusIconSilence;
0061     QLabel *m_statusIconActivity;
0062     QLabel *m_statusIconBell;
0063     QToolButton *m_closeBtn;
0064     QToolButton *m_moveToNewTab;
0065     QToolButton *m_toggleExpandedMode;
0066     bool m_terminalIsFocused;
0067     QPoint m_startDrag;
0068 };
0069 
0070 } // namespace Konsole
0071 
0072 #endif