Class: Ruber::NewProjectDialog::NewProjectWidget
- Inherits:
-
Qt::Widget
- Object
- Qt::Widget
- Ruber::NewProjectDialog::NewProjectWidget
- Defined in:
- lib/ruber/main_window/main_window_actions.rb,
lib/ruber/main_window/main_window_actions.rb
Overview
Main widget for the Ruber::NewProjectDialog
Instance Method Summary (collapse)
-
- (nil) data_changed
slot
private
Slot called whenever the user changes data in the widget.
-
- (NewProjectWidget) initialize(parent = nil)
constructor
A new instance of NewProjectWidget.
-
- (String) project_file
The path of the project file.
-
- (String) project_name
The name chosen by the user for the project.
Signal Summary
-
- complete_status_changed(bool complete)
Signal emitted when the user changes the data in the widget.
Constructor Details
- (NewProjectWidget) initialize(parent = nil)
A new instance of NewProjectWidget
811 812 813 814 815 816 817 818 819 820 821 822 |
# File 'lib/ruber/main_window/main_window_actions.rb', line 811 def initialize parent = nil super @ui = Ui::NewProjectWidget.new @ui.setupUi self @ui.container_dir.url = KDE::Url.new Ruber[:config][:general, :default_project_directory] @ui.container_dir.mode = KDE::File::Directory | KDE::File::LocalOnly| KDE::File::ExistingOnly connect @ui.project_name, SIGNAL('textChanged(QString)'), self, SLOT('data_changed()') connect @ui.container_dir, SIGNAL('textChanged(QString)'), self, SLOT('data_changed()') @ui.project_name.set_focus self.focus_proxy = @ui.project_name end |
Instance Method Details
- (nil) data_changed (private)
Slot called whenever the user changes data in the widget
It updates the Final location widget, displays the Invalid final location message if the project directory already exists and emit the #complete_status_changed signal
849 850 851 852 853 854 855 856 857 858 859 860 |
# File 'lib/ruber/main_window/main_window_actions.rb', line 849 def data_changed name = @ui.project_name.text container = @ui.container_dir.url.path || '' file = name.gsub(/\W/,'_') @ui.final_location.text = File.join container, file, "#{file}.ruprj" valid_container = File.exist?(container) valid = (valid_container and !(name.empty? or container.empty? or File.exist? File.join(container, file))) @ui.invalid_project.text = valid ? '' : 'Invalid final location' emit complete_status_changed(valid) nil end |
Slot Signature:
data_changed()
- (String) project_file
The path of the project file
834 835 836 |
# File 'lib/ruber/main_window/main_window_actions.rb', line 834 def project_file @ui.final_location.text end |
- (String) project_name
The name chosen by the user for the project
827 828 829 |
# File 'lib/ruber/main_window/main_window_actions.rb', line 827 def project_name @ui.project_name.text end |
Signal Details
- complete_status_changed(bool complete)
Signal emitted when the user changes the data in the widget