From 4c4ef728ca9bbc7726aa1dc309d09559287fce4c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 12 Mar 2019 09:03:39 +0000 Subject: weld OfaMiscTabPage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6a363142945fc0b77e6c84649d32ffc27a5e2f04 Reviewed-on: https://gerrit.libreoffice.org/69082 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- cui/source/options/optgdlg.cxx | 155 +++++++++++++++++--------------------- cui/source/options/optgdlg.hxx | 39 +++++----- cui/uiconfig/ui/optgeneralpage.ui | 9 ++- 3 files changed, 91 insertions(+), 112 deletions(-) diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index a7f1a7ea96f6..38d020438273 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -255,53 +255,53 @@ bool lcl_HasSystemFilePicker() } } -OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet) - : SfxTabPage(pParent, "OptGeneralPage", "cui/ui/optgeneralpage.ui", &rSet) +OfaMiscTabPage::OfaMiscTabPage(TabPageParent pParent, const SfxItemSet& rSet) + : SfxTabPage(pParent, "cui/ui/optgeneralpage.ui", "OptGeneralPage", &rSet) + , m_xExtHelpCB(m_xBuilder->weld_check_button("exthelp")) + , m_xPopUpNoHelpCB(m_xBuilder->weld_check_button("popupnohelp")) + , m_xFileDlgFrame(m_xBuilder->weld_widget("filedlgframe")) + , m_xPrintDlgFrame(m_xBuilder->weld_widget("printdlgframe")) + , m_xFileDlgROImage(m_xBuilder->weld_widget("lockimage")) + , m_xFileDlgCB(m_xBuilder->weld_check_button("filedlg")) + , m_xPrintDlgCB(m_xBuilder->weld_check_button("printdlg")) + , m_xDocStatusCB(m_xBuilder->weld_check_button("docstatus")) + , m_xYearFrame(m_xBuilder->weld_widget("yearframe")) + , m_xYearValueField(m_xBuilder->weld_spin_button("year")) + , m_xToYearFT(m_xBuilder->weld_label("toyear")) + , m_xCollectUsageInfo(m_xBuilder->weld_check_button("collectusageinfo")) + , m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter")) +#if defined(UNX) + , m_xQuickLaunchCB(m_xBuilder->weld_check_button("systray")) +#else + , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch")) +#endif { - get(m_pExtHelpCB, "exthelp"); - get(m_pPopUpNoHelpCB,"popupnohelp"); if (!lcl_HasSystemFilePicker()) - get("filedlgframe")->Hide(); + m_xFileDlgFrame->hide(); #if ! ENABLE_GTK - get("printdlgframe")->Hide(); + m_xFileDlgFrame->hide(); #else if (!SvtMiscOptions().IsExperimentalMode()) { - get("printdlgframe")->Hide(); + m_xFileDlgFrame->hide(); } #endif - get(m_pFileDlgCB, "filedlg"); - get(m_pFileDlgROImage, "lockimage"); - get(m_pPrintDlgCB, "printdlg"); - get(m_pDocStatusCB, "docstatus"); - get(m_pYearFrame, "yearframe"); - get(m_pYearValueField, "year"); - get(m_pToYearFT, "toyear"); - get(m_pCollectUsageInfo, "collectusageinfo"); - get(m_pQuickStarterFrame, "quickstarter"); -#if defined(UNX) - get(m_pQuickLaunchCB, "systray"); -#else - get(m_pQuickLaunchCB, "quicklaunch"); -#endif - - if (m_pFileDlgCB->IsVisible() && SvtMiscOptions().IsUseSystemFileDialogReadOnly()) + if (m_xFileDlgCB->get_visible() && SvtMiscOptions().IsUseSystemFileDialogReadOnly()) { - m_pFileDlgROImage->Show(); - m_pFileDlgCB->Disable(); + m_xFileDlgROImage->show(); + m_xFileDlgCB->set_sensitive(false); } - m_pQuickLaunchCB->Show(); + m_xQuickLaunchCB->show(); //Only available in Win or if building the gtk systray #if !defined(_WIN32) && ! ENABLE_GTK - m_pQuickStarterFrame->Hide(); + m_xQuickStarterFrame->hide(); #endif - m_aStrDateInfo = m_pToYearFT->GetText(); - m_pYearValueField->SetUseThousandSep(false); - m_pYearValueField->SetModifyHdl( LINK( this, OfaMiscTabPage, TwoFigureHdl ) ); + m_aStrDateInfo = m_xToYearFT->get_label(); + m_xYearValueField->connect_value_changed( LINK( this, OfaMiscTabPage, TwoFigureHdl ) ); SetExchangeSupport(); } @@ -311,26 +311,9 @@ OfaMiscTabPage::~OfaMiscTabPage() disposeOnce(); } -void OfaMiscTabPage::dispose() -{ - m_pExtHelpCB.clear(); - m_pFileDlgROImage.clear(); - m_pFileDlgCB.clear(); - m_pPrintDlgCB.clear(); - m_pDocStatusCB.clear(); - m_pYearFrame.clear(); - m_pYearValueField.clear(); - m_pToYearFT.clear(); - m_pCollectUsageInfo.clear(); - m_pQuickStarterFrame.clear(); - m_pQuickLaunchCB.clear(); - m_pPopUpNoHelpCB.clear(); - SfxTabPage::dispose(); -} - VclPtr OfaMiscTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) { - return VclPtr::Create( pParent.pParent, *rAttrSet ); + return VclPtr::Create( pParent, *rAttrSet ); } bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) @@ -339,52 +322,52 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) std::shared_ptr batch(comphelper::ConfigurationChanges::create()); SvtHelpOptions aHelpOptions; - if ( m_pPopUpNoHelpCB->IsValueChangedFromSaved() ) - aHelpOptions.SetOfflineHelpPopUp( m_pPopUpNoHelpCB->IsChecked() ); + if ( m_xPopUpNoHelpCB->get_state_changed_from_saved() ) + aHelpOptions.SetOfflineHelpPopUp( m_xPopUpNoHelpCB->get_active() ); - if ( m_pExtHelpCB->IsValueChangedFromSaved() ) - aHelpOptions.SetExtendedHelp( m_pExtHelpCB->IsChecked() ); + if ( m_xExtHelpCB->get_state_changed_from_saved() ) + aHelpOptions.SetExtendedHelp( m_xExtHelpCB->get_active() ); - if ( m_pFileDlgCB->IsValueChangedFromSaved() ) + if ( m_xFileDlgCB->get_state_changed_from_saved() ) { SvtMiscOptions aMiscOpt; - aMiscOpt.SetUseSystemFileDialog( !m_pFileDlgCB->IsChecked() ); + aMiscOpt.SetUseSystemFileDialog( !m_xFileDlgCB->get_active() ); bModified = true; } - if ( m_pPrintDlgCB->IsValueChangedFromSaved() ) + if ( m_xPrintDlgCB->get_state_changed_from_saved() ) { SvtMiscOptions aMiscOpt; - aMiscOpt.SetUseSystemPrintDialog( !m_pPrintDlgCB->IsChecked() ); + aMiscOpt.SetUseSystemPrintDialog( !m_xPrintDlgCB->get_active() ); bModified = true; } - if ( m_pDocStatusCB->IsValueChangedFromSaved() ) + if ( m_xDocStatusCB->get_state_changed_from_saved() ) { SvtPrintWarningOptions aPrintOptions; - aPrintOptions.SetModifyDocumentOnPrintingAllowed( m_pDocStatusCB->IsChecked() ); + aPrintOptions.SetModifyDocumentOnPrintingAllowed( m_xDocStatusCB->get_active() ); bModified = true; } const SfxUInt16Item* pUInt16Item = dynamic_cast< const SfxUInt16Item* >( GetOldItem( *rSet, SID_ATTR_YEAR2000 ) ); - sal_uInt16 nNum = static_cast(m_pYearValueField->GetText().toInt32()); + sal_uInt16 nNum = static_cast(m_xYearValueField->get_text().toInt32()); if ( pUInt16Item && pUInt16Item->GetValue() != nNum ) { bModified = true; rSet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) ); } - if (m_pCollectUsageInfo->IsValueChangedFromSaved()) + if (m_xCollectUsageInfo->get_state_changed_from_saved()) { - officecfg::Office::Common::Misc::CollectUsageInformation::set(m_pCollectUsageInfo->IsChecked(), batch); + officecfg::Office::Common::Misc::CollectUsageInformation::set(m_xCollectUsageInfo->get_active(), batch); bModified = true; } batch->commit(); - if( m_pQuickLaunchCB->IsValueChangedFromSaved()) + if( m_xQuickLaunchCB->get_state_changed_from_saved()) { - rSet->Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, m_pQuickLaunchCB->IsChecked())); + rSet->Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, m_xQuickLaunchCB->get_active())); bModified = true; } @@ -394,58 +377,58 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) { SvtHelpOptions aHelpOptions; - m_pExtHelpCB->Check( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() ); - m_pExtHelpCB->SaveValue(); - m_pPopUpNoHelpCB->Check( aHelpOptions.IsOfflineHelpPopUp() ); - m_pPopUpNoHelpCB->SaveValue(); + m_xExtHelpCB->set_active( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() ); + m_xExtHelpCB->save_state(); + m_xPopUpNoHelpCB->set_active( aHelpOptions.IsOfflineHelpPopUp() ); + m_xPopUpNoHelpCB->save_state(); SvtMiscOptions aMiscOpt; - m_pFileDlgCB->Check( !aMiscOpt.UseSystemFileDialog() ); - m_pFileDlgCB->SaveValue(); - m_pPrintDlgCB->Check( !aMiscOpt.UseSystemPrintDialog() ); - m_pPrintDlgCB->SaveValue(); + m_xFileDlgCB->set_active( !aMiscOpt.UseSystemFileDialog() ); + m_xFileDlgCB->save_state(); + m_xPrintDlgCB->set_active( !aMiscOpt.UseSystemPrintDialog() ); + m_xPrintDlgCB->save_state(); SvtPrintWarningOptions aPrintOptions; - m_pDocStatusCB->Check(aPrintOptions.IsModifyDocumentOnPrintingAllowed()); - m_pDocStatusCB->SaveValue(); + m_xDocStatusCB->set_active(aPrintOptions.IsModifyDocumentOnPrintingAllowed()); + m_xDocStatusCB->save_state(); const SfxPoolItem* pItem = nullptr; if ( SfxItemState::SET == rSet->GetItemState( SID_ATTR_YEAR2000, false, &pItem ) ) { - m_pYearValueField->SetValue( static_cast(pItem)->GetValue() ); - TwoFigureHdl(*m_pYearValueField); + m_xYearValueField->set_value( static_cast(pItem)->GetValue() ); + TwoFigureHdl(*m_xYearValueField); } else - m_pYearFrame->Enable(false); + m_xYearFrame->set_sensitive(false); - m_pCollectUsageInfo->Check(officecfg::Office::Common::Misc::CollectUsageInformation::get()); - m_pCollectUsageInfo->Enable(!officecfg::Office::Common::Misc::CollectUsageInformation::isReadOnly()); - m_pCollectUsageInfo->SaveValue(); + m_xCollectUsageInfo->set_active(officecfg::Office::Common::Misc::CollectUsageInformation::get()); + m_xCollectUsageInfo->set_sensitive(!officecfg::Office::Common::Misc::CollectUsageInformation::isReadOnly()); + m_xCollectUsageInfo->save_state(); SfxItemState eState = rSet->GetItemState( SID_ATTR_QUICKLAUNCHER, false, &pItem ); if ( SfxItemState::SET == eState ) - m_pQuickLaunchCB->Check( static_cast(pItem)->GetValue() ); + m_xQuickLaunchCB->set_active( static_cast(pItem)->GetValue() ); else if ( SfxItemState::DISABLED == eState ) { // quickstart not installed - m_pQuickStarterFrame->Hide(); + m_xQuickStarterFrame->hide(); } - m_pQuickLaunchCB->SaveValue(); + m_xQuickLaunchCB->save_state(); } -IMPL_LINK_NOARG( OfaMiscTabPage, TwoFigureHdl, Edit&, void ) +IMPL_LINK_NOARG( OfaMiscTabPage, TwoFigureHdl, weld::SpinButton&, void ) { OUString aOutput( m_aStrDateInfo ); - OUString aStr( m_pYearValueField->GetText() ); + OUString aStr( m_xYearValueField->get_text() ); sal_Int32 nNum = aStr.toInt32(); - if ( aStr.getLength() != 4 || nNum < m_pYearValueField->GetMin() || nNum > m_pYearValueField->GetMax() ) + if ( aStr.getLength() != 4 || nNum < m_xYearValueField->get_min() || nNum > m_xYearValueField->get_max() ) aOutput += "????"; else { nNum += 99; aOutput += OUString::number( nNum ); } - m_pToYearFT->SetText( aOutput ); + m_xToYearFT->set_label( aOutput ); } class CanvasSettings diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx index 08d5634a889e..52cf72ef3b6e 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -40,35 +40,30 @@ class OfaMiscTabPage : public SfxTabPage { using TabPage::DeactivatePage; private: - VclPtr m_pPopUpNoHelpCB; - VclPtr m_pExtHelpCB; - - VclPtr m_pFileDlgROImage; - VclPtr m_pFileDlgCB; - - VclPtr m_pPrintDlgCB; - - VclPtr m_pDocStatusCB; - - VclPtr m_pYearFrame; - VclPtr m_pYearValueField; - VclPtr m_pToYearFT; - OUString m_aStrDateInfo; - VclPtr m_pCollectUsageInfo; - - VclPtr m_pQuickStarterFrame; - VclPtr m_pQuickLaunchCB; - - DECL_LINK( TwoFigureHdl, Edit&, void ); + std::unique_ptr m_xExtHelpCB; + std::unique_ptr m_xPopUpNoHelpCB; + std::unique_ptr m_xFileDlgFrame; + std::unique_ptr m_xPrintDlgFrame; + std::unique_ptr m_xFileDlgROImage; + std::unique_ptr m_xFileDlgCB; + std::unique_ptr m_xPrintDlgCB; + std::unique_ptr m_xDocStatusCB; + std::unique_ptr m_xYearFrame; + std::unique_ptr m_xYearValueField; + std::unique_ptr m_xToYearFT; + std::unique_ptr m_xCollectUsageInfo; + std::unique_ptr m_xQuickStarterFrame; + std::unique_ptr m_xQuickLaunchCB; + + DECL_LINK(TwoFigureHdl, weld::SpinButton&, void); protected: virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; public: - OfaMiscTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); + OfaMiscTabPage(TabPageParent pParent, const SfxItemSet& rSet); virtual ~OfaMiscTabPage() override; - virtual void dispose() override; static VclPtr Create( TabPageParent pParent, const SfxItemSet* rAttrSet ); diff --git a/cui/uiconfig/ui/optgeneralpage.ui b/cui/uiconfig/ui/optgeneralpage.ui index 8d47ea9e4682..24eadff85c61 100644 --- a/cui/uiconfig/ui/optgeneralpage.ui +++ b/cui/uiconfig/ui/optgeneralpage.ui @@ -1,5 +1,5 @@ - + @@ -116,7 +116,7 @@ True center center - res/lock.png + res/lock.png 0 @@ -260,6 +260,7 @@ True True + True adjustment1 @@ -361,8 +362,8 @@ Load %PRODUCTNAME during system start-up True False - True True + True 0 True @@ -376,8 +377,8 @@ Enable systray Quickstarter True False - True True + True 0 True -- cgit