File indexing completed on 2024-04-28 03:58:04

0001 /*
0002     SPDX-FileCopyrightText: 2023 Waqar Ahmed <waqar.17a@gmail.com>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 #ifndef KTE_Screenshot_dialog_h
0006 #define KTE_Screenshot_dialog_h
0007 
0008 #include <KTextEditor/Range>
0009 #include <QDialog>
0010 
0011 class QPushButton;
0012 class KateRenderer;
0013 class BaseWidget;
0014 class QScrollArea;
0015 class QToolButton;
0016 class QTimer;
0017 class QMenu;
0018 class QCheckBox;
0019 
0020 namespace KTextEditor
0021 {
0022 class ViewPrivate;
0023 }
0024 
0025 class ScreenshotDialog : public QDialog
0026 {
0027 public:
0028     explicit ScreenshotDialog(KTextEditor::Range selRange, KTextEditor::ViewPrivate *parent = nullptr);
0029     ~ScreenshotDialog() override;
0030 
0031     void renderScreenshot(KateRenderer *renderer);
0032 
0033 private:
0034     void onSaveClicked();
0035     void onCopyClicked();
0036     enum {
0037         DontShowLineNums,
0038         ShowAbsoluteLineNums,
0039         ShowActualLineNums,
0040     };
0041     void onLineNumChangedClicked(int i);
0042     void resizeEvent(QResizeEvent *e) override;
0043 
0044 private:
0045     BaseWidget *const m_base;
0046     const KTextEditor::Range m_selRange;
0047     QScrollArea *const m_scrollArea;
0048     QPushButton *const m_saveButton;
0049     QPushButton *const m_copyButton;
0050     QPushButton *const m_changeBGColor;
0051     QToolButton *const m_lineNumButton;
0052     QCheckBox *const m_extraDecorations;
0053     QCheckBox *const m_windowDecorations;
0054     QMenu *const m_lineNumMenu;
0055     QTimer *m_resizeTimer;
0056     bool m_firstShow = true;
0057     bool m_showLineNumbers = true;
0058     bool m_absoluteLineNumbers = true;
0059 };
0060 
0061 #endif