summaryrefslogtreecommitdiffstats
path: root/pica-client
diff options
context:
space:
mode:
authorAnton <anton@picapica>2021-06-29 02:13:06 +0400
committerAnton <anton@picapica>2021-06-29 02:13:06 +0400
commit1a150eb79fc9c041622a63d51e9a1adfd47c8bcd (patch)
tree3bdb401dec525a9d88201829485e50b6b8ae5009 /pica-client
parent2d1002443c245c54f92f4bee31cb2d0232ce15e7 (diff)
downloadpica-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.cpp22
-rw-r--r--pica-client/audiovideocallcontroller.h35
-rw-r--r--pica-client/callwindow.cpp35
-rw-r--r--pica-client/callwindow.h37
-rw-r--r--pica-client/contactlistwidget.cpp10
-rw-r--r--pica-client/contactlistwidget.h2
-rw-r--r--pica-client/dialogs/settingsdialog.cpp4
-rw-r--r--pica-client/globals.h1
-rw-r--r--pica-client/main.cpp5
-rw-r--r--pica-client/mediadevice.h3
-rw-r--r--pica-client/msguirouter.cpp10
-rw-r--r--pica-client/pica-client.pro4
-rw-r--r--pica-client/videodevice.cpp12
-rw-r--r--pica-client/videodevice.h3
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