1 | /* |
2 | * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) |
3 | * |
4 | * This program is free software: you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation, either version 3 of the License, or |
7 | * (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 | */ |
17 | #ifndef MAINWINDOW_H |
18 | #define MAINWINDOW_H |
19 | |
20 | #include <QFileSystemWatcher> |
21 | #include <QMainWindow> |
22 | #include <QTimer> |
23 | #include <QFileSystemModel> |
24 | #include <QTcpServer> |
25 | #include <QElapsedTimer> |
26 | #include <QSortFilterProxyModel> |
27 | #include "common.h" |
28 | #include "widgets/searchresultview.h" |
29 | #include "widgets/classbrowser.h" |
30 | #include "widgets/codecompletionpopup.h" |
31 | #include "widgets/headercompletionpopup.h" |
32 | #include "widgets/functiontooltipwidget.h" |
33 | #include "caretlist.h" |
34 | #include "symbolusagemanager.h" |
35 | #include "codesnippetsmanager.h" |
36 | #include "todoparser.h" |
37 | #include "toolsmanager.h" |
38 | #include "widgets/labelwithmenu.h" |
39 | #include "widgets/bookmarkmodel.h" |
40 | #include "widgets/ojproblemsetmodel.h" |
41 | #include "widgets/customfilesystemmodel.h" |
42 | #include "customfileiconprovider.h" |
43 | |
44 | |
45 | QT_BEGIN_NAMESPACE |
46 | namespace Ui { class MainWindow; } |
47 | QT_END_NAMESPACE |
48 | |
49 | enum class CompileTarget { |
50 | Invalid, None, File, Project, SyntaxCheck |
51 | }; |
52 | |
53 | enum class RunType { |
54 | Normal, |
55 | CurrentProblemCase, |
56 | ProblemCases |
57 | }; |
58 | |
59 | |
60 | class EditorList; |
61 | class QLabel; |
62 | class QComboBox; |
63 | class CompilerManager; |
64 | class Editor; |
65 | class Debugger; |
66 | class CPUDialog; |
67 | class QPlainTextEdit; |
68 | class SearchDialog; |
69 | class Project; |
70 | class ColorSchemeItem; |
71 | |
72 | #define DPI_CHANGED_EVENT ((QEvent::Type)(QEvent::User+1)) |
73 | |
74 | class MainWindow : public QMainWindow |
75 | { |
76 | Q_OBJECT |
77 | |
78 | enum class CompileSuccessionTaskType { |
79 | None, |
80 | RunNormal, |
81 | RunProblemCases, |
82 | RunCurrentProblemCase, |
83 | Debug, |
84 | Profile |
85 | }; |
86 | |
87 | struct CompileSuccessionTask { |
88 | CompileSuccessionTaskType type; |
89 | QString execName; |
90 | QStringList binDirs; |
91 | }; |
92 | |
93 | using PCompileSuccessionTask = std::shared_ptr<CompileSuccessionTask>; |
94 | |
95 | struct TabWidgetInfo { |
96 | int order; |
97 | QString text; |
98 | QIcon icon; |
99 | }; |
100 | using PTabWidgetInfo = std::shared_ptr<TabWidgetInfo>; |
101 | |
102 | public: |
103 | MainWindow(QWidget *parent = nullptr); |
104 | ~MainWindow(); |
105 | |
106 | void updateForEncodingInfo(bool clear=false); |
107 | void updateStatusbarForLineCol(bool clear=false); |
108 | void updateForStatusbarModeInfo(bool clear=false); |
109 | void updateStatusbarMessage(const QString& s); |
110 | void updateEditorSettings(); |
111 | void updateEditorActions(); |
112 | void updateProjectActions(); |
113 | void updateCompileActions(); |
114 | void updateEditorColorSchemes(); |
115 | void updateCompilerSet(); |
116 | void updateDebuggerSettings(); |
117 | void updateActionIcons(); |
118 | void checkSyntaxInBack(Editor* e); |
119 | bool compile(bool rebuild=false); |
120 | void runExecutable( |
121 | const QString& exeName, |
122 | const QString& filename, |
123 | RunType runType, |
124 | const QStringList& binDirs); |
125 | void runExecutable(RunType runType = RunType::Normal); |
126 | void debug(); |
127 | void showSearchPanel(bool showReplace = false); |
128 | void showCPUInfoDialog(); |
129 | |
130 | void setFilesViewRoot(const QString& path, bool setOpenFolder=false); |
131 | |
132 | void applySettings(); |
133 | void applyUISettings(); |
134 | QFileSystemWatcher* fileSystemWatcher(); |
135 | void initDocks(); |
136 | |
137 | void removeActiveBreakpoints(); |
138 | void updateAppTitle(); |
139 | void addDebugOutput(const QString& text); |
140 | void changeDebugOutputLastline(const QString& text); |
141 | void updateDebugEval(const QString& value); |
142 | void rebuildOpenedFileHisotryMenu(); |
143 | void updateClassBrowserForEditor(Editor* editor); |
144 | void resetAutoSaveTimer(); |
145 | void updateShortcuts(); |
146 | void saveLastOpens(); |
147 | void loadLastOpens(); |
148 | void updateTools(); |
149 | |
150 | void openFiles(const QStringList& files); |
151 | |
152 | void newEditor(); |
153 | |
154 | QPlainTextEdit* txtLocals(); |
155 | |
156 | QMenuBar* menuBar() const; |
157 | |
158 | CPUDialog *cpuDialog() const; |
159 | |
160 | Debugger *debugger() const; |
161 | |
162 | EditorList *editorList() const; |
163 | |
164 | SearchDialog *searchDialog() const; |
165 | |
166 | SearchResultModel* searchResultModel(); |
167 | |
168 | const std::shared_ptr<CodeCompletionPopup> &completionPopup() const; |
169 | |
170 | const std::shared_ptr<HeaderCompletionPopup> &headerCompletionPopup() const; |
171 | |
172 | const std::shared_ptr<FunctionTooltipWidget> &functionTip() const; |
173 | |
174 | CaretList &caretList(); |
175 | void updateCaretActions(); |
176 | |
177 | std::shared_ptr<Project> project(); |
178 | |
179 | const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &statementColors() const; |
180 | |
181 | PSymbolUsageManager &symbolUsageManager(); |
182 | |
183 | PCodeSnippetManager &codeSnippetManager(); |
184 | |
185 | const PTodoParser &todoParser() const; |
186 | |
187 | const PToolsManager &toolsManager() const; |
188 | |
189 | bool shouldRemoveAllSettings() const; |
190 | |
191 | const PBookmarkModel &bookmarkModel() const; |
192 | |
193 | void openFile(const QString& filename, bool activate=true, QTabWidget* page=nullptr); |
194 | void openProject(const QString& filename, bool openFiles = true); |
195 | void changeOptions(const QString& widgetName=QString(), const QString& groupName=QString()); |
196 | |
197 | bool openningFiles() const; |
198 | |
199 | QList<QAction*> listShortCutableActions(); |
200 | |
201 | public slots: |
202 | void logToolsOutput(const QString& msg); |
203 | void onCompileIssue(PCompileIssue issue); |
204 | void clearToolsOutput(); |
205 | void onCompileStarted(); |
206 | void onCompileFinished(bool isCheckSyntax); |
207 | void onCompileErrorOccured(const QString& reason); |
208 | void onRunErrorOccured(const QString& reason); |
209 | void onRunFinished(); |
210 | void onRunPausingForFinish(); |
211 | void onRunProblemFinished(); |
212 | void onOJProblemCaseStarted(const QString& id, int current, int total); |
213 | void onOJProblemCaseFinished(const QString& id, int current, int total); |
214 | void onOJProblemCaseNewOutputGetted(const QString& id, const QString& line); |
215 | void onOJProblemCaseResetOutput(const QString& id, const QString& line); |
216 | void cleanUpCPUDialog(); |
217 | void onDebugCommandInput(const QString& command); |
218 | void onDebugEvaluateInput(); |
219 | void onDebugMemoryAddressInput(); |
220 | void onParserProgress(const QString& fileName, int total, int current); |
221 | void onStartParsing(); |
222 | void onEndParsing(int total, int updateView); |
223 | void onEvalValueReady(const QString& value); |
224 | void onLocalsReady(const QStringList& value); |
225 | void onEditorContextMenu(const QPoint& pos); |
226 | void onEditorRightTabContextMenu(const QPoint& pos); |
227 | void onEditorLeftTabContextMenu(const QPoint& pos); |
228 | void onEditorTabContextMenu(QTabWidget* tabWidget, const QPoint& pos); |
229 | void disableDebugActions(); |
230 | void enableDebugActions(); |
231 | void onTodoParseStarted(const QString& filename); |
232 | void onTodoParsing(const QString& filename, int lineNo, int ch, const QString& line); |
233 | void onTodoParseFinished(); |
234 | void setActiveBreakpoint(QString FileName, int Line, bool setFocus); |
235 | void updateDPI(int oldDPI, int newDPI); |
236 | void onFileSaved(const QString& path, bool inProject); |
237 | |
238 | private: |
239 | void prepareProjectForCompile(); |
240 | void closeProject(bool refreshEditor); |
241 | void updateProjectView(); |
242 | CompileTarget getCompileTarget(); |
243 | bool debugInferiorhasBreakpoint(); |
244 | void stretchMessagesPanel(bool open); |
245 | void stretchExplorerPanel(bool open); |
246 | void prepareDebugger(); |
247 | void doAutoSave(Editor *e); |
248 | void buildContextMenus(); |
249 | void buildEncodingMenu(); |
250 | void maximizeEditor(); |
251 | QStringList getBinDirsForCurrentEditor(); |
252 | QStringList getDefaultCompilerSetBinDirs(); |
253 | void openShell(const QString& folder, const QString& shellCommand, const QStringList& binDirs); |
254 | QAction* createActionFor(const QString& text, |
255 | QWidget* parent, |
256 | QKeySequence shortcut=QKeySequence()); |
257 | void scanActiveProject(bool parse=false); |
258 | void includeOrSkipDirs(const QStringList& dirs, bool skip); |
259 | void showSearchReplacePanel(bool show); |
260 | void clearIssues(); |
261 | void doCompileRun(RunType runType); |
262 | void updateProblemCaseOutput(POJProblemCase problemCase); |
263 | void applyCurrentProblemCaseChanges(); |
264 | void showHideInfosTab(QWidget *widget, bool show); |
265 | void showHideMessagesTab(QWidget *widget, bool show); |
266 | void prepareTabInfosData(); |
267 | void prepareTabMessagesData(); |
268 | void newProjectUnitFile(); |
269 | void fillProblemCaseInputAndExpected(const POJProblemCase &problemCase); |
270 | |
271 | void doFilesViewRemoveFile(const QModelIndex& index); |
272 | |
273 | private slots: |
274 | void setDockExplorerToArea(const Qt::DockWidgetArea &area); |
275 | void setDockMessagesToArea(const Qt::DockWidgetArea &area); |
276 | void updateVCSActions(); |
277 | void invalidateProjectProxyModel(); |
278 | void onEditorRenamed(const QString& oldFilename, const QString& newFilename, bool firstSave); |
279 | void onAutoSaveTimeout(); |
280 | void onFileChanged(const QString& path); |
281 | void onFilesViewPathChanged(); |
282 | void onWatchViewContextMenu(const QPoint& pos); |
283 | void onBookmarkContextMenu(const QPoint& pos); |
284 | void onTableIssuesContextMenu(const QPoint& pos); |
285 | void onSearchViewContextMenu(const QPoint& pos); |
286 | void onBreakpointsViewContextMenu(const QPoint& pos); |
287 | void onProjectViewContextMenu(const QPoint& pos); |
288 | void onClassBrowserContextMenu(const QPoint& pos); |
289 | void onDebugConsoleContextMenu(const QPoint& pos); |
290 | void onFileEncodingContextMenu(const QPoint& pos); |
291 | void onFilesViewContextMenu(const QPoint& pos); |
292 | void onLstProblemSetContextMenu(const QPoint& pos); |
293 | void onTableProblemCasesContextMenu(const QPoint& pos); |
294 | void onToolsOutputContextMenu(const QPoint&pos); |
295 | |
296 | void onProblemSetIndexChanged(const QModelIndex ¤t, const QModelIndex &previous); |
297 | void onProblemCaseIndexChanged(const QModelIndex ¤t, const QModelIndex &previous); |
298 | void onProblemNameChanged(int index); |
299 | void onProblemRunCurrentCase(); |
300 | void onProblemBatchSetCases(); |
301 | void onNewProblemConnection(); |
302 | void updateProblemTitle(); |
303 | void onEditorClosed(); |
304 | void onToolsOutputClear(); |
305 | void onToolsOutputCopy(); |
306 | void onToolsOutputSelectAll(); |
307 | |
308 | void onShowInsertCodeSnippetMenu(); |
309 | |
310 | void onFilesViewCreateFolder(); |
311 | void onFilesViewCreateFile(); |
312 | void onFilesViewRemoveFiles(); |
313 | void onFilesViewRename(); |
314 | void onProblemProperties(); |
315 | void onProblemOpenSource(); |
316 | void onLableProblemSetContextMenuRequested(); |
317 | void onBookmarkRemove(); |
318 | void onBookmarkRemoveAll(); |
319 | void onBookmarkModify(); |
320 | void onDebugConsoleShowDetailLog(); |
321 | void onDebugConsolePaste(); |
322 | void onDebugConsoleSelectAll(); |
323 | void onDebugConsoleCopy(); |
324 | void onDebugConsoleClear(); |
325 | void onFilesViewOpenInExplorer(); |
326 | void onFilesViewOpenInTerminal(); |
327 | void onFilesViewOpenWithExternal(); |
328 | void onFilesViewOpen(); |
329 | void onClassBrowserGotoDeclaration(); |
330 | void onClassBrowserGotoDefinition(); |
331 | void onClassBrowserShowInherited(); |
332 | void onClassBrowserSortByType(); |
333 | void onClassBrowserSortByName(); |
334 | void onProjectSwitchCustomViewMode(); |
335 | void onProjectSwitchFileSystemViewMode(); |
336 | void onProjectRemoveFolder(); |
337 | void onProjectRenameFolder(); |
338 | void onProjectAddFolder(); |
339 | void onProjectRenameUnit(); |
340 | void onBreakpointRemove(); |
341 | void onBreakpointViewRemoveAll(); |
342 | void onBreakpointViewProperty(); |
343 | void onSearchViewClearAll(); |
344 | void onSearchViewClear(); |
345 | void onTableIssuesClear(); |
346 | void onTableIssuesCopyAll(); |
347 | void onTableIssuesCopy(); |
348 | |
349 | void on_actionNew_triggered(); |
350 | |
351 | void on_EditorTabsLeft_tabCloseRequested(int index); |
352 | void on_EditorTabsRight_tabCloseRequested(int index); |
353 | |
354 | void onFileSystemModelLayoutChanged(); |
355 | |
356 | void on_actionOpen_triggered(); |
357 | |
358 | void on_actionSave_triggered(); |
359 | |
360 | void on_actionSaveAs_triggered(); |
361 | |
362 | void on_actionOptions_triggered(); |
363 | |
364 | // qt will auto bind slots with the prefix "on_" |
365 | void onCompilerSetChanged(int index); |
366 | |
367 | void on_actionCompile_triggered(); |
368 | |
369 | void on_actionRun_triggered(); |
370 | |
371 | void on_actionUndo_triggered(); |
372 | |
373 | void on_actionRedo_triggered(); |
374 | |
375 | void on_actionCut_triggered(); |
376 | |
377 | void on_actionSelectAll_triggered(); |
378 | |
379 | void on_actionCopy_triggered(); |
380 | |
381 | void on_actionPaste_triggered(); |
382 | |
383 | void on_actionIndent_triggered(); |
384 | |
385 | void on_actionUnIndent_triggered(); |
386 | |
387 | void on_actionToggleComment_triggered(); |
388 | |
389 | void on_actionUnfoldAll_triggered(); |
390 | |
391 | void on_actionFoldAll_triggered(); |
392 | |
393 | void on_tableIssues_doubleClicked(const QModelIndex &index); |
394 | |
395 | void on_actionEncode_in_ANSI_triggered(); |
396 | |
397 | void on_actionEncode_in_UTF_8_triggered(); |
398 | |
399 | void on_actionAuto_Detect_triggered(); |
400 | |
401 | void on_actionConvert_to_ANSI_triggered(); |
402 | |
403 | void on_actionConvert_to_UTF_8_triggered(); |
404 | |
405 | void on_tabMessages_tabBarClicked(int index); |
406 | |
407 | void on_actionCompile_Run_triggered(); |
408 | |
409 | void on_actionRebuild_triggered(); |
410 | |
411 | void on_actionStop_Execution_triggered(); |
412 | |
413 | void on_actionDebug_triggered(); |
414 | |
415 | void on_actionStep_Over_triggered(); |
416 | |
417 | void on_actionStep_Into_triggered(); |
418 | |
419 | void on_actionStep_Out_triggered(); |
420 | |
421 | void on_actionRun_To_Cursor_triggered(); |
422 | |
423 | void on_actionContinue_triggered(); |
424 | |
425 | void on_actionAdd_Watch_triggered(); |
426 | |
427 | void on_actionView_CPU_Window_triggered(); |
428 | |
429 | void on_actionExit_triggered(); |
430 | |
431 | void on_actionFind_triggered(); |
432 | |
433 | void on_actionFind_in_files_triggered(); |
434 | |
435 | void on_actionReplace_triggered(); |
436 | |
437 | void on_actionFind_Next_triggered(); |
438 | |
439 | void on_actionFind_Previous_triggered(); |
440 | |
441 | void on_cbSearchHistory_currentIndexChanged(int index); |
442 | |
443 | void on_btnSearchAgain_clicked(); |
444 | void on_actionRemove_Watch_triggered(); |
445 | |
446 | void on_actionRemove_All_Watches_triggered(); |
447 | |
448 | void on_actionModify_Watch_triggered(); |
449 | |
450 | void on_actionReformat_Code_triggered(); |
451 | |
452 | void on_actionBack_triggered(); |
453 | |
454 | void on_actionForward_triggered(); |
455 | |
456 | void on_tabExplorer_tabBarClicked(int index); |
457 | |
458 | void on_EditorTabsLeft_tabBarDoubleClicked(int index); |
459 | void on_EditorTabsRight_tabBarDoubleClicked(int index); |
460 | |
461 | void on_actionClose_triggered(); |
462 | |
463 | void on_actionClose_All_triggered(); |
464 | |
465 | void on_actionMaximize_Editor_triggered(); |
466 | |
467 | void on_actionNext_Editor_triggered(); |
468 | |
469 | void on_actionPrevious_Editor_triggered(); |
470 | |
471 | void on_actionToggle_Breakpoint_triggered(); |
472 | |
473 | void on_actionClear_all_breakpoints_triggered(); |
474 | |
475 | void on_actionBreakpoint_property_triggered(); |
476 | |
477 | void on_actionGoto_Declaration_triggered(); |
478 | |
479 | void on_actionGoto_Definition_triggered(); |
480 | |
481 | void on_actionFind_references_triggered(); |
482 | |
483 | void on_actionOpen_Containing_Folder_triggered(); |
484 | |
485 | void on_actionOpen_Terminal_triggered(); |
486 | |
487 | void on_actionFile_Properties_triggered(); |
488 | |
489 | void on_searchView_doubleClicked(const QModelIndex &index); |
490 | |
491 | void on_tblStackTrace_doubleClicked(const QModelIndex &index); |
492 | |
493 | void on_tblBreakpoints_doubleClicked(const QModelIndex &index); |
494 | |
495 | void on_projectView_doubleClicked(const QModelIndex &index); |
496 | |
497 | void on_actionClose_Project_triggered(); |
498 | |
499 | void on_actionProject_options_triggered(); |
500 | |
501 | void on_actionNew_Project_triggered(); |
502 | |
503 | void on_actionSaveAll_triggered(); |
504 | |
505 | void on_actionProject_New_File_triggered(); |
506 | |
507 | void on_actionAdd_to_project_triggered(); |
508 | |
509 | void on_actionRemove_from_project_triggered(); |
510 | |
511 | void on_actionView_Makefile_triggered(); |
512 | |
513 | void on_actionMakeClean_triggered(); |
514 | |
515 | void on_actionProject_Open_Folder_In_Explorer_triggered(); |
516 | |
517 | void on_actionProject_Open_In_Terminal_triggered(); |
518 | |
519 | void on_classBrowser_doubleClicked(const QModelIndex &index); |
520 | |
521 | void on_EditorTabsLeft_currentChanged(int index); |
522 | void on_EditorTabsRight_currentChanged(int index); |
523 | |
524 | void on_tableTODO_doubleClicked(const QModelIndex &index); |
525 | |
526 | void on_actionAbout_triggered(); |
527 | |
528 | void on_actionRename_Symbol_triggered(); |
529 | |
530 | void on_btnReplace_clicked(); |
531 | |
532 | void on_btnCancelReplace_clicked(); |
533 | |
534 | void on_actionPrint_triggered(); |
535 | |
536 | void on_actionExport_As_RTF_triggered(); |
537 | |
538 | void on_actionExport_As_HTML_triggered(); |
539 | |
540 | void on_actionMove_To_Other_View_triggered(); |
541 | |
542 | void on_actionC_C_Reference_triggered(); |
543 | |
544 | void on_actionEGE_Manual_triggered(); |
545 | |
546 | void on_actionAdd_bookmark_triggered(); |
547 | |
548 | void on_actionRemove_Bookmark_triggered(); |
549 | |
550 | void on_tableBookmark_doubleClicked(const QModelIndex &index); |
551 | |
552 | void on_actionModify_Bookmark_Description_triggered(); |
553 | |
554 | void on_actionLocate_in_Files_View_triggered(); |
555 | |
556 | void on_treeFiles_doubleClicked(const QModelIndex &index); |
557 | |
558 | void on_actionOpen_Folder_triggered(); |
559 | |
560 | void on_actionRun_Parameters_triggered(); |
561 | |
562 | void on_btnNewProblemSet_clicked(); |
563 | |
564 | void on_btnAddProblem_clicked(); |
565 | |
566 | void on_btnRemoveProblem_clicked(); |
567 | |
568 | void on_btnSaveProblemSet_clicked(); |
569 | |
570 | void on_btnLoadProblemSet_clicked(); |
571 | |
572 | void on_btnAddProblemCase_clicked(); |
573 | |
574 | void on_btnRunAllProblemCases_clicked(); |
575 | |
576 | void on_actionC_Reference_triggered(); |
577 | |
578 | void on_btnRemoveProblemCase_clicked(); |
579 | |
580 | void on_btnOpenProblemAnswer_clicked(); |
581 | |
582 | void on_actionTool_Window_Bars_triggered(); |
583 | |
584 | void on_actionStatus_Bar_triggered(); |
585 | |
586 | void on_actionProject_triggered(); |
587 | |
588 | void on_actionWatch_triggered(); |
589 | |
590 | void on_actionStructure_triggered(); |
591 | |
592 | void on_actionFiles_triggered(); |
593 | |
594 | void on_actionProblem_Set_triggered(); |
595 | |
596 | void on_actionIssues_triggered(); |
597 | |
598 | void on_actionTools_Output_triggered(); |
599 | |
600 | void on_actionDebug_Window_triggered(); |
601 | |
602 | void on_actionSearch_triggered(); |
603 | |
604 | void on_actionTODO_triggered(); |
605 | |
606 | void on_actionBookmark_triggered(); |
607 | |
608 | void on_actionProblem_triggered(); |
609 | |
610 | void on_actionDelete_Line_triggered(); |
611 | |
612 | void on_actionDuplicate_Line_triggered(); |
613 | |
614 | void on_actionDelete_Word_triggered(); |
615 | |
616 | void on_actionDelete_to_EOL_triggered(); |
617 | |
618 | void on_actionDelete_to_BOL_triggered(); |
619 | |
620 | void on_btnCaseValidateOptions_clicked(); |
621 | |
622 | void on_actionInterrupt_triggered(); |
623 | |
624 | void on_actionDelete_Last_Word_triggered(); |
625 | |
626 | void on_actionDelete_to_Word_End_triggered(); |
627 | |
628 | void on_actionNew_Class_triggered(); |
629 | |
630 | void on_actionNew_Header_triggered(); |
631 | |
632 | void on_actionGit_Create_Repository_triggered(); |
633 | |
634 | void on_actionGit_Add_Files_triggered(); |
635 | |
636 | void on_actionGit_Commit_triggered(); |
637 | |
638 | void on_actionGit_Restore_triggered(); |
639 | |
640 | void on_actionWebsite_triggered(); |
641 | |
642 | void on_actionGit_Branch_triggered(); |
643 | |
644 | void on_actionGit_Merge_triggered(); |
645 | |
646 | void on_actionGit_Log_triggered(); |
647 | |
648 | void on_actionGit_Remotes_triggered(); |
649 | |
650 | void on_actionGit_Fetch_triggered(); |
651 | |
652 | void on_actionGit_Pull_triggered(); |
653 | |
654 | void on_actionGit_Push_triggered(); |
655 | |
656 | void on_actionFilesView_Hide_Non_Support_Files_toggled(bool arg1); |
657 | |
658 | void on_actionToggle_Block_Comment_triggered(); |
659 | |
660 | void on_actionMatch_Bracket_triggered(); |
661 | |
662 | void on_btnProblemCaseInputFileName_clicked(); |
663 | |
664 | void on_btnProblemCaseClearExpectedOutputFileName_clicked(); |
665 | |
666 | void on_btnProblemCaseClearInputFileName_clicked(); |
667 | |
668 | void on_btnProblemCaseExpectedOutputFileName_clicked(); |
669 | |
670 | void on_txtProblemCaseOutput_cursorPositionChanged(); |
671 | |
672 | void on_txtProblemCaseExpected_cursorPositionChanged(); |
673 | |
674 | void on_txtProblemCaseInput_cursorPositionChanged(); |
675 | |
676 | void on_actionMove_Selection_Up_triggered(); |
677 | |
678 | void on_actionMove_Selection_Down_triggered(); |
679 | |
680 | void on_actionConvert_to_UTF_8_BOM_triggered(); |
681 | |
682 | void on_actionEncode_in_UTF_8_BOM_triggered(); |
683 | |
684 | void on_actionCompiler_Options_triggered(); |
685 | |
686 | void on_dockExplorer_dockLocationChanged(const Qt::DockWidgetArea &area); |
687 | |
688 | void on_dockMessages_dockLocationChanged(const Qt::DockWidgetArea &area); |
689 | |
690 | void on_actionToggle_Explorer_Panel_triggered(); |
691 | |
692 | void on_actionToggle_Messages_Panel_triggered(); |
693 | |
694 | void on_chkIgnoreSpaces_stateChanged(int arg1); |
695 | |
696 | void on_actionRaylib_Manual_triggered(); |
697 | |
698 | void on_actionSelect_Word_triggered(); |
699 | |
700 | void on_actionGo_to_Line_triggered(); |
701 | |
702 | void on_actionNew_Template_triggered(); |
703 | |
704 | private: |
705 | Ui::MainWindow *ui; |
706 | EditorList *mEditorList; |
707 | QLabel *mFileInfoStatus; |
708 | LabelWithMenu *mFileEncodingStatus; |
709 | QLabel *mFileModeStatus; |
710 | QMenu *mMenuEncoding; |
711 | QMenu *mMenuExport; |
712 | QMenu *mMenuEncodingList; |
713 | QMenu *mMenuRecentFiles; |
714 | QMenu *mMenuRecentProjects; |
715 | QMenu *mMenuNew; |
716 | QMenu *mMenuInsertCodeSnippet; |
717 | QComboBox *mCompilerSet; |
718 | CompilerManager *mCompilerManager; |
719 | Debugger *mDebugger; |
720 | CPUDialog *mCPUDialog; |
721 | SearchDialog *mSearchDialog; |
722 | bool mQuitting; |
723 | QElapsedTimer mParserTimer; |
724 | QFileSystemWatcher mFileSystemWatcher; |
725 | std::shared_ptr<Project> mProject; |
726 | Qt::DockWidgetArea mMessagesDockLocation; |
727 | |
728 | std::shared_ptr<CodeCompletionPopup> mCompletionPopup; |
729 | std::shared_ptr<HeaderCompletionPopup> mHeaderCompletionPopup; |
730 | std::shared_ptr<FunctionTooltipWidget> mFunctionTip; |
731 | |
732 | TodoModel mTodoModel; |
733 | SearchResultModel mSearchResultModel; |
734 | PBookmarkModel mBookmarkModel; |
735 | PSearchResultListModel mSearchResultListModel; |
736 | PSearchResultTreeModel mSearchResultTreeModel; |
737 | PSearchResultTreeViewDelegate mSearchViewDelegate; |
738 | ClassBrowserModel mClassBrowserModel; |
739 | std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mStatementColors; |
740 | PSymbolUsageManager mSymbolUsageManager; |
741 | PCodeSnippetManager mCodeSnippetManager; |
742 | PTodoParser mTodoParser; |
743 | PToolsManager mToolsManager; |
744 | CustomFileSystemModel mFileSystemModel; |
745 | CustomFileIconProvider mFileSystemModelIconProvider; |
746 | OJProblemSetModel mOJProblemSetModel; |
747 | OJProblemModel mOJProblemModel; |
748 | int mOJProblemSetNameCounter; |
749 | |
750 | bool mCheckSyntaxInBack; |
751 | bool mShouldRemoveAllSettings; |
752 | PCompileSuccessionTask mCompileSuccessionTask; |
753 | |
754 | QMap<QWidget*, PTabWidgetInfo> mTabInfosData; |
755 | QMap<QWidget*, PTabWidgetInfo> mTabMessagesData; |
756 | |
757 | QTimer mAutoSaveTimer; |
758 | |
759 | CaretList mCaretList; |
760 | |
761 | bool mClosing; |
762 | bool mClosingAll; |
763 | bool mOpenningFiles; |
764 | bool mSystemTurnedOff; |
765 | QPoint mEditorContextMenuPos; |
766 | QTcpServer mTcpServer; |
767 | QColor mErrorColor; |
768 | |
769 | QSet<QString> mFilesChangedNotifying; |
770 | |
771 | //actions for compile issue table |
772 | QAction * mTableIssuesCopyAction; |
773 | QAction * mTableIssuesCopyAllAction; |
774 | QAction * mTableIssuesClearAction; |
775 | |
776 | //actions for search result view |
777 | QAction * mSearchViewClearAction; |
778 | QAction * mSearchViewClearAllAction; |
779 | |
780 | //actions for breakpoint view |
781 | QAction * mBreakpointViewPropertyAction; |
782 | QAction * mBreakpointViewRemoveAllAction; |
783 | QAction * mBreakpointViewRemoveAction; |
784 | |
785 | //actions for project view |
786 | QAction * mProject_Add_Folder; |
787 | QAction * mProject_Rename_Unit; |
788 | QAction * mProject_Rename_Folder; |
789 | QAction * mProject_Remove_Folder; |
790 | QAction * mProject_SwitchFileSystemViewMode; |
791 | QAction * mProject_SwitchCustomViewMode; |
792 | |
793 | //actions for class browser |
794 | QAction * mClassBrowser_Sort_By_Type; |
795 | QAction * mClassBrowser_Sort_By_Name; |
796 | QAction * mClassBrowser_Show_Inherited; |
797 | QAction * mClassBrowser_goto_declaration; |
798 | QAction * mClassBrowser_goto_definition; |
799 | QWidget * mClassBrowserToolbar; |
800 | |
801 | //actions for files view |
802 | QAction * mFilesView_Open; |
803 | QAction * mFilesView_OpenWithExternal; |
804 | QAction * mFilesView_OpenInTerminal; |
805 | QAction * mFilesView_OpenInExplorer; |
806 | QAction * mFilesView_CreateFolder; |
807 | QAction * mFilesView_CreateFile; |
808 | QAction * mFilesView_RemoveFile; |
809 | QAction * mFilesView_Rename; |
810 | |
811 | //action for debug console |
812 | QAction * mDebugConsole_ShowDetailLog; |
813 | QAction * mDebugConsole_Clear; |
814 | QAction * mDebugConsole_Copy; |
815 | QAction * mDebugConsole_Paste; |
816 | QAction * mDebugConsole_SelectAll; |
817 | //action for bookmarks |
818 | QAction * mBookmark_Remove; |
819 | QAction * mBookmark_RemoveAll; |
820 | QAction * mBookmark_Modify; |
821 | |
822 | //action for problem set |
823 | QAction * mProblem_OpenSource; |
824 | QAction * mProblem_Properties; |
825 | |
826 | //action for problem |
827 | QAction * mProblem_RunCurrentCase; |
828 | QAction * mProblem_RunAllCases; |
829 | QAction * mProblem_batchSetCases; |
830 | |
831 | //action for tools output |
832 | QAction * mToolsOutput_Clear; |
833 | QAction * mToolsOutput_SelectAll; |
834 | QAction * mToolsOutput_Copy; |
835 | |
836 | QSortFilterProxyModel* mProjectProxyModel; |
837 | |
838 | // QWidget interface |
839 | protected: |
840 | void closeEvent(QCloseEvent *event) override; |
841 | void showEvent(QShowEvent* event) override; |
842 | void hideEvent(QHideEvent *event) override; |
843 | |
844 | |
845 | // QObject interface |
846 | public: |
847 | bool event(QEvent *event) override; |
848 | bool isClosingAll() const; |
849 | bool isQuitting() const; |
850 | }; |
851 | |
852 | extern MainWindow* pMainWindow; |
853 | #endif // MAINWINDOW_H |
854 | |