mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #5332
iphydf (1): chore: Use `nullptr` instead of `0` for NULL pointer constants.
This commit is contained in:
commit
ffbcbddcaf
|
@ -633,9 +633,9 @@ bool OpenAL::isOutputReady() const
|
|||
QStringList OpenAL::outDeviceNames()
|
||||
{
|
||||
QStringList list;
|
||||
const ALchar* pDeviceList = (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
||||
? alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER)
|
||||
: alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||
const ALchar* pDeviceList = (alcIsExtensionPresent(nullptr, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
||||
? alcGetString(nullptr, ALC_ALL_DEVICES_SPECIFIER)
|
||||
: alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
|
||||
|
||||
if (pDeviceList) {
|
||||
while (*pDeviceList) {
|
||||
|
@ -651,7 +651,7 @@ QStringList OpenAL::outDeviceNames()
|
|||
QStringList OpenAL::inDeviceNames()
|
||||
{
|
||||
QStringList list;
|
||||
const ALchar* pDeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
|
||||
const ALchar* pDeviceList = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER);
|
||||
|
||||
if (pDeviceList) {
|
||||
while (*pDeviceList) {
|
||||
|
|
|
@ -164,7 +164,7 @@ bool OpenAL2::initOutputEchoCancel()
|
|||
Audio::AUDIO_SAMPLE_RATE,
|
||||
0}; // End of List
|
||||
|
||||
alProxyDev = alcLoopbackOpenDeviceSOFT(NULL);
|
||||
alProxyDev = alcLoopbackOpenDeviceSOFT(nullptr);
|
||||
checkAlcError(alProxyDev);
|
||||
if (!alProxyDev) {
|
||||
qDebug() << "Couldn't create proxy device";
|
||||
|
|
|
@ -38,7 +38,7 @@ class ChatLog : public QGraphicsView
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ChatLog(QWidget* parent = 0);
|
||||
explicit ChatLog(QWidget* parent = nullptr);
|
||||
virtual ~ChatLog();
|
||||
|
||||
void insertChatlineAtBottom(ChatLine::Ptr l);
|
||||
|
|
|
@ -144,7 +144,7 @@ ChatMessage::Ptr ChatMessage::createFileTransferMessage(const QString& sender, T
|
|||
|
||||
msg->addColumn(new Text(sender, authorFont, true),
|
||||
ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
|
||||
msg->addColumn(new ChatLineContentProxy(new FileTransferWidget(0, file), 320, 0.6f),
|
||||
msg->addColumn(new ChatLineContentProxy(new FileTransferWidget(nullptr, file), 320, 0.6f),
|
||||
ColumnFormat(1.0, ColumnFormat::VariableSize));
|
||||
msg->addColumn(new Timestamp(date, Settings::getInstance().getTimestampFormat(), baseFont),
|
||||
ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
|
||||
|
|
|
@ -331,7 +331,7 @@ void FileTransferWidget::onFileTransferCancelled(ToxFile file)
|
|||
setupButtons();
|
||||
hideWidgets();
|
||||
|
||||
disconnect(Core::getInstance(), 0, this, 0);
|
||||
disconnect(Core::getInstance(), nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
void FileTransferWidget::onFileTransferPaused(ToxFile file)
|
||||
|
@ -401,7 +401,7 @@ void FileTransferWidget::onFileTransferFinished(ToxFile file)
|
|||
if (fileInfo.direction == ToxFile::RECEIVING)
|
||||
showPreview(fileInfo.filePath);
|
||||
|
||||
disconnect(Core::getInstance(), 0, this, 0);
|
||||
disconnect(Core::getInstance(), nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
void FileTransferWidget::fileTransferRemotePausedUnpaused(ToxFile file, bool paused)
|
||||
|
|
22
src/ipc.cpp
22
src/ipc.cpp
|
@ -64,7 +64,7 @@ IPC::IPC(uint32_t profileId)
|
|||
IPCMemory* mem = global();
|
||||
memset(mem, 0, sizeof(IPCMemory));
|
||||
mem->globalId = globalId;
|
||||
mem->lastProcessed = time(0);
|
||||
mem->lastProcessed = time(nullptr);
|
||||
globalMemory.unlock();
|
||||
} else {
|
||||
qWarning() << "Couldn't lock to take ownership";
|
||||
|
@ -122,7 +122,7 @@ time_t IPC::postEvent(const QString& name, const QByteArray& data, uint32_t dest
|
|||
memset(evt, 0, sizeof(IPCEvent));
|
||||
memcpy(evt->name, binName.constData(), binName.length());
|
||||
memcpy(evt->data, data.constData(), data.length());
|
||||
mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(0));
|
||||
mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(nullptr));
|
||||
evt->dest = dest;
|
||||
evt->sender = getpid();
|
||||
qDebug() << "postEvent " << name << "to" << dest;
|
||||
|
@ -177,11 +177,11 @@ bool IPC::isEventAccepted(time_t time)
|
|||
bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout /*=-1*/)
|
||||
{
|
||||
bool result = false;
|
||||
time_t start = time(0);
|
||||
time_t start = time(nullptr);
|
||||
forever
|
||||
{
|
||||
result = isEventAccepted(postTime);
|
||||
if (result || (timeout > 0 && difftime(time(0), start) >= timeout))
|
||||
if (result || (timeout > 0 && difftime(time(nullptr), start) >= timeout))
|
||||
break;
|
||||
|
||||
qApp->processEvents();
|
||||
|
@ -213,8 +213,8 @@ IPC::IPCEvent* IPC::fetchEvent()
|
|||
// Garbage-collect events that were not processed in EVENT_GC_TIMEOUT
|
||||
// and events that were processed and EVENT_GC_TIMEOUT passed after
|
||||
// so sending instance has time to react to those events.
|
||||
if ((evt->processed && difftime(time(0), evt->processed) > EVENT_GC_TIMEOUT)
|
||||
|| (!evt->processed && difftime(time(0), evt->posted) > EVENT_GC_TIMEOUT))
|
||||
if ((evt->processed && difftime(time(nullptr), evt->processed) > EVENT_GC_TIMEOUT)
|
||||
|| (!evt->processed && difftime(time(nullptr), evt->posted) > EVENT_GC_TIMEOUT))
|
||||
memset(evt, 0, sizeof(IPCEvent));
|
||||
|
||||
if (evt->posted && !evt->processed && evt->sender != getpid()
|
||||
|
@ -245,17 +245,17 @@ void IPC::processEvents()
|
|||
|
||||
if (mem->globalId == globalId) {
|
||||
// We're the owner, let's process those events
|
||||
mem->lastProcessed = time(0);
|
||||
mem->lastProcessed = time(nullptr);
|
||||
} else {
|
||||
// Only the owner processes events. But if the previous owner's dead, we can take
|
||||
// ownership now
|
||||
if (difftime(time(0), mem->lastProcessed) >= OWNERSHIP_TIMEOUT_S) {
|
||||
if (difftime(time(nullptr), mem->lastProcessed) >= OWNERSHIP_TIMEOUT_S) {
|
||||
qDebug() << "Previous owner timed out, taking ownership" << mem->globalId << "->"
|
||||
<< globalId;
|
||||
// Ignore events that were not meant for this instance
|
||||
memset(mem, 0, sizeof(IPCMemory));
|
||||
mem->globalId = globalId;
|
||||
mem->lastProcessed = time(0);
|
||||
mem->lastProcessed = time(nullptr);
|
||||
}
|
||||
// Non-main instance is limited to events destined for specific profile it runs
|
||||
}
|
||||
|
@ -271,9 +271,9 @@ void IPC::processEvents()
|
|||
// Otherwise global
|
||||
// event would be consumed by very first instance that gets to check it.
|
||||
if (evt->accepted)
|
||||
evt->processed = time(0);
|
||||
evt->processed = time(nullptr);
|
||||
} else {
|
||||
evt->processed = time(0);
|
||||
evt->processed = time(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ int main(int argc, char* argv[])
|
|||
osx::migrateProfiles();
|
||||
#endif
|
||||
|
||||
qsrand(time(0));
|
||||
qsrand(time(nullptr));
|
||||
Settings::getInstance();
|
||||
QString locale = Settings::getInstance().getTranslation();
|
||||
Translator::translate(locale);
|
||||
|
|
|
@ -85,7 +85,7 @@ private:
|
|||
#endif
|
||||
|
||||
private:
|
||||
explicit Nexus(QObject* parent = 0);
|
||||
explicit Nexus(QObject* parent = nullptr);
|
||||
~Nexus();
|
||||
|
||||
private:
|
||||
|
|
|
@ -163,13 +163,13 @@ bool RawDatabase::open(const QString& path, const QString& hexKey)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (sqlite3_create_function(sqlite, "regexp", 2, SQLITE_UTF8, NULL, &RawDatabase::regexpInsensitive, NULL, NULL)) {
|
||||
if (sqlite3_create_function(sqlite, "regexp", 2, SQLITE_UTF8, nullptr, &RawDatabase::regexpInsensitive, nullptr, nullptr)) {
|
||||
qWarning() << "Failed to create function regexp";
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sqlite3_create_function(sqlite, "regexpsensitive", 2, SQLITE_UTF8, NULL, &RawDatabase::regexpSensitive, NULL, NULL)) {
|
||||
if (sqlite3_create_function(sqlite, "regexpsensitive", 2, SQLITE_UTF8, nullptr, &RawDatabase::regexpSensitive, nullptr, nullptr)) {
|
||||
qWarning() << "Failed to create function regexpsensitive";
|
||||
close();
|
||||
return false;
|
||||
|
|
|
@ -88,7 +88,7 @@ void PosixSignalNotifier::watchSignal(int signum)
|
|||
action.sa_handler = detail::signalHandler;
|
||||
action.sa_mask = blockMask; // allow old signal to finish before new is raised
|
||||
|
||||
if (::sigaction(signum, &action, 0)) {
|
||||
if (::sigaction(signum, &action, nullptr)) {
|
||||
qFatal("Failed to setup signal %d, error = %d", signum, errno);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ CameraDevice* CameraDevice::open(QString devName, AVDictionary** options)
|
|||
aduration = fctx->max_analyze_duration = 0;
|
||||
#endif
|
||||
|
||||
if (avformat_find_stream_info(fctx, NULL) < 0) {
|
||||
if (avformat_find_stream_info(fctx, nullptr) < 0) {
|
||||
avformat_close_input(&fctx);
|
||||
goto out;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric()
|
|||
av_opt_set_defaults(s->priv_data);
|
||||
}
|
||||
} else {
|
||||
s->priv_data = NULL;
|
||||
s->priv_data = nullptr;
|
||||
}
|
||||
|
||||
// List the devices for this context
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
class LabeledVideo : public QFrame
|
||||
{
|
||||
public:
|
||||
LabeledVideo(const QPixmap& avatar, QWidget* parent = 0, bool expanding = true)
|
||||
LabeledVideo(const QPixmap& avatar, QWidget* parent = nullptr, bool expanding = true)
|
||||
: QFrame(parent)
|
||||
{
|
||||
qDebug() << "Created expanding? " << expanding;
|
||||
videoSurface = new VideoSurface(avatar, 0, expanding);
|
||||
videoSurface = new VideoSurface(avatar, nullptr, expanding);
|
||||
videoSurface->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
videoSurface->setMinimumHeight(32);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class QHBoxLayout;
|
|||
class GroupNetCamView : public GenericNetCamView
|
||||
{
|
||||
public:
|
||||
GroupNetCamView(int group, QWidget* parent = 0);
|
||||
GroupNetCamView(int group, QWidget* parent = nullptr);
|
||||
void clearPeers();
|
||||
void addPeer(const ToxPk& peer, const QString& name);
|
||||
void removePeer(const ToxPk& peer);
|
||||
|
|
|
@ -34,7 +34,7 @@ class NetCamView : public GenericNetCamView
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NetCamView(int friendId, QWidget* parent = 0);
|
||||
NetCamView(int friendId, QWidget* parent = nullptr);
|
||||
~NetCamView();
|
||||
|
||||
virtual void show(VideoSource* source, const QString& title);
|
||||
|
|
|
@ -30,8 +30,8 @@ class VideoSurface : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VideoSurface(const QPixmap& avatar, QWidget* parent = 0, bool expanding = false);
|
||||
VideoSurface(const QPixmap& avatar, VideoSource* source, QWidget* parent = 0);
|
||||
VideoSurface(const QPixmap& avatar, QWidget* parent = nullptr, bool expanding = false);
|
||||
VideoSurface(const QPixmap& avatar, VideoSource* source, QWidget* parent = nullptr);
|
||||
~VideoSurface();
|
||||
|
||||
bool isExpanding() const;
|
||||
|
|
|
@ -17,7 +17,7 @@ class AboutFriendForm : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AboutFriendForm(std::unique_ptr<IAboutFriend> about, QWidget* parent = 0);
|
||||
AboutFriendForm(std::unique_ptr<IAboutFriend> about, QWidget* parent = nullptr);
|
||||
~AboutFriendForm();
|
||||
|
||||
private:
|
||||
|
|
|
@ -33,7 +33,7 @@ class CategoryWidget : public GenericChatItemWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CategoryWidget(bool compact, QWidget* parent = 0);
|
||||
explicit CategoryWidget(bool compact, QWidget* parent = nullptr);
|
||||
|
||||
bool isExpanded() const;
|
||||
void setExpanded(bool isExpanded, bool save = true);
|
||||
|
|
|
@ -69,13 +69,13 @@ ContentLayout::~ContentLayout()
|
|||
void ContentLayout::clear()
|
||||
{
|
||||
QLayoutItem* item;
|
||||
while ((item = mainHead->layout()->takeAt(0)) != 0) {
|
||||
while ((item = mainHead->layout()->takeAt(0)) != nullptr) {
|
||||
item->widget()->hide();
|
||||
item->widget()->setParent(nullptr);
|
||||
delete item;
|
||||
}
|
||||
|
||||
while ((item = mainContent->layout()->takeAt(0)) != 0) {
|
||||
while ((item = mainContent->layout()->takeAt(0)) != nullptr) {
|
||||
item->widget()->hide();
|
||||
item->widget()->setParent(nullptr);
|
||||
delete item;
|
||||
|
|
|
@ -33,7 +33,7 @@ class EmoticonsWidget : public QMenu
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EmoticonsWidget(QWidget* parent = 0);
|
||||
explicit EmoticonsWidget(QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void insertEmoticon(QString str);
|
||||
|
|
|
@ -99,12 +99,12 @@ QLayoutItem* FlowLayout::takeAt(int index)
|
|||
if (index >= 0 && index < itemList.size())
|
||||
return itemList.takeAt(index);
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Qt::Orientations FlowLayout::expandingDirections() const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool FlowLayout::hasHeightForWidth() const
|
||||
|
@ -184,7 +184,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
|
|||
return -1;
|
||||
} else if (parent->isWidgetType()) {
|
||||
QWidget* pw = static_cast<QWidget*>(parent);
|
||||
return pw->style()->pixelMetric(pm, 0, pw);
|
||||
return pw->style()->pixelMetric(pm, nullptr, pw);
|
||||
} else {
|
||||
return static_cast<QLayout*>(parent)->spacing();
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ void ChatForm::onTextEditChanged()
|
|||
void ChatForm::onAttachClicked()
|
||||
{
|
||||
QStringList paths =
|
||||
QFileDialog::getOpenFileNames(Q_NULLPTR, tr("Send a file"), QDir::homePath(), 0, 0);
|
||||
QFileDialog::getOpenFileNames(Q_NULLPTR, tr("Send a file"), QDir::homePath(), nullptr, nullptr);
|
||||
|
||||
if (paths.isEmpty()) {
|
||||
return;
|
||||
|
@ -714,7 +714,7 @@ void ChatForm::dropEvent(QDropEvent* ev)
|
|||
|
||||
file.close();
|
||||
if (file.isSequential()) {
|
||||
QMessageBox::critical(0, tr("Bad idea"),
|
||||
QMessageBox::critical(nullptr, tr("Bad idea"),
|
||||
tr("You're trying to send a sequential file, "
|
||||
"which is not going to work!"));
|
||||
continue;
|
||||
|
|
|
@ -33,8 +33,8 @@ class LoadHistoryDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LoadHistoryDialog(const ToxPk& friendPk, QWidget* parent = 0);
|
||||
explicit LoadHistoryDialog(QWidget* parent = 0);
|
||||
explicit LoadHistoryDialog(const ToxPk& friendPk, QWidget* parent = nullptr);
|
||||
explicit LoadHistoryDialog(QWidget* parent = nullptr);
|
||||
~LoadHistoryDialog();
|
||||
|
||||
QDateTime getFromDate();
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
Accepted = QDialog::Accepted,
|
||||
Tertiary
|
||||
};
|
||||
explicit SetPasswordDialog(QString body, QString extraButton, QWidget* parent = 0);
|
||||
explicit SetPasswordDialog(QString body, QString extraButton, QWidget* parent = nullptr);
|
||||
~SetPasswordDialog();
|
||||
QString getPassword();
|
||||
static int getPasswordStrength(QString pass);
|
||||
|
|
|
@ -614,7 +614,7 @@ void AVForm::killVideoSurface()
|
|||
return;
|
||||
|
||||
QLayoutItem* child;
|
||||
while ((child = gridLayout->takeAt(0)) != 0)
|
||||
while ((child = gridLayout->takeAt(0)) != nullptr)
|
||||
delete child;
|
||||
|
||||
camVideoSurface->close();
|
||||
|
|
|
@ -62,7 +62,7 @@ void PrivacyForm::on_cbKeepHistory_stateChanged()
|
|||
if (!bodyUI->cbKeepHistory->isChecked()) {
|
||||
QMessageBox::StandardButton dialogDelHistory;
|
||||
dialogDelHistory =
|
||||
QMessageBox::question(0, tr("Confirmation"),
|
||||
QMessageBox::question(nullptr, tr("Confirmation"),
|
||||
tr("Do you want to permanently delete all chat history?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (dialogDelHistory == QMessageBox::Yes) {
|
||||
|
|
|
@ -29,7 +29,7 @@ class VerticalOnlyScroller : public QScrollArea
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VerticalOnlyScroller(QWidget* parent = 0);
|
||||
explicit VerticalOnlyScroller(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent* event) final override;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
GenericChatItemLayout(const GenericChatItemLayout& layout) = delete;
|
||||
~GenericChatItemLayout();
|
||||
|
||||
void addSortedWidget(GenericChatItemWidget* widget, int stretch = 0, Qt::Alignment alignment = 0);
|
||||
void addSortedWidget(GenericChatItemWidget* widget, int stretch = 0, Qt::Alignment alignment = nullptr);
|
||||
int indexOfSortedWidget(GenericChatItemWidget* widget) const;
|
||||
bool existsSortedWidget(GenericChatItemWidget* widget) const;
|
||||
void removeSortedWidget(GenericChatItemWidget* widget);
|
||||
|
|
|
@ -34,7 +34,7 @@ class GenericChatroomWidget : public GenericChatItemWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GenericChatroomWidget(bool compact, QWidget* parent = 0);
|
||||
explicit GenericChatroomWidget(bool compact, QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
virtual void setAsActiveChatroom() = 0;
|
||||
|
|
|
@ -47,13 +47,13 @@ public:
|
|||
|
||||
static QString itemInputDialog(QWidget* parent, const QString& title, const QString& label,
|
||||
const QStringList& items, int current = 0, bool editable = true,
|
||||
bool* ok = 0, Qt::WindowFlags flags = 0,
|
||||
bool* ok = nullptr, Qt::WindowFlags flags = nullptr,
|
||||
Qt::InputMethodHints hints = Qt::ImhNone);
|
||||
|
||||
static QString passwordDialog(const QString& cancel, const QString& body);
|
||||
|
||||
private:
|
||||
explicit GUI(QObject* parent = 0);
|
||||
explicit GUI(QObject* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
// Private implementation, those must be called from the GUI thread
|
||||
|
@ -71,7 +71,7 @@ private slots:
|
|||
const QString& button2, bool defaultAns = false, bool warning = true);
|
||||
QString _itemInputDialog(QWidget* parent, const QString& title, const QString& label,
|
||||
const QStringList& items, int current = 0, bool editable = true,
|
||||
bool* ok = 0, Qt::WindowFlags flags = 0,
|
||||
bool* ok = nullptr, Qt::WindowFlags flags = nullptr,
|
||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
QString _passwordDialog(const QString& cancel, const QString& body);
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
Bottom
|
||||
};
|
||||
|
||||
explicit NotificationEdgeWidget(Position position, QWidget* parent = 0);
|
||||
explicit NotificationEdgeWidget(Position position, QWidget* parent = nullptr);
|
||||
void updateNotificationCount(int count);
|
||||
|
||||
signals:
|
||||
|
|
|
@ -29,7 +29,7 @@ class NotificationEdgeWidget;
|
|||
class NotificationScrollArea final : public AdjustingScrollArea
|
||||
{
|
||||
public:
|
||||
explicit NotificationScrollArea(QWidget* parent = 0);
|
||||
explicit NotificationScrollArea(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void trackWidget(GenericChatroomWidget* widget);
|
||||
|
|
|
@ -71,9 +71,8 @@ QImage* QRWidget::getImage()
|
|||
*/
|
||||
bool QRWidget::saveImage(QString path)
|
||||
{
|
||||
return image
|
||||
->save(path, 0,
|
||||
75); // 0 - image format same as file extension, 75-quality, png file is ~6.3kb
|
||||
// 0 - image format same as file extension, 75-quality, png file is ~6.3kb
|
||||
return image->save(path, nullptr, 75);
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/21400254/how-to-draw-a-qr-code-with-qt-in-native-c-c
|
||||
|
|
|
@ -28,7 +28,7 @@ class QRWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QRWidget(QWidget* parent = 0);
|
||||
explicit QRWidget(QWidget* parent = nullptr);
|
||||
~QRWidget();
|
||||
void setQRData(const QString& data);
|
||||
QImage* getImage();
|
||||
|
|
|
@ -120,7 +120,7 @@ GdkPixbuf* SystemTrayIcon::convertQIconToPixbuf(const QIcon& icon)
|
|||
|
||||
return gdk_pixbuf_new_from_data(image_bytes, GDK_COLORSPACE_RGB, image.hasAlphaChannel(), 8,
|
||||
image.width(), image.height(), image.bytesPerLine(),
|
||||
callbackFreeImage, NULL);
|
||||
callbackFreeImage, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -231,8 +231,8 @@ void SystemTrayIcon::setContextMenu(QMenu* menu)
|
|||
app_indicator_set_menu(unityIndicator, GTK_MENU(unityMenu));
|
||||
DbusmenuServer* menuServer;
|
||||
DbusmenuMenuitem* rootMenuItem;
|
||||
g_object_get(unityIndicator, "dbus-menu-server", &menuServer, NULL);
|
||||
g_object_get(menuServer, "root-node", &rootMenuItem, NULL);
|
||||
g_object_get(unityIndicator, "dbus-menu-server", &menuServer, nullptr);
|
||||
g_object_get(menuServer, "root-node", &rootMenuItem, nullptr);
|
||||
void (*callback)(DbusmenuMenuitem*, gpointer) = [](DbusmenuMenuitem*, gpointer data) {
|
||||
static_cast<SystemTrayIcon*>(data)->activated(QSystemTrayIcon::Unknown);
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@ class ActivateDialog : public QDialog
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ActivateDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
ActivateDialog(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||
bool event(QEvent* event) override;
|
||||
|
||||
signals:
|
||||
|
|
|
@ -26,7 +26,7 @@ class AdjustingScrollArea : public QScrollArea
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AdjustingScrollArea(QWidget* parent = 0);
|
||||
explicit AdjustingScrollArea(QWidget* parent = nullptr);
|
||||
virtual ~AdjustingScrollArea() = default;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -26,7 +26,7 @@ class ChatTextEdit final : public QTextEdit
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ChatTextEdit(QWidget* parent = 0);
|
||||
explicit ChatTextEdit(QWidget* parent = nullptr);
|
||||
~ChatTextEdit();
|
||||
void setLastMessage(QString lm);
|
||||
void sendKeyEvent(QKeyEvent* event);
|
||||
|
|
|
@ -34,7 +34,7 @@ CroppingLabel::CroppingLabel(QWidget* parent)
|
|||
class LineEdit : public QLineEdit
|
||||
{
|
||||
public:
|
||||
explicit LineEdit(QWidget* parent = 0)
|
||||
explicit LineEdit(QWidget* parent = nullptr)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class CroppingLabel : public QLabel
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CroppingLabel(QWidget* parent = 0);
|
||||
explicit CroppingLabel(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void editBegin();
|
||||
|
|
|
@ -30,7 +30,7 @@ class FlyoutOverlayWidget : public QWidget
|
|||
Q_OBJECT
|
||||
Q_PROPERTY(qreal flyoutPercent READ flyoutPercent WRITE setFlyoutPercent)
|
||||
public:
|
||||
explicit FlyoutOverlayWidget(QWidget* parent = 0);
|
||||
explicit FlyoutOverlayWidget(QWidget* parent = nullptr);
|
||||
~FlyoutOverlayWidget();
|
||||
|
||||
int animationDuration() const;
|
||||
|
|
|
@ -27,7 +27,7 @@ class ProfileImporter : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProfileImporter(QWidget* parent = 0);
|
||||
explicit ProfileImporter(QWidget* parent = nullptr);
|
||||
bool importProfile(const QString& path);
|
||||
bool importProfile();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
ScreenshotGrabber::ScreenshotGrabber()
|
||||
: QObject()
|
||||
, mKeysBlocked(false)
|
||||
, scene(0)
|
||||
, scene(nullptr)
|
||||
, mQToxVisible(true)
|
||||
{
|
||||
window = new QGraphicsView(scene); // Top-level widget
|
||||
|
|
|
@ -699,7 +699,7 @@ void Widget::onSeparateWindowChanged(bool separate, bool clicked)
|
|||
|
||||
if (contentLayout) {
|
||||
contentLayout->clear();
|
||||
contentLayout->parentWidget()->setParent(0); // Remove from splitter.
|
||||
contentLayout->parentWidget()->setParent(nullptr); // Remove from splitter.
|
||||
contentLayout->parentWidget()->hide();
|
||||
contentLayout->parentWidget()->deleteLater();
|
||||
contentLayout->deleteLater();
|
||||
|
@ -1043,7 +1043,7 @@ void Widget::addFriendFailed(const ToxPk&, const QString& errorInfo)
|
|||
info = info + QStringLiteral(": ") + errorInfo;
|
||||
}
|
||||
|
||||
QMessageBox::critical(0, "Error", info);
|
||||
QMessageBox::critical(nullptr, "Error", info);
|
||||
}
|
||||
|
||||
void Widget::onFriendStatusChanged(int friendId, Status status)
|
||||
|
|
|
@ -103,7 +103,7 @@ private:
|
|||
};
|
||||
|
||||
public:
|
||||
explicit Widget(QWidget* parent = 0);
|
||||
explicit Widget(QWidget* parent = nullptr);
|
||||
~Widget();
|
||||
void init();
|
||||
void setCentralWidget(QWidget* widget, const QString& widgetName);
|
||||
|
|
|
@ -116,8 +116,8 @@ Q_DECLARE_METATYPE(ToxId)
|
|||
void TestToxmeData::lookup_data()
|
||||
{
|
||||
qRegisterMetaType<ToxId>("ToxId");
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<ToxId>("result");
|
||||
QTest::addColumn<QString>("input", nullptr);
|
||||
QTest::addColumn<ToxId>("result", nullptr);
|
||||
QString sToxId = testToxId.toHex();
|
||||
|
||||
QTest::newRow("Valid ToxId") << QStringLiteral(R"({"tox_id": "%1"})").arg(sToxId)
|
||||
|
@ -149,8 +149,8 @@ Q_DECLARE_METATYPE(ToxmeData::ExecCode)
|
|||
void TestToxmeData::extractCode_data()
|
||||
{
|
||||
qRegisterMetaType<ToxmeData::ExecCode>("ToxmeData::ExecCode");
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<ToxmeData::ExecCode>("result");
|
||||
QTest::addColumn<QString>("input", nullptr);
|
||||
QTest::addColumn<ToxmeData::ExecCode>("result", nullptr);
|
||||
|
||||
QTest::newRow("Custom code") << QStringLiteral(R"({"c": 123})")
|
||||
<< ToxmeData::ExecCode(123);
|
||||
|
@ -205,7 +205,7 @@ void TestToxmeData::createAddressRequest()
|
|||
QCOMPARE(bioRes, bio);
|
||||
|
||||
int timeRes = json["timestamp"].toInt();
|
||||
// Test will be failed if `createAddressRequest` will take more
|
||||
// Test will be failed if `createAddressRequest` will take more
|
||||
// than 100 seconds
|
||||
QVERIFY(qAbs(timeRes - timestamp) < 100);
|
||||
}
|
||||
|
@ -216,9 +216,9 @@ void TestToxmeData::createAddressRequest()
|
|||
void TestToxmeData::getPassTest_data()
|
||||
{
|
||||
qRegisterMetaType<ToxmeData::ExecCode>("ToxmeData::ExecCode");
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<QString>("result");
|
||||
QTest::addColumn<ToxmeData::ExecCode>("code");
|
||||
QTest::addColumn<QString>("input", nullptr);
|
||||
QTest::addColumn<QString>("result", nullptr);
|
||||
QTest::addColumn<ToxmeData::ExecCode>("code", nullptr);
|
||||
|
||||
QTest::newRow("Valid password") << QStringLiteral(R"({"password": "123qwe"})")
|
||||
<< QStringLiteral("123qwe")
|
||||
|
@ -280,7 +280,7 @@ void TestToxmeData::deleteAddressRequestTest()
|
|||
QCOMPARE(pkRes, testPublicKey);
|
||||
|
||||
int timeRes = json["timestamp"].toInt();
|
||||
// Test will be failed if `deleteAddressRequest` will take more
|
||||
// Test will be failed if `deleteAddressRequest` will take more
|
||||
// than 100 seconds
|
||||
QVERIFY(qAbs(timeRes - timestamp) < 100);
|
||||
}
|
||||
|
|
|
@ -38,14 +38,14 @@ Settings::Settings()
|
|||
DWORD dwLastErr = 0;
|
||||
|
||||
// Enable SeIncreaseQuotaPrivilege
|
||||
HANDLE hProcessToken = NULL;
|
||||
HANDLE hProcessToken = nullptr;
|
||||
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hProcessToken))
|
||||
goto unelevateFail;
|
||||
TOKEN_PRIVILEGES tkp;
|
||||
tkp.PrivilegeCount = 1;
|
||||
LookupPrivilegeValueW(NULL, SE_INCREASE_QUOTA_NAME, &tkp.Privileges[0].Luid);
|
||||
LookupPrivilegeValueW(nullptr, SE_INCREASE_QUOTA_NAME, &tkp.Privileges[0].Luid);
|
||||
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
AdjustTokenPrivileges(hProcessToken, FALSE, &tkp, 0, NULL, NULL);
|
||||
AdjustTokenPrivileges(hProcessToken, FALSE, &tkp, 0, nullptr, nullptr);
|
||||
dwLastErr = GetLastError();
|
||||
CloseHandle(hProcessToken);
|
||||
if (ERROR_SUCCESS != dwLastErr)
|
||||
|
@ -68,7 +68,7 @@ Settings::Settings()
|
|||
// Duplicate the shell's process token to get a primary token.
|
||||
// Based on experimentation, this is the minimal set of rights required for
|
||||
// CreateProcessWithTokenW (contrary to current documentation).
|
||||
if (!DuplicateTokenEx(hShellProcessToken, dwTokenRights, NULL, SecurityImpersonation,
|
||||
if (!DuplicateTokenEx(hShellProcessToken, dwTokenRights, nullptr, SecurityImpersonation,
|
||||
TokenPrimary, &hPrimaryToken))
|
||||
goto unelevateFail;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user