author | josef <josef> | 2002-10-18 11:36:34 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-18 11:36:34 (UTC) |
commit | 24c0ae04669e94d554fe8ef49888ffb5a6a00656 (patch) (side-by-side diff) | |
tree | 96e48d488555d789de7ac73797d016c7e8262956 | |
parent | 3484cd354a54bcc20d389b123423028e09d884df (diff) | |
download | opie-24c0ae04669e94d554fe8ef49888ffb5a6a00656.zip opie-24c0ae04669e94d554fe8ef49888ffb5a6a00656.tar.gz opie-24c0ae04669e94d554fe8ef49888ffb5a6a00656.tar.bz2 |
- increase dialog responsiveness
The higher the value (currently 100) is, the faster the modem dials, but lower
values guarantee a smoother UI.
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 7bf9352..51d4093 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp @@ -179,117 +179,118 @@ void Dialer::trydial(const QString& number) //send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); QString response5 = receive(); if(!response5.contains("\nCONNECT")) { if(response5.contains("BUSY")) switchState(state_dialing); else { QMessageBox::warning(this, QObject::tr("Failure"), QObject::tr("Dialing the number failed.")); slotCancel(); } } } if(state != state_cancel) { switchState(state_online); } } void Dialer::send(const QString& msg) { QString m = msg; int bytes; QString termination; qWarning("Sending: '%s'", m.latin1()); termination = "\r"; //termination = m_profile.readEntry("Termination"); if(termination == "\n") m = m + "\n"; else if(termination == "\r") m = m + "\r"; else m = m + "\r\n"; bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); if(bytes < 0) { reset(); } } QString Dialer::receive() { QString buf; char buffer[1024]; int ret; - - qApp->processEvents(); + int counter; while(1) { ret = ::read(m_fd, buffer, sizeof(buffer)); if(ret > 0) { for(int i = 0; i < ret; i++) buffer[i] = buffer[i] & 0x7F; buffer[ret] = 0; qWarning("Got: '%s'", buffer); buf.append(QString(buffer)); if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) { qWarning("Receiving: '%s'", buf.latin1()); return buf; } } else if(ret < 0) { if(errno != EAGAIN) reset(); + else if(!(counter++ % 100)) qApp->processEvents(); } + else if(!(counter++ % 100)) qApp->processEvents(); } return QString::null; } void Dialer::switchState(int newstate) { int oldstate = state; state = newstate; switch(state) { case state_cancel: status->setText(QObject::tr("Cancelling...")); progress->setProgress(0); break; case state_preinit: status->setText(QObject::tr("Searching modem")); progress->setProgress(10); break; case state_init: status->setText(QObject::tr("Initializing...")); progress->setProgress(20); break; case state_options: status->setText(QObject::tr("Reset speakers")); progress->setProgress(30); break; case state_dialtone: status->setText(QObject::tr("Turning off dialtone")); progress->setProgress(40); break; case state_dialing: if(oldstate != state_dialing) status->setText(QObject::tr("Dial number")); else status->setText(QObject::tr("Line busy, redialing number")); progress->setProgress(50); break; case state_online: status->setText(QObject::tr("Connection established")); progress->setProgress(100); cancel->setText(QObject::tr("Dismiss")); break; } } |