1#include "ParameterApp.h"
4#include "RabbitCommonDir.h"
9CParameterApp::CParameterApp(QObject *parent) : QObject(parent),
10 m_bReceiveShortCut(false),
11 m_bSaveMainWindowStatus(true),
12 m_TabPosition(QTabWidget::North),
13 m_bEnableTabToolTip(true),
14 m_bEnableTabIcon(true),
15 m_nRecentMenuMaxCount(10),
16 m_SystemTrayIconType(SystemTrayIconMenuType::MenuBar),
17 m_bEnableSystemTrayIcon(true),
18 m_bOpenLasterClose(false),
19 m_bFavoriteEdit(false),
23 m_bMessageBoxDisplayInfomation(true)
27CParameterApp::~CParameterApp()
29 QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
30 QSettings::IniFormat);
31 if(GetSaveMainWindowStatus())
33 set.setValue(
"MainWindow/Status/Bar", GetStatusBar());
34 set.setValue(
"MainWindow/TabBar", GetTabBar());
35 set.setValue(
"MainWindow/MenuBar", GetMenuBar());
40int CParameterApp::Load()
42 QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
43 QSettings::IniFormat);
45 SetReceiveShortCut(set.value(
"MainWindow/ReceiveShortCurt",
46 GetReceiveShortCut()).toBool());
47 SetSaveMainWindowStatus(set.value(
"MainWindow/Status/Enable",
48 GetSaveMainWindowStatus()).toBool());
49 SetTabPosition(
static_cast<QTabWidget::TabPosition
>(
50 set.value(
"MainWindow/View/TabView/Tab/Position",
51 GetTabPosition()).toInt()));
52 SetEnableTabToolTip(set.value(
"MainWindow/View/TabView/Tab/Enable/ToolTip",
53 GetEnableTabToolTip()).toBool());
54 SetEnableTabIcon(set.value(
"MainWindow/View/TabView/Tab/Enable/Icon",
55 GetEnableTabIcon()).toBool());
57 SetRecentMenuMaxCount(set.value(
"MainWindow/Recent/Max",
58 GetRecentMenuMaxCount()).toInt());
61 SetEnableSystemTrayIcon(set.value(
"MainWindow/SystemTrayIcon/Enable",
62 GetEnableSystemTrayIcon()).toBool());
63 SetSystemTrayIconMenuType(
static_cast<SystemTrayIconMenuType
>(
64 set.value(
"MainWindow/SystemTrayIcon/MenuType",
65 static_cast<int>(GetSystemTrayIconMenuType())).toInt()));
67 SetOpenLasterClose(set.value(
"MainWindow/OpenLasterClose",
68 GetOpenLasterClose()).toBool());
69 SetFavoriteEdit(set.value(
"MainWindow/Favorite/Double/Edit",
70 GetFavoriteEdit()).toBool());
72 SetStatusBar(set.value(
"MainWindow/Status/Bar",
73 GetStatusBar()).toBool());
75 SetTabBar(set.value(
"MainWindow/TabBar",
76 GetTabBar()).toBool());
78 SetMenuBar(set.value(
"MainWindow/MenuBar",
79 GetMenuBar()).toBool());
81 SetMessageBoxDisplayInformation(
82 set.value(
"MainWindow/MessageBoxDisplayInformation",
83 GetMessageBoxDisplayInformation()).toBool());
91int CParameterApp::Save()
93 QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
94 QSettings::IniFormat);
96 set.setValue(
"MainWindow/ReceiveShortCurt", GetReceiveShortCut());
97 set.setValue(
"MainWindow/Status/Enable", GetSaveMainWindowStatus());
98 set.setValue(
"MainWindow/View/TabView/Tab/Position", GetTabPosition());
99 set.setValue(
"MainWindow/View/TabView/Tab/Enable/ToolTip", GetEnableTabToolTip());
100 set.setValue(
"MainWindow/View/TabView/Tab/Enable/Icon", GetEnableTabIcon());
101 set.setValue(
"MainWindow/Recent/Max", GetRecentMenuMaxCount());
102 set.setValue(
"MainWindow/SystemTrayIcon/Enable", GetEnableSystemTrayIcon());
103 set.setValue(
"MainWindow/SystemTrayIcon/MenuType",
104 static_cast<int>(GetSystemTrayIconMenuType()));
105 set.setValue(
"MainWindow/OpenLasterClose", GetOpenLasterClose());
106 set.setValue(
"MainWindow/Favorite/Double/Edit", GetFavoriteEdit());
107 set.setValue(
"MainWindow/MessageBoxDisplayInformation", GetMessageBoxDisplayInformation());
115bool CParameterApp::GetReceiveShortCut()
const
117 return m_bReceiveShortCut;
120void CParameterApp::SetReceiveShortCut(
bool newReceiveShortCut)
122 if (m_bReceiveShortCut == newReceiveShortCut)
124 m_bReceiveShortCut = newReceiveShortCut;
125 emit sigReceiveShortCutChanged();
128bool CParameterApp::GetSaveMainWindowStatus()
const
130 return m_bSaveMainWindowStatus;
133void CParameterApp::SetSaveMainWindowStatus(
bool newSaveMainWindowStatus)
135 if (m_bSaveMainWindowStatus == newSaveMainWindowStatus)
137 m_bSaveMainWindowStatus = newSaveMainWindowStatus;
138 emit sigSaveMainWindowStatusChanged();
141const QTabWidget::TabPosition &CParameterApp::GetTabPosition()
const
143 return m_TabPosition;
146void CParameterApp::SetTabPosition(
const QTabWidget::TabPosition &newTabPosition)
148 if (m_TabPosition == newTabPosition)
150 m_TabPosition = newTabPosition;
151 emit sigTabPositionChanged();
154const bool CParameterApp::GetEnableTabToolTip()
const
156 return m_bEnableTabToolTip;
159void CParameterApp::SetEnableTabToolTip(
bool bEnable)
161 if(m_bEnableTabToolTip == bEnable)
163 m_bEnableTabToolTip = bEnable;
164 emit sigEnableTabToolTipChanged();
167const bool CParameterApp::GetEnableTabIcon()
const
169 return m_bEnableTabIcon;
172void CParameterApp::SetEnableTabIcon(
bool bEnable)
174 if(m_bEnableTabIcon == bEnable)
176 m_bEnableTabIcon = bEnable;
177 emit sigEnableTabIconChanged();
180int CParameterApp::GetRecentMenuMaxCount()
const
182 return m_nRecentMenuMaxCount;
185void CParameterApp::SetRecentMenuMaxCount(
int newRecentMenuMaxCount)
187 if (m_nRecentMenuMaxCount == newRecentMenuMaxCount)
189 m_nRecentMenuMaxCount = newRecentMenuMaxCount;
190 emit sigRecentMenuMaxCountChanged(m_nRecentMenuMaxCount);
193CParameterApp::SystemTrayIconMenuType CParameterApp::GetSystemTrayIconMenuType()
const
195 return m_SystemTrayIconType;
198void CParameterApp::SetSystemTrayIconMenuType(SystemTrayIconMenuType newSystemTrayIconType)
200 if(m_SystemTrayIconType == newSystemTrayIconType)
202 m_SystemTrayIconType = newSystemTrayIconType;
203 emit sigSystemTrayIconTypeChanged();
206bool CParameterApp::GetEnableSystemTrayIcon()
const
208 return m_bEnableSystemTrayIcon;
211int CParameterApp::SetEnableSystemTrayIcon(
bool bShow)
213 if(m_bEnableSystemTrayIcon == bShow)
215 m_bEnableSystemTrayIcon = bShow;
216 emit sigEnableSystemTrayIcon();
220bool CParameterApp::GetOpenLasterClose()
const
222 return m_bOpenLasterClose;
225void CParameterApp::SetOpenLasterClose(
bool newOpenLasterClose)
227 if (m_bOpenLasterClose == newOpenLasterClose)
229 m_bOpenLasterClose = newOpenLasterClose;
230 emit sigOpenLasterCloseChanged(m_bOpenLasterClose);
233bool CParameterApp::GetFavoriteEdit()
const
235 return m_bFavoriteEdit;
238void CParameterApp::SetFavoriteEdit(
bool newFavoriteEdit)
240 m_bFavoriteEdit = newFavoriteEdit;
241 emit sigFavoriteEditChanged(m_bFavoriteEdit);
244bool CParameterApp::GetStatusBar()
const
249void CParameterApp::SetStatusBar(
bool checked)
251 m_bStatusBar = checked;
254bool CParameterApp::GetTabBar()
const
259void CParameterApp::SetTabBar(
bool checked)
264bool CParameterApp::GetMenuBar()
const
269void CParameterApp::SetMenuBar(
bool checked)
271 m_bMenuBar = checked;
274const bool CParameterApp::GetMessageBoxDisplayInformation()
const
276 return m_bMessageBoxDisplayInfomation;
279void CParameterApp::SetMessageBoxDisplayInformation(
bool bEnable)
281 if(m_bMessageBoxDisplayInfomation == bEnable)
283 m_bMessageBoxDisplayInfomation = bEnable;
static CICE * Instance()
Single instance.