102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# File 'lib/wiki_lyrics/gui/gui-qt4.rb', line 102
def initialize( values )
super( values )
setWindowTitle( I18n.get( "gui.pluginsmanager.title", @values["script_name"] ) )
sites_group = Qt::GroupBox.new( I18n.get( "gui.pluginsmanager.sites" ), self )
@move_up_button = Qt::PushButton.new( I18n.get( "gui.pluginsmanager.sites.moveup" ), sites_group )
@move_down_button = Qt::PushButton.new( I18n.get( "gui.pluginsmanager.sites.movedown" ), sites_group )
@used_plugins_model = StringListModel.new( I18n.get( "gui.pluginsmanager.sites.inuse" ) )
@used_plugins_model.setStringList( @values["used_plugins"] )
@used_plugins_view = Qt::TreeView.new( sites_group )
@used_plugins_view.rootIsDecorated = false
@used_plugins_view.sortingEnabled = false
@used_plugins_view.allColumnsShowFocus = true
@used_plugins_view.setModel( @used_plugins_model )
@add_button = Qt::PushButton.new( I18n.get( "gui.pluginsmanager.sites.add" ), sites_group )
@remove_button = Qt::PushButton.new( I18n.get( "gui.pluginsmanager.sites.remove" ), sites_group )
@unused_plugins_model = StringListModel.new( I18n.get( "gui.pluginsmanager.sites.available" ) )
@unused_plugins_model.setStringList( @values["unused_plugins"] )
@unused_plugins_view = Qt::TreeView.new( sites_group )
@unused_plugins_view.rootIsDecorated = false
@unused_plugins_view.sortingEnabled = false
@unused_plugins_view.allColumnsShowFocus = true
@unused_plugins_view.setModel( @unused_plugins_model )
misc_group = Qt::GroupBox.new( I18n.get( "gui.pluginsmanager.misc" ), self )
@cleanup_lyrics_checkbox = Qt::CheckBox.new( misc_group )
@cleanup_lyrics_checkbox.setChecked( values["cleanup_lyrics"].to_s() == "true" )
@cleanup_lyrics_checkbox.setText( I18n.get( "gui.pluginsmanager.misc.cleanup" ) )
@single_threaded_checkbox = Qt::CheckBox.new( misc_group )
@single_threaded_checkbox.setChecked( values["single_threaded"].to_s() == "true" )
@single_threaded_checkbox.setText( I18n.get( "gui.pluginsmanager.misc.singlethreaded" ) )
@write_log_checkbox = Qt::CheckBox.new( misc_group )
@write_log_checkbox.setChecked( values["write_log"].to_s() == "true" )
@write_log_checkbox.setText( I18n.get( "gui.pluginsmanager.misc.writelog", "$HOME/.wikilyrics.log" ) )
buttons = create_action_buttons()
sites_group_layout = Qt::GridLayout.new( sites_group )
sites_group_layout.margin = 4
sites_group_layout.spacing = 4
sites_group_layout.setColumnStretch( 1, 1 )
sites_group_layout.setColumnStretch( 3, 1 )
sites_group_layout.setRowStretch( 0, 1 )
sites_group_layout.setRowStretch( 3, 1 )
sites_group_layout.addWidget( @move_up_button, 1, 0 )
sites_group_layout.addWidget( @move_down_button, 2, 0 )
sites_group_layout.addWidget( @used_plugins_view, 0, 1, 4, 1 )
sites_group_layout.addWidget( @add_button, 1, 2 )
sites_group_layout.addWidget( @remove_button, 2, 2 )
sites_group_layout.addWidget( @unused_plugins_view, 0, 3, 4, 1 )
sites_group.setLayout( sites_group_layout )
misc_group_layout = Qt::VBoxLayout.new()
misc_group_layout.margin = 5
misc_group_layout.spacing = 4
misc_group_layout.addWidget( @cleanup_lyrics_checkbox );
misc_group_layout.addWidget( @single_threaded_checkbox );
misc_group_layout.addWidget( @write_log_checkbox );
misc_group.setLayout( misc_group_layout );
layout = Qt::VBoxLayout.new( self )
layout.margin = 4
layout.spacing = 4
layout.addWidget( sites_group )
layout.addWidget( misc_group )
layout.addLayout( buttons )
connect( @move_up_button, SIGNAL( "clicked()" ), self, SLOT( "move_up()" ) )
connect( @move_down_button, SIGNAL( "clicked()" ), self, SLOT( "move_down()" ) )
connect( @add_button, SIGNAL( "clicked()" ), self, SLOT( "add_plugin()" ) )
connect( @remove_button, SIGNAL( "clicked()" ), self, SLOT( "remove_plugin()" ) )
update_accept_button()
resize( 430, 300 )
end
|