File: WateringConfigDialog.pm

package info (click to toggle)
qt4-perl 4.5~~svn1145508-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,144 kB
  • ctags: 5,947
  • sloc: perl: 29,224; cpp: 18,849; xml: 98; makefile: 91; sh: 4
file content (45 lines) | stat: -rw-r--r-- 1,595 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package WateringConfigDialog;

use strict;
use warnings;
use QtCore4;
use QtGui4;

use Ui_WateringConfigDialog;

use QtCore4::isa qw( Qt::Dialog );
use QtCore4::slots
    focusChanged => ['QWidget*', 'QWidget*'];
    
sub NEW
{
    my ($class, $parent) = @_;
    $class->SUPER::NEW($parent);

    this->{m_ui} = Ui_WateringConfigDialog->setupUi(this);
    this->{m_widgetInfo} = {};
    this->{m_widgetInfo}->{this->{m_ui}->plantComboBox} = this->tr('plants');
    this->{m_widgetInfo}->{this->{m_ui}->temperatureCheckBox} = this->tr('temperature');
    this->{m_widgetInfo}->{this->{m_ui}->temperatureSpinBox} = this->tr('temperature');
    this->{m_widgetInfo}->{this->{m_ui}->rainCheckBox} = this->tr('rain');
    this->{m_widgetInfo}->{this->{m_ui}->rainSpinBox} = this->tr('rain');
    this->{m_widgetInfo}->{this->{m_ui}->startTimeEdit} = this->tr('starting time');
    this->{m_widgetInfo}->{this->{m_ui}->amountSpinBox} = this->tr('water amount');
    this->{m_widgetInfo}->{this->{m_ui}->sourceComboBox} = this->tr('water source');
    this->{m_widgetInfo}->{this->{m_ui}->filterCheckBox} = this->tr('water filtering');

    this->connect(qApp, SIGNAL 'focusChanged(QWidget*, QWidget*)',
        this, SLOT 'focusChanged(QWidget*, QWidget*)');
}

sub focusChanged
{
    my $now = $_[1];
    if (defined this->{m_widgetInfo}->{$now}) {
        this->{m_ui}->helpLabel->setText(sprintf this->tr('Information about %s:'), this->{m_widgetInfo}->{$now});
        my @lst = split ' ', this->{m_widgetInfo}->{$now};
        this->{m_ui}->helpBrowser->showHelpForKeyword($lst[-1]);
    }
}

1;