SGL
gdiffgui.h
1 /*
2  * File: gdiffgui.h
3  * ----------------
4  *
5  * @author Marty Stepp
6  * @version 2021/04/09
7  * - added sgl namespace
8  * @version 2018/10/06
9  * - allow passing diff flags
10  * @version 2018/09/07
11  * - added doc comments for new documentation generation
12  * @version 2018/08/23
13  * - renamed to gdiffgui.h to replace Java version
14  * @version 2018/07/31
15  * - initial version
16  */
17 
18 
19 #ifndef _gdiffgui_h
20 #define _gdiffgui_h
21 
22 #include <string>
23 #include <QWidget>
24 #include <QSplitter>
25 
26 #include "ginteractor.h"
27 #include "gtextarea.h"
28 #include "gwindow.h"
29 #include "privatediff.h"
30 
31 namespace sgl {
32 
41 class GDiffGui {
42 public:
43  static const string COLOR_EXPECTED;
44  static const string COLOR_EXPECTED_DARK_MODE;
45  static const string COLOR_LINE_NUMBERS;
46  static const string COLOR_LINE_NUMBERS_DARK_MODE;
47  static const string COLOR_STUDENT;
48  static const string COLOR_STUDENT_DARK_MODE;
49 
53  static void showDialog(const string& name1,
54  const string& text1,
55  const string& name2,
56  const string& text2,
57  int diffFlags = ::sgl::priv::diff::DIFF_DEFAULT_FLAGS,
58  bool showCheckBoxes = false);
59 
60 private:
61  static const bool LINE_NUMBERS;
62 
63  GDiffGui(const string& name1,
64  const string& text1,
65  const string& name2,
66  const string& text2,
67  int diffFlags = ::sgl::priv::diff::DIFF_DEFAULT_FLAGS,
68  bool showCheckBoxes = false); // forbid construction
69  virtual ~GDiffGui();
70 
71  Q_DISABLE_COPY(GDiffGui)
72 
73  void setupDiffText(const string& diffs);
74  void setupLeftRightText(GTextArea* textArea, const string& text);
75  void syncScrollBars(bool left);
76 
77  GWindow* _window;
78  QSplitter* _hsplitter;
79  QSplitter* _vsplitter;
80  GTextArea* _textAreaLeft;
81  GTextArea* _textAreaRight;
82  GTextArea* _textAreaBottom;
83  GGenericInteractor<QSplitter>* _hsplitterInteractor;
84  GGenericInteractor<QSplitter>* _vsplitterInteractor;
85 };
86 
87 } // namespace sgl
88 
89 #endif // _gdiffgui_h
Definition: console.h:45