267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
# File 'lib/wiki_lyrics/gui/gui-qt4.rb', line 267
def initialize( values )
super( values )
setWindowTitle( I18n.get( "gui.wikiplugin.title", values["site_name"] ) )
general_group = Qt::GroupBox.new( I18n.get( "gui.wikiplugin.general" ), self )
@submit_checkbox = Qt::CheckBox.new( general_group )
@submit_checkbox.setChecked( values["submit"].to_s() == "true" )
@submit_checkbox.setText( I18n.get( "gui.wikiplugin.general.submit", values["site_name"] ) )
@review_checkbox = Qt::CheckBox.new( general_group )
@review_checkbox.setEnabled( @submit_checkbox.isChecked() )
@review_checkbox.setChecked( @review_checkbox.isEnabled() && values["review"].to_s() == "true" )
@review_checkbox.setText( I18n.get( "gui.wikiplugin.general.review" ) )
@prompt_autogen_checkbox = Qt::CheckBox.new( general_group )
@prompt_autogen_checkbox.setEnabled( @review_checkbox.isChecked() )
@prompt_autogen_checkbox.setChecked( @prompt_autogen_checkbox.isEnabled() && values["prompt_autogen"].to_s() == "true" )
@prompt_autogen_checkbox.setText( I18n.get( "gui.wikiplugin.general.autogen" ) )
@prompt_no_lyrics_checkbox = Qt::CheckBox.new( general_group )
@prompt_no_lyrics_checkbox.setEnabled( @review_checkbox.isChecked() )
@prompt_no_lyrics_checkbox.setChecked( @prompt_no_lyrics_checkbox.isEnabled() && values["prompt_no_lyrics"].to_s() == "true" )
@prompt_no_lyrics_checkbox.setText( I18n.get( "gui.wikiplugin.general.nolyrics" ) )
login_group = Qt::GroupBox.new( I18n.get( "gui.wikiplugin.login" ), self )
username_label = Qt::Label.new( I18n.get( "gui.wikiplugin.login.username" ), login_group )
@username_lineedit = Qt::LineEdit.new( values["username"], login_group )
password_label = Qt::Label.new( I18n.get( "gui.wikiplugin.login.password" ), login_group )
@password_lineedit = Qt::LineEdit.new( values["password"], login_group )
@password_lineedit.setEchoMode( Qt::LineEdit::Password )
buttons = create_action_buttons()
update_accept_button_state()
general_group_layout = Qt::GridLayout.new()
general_group_layout.margin = 5
general_group_layout.spacing = 4
general_group_layout.setRowStretch( 4, 1 )
general_group.setLayout( general_group_layout )
general_group_layout.addWidget( @submit_checkbox, 0, 0 )
general_group_layout.addWidget( @review_checkbox, 1, 0 )
general_group_layout.addWidget( @prompt_autogen_checkbox, 2, 0 )
general_group_layout.addWidget( @prompt_no_lyrics_checkbox, 3, 0 )
login_group_layout = Qt::GridLayout.new()
login_group_layout.setRowStretch( 2, 1 )
login_group_layout.margin = 5
login_group_layout.spacing = 4
login_group_layout.addWidget( username_label, 0, 0 );
login_group_layout.addWidget( @username_lineedit, 0, 1 );
login_group_layout.addWidget( password_label, 1, 0 )
login_group_layout.addWidget( @password_lineedit, 1, 1 )
login_group.setLayout( login_group_layout )
layout = Qt::GridLayout.new( self )
layout.margin = 4
layout.spacing = 4
layout.setRowStretch( 2, 1 )
layout.addWidget( general_group, 0, 0 )
layout.addWidget( login_group, 1, 0 )
layout.addLayout( buttons, 2, 0 )
connect( @username_lineedit, SIGNAL( "textChanged(const QString&)" ), self, SLOT( "update_accept_button_state()" ) )
connect( @submit_checkbox, SIGNAL( "toggled(bool)" ), self, SLOT( "toggle_submit_checked(bool)" ) )
connect( @review_checkbox, SIGNAL( "toggled(bool)" ), self, SLOT( "toggle_review_checked(bool)" ) )
resize( 300, 50 )
end
|