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,314 @@
|
|
|
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/project'
|
|
22
|
+
require 'ruber/plugin_like'
|
|
23
|
+
|
|
24
|
+
module Ruber
|
|
25
|
+
|
|
26
|
+
=begin rdoc
|
|
27
|
+
The current project
|
|
28
|
+
|
|
29
|
+
@return [Ruber::Project,nil] the current project or *nil* if no project is open
|
|
30
|
+
=end
|
|
31
|
+
def self.current_project
|
|
32
|
+
self[:projects].current_project
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
=begin rdoc
|
|
36
|
+
List of all open global projects
|
|
37
|
+
|
|
38
|
+
It allows to obtain a list of the open projects, to know when a project is
|
|
39
|
+
closed and keeps trace of which is the current project. The most common usage
|
|
40
|
+
is the following:
|
|
41
|
+
* use the {#project} method to retrieve an open project basing on the name of
|
|
42
|
+
its file, or to open it if it isn't already open, or to create a new project.
|
|
43
|
+
This will also cause the project to be added to the list of open projects,
|
|
44
|
+
if needed
|
|
45
|
+
* use {#current_project=} to set the current project
|
|
46
|
+
* use one of the methods to iterate or work with one of the projects
|
|
47
|
+
* close one of the projects with the project's {Project#close close} method, or use the
|
|
48
|
+
{#close_current_project} method to close the current project.
|
|
49
|
+
=end
|
|
50
|
+
class ProjectList < Qt::Object
|
|
51
|
+
|
|
52
|
+
include PluginLike
|
|
53
|
+
|
|
54
|
+
include Enumerable
|
|
55
|
+
|
|
56
|
+
=begin rdoc
|
|
57
|
+
Signal emitted when the current project changes
|
|
58
|
+
|
|
59
|
+
@param [Ruber::Project,nil] prj the new current project, or *nil* if there's no open
|
|
60
|
+
project
|
|
61
|
+
=end
|
|
62
|
+
signals 'current_project_changed(QObject*)'
|
|
63
|
+
|
|
64
|
+
=begin rdoc
|
|
65
|
+
Signal emitted just before a project is closed
|
|
66
|
+
|
|
67
|
+
@param [Ruber::Project] prj the project which is being closed
|
|
68
|
+
=end
|
|
69
|
+
signals 'closing_project(QObject*)'
|
|
70
|
+
|
|
71
|
+
=begin rdoc
|
|
72
|
+
Signal emitted whenever a project is added
|
|
73
|
+
|
|
74
|
+
@param [Ruber::Project] prj the newly added project
|
|
75
|
+
=end
|
|
76
|
+
signals 'project_added(QObject*)'
|
|
77
|
+
|
|
78
|
+
slots 'add_project(QObject*)', 'close_project(QObject*)', 'load_settings()'
|
|
79
|
+
|
|
80
|
+
=begin rdoc
|
|
81
|
+
@return [Ruber::Project,nil] the current project or *nil* if there's no open project
|
|
82
|
+
=end
|
|
83
|
+
attr_reader :current_project
|
|
84
|
+
alias_method :current, :current_project
|
|
85
|
+
|
|
86
|
+
=begin rdoc
|
|
87
|
+
@param [Ruber::ComponentManager] _manager (unused)
|
|
88
|
+
@param [Ruber::PluginSpecification] psf the plugin specification object describing
|
|
89
|
+
the component
|
|
90
|
+
=end
|
|
91
|
+
def initialize _manager, psf
|
|
92
|
+
super Ruber[:app]
|
|
93
|
+
initialize_plugin psf
|
|
94
|
+
@current_project = nil
|
|
95
|
+
@projects = {}
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
=begin rdoc
|
|
99
|
+
Iterates on all the projects
|
|
100
|
+
|
|
101
|
+
In both versions of the method, the order in which the projects are passed to the block is arbitrary
|
|
102
|
+
|
|
103
|
+
@overload each_project
|
|
104
|
+
Passes each open project to the block in turn
|
|
105
|
+
|
|
106
|
+
@yield [prj] one of the projects
|
|
107
|
+
@return [Ruber::ProjectList] *self*
|
|
108
|
+
@overload each_project
|
|
109
|
+
@return [Enumerator] an enumerator whose @each@ method yields all the projects
|
|
110
|
+
in turn
|
|
111
|
+
=end
|
|
112
|
+
def each_project &blk #:yields: project
|
|
113
|
+
res = @projects.each_value &blk
|
|
114
|
+
res.same?(@projects) ? self : res
|
|
115
|
+
end
|
|
116
|
+
alias each each_project
|
|
117
|
+
|
|
118
|
+
=begin rdoc
|
|
119
|
+
The existing projects
|
|
120
|
+
|
|
121
|
+
@return [Array<Ruber::Project>] the existing projects. Modifying the array
|
|
122
|
+
wont affect the @ProjectList@
|
|
123
|
+
=end
|
|
124
|
+
def projects
|
|
125
|
+
@projects.values
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
=begin rdoc
|
|
129
|
+
Returns the project associated with a project file, opening it if necessary
|
|
130
|
+
|
|
131
|
+
This is one of the core methods of this class. It searchs the list of open projects
|
|
132
|
+
and return the one corresponding to the given project file. If a project for that
|
|
133
|
+
file isn't open, it will be opened and added to the list of open projects.
|
|
134
|
+
|
|
135
|
+
If, for any reason, you create a project using @Project.new@ instead of
|
|
136
|
+
using this method, you'll need to add it to the project list yourself using
|
|
137
|
+
{#add_project}.
|
|
138
|
+
|
|
139
|
+
@param [String] file the absolute path of the project file
|
|
140
|
+
@return [Ruber::Project] the project corresponding to the project file _file_
|
|
141
|
+
@raise an error deriving from @SystemCallError@ if the project file doesn't exist
|
|
142
|
+
or can't be opened
|
|
143
|
+
@raise {Ruber::AbstractProject::InvalidProjectFile} if _file_ isn't a valid project file
|
|
144
|
+
=end
|
|
145
|
+
def project file
|
|
146
|
+
@projects[file] || add_project(Project.new(file))
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
=begin rdoc
|
|
150
|
+
Returns the project corresponding to a given file or with a given name
|
|
151
|
+
|
|
152
|
+
@overload [] name
|
|
153
|
+
Returns the project with the given name
|
|
154
|
+
@param [String] name the name of the project. It *must not* start with a slash (@/@)
|
|
155
|
+
@return [Ruber::Project,nil] the project with name _name_ or *nil* if no open
|
|
156
|
+
project with that name exists. If more than one project with that name exist,
|
|
157
|
+
which will be returned is arbitrary
|
|
158
|
+
@overload [] file
|
|
159
|
+
Returns the project corresponding to the given project file
|
|
160
|
+
@param [String] file the absolute path of the project file
|
|
161
|
+
@return [Ruber::Project,nil] the project corresponding to the project file _file_
|
|
162
|
+
or *nil* if no open projects correspond to that file. Note that, unlike {#project},
|
|
163
|
+
this method doesn't attempt to open the project corresponding to _file_ if it
|
|
164
|
+
isn't already open
|
|
165
|
+
=end
|
|
166
|
+
def [] arg
|
|
167
|
+
if arg[0,1] == '/' then @projects[arg]
|
|
168
|
+
else
|
|
169
|
+
find{|prj| prj.project_name == arg}
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
=begin rdoc
|
|
174
|
+
Creates a new empty project
|
|
175
|
+
|
|
176
|
+
After being created, the new project is added to the list. You almost always should
|
|
177
|
+
use this method, rather than calling {AbstractProject.new} to create a new empty
|
|
178
|
+
project.
|
|
179
|
+
|
|
180
|
+
@param [String] file the absolue path of the project file to associate with the
|
|
181
|
+
new project
|
|
182
|
+
@param [String] name the name of the new project
|
|
183
|
+
@return [Ruber::Project] the new project
|
|
184
|
+
@raise @RuntimeError@ if a file corresponding to the path _file_ already exists
|
|
185
|
+
=end
|
|
186
|
+
def new_project file, name
|
|
187
|
+
add_project Project.new( file, name )
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
=begin rdoc
|
|
191
|
+
Makes a project active
|
|
192
|
+
|
|
193
|
+
The previously active project is deactivated, while the new one (unless *nil*)
|
|
194
|
+
will be activated (calling respectively the the projects' @deactivate@ and @activate@
|
|
195
|
+
methods)
|
|
196
|
+
|
|
197
|
+
@param [Ruber::Project,nil] prj the project to make current. If *nil*, the current
|
|
198
|
+
project will be deactivated, but no other project will become current
|
|
199
|
+
@raise @ArgumentError@ if _prj_ is not included in the project list
|
|
200
|
+
=end
|
|
201
|
+
def current_project= prj
|
|
202
|
+
if prj and !@projects[prj.project_file]
|
|
203
|
+
raise ArgumentError, "Tried to set an unknown project as current project"
|
|
204
|
+
end
|
|
205
|
+
@current_project.deactivate if @current_project
|
|
206
|
+
@current_project = prj
|
|
207
|
+
emit current_project_changed prj
|
|
208
|
+
@current_project.activate if @current_project
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
=begin rdoc
|
|
212
|
+
Adds a project to the list
|
|
213
|
+
|
|
214
|
+
The {#project_added} signal is emitted after adding the project.
|
|
215
|
+
|
|
216
|
+
Since this method is automatically called by both {#project} and {#new_project},
|
|
217
|
+
you usually don't need to call it, unless you need to create the project using
|
|
218
|
+
@Project.new@ rather than using one of the above methods.
|
|
219
|
+
|
|
220
|
+
@param [Ruber::Project] prj the project to add
|
|
221
|
+
@return [Ruber::Project] the project itself
|
|
222
|
+
@raise @RuntimeError@ if a project corresponding to the same file as _prj_ is
|
|
223
|
+
already in the list
|
|
224
|
+
=end
|
|
225
|
+
def add_project prj
|
|
226
|
+
if @projects[prj.project_file]
|
|
227
|
+
raise "A project with project file #{prj.project_file} is already open"
|
|
228
|
+
end
|
|
229
|
+
@projects[prj.project_file] = prj
|
|
230
|
+
connect prj, SIGNAL('closing(QObject*)'), self, SLOT('close_project(QObject*)')
|
|
231
|
+
emit project_added(prj)
|
|
232
|
+
prj
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
=begin rdoc
|
|
236
|
+
Closes the current project
|
|
237
|
+
|
|
238
|
+
If there's not a current project, nothing is done. Otherwise, it simply calls the
|
|
239
|
+
{#close_project} method passing the current project as argument.
|
|
240
|
+
|
|
241
|
+
@return [nil]
|
|
242
|
+
=end
|
|
243
|
+
def close_current_project
|
|
244
|
+
@current_project.close if @current_project
|
|
245
|
+
nil
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
=begin rdoc
|
|
249
|
+
|
|
250
|
+
Closes a project
|
|
251
|
+
|
|
252
|
+
If the project is current, sets the current project to *nil* before closing it.
|
|
253
|
+
In all cases, emits the {#closing_project} signal before closing the project.
|
|
254
|
+
|
|
255
|
+
@param [Ruber::Project] the project to close
|
|
256
|
+
@return [nil]
|
|
257
|
+
=end
|
|
258
|
+
def close_project prj
|
|
259
|
+
self.current_project = nil if @current_project == prj
|
|
260
|
+
emit closing_project(prj)
|
|
261
|
+
@projects.delete prj.project_file
|
|
262
|
+
nil
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
=begin rdoc
|
|
267
|
+
Saves each open project
|
|
268
|
+
|
|
269
|
+
@return [nil]
|
|
270
|
+
=end
|
|
271
|
+
def save_settings
|
|
272
|
+
@projects.values.each{|pr| pr.save}
|
|
273
|
+
nil
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
=begin rdoc
|
|
277
|
+
Tells whether it's all right for the projects to close the application
|
|
278
|
+
|
|
279
|
+
It calls the @query_close@ method for each project, returning *false* if any of
|
|
280
|
+
them returns *false* and *true* if all return *true*
|
|
281
|
+
|
|
282
|
+
@return [Boolean] *true* if it's all right for the projects to close the application
|
|
283
|
+
and *false* if at least one of them say the application can't be closed
|
|
284
|
+
=end
|
|
285
|
+
def query_close
|
|
286
|
+
@projects.values.each{|pr| return false unless pr.query_close}
|
|
287
|
+
true
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
=begin rdoc
|
|
291
|
+
Returns the project associated with a given project file
|
|
292
|
+
|
|
293
|
+
@param [String] file the path of the project file
|
|
294
|
+
@param [Symbol] which if @:active_only@, the project corresponding to _file_ will
|
|
295
|
+
be returned only if it's active. If it is @:all@ then it will be returned even if
|
|
296
|
+
it's inactive. Any other value will cause this method to always return *nil*
|
|
297
|
+
@return [Ruber::Project,nil] the project associated with the file _file_ or *nil*
|
|
298
|
+
if the list doesn't contain any such file or if it doesn't respect the value of
|
|
299
|
+
_which_.
|
|
300
|
+
=end
|
|
301
|
+
def project_for_file file, which = :active_only
|
|
302
|
+
current_prj = current
|
|
303
|
+
return nil unless current_prj
|
|
304
|
+
if current_prj.project_files.file_in_project?(file) then current_prj
|
|
305
|
+
elsif which == :all
|
|
306
|
+
find{|prj| prj.project_files.file_in_project?(file)}
|
|
307
|
+
else nil
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
** Form generated from reading ui file 'project_files_rule_chooser_widget.ui'
|
|
3
|
+
**
|
|
4
|
+
** Created: ven ott 29 17:39:04 2010
|
|
5
|
+
** by: Qt User Interface Compiler version 4.7.0
|
|
6
|
+
**
|
|
7
|
+
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
class Ui_ProjectFilesRuleChooser
|
|
11
|
+
attr_reader :gridLayout
|
|
12
|
+
attr_reader :remove_rule_btn
|
|
13
|
+
attr_reader :add_regexp_btn
|
|
14
|
+
attr_reader :add_path_btn
|
|
15
|
+
attr_reader :rules_widget
|
|
16
|
+
|
|
17
|
+
def setupUi(projectFilesRuleChooser)
|
|
18
|
+
if projectFilesRuleChooser.objectName.nil?
|
|
19
|
+
projectFilesRuleChooser.objectName = "projectFilesRuleChooser"
|
|
20
|
+
end
|
|
21
|
+
projectFilesRuleChooser.resize(505, 143)
|
|
22
|
+
@gridLayout = Qt::GridLayout.new(projectFilesRuleChooser)
|
|
23
|
+
@gridLayout.objectName = "gridLayout"
|
|
24
|
+
@remove_rule_btn = KDE::PushButton.new(projectFilesRuleChooser)
|
|
25
|
+
@remove_rule_btn.objectName = "remove_rule_btn"
|
|
26
|
+
|
|
27
|
+
@gridLayout.addWidget(@remove_rule_btn, 3, 1, 1, 1)
|
|
28
|
+
|
|
29
|
+
@add_regexp_btn = KDE::PushButton.new(projectFilesRuleChooser)
|
|
30
|
+
@add_regexp_btn.objectName = "add_regexp_btn"
|
|
31
|
+
|
|
32
|
+
@gridLayout.addWidget(@add_regexp_btn, 0, 1, 1, 1)
|
|
33
|
+
|
|
34
|
+
@add_path_btn = KDE::PushButton.new(projectFilesRuleChooser)
|
|
35
|
+
@add_path_btn.objectName = "add_path_btn"
|
|
36
|
+
|
|
37
|
+
@gridLayout.addWidget(@add_path_btn, 1, 1, 1, 1)
|
|
38
|
+
|
|
39
|
+
@rules_widget = Qt::TreeView.new(projectFilesRuleChooser)
|
|
40
|
+
@rules_widget.objectName = "rules_widget"
|
|
41
|
+
@rules_widget.rootIsDecorated = false
|
|
42
|
+
@rules_widget.uniformRowHeights = true
|
|
43
|
+
@rules_widget.allColumnsShowFocus = true
|
|
44
|
+
|
|
45
|
+
@gridLayout.addWidget(@rules_widget, 0, 0, 5, 1)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
retranslateUi(projectFilesRuleChooser)
|
|
49
|
+
|
|
50
|
+
Qt::MetaObject.connectSlotsByName(projectFilesRuleChooser)
|
|
51
|
+
end # setupUi
|
|
52
|
+
|
|
53
|
+
def setup_ui(projectFilesRuleChooser)
|
|
54
|
+
setupUi(projectFilesRuleChooser)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def retranslateUi(projectFilesRuleChooser)
|
|
58
|
+
projectFilesRuleChooser.windowTitle = Qt::Application.translate("ProjectFilesRuleChooser", "Form", nil, Qt::Application::UnicodeUTF8)
|
|
59
|
+
@remove_rule_btn.text = Qt::Application.translate("ProjectFilesRuleChooser", "&Remove rule", nil, Qt::Application::UnicodeUTF8)
|
|
60
|
+
@add_regexp_btn.text = Qt::Application.translate("ProjectFilesRuleChooser", "Add ®exp rule", nil, Qt::Application::UnicodeUTF8)
|
|
61
|
+
@add_path_btn.text = Qt::Application.translate("ProjectFilesRuleChooser", "Add &file rule", nil, Qt::Application::UnicodeUTF8)
|
|
62
|
+
end # retranslateUi
|
|
63
|
+
|
|
64
|
+
def retranslate_ui(projectFilesRuleChooser)
|
|
65
|
+
retranslateUi(projectFilesRuleChooser)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
module Ui
|
|
71
|
+
class ProjectFilesRuleChooser < Ui_ProjectFilesRuleChooser
|
|
72
|
+
end
|
|
73
|
+
end # module Ui
|
|
74
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<ui version="4.0" >
|
|
2
|
+
<class>ProjectFilesRuleChooser</class>
|
|
3
|
+
<widget class="QWidget" name="ProjectFilesRuleChooser" >
|
|
4
|
+
<property name="geometry" >
|
|
5
|
+
<rect>
|
|
6
|
+
<x>0</x>
|
|
7
|
+
<y>0</y>
|
|
8
|
+
<width>505</width>
|
|
9
|
+
<height>143</height>
|
|
10
|
+
</rect>
|
|
11
|
+
</property>
|
|
12
|
+
<property name="windowTitle" >
|
|
13
|
+
<string>Form</string>
|
|
14
|
+
</property>
|
|
15
|
+
<layout class="QGridLayout" name="gridLayout" >
|
|
16
|
+
<item row="3" column="1" >
|
|
17
|
+
<widget class="KPushButton" name="remove_rule_btn" >
|
|
18
|
+
<property name="text" >
|
|
19
|
+
<string>&Remove rule</string>
|
|
20
|
+
</property>
|
|
21
|
+
</widget>
|
|
22
|
+
</item>
|
|
23
|
+
<item row="0" column="1" >
|
|
24
|
+
<widget class="KPushButton" name="add_regexp_btn" >
|
|
25
|
+
<property name="text" >
|
|
26
|
+
<string>Add &regexp rule</string>
|
|
27
|
+
</property>
|
|
28
|
+
</widget>
|
|
29
|
+
</item>
|
|
30
|
+
<item row="1" column="1" >
|
|
31
|
+
<widget class="KPushButton" name="add_path_btn" >
|
|
32
|
+
<property name="text" >
|
|
33
|
+
<string>Add &file rule</string>
|
|
34
|
+
</property>
|
|
35
|
+
</widget>
|
|
36
|
+
</item>
|
|
37
|
+
<item rowspan="5" row="0" column="0" >
|
|
38
|
+
<widget class="QTreeView" name="rules_widget" >
|
|
39
|
+
<property name="rootIsDecorated" >
|
|
40
|
+
<bool>false</bool>
|
|
41
|
+
</property>
|
|
42
|
+
<property name="uniformRowHeights" >
|
|
43
|
+
<bool>true</bool>
|
|
44
|
+
</property>
|
|
45
|
+
<property name="allColumnsShowFocus" >
|
|
46
|
+
<bool>true</bool>
|
|
47
|
+
</property>
|
|
48
|
+
</widget>
|
|
49
|
+
</item>
|
|
50
|
+
</layout>
|
|
51
|
+
</widget>
|
|
52
|
+
<customwidgets>
|
|
53
|
+
<customwidget>
|
|
54
|
+
<class>KPushButton</class>
|
|
55
|
+
<extends>QPushButton</extends>
|
|
56
|
+
<header>kpushbutton.h</header>
|
|
57
|
+
</customwidget>
|
|
58
|
+
</customwidgets>
|
|
59
|
+
<resources/>
|
|
60
|
+
<connections/>
|
|
61
|
+
</ui>
|