mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
style: change postfix increment to prefix increment
This commit is contained in:
parent
6ee3b95b6f
commit
64bbc6cfbb
|
@ -308,7 +308,7 @@ void Audio::subscribeInput()
|
|||
return;
|
||||
}
|
||||
|
||||
inSubscriptions++;
|
||||
++inSubscriptions;
|
||||
qDebug() << "Subscribed to audio input device [" << inSubscriptions << "subscriptions ]";
|
||||
}
|
||||
|
||||
|
|
|
@ -865,7 +865,7 @@ void ChatLog::retranslateUi()
|
|||
bool ChatLog::isActiveFileTransfer(ChatLine::Ptr l)
|
||||
{
|
||||
int count = l->getColumnCount();
|
||||
for (int i = 0; i < count; i++)
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
ChatLineContent *content = l->getContent(i);
|
||||
ChatLineContentProxy *proxy = qobject_cast<ChatLineContentProxy*>(content);
|
||||
|
|
|
@ -121,7 +121,7 @@ void FileTransferWidget::autoAcceptTransfer(const QString &path)
|
|||
do
|
||||
{
|
||||
filepath = QString("%1/%2%3.%4").arg(path, base, number > 0 ? QString(" (%1)").arg(QString::number(number)) : QString(), suffix);
|
||||
number++;
|
||||
++number;
|
||||
}
|
||||
while (QFileInfo(filepath).exists());
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ QString Text::extractSanitizedText(int from, int to) const
|
|||
if (pos >= from && pos < to)
|
||||
{
|
||||
txt += rune;
|
||||
pos++;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -350,7 +350,7 @@ QString Text::extractSanitizedText(int from, int to) const
|
|||
if (pos >= from && pos < to)
|
||||
txt += c;
|
||||
|
||||
pos++;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ bool Core::checkConnection()
|
|||
emit disconnected();
|
||||
isConnected = false;
|
||||
//count++;
|
||||
} //else if (!toxConnected) count++;
|
||||
} //else if (!toxConnected) ++count;
|
||||
return isConnected;
|
||||
}
|
||||
|
||||
|
@ -436,8 +436,8 @@ void Core::bootstrapDht()
|
|||
qDebug() << "Error adding TCP relay from "+dhtServer.name;
|
||||
}
|
||||
|
||||
j++;
|
||||
i++;
|
||||
++j;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ QList<QString> Core::getGroupPeerNames(int groupId) const
|
|||
qWarning() << "getGroupPeerNames: Unexpected tox_group_get_names result";
|
||||
return names;
|
||||
}
|
||||
for (uint16_t i=0; i<nPeers; i++)
|
||||
for (uint16_t i=0; i<nPeers; ++i)
|
||||
names.push_back(CString::toString(namesArray[i], lengths[i]));
|
||||
|
||||
return names;
|
||||
|
|
|
@ -323,7 +323,7 @@ bool CoreAV::sendCallAudio(uint32_t callId, const int16_t *pcm, size_t samples,
|
|||
{
|
||||
if (err == TOXAV_ERR_SEND_FRAME_SYNC)
|
||||
{
|
||||
retries++;
|
||||
++retries;
|
||||
QThread::usleep(500);
|
||||
}
|
||||
else
|
||||
|
@ -375,7 +375,7 @@ void CoreAV::sendCallVideo(uint32_t callId, std::shared_ptr<VideoFrame> vframe)
|
|||
{
|
||||
if (err == TOXAV_ERR_SEND_FRAME_SYNC)
|
||||
{
|
||||
retries++;
|
||||
++retries;
|
||||
QThread::usleep(500);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -87,7 +87,7 @@ void Group::regeneratePeerList()
|
|||
peers = Core::getInstance()->getGroupPeerNames(groupId);
|
||||
toxids.clear();
|
||||
nPeers = peers.size();
|
||||
for (int i = 0; i < nPeers; i++)
|
||||
for (int i = 0; i < nPeers; ++i)
|
||||
{
|
||||
ToxId id = Core::getInstance()->getGroupPeerToxId(groupId, i);
|
||||
if (id.isSelf())
|
||||
|
|
|
@ -128,7 +128,7 @@ time_t IPC::postEvent(const QString &name, const QByteArray& data, uint32_t dest
|
|||
IPCMemory* mem = global();
|
||||
time_t result = 0;
|
||||
|
||||
for (uint32_t i = 0; !evt && i < EVENT_QUEUE_SIZE; i++)
|
||||
for (uint32_t i = 0; !evt && i < EVENT_QUEUE_SIZE; ++i)
|
||||
{
|
||||
if (mem->events[i].posted == 0)
|
||||
evt = &mem->events[i];
|
||||
|
@ -188,7 +188,7 @@ bool IPC::isEventAccepted(time_t time)
|
|||
if (difftime(global()->lastProcessed, time) > 0)
|
||||
{
|
||||
IPCMemory* mem = global();
|
||||
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; i++)
|
||||
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i)
|
||||
{
|
||||
if (mem->events[i].posted == time && mem->events[i].processed)
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout/*=-1*/)
|
|||
IPC::IPCEvent *IPC::fetchEvent()
|
||||
{
|
||||
IPCMemory* mem = global();
|
||||
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; i++)
|
||||
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i)
|
||||
{
|
||||
IPCEvent* evt = &mem->events[i];
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ QByteArray Toxme::getServerPubkey(QString url, QNetworkReply::NetworkError &erro
|
|||
|
||||
QByteArray key;
|
||||
// I think, exist more easy way to convert key to ByteArray
|
||||
for (int i = 0; i < pubkeySize; i++) {
|
||||
for (int i = 0; i < pubkeySize; ++i) {
|
||||
QString byte = rawKey.mid(i*2, 2);
|
||||
key[i] = byte.toInt(nullptr, 16);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void EncryptedDb::appendToEncrypted(const QString &sql)
|
|||
}
|
||||
|
||||
buffer = buffer.right(buffer.size() - plainChunkSize);
|
||||
chunkPosition++;
|
||||
++chunkPosition;
|
||||
}
|
||||
encrFile.seek(chunkPosition * encryptedChunkSize);
|
||||
|
||||
|
|
|
@ -616,7 +616,7 @@ QVector<QString> Profile::remove()
|
|||
isRemoved = true;
|
||||
|
||||
qDebug() << "Removing profile" << name;
|
||||
for (int i=0; i<profiles.size(); i++)
|
||||
for (int i=0; i<profiles.size(); ++i)
|
||||
{
|
||||
if (profiles[i] == name)
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ unsigned getVUint32Size(QByteArray data)
|
|||
char num3;
|
||||
do {
|
||||
num3 = data[lensize];
|
||||
lensize++;
|
||||
++lensize;
|
||||
} while ((num3 & 0x80) != 0);
|
||||
|
||||
return lensize;
|
||||
|
@ -111,7 +111,7 @@ QByteArray vintToData(int num)
|
|||
while (num >= 0x80)
|
||||
{
|
||||
data[i] = static_cast<char>(num | 0x80);
|
||||
i++;
|
||||
++i;
|
||||
num = num >> 7;
|
||||
}
|
||||
data[i] = static_cast<char>(num);
|
||||
|
@ -127,7 +127,7 @@ QByteArray vuintToData(size_t num)
|
|||
while (num >= 0x80)
|
||||
{
|
||||
data[i] = static_cast<char>(num | 0x80);
|
||||
i++;
|
||||
++i;
|
||||
num = num >> 7;
|
||||
}
|
||||
data[i] = static_cast<char>(num);
|
||||
|
|
|
@ -719,7 +719,7 @@ void Settings::savePersonal(QString profileName, const QString &password)
|
|||
ps.setArrayIndex(index);
|
||||
ps.setValue("name", circle.name);
|
||||
ps.setValue("expanded", circle.expanded);
|
||||
index++;
|
||||
++index;
|
||||
}
|
||||
ps.endArray();
|
||||
}
|
||||
|
@ -2291,7 +2291,7 @@ unsigned int Settings::getUnreadFriendRequests() const
|
|||
unsigned int unreadFriendRequests = 0;
|
||||
for (auto request : friendRequests)
|
||||
if (!request.read)
|
||||
unreadFriendRequests++;
|
||||
++unreadFriendRequests;
|
||||
|
||||
return unreadFriendRequests;
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ void SettingsSerializer::save()
|
|||
QDataStream stream(&data, QIODevice::ReadWrite | QIODevice::Append);
|
||||
stream.setVersion(QDataStream::Qt_5_0);
|
||||
|
||||
for (int g=-1; g<groups.size(); g++)
|
||||
for (int g=-1; g<groups.size(); ++g)
|
||||
{
|
||||
// Save the group name, if any
|
||||
if (g!=-1)
|
||||
|
@ -534,7 +534,7 @@ void SettingsSerializer::readIni()
|
|||
else
|
||||
{
|
||||
a.group = -1;
|
||||
for (int i=0; i<groups.size(); i++)
|
||||
for (int i=0; i<groups.size(); ++i)
|
||||
if (groups[i] == groups[static_cast<int>(v.group)].left(slashIndex))
|
||||
a.group = i;
|
||||
a.name = groups[static_cast<int>(v.group)].mid(slashIndex+1);
|
||||
|
@ -547,7 +547,7 @@ void SettingsSerializer::readIni()
|
|||
}
|
||||
|
||||
// Associate each array's values with the array
|
||||
for (int ai=0; ai<arrays.size(); ai++)
|
||||
for (int ai=0; ai<arrays.size(); ++ai)
|
||||
{
|
||||
Array& a = arrays[ai];
|
||||
QString arrayPrefix;
|
||||
|
@ -556,7 +556,7 @@ void SettingsSerializer::readIni()
|
|||
arrayPrefix += a.name+'/';
|
||||
|
||||
// Find groups which represent each array index
|
||||
for (int g=0; g<groups.size(); g++)
|
||||
for (int g=0; g<groups.size(); ++g)
|
||||
{
|
||||
if (!groups[g].startsWith(arrayPrefix))
|
||||
continue;
|
||||
|
|
|
@ -80,7 +80,7 @@ QVector<QPair<QString,QString>> DirectShow::getDeviceList()
|
|||
devIdString = wcharToUtf8(olestr);
|
||||
|
||||
// replace ':' with '_' since FFmpeg uses : to delimitate sources
|
||||
for (size_t i = 0; i < strlen(devIdString); i++)
|
||||
for (size_t i = 0; i < strlen(devIdString); ++i)
|
||||
if (devIdString[i] == ':')
|
||||
devIdString[i] = '_';
|
||||
|
||||
|
@ -146,7 +146,7 @@ static IBaseFilter* getDevFilter(QString devName)
|
|||
devIdString = wcharToUtf8(olestr);
|
||||
|
||||
// replace ':' with '_' since FFmpeg uses : to delimitate sources
|
||||
for (size_t i = 0; i < strlen(devIdString); i++)
|
||||
for (size_t i = 0; i < strlen(devIdString); ++i)
|
||||
if (devIdString[i] == ':')
|
||||
devIdString[i] = '_';
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric()
|
|||
|
||||
// Convert the list to a QVector
|
||||
devices.resize(devlist->nb_devices);
|
||||
for (int i = 0; i < devlist->nb_devices; i++)
|
||||
for (int i = 0; i < devlist->nb_devices; ++i)
|
||||
{
|
||||
AVDeviceInfo* dev = devlist->devices[i];
|
||||
devices[i].first = dev->device_name;
|
||||
|
|
|
@ -194,7 +194,7 @@ CameraSource::~CameraSource()
|
|||
|
||||
if (device)
|
||||
{
|
||||
for (int i = 0; i < subscriptions; i++)
|
||||
for (int i = 0; i < subscriptions; ++i)
|
||||
device->close();
|
||||
|
||||
device = nullptr;
|
||||
|
@ -286,11 +286,11 @@ bool CameraSource::openDevice()
|
|||
|
||||
// We need to open the device as many time as we already have subscribers,
|
||||
// otherwise the device could get closed while we still have subscribers
|
||||
for (int i = 0; i < subscriptions; i++)
|
||||
for (int i = 0; i < subscriptions; ++i)
|
||||
device->open();
|
||||
|
||||
// Find the first video stream
|
||||
for (unsigned i = 0; i < device->context->nb_streams; i++)
|
||||
for (unsigned i = 0; i < device->context->nb_streams; ++i)
|
||||
{
|
||||
if (device->context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
{
|
||||
|
|
|
@ -84,14 +84,14 @@ void CoreVideoSource::pushFrame(const vpx_image_t* vpxframe)
|
|||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int dstStride = avframe->linesize[i];
|
||||
int srcStride = vpxframe->stride[i];
|
||||
int minStride = std::min(dstStride, srcStride);
|
||||
int size = (i == 0) ? height : height / 2;
|
||||
|
||||
for (int j = 0; j < size; j++)
|
||||
for (int j = 0; j < size; ++j)
|
||||
{
|
||||
uint8_t* dst = avframe->data[i] + dstStride * j;
|
||||
uint8_t* src = vpxframe->planes[i] + srcStride * j;
|
||||
|
|
|
@ -369,7 +369,7 @@ void ContentDialog::cycleContacts(bool forward, bool loop)
|
|||
|
||||
void ContentDialog::onVideoShow(QSize size)
|
||||
{
|
||||
videoCount++;
|
||||
++videoCount;
|
||||
if (videoCount > 1)
|
||||
return;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
|
|||
|
||||
// create pages
|
||||
buttonLayout->addStretch();
|
||||
for (int i = 0; i < pageCount; i++)
|
||||
for (int i = 0; i < pageCount; ++i)
|
||||
{
|
||||
QGridLayout* pageLayout = new QGridLayout;
|
||||
pageLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), maxRows, 0);
|
||||
|
@ -101,14 +101,14 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
|
|||
|
||||
qobject_cast<QGridLayout*>(stack.widget(currPage)->layout())->addWidget(button, row, col);
|
||||
|
||||
col++;
|
||||
currItem++;
|
||||
++col;
|
||||
++currItem;
|
||||
|
||||
// next row
|
||||
if (col >= maxCols)
|
||||
{
|
||||
col = 0;
|
||||
row++;
|
||||
++row;
|
||||
}
|
||||
|
||||
// next page
|
||||
|
@ -116,7 +116,7 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
|
|||
{
|
||||
row = 0;
|
||||
currItem = 0;
|
||||
currPage++;
|
||||
++currPage;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ void AddFriendForm::setIdFromClipboard()
|
|||
void AddFriendForm::deleteFriendRequest(const QString& toxId)
|
||||
{
|
||||
int size = Settings::getInstance().getFriendRequestSize();
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
Settings::Request request = Settings::getInstance().getFriendRequest(i);
|
||||
if (ToxId(toxId) == ToxId(request.address))
|
||||
|
|
|
@ -278,7 +278,7 @@ void AVForm::fillCameraModesComboBox()
|
|||
bool previouslyBlocked = videoModescomboBox->blockSignals(true);
|
||||
videoModescomboBox->clear();
|
||||
|
||||
for(int i = 0; i < videoModes.size(); i++)
|
||||
for(int i = 0; i < videoModes.size(); ++i)
|
||||
{
|
||||
VideoMode mode = videoModes[i];
|
||||
|
||||
|
@ -305,7 +305,7 @@ int AVForm::searchPreferredIndex()
|
|||
QRect prefRes = Settings::getInstance().getCamVideoRes();
|
||||
quint16 prefFPS = Settings::getInstance().getCamVideoFPS();
|
||||
|
||||
for (int i = 0; i < videoModes.size(); i++)
|
||||
for (int i = 0; i < videoModes.size(); ++i)
|
||||
{
|
||||
VideoMode mode = videoModes[i];
|
||||
if (mode.width == prefRes.width()
|
||||
|
@ -322,7 +322,7 @@ void AVForm::fillScreenModesComboBox()
|
|||
bool previouslyBlocked = videoModescomboBox->blockSignals(true);
|
||||
videoModescomboBox->clear();
|
||||
|
||||
for(int i = 0; i < videoModes.size(); i++)
|
||||
for(int i = 0; i < videoModes.size(); ++i)
|
||||
{
|
||||
VideoMode mode = videoModes[i];
|
||||
QString pixelFormat = CameraDevice::getPixelFormatString(mode.pixel_format);
|
||||
|
|
|
@ -121,7 +121,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent)
|
|||
bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
|
||||
bodyUI->checkUpdates->setChecked(s.getCheckUpdates());
|
||||
|
||||
for (int i = 0; i < langs.size(); i++)
|
||||
for (int i = 0; i < langs.size(); ++i)
|
||||
bodyUI->transComboBox->insertItem(i, langs[i]);
|
||||
|
||||
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(s.getTranslation()));
|
||||
|
|
|
@ -100,7 +100,7 @@ void PrivacyForm::on_randomNosapamButton_clicked()
|
|||
qsrand((uint)time.msec());
|
||||
|
||||
uint32_t newNospam{0};
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
newNospam = (newNospam<<8) + (qrand() % 256); // Generate byte by byte. For some reason.
|
||||
|
||||
Core::getInstance()->setNospam(newNospam);
|
||||
|
|
|
@ -234,11 +234,11 @@ void UserInterfaceForm::reloadSmileys()
|
|||
}
|
||||
|
||||
QStringList smileys;
|
||||
for (int i = 0; i < emoticons.size(); i++)
|
||||
for (int i = 0; i < emoticons.size(); ++i)
|
||||
smileys.push_front(emoticons.at(i).first());
|
||||
|
||||
const QSize size(18,18);
|
||||
for (int i = 0; i < smileLabels.size(); i++)
|
||||
for (int i = 0; i < smileLabels.size(); ++i)
|
||||
{
|
||||
QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[i]);
|
||||
smileLabels[i]->setPixmap(icon.pixmap(size));
|
||||
|
|
|
@ -104,6 +104,6 @@ void SettingsWidget::onTabChanged(int index)
|
|||
|
||||
void SettingsWidget::retranslateUi()
|
||||
{
|
||||
for (size_t i = 0; i < cfgForms.size(); i++)
|
||||
for (size_t i = 0; i < cfgForms.size(); ++i)
|
||||
settingsWidgets->setTabText(i, cfgForms[i]->getFormName());
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ void TabCompleter::complete()
|
|||
auto cur = msgEdit->textCursor();
|
||||
cur.setPosition(cur.selectionEnd());
|
||||
msgEdit->setTextCursor(cur);
|
||||
for (int i = 0; i < lastCompletionLength; i++)
|
||||
for (int i = 0; i < lastCompletionLength; ++i)
|
||||
msgEdit->textCursor().deletePreviousChar();
|
||||
|
||||
// insert completion
|
||||
|
|
|
@ -96,10 +96,10 @@ void QRWidget::paintImage()
|
|||
const double aspect = w / h;
|
||||
const double scale = ((aspect > 1.0) ? h : w) / s;
|
||||
|
||||
for (int y = 0; y < s; y++)
|
||||
for (int y = 0; y < s; ++y)
|
||||
{
|
||||
const int yy = y * s;
|
||||
for (int x = 0; x < s; x++)
|
||||
for (int x = 0; x < s; ++x)
|
||||
{
|
||||
const int xx = yy + x;
|
||||
const unsigned char b = qr->data[xx];
|
||||
|
|
Loading…
Reference in New Issue
Block a user