1#include "ParameterApp.h"
4#include "RabbitCommonDir.h"
9CParameterApp::CParameterApp(QObject *parent) :
CParameter(parent,
"MainWindow"),
10 m_bReceiveShortCut(false),
11 m_bSaveMainWindowStatus(true),
12 m_ViewType(ViewType::Tab),
13 m_TabPosition(QTabWidget::North),
14 m_bEnableTabToolTip(true),
15 m_bEnableTabIcon(true),
17 m_nRecentMenuMaxCount(10),
18 m_SystemTrayIconType(SystemTrayIconMenuType::MenuBar),
19 m_bEnableSystemTrayIcon(true),
20 m_bOpenLasterClose(false),
21 m_bFavoriteEdit(false),
25 m_bMessageBoxDisplayInfomation(true),
26 m_bDockListActiveShowToolBar(true),
27 m_bDockListRecentShowToolBar(true),
28 m_bKeepSplitViewWhenFullScreen(false),
33CParameterApp::~CParameterApp()
37int CParameterApp::OnLoad(QSettings &set)
39 SetReceiveShortCut(set.value(
"ReceiveShortCurt",
40 GetReceiveShortCut()).toBool());
42 set.beginGroup(
"Status");
43 SetSaveMainWindowStatus(set.value(
"Enable",
44 GetSaveMainWindowStatus()).toBool());
45 if(GetSaveMainWindowStatus()) {
46 SetStatusBar(set.value(
"StatusBar",
47 GetStatusBar()).toBool());
48 SetTabBar(set.value(
"TabBar",
49 GetTabBar()).toBool());
50 SetMenuBar(set.value(
"MenuBar",
51 GetMenuBar()).toBool());
55 set.beginGroup(
"View");
56 int viewType = set.value(
"Type").toInt();
57 SetViewType((ViewType)viewType);
58 SetTabPosition(
static_cast<QTabWidget::TabPosition
>(
59 set.value(
"TabView/Tab/Position",
60 GetTabPosition()).toInt()));
61 SetEnableTabToolTip(set.value(
"TabView/Tab/Enable/ToolTip",
62 GetEnableTabToolTip()).toBool());
63 SetEnableTabIcon(set.value(
"TabView/Tab/Enable/Icon",
64 GetEnableTabIcon()).toBool());
65 SetTabElided(set.value(
"TabView/Tab/Enable/Elided", GetTabElided()).toBool());
68 SetRecentMenuMaxCount(set.value(
"Recent/Max",
69 GetRecentMenuMaxCount()).toInt());
71 set.beginGroup(
"SystemTrayIcon");
73 SetEnableSystemTrayIcon(set.value(
"Enable",
74 GetEnableSystemTrayIcon()).toBool());
75 SetSystemTrayIconMenuType(
static_cast<SystemTrayIconMenuType
>(
77 static_cast<int>(GetSystemTrayIconMenuType())).toInt()));
80 SetOpenLasterClose(set.value(
"OpenLasterClose",
81 GetOpenLasterClose()).toBool());
82 SetFavoriteEdit(set.value(
"Favorite/Double/Edit",
83 GetFavoriteEdit()).toBool());
85 SetMessageBoxDisplayInformation(
86 set.value(
"MessageBoxDisplayInformation",
87 GetMessageBoxDisplayInformation()).toBool());
89 set.beginGroup(
"Dock");
90 SetDockListActiveShowToolBar(
91 set.value(
"ListActive/ToolBar/Show",
92 GetDockListActiveShowToolBar()).toBool());
94 SetDockListRecentShowToolBar(
95 set.value(
"Recent/ToolBar/Show",
96 GetDockListRecentShowToolBar()).toBool());
98 SetKeepSplitViewWhenFullScreen(
99 set.value(
"KeepSplitViewWhenFullScreen",
100 GetKeepSplitViewWhenFullScreen()).toBool());
102 SetStartByType(set.value(
"Menu/StartByType", GetStartByType()).toBool());
112int CParameterApp::OnSave(QSettings &set)
114 set.setValue(
"ReceiveShortCurt", GetReceiveShortCut());
116 set.beginGroup(
"Status");
117 set.setValue(
"Enable", GetSaveMainWindowStatus());
118 if(GetSaveMainWindowStatus())
120 set.setValue(
"StatusBar", GetStatusBar());
121 set.setValue(
"TabBar", GetTabBar());
122 set.setValue(
"MenuBar", GetMenuBar());
127 set.beginGroup(
"View");
128 set.setValue(
"Type", (
int)GetViewType());
129 set.setValue(
"TabView/Tab/Position", GetTabPosition());
130 set.setValue(
"TabView/Tab/Enable/ToolTip", GetEnableTabToolTip());
131 set.setValue(
"TabView/Tab/Enable/Icon", GetEnableTabIcon());
132 set.setValue(
"TabView/Tab/Enable/Elided", GetTabElided());
135 set.setValue(
"Recent/Max", GetRecentMenuMaxCount());
137 set.beginGroup(
"SystemTrayIcon");
138 set.setValue(
"Enable", GetEnableSystemTrayIcon());
139 set.setValue(
"MenuType",
140 static_cast<int>(GetSystemTrayIconMenuType()));
143 set.setValue(
"OpenLasterClose", GetOpenLasterClose());
144 set.setValue(
"Favorite/Double/Edit", GetFavoriteEdit());
145 set.setValue(
"MessageBoxDisplayInformation",
146 GetMessageBoxDisplayInformation());
148 set.beginGroup(
"Dock");
149 set.setValue(
"ListActive/ToolBar/Show",
150 GetDockListActiveShowToolBar());
151 set.setValue(
"Recent/ToolBar/Show",
152 GetDockListRecentShowToolBar());
154 set.setValue(
"KeepSplitViewWhenFullScreen",
155 GetKeepSplitViewWhenFullScreen());
157 set.setValue(
"Menu/StartByType", GetStartByType());
167bool CParameterApp::GetReceiveShortCut()
const
169 return m_bReceiveShortCut;
172void CParameterApp::SetReceiveShortCut(
bool newReceiveShortCut)
174 if (m_bReceiveShortCut == newReceiveShortCut)
176 m_bReceiveShortCut = newReceiveShortCut;
178 emit sigReceiveShortCutChanged();
181bool CParameterApp::GetSaveMainWindowStatus()
const
183 return m_bSaveMainWindowStatus;
186void CParameterApp::SetSaveMainWindowStatus(
bool newSaveMainWindowStatus)
188 if (m_bSaveMainWindowStatus == newSaveMainWindowStatus)
190 m_bSaveMainWindowStatus = newSaveMainWindowStatus;
192 emit sigSaveMainWindowStatusChanged();
195CParameterApp::ViewType CParameterApp::GetViewType()
200int CParameterApp::SetViewType(ViewType type)
202 if(m_ViewType == type)
206 emit sigViewTypeChanged();
210const QTabWidget::TabPosition &CParameterApp::GetTabPosition()
const
212 return m_TabPosition;
215void CParameterApp::SetTabPosition(
const QTabWidget::TabPosition &newTabPosition)
217 if (m_TabPosition == newTabPosition)
219 m_TabPosition = newTabPosition;
221 emit sigTabPositionChanged();
224const bool CParameterApp::GetEnableTabToolTip()
const
226 return m_bEnableTabToolTip;
229void CParameterApp::SetEnableTabToolTip(
bool bEnable)
231 if(m_bEnableTabToolTip == bEnable)
233 m_bEnableTabToolTip = bEnable;
235 emit sigEnableTabToolTipChanged();
238const bool CParameterApp::GetEnableTabIcon()
const
240 return m_bEnableTabIcon;
243void CParameterApp::SetEnableTabIcon(
bool bEnable)
245 if(m_bEnableTabIcon == bEnable)
247 m_bEnableTabIcon = bEnable;
249 emit sigEnableTabIconChanged();
252const bool CParameterApp::GetTabElided()
const
257void CParameterApp::SetTabElided(
bool bElided)
259 if(m_bTabElided == bElided)
261 m_bTabElided = bElided;
266int CParameterApp::GetRecentMenuMaxCount()
const
268 return m_nRecentMenuMaxCount;
271void CParameterApp::SetRecentMenuMaxCount(
int newRecentMenuMaxCount)
273 if (m_nRecentMenuMaxCount == newRecentMenuMaxCount)
275 m_nRecentMenuMaxCount = newRecentMenuMaxCount;
277 emit sigRecentMenuMaxCountChanged(m_nRecentMenuMaxCount);
280CParameterApp::SystemTrayIconMenuType CParameterApp::GetSystemTrayIconMenuType()
const
282 return m_SystemTrayIconType;
285void CParameterApp::SetSystemTrayIconMenuType(SystemTrayIconMenuType newSystemTrayIconType)
287 if(m_SystemTrayIconType == newSystemTrayIconType)
289 m_SystemTrayIconType = newSystemTrayIconType;
291 emit sigSystemTrayIconTypeChanged();
294bool CParameterApp::GetEnableSystemTrayIcon()
const
296 return m_bEnableSystemTrayIcon;
299int CParameterApp::SetEnableSystemTrayIcon(
bool bShow)
301 if(m_bEnableSystemTrayIcon == bShow)
303 m_bEnableSystemTrayIcon = bShow;
305 emit sigEnableSystemTrayIcon();
309bool CParameterApp::GetOpenLasterClose()
const
311 return m_bOpenLasterClose;
314void CParameterApp::SetOpenLasterClose(
bool newOpenLasterClose)
316 if (m_bOpenLasterClose == newOpenLasterClose)
318 m_bOpenLasterClose = newOpenLasterClose;
320 emit sigOpenLasterCloseChanged(m_bOpenLasterClose);
323bool CParameterApp::GetFavoriteEdit()
const
325 return m_bFavoriteEdit;
328void CParameterApp::SetFavoriteEdit(
bool newFavoriteEdit)
330 if(m_bFavoriteEdit == newFavoriteEdit)
332 m_bFavoriteEdit = newFavoriteEdit;
334 emit sigFavoriteEditChanged(m_bFavoriteEdit);
337bool CParameterApp::GetStatusBar()
const
342void CParameterApp::SetStatusBar(
bool checked)
344 if(m_bStatusBar == checked)
346 m_bStatusBar = checked;
350bool CParameterApp::GetTabBar()
const
355void CParameterApp::SetTabBar(
bool checked)
357 if(m_bTabBar == checked)
363bool CParameterApp::GetMenuBar()
const
368void CParameterApp::SetMenuBar(
bool checked)
370 if(m_bMenuBar == checked)
372 m_bMenuBar = checked;
376const bool CParameterApp::GetMessageBoxDisplayInformation()
const
378 return m_bMessageBoxDisplayInfomation;
381void CParameterApp::SetMessageBoxDisplayInformation(
bool bEnable)
383 if(m_bMessageBoxDisplayInfomation == bEnable)
385 m_bMessageBoxDisplayInfomation = bEnable;
389const bool CParameterApp::GetDockListActiveShowToolBar()
const
391 return m_bDockListActiveShowToolBar;
394void CParameterApp::SetDockListActiveShowToolBar(
bool bEnable)
396 if(m_bDockListActiveShowToolBar == bEnable)
398 m_bDockListActiveShowToolBar = bEnable;
402const bool CParameterApp::GetDockListRecentShowToolBar()
const
404 return m_bDockListRecentShowToolBar;
407void CParameterApp::SetDockListRecentShowToolBar(
bool bEnable)
409 if(m_bDockListRecentShowToolBar == bEnable)
411 m_bDockListRecentShowToolBar = bEnable;
415bool CParameterApp::GetKeepSplitViewWhenFullScreen()
const
417 return m_bKeepSplitViewWhenFullScreen;
420void CParameterApp::SetKeepSplitViewWhenFullScreen(
bool newKeepSplitViewWhenFullScreen)
422 if(m_bKeepSplitViewWhenFullScreen == newKeepSplitViewWhenFullScreen)
424 m_bKeepSplitViewWhenFullScreen = newKeepSplitViewWhenFullScreen;
428bool CParameterApp::GetStartByType()
const
430 return m_bStartByType;
433void CParameterApp::SetStartByType(
bool newStartByType)
435 if (m_bStartByType == newStartByType)
437 m_bStartByType = newStartByType;
438 emit sigStartByTypeChanged();
static CICE * Instance()
Single instance.
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.