mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Clean code, improve compilation speed
This commit is contained in:
parent
e91846e821
commit
a7c75e63a5
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cdata.h"
|
#include "cdata.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <tox/tox.h>
|
||||||
|
|
||||||
// CData
|
// CData
|
||||||
|
|
||||||
|
@ -54,6 +56,8 @@ uint16_t CData::fromString(const QString& data, uint8_t* cData)
|
||||||
|
|
||||||
// CUserId
|
// CUserId
|
||||||
|
|
||||||
|
const uint16_t CUserId::SIZE{TOX_CLIENT_ID_SIZE};
|
||||||
|
|
||||||
CUserId::CUserId(const QString &userId) :
|
CUserId::CUserId(const QString &userId) :
|
||||||
CData(userId, SIZE)
|
CData(userId, SIZE)
|
||||||
{
|
{
|
||||||
|
@ -68,6 +72,8 @@ QString CUserId::toString(const uint8_t* cUserId)
|
||||||
|
|
||||||
// CFriendAddress
|
// CFriendAddress
|
||||||
|
|
||||||
|
const uint16_t CFriendAddress::SIZE{TOX_FRIEND_ADDRESS_SIZE};
|
||||||
|
|
||||||
CFriendAddress::CFriendAddress(const QString &friendAddress) :
|
CFriendAddress::CFriendAddress(const QString &friendAddress) :
|
||||||
CData(friendAddress, SIZE)
|
CData(friendAddress, SIZE)
|
||||||
{
|
{
|
||||||
|
|
7
cdata.h
7
cdata.h
|
@ -18,9 +18,8 @@
|
||||||
#define CDATA_H
|
#define CDATA_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <QString>
|
|
||||||
#include "tox/tox.h"
|
|
||||||
|
|
||||||
|
class QString;
|
||||||
class CData
|
class CData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -48,7 +47,7 @@ public:
|
||||||
static QString toString(const uint8_t *cUserId);
|
static QString toString(const uint8_t *cUserId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint16_t SIZE = TOX_CLIENT_ID_SIZE;
|
static const uint16_t SIZE;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ public:
|
||||||
static QString toString(const uint8_t* cFriendAddress);
|
static QString toString(const uint8_t* cFriendAddress);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint16_t SIZE = TOX_FRIEND_ADDRESS_SIZE;
|
static const uint16_t SIZE;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
11
core.cpp
11
core.cpp
|
@ -20,6 +20,8 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "widget/widget.h"
|
#include "widget/widget.h"
|
||||||
|
|
||||||
|
#include <tox/tox.h>
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
@ -29,7 +31,9 @@
|
||||||
#include <QSaveFile>
|
#include <QSaveFile>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QTimer>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
const QString Core::CONFIG_FILE_NAME = "data";
|
const QString Core::CONFIG_FILE_NAME = "data";
|
||||||
QList<ToxFile> Core::fileSendQueue;
|
QList<ToxFile> Core::fileSendQueue;
|
||||||
|
@ -111,6 +115,11 @@ Core::~Core()
|
||||||
alcCaptureCloseDevice(alInDev);
|
alcCaptureCloseDevice(alInDev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core* Core::getInstance()
|
||||||
|
{
|
||||||
|
return Widget::getInstance()->getCore();
|
||||||
|
}
|
||||||
|
|
||||||
void Core::start()
|
void Core::start()
|
||||||
{
|
{
|
||||||
// IPv6 needed for LAN discovery, but can crash some weird routers. On by default, can be disabled in options.
|
// IPv6 needed for LAN discovery, but can crash some weird routers. On by default, can be disabled in options.
|
||||||
|
|
94
core.h
94
core.h
|
@ -17,102 +17,24 @@
|
||||||
#ifndef CORE_HPP
|
#ifndef CORE_HPP
|
||||||
#define CORE_HPP
|
#define CORE_HPP
|
||||||
|
|
||||||
#include <tox/tox.h>
|
|
||||||
#include <tox/toxav.h>
|
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
|
||||||
#include <OpenAL/al.h>
|
|
||||||
#include <OpenAL/alc.h>
|
|
||||||
#else
|
|
||||||
#include <AL/al.h>
|
|
||||||
#include <AL/alc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <QDateTime>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTimer>
|
|
||||||
#include <QString>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QList>
|
|
||||||
#include <QByteArray>
|
|
||||||
|
|
||||||
#define TOXAV_MAX_CALLS 16
|
#include "corestructs.h"
|
||||||
#define GROUPCHAT_MAX_SIZE 32
|
#include "coreav.h"
|
||||||
#define TOX_SAVE_INTERVAL 30*1000
|
#include "coredefines.h"
|
||||||
#define TOX_FILE_INTERVAL 0
|
|
||||||
#define TOX_BOOTSTRAP_INTERVAL 5*1000
|
|
||||||
#define TOXAV_RINGING_TIME 15
|
|
||||||
|
|
||||||
// TODO: Put that in the settings
|
|
||||||
#define TOXAV_MAX_VIDEO_WIDTH 1600
|
|
||||||
#define TOXAV_MAX_VIDEO_HEIGHT 1200
|
|
||||||
|
|
||||||
|
template <typename T> class QList;
|
||||||
class Camera;
|
class Camera;
|
||||||
|
class QTimer;
|
||||||
enum class Status : int {Online = 0, Away, Busy, Offline};
|
class QString;
|
||||||
|
|
||||||
struct DhtServer
|
|
||||||
{
|
|
||||||
QString name;
|
|
||||||
QString userId;
|
|
||||||
QString address;
|
|
||||||
int port;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ToxFile
|
|
||||||
{
|
|
||||||
enum FileStatus
|
|
||||||
{
|
|
||||||
STOPPED,
|
|
||||||
PAUSED,
|
|
||||||
TRANSMITTING
|
|
||||||
};
|
|
||||||
|
|
||||||
enum FileDirection : bool
|
|
||||||
{
|
|
||||||
SENDING,
|
|
||||||
RECEIVING
|
|
||||||
};
|
|
||||||
|
|
||||||
ToxFile()=default;
|
|
||||||
ToxFile(int FileNum, int FriendId, QByteArray FileName, QString FilePath, FileDirection Direction)
|
|
||||||
: fileNum(FileNum), friendId(FriendId), fileName{FileName}, filePath{FilePath}, file{new QFile(filePath)},
|
|
||||||
bytesSent{0}, filesize{0}, status{STOPPED}, direction{Direction}, sendTimer{nullptr} {}
|
|
||||||
~ToxFile(){}
|
|
||||||
void setFilePath(QString path) {filePath=path; file->setFileName(path);}
|
|
||||||
bool open(bool write) {return write?file->open(QIODevice::ReadWrite):file->open(QIODevice::ReadOnly);}
|
|
||||||
|
|
||||||
int fileNum;
|
|
||||||
int friendId;
|
|
||||||
QByteArray fileName;
|
|
||||||
QString filePath;
|
|
||||||
QFile* file;
|
|
||||||
long long bytesSent;
|
|
||||||
long long filesize;
|
|
||||||
FileStatus status;
|
|
||||||
FileDirection direction;
|
|
||||||
QTimer* sendTimer;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ToxCall
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ToxAvCSettings codecSettings;
|
|
||||||
QTimer *sendAudioTimer, *sendVideoTimer;
|
|
||||||
int callId;
|
|
||||||
int friendId;
|
|
||||||
bool videoEnabled;
|
|
||||||
bool active;
|
|
||||||
bool muteMic;
|
|
||||||
ALuint alSource;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Core : public QObject
|
class Core : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Core(Camera* cam, QThread* coreThread);
|
explicit Core(Camera* cam, QThread* coreThread);
|
||||||
|
static Core* getInstance(); ///< Returns the global widget's Core instance
|
||||||
~Core();
|
~Core();
|
||||||
|
|
||||||
int getGroupNumberPeers(int groupId) const;
|
int getGroupNumberPeers(int groupId) const;
|
||||||
|
@ -298,7 +220,7 @@ private:
|
||||||
QList<DhtServer> dhtServerList;
|
QList<DhtServer> dhtServerList;
|
||||||
int dhtServerId;
|
int dhtServerId;
|
||||||
static QList<ToxFile> fileSendQueue, fileRecvQueue;
|
static QList<ToxFile> fileSendQueue, fileRecvQueue;
|
||||||
static ToxCall calls[TOXAV_MAX_CALLS];
|
static ToxCall calls[];
|
||||||
|
|
||||||
static const QString CONFIG_FILE_NAME;
|
static const QString CONFIG_FILE_NAME;
|
||||||
static const int videobufsize;
|
static const int videobufsize;
|
||||||
|
|
14
coreav.cpp
14
coreav.cpp
|
@ -15,7 +15,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "widget/widget.h"
|
#include "widget/camera.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
ToxCall Core::calls[TOXAV_MAX_CALLS];
|
ToxCall Core::calls[TOXAV_MAX_CALLS];
|
||||||
const int Core::videobufsize{TOXAV_MAX_VIDEO_WIDTH * TOXAV_MAX_VIDEO_HEIGHT * 4};
|
const int Core::videobufsize{TOXAV_MAX_VIDEO_WIDTH * TOXAV_MAX_VIDEO_HEIGHT * 4};
|
||||||
|
@ -55,7 +57,7 @@ void Core::prepareCall(int friendId, int callId, ToxAv* toxav, bool videoEnabled
|
||||||
if (calls[callId].videoEnabled)
|
if (calls[callId].videoEnabled)
|
||||||
{
|
{
|
||||||
calls[callId].sendVideoTimer->start();
|
calls[callId].sendVideoTimer->start();
|
||||||
Widget::getInstance()->getCamera()->suscribe();
|
Camera::getInstance()->suscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,12 +73,12 @@ void Core::onAvMediaChange(void* toxav, int32_t callId, void* core)
|
||||||
{
|
{
|
||||||
calls[callId].videoEnabled = false;
|
calls[callId].videoEnabled = false;
|
||||||
calls[callId].sendVideoTimer->stop();
|
calls[callId].sendVideoTimer->stop();
|
||||||
Widget::getInstance()->getCamera()->unsuscribe();
|
Camera::getInstance()->unsuscribe();
|
||||||
emit ((Core*)core)->avMediaChange(friendId, callId, false);
|
emit ((Core*)core)->avMediaChange(friendId, callId, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Widget::getInstance()->getCamera()->suscribe();
|
Camera::getInstance()->suscribe();
|
||||||
calls[callId].videoEnabled = true;
|
calls[callId].videoEnabled = true;
|
||||||
calls[callId].sendVideoTimer->start();
|
calls[callId].sendVideoTimer->start();
|
||||||
emit ((Core*)core)->avMediaChange(friendId, callId, true);
|
emit ((Core*)core)->avMediaChange(friendId, callId, true);
|
||||||
|
@ -159,7 +161,7 @@ void Core::cleanupCall(int callId)
|
||||||
calls[callId].sendAudioTimer->stop();
|
calls[callId].sendAudioTimer->stop();
|
||||||
calls[callId].sendVideoTimer->stop();
|
calls[callId].sendVideoTimer->stop();
|
||||||
if (calls[callId].videoEnabled)
|
if (calls[callId].videoEnabled)
|
||||||
Widget::getInstance()->getCamera()->unsuscribe();
|
Camera::getInstance()->unsuscribe();
|
||||||
alcCaptureStop(alInDev);
|
alcCaptureStop(alInDev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +226,7 @@ void Core::playCallVideo(ToxAv*, int32_t callId, vpx_image_t* img, void *user_da
|
||||||
if (videoBusyness >= 1)
|
if (videoBusyness >= 1)
|
||||||
qWarning() << "Core: playCallVideo: Busy, dropping current frame";
|
qWarning() << "Core: playCallVideo: Busy, dropping current frame";
|
||||||
else
|
else
|
||||||
emit Widget::getInstance()->getCore()->videoFrameReceived(img);
|
emit Core::getInstance()->videoFrameReceived(img);
|
||||||
vpx_img_free(img);
|
vpx_img_free(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
29
coreav.h
Normal file
29
coreav.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef COREAV_H
|
||||||
|
#define COREAV_H
|
||||||
|
|
||||||
|
#include <tox/toxav.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
|
#include <OpenAL/al.h>
|
||||||
|
#include <OpenAL/alc.h>
|
||||||
|
#else
|
||||||
|
#include <AL/al.h>
|
||||||
|
#include <AL/alc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
|
struct ToxCall
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ToxAvCSettings codecSettings;
|
||||||
|
QTimer *sendAudioTimer, *sendVideoTimer;
|
||||||
|
int callId;
|
||||||
|
int friendId;
|
||||||
|
bool videoEnabled;
|
||||||
|
bool active;
|
||||||
|
bool muteMic;
|
||||||
|
ALuint alSource;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COREAV_H
|
15
coredefines.h
Normal file
15
coredefines.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef COREDEFINES_H
|
||||||
|
#define COREDEFINES_H
|
||||||
|
|
||||||
|
#define TOXAV_MAX_CALLS 16
|
||||||
|
#define GROUPCHAT_MAX_SIZE 32
|
||||||
|
#define TOX_SAVE_INTERVAL 30*1000
|
||||||
|
#define TOX_FILE_INTERVAL 0
|
||||||
|
#define TOX_BOOTSTRAP_INTERVAL 5*1000
|
||||||
|
#define TOXAV_RINGING_TIME 15
|
||||||
|
|
||||||
|
// TODO: Put that in the settings
|
||||||
|
#define TOXAV_MAX_VIDEO_WIDTH 1600
|
||||||
|
#define TOXAV_MAX_VIDEO_HEIGHT 1200
|
||||||
|
|
||||||
|
#endif // COREDEFINES_H
|
19
corestructs.cpp
Normal file
19
corestructs.cpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#include "corestructs.h"
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
ToxFile::ToxFile(int FileNum, int FriendId, QByteArray FileName, QString FilePath, FileDirection Direction)
|
||||||
|
: fileNum(FileNum), friendId(FriendId), fileName{FileName}, filePath{FilePath}, file{new QFile(filePath)},
|
||||||
|
bytesSent{0}, filesize{0}, status{STOPPED}, direction{Direction}, sendTimer{nullptr}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToxFile::setFilePath(QString path)
|
||||||
|
{
|
||||||
|
filePath=path;
|
||||||
|
file->setFileName(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ToxFile::open(bool write)
|
||||||
|
{
|
||||||
|
return write ? file->open(QIODevice::ReadWrite) : file->open(QIODevice::ReadOnly);
|
||||||
|
}
|
54
corestructs.h
Normal file
54
corestructs.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#ifndef CORESTRUCTS_H
|
||||||
|
#define CORESTRUCTS_H
|
||||||
|
|
||||||
|
// Some headers use Core structs but don't need to include all of core.h
|
||||||
|
// They should include this file directly instead to reduce compilation times
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
class QFile;
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
|
enum class Status : int {Online = 0, Away, Busy, Offline};
|
||||||
|
|
||||||
|
struct DhtServer
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
QString userId;
|
||||||
|
QString address;
|
||||||
|
int port;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ToxFile
|
||||||
|
{
|
||||||
|
enum FileStatus
|
||||||
|
{
|
||||||
|
STOPPED,
|
||||||
|
PAUSED,
|
||||||
|
TRANSMITTING
|
||||||
|
};
|
||||||
|
|
||||||
|
enum FileDirection : bool
|
||||||
|
{
|
||||||
|
SENDING,
|
||||||
|
RECEIVING
|
||||||
|
};
|
||||||
|
|
||||||
|
ToxFile()=default;
|
||||||
|
ToxFile(int FileNum, int FriendId, QByteArray FileName, QString FilePath, FileDirection Direction);
|
||||||
|
~ToxFile(){}
|
||||||
|
void setFilePath(QString path);
|
||||||
|
bool open(bool write);
|
||||||
|
|
||||||
|
int fileNum;
|
||||||
|
int friendId;
|
||||||
|
QByteArray fileName;
|
||||||
|
QString filePath;
|
||||||
|
QFile* file;
|
||||||
|
long long bytesSent;
|
||||||
|
long long filesize;
|
||||||
|
FileStatus status;
|
||||||
|
FileDirection direction;
|
||||||
|
QTimer* sendTimer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CORESTRUCTS_H
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cstring.h"
|
#include "cstring.h"
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
CString::CString(const QString& string)
|
CString::CString(const QString& string)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
#define CSTRING_H
|
#define CSTRING_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <QString>
|
|
||||||
|
class QString;
|
||||||
|
|
||||||
class CString
|
class CString
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,15 +15,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "filetransferinstance.h"
|
#include "filetransferinstance.h"
|
||||||
#include "widget/widget.h"
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "math.h"
|
#include <math.h>
|
||||||
#include "style.h"
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QPixmap>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
uint FileTransferInstance::Idconter = 0;
|
uint FileTransferInstance::Idconter = 0;
|
||||||
|
|
||||||
|
@ -93,7 +90,7 @@ void FileTransferInstance::onFileTransferCancelled(int FriendId, int FileNum, To
|
||||||
{
|
{
|
||||||
if (FileNum != fileNum || FriendId != friendId || Direction != direction)
|
if (FileNum != fileNum || FriendId != friendId || Direction != direction)
|
||||||
return;
|
return;
|
||||||
disconnect(Widget::getInstance()->getCore(),0,this,0);
|
disconnect(Core::getInstance(),0,this,0);
|
||||||
state = tsCanceled;
|
state = tsCanceled;
|
||||||
|
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
|
@ -103,7 +100,7 @@ void FileTransferInstance::onFileTransferFinished(ToxFile File)
|
||||||
{
|
{
|
||||||
if (File.fileNum != fileNum || File.friendId != friendId || File.direction != direction)
|
if (File.fileNum != fileNum || File.friendId != friendId || File.direction != direction)
|
||||||
return;
|
return;
|
||||||
disconnect(Widget::getInstance()->getCore(),0,this,0);
|
disconnect(Core::getInstance(),0,this,0);
|
||||||
|
|
||||||
if (File.direction == ToxFile::RECEIVING)
|
if (File.direction == ToxFile::RECEIVING)
|
||||||
{
|
{
|
||||||
|
@ -126,14 +123,14 @@ void FileTransferInstance::onFileTransferFinished(ToxFile File)
|
||||||
|
|
||||||
void FileTransferInstance::cancelTransfer()
|
void FileTransferInstance::cancelTransfer()
|
||||||
{
|
{
|
||||||
Widget::getInstance()->getCore()->cancelFileSend(friendId, fileNum);
|
Core::getInstance()->cancelFileSend(friendId, fileNum);
|
||||||
state = tsCanceled;
|
state = tsCanceled;
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileTransferInstance::rejectRecvRequest()
|
void FileTransferInstance::rejectRecvRequest()
|
||||||
{
|
{
|
||||||
Widget::getInstance()->getCore()->rejectFileRecvRequest(friendId, fileNum);
|
Core::getInstance()->rejectFileRecvRequest(friendId, fileNum);
|
||||||
onFileTransferCancelled(friendId, fileNum, direction);
|
onFileTransferCancelled(friendId, fileNum, direction);
|
||||||
state = tsCanceled;
|
state = tsCanceled;
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
|
@ -159,7 +156,7 @@ void FileTransferInstance::acceptRecvRequest()
|
||||||
QString path;
|
QString path;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
path = QFileDialog::getSaveFileName(Widget::getInstance(), tr("Save a file","Title of the file saving dialog"), QDir::current().filePath(filename));
|
path = QFileDialog::getSaveFileName(0, tr("Save a file","Title of the file saving dialog"), QDir::current().filePath(filename));
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
|
@ -170,13 +167,13 @@ void FileTransferInstance::acceptRecvRequest()
|
||||||
if (isFileWritable(path))
|
if (isFileWritable(path))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
QMessageBox::warning(Widget::getInstance(), tr("Location not writable","Title of permissions popup"), tr("You do not have permission to write that location. Choose another, or cancel the save dialog.", "text of permissions popup"));
|
QMessageBox::warning(0, tr("Location not writable","Title of permissions popup"), tr("You do not have permission to write that location. Choose another, or cancel the save dialog.", "text of permissions popup"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
savePath = path;
|
savePath = path;
|
||||||
|
|
||||||
Widget::getInstance()->getCore()->acceptFileRecvRequest(friendId, fileNum, path);
|
Core::getInstance()->acceptFileRecvRequest(friendId, fileNum, path);
|
||||||
state = tsProcessing;
|
state = tsProcessing;
|
||||||
|
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
|
@ -184,7 +181,7 @@ void FileTransferInstance::acceptRecvRequest()
|
||||||
|
|
||||||
void FileTransferInstance::pauseResumeRecv()
|
void FileTransferInstance::pauseResumeRecv()
|
||||||
{
|
{
|
||||||
Widget::getInstance()->getCore()->pauseResumeFileRecv(friendId, fileNum);
|
Core::getInstance()->pauseResumeFileRecv(friendId, fileNum);
|
||||||
if (state == tsProcessing)
|
if (state == tsProcessing)
|
||||||
state = tsPaused;
|
state = tsPaused;
|
||||||
else state = tsProcessing;
|
else state = tsProcessing;
|
||||||
|
@ -193,7 +190,7 @@ void FileTransferInstance::pauseResumeRecv()
|
||||||
|
|
||||||
void FileTransferInstance::pauseResumeSend()
|
void FileTransferInstance::pauseResumeSend()
|
||||||
{
|
{
|
||||||
Widget::getInstance()->getCore()->pauseResumeFileSend(friendId, fileNum);
|
Core::getInstance()->pauseResumeFileSend(friendId, fileNum);
|
||||||
if (state == tsProcessing)
|
if (state == tsProcessing)
|
||||||
state = tsPaused;
|
state = tsPaused;
|
||||||
else state = tsProcessing;
|
else state = tsProcessing;
|
||||||
|
|
|
@ -17,15 +17,10 @@
|
||||||
#define FILETRANSFERINSTANCE_H
|
#define FILETRANSFERINSTANCE_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QProgressBar>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QTextCursor>
|
#include <QImage>
|
||||||
|
|
||||||
#include "core.h"
|
#include "corestructs.h"
|
||||||
|
|
||||||
struct ToxFile;
|
struct ToxFile;
|
||||||
|
|
||||||
|
@ -39,7 +34,6 @@ public:
|
||||||
explicit FileTransferInstance(ToxFile File);
|
explicit FileTransferInstance(ToxFile File);
|
||||||
QString getHtmlImage();
|
QString getHtmlImage();
|
||||||
uint getId(){return id;}
|
uint getId(){return id;}
|
||||||
void setTextCursor(QTextCursor cursor);
|
|
||||||
TransfState getState() {return state;}
|
TransfState getState() {return state;}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
#include "friendlist.h"
|
#include "friendlist.h"
|
||||||
#include "widget/friendwidget.h"
|
#include "widget/friendwidget.h"
|
||||||
|
#include "widget/form/chatform.h"
|
||||||
|
|
||||||
Friend::Friend(int FriendId, QString UserId)
|
Friend::Friend(int FriendId, QString UserId)
|
||||||
: friendId(FriendId), userId(UserId)
|
: friendId(FriendId), userId(UserId)
|
||||||
|
|
4
friend.h
4
friend.h
|
@ -18,9 +18,10 @@
|
||||||
#define FRIEND_H
|
#define FRIEND_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "widget/form/chatform.h"
|
#include "corestructs.h"
|
||||||
|
|
||||||
struct FriendWidget;
|
struct FriendWidget;
|
||||||
|
class ChatForm;
|
||||||
|
|
||||||
struct Friend
|
struct Friend
|
||||||
{
|
{
|
||||||
|
@ -38,7 +39,6 @@ public:
|
||||||
ChatForm* chatForm;
|
ChatForm* chatForm;
|
||||||
int hasNewEvents;
|
int hasNewEvents;
|
||||||
Status friendStatus;
|
Status friendStatus;
|
||||||
QPixmap avatar;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRIEND_H
|
#endif // FRIEND_H
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
QList<Friend*> FriendList::friendList;
|
QList<Friend*> FriendList::friendList;
|
||||||
|
|
||||||
Friend* FriendList::addFriend(int friendId, QString userId)
|
Friend* FriendList::addFriend(int friendId, const QString& userId)
|
||||||
{
|
{
|
||||||
for (Friend* f : friendList)
|
for (Friend* f : friendList)
|
||||||
if (f->friendId == friendId)
|
if (f->friendId == friendId)
|
||||||
|
|
|
@ -17,16 +17,15 @@
|
||||||
#ifndef FRIENDLIST_H
|
#ifndef FRIENDLIST_H
|
||||||
#define FRIENDLIST_H
|
#define FRIENDLIST_H
|
||||||
|
|
||||||
#include <QString>
|
template <class T> class QList;
|
||||||
#include <QList>
|
|
||||||
|
|
||||||
struct Friend;
|
struct Friend;
|
||||||
|
class QString;
|
||||||
|
|
||||||
class FriendList
|
class FriendList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FriendList();
|
FriendList();
|
||||||
static Friend* addFriend(int friendId, QString userId);
|
static Friend* addFriend(int friendId, const QString& userId);
|
||||||
static Friend* findFriend(int friendId);
|
static Friend* findFriend(int friendId);
|
||||||
static void removeFriend(int friendId);
|
static void removeFriend(int friendId);
|
||||||
|
|
||||||
|
|
15
group.cpp
15
group.cpp
|
@ -19,18 +19,18 @@
|
||||||
#include "widget/form/groupchatform.h"
|
#include "widget/form/groupchatform.h"
|
||||||
#include "friendlist.h"
|
#include "friendlist.h"
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
#include "widget/widget.h"
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
Group::Group(int GroupId, QString Name)
|
Group::Group(int GroupId, QString Name)
|
||||||
: groupId(GroupId), nPeers{0}, hasPeerInfo{false}
|
: groupId(GroupId), nPeers{0}, hasPeerInfo{false}, peerInfoTimer{new QTimer}
|
||||||
{
|
{
|
||||||
widget = new GroupWidget(groupId, Name);
|
widget = new GroupWidget(groupId, Name);
|
||||||
chatForm = new GroupChatForm(this);
|
chatForm = new GroupChatForm(this);
|
||||||
connect(&peerInfoTimer, SIGNAL(timeout()), this, SLOT(queryPeerInfo()));
|
connect(peerInfoTimer, SIGNAL(timeout()), this, SLOT(queryPeerInfo()));
|
||||||
peerInfoTimer.setInterval(500);
|
peerInfoTimer->setInterval(500);
|
||||||
peerInfoTimer.setSingleShot(false);
|
peerInfoTimer->setSingleShot(false);
|
||||||
//peerInfoTimer.start();
|
//peerInfoTimer.start();
|
||||||
|
|
||||||
//in groupchats, we only notify on messages containing your name
|
//in groupchats, we only notify on messages containing your name
|
||||||
|
@ -42,11 +42,12 @@ Group::~Group()
|
||||||
{
|
{
|
||||||
delete chatForm;
|
delete chatForm;
|
||||||
delete widget;
|
delete widget;
|
||||||
|
delete peerInfoTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::queryPeerInfo()
|
void Group::queryPeerInfo()
|
||||||
{
|
{
|
||||||
const Core* core = Widget::getInstance()->getCore();
|
const Core* core = Core::getInstance();
|
||||||
int nPeersResult = core->getGroupNumberPeers(groupId);
|
int nPeersResult = core->getGroupNumberPeers(groupId);
|
||||||
if (nPeersResult == -1)
|
if (nPeersResult == -1)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +87,7 @@ void Group::queryPeerInfo()
|
||||||
{
|
{
|
||||||
qDebug() << "Group::queryPeerInfo: Successfully loaded names";
|
qDebug() << "Group::queryPeerInfo: Successfully loaded names";
|
||||||
hasPeerInfo = true;
|
hasPeerInfo = true;
|
||||||
peerInfoTimer.stop();
|
peerInfoTimer->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
group.h
6
group.h
|
@ -17,15 +17,15 @@
|
||||||
#ifndef GROUP_H
|
#ifndef GROUP_H
|
||||||
#define GROUP_H
|
#define GROUP_H
|
||||||
|
|
||||||
#include <QList>
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QTimer>
|
#include <QObject>
|
||||||
|
|
||||||
#define RETRY_PEER_INFO_INTERVAL 500
|
#define RETRY_PEER_INFO_INTERVAL 500
|
||||||
|
|
||||||
struct Friend;
|
struct Friend;
|
||||||
class GroupWidget;
|
class GroupWidget;
|
||||||
class GroupChatForm;
|
class GroupChatForm;
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
class Group : public QObject
|
class Group : public QObject
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
GroupWidget* widget;
|
GroupWidget* widget;
|
||||||
GroupChatForm* chatForm;
|
GroupChatForm* chatForm;
|
||||||
bool hasPeerInfo;
|
bool hasPeerInfo;
|
||||||
QTimer peerInfoTimer;
|
QTimer* peerInfoTimer;
|
||||||
int hasNewMessages, userWasMentioned;
|
int hasNewMessages, userWasMentioned;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
QList<Group*> GroupList::groupList;
|
QList<Group*> GroupList::groupList;
|
||||||
|
|
||||||
Group* GroupList::addGroup(int groupId, QString name)
|
Group* GroupList::addGroup(int groupId, const QString& name)
|
||||||
{
|
{
|
||||||
Group* newGroup = new Group(groupId, name);
|
Group* newGroup = new Group(groupId, name);
|
||||||
groupList.append(newGroup);
|
groupList.append(newGroup);
|
||||||
|
|
|
@ -17,17 +17,16 @@
|
||||||
#ifndef GROUPLIST_H
|
#ifndef GROUPLIST_H
|
||||||
#define GROUPLIST_H
|
#define GROUPLIST_H
|
||||||
|
|
||||||
#include <QString>
|
template <typename T>
|
||||||
#include <QList>
|
class QList;
|
||||||
#include <QMap>
|
|
||||||
|
|
||||||
class Group;
|
class Group;
|
||||||
|
class QString;
|
||||||
|
|
||||||
class GroupList
|
class GroupList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GroupList();
|
GroupList();
|
||||||
static Group* addGroup(int groupId, QString name);
|
static Group* addGroup(int groupId, const QString& name);
|
||||||
static Group* findGroup(int groupId);
|
static Group* findGroup(int groupId);
|
||||||
static void removeGroup(int groupId);
|
static void removeGroup(int groupId);
|
||||||
|
|
||||||
|
|
45
main.cpp
45
main.cpp
|
@ -19,6 +19,7 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -31,7 +32,7 @@ int main(int argc, char *argv[])
|
||||||
if (Settings::getInstance().getUseTranslations())
|
if (Settings::getInstance().getUseTranslations())
|
||||||
{
|
{
|
||||||
QString locale = QLocale::system().name().section('_', 0, 0);
|
QString locale = QLocale::system().name().section('_', 0, 0);
|
||||||
if (translator.load(locale,":translations/"))
|
if (locale=="en" || translator.load(locale,":translations/"))
|
||||||
qDebug() << "Loaded translation "+locale;
|
qDebug() << "Loaded translation "+locale;
|
||||||
else
|
else
|
||||||
qDebug() << "Error loading translation "+locale;
|
qDebug() << "Error loading translation "+locale;
|
||||||
|
@ -50,45 +51,3 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
return errorcode;
|
return errorcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO
|
|
||||||
* ">using a dedicated tool to maintain a TODO list" edition
|
|
||||||
*
|
|
||||||
* QRC FILES DO YOU EVEN INTO THEM ? Fix it soon for packaging and Urras.
|
|
||||||
* Most cameras use YUYV, implement YUYV -> YUV240
|
|
||||||
* Sending large files (~380MB) "restarts" after ~10MB. Goes back to 0%, consumes twice as much ram (reloads the file?)
|
|
||||||
* => Don't load the whole file at once, load small chunks (25MB?) when needed, then free them and load the next
|
|
||||||
* Don't do anything if a friend is disconnected, don't print to the chat
|
|
||||||
* Changing online/away/busy/offline by clicking the bubble
|
|
||||||
* /me action messages
|
|
||||||
* Popup windows for adding friends and changing settings
|
|
||||||
* And logging of the chat
|
|
||||||
* Show the picture's size between name and size after transfer completion if it's a pic
|
|
||||||
* Adjust all status icons to match the mockup, including scooting the friendslist ones to the left and making the user one the same size
|
|
||||||
* Sidepanel (friendlist) should be resizeable
|
|
||||||
* An extra side panel for groupchats, like Venom does (?)
|
|
||||||
*
|
|
||||||
* In the file transfer widget:
|
|
||||||
* >There is more padding on the left side compared to the right.
|
|
||||||
* >Maybe put the file size should be in the same row as the name.
|
|
||||||
* >Right-align the ETA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** NAMES :
|
|
||||||
Botox
|
|
||||||
Ricin
|
|
||||||
Anthrax
|
|
||||||
Sarin
|
|
||||||
Cyanide
|
|
||||||
Polonium
|
|
||||||
Mercury
|
|
||||||
Arsenic
|
|
||||||
qTox
|
|
||||||
plague
|
|
||||||
Britney
|
|
||||||
Nightshade
|
|
||||||
Belladonna
|
|
||||||
toxer
|
|
||||||
GoyIM
|
|
||||||
*/
|
|
||||||
|
|
8
qtox.pro
8
qtox.pro
|
@ -107,7 +107,10 @@ HEADERS += widget/form/addfriendform.h \
|
||||||
widget/form/genericchatform.h \
|
widget/form/genericchatform.h \
|
||||||
widget/tool/chataction.h \
|
widget/tool/chataction.h \
|
||||||
widget/chatareawidget.h \
|
widget/chatareawidget.h \
|
||||||
filetransferinstance.h
|
filetransferinstance.h \
|
||||||
|
corestructs.h \
|
||||||
|
coredefines.h \
|
||||||
|
coreav.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
widget/form/addfriendform.cpp \
|
widget/form/addfriendform.cpp \
|
||||||
|
@ -143,4 +146,5 @@ SOURCES += \
|
||||||
widget/form/genericchatform.cpp \
|
widget/form/genericchatform.cpp \
|
||||||
widget/tool/chataction.cpp \
|
widget/tool/chataction.cpp \
|
||||||
widget/chatareawidget.cpp \
|
widget/chatareawidget.cpp \
|
||||||
filetransferinstance.cpp
|
filetransferinstance.cpp \
|
||||||
|
corestructs.cpp
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "smileypack.h"
|
#include "smileypack.h"
|
||||||
#include "widget/widget.h"
|
|
||||||
|
|
||||||
|
#include <QFont>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
#define SETTINGS_HPP
|
#define SETTINGS_HPP
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QMainWindow>
|
#include <QObject>
|
||||||
#include <QSplitter>
|
|
||||||
|
|
||||||
class Settings : public QObject
|
class Settings : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,8 +19,14 @@
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QtXml>
|
#include <QIcon>
|
||||||
#include <QDebug>
|
#include <QPixmap>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDomDocument>
|
||||||
|
#include <QDomElement>
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QStringBuilder>
|
||||||
|
|
||||||
SmileyPack::SmileyPack()
|
SmileyPack::SmileyPack()
|
||||||
{
|
{
|
||||||
|
|
2
style.h
2
style.h
|
@ -17,7 +17,7 @@
|
||||||
#ifndef STYLE_H
|
#ifndef STYLE_H
|
||||||
#define STYLE_H
|
#define STYLE_H
|
||||||
|
|
||||||
#include <QString>
|
class QString;
|
||||||
|
|
||||||
class Style
|
class Style
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include <QMessageBox>
|
#include "widget.h"
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
@ -114,3 +114,8 @@ vpx_image Camera::getLastVPXImage()
|
||||||
}
|
}
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Camera* Camera::getInstance()
|
||||||
|
{
|
||||||
|
return Widget::getInstance()->getCamera();
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ class Camera
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Camera();
|
Camera();
|
||||||
|
static Camera* getInstance(); ///< Returns the global widget's Camera instance
|
||||||
void suscribe(); ///< Call this once before trying to get frames
|
void suscribe(); ///< Call this once before trying to get frames
|
||||||
void unsuscribe(); ///< Call this once when you don't need frames anymore
|
void unsuscribe(); ///< Call this once when you don't need frames anymore
|
||||||
cv::Mat getLastFrame(); ///< Get the last captured frame
|
cv::Mat getLastFrame(); ///< Get the last captured frame
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
|
|
||||||
#include "chatareawidget.h"
|
#include "chatareawidget.h"
|
||||||
#include "widget/tool/chataction.h"
|
#include "widget/tool/chataction.h"
|
||||||
#include <QAbstractTextDocumentLayout>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QTextTable>
|
||||||
|
#include <QAbstractTextDocumentLayout>
|
||||||
|
|
||||||
ChatAreaWidget::ChatAreaWidget(QWidget *parent) :
|
ChatAreaWidget::ChatAreaWidget(QWidget *parent) :
|
||||||
QTextBrowser(parent)
|
QTextBrowser(parent)
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
|
|
||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QTextTable>
|
|
||||||
|
|
||||||
class ChatAction;
|
class ChatAction;
|
||||||
|
class QTextTable;
|
||||||
|
|
||||||
class ChatAreaWidget : public QTextBrowser
|
class ChatAreaWidget : public QTextBrowser
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "croppinglabel.h"
|
#include "croppinglabel.h"
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
CroppingLabel::CroppingLabel(QWidget* parent)
|
CroppingLabel::CroppingLabel(QWidget* parent)
|
||||||
: QLabel(parent)
|
: QLabel(parent)
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
#define CROPPINGLABEL_H
|
#define CROPPINGLABEL_H
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
|
||||||
|
class QLineEdit;
|
||||||
|
|
||||||
class CroppingLabel : public QLabel
|
class CroppingLabel : public QLabel
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <tox/tox.h>
|
#include <tox/tox.h>
|
||||||
#include "widget/widget.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
|
||||||
#define TOX_ID_LENGTH 2*TOX_FRIEND_ADDRESS_SIZE
|
#define TOX_ID_LENGTH 2*TOX_FRIEND_ADDRESS_SIZE
|
||||||
|
@ -95,7 +95,7 @@ void AddFriendForm::onSendTriggered()
|
||||||
if (id.isEmpty()) {
|
if (id.isEmpty()) {
|
||||||
showWarning(tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
|
showWarning(tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
|
||||||
} else if (isToxId(id)) {
|
} else if (isToxId(id)) {
|
||||||
if (id.toUpper() == Widget::getInstance()->getCore()->getSelfId().toUpper())
|
if (id.toUpper() == Core::getInstance()->getSelfId().toUpper())
|
||||||
showWarning(tr("You can't add yourself as a friend !","When trying to add your own Tox ID as friend"));
|
showWarning(tr("You can't add yourself as a friend !","When trying to add your own Tox ID as friend"));
|
||||||
else
|
else
|
||||||
emit friendRequested(id, getMessage());
|
emit friendRequested(id, getMessage());
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef ADDFRIENDFORM_H
|
#ifndef ADDFRIENDFORM_H
|
||||||
#define ADDFRIENDFORM_H
|
#define ADDFRIENDFORM_H
|
||||||
|
|
||||||
#include "ui_mainwindow.h"
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
@ -26,6 +24,8 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QDnsLookup>
|
#include <QDnsLookup>
|
||||||
|
|
||||||
|
namespace Ui {class MainWindow;}
|
||||||
|
|
||||||
class AddFriendForm : public QObject
|
class AddFriendForm : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -42,8 +42,8 @@ signals:
|
||||||
void friendRequested(const QString& friendAddress, const QString& message);
|
void friendRequested(const QString& friendAddress, const QString& message);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSendTriggered();
|
void onSendTriggered();
|
||||||
void handleDnsLookup();
|
void handleDnsLookup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel headLabel, toxIdLabel, messageLabel;
|
QLabel headLabel, toxIdLabel, messageLabel;
|
||||||
|
|
|
@ -14,15 +14,21 @@
|
||||||
See the COPYING file for more details.
|
See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPushButton>
|
||||||
#include "chatform.h"
|
#include "chatform.h"
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
#include "widget/friendwidget.h"
|
#include "widget/friendwidget.h"
|
||||||
#include "filetransferinstance.h"
|
#include "filetransferinstance.h"
|
||||||
#include "widget/widget.h"
|
|
||||||
#include "widget/tool/chataction.h"
|
#include "widget/tool/chataction.h"
|
||||||
#include <QScrollBar>
|
#include "widget/netcamview.h"
|
||||||
#include <QFileDialog>
|
#include "widget/chatareawidget.h"
|
||||||
#include <QMessageBox>
|
#include "widget/tool/chattextedit.h"
|
||||||
|
#include "core.h"
|
||||||
|
#include "widget/widget.h"
|
||||||
|
|
||||||
ChatForm::ChatForm(Friend* chatFriend)
|
ChatForm::ChatForm(Friend* chatFriend)
|
||||||
: f(chatFriend)
|
: f(chatFriend)
|
||||||
|
@ -36,15 +42,15 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
headTextLayout->addWidget(statusMessageLabel);
|
headTextLayout->addWidget(statusMessageLabel);
|
||||||
headTextLayout->addStretch();
|
headTextLayout->addStretch();
|
||||||
|
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileSendStarted, this, &ChatForm::startFileSend);
|
connect(Core::getInstance(), &Core::fileSendStarted, this, &ChatForm::startFileSend);
|
||||||
connect(Widget::getInstance()->getCore(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay);
|
connect(Core::getInstance(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay);
|
||||||
connect(sendButton, &QPushButton::clicked, this, &ChatForm::onSendTriggered);
|
connect(sendButton, &QPushButton::clicked, this, &ChatForm::onSendTriggered);
|
||||||
connect(fileButton, &QPushButton::clicked, this, &ChatForm::onAttachClicked);
|
connect(fileButton, &QPushButton::clicked, this, &ChatForm::onAttachClicked);
|
||||||
connect(callButton, &QPushButton::clicked, this, &ChatForm::onCallTriggered);
|
connect(callButton, &QPushButton::clicked, this, &ChatForm::onCallTriggered);
|
||||||
connect(videoButton, &QPushButton::clicked, this, &ChatForm::onVideoCallTriggered);
|
connect(videoButton, &QPushButton::clicked, this, &ChatForm::onVideoCallTriggered);
|
||||||
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
||||||
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
||||||
connect(chatWidget, SIGNAL(onFileTranfertInterract(QString,QString)), this, SLOT(onFileTansBtnClicked(QString,QString)));
|
connect(chatWidget, &ChatAreaWidget::onFileTranfertInterract, this, &ChatForm::onFileTansBtnClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatForm::~ChatForm()
|
ChatForm::~ChatForm()
|
||||||
|
@ -99,9 +105,9 @@ void ChatForm::startFileSend(ToxFile file)
|
||||||
FileTransferInstance* fileTrans = new FileTransferInstance(file);
|
FileTransferInstance* fileTrans = new FileTransferInstance(file);
|
||||||
ftransWidgets.insert(fileTrans->getId(), fileTrans);
|
ftransWidgets.insert(fileTrans->getId(), fileTrans);
|
||||||
|
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferInfo, fileTrans, &FileTransferInstance::onFileTransferInfo);
|
connect(Core::getInstance(), &Core::fileTransferInfo, fileTrans, &FileTransferInstance::onFileTransferInfo);
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferCancelled, fileTrans, &FileTransferInstance::onFileTransferCancelled);
|
connect(Core::getInstance(), &Core::fileTransferCancelled, fileTrans, &FileTransferInstance::onFileTransferCancelled);
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferFinished, fileTrans, &FileTransferInstance::onFileTransferFinished);
|
connect(Core::getInstance(), &Core::fileTransferFinished, fileTrans, &FileTransferInstance::onFileTransferFinished);
|
||||||
|
|
||||||
QString name = Widget::getInstance()->getUsername();
|
QString name = Widget::getInstance()->getUsername();
|
||||||
if (name == previousName)
|
if (name == previousName)
|
||||||
|
@ -119,9 +125,9 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
||||||
FileTransferInstance* fileTrans = new FileTransferInstance(file);
|
FileTransferInstance* fileTrans = new FileTransferInstance(file);
|
||||||
ftransWidgets.insert(fileTrans->getId(), fileTrans);
|
ftransWidgets.insert(fileTrans->getId(), fileTrans);
|
||||||
|
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferInfo, fileTrans, &FileTransferInstance::onFileTransferInfo);
|
connect(Core::getInstance(), &Core::fileTransferInfo, fileTrans, &FileTransferInstance::onFileTransferInfo);
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferCancelled, fileTrans, &FileTransferInstance::onFileTransferCancelled);
|
connect(Core::getInstance(), &Core::fileTransferCancelled, fileTrans, &FileTransferInstance::onFileTransferCancelled);
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferFinished, fileTrans, &FileTransferInstance::onFileTransferFinished);
|
connect(Core::getInstance(), &Core::fileTransferFinished, fileTrans, &FileTransferInstance::onFileTransferFinished);
|
||||||
|
|
||||||
Widget* w = Widget::getInstance();
|
Widget* w = Widget::getInstance();
|
||||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->getIsWindowMinimized() || !w->isActiveWindow())
|
if (!w->isFriendWidgetCurActiveWidget(f)|| w->getIsWindowMinimized() || !w->isActiveWindow())
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
#define CHATFORM_H
|
#define CHATFORM_H
|
||||||
|
|
||||||
#include "genericchatform.h"
|
#include "genericchatform.h"
|
||||||
#include "core.h"
|
#include "corestructs.h"
|
||||||
#include "widget/netcamview.h"
|
|
||||||
|
|
||||||
struct Friend;
|
struct Friend;
|
||||||
class FileTransferInstance;
|
class FileTransferInstance;
|
||||||
|
class NetCamView;
|
||||||
|
|
||||||
class ChatForm : public GenericChatForm
|
class ChatForm : public GenericChatForm
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "filesform.h"
|
#include "filesform.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
FilesForm::FilesForm()
|
FilesForm::FilesForm()
|
||||||
: QObject()
|
: QObject()
|
||||||
|
|
|
@ -17,17 +17,14 @@
|
||||||
#ifndef FILESFORM_H
|
#ifndef FILESFORM_H
|
||||||
#define FILESFORM_H
|
#define FILESFORM_H
|
||||||
|
|
||||||
#include "ui_mainwindow.h"
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QUrl>
|
|
||||||
#include <QDebug>
|
namespace Ui {class MainWindow;}
|
||||||
#include <QFileInfo>
|
class QListWidget;
|
||||||
|
|
||||||
class FilesForm : public QObject
|
class FilesForm : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "widget/widget.h"
|
#include "widget/widget.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "widget/tool/chataction.h"
|
#include "widget/tool/chataction.h"
|
||||||
|
#include "widget/chatareawidget.h"
|
||||||
|
#include "widget/tool/chattextedit.h"
|
||||||
|
|
||||||
GenericChatForm::GenericChatForm(QObject *parent) :
|
GenericChatForm::GenericChatForm(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
|
|
|
@ -19,19 +19,18 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QTime>
|
#include <QDateTime>
|
||||||
#include <QLabel>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
#include "widget/croppinglabel.h"
|
|
||||||
#include "widget/chatareawidget.h"
|
|
||||||
#include "widget/tool/chattextedit.h"
|
|
||||||
|
|
||||||
// Spacing in px inserted when the author of the last message changes
|
// Spacing in px inserted when the author of the last message changes
|
||||||
#define AUTHOR_CHANGE_SPACING 5
|
#define AUTHOR_CHANGE_SPACING 5
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
class QVBoxLayout;
|
||||||
|
class QPushButton;
|
||||||
|
class CroppingLabel;
|
||||||
|
class ChatTextEdit;
|
||||||
|
class ChatAreaWidget;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
#include "groupchatform.h"
|
#include "groupchatform.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "widget/groupwidget.h"
|
#include "widget/groupwidget.h"
|
||||||
#include "widget/widget.h"
|
#include "widget/tool/chattextedit.h"
|
||||||
|
#include "widget/croppinglabel.h"
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
GroupChatForm::GroupChatForm(Group* chatGroup)
|
GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
: group(chatGroup)
|
: group(chatGroup)
|
||||||
|
|
|
@ -18,9 +18,8 @@
|
||||||
#define GROUPCHATFORM_H
|
#define GROUPCHATFORM_H
|
||||||
|
|
||||||
#include "genericchatform.h"
|
#include "genericchatform.h"
|
||||||
#include "widget/tool/chattextedit.h"
|
|
||||||
#include "ui_mainwindow.h"
|
|
||||||
|
|
||||||
|
namespace Ui {class MainWindow;}
|
||||||
class Group;
|
class Group;
|
||||||
|
|
||||||
class GroupChatForm : public GenericChatForm
|
class GroupChatForm : public GenericChatForm
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "widget/widget.h"
|
#include "widget/widget.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "smileypack.h"
|
#include "smileypack.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
|
@ -20,17 +20,17 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QString>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSpacerItem>
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include "ui_mainwindow.h"
|
|
||||||
#include "widget/selfcamview.h"
|
|
||||||
#include "widget/croppinglabel.h"
|
#include "widget/croppinglabel.h"
|
||||||
|
|
||||||
|
namespace Ui {class MainWindow;}
|
||||||
|
class QString;
|
||||||
|
|
||||||
class SettingsForm : public QObject
|
class SettingsForm : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include "friendlistwidget.h"
|
#include "friendlistwidget.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QGridLayout>
|
||||||
|
|
||||||
FriendListWidget::FriendListWidget(QWidget *parent) :
|
FriendListWidget::FriendListWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
|
|
|
@ -18,8 +18,11 @@
|
||||||
#define FRIENDLISTWIDGET_H
|
#define FRIENDLISTWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QGridLayout>
|
#include <QHash>
|
||||||
#include "core.h"
|
#include "corestructs.h"
|
||||||
|
|
||||||
|
class QLayout;
|
||||||
|
class QGridLayout;
|
||||||
|
|
||||||
class FriendListWidget : public QWidget
|
class FriendListWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "grouplist.h"
|
#include "grouplist.h"
|
||||||
#include "groupwidget.h"
|
#include "groupwidget.h"
|
||||||
#include "widget.h"
|
|
||||||
#include "friendlist.h"
|
#include "friendlist.h"
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
|
#include "core.h"
|
||||||
|
#include "widget/form/chatform.h"
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
else if (groupActions.contains(selectedItem))
|
else if (groupActions.contains(selectedItem))
|
||||||
{
|
{
|
||||||
Group* group = groupActions[selectedItem];
|
Group* group = groupActions[selectedItem];
|
||||||
Widget::getInstance()->getCore()->groupInviteFriend(friendId, group->groupId);
|
Core::getInstance()->groupInviteFriend(friendId, group->groupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,7 @@
|
||||||
#ifndef FRIENDWIDGET_H
|
#ifndef FRIENDWIDGET_H
|
||||||
#define FRIENDWIDGET_H
|
#define FRIENDWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
|
|
||||||
#include "genericchatroomwidget.h"
|
#include "genericchatroomwidget.h"
|
||||||
#include "croppinglabel.h"
|
#include "croppinglabel.h"
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#ifndef GROUPWIDGET_H
|
#ifndef GROUPWIDGET_H
|
||||||
#define GROUPWIDGET_H
|
#define GROUPWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include "genericchatroomwidget.h"
|
#include "genericchatroomwidget.h"
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,8 @@
|
||||||
|
|
||||||
#include "netcamview.h"
|
#include "netcamview.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "widget.h"
|
#include <QLabel>
|
||||||
#include <QApplication>
|
#include <QHBoxLayout>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
|
||||||
|
|
||||||
static inline void fromYCbCrToRGB(
|
static inline void fromYCbCrToRGB(
|
||||||
uint8_t Y, uint8_t Cb, uint8_t Cr,
|
uint8_t Y, uint8_t Cb, uint8_t Cr,
|
||||||
|
@ -70,7 +69,7 @@ void NetCamView::updateDisplay(vpx_image* frame)
|
||||||
if (!frame->w || !frame->h)
|
if (!frame->w || !frame->h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Core* core = Widget::getInstance()->getCore();
|
Core* core = Core::getInstance();
|
||||||
|
|
||||||
core->increaseVideoBusyness();
|
core->increaseVideoBusyness();
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,13 @@
|
||||||
#define NETCAMVIEW_H
|
#define NETCAMVIEW_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <vpx/vpx_image.h>
|
|
||||||
|
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QShowEvent;
|
class QShowEvent;
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
class QLabel;
|
||||||
|
class QHBoxLayout;
|
||||||
|
class vpx_image;
|
||||||
|
|
||||||
class NetCamView : public QWidget
|
class NetCamView : public QWidget
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,46 +15,45 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "selfcamview.h"
|
#include "selfcamview.h"
|
||||||
|
#include "camera.h"
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
#include <QTimer>
|
||||||
#include "widget.h"
|
#include <QLabel>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <opencv2/opencv.hpp>
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
SelfCamView::SelfCamView(Camera* Cam, QWidget* parent)
|
SelfCamView::SelfCamView(Camera* Cam, QWidget* parent)
|
||||||
: QWidget(parent), displayLabel{new QLabel},
|
: QWidget(parent), displayLabel{new QLabel},
|
||||||
mainLayout{new QHBoxLayout()}, cam(Cam)
|
mainLayout{new QHBoxLayout()}, cam(Cam), updateDisplayTimer{new QTimer}
|
||||||
{
|
{
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
setWindowTitle(SelfCamView::tr("Tox video test","Title of the window to test the video/webcam"));
|
setWindowTitle(SelfCamView::tr("Tox video test","Title of the window to test the video/webcam"));
|
||||||
setMinimumSize(320,240);
|
setMinimumSize(320,240);
|
||||||
|
|
||||||
updateDisplayTimer.setInterval(5);
|
updateDisplayTimer->setInterval(5);
|
||||||
updateDisplayTimer.setSingleShot(false);
|
updateDisplayTimer->setSingleShot(false);
|
||||||
|
|
||||||
displayLabel->setScaledContents(true);
|
displayLabel->setScaledContents(true);
|
||||||
|
|
||||||
mainLayout->addWidget(displayLabel);
|
mainLayout->addWidget(displayLabel);
|
||||||
|
|
||||||
connect(&updateDisplayTimer, SIGNAL(timeout()), this, SLOT(updateDisplay()));
|
connect(updateDisplayTimer, SIGNAL(timeout()), this, SLOT(updateDisplay()));
|
||||||
}
|
|
||||||
|
|
||||||
SelfCamView::~SelfCamView()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelfCamView::closeEvent(QCloseEvent* event)
|
void SelfCamView::closeEvent(QCloseEvent* event)
|
||||||
{
|
{
|
||||||
cam->unsuscribe();
|
cam->unsuscribe();
|
||||||
updateDisplayTimer.stop();
|
updateDisplayTimer->stop();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelfCamView::showEvent(QShowEvent* event)
|
void SelfCamView::showEvent(QShowEvent* event)
|
||||||
{
|
{
|
||||||
cam->suscribe();
|
cam->suscribe();
|
||||||
updateDisplayTimer.start();
|
updateDisplayTimer->start();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
#define SELFCAMVIEW_H
|
#define SELFCAMVIEW_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QLabel>
|
|
||||||
#include "camera.h"
|
|
||||||
|
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QShowEvent;
|
class QShowEvent;
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
class Camera;
|
||||||
|
class QLabel;
|
||||||
|
class QHBoxLayout;
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
class SelfCamView : public QWidget
|
class SelfCamView : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,6 @@ class SelfCamView : public QWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SelfCamView(Camera* Cam, QWidget *parent=0);
|
SelfCamView(Camera* Cam, QWidget *parent=0);
|
||||||
~SelfCamView();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
|
@ -47,7 +46,7 @@ private:
|
||||||
QLabel *displayLabel;
|
QLabel *displayLabel;
|
||||||
QHBoxLayout* mainLayout;
|
QHBoxLayout* mainLayout;
|
||||||
Camera* cam;
|
Camera* cam;
|
||||||
QTimer updateDisplayTimer;
|
QTimer* updateDisplayTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SELFCAMVIEW_H
|
#endif // SELFCAMVIEW_H
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
#include "core.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "friend.h"
|
#include "friend.h"
|
||||||
#include "friendlist.h"
|
#include "friendlist.h"
|
||||||
|
@ -26,17 +27,19 @@
|
||||||
#include "widget/groupwidget.h"
|
#include "widget/groupwidget.h"
|
||||||
#include "widget/form/groupchatform.h"
|
#include "widget/form/groupchatform.h"
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
|
#include "selfcamview.h"
|
||||||
|
#include "widget/friendlistwidget.h"
|
||||||
|
#include "camera.h"
|
||||||
|
#include "widget/form/chatform.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTextStream>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QCursor>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <QThread>
|
||||||
|
#include <tox/tox.h>
|
||||||
|
|
||||||
Widget *Widget::instance{nullptr};
|
Widget *Widget::instance{nullptr};
|
||||||
|
|
||||||
|
|
|
@ -17,17 +17,11 @@
|
||||||
#ifndef WIDGET_H
|
#ifndef WIDGET_H
|
||||||
#define WIDGET_H
|
#define WIDGET_H
|
||||||
|
|
||||||
#include <QThread>
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QString>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QMenu>
|
|
||||||
#include "core.h"
|
|
||||||
#include "widget/form/addfriendform.h"
|
#include "widget/form/addfriendform.h"
|
||||||
#include "widget/form/settingsform.h"
|
#include "widget/form/settingsform.h"
|
||||||
#include "widget/form/filesform.h"
|
#include "widget/form/filesform.h"
|
||||||
#include "camera.h"
|
#include "corestructs.h"
|
||||||
#include "friendlistwidget.h"
|
|
||||||
|
|
||||||
#define PIXELS_TO_ACT 7
|
#define PIXELS_TO_ACT 7
|
||||||
|
|
||||||
|
@ -38,6 +32,12 @@ class MainWindow;
|
||||||
class GenericChatroomWidget;
|
class GenericChatroomWidget;
|
||||||
class Group;
|
class Group;
|
||||||
struct Friend;
|
struct Friend;
|
||||||
|
class QSplitter;
|
||||||
|
class SelfCamView;
|
||||||
|
class QMenu;
|
||||||
|
class Core;
|
||||||
|
class Camera;
|
||||||
|
class FriendListWidget;
|
||||||
|
|
||||||
class Widget : public QMainWindow
|
class Widget : public QMainWindow
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user