author | harlekin <harlekin> | 2002-10-12 15:44:01 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-12 15:44:01 (UTC) |
commit | e6b92ad451dba66f4eb5000a41b96eb2ee203dce (patch) (unidiff) | |
tree | 07caa3f11d59c96858dd374d6b7cff90dbe3915e /noncore/apps/opie-console/dialdialog.cpp | |
parent | 83aed438ec060307bf5562d91bd8b61fe60f860b (diff) | |
download | opie-e6b92ad451dba66f4eb5000a41b96eb2ee203dce.zip opie-e6b92ad451dba66f4eb5000a41b96eb2ee203dce.tar.gz opie-e6b92ad451dba66f4eb5000a41b96eb2ee203dce.tar.bz2 |
some more stuff - modem config, bluetooth.. -, not finished
Diffstat (limited to 'noncore/apps/opie-console/dialdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/dialdialog.cpp | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp new file mode 100644 index 0000000..8bf32f9 --- a/dev/null +++ b/noncore/apps/opie-console/dialdialog.cpp | |||
@@ -0,0 +1,95 @@ | |||
1 | |||
2 | |||
3 | #include <qlayout.h> | ||
4 | #include <qlabel.h> | ||
5 | #include <qcombobox.h> | ||
6 | #include <qscrollview.h> | ||
7 | #include <qpushbutton.h> | ||
8 | #include <qfont.h> | ||
9 | #include <qbuttongroup.h> | ||
10 | |||
11 | #include "dialdialog.h" | ||
12 | |||
13 | |||
14 | |||
15 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
16 | : QDialog( parent, name, modal, fl ) { | ||
17 | |||
18 | m_number = 0; | ||
19 | |||
20 | setCaption( tr( "Enter number" ) ); | ||
21 | |||
22 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | ||
23 | |||
24 | QLabel *textLabel = new QLabel( this ); | ||
25 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); | ||
26 | |||
27 | LCD = new QLCDNumber( this, "LCD" ); | ||
28 | QFont LCD_font( LCD->font() ); | ||
29 | LCD_font.setPointSize( 7 ); | ||
30 | LCD->setFont( LCD_font ); | ||
31 | LCD->setNumDigits( 25 ); | ||
32 | LCD->setSegmentStyle( QLCDNumber::Flat ); | ||
33 | LCD->setMaximumHeight( 30 ); | ||
34 | |||
35 | QGridLayout *layout = new QGridLayout( this , 4, 3 ); | ||
36 | |||
37 | QButtonGroup *dialButtons = new QButtonGroup( ); | ||
38 | |||
39 | QPushButton *number0 = new QPushButton( this ); | ||
40 | number0->setText( QString( "0" ) ); | ||
41 | QFont number0_font( number0->font() ); | ||
42 | number0_font.setBold( TRUE ); | ||
43 | number0->setFont( number0_font ); | ||
44 | layout->addWidget( number0, 4, 1 ); | ||
45 | dialButtons->insert( number0 ); | ||
46 | |||
47 | int x = 0, y = 0; | ||
48 | for ( int i = 0 ; i < 9; i++ ) { | ||
49 | QPushButton *number = new QPushButton( this ); | ||
50 | number->setText( QString( "%1" ).arg( i + 1 ) ); | ||
51 | QFont number_font( number->font() ); | ||
52 | number_font.setBold( TRUE ); | ||
53 | number->setFont( number_font ); | ||
54 | |||
55 | dialButtons->insert( number ); | ||
56 | |||
57 | layout->addWidget( number, x, y ); | ||
58 | |||
59 | if ( y < 2 ) { | ||
60 | y++; | ||
61 | } else { | ||
62 | x++; | ||
63 | y = 0; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); | ||
68 | |||
69 | mainLayout->addStretch( 0 ); | ||
70 | mainLayout->addWidget( textLabel ); | ||
71 | mainLayout->addWidget( LCD ); | ||
72 | mainLayout->addStretch( 0 ); | ||
73 | mainLayout->addLayout( layout ); | ||
74 | mainLayout->addStretch( 0 ); | ||
75 | |||
76 | |||
77 | } | ||
78 | |||
79 | |||
80 | void DialDialog::slotEnterNumber( int number ) { | ||
81 | |||
82 | // pretty stupid, just for testing .-) | ||
83 | |||
84 | m_number = ( m_number * 10 ) + number; | ||
85 | qDebug( QString("%1").arg( m_number ) ); | ||
86 | LCD->display( m_number ); | ||
87 | |||
88 | } | ||
89 | |||
90 | DialDialog::~DialDialog() { | ||
91 | } | ||
92 | |||
93 | QString DialDialog::number() { | ||
94 | return QString( "%1").arg( m_number ); | ||
95 | } | ||