diff options
| author | Anton <anton@picapica> | 2021-06-29 02:13:06 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2021-06-29 02:13:06 +0400 |
| commit | 1a150eb79fc9c041622a63d51e9a1adfd47c8bcd (patch) | |
| tree | 3bdb401dec525a9d88201829485e50b6b8ae5009 /pica-client | |
| parent | 2d1002443c245c54f92f4bee31cb2d0232ce15e7 (diff) | |
| download | pica-pica-1a150eb79fc9c041622a63d51e9a1adfd47c8bcd.tar.gz pica-pica-1a150eb79fc9c041622a63d51e9a1adfd47c8bcd.zip | |
add audiovideocallcontroller and callwindow, menu action to initiate call
Diffstat (limited to 'pica-client')
| -rw-r--r-- | pica-client/audiovideocallcontroller.cpp | 22 | ||||
| -rw-r--r-- | pica-client/audiovideocallcontroller.h | 35 | ||||
| -rw-r--r-- | pica-client/callwindow.cpp | 35 | ||||
| -rw-r--r-- | pica-client/callwindow.h | 37 | ||||
| -rw-r--r-- | pica-client/contactlistwidget.cpp | 10 | ||||
| -rw-r--r-- | pica-client/contactlistwidget.h | 2 | ||||
| -rw-r--r-- | pica-client/dialogs/settingsdialog.cpp | 4 | ||||
| -rw-r--r-- | pica-client/globals.h | 1 | ||||
| -rw-r--r-- | pica-client/main.cpp | 5 | ||||
| -rw-r--r-- | pica-client/mediadevice.h | 3 | ||||
| -rw-r--r-- | pica-client/msguirouter.cpp | 10 | ||||
| -rw-r--r-- | pica-client/pica-client.pro | 4 | ||||
| -rw-r--r-- | pica-client/videodevice.cpp | 12 | ||||
| -rw-r--r-- | pica-client/videodevice.h | 3 |
14 files changed, 172 insertions, 11 deletions
diff --git a/pica-client/audiovideocallcontroller.cpp b/pica-client/audiovideocallcontroller.cpp new file mode 100644 index 0000000..97557af --- /dev/null +++ b/pica-client/audiovideocallcontroller.cpp @@ -0,0 +1,22 @@ +#include "audiovideocallcontroller.h" +#include "globals.h" +#include "skynet.h" +#include <QByteArray> + +AudioVideoCallController::AudioVideoCallController(QObject *parent) + : QObject(parent), callwindow(0) +{ + +} + +void AudioVideoCallController::start_call(QByteArray peer_id) +{ + if (callwindow) + { + /* call is already in progress */ + return; + } + + callwindow = new CallWindow(peer_id); + callwindow->show(); +} diff --git a/pica-client/audiovideocallcontroller.h b/pica-client/audiovideocallcontroller.h new file mode 100644 index 0000000..9bc9c38 --- /dev/null +++ b/pica-client/audiovideocallcontroller.h @@ -0,0 +1,35 @@ +/* + (c) Copyright 2012 - 2021 Anton Sviridenko + https://picapica.im + + 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, version 3. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef AUDIOVIDEOCALLCONTROLLER_H +#define AUDIOVIDEOCALLCONTROLLER_H + +#include <QObject> +#include "callwindow.h" + +class AudioVideoCallController : public QObject +{ + Q_OBJECT +public: + explicit AudioVideoCallController(QObject *parent = nullptr); +public slots: + void start_call(QByteArray peer_id); +signals: +private: + CallWindow *callwindow; +}; + +#endif // AUDIOVIDEOCALLCONTROLLER_H diff --git a/pica-client/callwindow.cpp b/pica-client/callwindow.cpp new file mode 100644 index 0000000..d63f1b7 --- /dev/null +++ b/pica-client/callwindow.cpp @@ -0,0 +1,35 @@ +/* + (c) Copyright 2012 - 2020 Anton Sviridenko + https://picapica.im + + 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, version 3. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +#include "callwindow.h" +#include <QHBoxLayout> +#include <QVBoxLayout> + +CallWindow::CallWindow(QByteArray peer_id) + : m_peer_id(peer_id) +{ + QHBoxLayout *lh = new QHBoxLayout(this); + QVBoxLayout *lv = new QVBoxLayout(this); + + pbCall = new QPushButton(tr("Call"), this); + pbHang = new QPushButton(tr("Hang Up"), this); + + lh->addWidget(pbCall, Qt::AlignRight); + lh->addWidget(pbHang, Qt::AlignLeft); + lh->addLayout(lv); + setLayout(lh); +} diff --git a/pica-client/callwindow.h b/pica-client/callwindow.h new file mode 100644 index 0000000..2a0431e --- /dev/null +++ b/pica-client/callwindow.h @@ -0,0 +1,37 @@ + +/* + (c) Copyright 2012 - 2018 Anton Sviridenko + https://picapica.im + + 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, version 3. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef CALLWINDOW_H +#define CALLWINDOW_H + +#include <QWidget> +#include <QPushButton> +#include <QLabel> + +class CallWindow : public QWidget +{ + Q_OBJECT +public: + explicit CallWindow(QByteArray peer_id); +private: + QByteArray m_peer_id; + QPushButton *pbCall; + QPushButton *pbHang; +}; + +#endif + diff --git a/pica-client/contactlistwidget.cpp b/pica-client/contactlistwidget.cpp index 0e19bb6..eed4abf 100644 --- a/pica-client/contactlistwidget.cpp +++ b/pica-client/contactlistwidget.cpp @@ -21,6 +21,7 @@ #include "dialogs/filetransferdialog.h" #include "msguirouter.h" #include "filetransfercontroller.h" +#include "audiovideocallcontroller.h" #include <QMenu> #include <QMessageBox> #include <QContextMenuEvent> @@ -42,6 +43,9 @@ ContactListWidget::ContactListWidget(QWidget *parent) : startchatAct = new QAction(tr("Start &Chat"), this); connect(startchatAct, SIGNAL(triggered()), this, SLOT(start_chat())); + startcallAct = new QAction(tr("Start Ca&ll π"), this); + connect(startcallAct, SIGNAL(triggered()), this, SLOT(start_call())); + viewcertAct = new QAction(tr("&View Certificate"), this); connect(viewcertAct, SIGNAL(triggered()), this, SLOT(view_cert())); @@ -84,6 +88,7 @@ void ContactListWidget::contextMenuEvent(QContextMenuEvent *event) if (this->itemAt(event->pos()) && wgitem_to_recs.contains(this->itemAt(event->pos()))) { menu.addAction(startchatAct); + menu.addAction(startcallAct); menu.addAction(viewcertAct); menu.addAction(showidAct); menu.addAction(sendfileAct); @@ -227,6 +232,11 @@ void ContactListWidget::start_chat() msguirouter->start_chat(wgitem_to_recs[currentItem()]->id); } +void ContactListWidget::start_call() +{ + avctrl->start_call(wgitem_to_recs[currentItem()]->id); +} + void ContactListWidget::view_cert() { QString cert_pem = storage->GetContactCert(wgitem_to_recs[currentItem()]->id); diff --git a/pica-client/contactlistwidget.h b/pica-client/contactlistwidget.h index b58fdfe..4800b46 100644 --- a/pica-client/contactlistwidget.h +++ b/pica-client/contactlistwidget.h @@ -33,6 +33,7 @@ public: QAction *addcontactAct; QAction *delcontactAct; QAction *startchatAct; + QAction *startcallAct; QAction *viewcertAct; QAction *showidAct; QAction *sendfileAct; @@ -59,6 +60,7 @@ private slots: void add_contact(); void del_contact(); void start_chat(); + void start_call(); void view_cert(); void show_id(); void send_file(); diff --git a/pica-client/dialogs/settingsdialog.cpp b/pica-client/dialogs/settingsdialog.cpp index 6dc3832..8bd7abb 100644 --- a/pica-client/dialogs/settingsdialog.cpp +++ b/pica-client/dialogs/settingsdialog.cpp @@ -120,8 +120,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) : multilogintab->setLayout(multiloginlayout); // Audio Devices - QLabel *lbAudioCaptureDev = new QLabel(tr("Microphone Device")); - QLabel *lbAudioPlaybackDev = new QLabel(tr("Playback device")); + QLabel *lbAudioCaptureDev = new QLabel(tr("Microphone Device ποΈ")); + QLabel *lbAudioPlaybackDev = new QLabel(tr("Playback device π§")); audioCaptureDev = new QComboBox(this); audioCaptureDev->addItem(QString("default")); diff --git a/pica-client/globals.h b/pica-client/globals.h index 1817f3c..ab359d6 100644 --- a/pica-client/globals.h +++ b/pica-client/globals.h @@ -42,6 +42,7 @@ extern class QIcon picapica_ico_fly; extern class PicaActionCenter *action_center; extern class PicaSysTray *systray; extern class FileTransferController *ftctrl; +extern class AudioVideoCallController *avctrl; extern class QString snd_newmessage; extern class AccountsWindow *accwindow; #endif // GLOBALS_H diff --git a/pica-client/main.cpp b/pica-client/main.cpp index d44025d..e4b7ca9 100644 --- a/pica-client/main.cpp +++ b/pica-client/main.cpp @@ -24,6 +24,7 @@ #include "skynet.h" #include "msguirouter.h" #include "filetransfercontroller.h" +#include "audiovideocallcontroller.h" #include "picaactioncenter.h" #include "picasystray.h" #include <QDir> @@ -51,6 +52,7 @@ QIcon picapica_ico_fly; class PicaActionCenter *action_center; class PicaSysTray *systray; class FileTransferController *ftctrl; +class AudioVideoCallController *avctrl; class AccountsWindow *accwindow; QString config_defaultDHParam; @@ -544,6 +546,9 @@ int main(int argc, char *argv[]) FileTransferController ftc; ftctrl = &ftc; + AudioVideoCallController avc; + avctrl = &avc; + aw.show(); a.setQuitOnLastWindowClosed(false); diff --git a/pica-client/mediadevice.h b/pica-client/mediadevice.h index d8660f6..14fe291 100644 --- a/pica-client/mediadevice.h +++ b/pica-client/mediadevice.h @@ -17,6 +17,9 @@ public: MediaDevice(); virtual ~MediaDevice(); virtual QList<MediaDeviceInfo> Enumerate() = 0; + virtual void Capture() = 0; + virtual void Play() = 0; + virtual void Close() = 0; }; #endif // MEDIADEVICE_H diff --git a/pica-client/msguirouter.cpp b/pica-client/msguirouter.cpp index 88a272c..20897fd 100644 --- a/pica-client/msguirouter.cpp +++ b/pica-client/msguirouter.cpp @@ -23,15 +23,7 @@ #include "globals.h" #include "sound.h" -/* - ΡΡΠΎΡ ΠΊΠ»Π°ΡΡ Π΄ΠΎΠ»ΠΆΠ΅Π½ ΠΎΠ±Π΅ΡΠΏΠ΅ΡΠΈΠ²Π°ΡΡ ΡΠ²ΡΠ·Ρ ΠΌΠ΅ΠΆΠ΄Ρ ΠΏΡΠΈΡΠΌΠΎΠΌ-ΠΎΡΠΏΡΠ°Π²ΠΊΠΎΠΉ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΉ ΠΈ ΠΈΡ
ΠΎΡΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ΠΌ Π² ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»ΡΡΠΊΠΎΠΌ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ΅. - ΠΠ»Π°ΡΡ SkyNet ΠΎΡΠ²Π΅ΡΠ°Π΅Ρ ΡΠΎΠ»ΡΠΊΠΎ Π·Π° ΠΏΡΠΈΠ΅ΠΌ ΠΈ ΠΎΡΠΏΡΠ°Π²ΠΊΡ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΉ, ΠΏΠ΅ΡΠ΅ΡΡΠ»ΠΊΡ ΡΠ΅ΡΠ΅Π· ΡΠ΅ΡΡ ΠΈ ΡΠ°Π±ΠΎΡΡ Ρ ΠΏΡΠΎΡΠΎΠΊΠΎΠ»ΠΎΠΌ, Π΅ΠΌΡ ΠΏΠΎΡΠΈΠ³, - ΠΊΠ°ΠΊ ΠΎΠ½ΠΈ ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°ΡΡΡΡ ΡΠ·Π΅ΡΡ. ΠΠ°Π½Π½ΡΠΉ ΠΊΠ»Π°ΡΡ Π΄ΠΎΠ»ΠΆΠ΅Π½ ΡΠ°Π±ΠΎΡΠ°ΡΡ Ρ GUI, Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, ΠΏΠΎ ΠΏΡΠΈΡ
ΠΎΠ΄Ρ Π½ΠΎΠ²ΠΎΠ³ΠΎ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ (ΡΠ΅ΡΠ΅Π· ΡΠΈΠ³Π½Π°Π» ΠΎΡ - ΠΊΠ»Π°ΡΡΠ° SkyNet) Π»ΠΈΠ±ΠΎ ΠΏΠΎΠΌΠΈΠ³Π°ΡΡ ΠΈΠΊΠΎΠ½ΠΊΠΎΠΉ Π² ΡΡΠ΅Π΅, Π»ΠΈΠ±ΠΎ ΡΠΎΠ·Π΄Π°ΡΡ Π½ΠΎΠ²ΠΎΠ΅ ΠΎΠΊΠ½ΠΎ ΡΠ°ΡΠ°, Π»ΠΈΠ±ΠΎ ΡΠ°Π·Π²Π΅ΡΠ½ΡΡΡ ΡΠΆΠ΅ ΠΈΠΌΠ΅ΡΡΠ΅Π΅ΡΡ, Π»ΠΈΠ±ΠΎ ΠΏΠΎΠΌΠΈΠ³Π°ΡΡ - ΡΠ²Π΅ΡΠ½ΡΡΡΠΌ ΠΎΠΊΠ½ΠΎΠΌ Π½Π° ΡΠ°ΡΠΊΠ±Π°ΡΠ΅. ΠΡΠΎ ΠΏΠΎΠ²Π΅Π΄Π΅Π½ΠΈΠ΅ ΠΌΠΎΠΆΠ΅Ρ Π½Π°ΡΡΡΠ°ΠΈΠ²Π°ΡΡΡΡ, Π½Π°ΡΡΡΠΎΠΉΠΊΠΈ Ρ
ΡΠ°Π½ΠΈΡΡ Π² Π±Π°Π·Π΅ ΠΈ Π·Π°Π³ΡΡΠΆΠ°ΡΡ Π² ΠΊΠΎΠ½ΡΡΡΡΠΊΡΠΎΡΠ΅ ΠΈΠ· - Π±Π°Π·Ρ sqlite. ΠΠ°ΠΏΡΠΈΠΌΠ΅Ρ, Π΄Π°Π½Π½ΡΠΉ ΠΊΠ»Π°ΡΡ Π΄ΠΎΠ»ΠΆΠ΅Π½ ΡΠΏΡΠ°Π²Π»ΡΡΡ ΡΠΊΠ·Π΅ΠΌΠΏΠ»ΡΡΠ°ΠΌΠΈ ChatWindow, ΡΠΎΠ·Π΄Π°Π²Π°ΡΡ Π½ΠΎΠ²ΡΠ΅ ΠΏΡΠΈ Π½Π΅ΠΎΠ±Ρ
ΠΎΠ΄ΠΈΠΌΠΎΡΡΠΈ Π»ΠΈΠ±ΠΎ - Π°ΠΊΡΠΈΠ²ΠΈΡΠΎΠ²Π°ΡΡ ΠΈΠΌΠ΅ΡΡΠΈΠ΅ΡΡ. - */ + MsgUIRouter::MsgUIRouter(QObject *parent) : QObject(parent) { diff --git a/pica-client/pica-client.pro b/pica-client/pica-client.pro index a701d12..87dc462 100644 --- a/pica-client/pica-client.pro +++ b/pica-client/pica-client.pro @@ -12,8 +12,10 @@ TEMPLATE = app SOURCES += main.cpp\ audiodevice.cpp \ + audiovideocallcontroller.cpp \ mainwindow.cpp \ chatwindow.cpp \ + callwindow.cpp \ contacts.cpp \ ../PICA_client.c \ ../PICA_msgproc.c \ @@ -48,7 +50,9 @@ SOURCES += main.cpp\ HEADERS += mainwindow.h \ audiodevice.h \ + audiovideocallcontroller.h \ chatwindow.h \ + callwindow.h \ contacts.h \ globals.h \ ../PICA_client.h \ diff --git a/pica-client/videodevice.cpp b/pica-client/videodevice.cpp index 75b516b..24b5b98 100644 --- a/pica-client/videodevice.cpp +++ b/pica-client/videodevice.cpp @@ -11,6 +11,18 @@ VideoDevice::~VideoDevice() } +void VideoDevice::Capture() +{ +} + +void VideoDevice::Play() +{ +} + +void VideoDevice::Close() +{ +} + QList<MediaDeviceInfo> VideoDevice::Enumerate() { QList<MediaDeviceInfo> result; diff --git a/pica-client/videodevice.h b/pica-client/videodevice.h index 0b714c7..f880b4c 100644 --- a/pica-client/videodevice.h +++ b/pica-client/videodevice.h @@ -9,6 +9,9 @@ public: VideoDevice(); ~VideoDevice(); virtual QList<MediaDeviceInfo> Enumerate(); + void Capture(); + void Play(); + void Close(); }; #endif // VIDEODEVICE_H |
