ruber 0.0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +339 -0
- data/INSTALL +137 -0
- data/LICENSE +8 -0
- data/bin/ruber +65 -0
- data/data/share/apps/ruber/core_components.yaml +31 -0
- data/data/share/apps/ruber/ruberui.rc +109 -0
- data/data/share/icons/ruber.png +0 -0
- data/data/share/pixmaps/ruby.png +0 -0
- data/icons/ruber-16.png +0 -0
- data/icons/ruber-32.png +0 -0
- data/icons/ruber-48.png +0 -0
- data/icons/ruber-8.png +0 -0
- data/lib/ruber/application/application.rb +288 -0
- data/lib/ruber/application/plugin.yaml +11 -0
- data/lib/ruber/component_manager.rb +899 -0
- data/lib/ruber/config/config.rb +82 -0
- data/lib/ruber/config/plugin.yaml +3 -0
- data/lib/ruber/document_project.rb +209 -0
- data/lib/ruber/documents/document_list.rb +416 -0
- data/lib/ruber/documents/plugin.yaml +4 -0
- data/lib/ruber/editor/document.rb +506 -0
- data/lib/ruber/editor/editor_view.rb +167 -0
- data/lib/ruber/editor/ktexteditor_wrapper.rb +202 -0
- data/lib/ruber/exception_widgets.rb +245 -0
- data/lib/ruber/external_program_plugin.rb +397 -0
- data/lib/ruber/filtered_output_widget.rb +342 -0
- data/lib/ruber/gui_states_handler.rb +231 -0
- data/lib/ruber/kde_config_option_backend.rb +167 -0
- data/lib/ruber/kde_sugar.rb +249 -0
- data/lib/ruber/main_window/choose_plugins_dlg.rb +353 -0
- data/lib/ruber/main_window/main_window.rb +524 -0
- data/lib/ruber/main_window/main_window_actions.rb +537 -0
- data/lib/ruber/main_window/main_window_internal.rb +239 -0
- data/lib/ruber/main_window/open_file_in_project_dlg.rb +212 -0
- data/lib/ruber/main_window/output_color_widget.rb +35 -0
- data/lib/ruber/main_window/plugin.yaml +58 -0
- data/lib/ruber/main_window/save_modified_files_dlg.rb +89 -0
- data/lib/ruber/main_window/status_bar.rb +156 -0
- data/lib/ruber/main_window/ui/choose_plugins_widget.rb +90 -0
- data/lib/ruber/main_window/ui/choose_plugins_widget.ui +77 -0
- data/lib/ruber/main_window/ui/main_window_settings_widget.rb +108 -0
- data/lib/ruber/main_window/ui/main_window_settings_widget.ui +89 -0
- data/lib/ruber/main_window/ui/new_project_widget.rb +119 -0
- data/lib/ruber/main_window/ui/new_project_widget.ui +178 -0
- data/lib/ruber/main_window/ui/open_file_in_project_dlg.rb +109 -0
- data/lib/ruber/main_window/ui/open_file_in_project_dlg.ui +168 -0
- data/lib/ruber/main_window/ui/output_color_widget.rb +241 -0
- data/lib/ruber/main_window/ui/output_color_widget.ui +204 -0
- data/lib/ruber/main_window/workspace.rb +442 -0
- data/lib/ruber/output_widget.rb +1093 -0
- data/lib/ruber/plugin.rb +264 -0
- data/lib/ruber/plugin_like.rb +589 -0
- data/lib/ruber/plugin_specification.rb +106 -0
- data/lib/ruber/plugin_specification_reader.rb +451 -0
- data/lib/ruber/project.rb +493 -0
- data/lib/ruber/project_backend.rb +105 -0
- data/lib/ruber/projects/plugin.yaml +11 -0
- data/lib/ruber/projects/project_files_list.rb +314 -0
- data/lib/ruber/projects/project_files_widget.rb +301 -0
- data/lib/ruber/projects/project_list.rb +314 -0
- data/lib/ruber/projects/ui/project_files_rule_chooser_widget.rb +74 -0
- data/lib/ruber/projects/ui/project_files_rule_chooser_widget.ui +61 -0
- data/lib/ruber/projects/ui/project_files_widget.rb +117 -0
- data/lib/ruber/projects/ui/project_files_widget.ui +123 -0
- data/lib/ruber/qt_sugar.rb +673 -0
- data/lib/ruber/settings_container.rb +515 -0
- data/lib/ruber/settings_dialog.rb +244 -0
- data/lib/ruber/settings_dialog_manager.rb +503 -0
- data/lib/ruber/utils.rb +414 -0
- data/lib/ruber/yaml_option_backend.rb +159 -0
- data/outsider_files +15 -0
- data/plugins/autosave/autosave.rb +404 -0
- data/plugins/autosave/plugin.yaml +16 -0
- data/plugins/autosave/ui/autosave_config_widget.rb +83 -0
- data/plugins/autosave/ui/autosave_config_widget.ui +68 -0
- data/plugins/command/command.png +0 -0
- data/plugins/command/command.rb +74 -0
- data/plugins/command/plugin.yaml +11 -0
- data/plugins/find_in_files/find_in_files.rb +337 -0
- data/plugins/find_in_files/find_in_files_dlg.rb +411 -0
- data/plugins/find_in_files/find_in_files_ui.rc +11 -0
- data/plugins/find_in_files/find_in_files_widgets.rb +485 -0
- data/plugins/find_in_files/plugin.yaml +23 -0
- data/plugins/find_in_files/ui/config_widget.rb +58 -0
- data/plugins/find_in_files/ui/config_widget.ui +41 -0
- data/plugins/find_in_files/ui/find_in_files_widget.rb +260 -0
- data/plugins/find_in_files/ui/find_in_files_widget.ui +324 -0
- data/plugins/project_browser/plugin.yaml +10 -0
- data/plugins/project_browser/project_browser.rb +245 -0
- data/plugins/rake/plugin.yaml +39 -0
- data/plugins/rake/rake.png +0 -0
- data/plugins/rake/rake.rb +567 -0
- data/plugins/rake/rake_extension.rb +153 -0
- data/plugins/rake/rake_widgets.rb +615 -0
- data/plugins/rake/rakeui.rc +27 -0
- data/plugins/rake/ui/add_quick_task_widget.rb +71 -0
- data/plugins/rake/ui/add_quick_task_widget.ui +59 -0
- data/plugins/rake/ui/choose_task_widget.rb +77 -0
- data/plugins/rake/ui/choose_task_widget.ui +72 -0
- data/plugins/rake/ui/config_widget.rb +127 -0
- data/plugins/rake/ui/config_widget.ui +123 -0
- data/plugins/rake/ui/project_widget.rb +217 -0
- data/plugins/rake/ui/project_widget.ui +246 -0
- data/plugins/rspec/plugin.yaml +30 -0
- data/plugins/rspec/rspec.png +0 -0
- data/plugins/rspec/rspec.rb +945 -0
- data/plugins/rspec/rspec.svg +90 -0
- data/plugins/rspec/rspecui.rc +20 -0
- data/plugins/rspec/ruber_rspec_formatter.rb +312 -0
- data/plugins/rspec/ui/rspec_project_widget.rb +170 -0
- data/plugins/rspec/ui/rspec_project_widget.ui +193 -0
- data/plugins/ruby_development/plugin.yaml +27 -0
- data/plugins/ruby_development/ruby_development.png +0 -0
- data/plugins/ruby_development/ruby_development.rb +453 -0
- data/plugins/ruby_development/ruby_developmentui.rc +19 -0
- data/plugins/ruby_development/ui/project_widget.rb +112 -0
- data/plugins/ruby_development/ui/project_widget.ui +108 -0
- data/plugins/ruby_runner/config_widget.rb +116 -0
- data/plugins/ruby_runner/plugin.yaml +26 -0
- data/plugins/ruby_runner/project_widget.rb +62 -0
- data/plugins/ruby_runner/ruby.png +0 -0
- data/plugins/ruby_runner/ruby_interpretersui.rc +26 -0
- data/plugins/ruby_runner/ruby_runner.rb +411 -0
- data/plugins/ruby_runner/ui/config_widget.rb +92 -0
- data/plugins/ruby_runner/ui/config_widget.ui +91 -0
- data/plugins/ruby_runner/ui/project_widget.rb +60 -0
- data/plugins/ruby_runner/ui/project_widget.ui +48 -0
- data/plugins/ruby_runner/ui/ruby_runnner_plugin_option_widget.rb +59 -0
- data/plugins/ruby_runner/ui/ruby_runnner_plugin_option_widget.ui +44 -0
- data/plugins/state/plugin.yaml +28 -0
- data/plugins/state/state.rb +520 -0
- data/plugins/state/ui/config_widget.rb +92 -0
- data/plugins/state/ui/config_widget.ui +89 -0
- data/plugins/syntax_checker/plugin.yaml +18 -0
- data/plugins/syntax_checker/syntax_checker.rb +662 -0
- data/ruber.desktop +10 -0
- data/spec/annotation_model_spec.rb +174 -0
- data/spec/common.rb +119 -0
- data/spec/component_manager_spec.rb +1259 -0
- data/spec/document_list_spec.rb +626 -0
- data/spec/document_project_spec.rb +373 -0
- data/spec/document_spec.rb +779 -0
- data/spec/editor_view_spec.rb +167 -0
- data/spec/external_program_plugin_spec.rb +676 -0
- data/spec/filtered_output_widget_spec.rb +642 -0
- data/spec/gui_states_handler_spec.rb +304 -0
- data/spec/kde_config_option_backend_spec.rb +214 -0
- data/spec/kde_sugar_spec.rb +101 -0
- data/spec/ktexteditor_wrapper_spec.rb +305 -0
- data/spec/output_widget_spec.rb +1703 -0
- data/spec/plugin_spec.rb +1393 -0
- data/spec/plugin_specification_reader_spec.rb +1765 -0
- data/spec/plugin_specification_spec.rb +401 -0
- data/spec/project_backend_spec.rb +172 -0
- data/spec/project_files_list_spec.rb +401 -0
- data/spec/project_list_spec.rb +511 -0
- data/spec/project_spec.rb +990 -0
- data/spec/qt_sugar_spec.rb +328 -0
- data/spec/settings_container_spec.rb +617 -0
- data/spec/settings_dialog_manager_spec.rb +773 -0
- data/spec/settings_dialog_spec.rb +419 -0
- data/spec/state_spec.rb +991 -0
- data/spec/utils_spec.rb +406 -0
- data/spec/workspace_spec.rb +869 -0
- data/spec/yaml_option_backend_spec.rb +246 -0
- metadata +284 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (C) 2010 by Stefano Crocco
|
|
3
|
+
stefano.crocco@alice.it
|
|
4
|
+
|
|
5
|
+
This program is free software; you can redistribute it andor modify
|
|
6
|
+
it under the terms of the GNU General Public License as published by
|
|
7
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program; if not, write to the
|
|
17
|
+
Free Software Foundation, Inc.,
|
|
18
|
+
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
19
|
+
=end
|
|
20
|
+
|
|
21
|
+
require 'ruber/main_window/save_modified_files_dlg'
|
|
22
|
+
require 'ruber/main_window/open_file_in_project_dlg'
|
|
23
|
+
require_relative 'ui/main_window_settings_widget'
|
|
24
|
+
require 'ruber/main_window/choose_plugins_dlg'
|
|
25
|
+
require 'ruber/main_window/ui/new_project_widget'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
module Ruber
|
|
29
|
+
|
|
30
|
+
class MainWindow < KParts::MainWindow
|
|
31
|
+
|
|
32
|
+
slots 'open_recent_project(KUrl)', :close_current_project, :open_file,
|
|
33
|
+
:open_project, :open_file_in_project, :preferences, :choose_plugins,
|
|
34
|
+
:new_project, :configure_project, 'open_recent_file(KUrl)',
|
|
35
|
+
:close_current, :close_other_views, :save_all, :new_file, :activate_editor,
|
|
36
|
+
:close_all_views, 'activate_editor(int)', :close_current_editor, :focus_on_editor,
|
|
37
|
+
'add_about_plugin_action(QObject*)', 'remove_about_plugin_action(QObject*)',
|
|
38
|
+
:display_about_plugin_dlg, :configure_document, :toggle_tool_widget
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
=begin rdoc
|
|
43
|
+
Slot connected to the 'New File' action
|
|
44
|
+
|
|
45
|
+
It creates and activates a new, empty file
|
|
46
|
+
|
|
47
|
+
@return [nil]
|
|
48
|
+
=end
|
|
49
|
+
def new_file
|
|
50
|
+
display_doc Ruber[:docs].new_document
|
|
51
|
+
nil
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
=begin rdoc
|
|
55
|
+
Slot connected to the 'Open File' action.
|
|
56
|
+
|
|
57
|
+
It opens in an editor and activates a document associated with a file chosen by the
|
|
58
|
+
user with an OpenFile dialog (the document is created if needed). It also adds
|
|
59
|
+
the file to the list of recently opened files.
|
|
60
|
+
|
|
61
|
+
@return [nil]
|
|
62
|
+
=end
|
|
63
|
+
def open_file
|
|
64
|
+
dir = KDE::Url.from_path(Ruber.current_project.project_directory) rescue KDE::Url.new
|
|
65
|
+
filenames = KDE::FileDialog.get_open_urls(dir, OPEN_DLG_FILTERS.join("\n") , self)
|
|
66
|
+
without_activating do
|
|
67
|
+
filenames.each{|f| gui_open_file f}
|
|
68
|
+
end
|
|
69
|
+
nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
=begin rdoc
|
|
73
|
+
Slot connected to the 'Open Recent File' action
|
|
74
|
+
|
|
75
|
+
It opens the file associated with the specified URL in an editor and gives it focus
|
|
76
|
+
|
|
77
|
+
@param [KDE::Url] the url of the file to open
|
|
78
|
+
@return [nil]
|
|
79
|
+
=end
|
|
80
|
+
def open_recent_file url
|
|
81
|
+
gui_open_file url.path
|
|
82
|
+
nil
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
=begin rdoc
|
|
86
|
+
Slot connected to the 'Close Current' action
|
|
87
|
+
|
|
88
|
+
It closes the current editor, if any. If the documents is modified,
|
|
89
|
+
it allows the user to choose what to do via a dialog. If the user chooses to abort
|
|
90
|
+
closing, nothing is done
|
|
91
|
+
|
|
92
|
+
@return [nil]
|
|
93
|
+
=end
|
|
94
|
+
def close_current_editor
|
|
95
|
+
close_editor active_editor if active_editor
|
|
96
|
+
nil
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
=begin rdoc
|
|
100
|
+
Slot connected to the 'Close All Other' action
|
|
101
|
+
|
|
102
|
+
It closes all the editors except the current one. If some documents are modified,
|
|
103
|
+
it allows the user to choose what to do via a dialog. If the user chooses to abort
|
|
104
|
+
closing, nothing is done.
|
|
105
|
+
|
|
106
|
+
@return [nil]
|
|
107
|
+
=end
|
|
108
|
+
def close_other_views
|
|
109
|
+
to_close = @views.select{|w| w != @views.current_widget}.map{|w| w.document}
|
|
110
|
+
if save_documents to_close
|
|
111
|
+
without_activating do
|
|
112
|
+
to_close.dup.each{|d| d.close_view d.view, false}
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
nil
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
=begin rdoc
|
|
119
|
+
Slot connected with the 'Close All' action
|
|
120
|
+
|
|
121
|
+
It closes all the editors. If some documents are modified,
|
|
122
|
+
it allows the user to choose what to do via a dialog. If the user chooses to abort
|
|
123
|
+
closing, nothing is done.
|
|
124
|
+
|
|
125
|
+
@return [nil]
|
|
126
|
+
=end
|
|
127
|
+
def close_all_views ask = true
|
|
128
|
+
return if ask and !save_documents @views.map{|v| v.document}
|
|
129
|
+
without_activating do
|
|
130
|
+
@views.to_a.each do |w|
|
|
131
|
+
close_editor w, false
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
nil
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
=begin rdoc
|
|
138
|
+
Slot connected to the 'Open Recent Projet' action
|
|
139
|
+
|
|
140
|
+
It opens a project and activates a project
|
|
141
|
+
|
|
142
|
+
@param [KDE::Url] the url of the project file to open
|
|
143
|
+
@return [nil]
|
|
144
|
+
=end
|
|
145
|
+
def open_recent_project url
|
|
146
|
+
return unless safe_open_project url.path
|
|
147
|
+
action_collection.action('project-open_recent').add_url url, url.file_name
|
|
148
|
+
nil
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
=begin rdoc
|
|
152
|
+
Slot connected to the 'Open Project' action
|
|
153
|
+
|
|
154
|
+
It opens the project chosen by the user using an open dialog
|
|
155
|
+
|
|
156
|
+
@return [nil]
|
|
157
|
+
=end
|
|
158
|
+
def open_project
|
|
159
|
+
filename = KDE::FileDialog.get_open_file_name KDE::Url.from_path(
|
|
160
|
+
ENV['HOME'] ), '*.ruprj|Ruber project files (*.ruprj)', self,
|
|
161
|
+
KDE::i18n('Open project')
|
|
162
|
+
return unless filename
|
|
163
|
+
prj = safe_open_project filename
|
|
164
|
+
url = KDE::Url.new prj.project_file
|
|
165
|
+
action_collection.action('project-open_recent').add_url url, url.file_name
|
|
166
|
+
nil
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
=begin rdoc
|
|
170
|
+
Slot connectedto the 'Close Current Project' action
|
|
171
|
+
=end
|
|
172
|
+
def close_current_project
|
|
173
|
+
unless Ruber[:projects].current_project.close
|
|
174
|
+
KDE::MessageBox.sorry self, "The project couldn't be saved"
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
=begin rdoc
|
|
179
|
+
Slot connected to the 'Quick Open File' action
|
|
180
|
+
|
|
181
|
+
It opens the file chosen by the user in a quick open file dialog
|
|
182
|
+
|
|
183
|
+
@retrun [nil]
|
|
184
|
+
=end
|
|
185
|
+
def open_file_in_project
|
|
186
|
+
dlg = OpenFileInProjectDlg.new self
|
|
187
|
+
if dlg.exec == Qt::Dialog::Accepted
|
|
188
|
+
display_doc dlg.chosen_file
|
|
189
|
+
action_collection.action( 'file_open_recent').add_url( KDE::Url.new(dlg.chosen_file) )
|
|
190
|
+
end
|
|
191
|
+
nil
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
=begin rdoc
|
|
195
|
+
Slot connected to the 'Configure Ruber' action
|
|
196
|
+
|
|
197
|
+
It displays the configuration dialog
|
|
198
|
+
|
|
199
|
+
@return [nil]
|
|
200
|
+
=end
|
|
201
|
+
def preferences
|
|
202
|
+
Ruber[:config].dialog.exec
|
|
203
|
+
nil
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
=begin rdoc
|
|
207
|
+
Slot connected with the 'Choose Plugins' action
|
|
208
|
+
|
|
209
|
+
It displays the choose plugins dialog then (unless the user canceled the dialog)
|
|
210
|
+
unloads all plugins and reloads them.
|
|
211
|
+
|
|
212
|
+
If there's a problem while reloading the plugins, the application is closed after
|
|
213
|
+
informing the user
|
|
214
|
+
|
|
215
|
+
@return [nil]
|
|
216
|
+
=end
|
|
217
|
+
def choose_plugins
|
|
218
|
+
dlg = ChoosePluginsDlg.new self
|
|
219
|
+
return if dlg.exec == Qt::Dialog::Rejected
|
|
220
|
+
loaded = []
|
|
221
|
+
Ruber[:components].plugins.each do |pl|
|
|
222
|
+
pl.save_settings
|
|
223
|
+
loaded << pl.plugin_name
|
|
224
|
+
end
|
|
225
|
+
loaded.each{|pl| Ruber[:components].unload_plugin pl}
|
|
226
|
+
res = Ruber[:app].safe_load_plugins dlg.plugins.keys.map(&:to_s)
|
|
227
|
+
close unless res
|
|
228
|
+
nil
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
=begin rdoc
|
|
232
|
+
Slot connected with the 'Configure Project' action
|
|
233
|
+
|
|
234
|
+
It displays the configure project dialog for the current project. It does nothing
|
|
235
|
+
if there's no active project
|
|
236
|
+
|
|
237
|
+
@return [nil]
|
|
238
|
+
=end
|
|
239
|
+
def configure_project
|
|
240
|
+
prj = Ruber.current_project
|
|
241
|
+
raise "No project is selected" unless prj
|
|
242
|
+
prj.dialog.exec
|
|
243
|
+
nil
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
=begin rdoc
|
|
247
|
+
Slot connected with the 'New Project' action
|
|
248
|
+
|
|
249
|
+
It displays the new project dialog. Unless the user cancels the dialog, it creates
|
|
250
|
+
the project directory and creates and saves a new project with the parameters chosen
|
|
251
|
+
by the user. The new project is then activated. If there was another active project,
|
|
252
|
+
it's closed
|
|
253
|
+
|
|
254
|
+
@return [nil]
|
|
255
|
+
=end
|
|
256
|
+
def new_project
|
|
257
|
+
dlg = NewProjectDialog.new self
|
|
258
|
+
return if dlg.exec == Qt::Dialog::Rejected
|
|
259
|
+
dir = File.dirname dlg.project_file
|
|
260
|
+
FileUtils.mkdir dir
|
|
261
|
+
prj = Ruber[:projects].new_project dlg.project_file, dlg.project_name
|
|
262
|
+
prj.save
|
|
263
|
+
action_collection.action('project-open_recent').add_url KDE::Url.new(dlg.project_file)
|
|
264
|
+
Ruber[:projects].close_current_project if Ruber[:projects].current
|
|
265
|
+
Ruber[:projects].current_project = prj
|
|
266
|
+
nil
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
=begin rdoc
|
|
270
|
+
Slot connected with the 'Next Document' action
|
|
271
|
+
|
|
272
|
+
Makes the editor to the right of the current one active. If there's no editor to
|
|
273
|
+
the right, the first editor becomes active
|
|
274
|
+
|
|
275
|
+
@return [nil]
|
|
276
|
+
=end
|
|
277
|
+
def next_document
|
|
278
|
+
idx = @views.current_index
|
|
279
|
+
new_idx = idx + 1 < @views.count ? idx + 1 : 0
|
|
280
|
+
activate_editor new_idx
|
|
281
|
+
nil
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
=begin rdoc
|
|
285
|
+
Slot connected with the 'Previous Document' action
|
|
286
|
+
|
|
287
|
+
Makes the editor to the left of the current one active. If there's no editor to
|
|
288
|
+
the left, the last editor becomes active
|
|
289
|
+
|
|
290
|
+
@return [nil]
|
|
291
|
+
=end
|
|
292
|
+
def previous_document
|
|
293
|
+
idx = @views.current_index
|
|
294
|
+
new_idx = idx > 0 ? idx - 1 : @views.count - 1
|
|
295
|
+
activate_editor new_idx
|
|
296
|
+
nil
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
=begin rdoc
|
|
300
|
+
Slot connected to the 'Ruber User Manual' action
|
|
301
|
+
|
|
302
|
+
Opens the user's browser and points it to the user manual
|
|
303
|
+
|
|
304
|
+
@return [nil]
|
|
305
|
+
=end
|
|
306
|
+
def show_user_manual
|
|
307
|
+
KDE::Run.run_url KDE::Url.new('http://stcrocco.github.com/ruber/user_manual'), 'text/html', self
|
|
308
|
+
nil
|
|
309
|
+
end
|
|
310
|
+
slots :show_user_manual
|
|
311
|
+
|
|
312
|
+
=begin rdoc
|
|
313
|
+
Slot connected to the actions in the "about_plugins_list" action list.
|
|
314
|
+
|
|
315
|
+
Displays a dialog with the about data regarding a plugin. The plugin to use is
|
|
316
|
+
determined from the triggered action
|
|
317
|
+
|
|
318
|
+
@return [nil]
|
|
319
|
+
=end
|
|
320
|
+
def display_about_plugin_dlg
|
|
321
|
+
name = sender.object_name.to_sym
|
|
322
|
+
data = Ruber[name].about_data
|
|
323
|
+
dlg = KDE::AboutApplicationDialog.new data, self
|
|
324
|
+
dlg.exec
|
|
325
|
+
nil
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
=begin rdoc
|
|
329
|
+
Creates an About entry for a component in the "about plugins list" of the Help menu
|
|
330
|
+
|
|
331
|
+
*Notes:*
|
|
332
|
+
# this method doesn't check whether the action already exists for the given
|
|
333
|
+
plugin. Since it's usually called in response to the {ComponentManager#component_loaded component_loaded}
|
|
334
|
+
signal of the component manager, there shouldn't be problems with this
|
|
335
|
+
# this method does nothing for core components
|
|
336
|
+
|
|
337
|
+
@param [Plugin] comp the plugin object of the plugin to create the action for
|
|
338
|
+
@return [nil]
|
|
339
|
+
=end
|
|
340
|
+
def add_about_plugin_action comp
|
|
341
|
+
name = comp.plugin_name
|
|
342
|
+
return unless comp.is_a? Plugin
|
|
343
|
+
unplug_action_list 'about_plugins_list'
|
|
344
|
+
a = action_collection.add_action "__about_#{name}", self, SLOT(:display_about_plugin_dlg)
|
|
345
|
+
a.object_name = name.to_s
|
|
346
|
+
a.text = comp.plugin_description.about.human_name
|
|
347
|
+
unless comp.plugin_description.about.icon.empty?
|
|
348
|
+
a.icon = KDE::Icon.new(comp.plugin_description.about.icon)
|
|
349
|
+
end
|
|
350
|
+
@about_plugin_actions << a
|
|
351
|
+
plug_action_list 'about_plugins_list', @about_plugin_actions
|
|
352
|
+
nil
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
=begin rdoc
|
|
356
|
+
Removes the About entry for the given menu from the "about plugins list" of the Help menu
|
|
357
|
+
|
|
358
|
+
*Notes:*
|
|
359
|
+
# this method doesn't check whether the action for the given
|
|
360
|
+
plugin actually exists. Since it's usually called in response to the {ComponentManager#unloading_component unloading_component}
|
|
361
|
+
signal of the component manager, there shouldn't be problems with this
|
|
362
|
+
# this method does nothing for core components
|
|
363
|
+
|
|
364
|
+
@param [Plugin] comp the plugin object of the plugin to remove the action for
|
|
365
|
+
@return [nil]
|
|
366
|
+
=end
|
|
367
|
+
def remove_about_plugin_action comp
|
|
368
|
+
name = comp.plugin_name.to_s
|
|
369
|
+
return unless comp.is_a? Plugin
|
|
370
|
+
unplug_action_list 'about_plugins_list'
|
|
371
|
+
a = @about_plugin_actions.find{|i| i.object_name == comp.plugin_name.to_s}
|
|
372
|
+
@about_plugin_actions.delete a
|
|
373
|
+
plug_action_list 'about_plugins_list', @about_plugin_actions
|
|
374
|
+
a.delete_later
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
=begin rdoc
|
|
378
|
+
Slot associated with the Configure Document action
|
|
379
|
+
|
|
380
|
+
Displays the configuration dialog for the current document, if it exists
|
|
381
|
+
|
|
382
|
+
@return [nil]
|
|
383
|
+
=end
|
|
384
|
+
def configure_document
|
|
385
|
+
current_document.own_project.dialog.exec
|
|
386
|
+
nil
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
=begin rdoc
|
|
390
|
+
Slot associated with the Toggle * Tool Widget
|
|
391
|
+
|
|
392
|
+
It identifies the tool widget to toggle basing on the name of the triggered action
|
|
393
|
+
|
|
394
|
+
@return [nil]
|
|
395
|
+
=end
|
|
396
|
+
def toggle_tool_widget
|
|
397
|
+
side = sender.object_name.match(/(left|right|bottom)/)[1].to_sym
|
|
398
|
+
w = @workspace.current_widget(side)
|
|
399
|
+
return unless w
|
|
400
|
+
@workspace.toggle_tool w
|
|
401
|
+
nil
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
=begin rdoc
|
|
407
|
+
Class containing the settings associated with the main window
|
|
408
|
+
=end
|
|
409
|
+
class MainWindowSettingsWidget < Qt::Widget
|
|
410
|
+
|
|
411
|
+
=begin rdoc
|
|
412
|
+
@param [Qt::Widget,nil] parent the parent widget
|
|
413
|
+
=end
|
|
414
|
+
def initialize parent = nil
|
|
415
|
+
super
|
|
416
|
+
@ui = Ui::MainWindowSettingsWidget.new
|
|
417
|
+
@ui.setupUi self
|
|
418
|
+
@ui._general__default_script_directory.mode = KDE::File::Directory
|
|
419
|
+
@ui._general__default_project_directory.mode = KDE::File::Directory
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
=begin rdoc
|
|
423
|
+
Override of @Qt::Widget#sizeHint@
|
|
424
|
+
|
|
425
|
+
@return [Qt::Size] the suggested size for the widget
|
|
426
|
+
=end
|
|
427
|
+
def sizeHint
|
|
428
|
+
Qt::Size.new(380,150)
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
=begin rdoc
|
|
434
|
+
Dialog where the user enters the parameters to create a new project
|
|
435
|
+
=end
|
|
436
|
+
class NewProjectDialog < KDE::Dialog
|
|
437
|
+
|
|
438
|
+
=begin rdoc
|
|
439
|
+
Main widget for the {NewProjectDialog}
|
|
440
|
+
=end
|
|
441
|
+
class NewProjectWidget < Qt::Widget
|
|
442
|
+
|
|
443
|
+
=begin rdoc
|
|
444
|
+
Signal emitted when the user changes the data in the widget
|
|
445
|
+
|
|
446
|
+
@param [Boolean] complete whether or not the user has filled all the necessary
|
|
447
|
+
fields with correct data
|
|
448
|
+
=end
|
|
449
|
+
signals 'complete_status_changed(bool)'
|
|
450
|
+
|
|
451
|
+
slots 'data_changed()'
|
|
452
|
+
|
|
453
|
+
=begin rdoc
|
|
454
|
+
@param [Qt::Widget,nil] parent the parent widget
|
|
455
|
+
=end
|
|
456
|
+
def initialize parent = nil
|
|
457
|
+
super
|
|
458
|
+
@ui = Ui::NewProjectWidget.new
|
|
459
|
+
@ui.setupUi self
|
|
460
|
+
@ui.container_dir.url = KDE::Url.new Ruber[:config][:general, :default_project_directory]
|
|
461
|
+
@ui.container_dir.mode = KDE::File::Directory | KDE::File::LocalOnly|
|
|
462
|
+
KDE::File::ExistingOnly
|
|
463
|
+
connect @ui.project_name, SIGNAL('textChanged(QString)'), self, SLOT('data_changed()')
|
|
464
|
+
connect @ui.container_dir, SIGNAL('textChanged(QString)'), self, SLOT('data_changed()')
|
|
465
|
+
@ui.project_name.set_focus
|
|
466
|
+
self.focus_proxy = @ui.project_name
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
=begin rdoc
|
|
470
|
+
@return [String] the name chosen by the user for the project
|
|
471
|
+
=end
|
|
472
|
+
def project_name
|
|
473
|
+
@ui.project_name.text
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
=begin rdoc
|
|
477
|
+
@return [String] the path of the project file
|
|
478
|
+
=end
|
|
479
|
+
def project_file
|
|
480
|
+
@ui.final_location.text
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
private
|
|
484
|
+
|
|
485
|
+
=begin rdoc
|
|
486
|
+
Slot called whenever the user changes data in the widget
|
|
487
|
+
|
|
488
|
+
It updates the Final location widget, displays the Invalid final location message
|
|
489
|
+
if the project directory already exists and emit the {#complete_status_changed}
|
|
490
|
+
signal
|
|
491
|
+
|
|
492
|
+
@return [nil]
|
|
493
|
+
=end
|
|
494
|
+
def data_changed
|
|
495
|
+
name = @ui.project_name.text
|
|
496
|
+
container = @ui.container_dir.url.path || ''
|
|
497
|
+
file = name.gsub(/\W/,'_')
|
|
498
|
+
@ui.final_location.text = File.join container, file, "#{file}.ruprj"
|
|
499
|
+
valid_container = File.exist?(container)
|
|
500
|
+
valid = (valid_container and !(name.empty? or container.empty? or
|
|
501
|
+
File.exist? File.join(container, file)))
|
|
502
|
+
@ui.invalid_project.text = valid ? '' : 'Invalid final location'
|
|
503
|
+
emit complete_status_changed(valid)
|
|
504
|
+
nil
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
=begin rdoc
|
|
510
|
+
@param [Qt::Widget,nil] parent the parent widget
|
|
511
|
+
=end
|
|
512
|
+
def initialize parent = Ruber[:main_window]
|
|
513
|
+
super
|
|
514
|
+
self.caption = 'New Project'
|
|
515
|
+
self.main_widget = NewProjectWidget.new self
|
|
516
|
+
enableButtonOk false
|
|
517
|
+
self.main_widget.set_focus
|
|
518
|
+
connect main_widget, SIGNAL('complete_status_changed(bool)'), self, SLOT('enableButtonOk(bool)')
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
=begin rdoc
|
|
522
|
+
@return [String] the path of the project file
|
|
523
|
+
=end
|
|
524
|
+
def project_file
|
|
525
|
+
main_widget.project_file
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
=begin rdoc
|
|
529
|
+
@return [String] the name chosen by the user for the project
|
|
530
|
+
=end
|
|
531
|
+
def project_name
|
|
532
|
+
main_widget.project_name
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
end
|
|
536
|
+
|
|
537
|
+
end
|