Kaydet (Commit) c22bdc3c authored tarafından Caolán McNamara's avatar Caolán McNamara

Tutorial step #6 convert remaining widgets

1. repeat step #5 for each remaining widget, this time making up more memorable
   names for the widgets we want to access and updating the .ui with them in
   parallel with adapting the code

Change-Id: I29eba9fd0f8680d170412d45a39ff1e562261267
üst c892615b
...@@ -46,32 +46,32 @@ using namespace ::com::sun::star::uno; ...@@ -46,32 +46,32 @@ using namespace ::com::sun::star::uno;
ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent ) ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent )
: ModalDialog(pParent, "ChineseConversionDialog", "svx/ui/chineseconversiondialog.ui") : ModalDialog(pParent, "ChineseConversionDialog", "svx/ui/chineseconversiondialog.ui")
, m_aRB_To_Simplified( this, TextConversionDlgs_ResId( RB_TO_SIMPLIFIED ) )
, m_aRB_To_Traditional( this, TextConversionDlgs_ResId( RB_TO_TRADITIONAL ) )
, m_aCB_Translate_Commonterms( this, TextConversionDlgs_ResId( CB_TRANSLATE_COMMONTERMS ) )
, m_aPB_Editterms( this, TextConversionDlgs_ResId( PB_EDITTERMS ) )
, m_pDictionaryDialog(0) , m_pDictionaryDialog(0)
{ {
get(m_pBP_OK, "ok"); get(m_pBP_OK, "ok");
get(m_pPB_Editterms, "editterms");
get(m_pRB_To_Simplified, "tosimplified");
get(m_pRB_To_Traditional, "totraditional");
get(m_pCB_Translate_Commonterms, "commonterms");
FreeResource(); FreeResource();
m_aRB_To_Simplified.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED ); m_pRB_To_Simplified->SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED );
m_aRB_To_Traditional.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL ); m_pRB_To_Traditional->SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL );
SvtLinguConfig aLngCfg; SvtLinguConfig aLngCfg;
sal_Bool bValue = sal_Bool(); sal_Bool bValue = sal_Bool();
Any aAny( aLngCfg.GetProperty( rtl::OUString( UPN_IS_DIRECTION_TO_SIMPLIFIED ) ) ); Any aAny( aLngCfg.GetProperty( rtl::OUString( UPN_IS_DIRECTION_TO_SIMPLIFIED ) ) );
aAny >>= bValue; aAny >>= bValue;
if( bValue ) if( bValue )
m_aRB_To_Simplified.Check(); m_pRB_To_Simplified->Check();
else else
m_aRB_To_Traditional.Check(); m_pRB_To_Traditional->Check();
aAny = aLngCfg.GetProperty( rtl::OUString( UPN_IS_TRANSLATE_COMMON_TERMS ) ); aAny = aLngCfg.GetProperty( rtl::OUString( UPN_IS_TRANSLATE_COMMON_TERMS ) );
if( aAny >>= bValue ) if( aAny >>= bValue )
m_aCB_Translate_Commonterms.Check( bValue ); m_pCB_Translate_Commonterms->Check( bValue );
m_aPB_Editterms.SetClickHdl( LINK( this, ChineseTranslationDialog, DictionaryHdl ) ); m_pPB_Editterms->SetClickHdl( LINK( this, ChineseTranslationDialog, DictionaryHdl ) );
m_pBP_OK->SetClickHdl( LINK( this, ChineseTranslationDialog, OkHdl ) ); m_pBP_OK->SetClickHdl( LINK( this, ChineseTranslationDialog, OkHdl ) );
} }
...@@ -88,8 +88,8 @@ ChineseTranslationDialog::~ChineseTranslationDialog() ...@@ -88,8 +88,8 @@ ChineseTranslationDialog::~ChineseTranslationDialog()
void ChineseTranslationDialog::getSettings( sal_Bool& rbDirectionToSimplified void ChineseTranslationDialog::getSettings( sal_Bool& rbDirectionToSimplified
, sal_Bool& rbTranslateCommonTerms ) const , sal_Bool& rbTranslateCommonTerms ) const
{ {
rbDirectionToSimplified = m_aRB_To_Simplified.IsChecked(); rbDirectionToSimplified = m_pRB_To_Simplified->IsChecked();
rbTranslateCommonTerms = m_aCB_Translate_Commonterms.IsChecked(); rbTranslateCommonTerms = m_pCB_Translate_Commonterms->IsChecked();
} }
IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl) IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl)
...@@ -97,9 +97,9 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl) ...@@ -97,9 +97,9 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl)
//save settings to configuration //save settings to configuration
SvtLinguConfig aLngCfg; SvtLinguConfig aLngCfg;
Any aAny; Any aAny;
aAny <<= sal_Bool( !!m_aRB_To_Simplified.IsChecked() ); aAny <<= sal_Bool( !!m_pRB_To_Simplified->IsChecked() );
aLngCfg.SetProperty( rtl::OUString( UPN_IS_DIRECTION_TO_SIMPLIFIED ), aAny ); aLngCfg.SetProperty( rtl::OUString( UPN_IS_DIRECTION_TO_SIMPLIFIED ), aAny );
aAny <<= sal_Bool( !!m_aCB_Translate_Commonterms.IsChecked() ); aAny <<= sal_Bool( !!m_pCB_Translate_Commonterms->IsChecked() );
aLngCfg.SetProperty( rtl::OUString( UPN_IS_TRANSLATE_COMMON_TERMS ), aAny ); aLngCfg.SetProperty( rtl::OUString( UPN_IS_TRANSLATE_COMMON_TERMS ), aAny );
EndDialog( RET_OK ); EndDialog( RET_OK );
...@@ -125,9 +125,9 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl) ...@@ -125,9 +125,9 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl)
else else
{ {
sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE; sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE;
if( !m_aCB_Translate_Commonterms.IsChecked() ) if( !m_pCB_Translate_Commonterms->IsChecked() )
nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER; nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
m_pDictionaryDialog->setDirectionAndTextConversionOptions( m_aRB_To_Simplified.IsChecked(), nTextConversionOptions ); m_pDictionaryDialog->setDirectionAndTextConversionOptions( m_pRB_To_Simplified->IsChecked(), nTextConversionOptions );
m_pDictionaryDialog->Execute(); m_pDictionaryDialog->Execute();
} }
} }
......
...@@ -52,11 +52,11 @@ private: ...@@ -52,11 +52,11 @@ private:
void impl_UpdateVariantsCheckBox(); void impl_UpdateVariantsCheckBox();
private: private:
RadioButton m_aRB_To_Simplified; RadioButton* m_pRB_To_Simplified;
RadioButton m_aRB_To_Traditional; RadioButton* m_pRB_To_Traditional;
CheckBox m_aCB_Translate_Commonterms; CheckBox* m_pCB_Translate_Commonterms;
PushButton m_aPB_Editterms; PushButton* m_pPB_Editterms;
OKButton* m_pBP_OK; OKButton* m_pBP_OK;
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
<child> <child>
<object class="GtkRadioButton" id="radiobutton1"> <object class="GtkRadioButton" id="tosimplified">
<property name="label" translatable="yes">_Traditional Chinese to simplified Chinese</property> <property name="label" translatable="yes">_Traditional Chinese to simplified Chinese</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">radiobutton2</property> <property name="group">totraditional</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="radiobutton2"> <object class="GtkRadioButton" id="totraditional">
<property name="label" translatable="yes">_Simplified Chinese to traditional Chinese</property> <property name="label" translatable="yes">_Simplified Chinese to traditional Chinese</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">radiobutton1</property> <property name="group">tosimplified</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
<child> <child>
<object class="GtkCheckButton" id="checkbutton1"> <object class="GtkCheckButton" id="commonterms">
<property name="label" translatable="yes">Translate _common terms</property> <property name="label" translatable="yes">Translate _common terms</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="button1"> <object class="GtkButton" id="editterms">
<property name="label" translatable="yes">_Edit Terms...</property> <property name="label" translatable="yes">_Edit Terms...</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment