-
Notifications
You must be signed in to change notification settings - Fork 1
/
GuiMainWindow.h
169 lines (143 loc) · 5.35 KB
/
GuiMainWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
* Copyright (C) 2012 Rajendran Thirupugalsamy
* See LICENSE for full copyright and license information.
* See COPYING for distribution information.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <map>
#include <tuple>
#include <QMainWindow>
#include <QMenu>
#include <QToolButton>
#include <QShortcut>
#include <QSignalMapper>
#include "QtCommon.h"
#include "GuiCompactSettingsWindow.h"
#include "GuiSettingsWindow.h"
#include "GuiMenu.h"
#include "GuiDrag.h"
#include "GuiNavigation.h"
#include "plugin/GuiWebPlugin.h"
class GuiCompactSettingsWindow;
class GuiSettingsWindow;
class GuiFindToolBar;
class GuiTabWidget;
class GuiToolButton : public QToolButton
{
Q_OBJECT
protected:
void paintEvent(QPaintEvent *);
public:
QSize sizeHint() const;
};
class GuiMainWindow : public QMainWindow
{
Q_OBJECT
public:
GuiTerminalWindow *menuCookieTermWnd;
GuiToolbarTerminalTop toolBarTerminalTop; // top-right of terminal in split-mode
// members for drag-drop support
GuiDragDropSite dragDropSite;
// find window
GuiFindToolBar *findToolBar;
// tab order-of-usage navigation window
uint32_t mru_count_last;
GuiTabNavigation *tabNavigate;
GuiPaneNavigation *paneNavigate;
GuiTabWidget *tabArea;
// webpluging window
GuiWebPlugin *webPluginWnd;
private:
GuiCompactSettingsWindow *compactSettingsWindow;
GuiSettingsWindow *settingsWindow;
QList<GuiTerminalWindow *> terminalList;
GuiToolButton newTabToolButton; // shown in top right corner of tabbar
// containers for fast-retrieval
std::map<const QWidget*,int> tabIndexMap;
std::vector<std::pair<GuiSplitter*,GuiTerminalWindow*> > widgetAtIndex;
// members for action/menu support
vector<std::tuple<int32_t, QShortcut*, QAction*>> menuCommonShortcuts;
QMenu menuCommonMenus[MENU_MAX_MENU];
QMenu menuSavedSessions;
QSignalMapper *menuCustomSavedSessionSigMapper;
public:
GuiMainWindow(QWidget *parent = 0);
~GuiMainWindow();
void createNewTab(Config *cfg, GuiBase::SplitType splittype=GuiBase::TYPE_LEAF);
void closeEvent ( QCloseEvent * event );
GuiTerminalWindow *getCurrentTerminal();
GuiTerminalWindow *getCurrentTerminalInTab(int tabIndex);
QMenu *menuGetMenuById(qutty_menu_id_t id) {
assert(id > MENU_SEPARATOR && id <= MENU_SEPARATOR + MENU_MAX_MENU);
return &menuCommonMenus[id - MENU_SEPARATOR - 1];
}
QAction *menuGetActionById(qutty_menu_id_t id);
QKeySequence menuGetShortcutById(qutty_menu_id_t id);
void menuSetShortcutById(qutty_menu_id_t id, QKeySequence key);
void initializeCustomSavedSessionShortcuts();
void tabInsert(int tabind, QWidget *w, const QString &title);
void tabRemove(int tabind);
int setupLayout(GuiTerminalWindow *newTerm, GuiBase::SplitType split, int tabind = -1);
void setupTerminalSize(GuiTerminalWindow *newTerm);
int getTerminalTabInd(const QWidget *term);
const QList<GuiTerminalWindow*> *getTerminalList() { return &terminalList; }
private:
void initializeMenuSystem();
void inittializeDragDropWidget();
void populateMenu(QMenu &menu, qutty_menu_id_t menu_list[], int len);
void readWindowSettings();
void writeWindowSettings();
public slots:
void on_openNewWindow();
void on_openNewCompactSession(GuiBase::SplitType splittype);
void on_openNewSession(Config cfg, GuiBase::SplitType splittype);
void on_openNewTab() { on_openNewCompactSession(GuiBase::TYPE_LEAF); }
void on_openNewSplitHorizontal() { on_openNewCompactSession(GuiBase::TYPE_HORIZONTAL); }
void on_openNewSplitVertical() { on_openNewCompactSession(GuiBase::TYPE_VERTICAL); }
void on_createNewSession(Config cfg, GuiBase::SplitType splittype);
void on_settingsWindowClose();
void on_changeSettingsTab(GuiTerminalWindow *termWnd);
void on_changeSettingsTabComplete(Config cfg, GuiTerminalWindow *termWnd);
void closeTerminal(GuiTerminalWindow *termWnd);
void tabCloseRequested (int index);
void currentChanged(int index);
void on_tabLayoutChanged();
void tabNext();
void tabPrev();
void contextMenuPaste();
void contextMenuSavedSessionsChanged();
void contextMenuSavedSessionTriggered();
void contextMenuDuplicateSessionTriggered();
void contextMenuOpenDuplicateHSplit();
void contextMenuOpenDuplicateVSplit();
void contextMenuRestartSessionTriggered();
void contextMenuChangeSettingsTriggered();
void contextMenuCloseSessionTriggered();
void contextMenuCloseWindowTriggered();
void contextMenuMenuBar();
void contextMenuTabInTitleBar();
void contextMenuFullScreen();
void contextMenuAlwaysOnTop();
void contextMenuTermTopDragPaneTriggered();
void contextMenuTermTopCloseTriggered();
void contextMenuPreferences();
void contextMenuRenameTab();
void contextMenuFind();
void contextMenuFindNext();
void contextMenuFindPrevious();
void contextMenuPaneUp();
void contextMenuPaneDown();
void contextMenuPaneLeft();
void contextMenuPaneRight();
void contextMenuMRUTab();
void contextMenuLRUTab();
void contextMenuMRUPane();
void contextMenuLRUPane();
void contextMenuCustomSavedSession(int ind);
void contextMenuImportFromFile();
void contextMenuImportFromPuttySessions();
void contextMenuExportToFile();
void contextMenuAutoComplete();
};
#endif // MAINWINDOW_H