Diffstat (limited to 'noncore/apps/opie-console/dialdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/dialdialog.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index 6bc1240..526d55e 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp | |||
@@ -1,98 +1,98 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qbuttongroup.h> | 6 | #include <qbuttongroup.h> |
7 | 7 | ||
8 | #include "dialdialog.h" | 8 | #include "dialdialog.h" |
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 12 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
13 | : QDialog( parent, name, modal, fl ) { | 13 | : QDialog( parent, name, modal, fl ) { |
14 | 14 | ||
15 | setCaption( tr( "Enter number" ) ); | 15 | setCaption( tr( "Enter number" ) ); |
16 | 16 | ||
17 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 17 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
18 | 18 | ||
19 | QLabel *textLabel = new QLabel( this ); | 19 | QLabel *textLabel = new QLabel( this ); |
20 | textLabel->setTextFormat( QLabel::RichText ); | 20 | textLabel->setTextFormat( QLabel::RichText ); |
21 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); | 21 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); |
22 | 22 | ||
23 | m_dialLine = new QLineEdit( this ); | 23 | m_dialLine = new QLineEdit( this ); |
24 | m_dialLine->setReadOnly( true ); | 24 | m_dialLine->setReadOnly( true ); |
25 | m_dialLine->setFrame( false ); | 25 | m_dialLine->setFrame( false ); |
26 | m_dialLine->setAlignment( Qt::AlignLeft ); | 26 | m_dialLine->setAlignment( Qt::AlignLeft ); |
27 | QFont dialLine_font( m_dialLine->font() ); | 27 | QFont dialLine_font( m_dialLine->font() ); |
28 | dialLine_font.setBold( TRUE ); | 28 | dialLine_font.setBold( TRUE ); |
29 | dialLine_font.setPointSize( 18 ); | 29 | dialLine_font.setPointSize( 18 ); |
30 | m_dialLine->setFont( dialLine_font ); | 30 | m_dialLine->setFont( dialLine_font ); |
31 | 31 | ||
32 | QWidget* dialWidget = new QWidget( this ); | 32 | QWidget* dialWidget = new QWidget( this ); |
33 | QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); | 33 | QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); |
34 | 34 | ||
35 | QButtonGroup *dialButtons = new QButtonGroup( ); | 35 | QButtonGroup *dialButtons = new QButtonGroup( ); |
36 | 36 | ||
37 | QPushButton *number0 = new QPushButton( dialWidget ); | 37 | QPushButton *number0 = new QPushButton( dialWidget ); |
38 | number0->setText( QString( "0" ) ); | 38 | number0->setText( QString( "0" ) ); |
39 | QFont number0_font( number0->font() ); | 39 | QFont number0_font( number0->font() ); |
40 | number0_font.setBold( TRUE ); | 40 | number0_font.setBold( TRUE ); |
41 | number0->setFont( number0_font ); | 41 | number0->setFont( number0_font ); |
42 | layout->addWidget( number0, 4, 1 ); | 42 | layout->addWidget( number0, 4, 1 ); |
43 | dialButtons->insert( number0 ); | 43 | dialButtons->insert( number0 ); |
44 | 44 | ||
45 | int x = 0, y = 0; | 45 | int x = 0, y = 0; |
46 | for ( int i = 0 ; i < 9; i++ ) { | 46 | for ( int i = 0 ; i < 9; i++ ) { |
47 | QPushButton *number = new QPushButton( dialWidget ); | 47 | QPushButton *number = new QPushButton( dialWidget ); |
48 | number->setText( QString( "%1" ).arg( i + 1 ) ); | 48 | number->setText( QString( "%1" ).arg( i + 1 ) ); |
49 | QFont number_font( number->font() ); | 49 | QFont number_font( number->font() ); |
50 | number_font.setBold( TRUE ); | 50 | number_font.setBold( TRUE ); |
51 | number->setFont( number_font ); | 51 | number->setFont( number_font ); |
52 | 52 | ||
53 | dialButtons->insert( number ); | 53 | dialButtons->insert( number ); |
54 | 54 | ||
55 | layout->addWidget( number, x, y ); | 55 | layout->addWidget( number, x, y ); |
56 | 56 | ||
57 | if ( y < 2 ) { | 57 | if ( y < 2 ) { |
58 | y++; | 58 | y++; |
59 | } else { | 59 | } else { |
60 | x++; | 60 | x++; |
61 | y = 0; | 61 | y = 0; |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); | 65 | connect( dialButtons, SIGNAL( clicked(int) ), this, SLOT( slotEnterNumber(int) ) ); |
66 | 66 | ||
67 | mainLayout->addStretch( 2 ); | 67 | mainLayout->addStretch( 2 ); |
68 | mainLayout->addWidget( textLabel ); | 68 | mainLayout->addWidget( textLabel ); |
69 | mainLayout->addStretch( 1 ); | 69 | mainLayout->addStretch( 1 ); |
70 | mainLayout->addWidget( m_dialLine ); | 70 | mainLayout->addWidget( m_dialLine ); |
71 | mainLayout->addStretch( 2 ); | 71 | mainLayout->addStretch( 2 ); |
72 | mainLayout->addWidget( dialWidget ); | 72 | mainLayout->addWidget( dialWidget ); |
73 | mainLayout->addStretch( 4 ); | 73 | mainLayout->addStretch( 4 ); |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | void DialDialog::slotEnterNumber( int number ) { | 77 | void DialDialog::slotEnterNumber( int number ) { |
78 | 78 | ||
79 | // pretty stupid, just for testing .-) | 79 | // pretty stupid, just for testing .-) |
80 | 80 | ||
81 | m_number.append(QString("%1").arg(number)); | 81 | m_number.append(QString("%1").arg(number)); |
82 | 82 | ||
83 | setNumber(m_number); | 83 | setNumber(m_number); |
84 | } | 84 | } |
85 | 85 | ||
86 | DialDialog::~DialDialog() { | 86 | DialDialog::~DialDialog() { |
87 | } | 87 | } |
88 | 88 | ||
89 | QString DialDialog::number() { | 89 | QString DialDialog::number() { |
90 | return m_number; | 90 | return m_number; |
91 | 91 | ||
92 | } | 92 | } |
93 | 93 | ||
94 | void DialDialog::setNumber( QString number ) | 94 | void DialDialog::setNumber( QString number ) |
95 | { | 95 | { |
96 | m_dialLine->setText( QString("%1").arg( number ) ); | 96 | m_dialLine->setText( QString("%1").arg( number ) ); |
97 | } | 97 | } |
98 | 98 | ||