From 666a49773d06ac94c19996d763854725c2f7a578 Mon Sep 17 00:00:00 2001 From: harlekin Date: Sun, 22 Feb 2004 23:38:58 +0000 Subject: initial checkin of opie linphone, not really usefull yet, just to make sure I dont loose any data --- (limited to 'noncore') diff --git a/noncore/net/linphone/.cvsignore b/noncore/net/linphone/.cvsignore new file mode 100644 index 0000000..e971ae6 --- a/dev/null +++ b/noncore/net/linphone/.cvsignore @@ -0,0 +1,6 @@ +.moc +Makefile +mainwidget.cpp +mainwidget.h +settingsdialog.cpp +settingsdialog.h diff --git a/noncore/net/linphone/linphone.pro b/noncore/net/linphone/linphone.pro new file mode 100644 index 0000000..9f9163c --- a/dev/null +++ b/noncore/net/linphone/linphone.pro @@ -0,0 +1,12 @@ +CONFIG += qt warn on release quick-app + +HEADERS = qlinphone.h mainwindow.h linphoneconfig.h +SOURCES = qlinphone.cpp mainwindow.cpp linphoneconfig.cpp main.cpp +INTERFACES = mainwidget.ui settingsdialog.ui + +INCLUDEPATH += $(OPIEDIR)/include /usr/include/linphone /usr/include/osipua /usr/include/ortp /usr/include/glib-2.0 /usr/lib/glib-2.0/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopie -llinphone +TARGET = olinphone + +include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/linphone/linphoneconfig.cpp b/noncore/net/linphone/linphoneconfig.cpp new file mode 100644 index 0000000..ee02e1a --- a/dev/null +++ b/noncore/net/linphone/linphoneconfig.cpp @@ -0,0 +1,65 @@ +#include +#include +#include +#include + +#include + +#include "linphoneconfig.h" + + +LinPhoneConfig::LinPhoneConfig( QWidget* parent , const char* name , bool modal, WFlags fl ) : SettingsDialog( parent, name, modal, fl ) { + loadConfig(); +} + +LinPhoneConfig::~LinPhoneConfig() { +} + +void LinPhoneConfig::loadConfig() { + Config cfg("opie-phone"); + cfg.setGroup( "net" ); + cfg.setGroup( "sip" ); + PortSpin->setValue( cfg.readNumEntry( "sip_port", 5060 ) ); + UserPartLine->setText( cfg.readEntry( "username", "" ) ); + HostPartLine->setText( cfg.readEntry( "hostname", "" ) ); + CheckBoxReg->setChecked( cfg.readBoolEntry( "use_registrar", 0 ) ); + ServerAddressLine->setText( cfg.readEntry( "registrar", "" ) ); + // cannot use crypt due to gnome stuff in linephone + PasswordLine->setText( cfg.readEntry( "reg_password", "" ) ); + RecordLine->setText( cfg.readEntry( "addr_of_rec", "" ) ); + CheckBoxProxy->setChecked( cfg.readBoolEntry( "as_proxy", 0 ) ); + cfg.setGroup( "rtp" ); + RTPPort->setText( cfg.readEntry( "audio_rtp_port", "" ) ); + SliderJitter->setValue( cfg.readNumEntry( "jitt_comp", 60 ) ); + cfg.setGroup( "audio" ); + // source + cfg.setGroup( "video" ); + cfg.setGroup( "codecs" ); + cfg.setGroup( "address_book" ); +} + +void LinPhoneConfig::writeConfig() { + Config cfg("opie-phone"); + cfg.setGroup( "net" ); + cfg.setGroup( "sip" ); + cfg.writeEntry( "sip_port", PortSpin->value() ); + cfg.writeEntry( "username", UserPartLine->text() ); + cfg.writeEntry( "hostname", HostPartLine->text() ); + cfg.writeEntry( "use_registrar", CheckBoxReg->isChecked() ); + cfg.writeEntry( "registrar", ServerAddressLine->text() ); + cfg.writeEntry( "reg_password", PasswordLine->text() ); + cfg.writeEntry( "addr_of_rec", RecordLine->text() ); + cfg.writeEntry( "as_proxy", CheckBoxProxy->isChecked() ); + cfg.setGroup( "rtp" ); + cfg.writeEntry( "audio_rtp_port", RTPPort->text() ); + cfg.writeEntry( "jitt_comp", SliderJitter->value() ); + cfg.setGroup( "audio" ); + cfg.setGroup( "video" ); + cfg.setGroup( "codecs" ); + cfg.setGroup( "address_book" ); +} + +void LinPhoneConfig::accept() { + writeConfig(); + QDialog::accept(); +} diff --git a/noncore/net/linphone/linphoneconfig.h b/noncore/net/linphone/linphoneconfig.h new file mode 100644 index 0000000..6ab8947 --- a/dev/null +++ b/noncore/net/linphone/linphoneconfig.h @@ -0,0 +1,21 @@ +#ifndef LINPHONECONFIG_H +#define LINPHONECONFIG_H + +#include "settingsdialog.h" + +class LinPhoneConfig : public SettingsDialog { + + Q_OBJECT + +public: + LinPhoneConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + virtual ~LinPhoneConfig(); + +private slots: + void accept(); + +private: + void writeConfig(); + void loadConfig(); +}; +#endif diff --git a/noncore/net/linphone/main.cpp b/noncore/net/linphone/main.cpp new file mode 100644 index 0000000..9146fee --- a/dev/null +++ b/noncore/net/linphone/main.cpp @@ -0,0 +1,22 @@ +/*************************************************************************** + main-opie.cpp - description + ------------------- + begin : ven mai 23 19:26:00 CEST 2003 + copyright : (C) 2003 by Simon Morlat + email : simon.morlat@linphone.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include +#include "mainwindow.h" + +OPIE_EXPORT_APP( OApplicationFactory ) + + diff --git a/noncore/net/linphone/mainwidget.ui b/noncore/net/linphone/mainwidget.ui new file mode 100644 index 0000000..b354713 --- a/dev/null +++ b/noncore/net/linphone/mainwidget.ui @@ -0,0 +1,714 @@ + +_QLinphoneMainWidget + + QWidget + + name + _QLinphoneMainWidget + + + geometry + + 0 + 0 + 385 + 410 + + + + sizePolicy + + 7 + 7 + + + + caption + opie-phone + SIP internet phone + + + icon + image0 + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QFrame + + name + Frame5 + + + sizePolicy + + 7 + 7 + + + + frameShape + StyledPanel + + + frameShadow + Raised + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QLineEdit + + name + sip_url + + + text + sip: + + + + QLayoutWidget + + name + Layout10 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + _callbutton + + + text + Call/Answer + + + + QPushButton + + name + _hangupbutton + + + text + Hangup/Refuse + + + + + + QCheckBox + + name + CheckBox1 + + + text + Show more + + + + QTabWidget + + name + TabWidget2 + + + layoutMargin + + + layoutSpacing + + + QWidget + + name + tab + + + title + Sound + + + + margin + 3 + + + spacing + 3 + + + + name + Spacer2 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QLabel + + name + TextLabel1 + + + text + Output Level + + + + QLabel + + name + TextLabel2 + + + text + Input Level + + + + + name + Spacer3 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QSlider + + name + SliderInput + + + maxValue + 100 + + + orientation + Horizontal + + + + QLabel + + name + TextLabel2_2 + + + text + TextLabel2 + + + + QLabel + + name + TextLabel1_2 + + + text + TextLabel1 + + + + QSlider + + name + SliderOutput + + + maxValue + 100 + + + orientation + Horizontal + + + + + + QWidget + + name + tab + + + title + Avail + + + + QWidget + + name + tab + + + title + DTMF + + + + margin + 3 + + + spacing + 3 + + + QLineEdit + + name + LineEdit2 + + + + QLayoutWidget + + name + Layout5 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + PushB1 + + + text + 1 + + + + QPushButton + + name + PushB2 + + + text + 2 + + + + QPushButton + + name + PushB3 + + + text + 3 + + + + + + QLayoutWidget + + name + Layout6 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + PushB4 + + + text + 4 + + + + QPushButton + + name + PushB5 + + + text + 5 + + + + QPushButton + + name + PushB6 + + + text + 6 + + + + + + QLayoutWidget + + name + Layout7 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + PushB7 + + + text + 7 + + + + QPushButton + + name + PushB8 + + + text + 8 + + + + QPushButton + + name + PushB9 + + + text + 9 + + + + + + QLayoutWidget + + name + Layout8 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + PushButton12 + + + text + * + + + + QPushButton + + name + PushB0 + + + text + 0 + + + + QPushButton + + name + PushBSharp + + + text + # + + + + + + + + QWidget + + name + tab + + + title + My friends + + + + margin + 3 + + + spacing + 3 + + + QListView + + name + FriendListView + + + + QLayoutWidget + + name + Layout10 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + PushButtonAdd + + + text + Add friend + + + + QPushButton + + name + PushButtonDel + + + text + delete + + + + QPushButton + + name + PushButton17 + + + text + Add add. book + + + + + + + + + + name + Spacer4 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + Line + + name + Line1 + + + orientation + Horizontal + + + + QLabel + + name + status_bar + + + text + Status + + + + + + + + + QListView +
qlistview.h
+ + -1 + -1 + + 0 + + 5 + 5 + + image1 +
+
+ + + image0 + 789cb5985b532a4912c7dfcfa73026df4e6ce470e946888d7df08622a2888ae0c63e6475370a0272157562bffbfebb2aabbc9d9970cecc1e02e1d7999559999595559c5fbf6ff5daadadefbf7e5bae64354cb6923b596c7d4fd793c9f3bffff3afdfbefd1217b6a278ab542a6c957ef9c7b75fce575bc9d6e9c334cb41c6002ad87f399b8972a4bcb15cf52cf3c055cb9172d5b179544e94939c8b85c0a9e7a2b33f749cbfacbd7be548e54f96ab415e56f6f29972d5313d0676fed6ca8963a69c4b85c0578ef1c471d573c9f96b2a47ca6dcb35cfe641b9ea98aa816b56bfa59c289b9ccb45cfe6c573b968e5278ecb05d54f3c3b39dd58ae79e6a172a4f2b97255ed5d0776feac3c2a7ab91905b67232ca3a1ff3ca6e7ce6382a38e65dcf91f3df548ed4deb6672737b796c5ebcbb3b2d7bff2acf676028be5997255c78f025bb9dc28272a1f0476e3ed7ac5253f9ef702bbf14b653ffe29b0934f1cc705c766e939b69b4b0e9563c7e4c68bd767f1ece4bcad1cebfcba9e557ead5c531e0576f6f69553959bc0ce9eada74ac98f972365af9f0676f6ca8e2b45e53bcf1537bea71c3b265bdf1509fac79e557fa81c3bb9649e55be50ae3936cfcaa932e7bc5df6fa66a1acf153ddb3dabb0aece45365b5c78781dd7cd4fe76d1b111cfdb652bbf558e9d9c6b968dd7a754d9cb179edd783350f6f3697b7672be0d6cacbfbe72ea986cfeaa653f9efb9edd78ba0c6cf5b9a99caafd24b093b71d57353ebe0fecfcaf3c579dfd3be558d99e175513ecdf38f6e3a9e259f547cab1fa7ff6ece466aaacf3a73dcf4e2e75e554ed1de45c8b82bd13653fbee859c797023bf94059edf14e60177feab8a6f3e7416037fed6732db2fa3a9f5aace35f3c3b393bff89f727e781ddfc9d7e12ecef2bab3dce3cabbf8ab28f67e159e5bb81132bb7f52d91d7e79e67a74ff7819d7e4139557bd3c0562ec79ec5c577e4588a2adf538ed59e5d6f4982bdaa63d1fcf14160a79f28fbf1879e9d3f79501695973dabdcf65393fb77f19d06b6fadc52d6f15cf4ecc6d39972a6f1343cabfc38b0f31f3b3625c7c6de2f4ceaed9bb1b2b757f0acf39d39c678c7fb819d7ec7b371f2ae7245e7130576f12c3d3b7d5a2b8bdaab797672b6f94962ef9fcf94bd7d09ece29d28fb7c5160e77fec59e77ba9acf9e2c03abf46e0d4eac78e138d972e023bf98ee724b672bb7f92101f9f2b7bfb7dc7c1de26b0b377aaacf9e242602be727cfce9f59298b93d3ae6795dbfd94c6de9e6c023bfd9ab21fdff1ecc6cb85b2e683bb9e35de526037ff33c7a9e643ee025bb9719c797b429e9d3e478ec37809ecfc373ca74ebfaeacf9e04d60a73ff1ecf465ad2c8ec9f68bace2c75316d88daf288b63ea7956ff17ca1a3fc79e553e0dec7edf141d673a7f3a0f6ce564ef5759e6c7d3cab1d7e757b6fadc51ae283f78ce2a76fc525954bef6ece4627f9f0c2a61fc5c59e5ece599f22cb0d53f5ffdff5f7fc50f130b1b4e38e58c0778dff2dddfe787873ce27b1ef384a7fcc0339ebf7b2ffeba1f3bf725af78cd8fb0f8c81b7ee2677ee11d78dee53ddee703aef3e1cffb819523ccdfcd79cd0dd83ee6261ff2095e2d3ee533bcda7cce1dbee0cb9ff1c35798ed13e69ec7d0c52a5c738ffbd66efebac1930217b9c4658ee065ce315778fbcff9e12af23485fddccb92175c23e653223e2322b19f069f093f520aeb2be8c10b6534f8ba1fbea25b1b035682eef89a86b03aa27bce684c132ed1941e684673aed3829688b08068d6d05dc1d3faab7ee89136762dbafc4c4ff40c1f2fdcc2ac0fe1778776e06d97f66840fb8823816e420754a743eed08a8e38faaa1f64bc4d0d3ae6436ad209b5e894ceb8496d3c5fd3c2561b62a573c2ba23ca0bbaa42baaf30d3e17348266f72b7e30b323ba460e7a985b05dffbc8d20d9e16a8881d93d86cceecdbee192a5199228aa942db54a506f7be160f57a9867c60cec8761ddff01616c2e70d56aa63d76d22623fd75442cda562704f4b2942950f3996ec8ffdc8801772cb290d503d73fb5ad9988812da83c74b1ecb1daa6141c71463952ee161c83d48f7b13a13ca30a394ae78f3d1d35b3f32e21db997b1e4fa1798ed1a59c92b75841ae8e36f9d6a94c814eb728c9e56c59e69c983cc644ee75c9005388fbd2e4b59c99a873ff6032f8732b6797b41e46e0de6744d45ccf54836f2447579b6bb31f750c43e59c98bece0492203ca6486711bbb7f229acb2e1dffd8cf6b07c4be3842be7ab2878ca4ba3e135e62956bf8ded1795740893cc93ee28ce400332aa34623d5375c94fa673ff428a1ff2173981bea758cce729eaf8f1c71260b640df9c7eb09bdad629f37641ff9426e25df0311aaad956b40ef529a58e3db8f7e60a9f6a61e4eb0f235ecce3e4d685f5aa8b202f2a3b587b57b91d3fc3b6abe80cc0d309b36edc919bac22d62aa5959dec33734ffb43e19a5d20eb9bb9121f6f889ada731767e94c7626b2f8fa983782de3ef0b2af110cf06b28bf8ce316edfe9d10346773ed71b35dff674ecf03e6ae9426378f7c62e7e426eed77d950996f85d15a87d8c935ece57bbb8e15b9c4897b447b9feafa4a1a6ffcccf85d0cef3fd1c70a6ebdc0e788772a5d64f31a59ebf3b12cd0cef3f59bc93577f3bdf4266f53f9d02fe444369f6309ef1831641adfb1f4798908477283156374df99dd49f9ae5ad2ee3b3f6d1a7dec167896d839efe345ef63829f3b9c3dcaf2c435ac4e03796af05c8ad24065c08794f0bc20e3377eca382bcb9f3c45549418fbbf8b9df431a68eac72ef762ff5b1cf2fb1b73bb4918a3d37705a705fb6f94caaaf7e642435baa7ea673fc8c292aed08b069fd729ef637915db1adc487e0f79c1fd6a4587e8ee9c9fecf9a96b58c23d515ad412f3b99ff373feeb13eb4bf0f3b9ee56e8343dd403439ac7708c1abfe19621e7c1be856b465ef386bd9c980f9ed025a64e863ef9e3da5b613d76b880336880589a38179cf597d7cffc6614e23941af664e358aa131b94f6987275726c1cda9fe312678eb60ed4694d26998bfbd0be59ff64d74f29a3744fd98af06b6db1ecea03b8c8ea9873e7260ef3933f4ce217ec14fd0893ec4a473f76f42a7127b1f9a68e65a865feb1ab5d6371975d16f2f50f70d39c5de4bb07f629c75796515a96306e616f7b9d6fb98cc1dee5a2f32f3eb81bf13f7c6df67de36c3f7fd009d7689dd72cd97d4451fbd92b619d11c7533c609d437f798fd0a5e7b6688aedaf7315166c688e3f44d3ca4f1a4d4351377a2bde9d706ebd9e5c84c99cc0313ce86f0827684ddd5b4674f4c9199413e0bfb66285d7a575f5245ff8cbc87b77e707758a066f6696e32dc428a4466eef5e8ca8cd0171ecdc41858c73d10b53ec64a96f3fe4703b3785d1f33e65abe8e26f9b83f9c1fba412c389965cec62ca5670c763fc1e71027a59815aa36c2497782f543c6d019c7f6343c9186c96fdc880331c08394df47f1c94f8a6c47b81b9569475ae87d4d9c399dbc8ab15eb87d20e12b7b033ae03dc4d0f5d610558a3b694926a8c5dff1f0ea4796a8e0183db089aa15dcd362fbfba28e6c9f4b01bb196736aa0c273fa2bae6a6345f6de611fcb187573fe616fbe3597003c3ac23ac7486ea2ac2eb1332d1c65dbd877acb30f304f545d2fe8add1fe70d153c454ef25bc1193ae30c7364dcd38a2631eb7c8fa2c74db0be8fe89411b7e5e467fdd80ccc25321bf3e4ba0c6a6e803333fd981574fd062af0533d7dddcffb17f67d11abd295c95b3fa8c85323e6f9cf67eef77fcf61f51b7c83b2d8332fe641fd64b85f574df277fa81d5850c4dfe5baa801a89786056dc356bd4dba753f7aff9b1779e1acecb1af64e0fb598a0daaed107e9eff683ec0d8551d3114ebc0d6239e0eacf54f557ffff006b15a183ff9407f5f3df7f7efb1f2140aae1 + + + image1 + 789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753 + + + + + _callbutton + clicked() + _QLinphoneMainWidget + callOrAccept() + + + _hangupbutton + clicked() + _QLinphoneMainWidget + terminateCall() + + + SliderOutput + valueChanged(int) + TextLabel1_2 + setNum(int) + + + SliderInput + valueChanged(int) + TextLabel2_2 + setNum(int) + + callOrAccept() + terminateCall() + +
diff --git a/noncore/net/linphone/mainwindow.cpp b/noncore/net/linphone/mainwindow.cpp new file mode 100644 index 0000000..1bd9987 --- a/dev/null +++ b/noncore/net/linphone/mainwindow.cpp @@ -0,0 +1,37 @@ +#include +#include +#include + +#include "mainwindow.h" +#include "linphoneconfig.h" + +MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) +: QMainWindow( parent, name, flags ) { + + setCaption( tr( "Sip Phone" ) ); + setToolBarsMovable( false ); + + toolBar = new QToolBar( this ); + toolBar->setHorizontalStretchable( true ); + menuBar = new QMenuBar( toolBar ); + prefMenu = new QPopupMenu( menuBar ); + menuBar->insertItem( tr( "Connection" ), prefMenu ); + + settings = new QAction( tr("Settings"), QIconSet( Resource::loadPixmap("SettingsIcon") ), 0, 0, this); + settings->addTo( prefMenu ); + connect( settings, SIGNAL( activated() ), + SLOT( slotSettings() ) ); + + mainWidget = new QLinphoneMainWidget( this, "qlinphone", WStyle_ContextHelp ); + setCentralWidget( mainWidget ); +} + + +MainWindow::~MainWindow() {} + +void MainWindow::slotSettings() { + LinPhoneConfig settings( this, 0, true, WStyle_ContextHelp ); + QPEApplication::execDialog( &settings ); + // FIXME - only in OK case + mainWidget->createLinphoneCore(); +} diff --git a/noncore/net/linphone/mainwindow.h b/noncore/net/linphone/mainwindow.h new file mode 100644 index 0000000..5a9bafb --- a/dev/null +++ b/noncore/net/linphone/mainwindow.h @@ -0,0 +1,35 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +#include +#include +#include + +#include "qlinphone.h" + +class MainWindow : public QMainWindow { + Q_OBJECT + +public: + MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); + virtual ~MainWindow(); + + static QString appName() { + return QString::fromLatin1("olinphone"); + } + + QLinphoneMainWidget *mainWidget; + QToolBar *toolBar; + QMenuBar *menuBar; + QPopupMenu *prefMenu; + + QAction *settings; + +public slots: + void slotSettings(); + +}; + +#endif diff --git a/noncore/net/linphone/qlinphone.cpp b/noncore/net/linphone/qlinphone.cpp new file mode 100644 index 0000000..3cc2ebc --- a/dev/null +++ b/noncore/net/linphone/qlinphone.cpp @@ -0,0 +1,210 @@ +/*************************************************************************** + qlinphone.cpp - description + ------------------- + begin : sam mai 24 2003 + copyright : (C) 2003 by Simon Morlat, 2004 Maximilian Reiss + email : simon.morlat@linphone.org, harlekin@handhelds.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qlinphone.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { + static void stub(LinphoneCore*lc, char*msg) {} + + static void qt_show(LinphoneCore *lc) { + QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; + w->pushGuiTask(new ShowTask(w)); + } + + static void qt_inv_recv(LinphoneCore *lc, char *from) { + QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; + QString tmp(from); + w->pushGuiTask(new InviteReceivedTask(w,tmp)); + } + + static void qt_display_status(LinphoneCore *lc, char *status) { + QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; + QString tmp(status); + w->pushGuiTask(new UpdateStatusBarTask(w,tmp)); + } + static void qt_display_message(LinphoneCore *lc, char *message) { + QString qmsg(message); + QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; + w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); + } + static void qt_display_warning(LinphoneCore *lc, char *message) { + QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; + QString qmsg(message); + w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Warn)); + } + static void qt_display_url(LinphoneCore *lc, char *message, char *url) { + QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; + QString qmsg=QString(message)+QString(url); + w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); + } + static void qt_notify_recv(LinphoneCore *lc, const char *url, const char *status) { + } + + LinphoneCoreVTable lcvtable={ + show: + qt_show, + inv_recv: + qt_inv_recv, + bye_recv : + stub, + notify_recv : + qt_notify_recv, + display_status : + qt_display_status, + display_message : + qt_display_message, + display_warning : + qt_display_warning, + display_url : + qt_display_url, + display_question : + stub + }; + + +} //extern "C" + +void UpdateStatusBarTask::execute() { + static_cast(_w)->displayStatus(_msg); +} + +void InviteReceivedTask::execute() { + static_cast(_w)->inviteReceived(_msg); +} + +void DisplayMessageTask::execute() { + switch(_msgtype) { + case Info: + QMessageBox::information(0,QObject::tr("Information"),_msg); + break; + case Warn: + QMessageBox::warning(0,QObject::tr("Warning"),_msg); + break; + } +} + +QLinphoneMainWidget::QLinphoneMainWidget(QWidget* parent , const char* name , WFlags fl ) : +_QLinphoneMainWidget( parent, name, fl ) { + + readConfig(); + createLinphoneCore(); + connect( CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( slotHide( bool ) ) ); + CheckBox1->setChecked( true ); +} + +QLinphoneMainWidget::~QLinphoneMainWidget() { + linphone_core_destroy(_core); + writeConfig(); +} + +void QLinphoneMainWidget::slotHide( bool show ) { + if ( show ) { + TabWidget2->show(); + } else { + TabWidget2->hide(); + } +} + +void QLinphoneMainWidget::callOrAccept() { + if (linphone_core_inc_invite_pending(_core)) { + linphone_core_accept_dialog(_core,NULL); + return; + } + QString url=sip_url->text(); + linphone_core_invite(_core,(char*)url.ascii()); +} +void QLinphoneMainWidget::terminateCall() { + linphone_core_terminate_dialog(_core,NULL); +} + +void QLinphoneMainWidget::inviteReceived(QString &tmp) { + sip_url->setText(tmp); +} + +void QLinphoneMainWidget::displayStatus(QString &msg) { + status_bar->setText(msg); +} + +void QLinphoneMainWidget::pushGuiTask(GuiTask* g) { + _mutex.lock(); + _actionq.enqueue(g); + _mutex.unlock(); + printf("New action added to task list.\n"); +} + +void QLinphoneMainWidget::processGuiTasks() { + GuiTask *g; + _mutex.lock(); + while(!_actionq.isEmpty()) { + g=_actionq.dequeue(); + printf("Executing action...\n"); + g->execute(); + delete g; + } + _mutex.unlock(); +} + +void QLinphoneMainWidget::timerEvent(QTimerEvent *t) { + processGuiTasks(); +} + +void QLinphoneMainWidget::readConfig() { + Config cfg( "opie-phone" ); + cfg.setGroup( "audio" ); + SliderInput->setValue( cfg.readNumEntry( "rec_lev", 50 ) ); + SliderOutput->setValue( cfg.readNumEntry( "play_lev", 50 ) ); +} + +void QLinphoneMainWidget::writeConfig() { + Config cfg( "opie-phone" ); + cfg.setGroup( "audio" ); + cfg.writeEntry( "rec_lev", SliderInput->value() ); + cfg.writeEntry( "playlev", SliderOutput->value() ); +} + +void QLinphoneMainWidget::helpAbout() { + QMessageBox::about(this,tr("About Linphone"),tr("QT version of linphone\nJuly 2003 - Made in old Europe.")); +} + +void QLinphoneMainWidget::createLinphoneCore() { + if ( _core ) { + linphone_core_destroy(_core); + } + + gchar *home=getenv("HOME"); + gchar *suffix="/Settings/opie-phone.conf"; + if (home==0) + home=strdup("/root"); + gchar *config=new char[strlen(home)+strlen(suffix)+2]; + sprintf(config,"%s/%s",home,suffix); + /* tracing for osip */ + TRACE_INITIALIZE((trace_level_t)5,stdout); + _core=linphone_core_new(&lcvtable,config,(gpointer)this); + delete [] config; + startTimer(10); +} + diff --git a/noncore/net/linphone/qlinphone.h b/noncore/net/linphone/qlinphone.h new file mode 100644 index 0000000..4192a4c --- a/dev/null +++ b/noncore/net/linphone/qlinphone.h @@ -0,0 +1,138 @@ +/*************************************************************************** + qlinphone.h - description + ------------------- + begin : sam mai 24 2003 + copyright : (C) 2003 by Simon Morlat, 2004 Maximilian Reiss + email : simon.morlat@linphone.org, harlekin@handhelds.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "mainwidget.h" +#include +#include +#include +#include + +class GuiTask { +public: + GuiTask(QWidget *w) { + _w=w; + } + virtual void execute()=0; + virtual ~GuiTask() {} + ; +protected: + QWidget *_w; +}; + +class ShowTask: public GuiTask { +public: +ShowTask(QWidget *w) : GuiTask(w) {} + ; +private: + void execute() { + _w->show(); + } +}; + +class DisplaySomethingTask : public GuiTask { +public: +DisplaySomethingTask(QWidget* w,QString &msg): GuiTask(w) { + _msg=msg; + } +protected: + QString _msg; +}; + +class UpdateStatusBarTask : public DisplaySomethingTask { +public: +UpdateStatusBarTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {} + ; +private: + void execute(); +}; + +class InviteReceivedTask : public DisplaySomethingTask { +public: +InviteReceivedTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {} + ; +private: + void execute(); +}; + +class DisplayMessageTask : public DisplaySomethingTask { +public: + enum MessageType{Info,Warn}; +DisplayMessageTask(QWidget *w,QString &msg,MessageType type) : DisplaySomethingTask(w,msg) { + _msgtype=type; + }; +private: + void execute(); + MessageType _msgtype; +}; + + + +typedef struct _LinphoneCore LinphoneCore; + +class MyMutex { +public: + MyMutex() { + pthread_mutex_init(&_mutex,NULL); + } + void lock() { + pthread_mutex_lock(&_mutex); + } + void unlock() { + pthread_mutex_unlock(&_mutex); + } + ~MyMutex() { + pthread_mutex_destroy(&_mutex); + } +private: + pthread_mutex_t _mutex; +}; + +class QLinphoneMainWidget : public _QLinphoneMainWidget { + +Q_OBJECT + +public: + QLinphoneMainWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~QLinphoneMainWidget(); + + + void callOrAccept(); + void terminateCall(); + void inviteReceived(QString &from); + void displayStatus(QString &status); + void helpAbout(); + // make it private + void createLinphoneCore(); + void pushGuiTask(GuiTask* g); + +private slots: + void slotHide( bool show ); + +private: + void readConfig(); + void writeConfig(); + void processGuiTasks(); + void timerEvent(QTimerEvent *); + LinphoneCore *_core; + QQueue _actionq; + MyMutex _mutex; +}; + + diff --git a/noncore/net/linphone/settingsdialog.ui b/noncore/net/linphone/settingsdialog.ui new file mode 100644 index 0000000..69d3228 --- a/dev/null +++ b/noncore/net/linphone/settingsdialog.ui @@ -0,0 +1,797 @@ + +SettingsDialog + + QDialog + + name + SettingsDialog + + + geometry + + 0 + 0 + 393 + 459 + + + + caption + Settings + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QTabWidget + + name + TabWidget4 + + + layoutMargin + + + layoutSpacing + + + QWidget + + name + tab + + + title + Network + + + + margin + 3 + + + spacing + 3 + + + QGroupBox + + name + GroupBox1 + + + title + NAT traversal options (experimental) + + + orientation + Vertical + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QLayoutWidget + + name + Layout15 + + + + margin + 0 + + + spacing + 6 + + + QCheckBox + + name + CheckBoxNAT + + + text + Enable + + + + QLabel + + name + TextLabel1 + + + enabled + false + + + text + Firewall ip address (in dot notations): + + + + QLineEdit + + name + NatIpField + + + enabled + false + + + + + + + + QGroupBox + + name + GroupBox2 + + + title + RTP properties + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QLayoutWidget + + name + Layout17 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel2 + + + text + RTP port used for audio + + + + QLineEdit + + name + RTPPort + + + + + + QLayoutWidget + + name + Layout15 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel3 + + + text + buffer miliiseconds: + + + + QSlider + + name + SliderJitter + + + maxValue + 512 + + + orientation + Horizontal + + + + QLabel + + name + TextLabel3_2 + + + text + TextLabel3 + + + + + + + + + + QWidget + + name + tab + + + title + Sound device + + + + margin + 3 + + + spacing + 3 + + + QGroupBox + + name + GroupBox3 + + + title + Sound properties + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + TextLabel5 + + + text + Source: + + + + QComboBox + + name + SourceCombo + + + + QLabel + + name + TextLabel4 + + + text + Device: + + + + QComboBox + + name + DeviceCombo + + + + + + + + QWidget + + name + tab + + + title + SIP + + + + margin + 3 + + + spacing + 3 + + + QGroupBox + + name + GroupBox4 + + + title + Basic + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QLayoutWidget + + name + Layout19 + + + layoutSpacing + + + + margin + 0 + + + spacing + 3 + + + QLabel + + name + TextLabel6 + + + text + Port: + + + + + name + Spacer7 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QSpinBox + + name + PortSpin + + + maxValue + 64000 + + + value + 5060 + + + + + + QLayoutWidget + + name + Layout20 + + + layoutSpacing + + + + margin + 0 + + + spacing + 3 + + + QLabel + + name + TextLabel7 + + + text + Sip address: + + + + QLayoutWidget + + name + Layout18 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel8 + + + text + sip: + + + + QLineEdit + + name + UserPartLine + + + + QLabel + + name + TextLabel9 + + + text + @ + + + + QLineEdit + + name + HostPartLine + + + + + + + + + + QGroupBox + + name + GroupBox5 + + + title + Remote services + + + layoutMargin + + + layoutSpacing + + + + margin + 3 + + + spacing + 3 + + + QCheckBox + + name + CheckBoxReg + + + text + Use sip registrar + + + + QLayoutWidget + + name + Layout21 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel13 + + + enabled + false + + + text + Address of record: + + + + QLineEdit + + name + ServerAddressLine + + + enabled + false + + + + QLineEdit + + name + RecordLine + + + enabled + false + + + + QLineEdit + + name + PasswordLine + + + enabled + false + + + echoMode + Password + + + + QLabel + + name + TextLabel11 + + + enabled + false + + + text + Server address: + + + + QLabel + + name + TextLabel12 + + + enabled + false + + + text + Password: + + + + + + QCheckBox + + name + CheckBoxProxy + + + enabled + false + + + text + Use this registrar as proxy + + + + + + + + QWidget + + name + tab + + + title + Codecs + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + TextLabel14 + + + text + later + + + + + + + + + + SliderJitter + valueChanged(int) + TextLabel3_2 + setNum(int) + + + CheckBoxNAT + toggled(bool) + NatIpField + setEnabled(bool) + + + CheckBoxNAT + toggled(bool) + TextLabel1 + setEnabled(bool) + + + CheckBoxReg + toggled(bool) + CheckBoxProxy + setEnabled(bool) + + + CheckBoxReg + toggled(bool) + PasswordLine + setEnabled(bool) + + + CheckBoxReg + toggled(bool) + RecordLine + setEnabled(bool) + + + CheckBoxReg + toggled(bool) + ServerAddressLine + setEnabled(bool) + + + CheckBoxReg + toggled(bool) + TextLabel11 + setEnabled(bool) + + + CheckBoxReg + toggled(bool) + TextLabel12 + setEnabled(bool) + + + CheckBoxReg + toggled(bool) + TextLabel13 + setEnabled(bool) + + + -- cgit v0.9.0.2