mirror of https://github.com/qTox/qTox.git
4 changed files with 2843 additions and 2831 deletions
@ -1,73 +1,118 @@ |
|||||||
#------------------------------------------------- |
#------------------------------------------------- |
||||||
# |
# |
||||||
# Project created by QtCreator 2014-06-22T14:07:35 |
# Project created by QtCreator 2014-06-22T14:07:35 |
||||||
# |
# |
||||||
#------------------------------------------------- |
#------------------------------------------------- |
||||||
|
|
||||||
QT += core gui multimedia |
QT += core gui multimedia multimediawidgets |
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets |
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets |
||||||
|
|
||||||
TARGET = toxgui |
TARGET = toxgui |
||||||
TEMPLATE = app |
TEMPLATE = app |
||||||
|
|
||||||
HEADERS += widget/form/addfriendform.h \ |
HEADERS += widget/form/addfriendform.h \ |
||||||
widget/form/chatform.h \ |
widget/form/chatform.h \ |
||||||
widget/form/groupchatform.h \ |
widget/form/groupchatform.h \ |
||||||
widget/form/settingsform.h \ |
widget/form/settingsform.h \ |
||||||
widget/tool/chattextedit.h \ |
widget/tool/chattextedit.h \ |
||||||
widget/tool/copyableelidelabel.h \ |
widget/tool/copyableelidelabel.h \ |
||||||
widget/tool/editablelabelwidget.h \ |
widget/tool/editablelabelwidget.h \ |
||||||
widget/tool/elidelabel.h \ |
widget/tool/elidelabel.h \ |
||||||
widget/tool/esclineedit.h \ |
widget/tool/esclineedit.h \ |
||||||
widget/tool/friendrequestdialog.h \ |
widget/tool/friendrequestdialog.h \ |
||||||
widget/filetransfertwidget.h \ |
widget/filetransfertwidget.h \ |
||||||
widget/friendwidget.h \ |
widget/friendwidget.h \ |
||||||
widget/groupwidget.h \ |
widget/groupwidget.h \ |
||||||
widget/widget.h \ |
widget/widget.h \ |
||||||
friend.h \ |
friend.h \ |
||||||
group.h \ |
group.h \ |
||||||
grouplist.h \ |
grouplist.h \ |
||||||
settings.h \ |
settings.h \ |
||||||
status.h \ |
status.h \ |
||||||
core.h \ |
core.h \ |
||||||
friendlist.h \ |
friendlist.h \ |
||||||
cdata.h \ |
cdata.h \ |
||||||
cstring.h \ |
cstring.h \ |
||||||
audiobuffer.h |
audiobuffer.h \ |
||||||
|
widget/selfcamview.h |
||||||
FORMS += widget.ui |
|
||||||
|
FORMS += widget.ui |
||||||
CONFIG += c++11 |
|
||||||
|
CONFIG += c++11 |
||||||
RESOURCES += \ |
|
||||||
res.qrc |
RESOURCES += \ |
||||||
|
res.qrc |
||||||
LIBS += -ltoxcore -ltoxav -lsodium |
|
||||||
|
LIBS += -ltoxcore -ltoxav -lsodium |
||||||
SOURCES += \ |
|
||||||
widget/form/addfriendform.cpp \ |
SOURCES += \ |
||||||
widget/form/chatform.cpp \ |
widget/form/addfriendform.cpp \ |
||||||
widget/form/groupchatform.cpp \ |
widget/form/chatform.cpp \ |
||||||
widget/form/settingsform.cpp \ |
widget/form/groupchatform.cpp \ |
||||||
widget/tool/chattextedit.cpp \ |
widget/form/settingsform.cpp \ |
||||||
widget/tool/copyableelidelabel.cpp \ |
widget/tool/chattextedit.cpp \ |
||||||
widget/tool/editablelabelwidget.cpp \ |
widget/tool/copyableelidelabel.cpp \ |
||||||
widget/tool/elidelabel.cpp \ |
widget/tool/editablelabelwidget.cpp \ |
||||||
widget/tool/esclineedit.cpp \ |
widget/tool/elidelabel.cpp \ |
||||||
widget/tool/friendrequestdialog.cpp \ |
widget/tool/esclineedit.cpp \ |
||||||
widget/filetransfertwidget.cpp \ |
widget/tool/friendrequestdialog.cpp \ |
||||||
widget/friendwidget.cpp \ |
widget/filetransfertwidget.cpp \ |
||||||
widget/groupwidget.cpp \ |
widget/friendwidget.cpp \ |
||||||
widget/widget.cpp \ |
widget/groupwidget.cpp \ |
||||||
core.cpp \ |
widget/widget.cpp \ |
||||||
friend.cpp \ |
core.cpp \ |
||||||
friendlist.cpp \ |
friend.cpp \ |
||||||
group.cpp \ |
friendlist.cpp \ |
||||||
grouplist.cpp \ |
group.cpp \ |
||||||
main.cpp \ |
grouplist.cpp \ |
||||||
settings.cpp \ |
main.cpp \ |
||||||
status.cpp \ |
settings.cpp \ |
||||||
cdata.cpp \ |
status.cpp \ |
||||||
cstring.cpp \ |
cdata.cpp \ |
||||||
audiobuffer.cpp |
cstring.cpp \ |
||||||
|
audiobuffer.cpp \ |
||||||
|
widget/selfcamview.cpp |
||||||
|
|
||||||
|
win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -ltoxcore |
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/toxcore.lib |
||||||
|
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libtoxcore.a |
||||||
|
|
||||||
|
win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -ltoxav |
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/toxav.lib |
||||||
|
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libtoxav.a |
||||||
|
|
||||||
|
win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -lvpx |
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/vpx.lib |
||||||
|
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libvpx.a |
||||||
|
|
||||||
|
|
||||||
|
win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -lopus |
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/opus.lib |
||||||
|
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libopus.a |
||||||
|
|
||||||
|
win32: LIBS += -lws2_32 |
||||||
|
|
||||||
|
win32: LIBS += -L$$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/ -lsodium |
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
DEPENDPATH += $$PWD/../../../../Downloads/libtoxcore-win32-i686/include |
||||||
|
|
||||||
|
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/sodium.lib |
||||||
|
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../../Downloads/libtoxcore-win32-i686/lib/libsodium.a |
||||||
|
@ -1,80 +1,80 @@ |
|||||||
#include "selfcamview.h" |
#include "selfcamview.h" |
||||||
#include <QActionGroup> |
#include <QActionGroup> |
||||||
#include <QMessageBox> |
#include <QMessageBox> |
||||||
#include <QCloseEvent> |
#include <QCloseEvent> |
||||||
#include <QShowEvent> |
#include <QShowEvent> |
||||||
|
|
||||||
SelfCamView::SelfCamView(QWidget* parent) |
SelfCamView::SelfCamView(QWidget* parent) |
||||||
: QWidget(parent), camera(nullptr), mainLayout{new QHBoxLayout()} |
: QWidget(parent), camera(nullptr), mainLayout{new QHBoxLayout()} |
||||||
{ |
{ |
||||||
setLayout(mainLayout); |
setLayout(mainLayout); |
||||||
setWindowTitle("Tox video test"); |
setWindowTitle("Tox video test"); |
||||||
setMinimumSize(320,240); |
setMinimumSize(320,240); |
||||||
|
|
||||||
QByteArray cameraDevice; |
QByteArray cameraDevice; |
||||||
|
|
||||||
/*
|
/*
|
||||||
QActionGroup *videoDevicesGroup = new QActionGroup(this); |
QActionGroup *videoDevicesGroup = new QActionGroup(this); |
||||||
videoDevicesGroup->setExclusive(true); |
videoDevicesGroup->setExclusive(true); |
||||||
foreach(const QByteArray &deviceName, QCamera::availableDevices()) { |
foreach(const QByteArray &deviceName, QCamera::availableDevices()) { |
||||||
QString description = camera->deviceDescription(deviceName); |
QString description = camera->deviceDescription(deviceName); |
||||||
QAction *videoDeviceAction = new QAction(description, videoDevicesGroup); |
QAction *videoDeviceAction = new QAction(description, videoDevicesGroup); |
||||||
videoDeviceAction->setCheckable(true); |
videoDeviceAction->setCheckable(true); |
||||||
videoDeviceAction->setData(QVariant(deviceName)); |
videoDeviceAction->setData(QVariant(deviceName)); |
||||||
if (cameraDevice.isEmpty()) { |
if (cameraDevice.isEmpty()) { |
||||||
cameraDevice = deviceName; |
cameraDevice = deviceName; |
||||||
videoDeviceAction->setChecked(true); |
videoDeviceAction->setChecked(true); |
||||||
} |
} |
||||||
ui->menuDevices->addAction(videoDeviceAction); |
ui->menuDevices->addAction(videoDeviceAction); |
||||||
} |
} |
||||||
|
|
||||||
connect(videoDevicesGroup, SIGNAL(triggered(QAction*)), SLOT(updateCameraDevice(QAction*))); |
connect(videoDevicesGroup, SIGNAL(triggered(QAction*)), SLOT(updateCameraDevice(QAction*))); |
||||||
*/ |
*/ |
||||||
|
|
||||||
viewfinder = new QCameraViewfinder(this); |
viewfinder = new QCameraViewfinder(this); |
||||||
mainLayout->addWidget(viewfinder); |
mainLayout->addWidget(viewfinder); |
||||||
viewfinder->show(); |
viewfinder->show(); |
||||||
|
|
||||||
setCamera(cameraDevice); |
setCamera(cameraDevice); |
||||||
} |
} |
||||||
|
|
||||||
SelfCamView::~SelfCamView() |
SelfCamView::~SelfCamView() |
||||||
{ |
{ |
||||||
delete camera; |
delete camera; |
||||||
} |
} |
||||||
|
|
||||||
void SelfCamView::setCamera(const QByteArray &cameraDevice) |
void SelfCamView::setCamera(const QByteArray &cameraDevice) |
||||||
{ |
{ |
||||||
delete camera; |
delete camera; |
||||||
|
|
||||||
if (cameraDevice.isEmpty()) |
if (cameraDevice.isEmpty()) |
||||||
camera = new QCamera; |
camera = new QCamera; |
||||||
else |
else |
||||||
camera = new QCamera(cameraDevice); |
camera = new QCamera(cameraDevice); |
||||||
|
|
||||||
//connect(camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(updateCameraState(QCamera::State)));
|
//connect(camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(updateCameraState(QCamera::State)));
|
||||||
connect(camera, SIGNAL(error(QCamera::Error)), this, SLOT(displayCameraError())); |
connect(camera, SIGNAL(error(QCamera::Error)), this, SLOT(displayCameraError())); |
||||||
|
|
||||||
camera->setViewfinder(viewfinder); |
camera->setViewfinder(viewfinder); |
||||||
|
|
||||||
//updateCameraState(camera->state());
|
//updateCameraState(camera->state());
|
||||||
|
|
||||||
camera->setCaptureMode(QCamera::CaptureVideo); |
camera->setCaptureMode(QCamera::CaptureVideo); |
||||||
} |
} |
||||||
|
|
||||||
void SelfCamView::displayCameraError() |
void SelfCamView::displayCameraError() |
||||||
{ |
{ |
||||||
QMessageBox::warning(this, tr("Camera error"), camera->errorString()); |
QMessageBox::warning(this, tr("Camera error"), camera->errorString()); |
||||||
} |
} |
||||||
|
|
||||||
void SelfCamView::closeEvent(QCloseEvent* event) |
void SelfCamView::closeEvent(QCloseEvent* event) |
||||||
{ |
{ |
||||||
camera->stop(); |
camera->stop(); |
||||||
event->accept(); |
event->accept(); |
||||||
} |
} |
||||||
|
|
||||||
void SelfCamView::showEvent(QShowEvent* event) |
void SelfCamView::showEvent(QShowEvent* event) |
||||||
{ |
{ |
||||||
camera->start(); |
camera->start(); |
||||||
event->accept(); |
event->accept(); |
||||||
} |
} |
||||||
|
@ -1,37 +1,37 @@ |
|||||||
#ifndef SELFCAMVIEW_H |
#ifndef SELFCAMVIEW_H |
||||||
#define SELFCAMVIEW_H |
#define SELFCAMVIEW_H |
||||||
|
|
||||||
#include <QCamera> |
#include <QCamera> |
||||||
#include <QCameraImageCapture> |
#include <QCameraImageCapture> |
||||||
#include <QMediaRecorder> |
#include <QMediaRecorder> |
||||||
#include <QWidget> |
#include <QWidget> |
||||||
#include <QVideoWidget> |
#include <QVideoWidget> |
||||||
#include <QCameraViewfinder> |
#include <QCameraViewfinder> |
||||||
#include <QHBoxLayout> |
#include <QHBoxLayout> |
||||||
|
|
||||||
class QCloseEvent; |
class QCloseEvent; |
||||||
class QShowEvent; |
class QShowEvent; |
||||||
|
|
||||||
class SelfCamView : public QWidget |
class SelfCamView : public QWidget |
||||||
{ |
{ |
||||||
Q_OBJECT |
Q_OBJECT |
||||||
|
|
||||||
public: |
public: |
||||||
SelfCamView(QWidget *parent=0); |
SelfCamView(QWidget *parent=0); |
||||||
~SelfCamView(); |
~SelfCamView(); |
||||||
|
|
||||||
private: |
private: |
||||||
void closeEvent(QCloseEvent*); |
void closeEvent(QCloseEvent*); |
||||||
void showEvent(QShowEvent*); |
void showEvent(QShowEvent*); |
||||||
|
|
||||||
private slots: |
private slots: |
||||||
void setCamera(const QByteArray &cameraDevice); |
void setCamera(const QByteArray &cameraDevice); |
||||||
void displayCameraError(); |
void displayCameraError(); |
||||||
|
|
||||||
private: |
private: |
||||||
QCamera *camera; |
QCamera *camera; |
||||||
QCameraViewfinder* viewfinder; |
QCameraViewfinder* viewfinder; |
||||||
QHBoxLayout* mainLayout; |
QHBoxLayout* mainLayout; |
||||||
}; |
}; |
||||||
|
|
||||||
#endif // SELFCAMVIEW_H
|
#endif // SELFCAMVIEW_H
|
||||||
|
Loading…
Reference in new issue