mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
remove unused code, removed unused checks
This commit is contained in:
parent
884547cd34
commit
d875221e53
8
qtox.pro
8
qtox.pro
|
@ -358,13 +358,13 @@ contains(ENABLE_SYSTRAY_GTK_BACKEND, NO) {
|
|||
src/widget/form/loadhistorydialog.h \
|
||||
src/widget/form/setpassworddialog.h \
|
||||
src/widget/form/tabcompleter.h \
|
||||
src/ipc.h \
|
||||
src/net/autoupdate.h \
|
||||
src/widget/tool/callconfirmwidget.h \
|
||||
src/widget/systemtrayicon.h \
|
||||
src/widget/qrwidget.h \
|
||||
src/widget/systemtrayicon_private.h \
|
||||
src/widget/loginscreen.h
|
||||
src/widget/loginscreen.h \
|
||||
src/ipc.h
|
||||
|
||||
SOURCES += \
|
||||
src/widget/form/addfriendform.cpp \
|
||||
|
@ -383,7 +383,6 @@ contains(ENABLE_SYSTRAY_GTK_BACKEND, NO) {
|
|||
src/widget/form/loadhistorydialog.cpp \
|
||||
src/widget/form/setpassworddialog.cpp \
|
||||
src/widget/form/tabcompleter.cpp \
|
||||
src/ipc.cpp \
|
||||
src/widget/flowlayout.cpp \
|
||||
src/net/autoupdate.cpp \
|
||||
src/widget/tool/callconfirmwidget.cpp \
|
||||
|
@ -426,7 +425,8 @@ contains(ENABLE_SYSTRAY_GTK_BACKEND, NO) {
|
|||
src/persistence/offlinemsgengine.cpp \
|
||||
src/widget/qrwidget.cpp \
|
||||
src/widget/genericchatroomwidget.cpp \
|
||||
src/widget/loginscreen.cpp
|
||||
src/widget/loginscreen.cpp \
|
||||
src/ipc.cpp
|
||||
}
|
||||
|
||||
win32 {
|
||||
|
|
|
@ -295,12 +295,12 @@ void Audio::playGroupAudio(int group, int peer, const int16_t* data,
|
|||
alSourcef(call.alSources[peer], AL_GAIN, outputVolume);
|
||||
}
|
||||
|
||||
size_t volume = 0;//data[1];
|
||||
qreal volume = 0.;
|
||||
int bufsize = samples * 2 * channels;
|
||||
for (int i = 0; i < bufsize; ++i)
|
||||
volume += abs(data[i]);//std::max(volume, data[i]);
|
||||
|
||||
emit groupAudioPlayed(group, peer, volume / static_cast<float>(bufsize));
|
||||
emit groupAudioPlayed(group, peer, volume / bufsize);
|
||||
|
||||
playAudioBuffer(call.alSources[peer], data, samples, channels, sample_rate);
|
||||
}
|
||||
|
|
|
@ -46,29 +46,6 @@ Group::~Group()
|
|||
widget->deleteLater();
|
||||
}
|
||||
|
||||
/*
|
||||
void Group::addPeer(int peerId, QString name)
|
||||
{
|
||||
if (peers.contains(peerId))
|
||||
qWarning() << "addPeer: peerId already used, overwriting anyway";
|
||||
if (name.isEmpty())
|
||||
peers[peerId] = "<Unknown>";
|
||||
else
|
||||
peers[peerId] = name;
|
||||
nPeers++;
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
}
|
||||
|
||||
void Group::removePeer(int peerId)
|
||||
{
|
||||
peers.remove(peerId);
|
||||
nPeers--;
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
}
|
||||
*/
|
||||
|
||||
void Group::updatePeer(int peerId, QString name)
|
||||
{
|
||||
ToxId id = Core::getInstance()->getGroupPeerToxId(groupId, peerId);
|
||||
|
@ -77,19 +54,13 @@ void Group::updatePeer(int peerId, QString name)
|
|||
toxids[toxid] = name;
|
||||
|
||||
Friend *f = FriendList::findFriend(id);
|
||||
if (f && f->hasAlias())
|
||||
|
||||
// I don't know what this is doing here but it changes back to the old name.
|
||||
/*Friend *f = FriendList::findFriend(id);
|
||||
if (f)
|
||||
if (f != nullptr && f->hasAlias())
|
||||
{
|
||||
peers[peerId] = f->getDisplayedName();
|
||||
toxids[toxid] = f->getDisplayedName();
|
||||
}*/
|
||||
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
emit userListChanged(getGroupWidget());
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
emit userListChanged(getGroupWidget());
|
||||
}
|
||||
}
|
||||
|
||||
void Group::setName(const QString& name)
|
||||
|
|
|
@ -54,11 +54,6 @@ public:
|
|||
void setMentionedFlag(int f);
|
||||
int getMentionedFlag() const;
|
||||
|
||||
/*
|
||||
void addPeer(int peerId, QString name);
|
||||
void removePeer(int peerId);
|
||||
*/
|
||||
|
||||
void updatePeer(int peerId, QString newName);
|
||||
void setName(const QString& name);
|
||||
QString getName() const;
|
||||
|
|
|
@ -40,8 +40,6 @@ CameraSource::CameraSource()
|
|||
biglock{false}, freelistLock{false},
|
||||
isOpen{false}, subscriptions{0}
|
||||
{
|
||||
//qDebug() << "CameraSource()";
|
||||
|
||||
subscriptions = 0;
|
||||
av_register_all();
|
||||
avdevice_register_all();
|
||||
|
@ -75,8 +73,6 @@ void CameraSource::open(const QString deviceName)
|
|||
|
||||
void CameraSource::open(const QString DeviceName, VideoMode Mode)
|
||||
{
|
||||
//qDebug() << "open(const QString DeviceName, VideoMode Mode)";
|
||||
|
||||
{
|
||||
bool expected = false;
|
||||
while (!biglock.compare_exchange_weak(expected, true))
|
||||
|
@ -137,7 +133,7 @@ CameraSource::~CameraSource()
|
|||
if (cctxOrig)
|
||||
avcodec_close(cctxOrig);
|
||||
|
||||
for (int i = subscriptions; i; --i)
|
||||
for(int i = 0; i < subscriptions; i++)
|
||||
device->close();
|
||||
|
||||
device = nullptr;
|
||||
|
@ -152,8 +148,6 @@ CameraSource::~CameraSource()
|
|||
|
||||
bool CameraSource::subscribe()
|
||||
{
|
||||
//qDebug() << "subscribe";
|
||||
|
||||
// Fast lock
|
||||
{
|
||||
bool expected = false;
|
||||
|
@ -164,8 +158,6 @@ bool CameraSource::subscribe()
|
|||
if (!isOpen)
|
||||
{
|
||||
++subscriptions;
|
||||
//qDebug() << "is not open, subscriptions: " << subscriptions;
|
||||
|
||||
biglock = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -173,8 +165,6 @@ bool CameraSource::subscribe()
|
|||
if (openDevice())
|
||||
{
|
||||
++subscriptions;
|
||||
//qDebug() << "open device, subscriptions: " << subscriptions;
|
||||
|
||||
biglock = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -189,13 +179,11 @@ bool CameraSource::subscribe()
|
|||
biglock = false;
|
||||
return false;
|
||||
}
|
||||
//qDebug() << "END subscribe";
|
||||
|
||||
}
|
||||
|
||||
void CameraSource::unsubscribe()
|
||||
{
|
||||
//qDebug() << "unsubscribe";
|
||||
// Fast lock
|
||||
{
|
||||
bool expected = false;
|
||||
|
@ -205,7 +193,6 @@ void CameraSource::unsubscribe()
|
|||
|
||||
if (!isOpen)
|
||||
{
|
||||
//qDebug() << "is not open";
|
||||
subscriptions--;
|
||||
biglock = false;
|
||||
return;
|
||||
|
@ -213,18 +200,14 @@ void CameraSource::unsubscribe()
|
|||
|
||||
if (!device)
|
||||
{
|
||||
//qWarning() << "Unsubscribing with zero subscriber";
|
||||
qWarning() << "Unsubscribing with zero subscriber";
|
||||
biglock = false;
|
||||
return;
|
||||
}
|
||||
//qDebug() << "1. device: " << device;
|
||||
//qDebug() << "2. subscriptions:" << subscriptions;
|
||||
|
||||
if (subscriptions - 1 == 0)
|
||||
{
|
||||
//qDebug() << "first block";
|
||||
closeDevice();
|
||||
|
||||
biglock = false;
|
||||
|
||||
// Synchronize with our stream thread
|
||||
|
@ -233,19 +216,15 @@ void CameraSource::unsubscribe()
|
|||
}
|
||||
else
|
||||
{
|
||||
//qDebug() << "second block";
|
||||
device->close();
|
||||
biglock = false;
|
||||
}
|
||||
subscriptions--;
|
||||
|
||||
//qDebug() << "3. subscriptions: " << subscriptions;
|
||||
}
|
||||
|
||||
bool CameraSource::openDevice()
|
||||
{
|
||||
//qDebug() << "Opening device: " << deviceName;
|
||||
|
||||
if (device)
|
||||
{
|
||||
device->open();
|
||||
|
@ -317,8 +296,6 @@ bool CameraSource::openDevice()
|
|||
|
||||
void CameraSource::closeDevice()
|
||||
{
|
||||
//qDebug() << "Closing device " << deviceName;
|
||||
|
||||
// Free all remaining VideoFrame
|
||||
// Locking must be done precisely this way to avoid races
|
||||
for (int i = 0; i < freelist.size(); i++)
|
||||
|
|
|
@ -38,18 +38,16 @@ public:
|
|||
LabeledVideo(const QPixmap& avatar, QWidget* parent = 0, bool expanding = true)
|
||||
: QFrame(parent)
|
||||
{
|
||||
//setFrameStyle(QFrame::Box);
|
||||
qDebug() << "Created expanding? " << expanding;
|
||||
videoSurface = new VideoSurface(avatar, 0, expanding);
|
||||
videoSurface->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
videoSurface->setMinimumHeight(32);
|
||||
//videoSurface->setMaximumHeight(96);
|
||||
|
||||
connect(videoSurface, &VideoSurface::ratioChanged, this, &LabeledVideo::updateSize);
|
||||
label = new CroppingLabel(this);
|
||||
label->setTextFormat(Qt::PlainText);
|
||||
label->setStyleSheet("color: white");
|
||||
//label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
//qDebug() << label->sizePolicy();
|
||||
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
@ -102,7 +100,6 @@ private slots:
|
|||
int width = videoSurface->height() * videoSurface->getRatio();
|
||||
videoSurface->setMinimumWidth(width);
|
||||
videoSurface->setMaximumWidth(width);
|
||||
//setMaximumWidth(width + layout()->margin() * 2);
|
||||
qDebug() << videoSurface->minimumWidth();
|
||||
}
|
||||
}
|
||||
|
@ -119,15 +116,12 @@ GroupNetCamView::GroupNetCamView(int group, QWidget *parent)
|
|||
{
|
||||
videoLabelSurface = new LabeledVideo(QPixmap(), this, false);
|
||||
videoSurface = videoLabelSurface->getVideoSurface();
|
||||
//videoSurface->setExpanding(false);
|
||||
videoSurface->setMinimumHeight(256);
|
||||
videoSurface->setContentsMargins(6, 6, 6, 0);
|
||||
videoLabelSurface->setContentsMargins(0, 0, 0, 0);
|
||||
videoLabelSurface->layout()->setMargin(0);
|
||||
videoLabelSurface->setStyleSheet("QFrame { background-color: black; }");
|
||||
|
||||
//verLayout->insertWidget(0, videoLabelSurface, 1);
|
||||
|
||||
QSplitter* splitter = new QSplitter(Qt::Vertical, this);
|
||||
splitter->setChildrenCollapsible(false);
|
||||
verLayout->insertWidget(0, splitter, 1);
|
||||
|
@ -145,13 +139,10 @@ GroupNetCamView::GroupNetCamView(int group, QWidget *parent)
|
|||
|
||||
selfVideoSurface = new LabeledVideo(Settings::getInstance().getSavedAvatar(Core::getInstance()->getSelfId().toString()), this);
|
||||
horLayout->addWidget(selfVideoSurface);
|
||||
//horLayout->setAlignment(selfVideoSurface, Qt::AlignCenter | Qt::AlignHCenter);
|
||||
|
||||
horLayout->addStretch(1);
|
||||
splitter->addWidget(scrollArea);
|
||||
scrollArea->setWidget(widget);
|
||||
//verLayout->insertWidget(1, scrollArea);
|
||||
//scrollArea->setMinimumHeight(selfVideoSurface->height());
|
||||
|
||||
connect(&Audio::getInstance(), &Audio::groupAudioPlayed, this, &GroupNetCamView::groupAudioPlayed);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#include <QPainter>
|
||||
#include <QLabel>
|
||||
#include <cassert>
|
||||
#include <QDebug>
|
||||
|
||||
float getSizeRatio(const QSize size)
|
||||
|
@ -99,8 +98,6 @@ QPixmap VideoSurface::getAvatar() const
|
|||
|
||||
void VideoSurface::subscribe()
|
||||
{
|
||||
assert(hasSubscribed >= 0);
|
||||
|
||||
if (source && hasSubscribed++ == 0)
|
||||
{
|
||||
source->subscribe();
|
||||
|
@ -110,8 +107,6 @@ void VideoSurface::subscribe()
|
|||
|
||||
void VideoSurface::unsubscribe()
|
||||
{
|
||||
assert(hasSubscribed >= 0);
|
||||
|
||||
if (!source || hasSubscribed == 0)
|
||||
return;
|
||||
|
||||
|
@ -185,8 +180,9 @@ void VideoSurface::resizeEvent(QResizeEvent* event)
|
|||
emit boundaryChanged();
|
||||
}
|
||||
|
||||
void VideoSurface::showEvent(QShowEvent*)
|
||||
void VideoSurface::showEvent(QShowEvent* e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
//emit ratioChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -119,8 +119,6 @@ ChatForm::ChatForm(Friend* chatFriend)
|
|||
|
||||
retranslateUi();
|
||||
Translator::registerHandler(std::bind(&ChatForm::retranslateUi, this), this);
|
||||
|
||||
//showNetcam();
|
||||
}
|
||||
|
||||
ChatForm::~ChatForm()
|
||||
|
|
|
@ -209,29 +209,6 @@ void AVForm::onVideoDevChanged(int index)
|
|||
createVideoSurface();
|
||||
}
|
||||
|
||||
/*void AVForm::onResProbingFinished(QList<QSize> res)
|
||||
{
|
||||
QSize savedRes = Settings::getInstance().getCamVideoRes();
|
||||
int savedResIndex = -1;
|
||||
bodyUI->videoModescomboBox->clear();
|
||||
bodyUI->videoModescomboBox->blockSignals(true);
|
||||
for (int i=0; i<res.size(); ++i)
|
||||
{
|
||||
QSize& r = res[i];
|
||||
bodyUI->videoModescomboBox->addItem(QString("%1x%2").arg(QString::number(r.width()),QString::number(r.height())), r);
|
||||
if (r == savedRes)
|
||||
savedResIndex = i;
|
||||
}
|
||||
//reset index, otherwise cameras with only one resolution won't get initialized
|
||||
bodyUI->videoModescomboBox->setCurrentIndex(-1);
|
||||
bodyUI->videoModescomboBox->blockSignals(false);
|
||||
|
||||
if (savedResIndex != -1)
|
||||
bodyUI->videoModescomboBox->setCurrentIndex(savedResIndex);
|
||||
else
|
||||
bodyUI->videoModescomboBox->setCurrentIndex(bodyUI->videoModescomboBox->count()-1);
|
||||
}*/
|
||||
|
||||
void AVForm::hideEvent(QHideEvent *)
|
||||
{
|
||||
if (camVideoSurface)
|
||||
|
@ -256,8 +233,6 @@ void AVForm::getVideoDevices()
|
|||
if (device.first == settingsInDev)
|
||||
videoDevIndex = bodyUI->videoDevCombobox->count()-1;
|
||||
}
|
||||
//addItem changes currentIndex -> reset
|
||||
//bodyUI->videoDevCombobox->setCurrentIndex(-1);
|
||||
bodyUI->videoDevCombobox->setCurrentIndex(videoDevIndex);
|
||||
bodyUI->videoDevCombobox->blockSignals(false);
|
||||
updateVideoModes(videoDevIndex);
|
||||
|
|
|
@ -63,7 +63,6 @@ private slots:
|
|||
// camera
|
||||
void onVideoDevChanged(int index);
|
||||
void onVideoModesIndexChanged(int index);
|
||||
//void onResProbingFinished(QList<QSize> res);
|
||||
|
||||
virtual void hideEvent(QHideEvent*) final override;
|
||||
virtual void showEvent(QShowEvent*) final override;
|
||||
|
|
Loading…
Reference in New Issue
Block a user