Commit 424340e3 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use Q_EMIT/nullptr/fix gcc warning

parent 54e8e80c
Pipeline #196152 passed with stage
in 4 minutes and 39 seconds
......@@ -348,7 +348,7 @@ void FancyTabBar::setTabToolTip(int index, const QString &toolTip)
// mode itself
void FancyTabBar::emitCurrentIndex()
{
emit currentChanged(m_currentIndex);
Q_EMIT currentChanged(m_currentIndex);
}
void FancyTabBar::mousePressEvent(QMouseEvent* e)
......@@ -460,7 +460,7 @@ void FancyTabBar::setCurrentIndex(int index)
{
m_currentIndex = index;
update();
emit currentChanged(m_currentIndex);
Q_EMIT currentChanged(m_currentIndex);
}
......@@ -590,7 +590,7 @@ void FancyTabWidget::SetCurrentIndex(int index)
void FancyTabWidget::ShowWidget(int index)
{
stack_->setCurrentIndex(index);
emit CurrentChanged(index);
Q_EMIT CurrentChanged(index);
}
void FancyTabWidget::AddBottomWidget(QWidget* widget)
......@@ -656,7 +656,7 @@ void FancyTabWidget::SetMode(Mode mode)
tab_bar_->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
mode_ = mode;
emit ModeChanged(mode);
Q_EMIT ModeChanged(mode);
update();
}
......
......@@ -38,7 +38,7 @@ bool SideWidget::event(QEvent* event)
{
switch (event->type()) {
case QEvent::LayoutRequest:
emit sizeHintChanged();
Q_EMIT sizeHintChanged();
break;
case QEvent::MouseButtonPress:
......
......@@ -275,7 +275,7 @@ void QtLocalPeer::receiveConnection()
socket->waitForBytesWritten(1000);
socket->waitForDisconnected(1000); // make sure client reads ack
delete socket;
emit messageReceived(message); //### (might take a long time to return)
Q_EMIT messageReceived(message); //### (might take a long time to return)
#endif
}
......
......@@ -250,7 +250,7 @@ void QtSingleApplication::setAppId(const QString &id)
/*!
Tries to send the text \a message to the currently running
instance. The QtSingleApplication object in the running instance
will emit the messageReceived() signal when it receives the
will Q_EMIT the messageReceived() signal when it receives the
message.
This function returns true if the message has been sent to, and
......
......@@ -75,7 +75,7 @@ void AdBlockManager::setEnabled(bool enabled)
}
m_enabled = enabled;
emit enabledChanged(enabled);
Q_EMIT enabledChanged(enabled);
Settings settings;
settings.beginGroup(QSL("AdBlock"));
......@@ -144,7 +144,7 @@ QVector<AdBlockedRequest> AdBlockManager::blockedRequestsForUrl(const QUrl &url)
void AdBlockManager::clearBlockedRequestsForUrl(const QUrl &url)
{
if (m_blockedRequests.remove(url)) {
emit blockedRequestsChanged(url);
Q_EMIT blockedRequestsChanged(url);
}
}
......@@ -350,7 +350,7 @@ void AdBlockManager::load()
connect(m_interceptor, &AdBlockUrlInterceptor::requestBlocked, this, [this](const AdBlockedRequest &request) {
m_blockedRequests[request.firstPartyUrl].append(request);
emit blockedRequestsChanged(request.firstPartyUrl);
Q_EMIT blockedRequestsChanged(request.firstPartyUrl);
});
mApp->networkManager()->installUrlInterceptor(m_interceptor);
......
......@@ -170,14 +170,14 @@ void AdBlockSubscription::subscriptionDownloaded()
m_reply = 0;
if (error) {
emit subscriptionError(tr("Cannot load subscription!"));
Q_EMIT subscriptionError(tr("Cannot load subscription!"));
return;
}
loadSubscription(AdBlockManager::instance()->disabledRules());
emit subscriptionUpdated();
emit subscriptionChanged();
Q_EMIT subscriptionUpdated();
Q_EMIT subscriptionChanged();
}
bool AdBlockSubscription::saveDownloadedData(const QByteArray &data)
......@@ -220,7 +220,7 @@ const AdBlockRule* AdBlockSubscription::enableRule(int offset)
rule->setEnabled(true);
AdBlockManager::instance()->removeDisabledRule(rule->filter());
emit subscriptionChanged();
Q_EMIT subscriptionChanged();
if (rule->isCssRule())
mApp->reloadUserStyleSheet();
......@@ -238,7 +238,7 @@ const AdBlockRule* AdBlockSubscription::disableRule(int offset)
rule->setEnabled(false);
AdBlockManager::instance()->addDisabledRule(rule->filter());
emit subscriptionChanged();
Q_EMIT subscriptionChanged();
if (rule->isCssRule())
mApp->reloadUserStyleSheet();
......@@ -379,7 +379,7 @@ int AdBlockCustomList::addRule(AdBlockRule* rule)
{
m_rules.append(rule);
emit subscriptionChanged();
Q_EMIT subscriptionChanged();
if (rule->isCssRule())
mApp->reloadUserStyleSheet();
......@@ -398,7 +398,7 @@ bool AdBlockCustomList::removeRule(int offset)
m_rules.remove(offset);
emit subscriptionChanged();
Q_EMIT subscriptionChanged();
if (rule->isCssRule())
mApp->reloadUserStyleSheet();
......@@ -418,7 +418,7 @@ const AdBlockRule* AdBlockCustomList::replaceRule(AdBlockRule* rule, int offset)
AdBlockRule* oldRule = m_rules.at(offset);
m_rules[offset] = rule;
emit subscriptionChanged();
Q_EMIT subscriptionChanged();
if (rule->isCssRule() || oldRule->isCssRule())
mApp->reloadUserStyleSheet();
......
......@@ -56,5 +56,5 @@ void AdBlockUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &request)
r.resourceType = request.resourceType();
r.navigationType = request.navigationType();
r.rule = ruleFilter;
emit requestBlocked(r);
Q_EMIT requestBlocked(r);
}
......@@ -32,7 +32,7 @@ void AutoSaver::saveIfNecessary()
{
if (m_timer.isActive()) {
m_timer.stop();
emit save();
Q_EMIT save();
}
}
......@@ -47,7 +47,7 @@ void AutoSaver::timerEvent(QTimerEvent* event)
{
if (event->timerId() == m_timer.timerId()) {
m_timer.stop();
emit save();
Q_EMIT save();
}
QObject::timerEvent(event);
......
......@@ -327,7 +327,7 @@ void BrowserWindow::postLaunch()
}
mApp->plugins()->emitMainWindowCreated(this);
emit startingCompleted();
Q_EMIT startingCompleted();
raise();
activateWindow();
......@@ -1515,7 +1515,7 @@ void BrowserWindow::closeEvent(QCloseEvent* event)
}
}
emit aboutToClose();
Q_EMIT aboutToClose();
saveSettings();
mApp->closedWindowsManager()->saveWindow(this);
......
......@@ -161,7 +161,7 @@ public Q_SLOTS:
void bookmarkPage();
void bookmarkAllTabs();
void loadAddress(const QUrl &url);
void showSource(WebView *view = Q_NULLPTR);
void showSource(WebView *view = nullptr);
private Q_SLOTS:
void openLocation();
......
......@@ -509,7 +509,7 @@ void MainApplication::destroyRestoreManager()
void MainApplication::reloadSettings()
{
loadSettings();
emit settingsReloaded();
Q_EMIT settingsReloaded();
}
QString MainApplication::styleName() const
......@@ -723,7 +723,7 @@ void MainApplication::quitApplication()
}
for (BrowserWindow *window : qAsConst(m_windows)) {
emit window->aboutToClose();
Q_EMIT window->aboutToClose();
}
if (m_sessionManager && m_windows.count() > 0) {
......@@ -914,7 +914,7 @@ void MainApplication::onFocusChanged()
if (activeBrowserWindow) {
m_lastActiveWindow = activeBrowserWindow;
emit activeWindowChanged(m_lastActiveWindow);
Q_EMIT activeWindowChanged(m_lastActiveWindow);
}
}
......
......@@ -163,7 +163,7 @@ void PasswordManager::switchBackend(const QString &backendID)
settings.setValue(QSL("Backend"), backendID);
settings.endGroup();
emit passwordBackendChanged();
Q_EMIT passwordBackendChanged();
}
bool PasswordManager::registerBackend(const QString &id, PasswordBackend* backend)
......
......@@ -148,7 +148,7 @@ void Bookmarks::insertBookmark(BookmarkItem* parent, int row, BookmarkItem* item
m_lastFolder = parent;
m_model->addBookmark(parent, row, item);
emit bookmarkAdded(item);
Q_EMIT bookmarkAdded(item);
m_autoSaver->changeOccurred();
}
......@@ -160,7 +160,7 @@ bool Bookmarks::removeBookmark(BookmarkItem* item)
}
m_model->removeBookmark(item);
emit bookmarkRemoved(item);
Q_EMIT bookmarkRemoved(item);
m_autoSaver->changeOccurred();
return true;
......@@ -169,7 +169,7 @@ bool Bookmarks::removeBookmark(BookmarkItem* item)
void Bookmarks::changeBookmark(BookmarkItem* item)
{
Q_ASSERT(item);
emit bookmarkChanged(item);
Q_EMIT bookmarkChanged(item);
m_autoSaver->changeOccurred();
}
......@@ -177,14 +177,14 @@ void Bookmarks::changeBookmark(BookmarkItem* item)
void Bookmarks::setShowOnlyIconsInToolbar(bool state)
{
m_showOnlyIconsInToolbar = state;
emit showOnlyIconsInToolbarChanged(state);
Q_EMIT showOnlyIconsInToolbarChanged(state);
m_autoSaver->changeOccurred();
}
void Bookmarks::setShowOnlyTextInToolbar(bool state)
{
m_showOnlyTextInToolbar = state;
emit showOnlyTextInToolbarChanged(state);
Q_EMIT showOnlyTextInToolbarChanged(state);
m_autoSaver->changeOccurred();
}
......
......@@ -305,7 +305,7 @@ BookmarkItem* BookmarksModel::item(const QModelIndex &index) const
void BookmarksModel::bookmarkChanged(BookmarkItem* item)
{
QModelIndex idx = index(item);
emit dataChanged(idx, idx);
Q_EMIT dataChanged(idx, idx);
}
......
......@@ -54,7 +54,7 @@ void BookmarksFoldersMenu::folderChoosed()
{
if (auto* act = qobject_cast<QAction*>(sender())) {
BookmarkItem* folder = static_cast<BookmarkItem*>(act->data().value<void*>());
emit folderSelected(folder);
Q_EMIT folderSelected(folder);
}
}
......@@ -115,7 +115,7 @@ void BookmarksFoldersButton::setSelectedFolder(BookmarkItem* folder)
setIcon(folder->icon());
if (sender()) {
emit selectedFolderChanged(folder);
Q_EMIT selectedFolderChanged(folder);
}
}
......
......@@ -173,12 +173,12 @@ void BookmarksTreeView::selectionChanged(const QItemSelection &selected, const Q
Q_UNUSED(selected)
Q_UNUSED(deselected)
emit bookmarksSelected(selectedBookmarks());
Q_EMIT bookmarksSelected(selectedBookmarks());
}
void BookmarksTreeView::contextMenuEvent(QContextMenuEvent* event)
{
emit contextMenuRequested(viewport()->mapToGlobal(event->pos()));
Q_EMIT contextMenuRequested(viewport()->mapToGlobal(event->pos()));
}
void BookmarksTreeView::mouseMoveEvent(QMouseEvent* event)
......@@ -210,10 +210,10 @@ void BookmarksTreeView::mousePressEvent(QMouseEvent* event)
BookmarkItem* item = m_model->item(m_filter->mapToSource(index));
if (buttons == Qt::LeftButton && modifiers == Qt::ShiftModifier) {
emit bookmarkShiftActivated(item);
Q_EMIT bookmarkShiftActivated(item);
}
else if (buttons == Qt::MiddleButton || (buttons == Qt::LeftButton && modifiers == Qt::ControlModifier)) {
emit bookmarkCtrlActivated(item);
Q_EMIT bookmarkCtrlActivated(item);
}
}
}
......@@ -231,7 +231,7 @@ void BookmarksTreeView::mouseReleaseEvent(QMouseEvent* event)
// Activate bookmarks with single mouse click in Sidebar
if (m_type == BookmarksSidebarViewType && event->button() == Qt::LeftButton && event->modifiers() == Qt::NoModifier) {
emit bookmarkActivated(item);
Q_EMIT bookmarkActivated(item);
}
}
}
......@@ -250,10 +250,10 @@ void BookmarksTreeView::mouseDoubleClickEvent(QMouseEvent* event)
Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
if (buttons == Qt::LeftButton && modifiers == Qt::NoModifier) {
emit bookmarkActivated(item);
Q_EMIT bookmarkActivated(item);
}
else if (buttons == Qt::LeftButton && modifiers == Qt::ShiftModifier) {
emit bookmarkShiftActivated(item);
Q_EMIT bookmarkShiftActivated(item);
}
}
}
......@@ -277,13 +277,13 @@ void BookmarksTreeView::keyPressEvent(QKeyEvent* event)
Qt::KeyboardModifiers modifiers = event->modifiers();
if (modifiers == Qt::NoModifier || modifiers == Qt::KeypadModifier) {
emit bookmarkActivated(item);
Q_EMIT bookmarkActivated(item);
}
else if (modifiers == Qt::ControlModifier) {
emit bookmarkCtrlActivated(item);
Q_EMIT bookmarkCtrlActivated(item);
}
else if (modifiers == Qt::ShiftModifier) {
emit bookmarkShiftActivated(item);
Q_EMIT bookmarkShiftActivated(item);
}
}
break;
......
......@@ -123,13 +123,13 @@ void CookieJar::slotCookieAdded(const QNetworkCookie &cookie)
}
m_cookies.append(cookie);
emit cookieAdded(cookie);
Q_EMIT cookieAdded(cookie);
}
void CookieJar::slotCookieRemoved(const QNetworkCookie &cookie)
{
if (m_cookies.removeOne(cookie))
emit cookieRemoved(cookie);
Q_EMIT cookieRemoved(cookie);
}
bool CookieJar::cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const
......
......@@ -243,7 +243,7 @@ QTreeWidgetItem *CookieManager::cookieItem(const QNetworkCookie &cookie) const
if (it.value() == cookie)
return it.key();
}
return Q_NULLPTR;
return nullptr;
}
void CookieManager::removeBlacklist()
......@@ -320,7 +320,7 @@ void CookieManager::removeCookie(const QNetworkCookie &cookie)
if (item->parent() && item->parent()->childCount() == 1) {
m_domainHash.remove(cookieDomain(cookie));
delete item->parent();
item = Q_NULLPTR;
item = nullptr;
}
delete item;
......
......@@ -151,7 +151,7 @@ void DownloadItem::finished()
if (success && m_openFile)
openFile();
emit downloadFinished(true);
Q_EMIT downloadFinished(true);
}
void DownloadItem::downloadProgress(qint64 received, qint64 total)
......@@ -276,7 +276,7 @@ void DownloadItem::stop()
m_download->cancel();
m_downloading = false;
emit downloadFinished(false);
Q_EMIT downloadFinished(false);
}
void DownloadItem::pauseResume()
......@@ -329,7 +329,7 @@ void DownloadItem::copyDownloadLink()
void DownloadItem::clear()
{
emit deleteItem(this);
Q_EMIT deleteItem(this);
}
void DownloadItem::openFile()
......
......@@ -106,7 +106,7 @@ void DownloadManager::show()
void DownloadManager::resizeEvent(QResizeEvent* e)
{
QWidget::resizeEvent(e);
emit resized(size());
Q_EMIT resized(size());
}
void DownloadManager::keyPressEvent(QKeyEvent* e)
......@@ -251,7 +251,7 @@ void DownloadManager::clearList()
items.append(downItem);
}
qDeleteAll(items);
emit downloadsCountChanged();
Q_EMIT downloadsCountChanged();
}
void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
......@@ -372,7 +372,7 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
downItem->show();
m_activeDownloadsCount++;
emit downloadsCountChanged();
Q_EMIT downloadsCountChanged();
}
int DownloadManager::downloadsCount() const
......@@ -403,7 +403,7 @@ void DownloadManager::downloadFinished(bool success)
downloadingAllFilesFinished = false;
}
emit downloadsCountChanged();
Q_EMIT downloadsCountChanged();
if (downloadingAllFilesFinished) {
if (success && qApp->activeWindow() != this) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment