Fix many bugs about management line.

Add Compose item to trayicon menu.
This commit is contained in:
llea
2005-07-20 19:57:05 +00:00
parent 8884eeb6a9
commit bba7ec78a0
5 changed files with 103 additions and 42 deletions

View File

@ -1,43 +1,48 @@
Laurielle LEA (18 July 2005) version 0.4 Laurielle LEA (20 July 2005) version 0.4
- Fix mute feature.
- Fix many bugs about line management.
- Add "Compose" item in trayicon menu.
Jean-Philippe Barette-LaPierre (18 July 2005) version 0.4
- Bug fix if error was raised before setGUI. - Bug fix if error was raised before setGUI.
Laurielle LEA (18 July 2005) version 0.4 Laurielle LEA (18 July 2005) version 0.4
- Fix incoming call sound notification - Fix incoming call sound notification.
- Fix transfer if no busy line - Fix transfer if no busy line.
Laurielle LEA (15 July 2005) version 0.4 Laurielle LEA (15 July 2005) version 0.4
- Fix configuration init - Fix configuration init.
Jerome OUFELLA (13 July 2005) version 0.4 Jerome OUFELLA (13 July 2005) version 0.4
- Fix tone. - Fix tone.
Jean-Philippe Barette-LaPierre (13 July 2005) version 0.4 Jean-Philippe Barette-LaPierre (13 July 2005) version 0.4
- Change "Manager" to a singleton - Change "Manager" to a singleton.
Laurielle LEA (13 July 2005) version 0.4 Laurielle LEA (13 July 2005) version 0.4
- Fix bug if network is not available. - Fix bug if network is not available.
- Fix apply skin feature - Fix apply skin feature.
Laurielle LEA (11 July 2005) version 0.4 Laurielle LEA (11 July 2005) version 0.4
- Check functions return. - Check functions return.
- Remove unused mute functions - Remove unused mute functions.
Laurielle LEA (8 July 2005) version 0.4 Laurielle LEA (8 July 2005) version 0.4
- Stop program when error opening skin file - Stop program when error opening skin file.
- Divide toggle() of qtguimainwindow.cpp in small functions - Divide toggle() of qtguimainwindow.cpp in small functions.
- Add return test - Add return test.
Laurielle LEA (7 July 2005) version 0.4 Laurielle LEA (7 July 2005) version 0.4
- Cleanup audiortp.cpp - Cleanup audiortp.cpp.
- Replace #define by global variable in codecDescriptor.cpp - Replace #define by global variable in codecDescriptor.cpp.
- Set mutex of ringbuffer in the functions of RingBuffer object - Set mutex of ringbuffer in the functions of RingBuffer object.
- Divide run() of audiortp.cpp in 3 small functions - Divide run() of audiortp.cpp in 3 small functions.
- Changed device static function in Manager for configurationpanel.ui.h - Changed device static function in Manager for configurationpanel.ui.h.
- Updated README - Updated README.
Jean-Philippe Barrette-LaPierre (6 July 2005) version 0.4 Jean-Philippe Barrette-LaPierre (6 July 2005) version 0.4
- Fixed all autotools problems. - Fixed all autotools problems.
- Updated all autotools scripts to use PortAudioCpp - Updated all autotools scripts to use PortAudioCpp.
Jean-Philippe Barrette-LaPierre (9 June 2005) version 0.4 Jean-Philippe Barrette-LaPierre (9 June 2005) version 0.4
- Added the autotools support. - Added the autotools support.

View File

