[Cadencii/trunk] #25598 QtとJavaの分を実装
@@ -284,14 +284,6 @@ | ||
284 | 284 | } |
285 | 285 | |
286 | 286 | @Override |
287 | - public void listDictionariesSetColumnWidth( | |
288 | - int columnIndex, | |
289 | - int columnWidth ) | |
290 | - { | |
291 | - this.listDictionaries.setColumnWidth( columnIndex, columnWidth ); | |
292 | - } | |
293 | - | |
294 | - @Override | |
295 | 287 | public int listDictionariesGetSelectedRow() |
296 | 288 | { |
297 | 289 | return this.listDictionaries.getSelectedRow(); |
@@ -311,10 +303,9 @@ | ||
311 | 303 | |
312 | 304 | @Override |
313 | 305 | public String listDictionariesGetItemAt( |
314 | - int row, | |
315 | - int column ) | |
306 | + int row ) | |
316 | 307 | { |
317 | - return this.listDictionaries.getItemAt( row, column ); | |
308 | + return this.listDictionaries.getItemAt( row, 0 ); | |
318 | 309 | } |
319 | 310 | |
320 | 311 | @Override |
@@ -327,10 +318,9 @@ | ||
327 | 318 | @Override |
328 | 319 | public void listDictionariesSetItemAt( |
329 | 320 | int row, |
330 | - int column, | |
331 | 321 | String value ) |
332 | 322 | { |
333 | - this.listDictionaries.setItemAt( row, column, value ); | |
323 | + this.listDictionaries.setItemAt( row, 0, value ); | |
334 | 324 | } |
335 | 325 | |
336 | 326 | @Override |
@@ -356,27 +346,13 @@ | ||
356 | 346 | |
357 | 347 | @Override |
358 | 348 | public void listDictionariesAddRow( |
359 | - String[] values, | |
349 | + String value, | |
360 | 350 | boolean selected ) |
361 | 351 | { |
362 | - this.listDictionaries.addRow( values, selected ); | |
352 | + this.listDictionaries.addRow( new String[]{ value }, selected ); | |
363 | 353 | } |
364 | 354 | |
365 | 355 | @Override |
366 | - public int listDictionariesGetColumnWidth( | |
367 | - int column ) | |
368 | - { | |
369 | - return this.listDictionaries.getColumnWidth( column ); | |
370 | - } | |
371 | - | |
372 | - @Override | |
373 | - public void listDictionariesSetColumnHeaders( | |
374 | - String[] headers ) | |
375 | - { | |
376 | - this.listDictionaries.setColumnHeaders( headers ); | |
377 | - } | |
378 | - | |
379 | - @Override | |
380 | 356 | public void labelAvailableDictionariesSetText( |
381 | 357 | String value ) |
382 | 358 | { |
@@ -51,7 +51,7 @@ | ||
51 | 51 | |
52 | 52 | [PureVirtualFunction] |
53 | 53 | void buttonCancelClick(); |
54 | - } | |
54 | + }; | |
55 | 55 | |
56 | 56 | #if !JAVA |
57 | 57 | } |
@@ -38,7 +38,17 @@ | ||
38 | 38 | Util.applyFontRecurse( this, AppManager.editorConfig.getBaseFont() ); |
39 | 39 | } |
40 | 40 | |
41 | + public void listDictionariesSetColumnWidth( int columnWidth ) | |
42 | + { | |
43 | + listDictionaries.Columns[0].Width = columnWidth; | |
44 | + } | |
41 | 45 | |
46 | + public int listDictionariesGetColumnWidth() | |
47 | + { | |
48 | + return listDictionaries.Columns[0].Width; | |
49 | + } | |
50 | + | |
51 | + | |
42 | 52 | #region FormWordDictionaryUiの実装 |
43 | 53 | |
44 | 54 | public void setTitle( string value ) |
@@ -66,20 +76,14 @@ | ||
66 | 76 | this.Close(); |
67 | 77 | } |
68 | 78 | |
69 | - public void listDictionariesSetColumnHeaders( string[] headers ) | |
79 | + /*public void listDictionariesSetColumnHeader( string header ) | |
70 | 80 | { |
71 | - if ( listDictionaries.Columns.Count < headers.Length ) | |
81 | + if ( listDictionaries.Columns.Count < 1 ) | |
72 | 82 | { |
73 | - for ( int i = listDictionaries.Columns.Count; i < headers.Length; i++ ) | |
74 | - { | |
75 | - listDictionaries.Columns.Add( "" ); | |
76 | - } | |
83 | + listDictionaries.Columns.Add( "" ); | |
77 | 84 | } |
78 | - for ( int i = 0; i < headers.Length; i++ ) | |
79 | - { | |
80 | - listDictionaries.Columns[i].Text = headers[i]; | |
81 | - } | |
82 | - } | |
85 | + listDictionaries.Columns[0].Text = header; | |
86 | + }*/ | |
83 | 87 | |
84 | 88 | public void listDictionariesClearSelection() |
85 | 89 | { |
@@ -86,25 +90,17 @@ | ||
86 | 90 | listDictionaries.SelectedIndices.Clear(); |
87 | 91 | } |
88 | 92 | |
89 | - public void listDictionariesAddRow( string[] values, bool selected ) | |
93 | + public void listDictionariesAddRow( string value, bool selected ) | |
90 | 94 | { |
91 | - ListViewItem item = new ListViewItem( values ); | |
92 | - if ( listDictionaries.Columns.Count < values.Length ) | |
95 | + ListViewItem item = new ListViewItem( new string[]{ value } ); | |
96 | + if ( listDictionaries.Columns.Count < 1 ) | |
93 | 97 | { |
94 | - for ( int i = listDictionaries.Columns.Count; i < values.Length; i++ ) | |
95 | - { | |
96 | - listDictionaries.Columns.Add( "" ); | |
97 | - } | |
98 | + listDictionaries.Columns.Add( "" ); | |
98 | 99 | } |
99 | 100 | item.Selected = selected; |
100 | 101 | listDictionaries.Items.Add( item ); |
101 | 102 | } |
102 | 103 | |
103 | - public int listDictionariesGetColumnWidth( int column ) | |
104 | - { | |
105 | - return listDictionaries.Columns[column].Width; | |
106 | - } | |
107 | - | |
108 | 104 | public void listDictionariesSetRowChecked( int row, bool value ) |
109 | 105 | { |
110 | 106 | listDictionaries.Items[row].Checked = value; |
@@ -118,9 +114,9 @@ | ||
118 | 114 | } |
119 | 115 | } |
120 | 116 | |
121 | - public void listDictionariesSetItemAt( int row, int column, string value ) | |
117 | + public void listDictionariesSetItemAt( int row, string value ) | |
122 | 118 | { |
123 | - listDictionaries.Items[row].SubItems[column].Text = value; | |
119 | + listDictionaries.Items[row].SubItems[0].Text = value; | |
124 | 120 | } |
125 | 121 | |
126 | 122 | public bool listDictionariesIsRowChecked( int row ) |
@@ -128,9 +124,9 @@ | ||
128 | 124 | return listDictionaries.Items[row].Checked; |
129 | 125 | } |
130 | 126 | |
131 | - public string listDictionariesGetItemAt( int row, int column ) | |
127 | + public string listDictionariesGetItemAt( int row ) | |
132 | 128 | { |
133 | - return listDictionaries.Items[row].SubItems[column].Text; | |
129 | + return listDictionaries.Items[row].SubItems[0].Text; | |
134 | 130 | } |
135 | 131 | |
136 | 132 | public int listDictionariesGetSelectedRow() |
@@ -155,11 +151,6 @@ | ||
155 | 151 | listDictionaries.Items.Clear(); |
156 | 152 | } |
157 | 153 | |
158 | - public void listDictionariesSetColumnWidth( int columnIndex, int columnWidth ) | |
159 | - { | |
160 | - listDictionaries.Columns[columnIndex].Width = columnWidth; | |
161 | - } | |
162 | - | |
163 | 154 | public void buttonDownSetText( string value ) |
164 | 155 | { |
165 | 156 | btnDown.Text = value; |
@@ -284,7 +275,9 @@ | ||
284 | 275 | |
285 | 276 | #endregion |
286 | 277 | |
278 | + private ColumnHeader columnHeader1; | |
287 | 279 | |
280 | + | |
288 | 281 | #region UI implementation |
289 | 282 | |
290 | 283 | /// <summary> |
@@ -312,10 +305,10 @@ | ||
312 | 305 | /// </summary> |
313 | 306 | private void InitializeComponent() |
314 | 307 | { |
315 | - System.Windows.Forms.ListViewGroup listViewGroup10 = new System.Windows.Forms.ListViewGroup( "ListViewGroup", System.Windows.Forms.HorizontalAlignment.Left ); | |
316 | - System.Windows.Forms.ListViewGroup listViewGroup11 = new System.Windows.Forms.ListViewGroup( "ListViewGroup", System.Windows.Forms.HorizontalAlignment.Left ); | |
317 | - System.Windows.Forms.ListViewGroup listViewGroup12 = new System.Windows.Forms.ListViewGroup( "ListViewGroup", System.Windows.Forms.HorizontalAlignment.Left ); | |
318 | - System.Windows.Forms.ListViewItem listViewItem4 = new System.Windows.Forms.ListViewItem( "DEFAULT_JP" ); | |
308 | + System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup( "ListViewGroup", System.Windows.Forms.HorizontalAlignment.Left ); | |
309 | + System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup( "ListViewGroup", System.Windows.Forms.HorizontalAlignment.Left ); | |
310 | + System.Windows.Forms.ListViewGroup listViewGroup3 = new System.Windows.Forms.ListViewGroup( "ListViewGroup", System.Windows.Forms.HorizontalAlignment.Left ); | |
311 | + System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem( "DEFAULT_JP" ); | |
319 | 312 | this.listDictionaries = new org.kbinani.windows.forms.BListView(); |
320 | 313 | this.lblAvailableDictionaries = new System.Windows.Forms.Label(); |
321 | 314 | this.btnOK = new System.Windows.Forms.Button(); |
@@ -322,6 +315,7 @@ | ||
322 | 315 | this.btnCancel = new System.Windows.Forms.Button(); |
323 | 316 | this.btnUp = new System.Windows.Forms.Button(); |
324 | 317 | this.btnDown = new System.Windows.Forms.Button(); |
318 | + this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); | |
325 | 319 | this.SuspendLayout(); |
326 | 320 | // |
327 | 321 | // listDictionaries |
@@ -330,22 +324,24 @@ | ||
330 | 324 | | System.Windows.Forms.AnchorStyles.Left) |
331 | 325 | | System.Windows.Forms.AnchorStyles.Right))); |
332 | 326 | this.listDictionaries.CheckBoxes = true; |
333 | - listViewGroup10.Header = "ListViewGroup"; | |
334 | - listViewGroup10.Name = null; | |
335 | - listViewGroup11.Header = "ListViewGroup"; | |
336 | - listViewGroup11.Name = null; | |
337 | - listViewGroup12.Header = "ListViewGroup"; | |
338 | - listViewGroup12.Name = null; | |
327 | + this.listDictionaries.Columns.AddRange( new System.Windows.Forms.ColumnHeader[] { | |
328 | + this.columnHeader1} ); | |
329 | + listViewGroup1.Header = "ListViewGroup"; | |
330 | + listViewGroup1.Name = null; | |
331 | + listViewGroup2.Header = "ListViewGroup"; | |
332 | + listViewGroup2.Name = null; | |
333 | + listViewGroup3.Header = "ListViewGroup"; | |
334 | + listViewGroup3.Name = null; | |
339 | 335 | this.listDictionaries.Groups.AddRange( new System.Windows.Forms.ListViewGroup[] { |
340 | - listViewGroup10, | |
341 | - listViewGroup11, | |
342 | - listViewGroup12} ); | |
336 | + listViewGroup1, | |
337 | + listViewGroup2, | |
338 | + listViewGroup3} ); | |
343 | 339 | this.listDictionaries.HideSelection = false; |
344 | - listViewItem4.Checked = true; | |
345 | - listViewItem4.Group = listViewGroup12; | |
346 | - listViewItem4.StateImageIndex = 1; | |
340 | + listViewItem1.Checked = true; | |
341 | + listViewItem1.Group = listViewGroup3; | |
342 | + listViewItem1.StateImageIndex = 1; | |
347 | 343 | this.listDictionaries.Items.AddRange( new System.Windows.Forms.ListViewItem[] { |
348 | - listViewItem4} ); | |
344 | + listViewItem1} ); | |
349 | 345 | this.listDictionaries.Location = new System.Drawing.Point( 12, 33 ); |
350 | 346 | this.listDictionaries.Name = "listDictionaries"; |
351 | 347 | this.listDictionaries.Size = new System.Drawing.Size( 248, 186 ); |
@@ -23,6 +23,10 @@ | ||
23 | 23 | { |
24 | 24 | namespace cadencii |
25 | 25 | { |
26 | +#if __cplusplus | |
27 | + using namespace std; | |
28 | + using namespace org::kbinani::cadencii; | |
29 | +#endif | |
26 | 30 | |
27 | 31 | #endif |
28 | 32 |
@@ -87,18 +91,9 @@ | ||
87 | 91 | [PureVirtualFunction] |
88 | 92 | void close(); |
89 | 93 | |
90 | - | |
91 | 94 | /// <summary> |
92 | 95 | /// TODO: comment |
93 | 96 | /// </summary> |
94 | - /// <param name="columIndex"></param> | |
95 | - /// <param name="columnWidth"></param> | |
96 | - [PureVirtualFunction] | |
97 | - void listDictionariesSetColumnWidth( int columIndex, int columnWidth ); | |
98 | - | |
99 | - /// <summary> | |
100 | - /// TODO: comment | |
101 | - /// </summary> | |
102 | 97 | /// <returns></returns> |
103 | 98 | [PureVirtualFunction] |
104 | 99 | int listDictionariesGetSelectedRow(); |
@@ -123,7 +118,7 @@ | ||
123 | 118 | /// <param name="column"></param> |
124 | 119 | /// <returns></returns> |
125 | 120 | [PureVirtualFunction] |
126 | - string listDictionariesGetItemAt( int row, int column ); | |
121 | + string listDictionariesGetItemAt( int row ); | |
127 | 122 | |
128 | 123 | /// <summary> |
129 | 124 | /// TODO: |
@@ -140,7 +135,7 @@ | ||
140 | 135 | /// <param name="column"></param> |
141 | 136 | /// <param name="value"></param> |
142 | 137 | [PureVirtualFunction] |
143 | - void listDictionariesSetItemAt( int row, int column, string value ); | |
138 | + void listDictionariesSetItemAt( int row, string value ); | |
144 | 139 | |
145 | 140 | /// <summary> |
146 | 141 | /// TODO: |
@@ -148,7 +143,7 @@ | ||
148 | 143 | /// <param name="row"></param> |
149 | 144 | /// <param name="value"></param> |
150 | 145 | [PureVirtualFunction] |
151 | - void listDictionariesSetRowChecked( int row, bool value ); | |
146 | + void listDictionariesSetRowChecked( int row, bool isChecked ); | |
152 | 147 | |
153 | 148 | /// <summary> |
154 | 149 | /// TODO: |
@@ -166,28 +161,12 @@ | ||
166 | 161 | /// <summary> |
167 | 162 | /// TODO: comment |
168 | 163 | /// </summary> |
169 | - /// <param name="values"></param> | |
164 | + /// <param name="value"></param> | |
170 | 165 | /// <param name="selected"></param> |
171 | 166 | [PureVirtualFunction] |
172 | - void listDictionariesAddRow( string[] values, bool selected ); | |
167 | + void listDictionariesAddRow( string value, bool isChecked ); | |
173 | 168 | |
174 | 169 | /// <summary> |
175 | - /// TODO: comment | |
176 | - /// </summary> | |
177 | - /// <param name="column"></param> | |
178 | - /// <returns></returns> | |
179 | - [PureVirtualFunction] | |
180 | - int listDictionariesGetColumnWidth( int column ); | |
181 | - | |
182 | - /// <summary> | |
183 | - /// リストのヘッダーの文字列を一括設定します | |
184 | - /// </summary> | |
185 | - /// <param name="headers">リストのヘッダー文字列のリスト</param> | |
186 | - [PureVirtualFunction] | |
187 | - void listDictionariesSetColumnHeaders( string[] headers ); | |
188 | - | |
189 | - | |
190 | - /// <summary> | |
191 | 170 | /// 「利用可能な辞書」という意味の説明文の文字列を設定します. |
192 | 171 | /// </summary> |
193 | 172 | /// <param name="value">設定する文字列</param> |
@@ -221,7 +200,7 @@ | ||
221 | 200 | /// <param name="value">設定する文字列</param> |
222 | 201 | [PureVirtualFunction] |
223 | 202 | void buttonDownSetText( string value ); |
224 | - } | |
203 | + }; | |
225 | 204 | |
226 | 205 | #if !JAVA |
227 | 206 | } |
@@ -57,7 +57,7 @@ | ||
57 | 57 | ui = new FormWordDictionaryUiImpl( this ); |
58 | 58 | applyLanguage(); |
59 | 59 | ui.setSize( mWidth, mHeight ); |
60 | - ui.listDictionariesSetColumnWidth( 0, mColumnWidth ); | |
60 | + ui.listDictionariesSetColumnWidth( mColumnWidth ); | |
61 | 61 | } |
62 | 62 | |
63 | 63 |
@@ -76,14 +76,14 @@ | ||
76 | 76 | try |
77 | 77 | { |
78 | 78 | ui.listDictionariesClear(); |
79 | - String upper_name = ui.listDictionariesGetItemAt( index, 0 ); | |
79 | + String upper_name = ui.listDictionariesGetItemAt( index ); | |
80 | 80 | boolean upper_enabled = ui.listDictionariesIsRowChecked( index ); |
81 | - String lower_name = ui.listDictionariesGetItemAt( index + 1, 0 ); | |
81 | + String lower_name = ui.listDictionariesGetItemAt( index + 1 ); | |
82 | 82 | boolean lower_enabled = ui.listDictionariesIsRowChecked( index + 1 ); |
83 | 83 | |
84 | - ui.listDictionariesSetItemAt( index + 1, 0, upper_name ); | |
84 | + ui.listDictionariesSetItemAt( index + 1, upper_name ); | |
85 | 85 | ui.listDictionariesSetRowChecked( index + 1, upper_enabled ); |
86 | - ui.listDictionariesSetItemAt( index, 0, lower_name ); | |
86 | + ui.listDictionariesSetItemAt( index, lower_name ); | |
87 | 87 | ui.listDictionariesSetRowChecked( index, lower_enabled ); |
88 | 88 | |
89 | 89 | ui.listDictionariesSetSelectedRow( index + 1 ); |
@@ -103,14 +103,14 @@ | ||
103 | 103 | try |
104 | 104 | { |
105 | 105 | ui.listDictionariesClearSelection(); |
106 | - String upper_name = ui.listDictionariesGetItemAt( index - 1, 0 ); | |
106 | + String upper_name = ui.listDictionariesGetItemAt( index - 1 ); | |
107 | 107 | boolean upper_enabled = ui.listDictionariesIsRowChecked( index - 1 ); |
108 | - String lower_name = ui.listDictionariesGetItemAt( index, 0 ); | |
108 | + String lower_name = ui.listDictionariesGetItemAt( index ); | |
109 | 109 | boolean lower_enabled = ui.listDictionariesIsRowChecked( index ); |
110 | 110 | |
111 | - ui.listDictionariesSetItemAt( index - 1, 0, lower_name ); | |
111 | + ui.listDictionariesSetItemAt( index - 1, lower_name ); | |
112 | 112 | ui.listDictionariesSetRowChecked( index - 1, lower_enabled ); |
113 | - ui.listDictionariesSetItemAt( index, 0, upper_name ); | |
113 | + ui.listDictionariesSetItemAt( index, upper_name ); | |
114 | 114 | ui.listDictionariesSetRowChecked( index, upper_enabled ); |
115 | 115 | |
116 | 116 | ui.listDictionariesSetSelectedRow( index - 1 ); |
@@ -134,13 +134,13 @@ | ||
134 | 134 | { |
135 | 135 | String name = SymbolTable.getSymbolTable( i ).getName(); |
136 | 136 | boolean enabled = SymbolTable.getSymbolTable( i ).isEnabled(); |
137 | - ui.listDictionariesAddRow( new String[] { name }, enabled ); | |
137 | + ui.listDictionariesAddRow( name, enabled ); | |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | public void formClosing() |
142 | 142 | { |
143 | - mColumnWidth = ui.listDictionariesGetColumnWidth( 0 ); | |
143 | + mColumnWidth = ui.listDictionariesGetColumnWidth(); | |
144 | 144 | mWidth = ui.getWidth(); |
145 | 145 | mHeight = ui.getHeight(); |
146 | 146 | } |
@@ -183,7 +183,7 @@ | ||
183 | 183 | ui.buttonCancelSetText( _( "Cancel" ) ); |
184 | 184 | ui.buttonUpSetText( _( "Up" ) ); |
185 | 185 | ui.buttonDownSetText( _( "Down" ) ); |
186 | - ui.listDictionariesSetColumnHeaders( new String[] { _( "Name of dictionary" ) } ); | |
186 | + //ui.listDictionariesSetColumnHeader( _( "Name of dictionary" ) ); | |
187 | 187 | } |
188 | 188 | |
189 | 189 | public Vector<ValuePair<String, Boolean>> getResult() |
@@ -195,10 +195,10 @@ | ||
195 | 195 | #endif |
196 | 196 | for ( int i = 0; i < count; i++ ) |
197 | 197 | { |
198 | - String name = ui.listDictionariesGetItemAt( i, 0 ); | |
198 | + String name = ui.listDictionariesGetItemAt( i ); | |
199 | 199 | |
200 | 200 | ret.add( new ValuePair<String, Boolean>( |
201 | - ui.listDictionariesGetItemAt( i, 0 ), ui.listDictionariesIsRowChecked( i ) ) ); | |
201 | + ui.listDictionariesGetItemAt( i ), ui.listDictionariesIsRowChecked( i ) ) ); | |
202 | 202 | } |
203 | 203 | return ret; |
204 | 204 | } |
@@ -12,6 +12,8 @@ | ||
12 | 12 | |
13 | 13 | #include "org/kbinani/cadencii/FormAskKeySoundGenerationUiListener.h" |
14 | 14 | #include "org/kbinani/cadencii/FormAskKeySoundGenerationUiImpl.h" |
15 | +void FormAskKeySoundGenerationUiListener::buttonCancelClickedSlot(){} | |
16 | +void FormAskKeySoundGenerationUiListener::buttonOkClickedSlot(){} | |
15 | 17 | |
16 | 18 | #include "org/kbinani/cadencii/WaveformZoomUiListener.h" |
17 | 19 | #include "org/kbinani/cadencii/WaveformZoomUi.h" |
@@ -18,7 +20,13 @@ | ||
18 | 20 | |
19 | 21 | #include "org/kbinani/cadencii/FormBeatConfigUiListener.h" |
20 | 22 | #include "org/kbinani/cadencii/FormBeatConfigUiImpl.h" |
23 | +void FormBeatConfigUiListener::buttonCancelClickedSlot(){} | |
24 | +void FormBeatConfigUiListener::buttonOkClickedSlot(){} | |
25 | +void FormBeatConfigUiListener::checkboxEndCheckedChangedSlot(){} | |
21 | 26 | |
27 | +#include "org/kbinani/cadencii/FormWordDictionaryUiListener.h" | |
28 | +#include "org/kbinani/cadencii/FormWordDictionaryUiImpl.h" | |
29 | + | |
22 | 30 | int UiBase::showDialog(QObject *parent_form){} |
23 | 31 | |
24 | 32 | int main( int argc, char*argv[] ) |
@@ -27,12 +35,18 @@ | ||
27 | 35 | |
28 | 36 | FormAskKeySoundGenerationUiImpl view( 0 ); |
29 | 37 | view.setAlwaysPerformThisCheck( false ); |
30 | - view.show(); | |
38 | + //view.show(); | |
31 | 39 | |
32 | 40 | FormBeatConfigUiImpl formBeatConfigUiImpl( 0 ); |
33 | 41 | formBeatConfigUiImpl.addItemDenominatorCombobox( "foo" ); |
34 | - formBeatConfigUiImpl.show(); | |
42 | + //formBeatConfigUiImpl.show(); | |
35 | 43 | |
44 | + FormWordDictionaryUiImpl formWordDictionaryUiImpl( 0 ); | |
45 | + formWordDictionaryUiImpl.listDictionariesAddRow( "foo", false ); | |
46 | + formWordDictionaryUiImpl.listDictionariesAddRow( "bar", true ); | |
47 | + formWordDictionaryUiImpl.listDictionariesSetSelectedRow( 1 ); | |
48 | + formWordDictionaryUiImpl.show(); | |
49 | + | |
36 | 50 | int ret = formBeatConfigUiImpl.showDialog( &view ); |
37 | 51 | string s = ""; |
38 | 52 | char buff[1024]; |
@@ -0,0 +1,9 @@ | ||
1 | +/*#include <QtTest/QtTest> | |
2 | + | |
3 | +class FormWordDictionaryUiImplTest : public QObject | |
4 | +{ | |
5 | + Q_OBJECT | |
6 | +private slots: | |
7 | + | |
8 | +}; | |
9 | +*/ |
@@ -0,0 +1,145 @@ | ||
1 | +#include "FormWordDictionaryUiImpl.h" | |
2 | +#include "ui_FormWordDictionaryUiImpl.h" | |
3 | + | |
4 | +FormWordDictionaryUiImpl::FormWordDictionaryUiImpl(QWidget *parent) : | |
5 | + QDialog(parent), | |
6 | + ui(new Ui::FormWordDictionaryUiImpl) | |
7 | +{ | |
8 | + ui->setupUi(this); | |
9 | +} | |
10 | + | |
11 | +FormWordDictionaryUiImpl::~FormWordDictionaryUiImpl() | |
12 | +{ | |
13 | + delete ui; | |
14 | +} | |
15 | + | |
16 | +void FormWordDictionaryUiImpl::changeEvent(QEvent *e) | |
17 | +{ | |
18 | + QDialog::changeEvent(e); | |
19 | + switch (e->type()) { | |
20 | + case QEvent::LanguageChange: | |
21 | + ui->retranslateUi(this); | |
22 | + break; | |
23 | + default: | |
24 | + break; | |
25 | + } | |
26 | +} | |
27 | + | |
28 | +void FormWordDictionaryUiImpl::setTitle(string value) | |
29 | +{ | |
30 | + QDialog::setWindowTitle( QString( value.c_str() ) ); | |
31 | +} | |
32 | + | |
33 | +void FormWordDictionaryUiImpl::setDialogResult(bool value) | |
34 | +{ | |
35 | + dialogResult = value; | |
36 | + close(); | |
37 | +} | |
38 | + | |
39 | +void FormWordDictionaryUiImpl::setSize(int width, int height) | |
40 | +{ | |
41 | + QDialog::setGeometry( QDialog::x(), QDialog::y(), width, height ); | |
42 | +} | |
43 | + | |
44 | +int FormWordDictionaryUiImpl::getWidth() | |
45 | +{ | |
46 | + return QDialog::width(); | |
47 | +} | |
48 | + | |
49 | +int FormWordDictionaryUiImpl::getHeight() | |
50 | +{ | |
51 | + return QDialog::height(); | |
52 | +} | |
53 | + | |
54 | +void FormWordDictionaryUiImpl::setLocation(int x, int y) | |
55 | +{ | |
56 | + QDialog::setGeometry( x, y, QDialog::width(), QDialog::height() ); | |
57 | +} | |
58 | + | |
59 | +void FormWordDictionaryUiImpl::close() | |
60 | +{ | |
61 | + QDialog::close(); | |
62 | +} | |
63 | + | |
64 | +int FormWordDictionaryUiImpl::listDictionariesGetSelectedRow() | |
65 | +{ | |
66 | + return ui->listDictionaries->selectionModel()->currentIndex().row(); | |
67 | +} | |
68 | + | |
69 | +int FormWordDictionaryUiImpl::listDictionariesGetItemCountRow() | |
70 | +{ | |
71 | + return ui->listDictionaries->count(); | |
72 | +} | |
73 | + | |
74 | +void FormWordDictionaryUiImpl::listDictionariesClear() | |
75 | +{ | |
76 | + ui->listDictionaries->clear(); | |
77 | +} | |
78 | + | |
79 | +string FormWordDictionaryUiImpl::listDictionariesGetItemAt(int row) | |
80 | +{ | |
81 | + QListWidgetItem *item = ui->listDictionaries->item( row ); | |
82 | + return item->text().toStdString(); | |
83 | +} | |
84 | + | |
85 | +bool FormWordDictionaryUiImpl::listDictionariesIsRowChecked(int row) | |
86 | +{ | |
87 | + QListWidgetItem *item = ui->listDictionaries->item( row ); | |
88 | + return item->checkState() == Qt::Checked; | |
89 | +} | |
90 | + | |
91 | +void FormWordDictionaryUiImpl::listDictionariesSetItemAt(int row, string value) | |
92 | +{ | |
93 | + QListWidgetItem *item = ui->listDictionaries->item( row ); | |
94 | + item->setText( QString( value.c_str() ) ); | |
95 | +} | |
96 | + | |
97 | +void FormWordDictionaryUiImpl::listDictionariesSetRowChecked(int row, bool value) | |
98 | +{ | |
99 | + QListWidgetItem *item = ui->listDictionaries->item( row ); | |
100 | + item->setCheckState( value ? Qt::Checked : Qt::Unchecked ); | |
101 | +} | |
102 | + | |
103 | +void FormWordDictionaryUiImpl::listDictionariesSetSelectedRow(int row) | |
104 | +{ | |
105 | + ui->listDictionaries->setCurrentRow( row ); | |
106 | +} | |
107 | + | |
108 | +void FormWordDictionaryUiImpl::listDictionariesClearSelection() | |
109 | +{ | |
110 | + ui->listDictionaries->clearSelection(); | |
111 | +} | |
112 | + | |
113 | +void FormWordDictionaryUiImpl::listDictionariesAddRow(string value, bool selected) | |
114 | +{ | |
115 | + ui->listDictionaries->addItem( QString( value.c_str() ) ); | |
116 | + QListWidgetItem *item = ui->listDictionaries->item( ui->listDictionaries->count() - 1 ); | |
117 | + Qt::ItemFlags flags = item->flags() | Qt::ItemIsUserCheckable; | |
118 | + item->setFlags( flags ); | |
119 | + item->setCheckState( selected ? Qt::Checked : Qt::Unchecked ); | |
120 | +} | |
121 | + | |
122 | +void FormWordDictionaryUiImpl::labelAvailableDictionariesSetText(string value) | |
123 | +{ | |
124 | + ui->labelAvailableDictionaries->setText( QString( value.c_str() ) ); | |
125 | +} | |
126 | + | |
127 | +void FormWordDictionaryUiImpl::buttonOkSetText(string value) | |
128 | +{ | |
129 | + ui->buttonOk->setText( QString( value.c_str() ) ); | |
130 | +} | |
131 | + | |
132 | +void FormWordDictionaryUiImpl::buttonCancelSetText(string value) | |
133 | +{ | |
134 | + ui->buttonCancel->setText( QString( value.c_str() ) ); | |
135 | +} | |
136 | + | |
137 | +void FormWordDictionaryUiImpl::buttonUpSetText(string value) | |
138 | +{ | |
139 | + ui->buttonUp->setText( QString( value.c_str() ) ); | |
140 | +} | |
141 | + | |
142 | +void FormWordDictionaryUiImpl::buttonDownSetText(string value) | |
143 | +{ | |
144 | + ui->buttonDown->setText( QString( value.c_str() ) ); | |
145 | +} |
@@ -0,0 +1,54 @@ | ||
1 | +#ifndef FORMWORDDICTIONARYUIIMPL_H | |
2 | +#define FORMWORDDICTIONARYUIIMPL_H | |
3 | + | |
4 | +#include <QDialog> | |
5 | + | |
6 | +#include "UiBase.h" | |
7 | +#include "FormWordDictionaryUi.h" | |
8 | +#include "FormWordDictionaryUiListener.h" | |
9 | +#include <string> | |
10 | + | |
11 | +namespace Ui { | |
12 | + class FormWordDictionaryUiImpl; | |
13 | +} | |
14 | + | |
15 | +using namespace org::kbinani::cadencii; | |
16 | +using namespace std; | |
17 | + | |
18 | +class FormWordDictionaryUiImpl : public QDialog, public FormWordDictionaryUi { | |
19 | + Q_OBJECT | |
20 | +public: | |
21 | + FormWordDictionaryUiImpl( QWidget *parent = 0 ); | |
22 | + ~FormWordDictionaryUiImpl(); | |
23 | + void setTitle( string value ); | |
24 | + void setDialogResult( bool value ); | |
25 | + void setSize( int width, int height ); | |
26 | + int getWidth(); | |
27 | + int getHeight(); | |
28 | + void setLocation( int x, int y ); | |
29 | + void close(); | |
30 | + int listDictionariesGetSelectedRow(); | |
31 | + int listDictionariesGetItemCountRow(); | |
32 | + void listDictionariesClear(); | |
33 | + string listDictionariesGetItemAt( int row ); | |
34 | + bool listDictionariesIsRowChecked( int row ); | |
35 | + void listDictionariesSetItemAt( int row, string value ); | |
36 | + void listDictionariesSetRowChecked( int row, bool value ); | |
37 | + void listDictionariesSetSelectedRow( int row ); | |
38 | + void listDictionariesClearSelection(); | |
39 | + void listDictionariesAddRow( string value, bool selected ); | |
40 | + void labelAvailableDictionariesSetText( string value ); | |
41 | + void buttonOkSetText( string value ); | |
42 | + void buttonCancelSetText( string value ); | |
43 | + void buttonUpSetText( string value ); | |
44 | + void buttonDownSetText( string value ); | |
45 | + | |
46 | +protected: | |
47 | + void changeEvent( QEvent *e ); | |
48 | + | |
49 | +private: | |
50 | + Ui::FormWordDictionaryUiImpl *ui; | |
51 | + bool dialogResult; | |
52 | +}; | |
53 | + | |
54 | +#endif // FORMWORDDICTIONARYUIIMPL_H |
@@ -0,0 +1,5 @@ | ||
1 | +#ifndef FORMWORDDICTIONARYUIIMPLTEST_H | |
2 | +#define FORMWORDDICTIONARYUIIMPLTEST_H | |
3 | + | |
4 | + | |
5 | +#endif // FORMWORDDICTIONARYUIIMPLTEST_H |