1 #ifndef NEOVIM_QT_MAINWINDOW
2 #define NEOVIM_QT_MAINWINDOW
3 
4 #include <QMainWindow>
5 #include <QStackedWidget>
6 #include <QTabBar>
7 #include <QSplitter>
8 #include "treeview.h"
9 #include "neovimconnector.h"
10 #include "errorwidget.h"
11 #include "scrollbar.h"
12 #include "shell.h"
13 
14 namespace NeovimQt {
15 
16 class MainWindow: public QMainWindow
17 {
18 	Q_OBJECT
19 public:
20 	enum DelayedShow {
21 		Disabled,
22 		Normal,
23 		Maximized,
24 		FullScreen,
25 	};
26 
27 	MainWindow(NeovimConnector *, ShellOptions opts, QWidget *parent=0);
28 	bool neovimAttached() const;
29 	Shell* shell();
30 	void restoreWindowGeometry();
31 public slots:
32 	void delayedShow(DelayedShow type=DelayedShow::Normal);
33 signals:
34 	void neovimAttached(bool);
35 protected:
36 	virtual void closeEvent(QCloseEvent *ev) Q_DECL_OVERRIDE;
37 	virtual void changeEvent(QEvent *ev) Q_DECL_OVERRIDE;
38 private slots:
39 	void neovimSetTitle(const QString &title);
40 	void neovimWidgetResized();
41 	void neovimMaximized(bool);
42 	void neovimSuspend();
43 	void neovimFullScreen(bool);
44 	void neovimGuiCloseRequest();
45 	void neovimExited(int status);
46 	void neovimError(NeovimConnector::NeovimError);
47 	void reconnectNeovim();
48 	void showIfDelayed();
49 	void neovimAttachmentChanged(bool);
50 	void neovimIsUnsupported();
51 	void neovimShowtablineSet(int);
52 	void neovimTablineUpdate(int64_t curtab, QList<Tab> tabs);
53 	void neovimShowContextMenu();
54 	void neovimSendCut();
55 	void neovimSendCopy();
56 	void neovimSendPaste();
57 	void neovimSendSelectAll();
58 	void extTablineSet(bool);
59 	void changeTab(int index);
60 	void saveWindowGeometry();
61 
62 private:
63 	void init(NeovimConnector *);
64 	NeovimConnector *m_nvim;
65 	ErrorWidget *m_errorWidget;
66 	QSplitter *m_window;
67 	TreeView *m_tree;
68 	Shell *m_shell;
69 	DelayedShow m_delayedShow;
70 	QStackedWidget m_stack;
71 	QTabBar *m_tabline;
72 	QToolBar *m_tabline_bar;
73 	ShellOptions m_shell_options;
74 	bool m_neovim_requested_close;
75 	QMenu *m_contextMenu;
76 	QAction *m_actCut;
77 	QAction *m_actCopy;
78 	QAction *m_actPaste;
79 	QAction *m_actSelectAll;
80 	ScrollBar *m_scrollbar;
81 };
82 
83 } // Namespace
84 
85 #endif
86