author | josef <josef> | 2002-10-21 20:23:34 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-21 20:23:34 (UTC) |
commit | df721474c6ed785ab7f258f4a9d9384cafa3f8fa (patch) (unidiff) | |
tree | 7800a4a8d98559fd812b8536a1c62a6b52a905c8 | |
parent | d7703116959fb71492f18a60eb41babd1183d7ec (diff) | |
download | opie-df721474c6ed785ab7f258f4a9d9384cafa3f8fa.zip opie-df721474c6ed785ab7f258f4a9d9384cafa3f8fa.tar.gz opie-df721474c6ed785ab7f258f4a9d9384cafa3f8fa.tar.bz2 |
- remove . and , from numbers
- use 2 QLCDWidgets so we can handle larger numbers
-rw-r--r-- | noncore/apps/opie-console/BUGS | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialdialog.cpp | 46 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialdialog.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 2 |
4 files changed, 34 insertions, 23 deletions
diff --git a/noncore/apps/opie-console/BUGS b/noncore/apps/opie-console/BUGS index ffaceef..496e28a 100644 --- a/noncore/apps/opie-console/BUGS +++ b/noncore/apps/opie-console/BUGS | |||
@@ -1,9 +1,12 @@ | |||
1 | Ok we all know we write perfect code | 1 | Ok we all know we write perfect code |
2 | but sometimes the compiler produces bad code | 2 | but sometimes the compiler produces bad code |
3 | and we need to work around some compiler bugs!! -zecke | 3 | and we need to work around some compiler bugs!! -zecke |
4 | 4 | ||
5 | MyPty is broken in some ways | 5 | MyPty is broken in some ways |
6 | if you do connect/disconnect/connect sh will be executed in the | 6 | if you do connect/disconnect/connect sh will be executed in the |
7 | process of opie-console.... funny aye? | 7 | process of opie-console.... funny aye? |
8 | 8 | ||
9 | OTabWidget seems to give us problems too | 9 | OTabWidget seems to give us problems too |
10 | |||
11 | Send/receive: lrzsz behaves strange when trying to use | ||
12 | --overwrite or --rename. | ||
diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index 0ace8f7..0d115bc 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp | |||
@@ -1,103 +1,111 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
6 | #include <qscrollview.h> | 6 | #include <qscrollview.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qfont.h> | 8 | #include <qfont.h> |
9 | #include <qbuttongroup.h> | 9 | #include <qbuttongroup.h> |
10 | 10 | ||
11 | #include "dialdialog.h" | 11 | #include "dialdialog.h" |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 15 | DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
16 | : QDialog( parent, name, modal, fl ) { | 16 | : QDialog( parent, name, modal, fl ) { |
17 | 17 | ||
18 | m_number = 0; | ||
19 | |||
20 | setCaption( tr( "Enter number" ) ); | 18 | setCaption( tr( "Enter number" ) ); |
21 | 19 | ||
22 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 20 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
23 | 21 | ||
24 | QLabel *textLabel = new QLabel( this ); | 22 | QLabel *textLabel = new QLabel( this ); |
25 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); | 23 | textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); |
26 | 24 | ||
27 | LCD = new QLCDNumber( this, "LCD" ); | 25 | LCD1 = new QLCDNumber( this, "LCD" ); |
28 | QFont LCD_font( LCD->font() ); | 26 | QFont LCD_font1( LCD1->font() ); |
29 | LCD_font.setPointSize( 7 ); | 27 | LCD_font1.setPointSize( 7 ); |
30 | LCD->setFont( LCD_font ); | 28 | LCD1->setFont( LCD_font1 ); |
31 | LCD->setNumDigits( 25 ); | 29 | LCD1->setNumDigits( 8 ); |
32 | LCD->setSegmentStyle( QLCDNumber::Flat ); | 30 | LCD1->setSegmentStyle( QLCDNumber::Flat ); |
33 | LCD->setMaximumHeight( 30 ); | 31 | LCD1->setMaximumHeight( 30 ); |
32 | |||
33 | LCD2 = new QLCDNumber( this, "LCD" ); | ||
34 | QFont LCD_font2( LCD2->font() ); | ||
35 | LCD_font2.setPointSize( 7 ); | ||
36 | LCD2->setFont( LCD_font2 ); | ||
37 | LCD2->setNumDigits( 8 ); | ||
38 | LCD2->setSegmentStyle( QLCDNumber::Flat ); | ||
39 | LCD2->setMaximumHeight( 30 ); | ||
34 | 40 | ||
35 | QGridLayout *layout = new QGridLayout( this , 4, 3 ); | 41 | QGridLayout *layout = new QGridLayout( this , 4, 3 ); |
36 | 42 | ||
37 | QButtonGroup *dialButtons = new QButtonGroup( ); | 43 | QButtonGroup *dialButtons = new QButtonGroup( ); |
38 | 44 | ||
39 | QPushButton *number0 = new QPushButton( this ); | 45 | QPushButton *number0 = new QPushButton( this ); |
40 | number0->setText( QString( "0" ) ); | 46 | number0->setText( QString( "0" ) ); |
41 | QFont number0_font( number0->font() ); | 47 | QFont number0_font( number0->font() ); |
42 | number0_font.setBold( TRUE ); | 48 | number0_font.setBold( TRUE ); |
43 | number0->setFont( number0_font ); | 49 | number0->setFont( number0_font ); |
44 | layout->addWidget( number0, 4, 1 ); | 50 | layout->addWidget( number0, 4, 1 ); |
45 | dialButtons->insert( number0 ); | 51 | dialButtons->insert( number0 ); |
46 | 52 | ||
47 | int x = 0, y = 0; | 53 | int x = 0, y = 0; |
48 | for ( int i = 0 ; i < 9; i++ ) { | 54 | for ( int i = 0 ; i < 9; i++ ) { |
49 | QPushButton *number = new QPushButton( this ); | 55 | QPushButton *number = new QPushButton( this ); |
50 | number->setText( QString( "%1" ).arg( i + 1 ) ); | 56 | number->setText( QString( "%1" ).arg( i + 1 ) ); |
51 | QFont number_font( number->font() ); | 57 | QFont number_font( number->font() ); |
52 | number_font.setBold( TRUE ); | 58 | number_font.setBold( TRUE ); |
53 | number->setFont( number_font ); | 59 | number->setFont( number_font ); |
54 | 60 | ||
55 | dialButtons->insert( number ); | 61 | dialButtons->insert( number ); |
56 | 62 | ||
57 | layout->addWidget( number, x, y ); | 63 | layout->addWidget( number, x, y ); |
58 | 64 | ||
59 | if ( y < 2 ) { | 65 | if ( y < 2 ) { |
60 | y++; | 66 | y++; |
61 | } else { | 67 | } else { |
62 | x++; | 68 | x++; |
63 | y = 0; | 69 | y = 0; |
64 | } | 70 | } |
65 | } | 71 | } |
66 | 72 | ||
67 | connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); | 73 | connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); |
68 | 74 | ||
69 | mainLayout->addStretch( 0 ); | 75 | mainLayout->addStretch( 0 ); |
70 | mainLayout->addWidget( textLabel ); | 76 | mainLayout->addWidget( textLabel ); |
71 | mainLayout->addWidget( LCD ); | 77 | QHBoxLayout *lcdLayout = new QHBoxLayout(mainLayout); |
78 | lcdLayout->addWidget( LCD1 ); | ||
79 | lcdLayout->addWidget( LCD2 ); | ||
72 | mainLayout->addStretch( 0 ); | 80 | mainLayout->addStretch( 0 ); |
73 | mainLayout->addLayout( layout ); | 81 | mainLayout->addLayout( layout ); |
74 | mainLayout->addStretch( 0 ); | 82 | mainLayout->addStretch( 0 ); |
75 | |||
76 | |||
77 | } | 83 | } |
78 | 84 | ||
79 | 85 | ||
80 | void DialDialog::slotEnterNumber( int number ) { | 86 | void DialDialog::slotEnterNumber( int number ) { |
81 | 87 | ||
82 | // pretty stupid, just for testing .-) | 88 | // pretty stupid, just for testing .-) |
83 | 89 | ||
84 | m_number = ( m_number * 10 ) + number; | 90 | m_number.append(QString("%1").arg(number)); |
85 | qDebug( QString("%1").arg( m_number ) ); | ||
86 | LCD->display( m_number ); | ||
87 | 91 | ||
92 | setNumber(m_number); | ||
88 | } | 93 | } |
89 | 94 | ||
90 | DialDialog::~DialDialog() { | 95 | DialDialog::~DialDialog() { |
91 | } | 96 | } |
92 | 97 | ||
93 | QString DialDialog::number() { | 98 | QString DialDialog::number() { |
94 | return QString( "%1").arg( m_number ); | 99 | return m_number; |
95 | 100 | ||
96 | } | 101 | } |
97 | 102 | ||
98 | void DialDialog::setNumber( int number ) | 103 | void DialDialog::setNumber( QString number ) |
99 | { | 104 | { |
100 | m_number = number; | 105 | QString n1; |
101 | LCD->display( m_number ); | 106 | if(number.length() > 8) n1 = number.left(number.length() - 8); |
107 | QString n2 = number.right(8); | ||
108 | LCD1->display( n1.toInt() ); | ||
109 | LCD2->display( n2.toInt() ); | ||
102 | } | 110 | } |
103 | 111 | ||
diff --git a/noncore/apps/opie-console/dialdialog.h b/noncore/apps/opie-console/dialdialog.h index bec7b81..4a74b66 100644 --- a/noncore/apps/opie-console/dialdialog.h +++ b/noncore/apps/opie-console/dialdialog.h | |||
@@ -1,31 +1,31 @@ | |||
1 | 1 | ||
2 | #ifndef DIALDIALOG_H | 2 | #ifndef DIALDIALOG_H |
3 | #define DIALDIALOG_H | 3 | #define DIALDIALOG_H |
4 | 4 | ||
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qlcdnumber.h> | 7 | #include <qlcdnumber.h> |
8 | 8 | ||
9 | class DialDialog : public QDialog { | 9 | class DialDialog : public QDialog { |
10 | 10 | ||
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 14 | DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
15 | 15 | ||
16 | ~DialDialog(); | 16 | ~DialDialog(); |
17 | 17 | ||
18 | QString number(); | 18 | QString number(); |
19 | 19 | ||
20 | void setNumber( int ); | 20 | void setNumber( QString number ); |
21 | 21 | ||
22 | private: | 22 | private: |
23 | float m_number; | 23 | QString m_number; |
24 | QLCDNumber *LCD; | 24 | QLCDNumber *LCD1, *LCD2; |
25 | 25 | ||
26 | private slots: | 26 | private slots: |
27 | void slotEnterNumber( int ); | 27 | void slotEnterNumber( int ); |
28 | }; | 28 | }; |
29 | 29 | ||
30 | 30 | ||
31 | #endif | 31 | #endif |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index c0ab0fc..d3a23fa 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -146,55 +146,55 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
146 | parity = 2; | 146 | parity = 2; |
147 | break; | 147 | break; |
148 | case IOLayerBase::Even: | 148 | case IOLayerBase::Even: |
149 | parity = 1; | 149 | parity = 1; |
150 | break; | 150 | break; |
151 | case IOLayerBase::NonePar: | 151 | case IOLayerBase::NonePar: |
152 | parity = 0; | 152 | parity = 0; |
153 | break; | 153 | break; |
154 | } | 154 | } |
155 | 155 | ||
156 | switch( m_base->speed() ) { | 156 | switch( m_base->speed() ) { |
157 | case IOLayerBase::Baud_115200: | 157 | case IOLayerBase::Baud_115200: |
158 | speed = 115200; | 158 | speed = 115200; |
159 | break; | 159 | break; |
160 | case IOLayerBase::Baud_57600: | 160 | case IOLayerBase::Baud_57600: |
161 | speed = 57600; | 161 | speed = 57600; |
162 | break; | 162 | break; |
163 | case IOLayerBase::Baud_38400: | 163 | case IOLayerBase::Baud_38400: |
164 | speed = 38400; | 164 | speed = 38400; |
165 | break; | 165 | break; |
166 | case IOLayerBase::Baud_19200: | 166 | case IOLayerBase::Baud_19200: |
167 | speed = 19200; | 167 | speed = 19200; |
168 | break; | 168 | break; |
169 | case IOLayerBase::Baud_9600: | 169 | case IOLayerBase::Baud_9600: |
170 | speed = 9600; | 170 | speed = 9600; |
171 | break; | 171 | break; |
172 | } | 172 | } |
173 | 173 | ||
174 | prof.writeEntry( "Flow", flow ); | 174 | prof.writeEntry( "Flow", flow ); |
175 | prof.writeEntry( "Parity", parity ); | 175 | prof.writeEntry( "Parity", parity ); |
176 | prof.writeEntry( "Speed", speed ); | 176 | prof.writeEntry( "Speed", speed ); |
177 | prof.writeEntry( "Number", m_telNumber->text() ); | 177 | prof.writeEntry( "Number", m_telNumber->text() ); |
178 | 178 | ||
179 | 179 | ||
180 | atConf->writeConfig(prof); | 180 | atConf->writeConfig(prof); |
181 | } | 181 | } |
182 | 182 | ||
183 | void ModemConfigWidget::slotAT() { | 183 | void ModemConfigWidget::slotAT() { |
184 | // ATConfigDialog conf( this, "ATConfig", true ); | 184 | // ATConfigDialog conf( this, "ATConfig", true ); |
185 | atConf->showMaximized(); | 185 | atConf->showMaximized(); |
186 | if ( atConf->exec() != QDialog::Accepted ) { | 186 | if ( atConf->exec() != QDialog::Accepted ) { |
187 | // reload old settings | 187 | // reload old settings |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void ModemConfigWidget::slotDial() { | 191 | void ModemConfigWidget::slotDial() { |
192 | DialDialog dial( this, "DialConfig", true ); | 192 | DialDialog dial( this, "DialConfig", true ); |
193 | if(!m_telNumber->text().isEmpty()) { | 193 | if(!m_telNumber->text().isEmpty()) { |
194 | dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ ]"), "").toInt()); | 194 | dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); |
195 | } | 195 | } |
196 | dial.showMaximized(); | 196 | dial.showMaximized(); |
197 | if ( dial.exec() == QDialog::Accepted ) { | 197 | if ( dial.exec() == QDialog::Accepted ) { |
198 | m_telNumber->setText( dial.number() ); | 198 | m_telNumber->setText( dial.number() ); |
199 | } | 199 | } |
200 | } | 200 | } |