mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Comply with Wshadow
Avoid shadowing variables: * Rename variables to something better if possible * If not, postfix shadowing arguments with _. Favour leaving member variables without postfixes. * Rename variables prefixed with _ to avoid library function collisions * Avoid double underscore anywhere in names * Make definition and declaration argument names match where seen * Favour using class variable over argument variable, where equivalent * Remove explicit this-> where equivalent
This commit is contained in:
parent
25c8904416
commit
fc2e445294
@ -380,12 +380,12 @@ bool OpenAL::initInput(const QString& deviceName, uint32_t channels)
|
||||
assert(!alInDev);
|
||||
|
||||
// TODO: Try to actually detect if our audio source is stereo
|
||||
this->channels = channels;
|
||||
int stereoFlag = channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
|
||||
inputChannels = channels;
|
||||
int stereoFlag = inputChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
|
||||
const int bytesPerSample = 2;
|
||||
const int safetyFactor = 2; // internal OpenAL ring buffer. must be larger than our inputBuffer
|
||||
// to avoid the ring from overwriting itself between captures.
|
||||
AUDIO_FRAME_SAMPLE_COUNT_TOTAL = AUDIO_FRAME_SAMPLE_COUNT_PER_CHANNEL * channels;
|
||||
AUDIO_FRAME_SAMPLE_COUNT_TOTAL = AUDIO_FRAME_SAMPLE_COUNT_PER_CHANNEL * inputChannels;
|
||||
const ALCsizei ringBufSize = AUDIO_FRAME_SAMPLE_COUNT_TOTAL * bytesPerSample * safetyFactor;
|
||||
|
||||
const QByteArray qDevName = deviceName.toUtf8();
|
||||
@ -661,7 +661,7 @@ void OpenAL::doInput()
|
||||
|
||||
// NOTE(sudden6): this loop probably doesn't scale too well with many sources
|
||||
for (auto source : sources) {
|
||||
emit source->frameAvailable(inputBuffer, AUDIO_FRAME_SAMPLE_COUNT_PER_CHANNEL, channels,
|
||||
emit source->frameAvailable(inputBuffer, AUDIO_FRAME_SAMPLE_COUNT_PER_CHANNEL, inputChannels,
|
||||
AUDIO_SAMPLE_RATE);
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ protected:
|
||||
std::unordered_set<AlSink*> soundSinks;
|
||||
std::unordered_set<AlSource*> sources;
|
||||
|
||||
int channels = 0;
|
||||
int inputChannels = 0;
|
||||
qreal gain = 0;
|
||||
qreal gainFactor = 1;
|
||||
static constexpr qreal minInGain = -30;
|
||||
|
@ -190,14 +190,14 @@ void ChatLine::layout(qreal w, QPointF scenePos)
|
||||
|
||||
for (int i = 0; i < content.size(); ++i) {
|
||||
// calculate the effective width of the current column
|
||||
qreal width;
|
||||
qreal contentWidth;
|
||||
if (format[i].policy == ColumnFormat::FixedSize)
|
||||
width = format[i].size;
|
||||
contentWidth = format[i].size;
|
||||
else
|
||||
width = format[i].size / varWidth * leftover;
|
||||
contentWidth = format[i].size / varWidth * leftover;
|
||||
|
||||
// set the width of the current column
|
||||
content[i]->setWidth(width);
|
||||
content[i]->setWidth(contentWidth);
|
||||
|
||||
// calculate horizontal alignment
|
||||
qreal xAlign = 0.0;
|
||||
@ -206,17 +206,17 @@ void ChatLine::layout(qreal w, QPointF scenePos)
|
||||
case ColumnFormat::Left:
|
||||
break;
|
||||
case ColumnFormat::Right:
|
||||
xAlign = width - content[i]->boundingRect().width();
|
||||
xAlign = contentWidth - content[i]->boundingRect().width();
|
||||
break;
|
||||
case ColumnFormat::Center:
|
||||
xAlign = (width - content[i]->boundingRect().width()) / 2.0;
|
||||
xAlign = (contentWidth - content[i]->boundingRect().width()) / 2.0;
|
||||
break;
|
||||
}
|
||||
|
||||
// reposition
|
||||
xPos[i] = scenePos.x() + xOffset + xAlign;
|
||||
|
||||
xOffset += width + columnSpacing;
|
||||
xOffset += contentWidth + columnSpacing;
|
||||
maxVOffset = qMax(maxVOffset, content[i]->getAscent());
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ ChatLineStorage::IdxInfoMap_t::iterator ChatLineStorage::equivalentInfoIterator(
|
||||
return equivalentIt;
|
||||
}
|
||||
|
||||
ChatLineStorage::IdxInfoMap_t::iterator ChatLineStorage::infoIteratorForIdx(ChatLogIdx idx)
|
||||
ChatLineStorage::IdxInfoMap_t::iterator ChatLineStorage::infoIteratorForIdx(ChatLogIdx idx_)
|
||||
{
|
||||
// If lower_bound proves to be expensive for appending we can try
|
||||
// special casing when idx > idxToLineMap.rbegin()->first
|
||||
@ -167,7 +167,7 @@ ChatLineStorage::IdxInfoMap_t::iterator ChatLineStorage::infoIteratorForIdx(Chat
|
||||
// If we find an exact match we return that index, otherwise we return
|
||||
// the first item after it. It's up to the caller to check if there's an
|
||||
// exact match first
|
||||
auto it = std::lower_bound(idxInfoMap.begin(), idxInfoMap.end(), idx, [](const IdxInfoMap_t::value_type& v, ChatLogIdx idx) {
|
||||
auto it = std::lower_bound(idxInfoMap.begin(), idxInfoMap.end(), idx_, [](const IdxInfoMap_t::value_type& v, ChatLogIdx idx) {
|
||||
return v.first < idx;
|
||||
});
|
||||
|
||||
|
@ -117,7 +117,7 @@ private:
|
||||
|
||||
IdxInfoMap_t::iterator equivalentInfoIterator(iterator it);
|
||||
|
||||
IdxInfoMap_t::iterator infoIteratorForIdx(ChatLogIdx idx);
|
||||
IdxInfoMap_t::iterator infoIteratorForIdx(ChatLogIdx idx_);
|
||||
|
||||
iterator adjustItForDate(iterator it, QDateTime timestamp);
|
||||
|
||||
|
@ -204,10 +204,10 @@ ChatLogIdx clampedAdd(ChatLogIdx idx, int val, IChatLog& chatLog)
|
||||
} // namespace
|
||||
|
||||
|
||||
ChatWidget::ChatWidget(IChatLog& chatLog, const Core& core, QWidget* parent)
|
||||
ChatWidget::ChatWidget(IChatLog& chatLog_, const Core& core_, QWidget* parent)
|
||||
: QGraphicsView(parent)
|
||||
, chatLog(chatLog)
|
||||
, core(core)
|
||||
, chatLog(chatLog_)
|
||||
, core(core_)
|
||||
, chatLineStorage(new ChatLineStorage())
|
||||
{
|
||||
// Create the scene
|
||||
@ -287,11 +287,11 @@ ChatWidget::ChatWidget(IChatLog& chatLog, const Core& core, QWidget* parent)
|
||||
Translator::registerHandler(std::bind(&ChatWidget::retranslateUi, this), this);
|
||||
|
||||
connect(this, &ChatWidget::renderFinished, this, &ChatWidget::onRenderFinished);
|
||||
connect(&chatLog, &IChatLog::itemUpdated, this, &ChatWidget::onMessageUpdated);
|
||||
connect(&chatLog_, &IChatLog::itemUpdated, this, &ChatWidget::onMessageUpdated);
|
||||
connect(verticalScrollBar(), &QScrollBar::valueChanged, this, &ChatWidget::onScrollValueChanged);
|
||||
|
||||
auto firstChatLogIdx = clampedAdd(chatLog.getNextIdx(), -100, chatLog);
|
||||
renderMessages(firstChatLogIdx, chatLog.getNextIdx());
|
||||
auto firstChatLogIdx = clampedAdd(chatLog_.getNextIdx(), -100, chatLog_);
|
||||
renderMessages(firstChatLogIdx, chatLog_.getNextIdx());
|
||||
}
|
||||
|
||||
ChatWidget::~ChatWidget()
|
||||
@ -1402,7 +1402,7 @@ void ChatWidget::setTypingNotification()
|
||||
}
|
||||
|
||||
|
||||
void ChatWidget::renderItem(const ChatLogItem& item, bool hideName, bool colorizeNames, ChatLine::Ptr& chatMessage)
|
||||
void ChatWidget::renderItem(const ChatLogItem& item, bool hideName, bool colorizeNames_, ChatLine::Ptr& chatMessage)
|
||||
{
|
||||
const auto& sender = item.getSender();
|
||||
|
||||
@ -1412,7 +1412,7 @@ void ChatWidget::renderItem(const ChatLogItem& item, bool hideName, bool coloriz
|
||||
case ChatLogItem::ContentType::message: {
|
||||
const auto& chatLogMessage = item.getContentAsMessage();
|
||||
|
||||
renderMessageRaw(item.getDisplayName(), isSelf, colorizeNames, chatLogMessage, chatMessage);
|
||||
renderMessageRaw(item.getDisplayName(), isSelf, colorizeNames_, chatLogMessage, chatMessage);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class ChatWidget : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ChatWidget(IChatLog& chatLog, const Core& core, QWidget* parent = nullptr);
|
||||
explicit ChatWidget(IChatLog& chatLog_, const Core& core_, QWidget* parent = nullptr);
|
||||
virtual ~ChatWidget();
|
||||
|
||||
void insertChatlines(std::map<ChatLogIdx, ChatLine::Ptr> chatLines);
|
||||
@ -144,7 +144,7 @@ private:
|
||||
void moveMultiSelectionDown(int offset);
|
||||
void setTypingNotification();
|
||||
|
||||
void renderItem(const ChatLogItem &item, bool hideName, bool colorizeNames, ChatLine::Ptr &chatMessage);
|
||||
void renderItem(const ChatLogItem &item, bool hideName, bool colorizeNames_, ChatLine::Ptr &chatMessage);
|
||||
void renderFile(QString displayName, ToxFile file, bool isSelf, QDateTime timestamp, ChatLine::Ptr &chatMessage);
|
||||
bool needsToHideName(ChatLogIdx idx, bool prevIdxRendered) const;
|
||||
bool shouldRenderMessage(ChatLogIdx idx) const;
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
class QStyleOptionGraphicsItem;
|
||||
|
||||
Broken::Broken(const QString& img, QSize size)
|
||||
: pmap{PixmapCache::getInstance().get(img, size)}
|
||||
, size{size}
|
||||
Broken::Broken(const QString& img, QSize size_)
|
||||
: pmap{PixmapCache::getInstance().get(img, size_)}
|
||||
, size{size_}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Broken : public ChatLineContent
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Broken(const QString& img, QSize size);
|
||||
Broken(const QString& img, QSize size_);
|
||||
QRectF boundingRect() const override;
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||
QWidget* widget) override;
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
#include "timestamp.h"
|
||||
|
||||
Timestamp::Timestamp(const QDateTime& time, const QString& format, const QFont& font)
|
||||
: Text(time.toString(format), font, false, time.toString(format))
|
||||
Timestamp::Timestamp(const QDateTime& time_, const QString& format, const QFont& font)
|
||||
: Text(time_.toString(format), font, false, time_.toString(format))
|
||||
{
|
||||
this->time = time;
|
||||
time = time_;
|
||||
}
|
||||
|
||||
QDateTime Timestamp::getTime()
|
||||
|
@ -29,7 +29,7 @@ class Timestamp : public Text
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Timestamp(const QDateTime& time, const QString& format, const QFont& font);
|
||||
Timestamp(const QDateTime& time_, const QString& format, const QFont& font);
|
||||
QDateTime getTime();
|
||||
|
||||
protected:
|
||||
|
@ -499,17 +499,17 @@ QList<DhtServer> shuffleBootstrapNodes(QList<DhtServer> bootstrapNodes)
|
||||
|
||||
} // namespace
|
||||
|
||||
Core::Core(QThread* coreThread, IBootstrapListGenerator& _bootstrapListGenerator, const ICoreSettings& _settings)
|
||||
Core::Core(QThread* coreThread_, IBootstrapListGenerator& bootstrapListGenerator_, const ICoreSettings& settings_)
|
||||
: tox(nullptr)
|
||||
, toxTimer{new QTimer{this}}
|
||||
, coreThread(coreThread)
|
||||
, bootstrapListGenerator(_bootstrapListGenerator)
|
||||
, settings(_settings)
|
||||
, coreThread(coreThread_)
|
||||
, bootstrapListGenerator(bootstrapListGenerator_)
|
||||
, settings(settings_)
|
||||
{
|
||||
assert(toxTimer);
|
||||
toxTimer->setSingleShot(true);
|
||||
connect(toxTimer, &QTimer::timeout, this, &Core::process);
|
||||
connect(coreThread, &QThread::finished, toxTimer, &QTimer::stop);
|
||||
connect(coreThread_, &QThread::finished, toxTimer, &QTimer::stop);
|
||||
}
|
||||
|
||||
Core::~Core()
|
||||
|
@ -197,7 +197,7 @@ signals:
|
||||
void failedToRemoveFriend(uint32_t friendId);
|
||||
|
||||
private:
|
||||
Core(QThread* coreThread, IBootstrapListGenerator& _bootstrapNodes, const ICoreSettings& settings);
|
||||
Core(QThread* coreThread_, IBootstrapListGenerator& bootstrapNodes_, const ICoreSettings& settings_);
|
||||
|
||||
static void onFriendRequest(Tox* tox, const uint8_t* cUserId, const uint8_t* cMessage,
|
||||
size_t cMessageSize, void* core);
|
||||
@ -247,9 +247,9 @@ private slots:
|
||||
private:
|
||||
struct ToxDeleter
|
||||
{
|
||||
void operator()(Tox* tox)
|
||||
void operator()(Tox* tox_)
|
||||
{
|
||||
tox_kill(tox);
|
||||
tox_kill(tox_);
|
||||
}
|
||||
};
|
||||
/* Using the now commented out statements in checkConnection(), I watched how
|
||||
|
@ -70,15 +70,15 @@
|
||||
* deadlock.
|
||||
*/
|
||||
|
||||
CoreAV::CoreAV(std::unique_ptr<ToxAV, ToxAVDeleter> toxav, CompatibleRecursiveMutex& toxCoreLock,
|
||||
IAudioSettings& _audioSettings, IGroupSettings& _groupSettings)
|
||||
CoreAV::CoreAV(std::unique_ptr<ToxAV, ToxAVDeleter> toxav_, CompatibleRecursiveMutex& toxCoreLock,
|
||||
IAudioSettings& audioSettings_, IGroupSettings& groupSettings_)
|
||||
: audio{nullptr}
|
||||
, toxav{std::move(toxav)}
|
||||
, toxav{std::move(toxav_)}
|
||||
, coreavThread{new QThread{this}}
|
||||
, iterateTimer{new QTimer{this}}
|
||||
, coreLock{toxCoreLock}
|
||||
, audioSettings{_audioSettings}
|
||||
, groupSettings{_groupSettings}
|
||||
, audioSettings{audioSettings_}
|
||||
, groupSettings{groupSettings_}
|
||||
{
|
||||
assert(coreavThread);
|
||||
assert(iterateTimer);
|
||||
@ -86,7 +86,7 @@ CoreAV::CoreAV(std::unique_ptr<ToxAV, ToxAVDeleter> toxav, CompatibleRecursiveMu
|
||||
coreavThread->setObjectName("qTox CoreAV");
|
||||
moveToThread(coreavThread.get());
|
||||
|
||||
connectCallbacks(*this->toxav);
|
||||
connectCallbacks();
|
||||
|
||||
iterateTimer->setSingleShot(true);
|
||||
|
||||
@ -95,14 +95,14 @@ CoreAV::CoreAV(std::unique_ptr<ToxAV, ToxAVDeleter> toxav, CompatibleRecursiveMu
|
||||
connect(coreavThread.get(), &QThread::started, this, &CoreAV::process);
|
||||
}
|
||||
|
||||
void CoreAV::connectCallbacks(ToxAV& toxav)
|
||||
void CoreAV::connectCallbacks()
|
||||
{
|
||||
toxav_callback_call(&toxav, CoreAV::callCallback, this);
|
||||
toxav_callback_call_state(&toxav, CoreAV::stateCallback, this);
|
||||
toxav_callback_audio_bit_rate(&toxav, CoreAV::audioBitrateCallback, this);
|
||||
toxav_callback_video_bit_rate(&toxav, CoreAV::videoBitrateCallback, this);
|
||||
toxav_callback_audio_receive_frame(&toxav, CoreAV::audioFrameCallback, this);
|
||||
toxav_callback_video_receive_frame(&toxav, CoreAV::videoFrameCallback, this);
|
||||
toxav_callback_call(toxav.get(), CoreAV::callCallback, this);
|
||||
toxav_callback_call_state(toxav.get(), CoreAV::stateCallback, this);
|
||||
toxav_callback_audio_bit_rate(toxav.get(), CoreAV::audioBitrateCallback, this);
|
||||
toxav_callback_video_bit_rate(toxav.get(), CoreAV::videoBitrateCallback, this);
|
||||
toxav_callback_audio_receive_frame(toxav.get(), CoreAV::audioFrameCallback, this);
|
||||
toxav_callback_video_receive_frame(toxav.get(), CoreAV::videoFrameCallback, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,7 +290,7 @@ bool CoreAV::startCall(uint32_t friendNum, bool video)
|
||||
assert(audio != nullptr);
|
||||
ToxFriendCallPtr call = ToxFriendCallPtr(new ToxFriendCall(friendNum, video, *this, *audio));
|
||||
// Call object must be owned by this thread or there will be locking problems with Audio
|
||||
call->moveToThread(this->thread());
|
||||
call->moveToThread(thread());
|
||||
assert(call != nullptr);
|
||||
calls.emplace(friendNum, std::move(call));
|
||||
return true;
|
||||
@ -553,7 +553,7 @@ void CoreAV::joinGroupCall(const Group& group)
|
||||
|
||||
ToxGroupCallPtr groupcall = ToxGroupCallPtr(new ToxGroupCall{group, *this, *audio});
|
||||
// Call Objects must be owned by CoreAV or there will be locking problems with Audio
|
||||
groupcall->moveToThread(this->thread());
|
||||
groupcall->moveToThread(thread());
|
||||
assert(groupcall != nullptr);
|
||||
auto ret = groupCalls.emplace(group.getId(), std::move(groupcall));
|
||||
if (ret.second == false) {
|
||||
|
@ -117,9 +117,9 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
CoreAV(std::unique_ptr<ToxAV, ToxAVDeleter> tox, CompatibleRecursiveMutex &toxCoreLock,
|
||||
IAudioSettings& _audioSettings, IGroupSettings& _groupSettings);
|
||||
void connectCallbacks(ToxAV& toxav);
|
||||
CoreAV(std::unique_ptr<ToxAV, ToxAVDeleter> tox_, CompatibleRecursiveMutex &toxCoreLock,
|
||||
IAudioSettings& audioSettings_, IGroupSettings& groupSettings_);
|
||||
void connectCallbacks();
|
||||
|
||||
void process();
|
||||
static void audioFrameCallback(ToxAV* toxAV, uint32_t friendNum, const int16_t* pcm,
|
||||
|
@ -72,15 +72,15 @@ void CoreExt::onLosslessPacket(uint32_t friendId, const uint8_t* data, size_t le
|
||||
}
|
||||
|
||||
CoreExt::Packet::Packet(
|
||||
ToxExtPacketList* packetList,
|
||||
ToxExtensionMessages* toxExtMessages,
|
||||
uint32_t friendId,
|
||||
std::mutex* toxext_mutex,
|
||||
ToxExtPacketList* packetList_,
|
||||
ToxExtensionMessages* toxExtMessages_,
|
||||
uint32_t friendId_,
|
||||
std::mutex* toxext_mutex_,
|
||||
PacketPassKey)
|
||||
: toxext_mutex(toxext_mutex)
|
||||
, toxExtMessages(toxExtMessages)
|
||||
, packetList(packetList)
|
||||
, friendId(friendId)
|
||||
: toxext_mutex(toxext_mutex_)
|
||||
, toxExtMessages(toxExtMessages_)
|
||||
, packetList(packetList_)
|
||||
, friendId(friendId_)
|
||||
{
|
||||
assert(toxext_mutex != nullptr);
|
||||
}
|
||||
@ -197,4 +197,3 @@ void CoreExt::onExtendedMessageNegotiation(uint32_t friendId, bool compatible, u
|
||||
|
||||
emit coreExt->extendedMessageSupport(friendId, compatible);
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,9 @@ CoreFilePtr CoreFile::makeCoreFile(Core *core, Tox *tox, CompatibleRecursiveMute
|
||||
return result;
|
||||
}
|
||||
|
||||
CoreFile::CoreFile(Tox *core, CompatibleRecursiveMutex &coreLoopLock)
|
||||
: tox{core}
|
||||
, coreLoopLock{&coreLoopLock}
|
||||
CoreFile::CoreFile(Tox *core_, CompatibleRecursiveMutex &coreLoopLock_)
|
||||
: tox{core_}
|
||||
, coreLoopLock{&coreLoopLock_}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ signals:
|
||||
void fileSendFailed(uint32_t friendId, const QString& fname);
|
||||
|
||||
private:
|
||||
CoreFile(Tox* core, CompatibleRecursiveMutex& coreLoopLock);
|
||||
CoreFile(Tox* core_, CompatibleRecursiveMutex& coreLoopLock_);
|
||||
|
||||
ToxFile* findFile(uint32_t friendId, uint32_t fileId);
|
||||
void addFile(uint32_t friendId, uint32_t fileId, const ToxFile& file);
|
||||
|
@ -48,11 +48,11 @@
|
||||
* @brief Keeps sources for users in group calls.
|
||||
*/
|
||||
|
||||
ToxCall::ToxCall(bool VideoEnabled, CoreAV& av, IAudioControl& audio)
|
||||
: av{&av}
|
||||
, audio(audio)
|
||||
, videoEnabled{VideoEnabled}
|
||||
, audioSource(audio.makeSource())
|
||||
ToxCall::ToxCall(bool VideoEnabled_, CoreAV& av_, IAudioControl& audio_)
|
||||
: av{&av_}
|
||||
, audio(audio_)
|
||||
, videoEnabled{VideoEnabled_}
|
||||
, audioSource(audio_.makeSource())
|
||||
{}
|
||||
|
||||
ToxCall::~ToxCall()
|
||||
@ -118,20 +118,20 @@ CoreVideoSource* ToxCall::getVideoSource() const
|
||||
return videoSource;
|
||||
}
|
||||
|
||||
ToxFriendCall::ToxFriendCall(uint32_t FriendNum, bool VideoEnabled, CoreAV& av, IAudioControl& audio)
|
||||
: ToxCall(VideoEnabled, av, audio)
|
||||
, sink(audio.makeSink())
|
||||
ToxFriendCall::ToxFriendCall(uint32_t FriendNum, bool VideoEnabled, CoreAV& av_, IAudioControl& audio_)
|
||||
: ToxCall(VideoEnabled, av_, audio_)
|
||||
, sink(audio_.makeSink())
|
||||
, friendId{FriendNum}
|
||||
{
|
||||
connect(audioSource.get(), &IAudioSource::frameAvailable, this,
|
||||
[this](const int16_t* pcm, size_t samples, uint8_t chans, uint32_t rate) {
|
||||
this->av->sendCallAudio(this->friendId, pcm, samples, chans, rate);
|
||||
av->sendCallAudio(friendId, pcm, samples, chans, rate);
|
||||
});
|
||||
|
||||
connect(audioSource.get(), &IAudioSource::invalidated, this, &ToxFriendCall::onAudioSourceInvalidated);
|
||||
|
||||
if (sink) {
|
||||
audioSinkInvalid = sink->connectTo_invalidated(this, [this]() { this->onAudioSinkInvalidated(); });
|
||||
audioSinkInvalid = sink->connectTo_invalidated(this, [this]() { onAudioSinkInvalidated(); });
|
||||
}
|
||||
|
||||
// register video
|
||||
@ -144,8 +144,8 @@ ToxFriendCall::ToxFriendCall(uint32_t FriendNum, bool VideoEnabled, CoreAV& av,
|
||||
}
|
||||
source.subscribe();
|
||||
videoInConn = QObject::connect(&source, &VideoSource::frameAvailable,
|
||||
[&av, FriendNum](std::shared_ptr<VideoFrame> frame) {
|
||||
av.sendCallVideo(FriendNum, frame);
|
||||
[&av_, FriendNum](std::shared_ptr<VideoFrame> frame) {
|
||||
av_.sendCallVideo(FriendNum, frame);
|
||||
});
|
||||
if (!videoInConn) {
|
||||
qDebug() << "Video connection not working";
|
||||
@ -163,7 +163,7 @@ void ToxFriendCall::onAudioSourceInvalidated()
|
||||
auto newSrc = audio.makeSource();
|
||||
connect(newSrc.get(), &IAudioSource::frameAvailable, this,
|
||||
[this](const int16_t* pcm, size_t samples, uint8_t chans, uint32_t rate) {
|
||||
this->av->sendCallAudio(this->friendId, pcm, samples, chans, rate);
|
||||
av->sendCallAudio(friendId, pcm, samples, chans, rate);
|
||||
});
|
||||
audioSource = std::move(newSrc);
|
||||
|
||||
@ -175,7 +175,7 @@ void ToxFriendCall::onAudioSinkInvalidated()
|
||||
auto newSink = audio.makeSink();
|
||||
|
||||
if (newSink) {
|
||||
audioSinkInvalid = newSink->connectTo_invalidated(this, [this]() { this->onAudioSinkInvalidated(); });
|
||||
audioSinkInvalid = newSink->connectTo_invalidated(this, [this]() { onAudioSinkInvalidated(); });
|
||||
}
|
||||
|
||||
sink = std::move(newSink);
|
||||
@ -199,18 +199,18 @@ void ToxFriendCall::playAudioBuffer(const int16_t* data, int samples, unsigned c
|
||||
}
|
||||
}
|
||||
|
||||
ToxGroupCall::ToxGroupCall(const Group& group, CoreAV& av, IAudioControl& audio)
|
||||
: ToxCall(false, av, audio)
|
||||
, group{group}
|
||||
ToxGroupCall::ToxGroupCall(const Group& group_, CoreAV& av_, IAudioControl& audio_)
|
||||
: ToxCall(false, av_, audio_)
|
||||
, group{group_}
|
||||
{
|
||||
// register audio
|
||||
connect(audioSource.get(), &IAudioSource::frameAvailable, this,
|
||||
[this](const int16_t* pcm, size_t samples, uint8_t chans, uint32_t rate) {
|
||||
if (this->group.getPeersCount() <= 1) {
|
||||
if (group.getPeersCount() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->av->sendGroupCallAudio(this->group.getId(), pcm, samples, chans, rate);
|
||||
av->sendGroupCallAudio(group.getId(), pcm, samples, chans, rate);
|
||||
});
|
||||
|
||||
connect(audioSource.get(), &IAudioSource::invalidated, this, &ToxGroupCall::onAudioSourceInvalidated);
|
||||
@ -227,11 +227,11 @@ void ToxGroupCall::onAudioSourceInvalidated()
|
||||
auto newSrc = audio.makeSource();
|
||||
connect(audioSource.get(), &IAudioSource::frameAvailable,
|
||||
[this](const int16_t* pcm, size_t samples, uint8_t chans, uint32_t rate) {
|
||||
if (this->group.getPeersCount() <= 1) {
|
||||
if (group.getPeersCount() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->av->sendGroupCallAudio(this->group.getId(), pcm, samples, chans, rate);
|
||||
av->sendGroupCallAudio(group.getId(), pcm, samples, chans, rate);
|
||||
});
|
||||
|
||||
audioSource = std::move(newSrc);
|
||||
@ -266,7 +266,7 @@ void ToxGroupCall::addPeer(ToxPk peerId)
|
||||
QMetaObject::Connection con;
|
||||
|
||||
if (newSink) {
|
||||
con = newSink->connectTo_invalidated(this, [this, peerId]() { this->onAudioSinkInvalidated(peerId); });
|
||||
con = newSink->connectTo_invalidated(this, [this, peerId]() { onAudioSinkInvalidated(peerId); });
|
||||
}
|
||||
|
||||
peers.emplace(peerId, std::move(newSink));
|
||||
|
@ -91,7 +91,7 @@ class ToxFriendCall : public ToxCall
|
||||
Q_OBJECT
|
||||
public:
|
||||
ToxFriendCall() = delete;
|
||||
ToxFriendCall(uint32_t friendId, bool VideoEnabled, CoreAV& av, IAudioControl& audio);
|
||||
ToxFriendCall(uint32_t friendId, bool VideoEnabled, CoreAV& av_, IAudioControl& audio_);
|
||||
ToxFriendCall(ToxFriendCall&& other) = delete;
|
||||
ToxFriendCall& operator=(ToxFriendCall&& other) = delete;
|
||||
~ToxFriendCall();
|
||||
@ -117,7 +117,7 @@ class ToxGroupCall : public ToxCall
|
||||
Q_OBJECT
|
||||
public:
|
||||
ToxGroupCall() = delete;
|
||||
ToxGroupCall(const Group& group, CoreAV& av, IAudioControl& audio);
|
||||
ToxGroupCall(const Group& group_, CoreAV& av_, IAudioControl& audio_);
|
||||
ToxGroupCall(ToxGroupCall&& other) = delete;
|
||||
~ToxGroupCall();
|
||||
|
||||
|
@ -46,16 +46,16 @@ ToxFile::ToxFile()
|
||||
/**
|
||||
* @brief ToxFile constructor
|
||||
*/
|
||||
ToxFile::ToxFile(uint32_t fileNum, uint32_t friendId, QString filename, QString filePath,
|
||||
uint64_t filesize, FileDirection Direction)
|
||||
ToxFile::ToxFile(uint32_t fileNum_, uint32_t friendId_, QString fileName_, QString filePath_,
|
||||
uint64_t filesize, FileDirection direction_)
|
||||
: fileKind{TOX_FILE_KIND_DATA}
|
||||
, fileNum(fileNum)
|
||||
, friendId(friendId)
|
||||
, fileName{filename}
|
||||
, filePath{filePath}
|
||||
, file{new QFile(filePath)}
|
||||
, fileNum(fileNum_)
|
||||
, friendId(friendId_)
|
||||
, fileName{fileName_}
|
||||
, filePath{filePath_}
|
||||
, file{new QFile(filePath_)}
|
||||
, status{INITIALIZING}
|
||||
, direction{Direction}
|
||||
, direction{direction_}
|
||||
, progress(filesize)
|
||||
{}
|
||||
|
||||
|
@ -52,8 +52,8 @@ struct ToxFile
|
||||
};
|
||||
|
||||
ToxFile();
|
||||
ToxFile(uint32_t FileNum, uint32_t FriendId, QString FileName, QString filePath,
|
||||
uint64_t filesize, FileDirection Direction);
|
||||
ToxFile(uint32_t fileNum_, uint32_t friendId_, QString fileName_, QString filePath_,
|
||||
uint64_t filesize, FileDirection direction);
|
||||
|
||||
bool operator==(const ToxFile& other) const;
|
||||
bool operator!=(const ToxFile& other) const;
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
ToxFileProgress::ToxFileProgress(uint64_t filesize, int samplePeriodMs)
|
||||
: filesize(filesize)
|
||||
, samplePeriodMs(samplePeriodMs)
|
||||
ToxFileProgress::ToxFileProgress(uint64_t filesize_, int samplePeriodMs_)
|
||||
: filesize(filesize_)
|
||||
, samplePeriodMs(samplePeriodMs_)
|
||||
{
|
||||
if (samplePeriodMs < 0) {
|
||||
if (samplePeriodMs_ < 0) {
|
||||
qWarning("Invalid sample rate, healing to 1000ms");
|
||||
this->samplePeriodMs = 1000;
|
||||
samplePeriodMs = 1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
class ToxFileProgress
|
||||
{
|
||||
public:
|
||||
ToxFileProgress(uint64_t filesize, int samplePeriodMs = 4000);
|
||||
ToxFileProgress(uint64_t filesize_, int samplePeriodMs_ = 4000);
|
||||
|
||||
QTime lastSampleTime() const;
|
||||
bool addSample(uint64_t bytesSent, QTime now = QTime::currentTime());
|
||||
|
@ -33,9 +33,9 @@
|
||||
* are correctly deleted.
|
||||
*/
|
||||
|
||||
ToxOptions::ToxOptions(Tox_Options* options, const QByteArray& proxyAddrData)
|
||||
: options(options)
|
||||
, proxyAddrData(proxyAddrData)
|
||||
ToxOptions::ToxOptions(Tox_Options* options_, const QByteArray& proxyAddrData_)
|
||||
: options(options_)
|
||||
, proxyAddrData(proxyAddrData_)
|
||||
{}
|
||||
|
||||
ToxOptions::~ToxOptions()
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
void setIPv6Enabled(bool enabled);
|
||||
|
||||
private:
|
||||
ToxOptions(Tox_Options* options, const QByteArray& proxyAddrData);
|
||||
ToxOptions(Tox_Options* options_, const QByteArray& proxyAddrData_);
|
||||
|
||||
private:
|
||||
Tox_Options* options = nullptr;
|
||||
|
@ -69,8 +69,8 @@ namespace
|
||||
* @brief Inter-process communication
|
||||
*/
|
||||
|
||||
IPC::IPC(uint32_t profileId)
|
||||
: profileId{profileId}
|
||||
IPC::IPC(uint32_t profileId_)
|
||||
: profileId{profileId_}
|
||||
, globalMemory{getIpcKey()}
|
||||
{
|
||||
qRegisterMetaType<IPCEventHandler>("IPCEventHandler");
|
||||
@ -237,9 +237,9 @@ bool IPC::isAttached() const
|
||||
return globalMemory.isAttached();
|
||||
}
|
||||
|
||||
void IPC::setProfileId(uint32_t profileId)
|
||||
void IPC::setProfileId(uint32_t profileId_)
|
||||
{
|
||||
this->profileId = profileId;
|
||||
profileId = profileId_;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ protected:
|
||||
static const int OWNERSHIP_TIMEOUT_S = 5;
|
||||
|
||||
public:
|
||||
IPC(uint32_t profileId);
|
||||
IPC(uint32_t profileId_);
|
||||
~IPC();
|
||||
|
||||
struct IPCEvent
|
||||
@ -74,7 +74,7 @@ public:
|
||||
bool isAttached() const;
|
||||
|
||||
public slots:
|
||||
void setProfileId(uint32_t profileId);
|
||||
void setProfileId(uint32_t profileId_);
|
||||
|
||||
private:
|
||||
IPCMemory* global();
|
||||
|
@ -162,8 +162,8 @@ void logMessageHandler(QtMsgType type, const QMessageLogContext& ctxt, const QSt
|
||||
logBufferMutex->lock();
|
||||
if (logBuffer) {
|
||||
// empty logBuffer to file
|
||||
foreach (QByteArray msg, *logBuffer)
|
||||
fwrite(msg.constData(), 1, msg.size(), logFilePtr);
|
||||
foreach (QByteArray bufferedMsg, *logBuffer)
|
||||
fwrite(bufferedMsg.constData(), 1, bufferedMsg.size(), logFilePtr);
|
||||
|
||||
delete logBuffer; // no longer needed
|
||||
logBuffer = nullptr;
|
||||
|
@ -24,21 +24,21 @@
|
||||
#include "src/persistence/profile.h"
|
||||
#include "src/persistence/ifriendsettings.h"
|
||||
|
||||
AboutFriend::AboutFriend(const Friend* f, IFriendSettings* const s)
|
||||
: f{f}
|
||||
, settings{s}
|
||||
AboutFriend::AboutFriend(const Friend* f_, IFriendSettings* const settings_)
|
||||
: f{f_}
|
||||
, settings{settings_}
|
||||
{
|
||||
s->connectTo_contactNoteChanged(this, [=](const ToxPk& pk, const QString& note) {
|
||||
settings->connectTo_contactNoteChanged(this, [=](const ToxPk& pk, const QString& note) {
|
||||
emit noteChanged(note);
|
||||
});
|
||||
s->connectTo_autoAcceptCallChanged(this,
|
||||
settings->connectTo_autoAcceptCallChanged(this,
|
||||
[=](const ToxPk& pk, IFriendSettings::AutoAcceptCallFlags flag) {
|
||||
emit autoAcceptCallChanged(flag);
|
||||
});
|
||||
s->connectTo_autoAcceptDirChanged(this, [=](const ToxPk& pk, const QString& dir) {
|
||||
settings->connectTo_autoAcceptDirChanged(this, [=](const ToxPk& pk, const QString& dir) {
|
||||
emit autoAcceptDirChanged(dir);
|
||||
});
|
||||
s->connectTo_autoGroupInviteChanged(this, [=](const ToxPk& pk, bool enable) {
|
||||
settings->connectTo_autoGroupInviteChanged(this, [=](const ToxPk& pk, bool enable) {
|
||||
emit autoGroupInviteChanged(enable);
|
||||
});
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class AboutFriend : public QObject, public IAboutFriend
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AboutFriend(const Friend* f, IFriendSettings* const settings);
|
||||
AboutFriend(const Friend* f_, IFriendSettings* const settings);
|
||||
|
||||
QString getName() const override;
|
||||
QString getStatusMessage() const override;
|
||||
|
@ -70,13 +70,13 @@ bool handleActionPrefix(QString& content)
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ChatHistory::ChatHistory(Friend& f_, History* history_, const ICoreIdHandler& coreIdHandler,
|
||||
ChatHistory::ChatHistory(Friend& f_, History* history_, const ICoreIdHandler& coreIdHandler_,
|
||||
const Settings& settings_, IMessageDispatcher& messageDispatcher)
|
||||
: f(f_)
|
||||
, history(history_)
|
||||
, settings(settings_)
|
||||
, coreIdHandler(coreIdHandler)
|
||||
, sessionChatLog(getInitialChatLogIdx(), coreIdHandler)
|
||||
, coreIdHandler(coreIdHandler_)
|
||||
, sessionChatLog(getInitialChatLogIdx(), coreIdHandler_)
|
||||
{
|
||||
connect(&messageDispatcher, &IMessageDispatcher::messageComplete, this,
|
||||
&ChatHistory::onMessageComplete);
|
||||
|
@ -32,8 +32,8 @@ class ChatHistory : public IChatLog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChatHistory(Friend& f_, History* history_, const ICoreIdHandler& coreIdHandler,
|
||||
const Settings& settings, IMessageDispatcher& messageDispatcher);
|
||||
ChatHistory(Friend& f_, History* history_, const ICoreIdHandler& coreIdHandler_,
|
||||
const Settings& settings_, IMessageDispatcher& messageDispatcher);
|
||||
const ChatLogItem& at(ChatLogIdx idx) const override;
|
||||
SearchResult searchForward(SearchPos startIdx, const QString& phrase,
|
||||
const ParameterSearch& parameter) const override;
|
||||
|
@ -38,14 +38,14 @@ struct ChatLogItemDeleter
|
||||
};
|
||||
} // namespace
|
||||
|
||||
ChatLogItem::ChatLogItem(ToxPk sender_, const QString& displayName, ChatLogFile file_)
|
||||
: ChatLogItem(std::move(sender_), displayName, ContentType::fileTransfer,
|
||||
ChatLogItem::ChatLogItem(ToxPk sender_, const QString& displayName_, ChatLogFile file_)
|
||||
: ChatLogItem(std::move(sender_), displayName_, ContentType::fileTransfer,
|
||||
ContentPtr(new ChatLogFile(std::move(file_)),
|
||||
ChatLogItemDeleter<ChatLogFile>::doDelete))
|
||||
{}
|
||||
|
||||
ChatLogItem::ChatLogItem(ToxPk sender_, const QString& displayName, ChatLogMessage message_)
|
||||
: ChatLogItem(sender_, displayName, ContentType::message,
|
||||
ChatLogItem::ChatLogItem(ToxPk sender_, const QString& displayName_, ChatLogMessage message_)
|
||||
: ChatLogItem(sender_, displayName_, ContentType::message,
|
||||
ContentPtr(new ChatLogMessage(std::move(message_)),
|
||||
ChatLogItemDeleter<ChatLogMessage>::doDelete))
|
||||
{}
|
||||
|
@ -52,8 +52,8 @@ public:
|
||||
systemMessage,
|
||||
};
|
||||
|
||||
ChatLogItem(ToxPk sender, const QString& displayName, ChatLogFile file);
|
||||
ChatLogItem(ToxPk sender, const QString& displayName, ChatLogMessage message);
|
||||
ChatLogItem(ToxPk sender_, const QString& displayName_, ChatLogFile file_);
|
||||
ChatLogItem(ToxPk sender_, const QString& displayName_, ChatLogMessage message_);
|
||||
ChatLogItem(SystemMessage message);
|
||||
const ToxPk& getSender() const;
|
||||
ContentType getContentType() const;
|
||||
|
@ -42,10 +42,10 @@ QString getShortName(const QString& name)
|
||||
|
||||
}
|
||||
|
||||
FriendChatroom::FriendChatroom(Friend* frnd, IDialogsManager* dialogsManager, Core& _core)
|
||||
: frnd{frnd}
|
||||
, dialogsManager{dialogsManager}
|
||||
, core{_core}
|
||||
FriendChatroom::FriendChatroom(Friend* frnd_, IDialogsManager* dialogsManager_, Core& core_)
|
||||
: frnd{frnd_}
|
||||
, dialogsManager{dialogsManager_}
|
||||
, core{core_}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class FriendChatroom : public QObject, public Chatroom
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FriendChatroom(Friend* frnd, IDialogsManager* dialogsManager, Core& _core);
|
||||
FriendChatroom(Friend* frnd_, IDialogsManager* dialogsManager_, Core& core_);
|
||||
|
||||
Contact* getContact() override;
|
||||
|
||||
|
@ -28,10 +28,10 @@
|
||||
#include "src/model/status.h"
|
||||
#include "src/persistence/settings.h"
|
||||
|
||||
GroupChatroom::GroupChatroom(Group* group, IDialogsManager* dialogsManager, Core& _core)
|
||||
: group{group}
|
||||
, dialogsManager{dialogsManager}
|
||||
, core{_core}
|
||||
GroupChatroom::GroupChatroom(Group* group_, IDialogsManager* dialogsManager_, Core& core_)
|
||||
: group{group_}
|
||||
, dialogsManager{dialogsManager_}
|
||||
, core{core_}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class GroupChatroom : public QObject, public Chatroom
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GroupChatroom(Group* group, IDialogsManager* dialogsManager, Core& _core);
|
||||
GroupChatroom(Group* group_, IDialogsManager* dialogsManager_, Core& core_);
|
||||
|
||||
Contact* getContact() override;
|
||||
|
||||
|
@ -26,17 +26,17 @@
|
||||
#include <QDebug>
|
||||
#include <memory>
|
||||
|
||||
Friend::Friend(uint32_t friendId, const ToxPk& friendPk, const QString& userAlias, const QString& userName)
|
||||
: userName{userName}
|
||||
, userAlias{userAlias}
|
||||
, friendPk{friendPk}
|
||||
, friendId{friendId}
|
||||
Friend::Friend(uint32_t friendId_, const ToxPk& friendPk_, const QString& userAlias_, const QString& userName_)
|
||||
: userName{userName_}
|
||||
, userAlias{userAlias_}
|
||||
, friendPk{friendPk_}
|
||||
, friendId{friendId_}
|
||||
, hasNewEvents{false}
|
||||
, friendStatus{Status::Status::Offline}
|
||||
, isNegotiating{false}
|
||||
{
|
||||
if (userName.isEmpty()) {
|
||||
this->userName = friendPk.toString();
|
||||
if (userName_.isEmpty()) {
|
||||
userName = friendPk.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Friend : public Contact
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Friend(uint32_t friendId, const ToxPk& friendPk, const QString& userAlias = {}, const QString &userName = {});
|
||||
Friend(uint32_t friendId_, const ToxPk& friendPk_, const QString& userAlias_ = {}, const QString& userName_ = {});
|
||||
Friend(const Friend& other) = delete;
|
||||
Friend& operator=(const Friend& other) = delete;
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include "friendlistmanager.h"
|
||||
#include "src/widget/genericchatroomwidget.h"
|
||||
|
||||
FriendListManager::FriendListManager(int countContacts, QObject *parent) : QObject(parent)
|
||||
FriendListManager::FriendListManager(int countContacts_, QObject *parent) : QObject(parent)
|
||||
{
|
||||
this->countContacts = countContacts;
|
||||
countContacts = countContacts_;
|
||||
}
|
||||
|
||||
QVector<FriendListManager::IFriendListItemPtr> FriendListManager::getItems() const
|
||||
@ -136,7 +136,7 @@ void FriendListManager::updatePositions()
|
||||
|
||||
if (byName) {
|
||||
auto sortName = [&](const IFriendListItemPtr &a, const IFriendListItemPtr &b) {
|
||||
return cmpByName(a, b, groupsOnTop);
|
||||
return cmpByName(a, b);
|
||||
};
|
||||
if (!needSort) {
|
||||
if (std::is_sorted(items.begin(), items.end(), sortName)) {
|
||||
@ -183,8 +183,7 @@ void FriendListManager::removeAll(IFriendListItem* item)
|
||||
}
|
||||
}
|
||||
|
||||
bool FriendListManager::cmpByName(const IFriendListItemPtr &a, const IFriendListItemPtr &b,
|
||||
bool groupsOnTop)
|
||||
bool FriendListManager::cmpByName(const IFriendListItemPtr &a, const IFriendListItemPtr &b)
|
||||
{
|
||||
if (a->isGroup() && !b->isGroup()) {
|
||||
if (groupsOnTop) {
|
||||
@ -239,4 +238,3 @@ bool FriendListManager::cmpByActivity(const IFriendListItemPtr &a, const IFriend
|
||||
|
||||
return a->getLastActivity() > b->getLastActivity();
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include <memory>
|
||||
|
||||
class FriendListManager : public QObject
|
||||
{
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using IFriendListItemPtr = std::shared_ptr<IFriendListItem>;
|
||||
|
||||
explicit FriendListManager(int countContacts, QObject *parent = nullptr);
|
||||
explicit FriendListManager(int countContacts_, QObject *parent = nullptr);
|
||||
|
||||
QVector<IFriendListItemPtr> getItems() const;
|
||||
bool needHideCircles() const;
|
||||
@ -63,8 +63,8 @@ private:
|
||||
bool hideGroups = false;
|
||||
} filterParams;
|
||||
|
||||
void removeAll(IFriendListItem*);
|
||||
bool cmpByName(const IFriendListItemPtr&, const IFriendListItemPtr&, bool groupsOnTop);
|
||||
void removeAll(IFriendListItem*);
|
||||
bool cmpByName(const IFriendListItemPtr&, const IFriendListItemPtr&);
|
||||
bool cmpByActivity(const IFriendListItemPtr&, const IFriendListItemPtr&);
|
||||
|
||||
bool byName = true;
|
||||
|
@ -47,7 +47,7 @@ FriendMessageDispatcher::sendMessage(bool isAction, const QString& content)
|
||||
auto onOfflineMsgComplete = getCompletionFn(messageId);
|
||||
sendProcessedMessage(message, onOfflineMsgComplete);
|
||||
|
||||
emit this->messageSent(messageId, message);
|
||||
emit messageSent(messageId, message);
|
||||
}
|
||||
return std::make_pair(firstId, lastId);
|
||||
}
|
||||
@ -68,7 +68,7 @@ FriendMessageDispatcher::sendExtendedMessage(const QString& content, ExtensionSe
|
||||
auto onOfflineMsgComplete = getCompletionFn(messageId);
|
||||
sendProcessedMessage(message, onOfflineMsgComplete);
|
||||
|
||||
emit this->messageSent(messageId, message);
|
||||
emit messageSent(messageId, message);
|
||||
}
|
||||
return std::make_pair(firstId, lastId);
|
||||
}
|
||||
@ -80,7 +80,7 @@ FriendMessageDispatcher::sendExtendedMessage(const QString& content, ExtensionSe
|
||||
*/
|
||||
void FriendMessageDispatcher::onMessageReceived(bool isAction, const QString& content)
|
||||
{
|
||||
emit this->messageReceived(f.getPublicKey(), processor.processIncomingCoreMessage(isAction, content));
|
||||
emit messageReceived(f.getPublicKey(), processor.processIncomingCoreMessage(isAction, content));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,7 +95,7 @@ void FriendMessageDispatcher::onReceiptReceived(ReceiptNum receipt)
|
||||
void FriendMessageDispatcher::onExtMessageReceived(const QString& content)
|
||||
{
|
||||
auto message = processor.processIncomingExtMessage(content);
|
||||
emit this->messageReceived(f.getPublicKey(), message);
|
||||
emit messageReceived(f.getPublicKey(), message);
|
||||
}
|
||||
|
||||
void FriendMessageDispatcher::onExtReceiptReceived(uint64_t receiptId)
|
||||
@ -191,11 +191,11 @@ OfflineMsgEngine::CompletionFn FriendMessageDispatcher::getCompletionFn(Dispatch
|
||||
{
|
||||
return [this, messageId] (bool success) {
|
||||
if (success) {
|
||||
emit this->messageComplete(messageId);
|
||||
emit messageComplete(messageId);
|
||||
} else {
|
||||
// For now we know the only reason we can fail after giving to the
|
||||
// offline message engine is due to a reduced extension set
|
||||
emit this->messageBroken(messageId, BrokenMessageReason::unsupportedExtensions);
|
||||
emit messageBroken(messageId, BrokenMessageReason::unsupportedExtensions);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -30,13 +30,13 @@
|
||||
|
||||
static const int MAX_GROUP_TITLE_LENGTH = 128;
|
||||
|
||||
Group::Group(int groupId, const GroupId persistentGroupId, const QString& name, bool isAvGroupchat,
|
||||
const QString& selfName, ICoreGroupQuery& groupQuery, ICoreIdHandler& idHandler)
|
||||
: groupQuery(groupQuery)
|
||||
, idHandler(idHandler)
|
||||
, selfName{selfName}
|
||||
Group::Group(int groupId_, const GroupId persistentGroupId, const QString& name, bool isAvGroupchat,
|
||||
const QString& selfName_, ICoreGroupQuery& groupQuery_, ICoreIdHandler& idHandler_)
|
||||
: groupQuery(groupQuery_)
|
||||
, idHandler(idHandler_)
|
||||
, selfName{selfName_}
|
||||
, title{name}
|
||||
, toxGroupNum(groupId)
|
||||
, toxGroupNum(groupId_)
|
||||
, groupId{persistentGroupId}
|
||||
, avGroupchat{isAvGroupchat}
|
||||
{
|
||||
|
@ -35,8 +35,8 @@ class Group : public Contact
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Group(int groupId, const GroupId persistentGroupId, const QString& name, bool isAvGroupchat,
|
||||
const QString& selfName, ICoreGroupQuery& groupQuery, ICoreIdHandler& idHandler);
|
||||
Group(int groupId_, const GroupId persistentGroupId, const QString& name, bool isAvGroupchat,
|
||||
const QString& selfName_, ICoreGroupQuery& groupQuery_, ICoreIdHandler& idHandler_);
|
||||
bool isAvGroupchat() const;
|
||||
uint32_t getId() const override;
|
||||
const GroupId& getPersistentId() const override;
|
||||
|
@ -25,8 +25,8 @@
|
||||
* @brief This class contains information needed to create a group invite
|
||||
*/
|
||||
|
||||
GroupInvite::GroupInvite(uint32_t friendId, uint8_t inviteType, const QByteArray& data)
|
||||
: friendId{friendId}
|
||||
GroupInvite::GroupInvite(uint32_t friendId_, uint8_t inviteType, const QByteArray& data)
|
||||
: friendId{friendId_}
|
||||
, type{inviteType}
|
||||
, invite{data}
|
||||
, date{QDateTime::currentDateTime()}
|
||||
|
@ -27,7 +27,7 @@ class GroupInvite
|
||||
{
|
||||
public:
|
||||
GroupInvite() = default;
|
||||
GroupInvite(uint32_t friendId, uint8_t inviteType, const QByteArray& data);
|
||||
GroupInvite(uint32_t friendId_, uint8_t inviteType, const QByteArray& data);
|
||||
bool operator==(const GroupInvite& other) const;
|
||||
|
||||
uint32_t getFriendId() const;
|
||||
|
@ -58,8 +58,8 @@ GroupMessageDispatcher::sendMessage(bool isAction, QString const& content)
|
||||
// toxcore to send it back to us to indicate a completed message, but
|
||||
// this isn't necessarily the design of toxcore and associating the
|
||||
// received message back would be difficult.
|
||||
emit this->messageSent(messageId, message);
|
||||
emit this->messageComplete(messageId);
|
||||
emit messageSent(messageId, message);
|
||||
emit messageComplete(messageId);
|
||||
}
|
||||
|
||||
return std::make_pair(firstMessageId, lastMessageId);
|
||||
@ -71,8 +71,8 @@ GroupMessageDispatcher::sendExtendedMessage(const QString& content, ExtensionSet
|
||||
// Stub this api to immediately fail
|
||||
auto messageId = nextMessageId++;
|
||||
auto messages = processor.processOutgoingMessage(false, content, ExtensionSet());
|
||||
emit this->messageSent(messageId, messages[0]);
|
||||
emit this->messageBroken(messageId, BrokenMessageReason::unsupportedExtensions);
|
||||
emit messageSent(messageId, messages[0]);
|
||||
emit messageBroken(messageId, BrokenMessageReason::unsupportedExtensions);
|
||||
return {messageId, messageId};
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,8 @@ void MessageProcessor::SharedParams::setPublicKey(const QString& pk)
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
}
|
||||
|
||||
MessageProcessor::MessageProcessor(const MessageProcessor::SharedParams& sharedParams)
|
||||
: sharedParams(sharedParams)
|
||||
MessageProcessor::MessageProcessor(const MessageProcessor::SharedParams& sharedParams_)
|
||||
: sharedParams(sharedParams_)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
QRegularExpression pubKeyMention;
|
||||
};
|
||||
|
||||
MessageProcessor(const SharedParams& sharedParams);
|
||||
MessageProcessor(const SharedParams& sharedParams_);
|
||||
|
||||
std::vector<Message> processOutgoingMessage(bool isAction, const QString& content, ExtensionSet extensions);
|
||||
Message processIncomingCoreMessage(bool isAction, const QString& content);
|
||||
|
@ -157,10 +157,10 @@ namespace
|
||||
} // namespace
|
||||
|
||||
NotificationGenerator::NotificationGenerator(
|
||||
INotificationSettings const& notificationSettings,
|
||||
Profile* profile)
|
||||
: notificationSettings(notificationSettings)
|
||||
, profile(profile)
|
||||
INotificationSettings const& notificationSettings_,
|
||||
Profile* profile_)
|
||||
: notificationSettings(notificationSettings_)
|
||||
, profile(profile_)
|
||||
{}
|
||||
|
||||
NotificationGenerator::~NotificationGenerator() = default;
|
||||
|
@ -36,11 +36,11 @@ class NotificationGenerator : public QObject
|
||||
|
||||
public:
|
||||
NotificationGenerator(
|
||||
INotificationSettings const& notificationSettings,
|
||||
INotificationSettings const& notificationSettings_,
|
||||
// Optional profile input to lookup avatars. Avatar lookup is not
|
||||
// currently mockable so we allow profile to be nullptr for unit
|
||||
// testing
|
||||
Profile* profile);
|
||||
Profile* profile_);
|
||||
virtual ~NotificationGenerator();
|
||||
NotificationGenerator(const NotificationGenerator&) = delete;
|
||||
NotificationGenerator& operator=(const NotificationGenerator&) = delete;
|
||||
|
@ -43,13 +43,13 @@
|
||||
* @param profile Pointer to Profile.
|
||||
* @note All pointers parameters shouldn't be null.
|
||||
*/
|
||||
ProfileInfo::ProfileInfo(Core* core, Profile* profile)
|
||||
: profile{profile}
|
||||
, core{core}
|
||||
ProfileInfo::ProfileInfo(Core* core_, Profile* profile_)
|
||||
: profile{profile_}
|
||||
, core{core_}
|
||||
{
|
||||
connect(core, &Core::idSet, this, &ProfileInfo::idChanged);
|
||||
connect(core, &Core::usernameSet, this, &ProfileInfo::usernameChanged);
|
||||
connect(core, &Core::statusMessageSet, this, &ProfileInfo::statusMessageChanged);
|
||||
connect(core_, &Core::idSet, this, &ProfileInfo::idChanged);
|
||||
connect(core_, &Core::usernameSet, this, &ProfileInfo::usernameChanged);
|
||||
connect(core_, &Core::statusMessageSet, this, &ProfileInfo::statusMessageChanged);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ class ProfileInfo : public QObject, public IProfileInfo
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProfileInfo(Core* core, Profile* profile);
|
||||
ProfileInfo(Core* core_, Profile* profile_);
|
||||
|
||||
bool setPassword(const QString& password) override;
|
||||
bool deletePassword() override;
|
||||
|
@ -40,8 +40,8 @@ struct MessageDateAdaptor
|
||||
: invalidDateTime)
|
||||
{}
|
||||
|
||||
MessageDateAdaptor(const QDateTime& timestamp)
|
||||
: timestamp(timestamp)
|
||||
MessageDateAdaptor(const QDateTime& timestamp_)
|
||||
: timestamp(timestamp_)
|
||||
{}
|
||||
|
||||
const QDateTime& timestamp;
|
||||
@ -125,15 +125,15 @@ QString resolveToxPk(const ToxPk& pk)
|
||||
}
|
||||
} // namespace
|
||||
|
||||
SessionChatLog::SessionChatLog(const ICoreIdHandler& coreIdHandler)
|
||||
: coreIdHandler(coreIdHandler)
|
||||
SessionChatLog::SessionChatLog(const ICoreIdHandler& coreIdHandler_)
|
||||
: coreIdHandler(coreIdHandler_)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief Alternate constructor that allows for an initial index to be set
|
||||
*/
|
||||
SessionChatLog::SessionChatLog(ChatLogIdx initialIdx, const ICoreIdHandler& coreIdHandler)
|
||||
: coreIdHandler(coreIdHandler)
|
||||
SessionChatLog::SessionChatLog(ChatLogIdx initialIdx, const ICoreIdHandler& coreIdHandler_)
|
||||
: coreIdHandler(coreIdHandler_)
|
||||
, nextIdx(initialIdx)
|
||||
{}
|
||||
|
||||
@ -325,7 +325,7 @@ void SessionChatLog::addSystemMessage(const SystemMessage& message)
|
||||
|
||||
items.emplace(messageIdx, ChatLogItem(message));
|
||||
|
||||
emit this->itemUpdated(messageIdx);
|
||||
emit itemUpdated(messageIdx);
|
||||
}
|
||||
|
||||
void SessionChatLog::insertCompleteMessageAtIdx(ChatLogIdx idx, const ToxPk& sender, QString senderName,
|
||||
@ -387,7 +387,7 @@ void SessionChatLog::onMessageReceived(const ToxPk& sender, const Message& messa
|
||||
chatLogMessage.message = message;
|
||||
items.emplace(messageIdx, ChatLogItem(sender, resolveSenderNameFromSender(sender), chatLogMessage));
|
||||
|
||||
emit this->itemUpdated(messageIdx);
|
||||
emit itemUpdated(messageIdx);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,7 +407,7 @@ void SessionChatLog::onMessageSent(DispatchedMessageId id, const Message& messag
|
||||
|
||||
outgoingMessages.insert(id, messageIdx);
|
||||
|
||||
emit this->itemUpdated(messageIdx);
|
||||
emit itemUpdated(messageIdx);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -433,7 +433,7 @@ void SessionChatLog::onMessageComplete(DispatchedMessageId id)
|
||||
|
||||
messageIt->second.getContentAsMessage().state = MessageState::complete;
|
||||
|
||||
emit this->itemUpdated(messageIt->first);
|
||||
emit itemUpdated(messageIt->first);
|
||||
}
|
||||
|
||||
void SessionChatLog::onMessageBroken(DispatchedMessageId id, BrokenMessageReason)
|
||||
@ -456,7 +456,7 @@ void SessionChatLog::onMessageBroken(DispatchedMessageId id, BrokenMessageReason
|
||||
// NOTE: Reason for broken message not currently shown in UI, but it could be
|
||||
messageIt->second.getContentAsMessage().state = MessageState::broken;
|
||||
|
||||
emit this->itemUpdated(messageIt->first);
|
||||
emit itemUpdated(messageIt->first);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -495,7 +495,7 @@ void SessionChatLog::onFileUpdated(const ToxPk& sender, const ToxFile& file)
|
||||
currentFileTransfers.erase(fileIt);
|
||||
}
|
||||
|
||||
emit this->itemUpdated(messageIdx);
|
||||
emit itemUpdated(messageIdx);
|
||||
}
|
||||
|
||||
void SessionChatLog::onFileTransferRemotePausedUnpaused(const ToxPk& sender, const ToxFile& file,
|
||||
|
@ -32,8 +32,8 @@ class SessionChatLog : public IChatLog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SessionChatLog(const ICoreIdHandler& coreIdHandler);
|
||||
SessionChatLog(ChatLogIdx initialIdx, const ICoreIdHandler& coreIdHandler);
|
||||
SessionChatLog(const ICoreIdHandler& coreIdHandler_);
|
||||
SessionChatLog(ChatLogIdx initialIdx, const ICoreIdHandler& coreIdHandler_);
|
||||
|
||||
~SessionChatLog();
|
||||
const ChatLogItem& at(ChatLogIdx idx) const override;
|
||||
|
@ -81,9 +81,9 @@ void AvatarBroadcaster::sendAvatarTo(uint32_t friendId)
|
||||
*/
|
||||
void AvatarBroadcaster::enableAutoBroadcast(bool state)
|
||||
{
|
||||
this->disconnect(&core, nullptr, this, nullptr);
|
||||
disconnect(&core, nullptr, this, nullptr);
|
||||
if (state) {
|
||||
connect(&core, &Core::friendStatusChanged,
|
||||
[=](uint32_t friendId, Status::Status) { this->sendAvatarTo(friendId); });
|
||||
[=](uint32_t friendId, Status::Status) { sendAvatarTo(friendId); });
|
||||
}
|
||||
}
|
||||
|
@ -220,12 +220,12 @@ void createExampleBootstrapNodesFile(const Paths& paths)
|
||||
* @brief Fetches a list of currently online bootstrap nodes from node.tox.chat
|
||||
* @param proxy Proxy to use for the lookup, must outlive this object
|
||||
*/
|
||||
BootstrapNodeUpdater::BootstrapNodeUpdater(const QNetworkProxy& proxy, Paths& _paths, QObject* parent)
|
||||
: proxy{proxy}
|
||||
, paths{_paths}
|
||||
BootstrapNodeUpdater::BootstrapNodeUpdater(const QNetworkProxy& proxy_, Paths& paths_, QObject* parent)
|
||||
: proxy{proxy_}
|
||||
, paths{paths_}
|
||||
, QObject{parent}
|
||||
{
|
||||
createExampleBootstrapNodesFile(_paths);
|
||||
createExampleBootstrapNodesFile(paths_);
|
||||
}
|
||||
|
||||
QList<DhtServer> BootstrapNodeUpdater::getBootstrapnodes() const
|
||||
|
@ -34,7 +34,7 @@ class BootstrapNodeUpdater : public QObject, public IBootstrapListGenerator
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BootstrapNodeUpdater(const QNetworkProxy& proxy, Paths& _paths, QObject* parent = nullptr);
|
||||
explicit BootstrapNodeUpdater(const QNetworkProxy& proxy_, Paths& paths_, QObject* parent = nullptr);
|
||||
QList<DhtServer> getBootstrapnodes() const override;
|
||||
void requestBootstrapNodes();
|
||||
static QList<DhtServer> loadDefaultBootstrapNodes();
|
||||
|
@ -99,8 +99,8 @@ bool isCurrentVersionStable()
|
||||
|
||||
} // namespace
|
||||
|
||||
UpdateCheck::UpdateCheck(const Settings& settings)
|
||||
: settings(settings)
|
||||
UpdateCheck::UpdateCheck(const Settings& settings_)
|
||||
: settings(settings_)
|
||||
{
|
||||
qInfo() << "qTox is running version:" << GIT_DESCRIBE;
|
||||
updateTimer.start(1000 * 60 * 60 * 24 /* 1 day */);
|
||||
|
@ -34,7 +34,7 @@ class UpdateCheck : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UpdateCheck(const Settings& settings);
|
||||
UpdateCheck(const Settings& settings_);
|
||||
void checkForUpdate();
|
||||
|
||||
signals:
|
||||
|
@ -191,14 +191,14 @@ void Nexus::bootstrapWithProfile(Profile* p)
|
||||
}
|
||||
}
|
||||
|
||||
void Nexus::setSettings(Settings* settings)
|
||||
void Nexus::setSettings(Settings* settings_)
|
||||
{
|
||||
if (this->settings) {
|
||||
QObject::disconnect(this, &Nexus::saveGlobal, this->settings, &Settings::saveGlobal);
|
||||
if (settings) {
|
||||
QObject::disconnect(this, &Nexus::saveGlobal, settings, &Settings::saveGlobal);
|
||||
}
|
||||
this->settings = settings;
|
||||
if (this->settings) {
|
||||
QObject::connect(this, &Nexus::saveGlobal, this->settings, &Settings::saveGlobal);
|
||||
settings = settings_;
|
||||
if (settings) {
|
||||
QObject::connect(this, &Nexus::saveGlobal, settings, &Settings::saveGlobal);
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,11 +276,11 @@ void Nexus::destroyInstance()
|
||||
*/
|
||||
Core* Nexus::getCore()
|
||||
{
|
||||
Nexus& nexus = getInstance();
|
||||
if (!nexus.profile)
|
||||
Nexus& nexus_ = getInstance();
|
||||
if (!nexus_.profile)
|
||||
return nullptr;
|
||||
|
||||
return &nexus.profile->getCore();
|
||||
return &nexus_.profile->getCore();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -328,9 +328,9 @@ void Nexus::setProfile(Profile* p)
|
||||
emit currentProfileChanged(p);
|
||||
}
|
||||
|
||||
void Nexus::setParser(QCommandLineParser* parser)
|
||||
void Nexus::setParser(QCommandLineParser* parser_)
|
||||
{
|
||||
this->parser = parser;
|
||||
parser = parser_;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,8 +46,8 @@ class Nexus : public QObject
|
||||
public:
|
||||
void start();
|
||||
void showMainGUI();
|
||||
void setSettings(Settings* settings);
|
||||
void setParser(QCommandLineParser* parser);
|
||||
void setSettings(Settings* settings_);
|
||||
void setParser(QCommandLineParser* parser_);
|
||||
static Nexus& getInstance();
|
||||
static void destroyInstance();
|
||||
static Core* getCore();
|
||||
|
@ -84,9 +84,9 @@
|
||||
* @param password If empty, the database will be opened unencrypted.
|
||||
* Otherwise we will use toxencryptsave to derive a key and encrypt the database.
|
||||
*/
|
||||
RawDatabase::RawDatabase(const QString& path, const QString& password, const QByteArray& salt)
|
||||
RawDatabase::RawDatabase(const QString& path_, const QString& password, const QByteArray& salt)
|
||||
: workerThread{new QThread}
|
||||
, path{path}
|
||||
, path{path_}
|
||||
, currentSalt{salt} // we need the salt later if a new password should be set
|
||||
, currentHexKey{deriveKey(password, salt)}
|
||||
{
|
||||
@ -140,25 +140,25 @@ RawDatabase::~RawDatabase()
|
||||
* @param hexKey Hex representation of the key in string.
|
||||
* @return True if success, false otherwise.
|
||||
*/
|
||||
bool RawDatabase::open(const QString& path, const QString& hexKey)
|
||||
bool RawDatabase::open(const QString& path_, const QString& hexKey)
|
||||
{
|
||||
if (QThread::currentThread() != workerThread.get()) {
|
||||
bool ret;
|
||||
QMetaObject::invokeMethod(this, "open", Qt::BlockingQueuedConnection, Q_RETURN_ARG(bool, ret),
|
||||
Q_ARG(const QString&, path), Q_ARG(const QString&, hexKey));
|
||||
Q_ARG(const QString&, path_), Q_ARG(const QString&, hexKey));
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!QFile::exists(path) && QFile::exists(path + ".tmp")) {
|
||||
if (!QFile::exists(path_) && QFile::exists(path_ + ".tmp")) {
|
||||
qWarning() << "Restoring database from temporary export file! Did we crash while changing "
|
||||
"the password or upgrading?";
|
||||
QFile::rename(path + ".tmp", path);
|
||||
QFile::rename(path_ + ".tmp", path_);
|
||||
}
|
||||
|
||||
if (sqlite3_open_v2(path.toUtf8().data(), &sqlite,
|
||||
if (sqlite3_open_v2(path_.toUtf8().data(), &sqlite,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, nullptr)
|
||||
!= SQLITE_OK) {
|
||||
qWarning() << "Failed to open database" << path << "with error:" << sqlite3_errmsg(sqlite);
|
||||
qWarning() << "Failed to open database" << path_ << "with error:" << sqlite3_errmsg(sqlite);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -57,21 +57,21 @@ public:
|
||||
class Query
|
||||
{
|
||||
public:
|
||||
Query(QString query, QVector<QByteArray> blobs = {},
|
||||
const std::function<void(RowId)>& insertCallback = {})
|
||||
: query{query.toUtf8()}
|
||||
, blobs{blobs}
|
||||
, insertCallback{insertCallback}
|
||||
Query(QString query_, QVector<QByteArray> blobs_ = {},
|
||||
const std::function<void(RowId)>& insertCallback_ = {})
|
||||
: query{query_.toUtf8()}
|
||||
, blobs{blobs_}
|
||||
, insertCallback{insertCallback_}
|
||||
{
|
||||
}
|
||||
Query(QString query, const std::function<void(RowId)>& insertCallback)
|
||||
: query{query.toUtf8()}
|
||||
, insertCallback{insertCallback}
|
||||
Query(QString query_, const std::function<void(RowId)>& insertCallback_)
|
||||
: query{query_.toUtf8()}
|
||||
, insertCallback{insertCallback_}
|
||||
{
|
||||
}
|
||||
Query(QString query, const std::function<void(const QVector<QVariant>&)>& rowCallback)
|
||||
: query{query.toUtf8()}
|
||||
, rowCallback{rowCallback}
|
||||
Query(QString query_, const std::function<void(const QVector<QVariant>&)>& rowCallback_)
|
||||
: query{query_.toUtf8()}
|
||||
, rowCallback{rowCallback_}
|
||||
{
|
||||
}
|
||||
Query() = default;
|
||||
@ -97,7 +97,7 @@ public:
|
||||
p4_0 // SQLCipher 4.0 default encryption params
|
||||
};
|
||||
|
||||
RawDatabase(const QString& path, const QString& password, const QByteArray& salt);
|
||||
RawDatabase(const QString& path_, const QString& password, const QByteArray& salt);
|
||||
~RawDatabase();
|
||||
bool isOpen();
|
||||
|
||||
@ -132,7 +132,7 @@ public slots:
|
||||
bool remove();
|
||||
|
||||
protected slots:
|
||||
bool open(const QString& path, const QString& hexKey = {});
|
||||
bool open(const QString& path_, const QString& hexKey = {});
|
||||
void close();
|
||||
void process();
|
||||
|
||||
|
@ -409,9 +409,9 @@ bool dbSchema7to8(RawDatabase& db)
|
||||
}
|
||||
|
||||
struct BadEntry {
|
||||
BadEntry(int64_t row, QString toxId) :
|
||||
row{row},
|
||||
toxId{toxId} {}
|
||||
BadEntry(int64_t row_, QString toxId_) :
|
||||
row{row_},
|
||||
toxId{toxId_} {}
|
||||
RowId row;
|
||||
QString toxId;
|
||||
};
|
||||
@ -447,9 +447,9 @@ RowId getValidPeerRow(RawDatabase& db, const ToxPk& friendPk)
|
||||
}
|
||||
|
||||
struct DuplicateAlias {
|
||||
DuplicateAlias(RowId goodAliasRow, std::vector<RowId> badAliasRows) :
|
||||
goodAliasRow{goodAliasRow},
|
||||
badAliasRows{badAliasRows} {}
|
||||
DuplicateAlias(RowId goodAliasRow_, std::vector<RowId> badAliasRows_) :
|
||||
goodAliasRow{goodAliasRow_},
|
||||
badAliasRows{badAliasRows_} {}
|
||||
DuplicateAlias() {};
|
||||
RowId goodAliasRow{-1};
|
||||
std::vector<RowId> badAliasRows;
|
||||
|
@ -137,33 +137,33 @@ class History : public QObject, public std::enable_shared_from_this<History>
|
||||
public:
|
||||
struct HistMessage
|
||||
{
|
||||
HistMessage(RowId id, MessageState state, ExtensionSet extensionSet, QDateTime timestamp, QString chat, QString dispName,
|
||||
QString sender, QString message)
|
||||
: chat{chat}
|
||||
, sender{sender}
|
||||
, dispName{dispName}
|
||||
, timestamp{timestamp}
|
||||
, id{id}
|
||||
, state{state}
|
||||
, extensionSet(extensionSet)
|
||||
HistMessage(RowId id_, MessageState state_, ExtensionSet extensionSet_, QDateTime timestamp_, QString chat_, QString dispName_,
|
||||
QString sender_, QString message)
|
||||
: chat{chat_}
|
||||
, sender{sender_}
|
||||
, dispName{dispName_}
|
||||
, timestamp{timestamp_}
|
||||
, id{id_}
|
||||
, state{state_}
|
||||
, extensionSet(extensionSet_)
|
||||
, content(std::move(message))
|
||||
{}
|
||||
|
||||
HistMessage(RowId id, MessageState state, QDateTime timestamp, QString chat, QString dispName,
|
||||
QString sender, ToxFile file)
|
||||
: chat{chat}
|
||||
, sender{sender}
|
||||
, dispName{dispName}
|
||||
, timestamp{timestamp}
|
||||
, id{id}
|
||||
, state{state}
|
||||
HistMessage(RowId id_, MessageState state_, QDateTime timestamp_, QString chat_, QString dispName_,
|
||||
QString sender_, ToxFile file)
|
||||
: chat{chat_}
|
||||
, sender{sender_}
|
||||
, dispName{dispName_}
|
||||
, timestamp{timestamp_}
|
||||
, id{id_}
|
||||
, state{state_}
|
||||
, content(std::move(file))
|
||||
{}
|
||||
|
||||
HistMessage(RowId id, QDateTime timestamp, QString chat, SystemMessage systemMessage)
|
||||
: chat{chat}
|
||||
, timestamp{timestamp}
|
||||
, id{id}
|
||||
HistMessage(RowId id_, QDateTime timestamp_, QString chat_, SystemMessage systemMessage)
|
||||
: chat{chat_}
|
||||
, timestamp{timestamp_}
|
||||
, id{id_}
|
||||
, state(MessageState::complete)
|
||||
, content(std::move(systemMessage))
|
||||
{}
|
||||
|
@ -293,11 +293,11 @@ void Profile::initCore(const QByteArray& toxsave, Settings& s, bool isNewProfile
|
||||
avatarBroadcaster = std::unique_ptr<AvatarBroadcaster>(new AvatarBroadcaster(*core));
|
||||
}
|
||||
|
||||
Profile::Profile(const QString& name, std::unique_ptr<ToxEncrypt> passkey, Paths& paths_, Settings& settings_)
|
||||
: name{name}
|
||||
, passkey{std::move(passkey)}
|
||||
Profile::Profile(const QString& name_, std::unique_ptr<ToxEncrypt> passkey_, Paths& paths_, Settings& settings_)
|
||||
: name{name_}
|
||||
, passkey{std::move(passkey_)}
|
||||
, isRemoved{false}
|
||||
, encrypted{this->passkey != nullptr}
|
||||
, encrypted{passkey != nullptr}
|
||||
, paths{paths_}
|
||||
, settings{settings_}
|
||||
{}
|
||||
@ -713,8 +713,8 @@ void Profile::onRequestSent(const ToxPk& friendPk, const QString& message)
|
||||
const QString inviteStr = Core::tr("/me offers friendship, \"%1\"").arg(message);
|
||||
const ToxPk selfPk = core->getSelfPublicKey();
|
||||
const QDateTime datetime = QDateTime::currentDateTime();
|
||||
const QString name = core->getUsername();
|
||||
history->addNewMessage(friendPk, inviteStr, selfPk, datetime, true, ExtensionSet(), name);
|
||||
const QString selfName = core->getUsername();
|
||||
history->addNewMessage(friendPk, inviteStr, selfPk, datetime, true, ExtensionSet(), selfName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ private slots:
|
||||
void onAvatarOfferReceived(uint32_t friendId, uint32_t fileId, const QByteArray& avatarHash, uint64_t filesize);
|
||||
|
||||
private:
|
||||
Profile(const QString& name, std::unique_ptr<ToxEncrypt> passkey, Paths& paths, Settings &settings_);
|
||||
Profile(const QString& name_, std::unique_ptr<ToxEncrypt> passkey_, Paths& paths_, Settings &settings_);
|
||||
static QStringList getFilesByExt(QString extension);
|
||||
QString avatarPath(const ToxPk& owner, bool forceUnencrypted = false);
|
||||
bool saveToxSave(QByteArray data);
|
||||
|
@ -575,7 +575,7 @@ private:
|
||||
Settings& operator=(const Settings&) = delete;
|
||||
void savePersonal(QString profileName, const ToxEncrypt* passkey);
|
||||
friendProp& getOrInsertFriendPropRef(const ToxPk& id);
|
||||
ICoreSettings::ProxyType fixInvalidProxyType(ICoreSettings::ProxyType proxyType);
|
||||
static ICoreSettings::ProxyType fixInvalidProxyType(ICoreSettings::ProxyType proxyType);
|
||||
|
||||
template <typename T>
|
||||
bool setVal(T& savedVal, T newVal);
|
||||
@ -686,8 +686,8 @@ private:
|
||||
struct friendProp
|
||||
{
|
||||
friendProp() = delete;
|
||||
friendProp(QString addr)
|
||||
: addr(addr)
|
||||
friendProp(QString addr_)
|
||||
: addr(addr_)
|
||||
{}
|
||||
QString alias = "";
|
||||
QString addr = "";
|
||||
|
@ -99,9 +99,9 @@ QDataStream& readStream(QDataStream& dataStream, QByteArray& data)
|
||||
return dataStream;
|
||||
}
|
||||
|
||||
SettingsSerializer::SettingsSerializer(QString filePath, const ToxEncrypt* passKey)
|
||||
: path{filePath}
|
||||
, passKey{passKey}
|
||||
SettingsSerializer::SettingsSerializer(QString filePath_, const ToxEncrypt* passKey_)
|
||||
: path{filePath_}
|
||||
, passKey{passKey_}
|
||||
, group{-1}
|
||||
, array{-1}
|
||||
, arrayIndex{-1}
|
||||
@ -469,9 +469,9 @@ void SettingsSerializer::readIni()
|
||||
a.size = v.value.toInt();
|
||||
} else {
|
||||
a.group = -1;
|
||||
for (int i = 0; i < groups.size(); ++i)
|
||||
if (groups[i] == groups[static_cast<int>(v.group)].left(slashIndex))
|
||||
a.group = i;
|
||||
for (int j = 0; j < groups.size(); ++j)
|
||||
if (groups[j] == groups[static_cast<int>(v.group)].left(slashIndex))
|
||||
a.group = j;
|
||||
a.name = groups[static_cast<int>(v.group)].mid(slashIndex + 1);
|
||||
}
|
||||
groupSizes[static_cast<size_t>(v.group)]--;
|
||||
@ -533,20 +533,20 @@ void SettingsSerializer::readIni()
|
||||
* @note The group must be empty.
|
||||
* @param group ID of group to remove.
|
||||
*/
|
||||
void SettingsSerializer::removeGroup(int group)
|
||||
void SettingsSerializer::removeGroup(int group_)
|
||||
{
|
||||
assert(group < groups.size());
|
||||
assert(group_ < groups.size());
|
||||
for (Array& a : arrays) {
|
||||
assert(a.group != group);
|
||||
if (a.group > group)
|
||||
assert(a.group != group_);
|
||||
if (a.group > group_)
|
||||
a.group--;
|
||||
}
|
||||
for (Value& v : values) {
|
||||
assert(v.group != group);
|
||||
if (v.group > group)
|
||||
assert(v.group != group_);
|
||||
if (v.group > group_)
|
||||
v.group--;
|
||||
}
|
||||
groups.removeAt(group);
|
||||
groups.removeAt(group_);
|
||||
}
|
||||
|
||||
void SettingsSerializer::writePackedVariant(QDataStream& stream, const QVariant& v)
|
||||
|
@ -29,7 +29,7 @@
|
||||
class SettingsSerializer
|
||||
{
|
||||
public:
|
||||
SettingsSerializer(QString filePath, const ToxEncrypt* passKey = nullptr);
|
||||
SettingsSerializer(QString filePath_, const ToxEncrypt* passKey_ = nullptr);
|
||||
|
||||
static bool isSerializedFormat(QString filePath);
|
||||
|
||||
@ -69,12 +69,12 @@ private:
|
||||
, value{}
|
||||
{
|
||||
}
|
||||
Value(qint64 group, qint64 array, int arrayIndex, QString key, QVariant value)
|
||||
: group{group}
|
||||
, array{array}
|
||||
, arrayIndex{arrayIndex}
|
||||
, key{key}
|
||||
, value{value}
|
||||
Value(qint64 group_, qint64 array_, int arrayIndex_, QString key_, QVariant value_)
|
||||
: group{group_}
|
||||
, array{array_}
|
||||
, arrayIndex{arrayIndex_}
|
||||
, key{key_}
|
||||
, value{value_}
|
||||
{
|
||||
}
|
||||
qint64 group;
|
||||
|
@ -77,9 +77,9 @@ QMutex CameraDevice::openDeviceLock, CameraDevice::iformatLock;
|
||||
static AvFindInputFormatRet idesktopFormat{nullptr};
|
||||
static AvFindInputFormatRet iformat{nullptr};
|
||||
|
||||
CameraDevice::CameraDevice(const QString& devName, AVFormatContext* context)
|
||||
: devName{devName}
|
||||
, context{context}
|
||||
CameraDevice::CameraDevice(const QString& devName_, AVFormatContext* context_)
|
||||
: devName{devName_}
|
||||
, context{context_}
|
||||
, refcount{1}
|
||||
{
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
static bool isScreen(const QString& devName);
|
||||
|
||||
private:
|
||||
CameraDevice(const QString& devName, AVFormatContext* context);
|
||||
CameraDevice(const QString& devName_, AVFormatContext* context_);
|
||||
static CameraDevice* open(QString devName, AVDictionary** options);
|
||||
static bool getDefaultInputFormat();
|
||||
static QVector<QPair<QString, QString>> getRawDeviceListGeneric();
|
||||
|
@ -103,7 +103,7 @@ CameraSource::CameraSource()
|
||||
, cctxOrig{nullptr}
|
||||
#endif
|
||||
, videoStreamIndex{-1}
|
||||
, _isNone{true}
|
||||
, isNone_{true}
|
||||
, subscriptions{0}
|
||||
{
|
||||
qRegisterMetaType<VideoMode>("VideoMode");
|
||||
@ -144,32 +144,32 @@ void CameraSource::destroyInstance()
|
||||
*/
|
||||
void CameraSource::setupDefault()
|
||||
{
|
||||
QString deviceName = CameraDevice::getDefaultDeviceName();
|
||||
bool isScreen = CameraDevice::isScreen(deviceName);
|
||||
VideoMode mode = VideoMode(Settings::getInstance().getScreenRegion());
|
||||
QString deviceName_ = CameraDevice::getDefaultDeviceName();
|
||||
bool isScreen = CameraDevice::isScreen(deviceName_);
|
||||
VideoMode mode_ = VideoMode(Settings::getInstance().getScreenRegion());
|
||||
if (!isScreen) {
|
||||
mode = VideoMode(Settings::getInstance().getCamVideoRes());
|
||||
mode.FPS = Settings::getInstance().getCamVideoFPS();
|
||||
mode_ = VideoMode(Settings::getInstance().getCamVideoRes());
|
||||
mode_.FPS = Settings::getInstance().getCamVideoFPS();
|
||||
}
|
||||
|
||||
setupDevice(deviceName, mode);
|
||||
setupDevice(deviceName_, mode_);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Change the device and mode.
|
||||
* @note If a device is already open, the source will seamlessly switch to the new device.
|
||||
*/
|
||||
void CameraSource::setupDevice(const QString& DeviceName, const VideoMode& Mode)
|
||||
void CameraSource::setupDevice(const QString& deviceName_, const VideoMode& mode_)
|
||||
{
|
||||
if (QThread::currentThread() != deviceThread) {
|
||||
QMetaObject::invokeMethod(this, "setupDevice", Q_ARG(const QString&, DeviceName),
|
||||
Q_ARG(const VideoMode&, Mode));
|
||||
QMetaObject::invokeMethod(this, "setupDevice", Q_ARG(const QString&, deviceName_),
|
||||
Q_ARG(const VideoMode&, mode_));
|
||||
return;
|
||||
}
|
||||
|
||||
QWriteLocker locker{&deviceMutex};
|
||||
|
||||
if (DeviceName == deviceName && Mode == mode) {
|
||||
if (deviceName_ == deviceName && mode_ == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -181,18 +181,18 @@ void CameraSource::setupDevice(const QString& DeviceName, const VideoMode& Mode)
|
||||
subscriptions = subs;
|
||||
}
|
||||
|
||||
deviceName = DeviceName;
|
||||
mode = Mode;
|
||||
_isNone = (deviceName == "none");
|
||||
deviceName = deviceName_;
|
||||
mode = mode_;
|
||||
isNone_ = (deviceName == "none");
|
||||
|
||||
if (subscriptions && !_isNone) {
|
||||
if (subscriptions && !isNone_) {
|
||||
openDevice();
|
||||
}
|
||||
}
|
||||
|
||||
bool CameraSource::isNone() const
|
||||
{
|
||||
return _isNone;
|
||||
return isNone_;
|
||||
}
|
||||
|
||||
CameraSource::~CameraSource()
|
||||
@ -205,7 +205,7 @@ CameraSource::~CameraSource()
|
||||
deviceThread->wait();
|
||||
delete deviceThread;
|
||||
|
||||
if (_isNone) {
|
||||
if (isNone_) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
void unsubscribe() override;
|
||||
|
||||
public slots:
|
||||
void setupDevice(const QString& deviceName, const VideoMode& mode);
|
||||
void setupDevice(const QString& deviceName_, const VideoMode& mode_);
|
||||
|
||||
signals:
|
||||
void deviceOpened();
|
||||
@ -76,7 +76,7 @@ private:
|
||||
QReadWriteLock deviceMutex;
|
||||
QReadWriteLock streamMutex;
|
||||
|
||||
std::atomic_bool _isNone;
|
||||
std::atomic_bool isNone_;
|
||||
std::atomic_int subscriptions;
|
||||
|
||||
static CameraSource* instance;
|
||||
|
@ -47,9 +47,9 @@ const int BTN_PANEL_WIDTH = 250;
|
||||
const auto BTN_STYLE_SHEET_PATH = QStringLiteral("chatForm/fullScreenButtons.css");
|
||||
}
|
||||
|
||||
NetCamView::NetCamView(ToxPk friendPk, QWidget* parent)
|
||||
NetCamView::NetCamView(ToxPk friendPk_, QWidget* parent)
|
||||
: selfFrame{nullptr}
|
||||
, friendPk{friendPk}
|
||||
, friendPk{friendPk_}
|
||||
, e(false)
|
||||
{
|
||||
verLayout = new QVBoxLayout(this);
|
||||
@ -148,8 +148,8 @@ NetCamView::NetCamView(ToxPk friendPk, QWidget* parent)
|
||||
[this](const QPixmap& pixmap) { selfVideoSurface->setAvatar(pixmap); });
|
||||
|
||||
connections += connect(Nexus::getProfile(), &Profile::friendAvatarChanged,
|
||||
[this](ToxPk friendPk, const QPixmap& pixmap) {
|
||||
if (this->friendPk == friendPk)
|
||||
[this](ToxPk friendPkArg, const QPixmap& pixmap) {
|
||||
if (friendPk == friendPkArg)
|
||||
videoSurface->setAvatar(pixmap);
|
||||
});
|
||||
|
||||
@ -257,7 +257,7 @@ void NetCamView::enterFullScreen()
|
||||
enterFullScreenButton->hide();
|
||||
toggleMessagesButton->hide();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
const auto screenSize = QGuiApplication::screenAt(this->pos())->geometry();
|
||||
const auto screenSize = QGuiApplication::screenAt(pos())->geometry();
|
||||
#else
|
||||
const QRect screenSize = QApplication::desktop()->screenGeometry(this);
|
||||
#endif
|
||||
|
@ -40,7 +40,7 @@ class NetCamView : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NetCamView(ToxPk friendPk, QWidget* parent = nullptr);
|
||||
NetCamView(ToxPk friendPk_, QWidget* parent = nullptr);
|
||||
~NetCamView();
|
||||
|
||||
virtual void show(VideoSource* source, const QString& title);
|
||||
|
@ -90,13 +90,13 @@ QReadWriteLock VideoFrame::refsLock{};
|
||||
* @param pixFmt the pixel format of the AVFrame, obtained from the AVFrame if not given.
|
||||
* @param freeSourceFrame whether to free the source frame buffers or not.
|
||||
*/
|
||||
VideoFrame::VideoFrame(IDType sourceID, AVFrame* sourceFrame, QRect dimensions, int pixFmt,
|
||||
bool freeSourceFrame)
|
||||
VideoFrame::VideoFrame(IDType sourceID_, AVFrame* sourceFrame, QRect dimensions, int pixFmt,
|
||||
bool freeSourceFrame_)
|
||||
: frameID(frameIDs++)
|
||||
, sourceID(sourceID)
|
||||
, sourceID(sourceID_)
|
||||
, sourceDimensions(dimensions)
|
||||
, sourceFrameKey(getFrameKey(dimensions.size(), pixFmt, sourceFrame->linesize[0]))
|
||||
, freeSourceFrame(freeSourceFrame)
|
||||
, freeSourceFrame(freeSourceFrame_)
|
||||
{
|
||||
|
||||
// We override the pixel format in the case a deprecated one is used
|
||||
@ -140,9 +140,9 @@ VideoFrame::VideoFrame(IDType sourceID, AVFrame* sourceFrame, QRect dimensions,
|
||||
frameBuffer[sourceFrameKey] = sourceFrame;
|
||||
}
|
||||
|
||||
VideoFrame::VideoFrame(IDType sourceID, AVFrame* sourceFrame, bool freeSourceFrame)
|
||||
: VideoFrame(sourceID, sourceFrame, QRect{0, 0, sourceFrame->width, sourceFrame->height},
|
||||
sourceFrame->format, freeSourceFrame)
|
||||
VideoFrame::VideoFrame(IDType sourceID_, AVFrame* sourceFrame, bool freeSourceFrame_)
|
||||
: VideoFrame(sourceID_, sourceFrame, QRect{0, 0, sourceFrame->width, sourceFrame->height},
|
||||
sourceFrame->format, freeSourceFrame_)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,9 @@ public:
|
||||
using AtomicIDType = std::atomic_uint_fast64_t;
|
||||
|
||||
public:
|
||||
VideoFrame(IDType sourceID, AVFrame* sourceFrame, QRect dimensions, int pixFmt,
|
||||
bool freeSourceFrame = false);
|
||||
VideoFrame(IDType sourceID, AVFrame* sourceFrame, bool freeSourceFrame = false);
|
||||
VideoFrame(IDType sourceID_, AVFrame* sourceFrame, QRect dimensions, int pixFmt,
|
||||
bool freeSourceFrame_ = false);
|
||||
VideoFrame(IDType sourceID_, AVFrame* sourceFrame, bool freeSourceFrame_ = false);
|
||||
|
||||
~VideoFrame();
|
||||
|
||||
|
@ -34,12 +34,12 @@
|
||||
* @note a value < 0 indicates an invalid value
|
||||
*/
|
||||
|
||||
VideoMode::VideoMode(int width, int height, int x, int y, float FPS)
|
||||
: width(width)
|
||||
, height(height)
|
||||
, x(x)
|
||||
, y(y)
|
||||
, FPS(FPS)
|
||||
VideoMode::VideoMode(int width_, int height_, int x_, int y_, float FPS_)
|
||||
: width(width_)
|
||||
, height(height_)
|
||||
, x(x_)
|
||||
, y(y_)
|
||||
, FPS(FPS_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ bool VideoMode::operator==(const VideoMode& other) const
|
||||
|
||||
uint32_t VideoMode::norm(const VideoMode& other) const
|
||||
{
|
||||
return qAbs(this->width - other.width) + qAbs(this->height - other.height);
|
||||
return qAbs(width - other.width) + qAbs(height - other.height);
|
||||
}
|
||||
|
||||
uint32_t VideoMode::tolerance() const
|
||||
|
@ -40,22 +40,22 @@ float getSizeRatio(const QSize size)
|
||||
return size.width() / static_cast<float>(size.height());
|
||||
}
|
||||
|
||||
VideoSurface::VideoSurface(const QPixmap& avatar, QWidget* parent, bool expanding)
|
||||
VideoSurface::VideoSurface(const QPixmap& avatar_, QWidget* parent, bool expanding_)
|
||||
: QWidget{parent}
|
||||
, source{nullptr}
|
||||
, frameLock{false}
|
||||
, hasSubscribed{0}
|
||||
, avatar{avatar}
|
||||
, avatar{avatar_}
|
||||
, ratio{1.0f}
|
||||
, expanding{expanding}
|
||||
, expanding{expanding_}
|
||||
{
|
||||
recalulateBounds();
|
||||
}
|
||||
|
||||
VideoSurface::VideoSurface(const QPixmap& avatar, VideoSource* source, QWidget* parent)
|
||||
: VideoSurface(avatar, parent)
|
||||
VideoSurface::VideoSurface(const QPixmap& avatar_, VideoSource* source_, QWidget* parent)
|
||||
: VideoSurface(avatar_, parent)
|
||||
{
|
||||
setSource(source);
|
||||
setSource(source_);
|
||||
}
|
||||
|
||||
VideoSurface::~VideoSurface()
|
||||
|
@ -29,8 +29,8 @@ class VideoSurface : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VideoSurface(const QPixmap& avatar, QWidget* parent = nullptr, bool expanding = false);
|
||||
VideoSurface(const QPixmap& avatar, VideoSource* source, QWidget* parent = nullptr);
|
||||
VideoSurface(const QPixmap& avatar_, QWidget* parent = nullptr, bool expanding_ = false);
|
||||
VideoSurface(const QPixmap& avatar_, VideoSource* source_, QWidget* parent = nullptr);
|
||||
~VideoSurface();
|
||||
|
||||
bool isExpanding() const;
|
||||
|
@ -38,8 +38,8 @@ void CategoryWidget::emitChatroomWidget(QLayout* layout, int index)
|
||||
}
|
||||
}
|
||||
|
||||
CategoryWidget::CategoryWidget(bool compact, QWidget* parent)
|
||||
: GenericChatItemWidget(compact, parent)
|
||||
CategoryWidget::CategoryWidget(bool compact_, QWidget* parent)
|
||||
: GenericChatItemWidget(compact_, parent)
|
||||
{
|
||||
container = new QWidget(this);
|
||||
container->setObjectName("circleWidgetContainer");
|
||||
|
@ -33,7 +33,7 @@ class CategoryWidget : public GenericChatItemWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CategoryWidget(bool compact, QWidget* parent = nullptr);
|
||||
explicit CategoryWidget(bool compact_, QWidget* parent = nullptr);
|
||||
|
||||
bool isExpanded() const;
|
||||
void setExpanded(bool isExpanded, bool save = true);
|
||||
|
@ -179,9 +179,9 @@ void ChatFormHeader::setName(const QString& newName)
|
||||
nameLabel->setToolTip(Qt::convertFromPlainText(newName, Qt::WhiteSpaceNormal));
|
||||
}
|
||||
|
||||
void ChatFormHeader::setMode(ChatFormHeader::Mode mode)
|
||||
void ChatFormHeader::setMode(ChatFormHeader::Mode mode_)
|
||||
{
|
||||
this->mode = mode;
|
||||
mode = mode_;
|
||||
if (mode == Mode::None) {
|
||||
callButton->hide();
|
||||
videoButton->hide();
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
~ChatFormHeader();
|
||||
|
||||
void setName(const QString& newName);
|
||||
void setMode(Mode mode);
|
||||
void setMode(Mode mode_);
|
||||
|
||||
void showOutgoingCall(bool video);
|
||||
void createCallConfirm(bool video);
|
||||
|
@ -40,10 +40,10 @@
|
||||
|
||||
QHash<int, CircleWidget*> CircleWidget::circleList;
|
||||
|
||||
CircleWidget::CircleWidget(const Core &_core, FriendListWidget* parent, int id)
|
||||
CircleWidget::CircleWidget(const Core &core_, FriendListWidget* parent, int id_)
|
||||
: CategoryWidget(isCompact(), parent)
|
||||
, id(id)
|
||||
, core{_core}
|
||||
, id(id_)
|
||||
, core{core_}
|
||||
{
|
||||
setName(Settings::getInstance().getCircleName(id), false);
|
||||
circleList[id] = this;
|
||||
|
@ -28,7 +28,7 @@ class CircleWidget final : public CategoryWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CircleWidget(const Core& _core, FriendListWidget* parent, int id);
|
||||
explicit CircleWidget(const Core& core_, FriendListWidget* parent, int id_);
|
||||
~CircleWidget();
|
||||
|
||||
void editName();
|
||||
|
@ -356,8 +356,8 @@ void ContentDialog::onVideoShow(QSize size)
|
||||
}
|
||||
|
||||
videoSurfaceSize = size;
|
||||
QSize minSize = minimumSize();
|
||||
setMinimumSize(minSize + videoSurfaceSize);
|
||||
QSize minSize_ = minimumSize();
|
||||
setMinimumSize(minSize_ + videoSurfaceSize);
|
||||
}
|
||||
|
||||
void ContentDialog::onVideoHide()
|
||||
@ -367,8 +367,8 @@ void ContentDialog::onVideoHide()
|
||||
return;
|
||||
}
|
||||
|
||||
QSize minSize = minimumSize();
|
||||
setMinimumSize(minSize - videoSurfaceSize);
|
||||
QSize minSize_ = minimumSize();
|
||||
setMinimumSize(minSize_ - videoSurfaceSize);
|
||||
videoSurfaceSize = QSize();
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ void EmoticonsWidget::wheelEvent(QWheelEvent* e)
|
||||
|
||||
void EmoticonsWidget::PageButtonsUpdate()
|
||||
{
|
||||
QList<QRadioButton*> pageButtons = this->findChildren<QRadioButton*>(QString());
|
||||
QList<QRadioButton*> pageButtons = findChildren<QRadioButton*>(QString());
|
||||
foreach (QRadioButton* t_pageButton, pageButtons) {
|
||||
if (t_pageButton->property("pageIndex").toInt() == stack.currentIndex())
|
||||
t_pageButton->setChecked(true);
|
||||
|
@ -179,13 +179,13 @@ int FlowLayout::doLayout(const QRect& rect, bool testOnly) const
|
||||
}
|
||||
int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
|
||||
{
|
||||
QObject* parent = this->parent();
|
||||
if (!parent) {
|
||||
QObject* parent_ = parent();
|
||||
if (!parent_) {
|
||||
return -1;
|
||||
} else if (parent->isWidgetType()) {
|
||||
QWidget* pw = static_cast<QWidget*>(parent);
|
||||
} else if (parent_->isWidgetType()) {
|
||||
QWidget* pw = static_cast<QWidget*>(parent_);
|
||||
return pw->style()->pixelMetric(pm, nullptr, pw);
|
||||
} else {
|
||||
return static_cast<QLayout*>(parent)->spacing();
|
||||
return static_cast<QLayout*>(parent_)->spacing();
|
||||
}
|
||||
}
|
||||
|
@ -178,10 +178,10 @@ void AddFriendForm::setMode(Mode mode)
|
||||
tabWidget->setCurrentIndex(mode);
|
||||
}
|
||||
|
||||
bool AddFriendForm::addFriendRequest(const QString& friendAddress, const QString& message)
|
||||
bool AddFriendForm::addFriendRequest(const QString& friendAddress, const QString& message_)
|
||||
{
|
||||
if (Settings::getInstance().addFriendRequest(friendAddress, message)) {
|
||||
addFriendRequestWidget(friendAddress, message);
|
||||
if (Settings::getInstance().addFriendRequest(friendAddress, message_)) {
|
||||
addFriendRequestWidget(friendAddress, message_);
|
||||
if (isShown()) {
|
||||
onCurrentChanged(tabWidget->currentIndex());
|
||||
}
|
||||
@ -222,8 +222,8 @@ void AddFriendForm::onSendTriggered()
|
||||
const QString id = getToxId(toxId.text());
|
||||
addFriend(id);
|
||||
|
||||
this->toxId.clear();
|
||||
this->message.clear();
|
||||
toxId.clear();
|
||||
message.clear();
|
||||
}
|
||||
|
||||
void AddFriendForm::onImportSendClicked()
|
||||
@ -309,12 +309,12 @@ void AddFriendForm::setIdFromClipboard()
|
||||
}
|
||||
}
|
||||
|
||||
void AddFriendForm::deleteFriendRequest(const ToxId& toxId)
|
||||
void AddFriendForm::deleteFriendRequest(const ToxId& toxId_)
|
||||
{
|
||||
const int size = Settings::getInstance().getFriendRequestSize();
|
||||
for (int i = 0; i < size; ++i) {
|
||||
Settings::Request request = Settings::getInstance().getFriendRequest(i);
|
||||
if (toxId.getPublicKey() == ToxPk(request.address)) {
|
||||
if (toxId_.getPublicKey() == ToxPk(request.address)) {
|
||||
Settings::getInstance().removeFriendRequest(i);
|
||||
return;
|
||||
}
|
||||
@ -390,7 +390,7 @@ void AddFriendForm::retranslateUi()
|
||||
}
|
||||
}
|
||||
|
||||
void AddFriendForm::addFriendRequestWidget(const QString& friendAddress, const QString& message)
|
||||
void AddFriendForm::addFriendRequestWidget(const QString& friendAddress_, const QString& message_)
|
||||
{
|
||||
QWidget* friendWidget = new QWidget(tabWidget);
|
||||
QHBoxLayout* friendLayout = new QHBoxLayout(friendWidget);
|
||||
@ -400,15 +400,15 @@ void AddFriendForm::addFriendRequestWidget(const QString& friendAddress, const Q
|
||||
|
||||
CroppingLabel* friendLabel = new CroppingLabel(friendWidget);
|
||||
friendLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
friendLabel->setText("<b>" + friendAddress + "</b>");
|
||||
friendLabel->setText("<b>" + friendAddress_ + "</b>");
|
||||
horLayout->addWidget(friendLabel);
|
||||
|
||||
QLabel* messageLabel = new QLabel(message);
|
||||
QLabel* messageLabel_ = new QLabel(message_);
|
||||
// allow to select text, but treat links as plaintext to prevent phishing
|
||||
messageLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
messageLabel->setTextFormat(Qt::PlainText);
|
||||
messageLabel->setWordWrap(true);
|
||||
horLayout->addWidget(messageLabel, 1);
|
||||
messageLabel_->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
messageLabel_->setTextFormat(Qt::PlainText);
|
||||
messageLabel_->setWordWrap(true);
|
||||
horLayout->addWidget(messageLabel_, 1);
|
||||
|
||||
QPushButton* acceptButton = new QPushButton(friendWidget);
|
||||
acceptButtons.append(acceptButton);
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
void show(ContentLayout* contentLayout);
|
||||
void setMode(Mode mode);
|
||||
|
||||
bool addFriendRequest(const QString& friendAddress, const QString& message);
|
||||
bool addFriendRequest(const QString& friendAddress, const QString& message_);
|
||||
|
||||
signals:
|
||||
void friendRequested(const ToxId& friendAddress, const QString& message);
|
||||
@ -76,11 +76,11 @@ private slots:
|
||||
private:
|
||||
void addFriend(const QString& idText);
|
||||
void retranslateUi();
|
||||
void addFriendRequestWidget(const QString& friendAddress, const QString& message);
|
||||
void addFriendRequestWidget(const QString& friendAddress_, const QString& message_);
|
||||
void removeFriendRequestWidget(QWidget* friendWidget);
|
||||
void retranslateAcceptButton(QPushButton* acceptButton);
|
||||
void retranslateRejectButton(QPushButton* rejectButton);
|
||||
void deleteFriendRequest(const ToxId& toxId);
|
||||
void deleteFriendRequest(const ToxId& toxId_);
|
||||
void setIdFromClipboard();
|
||||
QString getMessage() const;
|
||||
QString getImportMessage() const;
|
||||
|
@ -105,8 +105,8 @@ QString secondsToDHMS(quint32 duration)
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ChatForm::ChatForm(Profile& profile, Friend* chatFriend, IChatLog& chatLog, IMessageDispatcher& messageDispatcher)
|
||||
: GenericChatForm(profile.getCore(), chatFriend, chatLog, messageDispatcher)
|
||||
ChatForm::ChatForm(Profile& profile, Friend* chatFriend, IChatLog& chatLog_, IMessageDispatcher& messageDispatcher_)
|
||||
: GenericChatForm(profile.getCore(), chatFriend, chatLog_, messageDispatcher_)
|
||||
, core{profile.getCore()}
|
||||
, f(chatFriend)
|
||||
, isTyping{false}
|
||||
@ -182,8 +182,8 @@ ChatForm::ChatForm(Profile& profile, Friend* chatFriend, IChatLog& chatLog, IMes
|
||||
connect(statusMessageLabel, &CroppingLabel::customContextMenuRequested, this,
|
||||
[&](const QPoint& pos) {
|
||||
if (!statusMessageLabel->text().isEmpty()) {
|
||||
QWidget* sender = static_cast<QWidget*>(this->sender());
|
||||
statusMessageMenu.exec(sender->mapToGlobal(pos));
|
||||
QWidget* sender_ = static_cast<QWidget*>(sender());
|
||||
statusMessageMenu.exec(sender_->mapToGlobal(pos));
|
||||
}
|
||||
});
|
||||
|
||||
@ -319,7 +319,6 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
|
||||
auto testedFlag = video ? Settings::AutoAcceptCall::Video : Settings::AutoAcceptCall::Audio;
|
||||
// AutoAcceptCall is set for this friend
|
||||
if (Settings::getInstance().getAutoAcceptCall(f->getPublicKey()).testFlag(testedFlag)) {
|
||||
uint32_t friendId = f->getId();
|
||||
qDebug() << "automatic call answer";
|
||||
CoreAV* coreav = core.getAv();
|
||||
QMetaObject::invokeMethod(coreav, "answerCall", Qt::QueuedConnection,
|
||||
@ -472,10 +471,10 @@ void ChatForm::onFriendStatusChanged(const ToxPk& friendPk, Status::Status statu
|
||||
}
|
||||
}
|
||||
|
||||
void ChatForm::onFriendTypingChanged(quint32 friendId, bool isTyping)
|
||||
void ChatForm::onFriendTypingChanged(quint32 friendId, bool isTyping_)
|
||||
{
|
||||
if (friendId == f->getId()) {
|
||||
setFriendTyping(isTyping);
|
||||
setFriendTyping(isTyping_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,16 +700,16 @@ void ChatForm::onUpdateTime()
|
||||
callDuration->setText(secondsToDHMS(timeElapsed.elapsed() / 1000));
|
||||
}
|
||||
|
||||
void ChatForm::setFriendTyping(bool isTyping)
|
||||
void ChatForm::setFriendTyping(bool isTyping_)
|
||||
{
|
||||
chatWidget->setTypingNotificationVisible(isTyping);
|
||||
chatWidget->setTypingNotificationVisible(isTyping_);
|
||||
QString name = f->getDisplayedName();
|
||||
chatWidget->setTypingNotificationName(name);
|
||||
}
|
||||
|
||||
void ChatForm::show(ContentLayout* contentLayout)
|
||||
void ChatForm::show(ContentLayout* contentLayout_)
|
||||
{
|
||||
GenericChatForm::show(contentLayout);
|
||||
GenericChatForm::show(contentLayout_);
|
||||
}
|
||||
|
||||
void ChatForm::reloadTheme()
|
||||
|
@ -47,13 +47,13 @@ class ChatForm : public GenericChatForm
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChatForm(Profile& profile, Friend* chatFriend, IChatLog& chatLog, IMessageDispatcher& messageDispatcher);
|
||||
ChatForm(Profile& profile, Friend* chatFriend, IChatLog& chatLog_, IMessageDispatcher& messageDispatcher_);
|
||||
~ChatForm() override;
|
||||
void setStatusMessage(const QString& newMessage);
|
||||
|
||||
void setFriendTyping(bool isTyping);
|
||||
void setFriendTyping(bool isTyping_);
|
||||
|
||||
void show(ContentLayout* contentLayout) final;
|
||||
void show(ContentLayout* contentLayout_) final;
|
||||
|
||||
static const QString ACTION_PREFIX;
|
||||
|
||||
@ -93,7 +93,7 @@ private slots:
|
||||
void onVolMuteToggle();
|
||||
|
||||
void onFriendStatusChanged(const ToxPk& friendPk, Status::Status status);
|
||||
void onFriendTypingChanged(quint32 friendId, bool isTyping);
|
||||
void onFriendTypingChanged(quint32 friendId, bool isTyping_);
|
||||
void onFriendNameChanged(const QString& name);
|
||||
void onStatusMessage(const QString& message);
|
||||
void onUpdateTime();
|
||||
|
@ -134,20 +134,20 @@ QPushButton* createButton(const QString& name, T* self, Fun onClickSlot)
|
||||
|
||||
} // namespace
|
||||
|
||||
GenericChatForm::GenericChatForm(const Core& _core, const Contact* contact, IChatLog& chatLog,
|
||||
IMessageDispatcher& messageDispatcher, QWidget* parent)
|
||||
: QWidget(parent, Qt::Window)
|
||||
, core{_core}
|
||||
GenericChatForm::GenericChatForm(const Core& core_, const Contact* contact, IChatLog& chatLog_,
|
||||
IMessageDispatcher& messageDispatcher_, QWidget* parent_)
|
||||
: QWidget(parent_, Qt::Window)
|
||||
, core{core_}
|
||||
, audioInputFlag(false)
|
||||
, audioOutputFlag(false)
|
||||
, chatLog(chatLog)
|
||||
, messageDispatcher(messageDispatcher)
|
||||
, chatLog(chatLog_)
|
||||
, messageDispatcher(messageDispatcher_)
|
||||
{
|
||||
curRow = 0;
|
||||
headWidget = new ChatFormHeader();
|
||||
searchForm = new SearchForm();
|
||||
dateInfo = new QLabel(this);
|
||||
chatWidget = new ChatWidget(chatLog, core, this);
|
||||
chatWidget = new ChatWidget(chatLog_, core, this);
|
||||
searchForm->hide();
|
||||
dateInfo->setAlignment(Qt::AlignHCenter);
|
||||
dateInfo->setVisible(false);
|
||||
@ -363,9 +363,9 @@ void GenericChatForm::setName(const QString& newName)
|
||||
headWidget->setName(newName);
|
||||
}
|
||||
|
||||
void GenericChatForm::show(ContentLayout* contentLayout)
|
||||
void GenericChatForm::show(ContentLayout* contentLayout_)
|
||||
{
|
||||
contentLayout->mainHead->layout()->addWidget(headWidget);
|
||||
contentLayout_->mainHead->layout()->addWidget(headWidget);
|
||||
headWidget->show();
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 4) && QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
|
||||
@ -375,7 +375,7 @@ void GenericChatForm::show(ContentLayout* contentLayout)
|
||||
QWidget::show();
|
||||
contentLayout->mainContent->layout()->addWidget(this);
|
||||
#else
|
||||
contentLayout->mainContent->layout()->addWidget(this);
|
||||
contentLayout_->mainContent->layout()->addWidget(this);
|
||||
QWidget::show();
|
||||
#endif
|
||||
}
|
||||
@ -575,7 +575,7 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (object != this->fileButton && object != this->fileFlyout)
|
||||
if (object != fileButton && object != fileFlyout)
|
||||
return false;
|
||||
|
||||
if (!qobject_cast<QWidget*>(object)->isEnabled())
|
||||
|
@ -68,12 +68,12 @@ class GenericChatForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GenericChatForm(const Core& _core, const Contact* contact, IChatLog& chatLog,
|
||||
IMessageDispatcher& messageDispatcher, QWidget* parent = nullptr);
|
||||
GenericChatForm(const Core& core_, const Contact* contact, IChatLog& chatLog_,
|
||||
IMessageDispatcher& messageDispatcher_, QWidget* parent_ = nullptr);
|
||||
~GenericChatForm() override;
|
||||
|
||||
void setName(const QString& newName);
|
||||
virtual void show(ContentLayout* contentLayout);
|
||||
virtual void show(ContentLayout* contentLayout_);
|
||||
|
||||
void addSystemInfoMessage(const QDateTime& datetime, SystemMessageType messageType,
|
||||
SystemMessage::Args messageArgs);
|
||||
|
@ -82,12 +82,12 @@ QString editName(const QString& name)
|
||||
* @brief Timeout = peer stopped sending audio.
|
||||
*/
|
||||
|
||||
GroupChatForm::GroupChatForm(Core& _core, Group* chatGroup, IChatLog& chatLog, IMessageDispatcher& messageDispatcher, IGroupSettings& _settings)
|
||||
: GenericChatForm(_core, chatGroup, chatLog, messageDispatcher)
|
||||
, core{_core}
|
||||
GroupChatForm::GroupChatForm(Core& core_, Group* chatGroup, IChatLog& chatLog_, IMessageDispatcher& messageDispatcher_, IGroupSettings& settings_)
|
||||
: GenericChatForm(core_, chatGroup, chatLog_, messageDispatcher_)
|
||||
, core{core_}
|
||||
, group(chatGroup)
|
||||
, inCall(false)
|
||||
, settings(_settings)
|
||||
, settings(settings_)
|
||||
{
|
||||
nusersLabel = new QLabel();
|
||||
|
||||
@ -131,7 +131,7 @@ GroupChatForm::GroupChatForm(Core& _core, Group* chatGroup, IChatLog& chatLog, I
|
||||
connect(group, &Group::userLeft, this, &GroupChatForm::onUserLeft);
|
||||
connect(group, &Group::peerNameChanged, this, &GroupChatForm::onPeerNameChanged);
|
||||
connect(group, &Group::numPeersChanged, this, &GroupChatForm::updateUserCount);
|
||||
settings.connectTo_blackListChanged(this, [this](QStringList const&) { this->updateUserNames(); });
|
||||
settings.connectTo_blackListChanged(this, [this](QStringList const&) { updateUserNames(); });
|
||||
|
||||
if (settings.getShowGroupJoinLeaveMessages()) {
|
||||
addSystemInfoMessage(QDateTime::currentDateTime(), SystemMessageType::selfJoinedGroup, {});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user