3#include "ParameterDlgSettings.h"
4#include "ui_ParameterDlgSettings.h"
6#include "RabbitCommonDir.h"
13#include <QLoggingCategory>
15static Q_LOGGING_CATEGORY(log,
"App.MainWindow.Parameter")
18 QList<QWidget *> wViewer,
27 foreach(
auto p, wViewer)
29 ui->tabWidget->addTab(p, p->windowIcon(), p->windowTitle());
31 check = connect(
this, SIGNAL(accepted()), p, SLOT(slotAccept()));
34 qCritical(log) <<
"Class" << p->metaObject()->className()
35 <<
"must has slot slotAccept(), please add it";
45 ui->tabWidget->addTab(pWidget, pWidget->windowTitle());
47 check = connect(
this, SIGNAL(accepted()),
48 pWidget, SLOT(slotAccept()));
51 qCritical(log) <<
"Class" << pWidget->metaObject()->className()
52 <<
"must has slot slotAccept(), please add it";
58 ui->cbReciverShortCut->setChecked(m_pParameters->GetReceiveShortCut());
59 ui->cbSaveMainWindowStatus->setChecked(m_pParameters->GetSaveMainWindowStatus());
60 ui->cbResumLasterClose->setChecked(m_pParameters->GetOpenLasterClose());
62 switch (m_pParameters->GetTabPosition()) {
63 case QTabWidget::North:
64 ui->rbNorth->setChecked(
true);
66 case QTabWidget::South:
67 ui->rbSouth->setChecked(
true);
69 case QTabWidget::West:
70 ui->rbWest->setChecked(
true);
72 case QTabWidget::East:
73 ui->rbEast->setChecked(
true);
76 ui->cbTabToolTip->setChecked(m_pParameters->GetEnableTabToolTip());
77 ui->cbTabIcon->setChecked(m_pParameters->GetEnableTabIcon());
79 ui->sbRecentMenuMaxCount->setValue(m_pParameters->GetRecentMenuMaxCount());
81 switch (m_pParameters->GetSystemTrayIconMenuType()) {
82 case CParameterApp::SystemTrayIconMenuType::No:
83 ui->rbSystemTrayIconNo->setChecked(
true);
85 case CParameterApp::SystemTrayIconMenuType::MenuBar:
86 ui->rbMenuBar->setChecked(
true);
88 case CParameterApp::SystemTrayIconMenuType::RecentOpen:
89 ui->rbSystemTrayIconRecentOpen->setChecked(
true);
91 case CParameterApp::SystemTrayIconMenuType::Remote:
92 ui->rbSystemTrayIconRemote->setChecked(
true);
97 ui->cbShowSystemTrayIcon->setChecked(m_pParameters->GetEnableSystemTrayIcon());
99 ui->cbFavoriteDoubleEdit->setChecked(m_pParameters->GetFavoriteEdit());
100 ui->cbMessageBoxDisplayInfo->setChecked(m_pParameters->GetMessageBoxDisplayInformation());
103CParameterDlgSettings::~CParameterDlgSettings()
108void CParameterDlgSettings::on_pbOk_clicked()
110 if(!m_pParameters)
return;
112 m_pParameters->SetReceiveShortCut(ui->cbReciverShortCut->isChecked());
113 m_pParameters->SetSaveMainWindowStatus(ui->cbSaveMainWindowStatus->isChecked());
114 m_pParameters->SetOpenLasterClose(ui->cbResumLasterClose->isChecked());
116 if(ui->rbNorth->isChecked()) m_pParameters->SetTabPosition(QTabWidget::North);
117 if(ui->rbSouth->isChecked()) m_pParameters->SetTabPosition(QTabWidget::South);
118 if(ui->rbEast->isChecked()) m_pParameters->SetTabPosition(QTabWidget::East);
119 if(ui->rbWest->isChecked()) m_pParameters->SetTabPosition(QTabWidget::West);
120 m_pParameters->SetEnableTabToolTip(ui->cbTabToolTip->isChecked());
121 m_pParameters->SetEnableTabIcon(ui->cbTabIcon->isChecked());
123 m_pParameters->SetRecentMenuMaxCount(ui->sbRecentMenuMaxCount->value());
126 m_pParameters->SetEnableSystemTrayIcon(ui->cbShowSystemTrayIcon->isChecked());
127 if(ui->rbSystemTrayIconNo->isChecked())
128 m_pParameters->SetSystemTrayIconMenuType(CParameterApp::SystemTrayIconMenuType::No);
129 if(ui->rbMenuBar->isChecked())
130 m_pParameters->SetSystemTrayIconMenuType(CParameterApp::SystemTrayIconMenuType::MenuBar);
131 if(ui->rbSystemTrayIconRecentOpen->isChecked())
132 m_pParameters->SetSystemTrayIconMenuType(CParameterApp::SystemTrayIconMenuType::RecentOpen);
133 if(ui->rbSystemTrayIconRemote->isChecked())
134 m_pParameters->SetSystemTrayIconMenuType(CParameterApp::SystemTrayIconMenuType::Remote);
136 m_pParameters->SetFavoriteEdit(ui->cbFavoriteDoubleEdit->isChecked());
137 m_pParameters->SetMessageBoxDisplayInformation(ui->cbMessageBoxDisplayInfo->isChecked());
142void CParameterDlgSettings::on_pbNo_clicked()
147void CParameterDlgSettings::on_cbShowSystemTrayIcon_toggled(
bool checked)
149 ui->gbSystemTrayIconContextMenu->setEnabled(checked);
static CICE * Instance()
Single instance.