@ -216,7 +216,6 @@ MyDisplay::renderText (QPainter &painter, QFontMetrics &fm, QString &str) {
if (fm.width(str) > (_centerImage.width() - 5)) { if (fm.width(str) > (_centerImage.width() - 5)) {
extra_chars = str.length() - cpl; extra_chars = str.length() - cpl;
x_offset = fm.width(str[0]) * extra_chars; x_offset = fm.width(str[0]) * extra_chars;
x_offset = fm.width(str[0]) * extra_chars;
// Hack the scrolled string to inform the user // Hack the scrolled string to inform the user
backup_string[0] = str[extra_chars]; backup_string[0] = str[extra_chars];

View File

@ -156,6 +156,7 @@ QtGUIMainWindow::QtGUIMainWindow (QWidget *parent,
// Handle the tray icon system // Handle the tray icon system
_mypop = new QPopupMenu(this); _mypop = new QPopupMenu(this);
_mypop->insertItem ("Quit", qApp, SLOT(quit())); _mypop->insertItem ("Quit", qApp, SLOT(quit()));
_mypop->insertItem ("Compose", _urlinput, SLOT(show()));
_trayicon = new MyTrayIcon(QPixmap( _trayicon = new MyTrayIcon(QPixmap(
Skin::getPathPixmap(QString(PIXDIR), QString(TRAY_ICON))), Skin::getPathPixmap(QString(PIXDIR), QString(TRAY_ICON))),
@ -368,13 +369,13 @@ QtGUIMainWindow::initButtons (void) {
QToolTip::add(reduce_button, tr("Minimize window")); QToolTip::add(reduce_button, tr("Minimize window"));
QToolTip::add(quit_button, tr("Close window (Ctrl+Q)")); QToolTip::add(quit_button, tr("Close window (Ctrl+Q)"));
QToolTip::add(phoneKey_msg, tr("Get your message")); QToolTip::add(phoneKey_msg, tr("Get your message"));
QToolTip::add(phoneKey_transf, tr("Call transfer")); QToolTip::add(phoneKey_transf, tr("Call transfer (Ctrl+T)"));
QToolTip::add(phoneKey_conf, tr("Conference")); QToolTip::add(phoneKey_conf, tr("Conference"));
QToolTip::add(addr_book_button, tr("Address book")); QToolTip::add(addr_book_button, tr("Address book"));
QToolTip::add(configuration_button, tr("Configuration tools (Ctrl+C)")); QToolTip::add(configuration_button, tr("Configuration tools (Ctrl+C)"));
QToolTip::add(hangup_button, tr("Hangup")); QToolTip::add(hangup_button, tr("Hangup (Esc)"));
QToolTip::add(dial_button, tr("Dial")); QToolTip::add(dial_button, tr("Dial (Enter)"));
QToolTip::add(mute_button, tr("Mute")); QToolTip::add(mute_button, tr("Mute (Ctrl+M)"));
QToolTip::add(dtmf_button, tr("Show DTMF _keypad (Ctrl+D)")); QToolTip::add(dtmf_button, tr("Show DTMF _keypad (Ctrl+D)"));
// Buttons position // Buttons position
@ -605,7 +606,9 @@ QtGUIMainWindow::putOnHoldBusyLine (int line)
if (!getCall(line2id(line))->isRinging() and !getCall(line2id(line))->isProgressing()) { if (!getCall(line2id(line))->isRinging() and !getCall(line2id(line))->isProgressing()) {
// Occurs when newly off-hook line replaces another one. // Occurs when newly off-hook line replaces another one.
_debug("On hold line %d [id=%d]\n", line, line2id(line)); _debug("On hold line %d [id=%d]\n", line, line2id(line));
qt_onHoldCall(line2id(line)); if (qt_onHoldCall(line2id(line)) != 1) {
return -1;
}
} }
changeLineStatePixmap(line, ONHOLD); changeLineStatePixmap(line, ONHOLD);
return 1; return 1;
@ -679,12 +682,17 @@ int
QtGUIMainWindow::callIsOnHold(int id, int line, int busyLine) QtGUIMainWindow::callIsOnHold(int id, int line, int busyLine)
{ {
changeLineStatePixmap(line, BUSY); changeLineStatePixmap(line, BUSY);
putOnHoldBusyLine(busyLine); if (putOnHoldBusyLine(busyLine) == -1) {
Manager::instance().displayErrorText("Off-hold call failed !\n");
return -1;
}
if (getChooseLine()) { if (getChooseLine()) {
// If a free line is off-hook, set this line to free state // If a free line is off-hook, set this line to free state
setChooseLine(false); setChooseLine(false);
changeLineStatePixmap(getChosenLine(), FREE);
dialtone(false); dialtone(false);
if (busyLine == -1) {
changeLineStatePixmap(getChosenLine(), FREE);
}
} }
_lcd->setInFunction(true); _lcd->setInFunction(true);
if (qt_offHoldCall(id) != 1) { if (qt_offHoldCall(id) != 1) {
@ -715,7 +723,16 @@ QtGUIMainWindow::clickOnFreeLine(int line, int busyLine)
setChooseLine(true); setChooseLine(true);
setChosenLine(line); setChosenLine(line);
putOnHoldBusyLine(busyLine); if (!Manager::instance().getbCongestion()) {
putOnHoldBusyLine(busyLine);
} else {
// When a new line is off-hook -> hangup the previous line
// which runs congestion tone
changeLineStatePixmap(busyLine, FREE);
_lcd->clear(QString(ENTER_NUMBER_STATUS));
Manager::instance().congestion(false);
phLines[busyLine]->setCallId(0);
}
if (getPrevLine() != -1 and getPrevLine() != line if (getPrevLine() != -1 and getPrevLine() != line
and phLines[getPrevLine()]->isFree()) { and phLines[getPrevLine()]->isFree()) {
changeLineStatePixmap(getPrevLine(), FREE); changeLineStatePixmap(getPrevLine(), FREE);
@ -1029,7 +1046,7 @@ QtGUIMainWindow::qt_transferCall (short id)
int i; int i;
if (id != -1) { if (id != -1) {
const string to(_lcd->getTextBuffer().ascii());; const string to(_lcd->getTextBuffer().ascii());;
_debug("qt_transferCall: Transfer call %d to %s\n", id, to.data()); _debug("qt_transferCall: Transfer call %d to %s number\n", id, to.data());
i = transferCall(id, to); i = transferCall(id, to);
getPhoneLine(id)->setStatus(QString(getCall(id)->getStatus())); getPhoneLine(id)->setStatus(QString(getCall(id)->getStatus()));
return i; return i;
@ -1181,16 +1198,18 @@ QtGUIMainWindow::hangupLine (void)
int i; int i;
int line = getCurrentLine(); int line = getCurrentLine();
int id = phLines[line]->getCallId(); int id = phLines[line]->getCallId();
setTransfer(false);
_debug("id = %d et line = %d\n", id, line);
if (Manager::instance().getbCongestion()) { setTransfer(false);
if (Manager::instance().getbCongestion() and line != -1) {
// If congestion tone // If congestion tone
if (qt_hangupCall(id)) { if (id > 0 and qt_hangupCall(id)) {
changeLineStatePixmap(line, FREE); changeLineStatePixmap(line, FREE);
_lcd->clear(QString(ENTER_NUMBER_STATUS)); _lcd->clear(QString(ENTER_NUMBER_STATUS));
Manager::instance().congestion(false); Manager::instance().congestion(false);
phLines[line]->setCallId(0); phLines[line]->setCallId(0);
} else if (id == 0) {
changeLineStatePixmap(line, FREE);
} else { } else {
Manager::instance().displayErrorText("Hangup call failed !\n"); Manager::instance().displayErrorText("Hangup call failed !\n");
} }
@ -1199,6 +1218,7 @@ QtGUIMainWindow::hangupLine (void)
_debug("Refuse call %d\n", id); _debug("Refuse call %d\n", id);
if (qt_refuseCall(i)) { if (qt_refuseCall(i)) {
changeLineStatePixmap(id2line(i), FREE); changeLineStatePixmap(id2line(i), FREE);
phLines[id2line(i)]->setCallId(0);
} else { } else {
Manager::instance().displayErrorText("Refused call failed !\n"); Manager::instance().displayErrorText("Refused call failed !\n");
} }
@ -1326,7 +1346,8 @@ QtGUIMainWindow::button_msg (void) {
void void
QtGUIMainWindow::button_transfer (void) { QtGUIMainWindow::button_transfer (void) {
int line_num = getCurrentLine(); int line_num = getCurrentLine();
if (line_num != -1 and phLines[line_num]->isBusy()) { if (line_num != -1 and phLines[line_num]->isBusy()
and !Manager::instance().getbCongestion()) {
setTransfer(true); setTransfer(true);
onHoldCall(line2id(getCurrentLine())); onHoldCall(line2id(getCurrentLine()));
displayStatus(TRANSFER_STATUS); displayStatus(TRANSFER_STATUS);
@ -1379,7 +1400,7 @@ QtGUIMainWindow::button_mute(void)
int id = line2id(getCurrentLine()); int id = line2id(getCurrentLine());
if (Manager::instance().getNumberOfCalls() > 0) { if (id != -1 and Manager::instance().getNumberOfCalls() > 0) {
// If there is at least a pending call // If there is at least a pending call
if(!isOn) { if(!isOn) {
qt_muteOff(id); qt_muteOff(id);
@ -1553,6 +1574,7 @@ QtGUIMainWindow::stripSlot (void) {
QRegExp rx(REG_EXPR); QRegExp rx(REG_EXPR);
_lcd->appendText(_urlinput->url->text().remove(rx)); _lcd->appendText(_urlinput->url->text().remove(rx));
_urlinput->close(); _urlinput->close();
dial();
} }
/** /**
@ -1591,8 +1613,10 @@ QtGUIMainWindow::pressedKeySlot (int id) {
callid = line2id(getCurrentLine()); callid = line2id(getCurrentLine());
if (callid != -1 and getCall(callid)->isBusy()) { if (callid != -1 and getCall(callid)->isBusy()) {
sendDtmf(callid, code); // pour envoyer DTMF // To send DTMF during call, no display of them
sendDtmf(callid, code);
} else if (Manager::instance().isDriverLoaded()) { } else if (Manager::instance().isDriverLoaded()) {
// To compose, phone number appears in the screen
_lcd->appendText (code); _lcd->appendText (code);
} }
@ -1618,10 +1642,15 @@ QtGUIMainWindow::pressedKeySlot (int id) {
Manager::instance().getAudioDriver()->urgentRingBuffer().Put(buf_ctrl_vol, Manager::instance().getAudioDriver()->urgentRingBuffer().Put(buf_ctrl_vol,
size * CHANNELS); size * CHANNELS);
Manager::instance().getAudioDriver()->startStream(); // We activate the stream if it's not active yet.
Manager::instance().getAudioDriver()->sleep(pulselen); if (!Manager::instance().getAudioDriver()->isStreamActive()) {
Manager::instance().getAudioDriver()->stopStream(); Manager::instance().getAudioDriver()->startStream();
Manager::instance().getAudioDriver()->urgentRingBuffer().flush(); Manager::instance().getAudioDriver()->sleep(pulselen);
Manager::instance().getAudioDriver()->stopStream();
Manager::instance().getAudioDriver()->urgentRingBuffer().flush();
} else {
Manager::instance().getAudioDriver()->sleep(pulselen);
}
delete[] buf_ctrl_vol; delete[] buf_ctrl_vol;
} }
@ -1767,36 +1796,46 @@ QtGUIMainWindow::keyPressEvent(QKeyEvent *e) {
return; return;
break; break;
// To clear the screen
case Qt::Key_L: case Qt::Key_L:
if (e->state() == Qt::ControlButton ) { if (e->state() == Qt::ControlButton ) {
_lcd->clear(); _lcd->clear();
return; return;
} }
break; break;
// To quit the application
case Qt::Key_Q : case Qt::Key_Q :
if (e->state() == Qt::ControlButton ) { if (e->state() == Qt::ControlButton ) {
emit keyPressed(e->key()); emit keyPressed(e->key());
return; return;
} }
break; break;
// To open input line
case Qt::Key_O : case Qt::Key_O :
if (e->state() == Qt::ControlButton ) { if (e->state() == Qt::ControlButton ) {
_urlinput->show(); _urlinput->show();
return; return;
} }
break; break;
// To show window setup
case Qt::Key_C : case Qt::Key_C :
if (e->state() == Qt::ControlButton ) { if (e->state() == Qt::ControlButton ) {
configuration(); configuration();
return; return;
} }
break; break;
// To show/hide dtmf-keypad
case Qt::Key_D : case Qt::Key_D :
if (e->state() == Qt::ControlButton ) { if (e->state() == Qt::ControlButton ) {
dtmfKeypad(); dtmfKeypad();
return; return;
} }
break; break;
// To set mode (text/num)
case Qt::Key_Space: case Qt::Key_Space:
if (this->isInNumMode()) { if (this->isInNumMode()) {
this->setMode(TEXT_MODE); this->setMode(TEXT_MODE);
@ -1806,6 +1845,22 @@ QtGUIMainWindow::keyPressEvent(QKeyEvent *e) {
return; return;
break; break;
// To put mute on/off the mike sound
case Qt::Key_M :
if (e->state() == Qt::ControlButton ) {
button_mute();
return;
}
break;
// To transfer call
case Qt::Key_T :
if (e->state() == Qt::ControlButton ) {
button_transfer();
return;
}
break;
case Qt::Key_Alt: case Qt::Key_Alt:
case Qt::Key_CapsLock: case Qt::Key_CapsLock:
case Qt::Key_Shift: case Qt::Key_Shift:

View File

@ -288,8 +288,9 @@ ManagerImpl::hangupCall (short id)
Call* call; Call* call;
call = getCall(id); call = getCall(id);
if (call == NULL) if (call == NULL) {
return -1; return -1;
}
call->setStatus(string(HUNGUP_STATUS)); call->setStatus(string(HUNGUP_STATUS));
call->setState(Hungup); call->setState(Hungup);
_mutex.enterMutex(); _mutex.enterMutex();

View File

@ -597,6 +597,7 @@ SipVoIPLink::getEvent (void)
setRegister(); setRegister();
countReg++; countReg++;
} }
break; break;
case EXOSIP_OPTIONS_NEW: case EXOSIP_OPTIONS_NEW: