@@ -47,7 +47,7 @@ const QString COperateDesktop::Id()
4747 if (!GetParameter ()->m_Net .GetHost ().isEmpty ())
4848 szId += " _" + GetParameter ()->m_Net .GetHost ()
4949 + " _" + QString::number (GetParameter ()->m_Net .GetPort ());
50-
50+
5151 CParameterNet* net = nullptr ;
5252 QString szType;
5353 switch (GetParameter ()->m_Proxy .GetUsedType ())
@@ -72,7 +72,7 @@ const QString COperateDesktop::Id()
7272 default :
7373 break ;
7474 }
75-
75+
7676 if (!szType.isEmpty () && !net->GetHost ().isEmpty ()) {
7777 szId += " _" + szType + " _" ;
7878 szId += net->GetHost () + " _" + QString::number (net->GetPort ());
@@ -89,7 +89,7 @@ const QString COperateDesktop::Name()
8989 if (GetParameter () && GetParameter ()->GetGlobalParameters ()
9090 && GetParameter ()->GetGlobalParameters ()->GetShowProtocolPrefix ())
9191 szName = Protocol () + " :" ;
92-
92+
9393 if (GetParameter () && !(GetParameter ()->GetName ().isEmpty ()))
9494 szName += GetParameter ()->GetName ();
9595 else
@@ -102,10 +102,10 @@ const QString COperateDesktop::Description()
102102 QString szDescription;
103103 if (!Name ().isEmpty ())
104104 szDescription = tr (" Name: " ) + Name () + " \n " ;
105-
105+
106106 if (!GetTypeName ().isEmpty ())
107107 szDescription += tr (" Type:" ) + GetTypeName () + " \n " ;
108-
108+
109109 if (!Protocol ().isEmpty ()) {
110110 szDescription += tr (" Protocol: " ) + Protocol ();
111111#ifdef DEBUG
@@ -165,21 +165,21 @@ int COperateDesktop::Initial()
165165 qDebug (log) << Q_FUNC_INFO;
166166 int nRet = 0 ;
167167 bool check = false ;
168-
168+
169169 nRet = COperate::Initial ();
170170 if (nRet)
171171 return nRet;
172-
172+
173173 Q_ASSERT (!(m_pFrmViewer && m_pScroll));
174174 m_pFrmViewer = new CFrmViewer (); // The owner is m_pScroll
175175 m_pScroll = new CFrmScroll (m_pFrmViewer);
176-
176+
177177 check = connect (m_pFrmViewer, SIGNAL (sigViewerFocusIn (QWidget*)),
178178 this , SIGNAL (sigViewerFocusIn (QWidget*)));
179179 Q_ASSERT (check);
180-
180+
181181 nRet = InitialMenu ();
182-
182+
183183 return nRet;
184184}
185185
@@ -239,8 +239,11 @@ int COperateDesktop::InitialMenu()
239239 check = connect (
240240 m_pZoomIn, &QAction::toggled, this ,
241241 [&](){
242- if (m_psbZoomFactor)
243- m_psbZoomFactor->setValue ((m_pFrmViewer->GetZoomFactor () + 0.1 ) * 100 );
242+ double factor = 0 ;
243+ if (m_psbZoomFactor) {
244+ factor = (m_pFrmViewer->GetZoomFactor () + 0.1 ) * 100 ;
245+ m_psbZoomFactor->setValue (factor);
246+ }
244247 });
245248 Q_ASSERT (check);
246249 m_pZoomOut = pMenuZoom->addAction (
@@ -249,8 +252,11 @@ int COperateDesktop::InitialMenu()
249252 check = connect (
250253 m_pZoomOut, &QAction::toggled, this ,
251254 [&](){
252- if (m_psbZoomFactor)
253- m_psbZoomFactor->setValue ((m_pFrmViewer->GetZoomFactor () - 0.1 ) * 100 );
255+ double factor = 100 ;
256+ if (m_psbZoomFactor) {
257+ factor = (m_pFrmViewer->GetZoomFactor () - 0.1 ) * 100 ;
258+ m_psbZoomFactor->setValue (factor);
259+ }
254260 });
255261 Q_ASSERT (check);
256262 QActionGroup* pGBViewZoom = new QActionGroup (this );
@@ -363,6 +369,7 @@ int COperateDesktop::SetGlobalParameters(CParameterPlugin *pPara)
363369 this , SLOT (slotUpdateName ()));
364370 Q_ASSERT (check);
365371 }
372+ LoadAdaptWindows ();
366373 return 0 ;
367374 } else {
368375 QString szMsg = " There is not parameters! "
@@ -424,25 +431,8 @@ int COperateDesktop::SetParameter(CParameterBase *p)
424431 return 0 ;
425432}
426433
427- int COperateDesktop::Load (QSettings &set )
434+ int COperateDesktop::LoadAdaptWindows ( )
428435{
429- int nRet = 0 ;
430- Q_ASSERT (m_pFrmViewer);
431- nRet = COperate::Load (set);
432- if (m_pPara)
433- nRet = m_pPara->Load (set);
434- else {
435- QString szMsg = " There is not parameters! "
436- " please first create parameters, "
437- " then call SetParameter() in the " ;
438- szMsg += metaObject ()->className () + QString (" ::" )
439- + metaObject ()->className ();
440- szMsg += QString (" () or " ) + metaObject ()->className ()
441- + QString (" ::" ) + " Initial()" ;
442- szMsg += " to set the parameters pointer. " ;
443- qWarning (log) << szMsg.toStdString ().c_str ();
444- Q_ASSERT (false );// TODO: delete it
445- }
446436 if (m_pFrmViewer && GetParameter ())
447437 {
448438 m_pFrmViewer->slotSetZoomFactor (GetParameter ()->GetZoomFactor ());
@@ -463,6 +453,30 @@ int COperateDesktop::Load(QSettings &set)
463453 m_pZoomIn->setChecked (true );
464454 }
465455 }
456+ return 0 ;
457+ }
458+
459+ int COperateDesktop::Load (QSettings &set)
460+ {
461+ int nRet = 0 ;
462+ Q_ASSERT (m_pFrmViewer);
463+ nRet = COperate::Load (set);
464+ if (m_pPara)
465+ nRet = m_pPara->Load (set);
466+ else {
467+ QString szMsg = " There is not parameters! "
468+ " please first create parameters, "
469+ " then call SetParameter() in the " ;
470+ szMsg += metaObject ()->className () + QString (" ::" )
471+ + metaObject ()->className ();
472+ szMsg += QString (" () or " ) + metaObject ()->className ()
473+ + QString (" ::" ) + " Initial()" ;
474+ szMsg += " to set the parameters pointer. " ;
475+ qWarning (log) << szMsg.toStdString ().c_str ();
476+ Q_ASSERT (false );// TODO: delete it
477+ }
478+
479+ LoadAdaptWindows ();
466480 return nRet;
467481}
468482
0 commit comments