Commit 08744ab7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

GIT_SILENT: use Q_EMIT

parent d8c75e32
......@@ -104,7 +104,7 @@ protected:
const QPoint pos = Touch_Helper::simpleTapPosition(event);
if (pos != QPoint(-1, -1)) {
expand(indexAt(pos));
emit activated(indexAt(pos));
Q_EMIT activated(indexAt(pos));
}
return QTreeView::viewportEvent(event);
......@@ -187,7 +187,7 @@ void FolderViewContextManagerItem::slotActivated(const QModelIndex &index)
}
QUrl url = mModel->urlForIndex(index);
emit urlChanged(url);
Q_EMIT urlChanged(url);
}
void FolderViewContextManagerItem::setupModel()
......
......@@ -482,12 +482,12 @@ KIPI::UploadWidget *KIPIInterface::uploadWidget(QWidget *parent)
void KIPIInterface::slotSelectionChanged()
{
emit selectionChanged(!d->mMainWindow->contextManager()->selectedFileItemList().isEmpty());
Q_EMIT selectionChanged(!d->mMainWindow->contextManager()->selectedFileItemList().isEmpty());
}
void KIPIInterface::slotDirectoryChanged()
{
emit currentAlbumChanged(true);
Q_EMIT currentAlbumChanged(true);
}
#ifdef GWENVIEW_KIPI_WITH_CREATE_METHODS
......
......@@ -1118,7 +1118,7 @@ void MainWindow::setActiveViewModeAction(QAction *action)
toggleSideBar(d->sideBarVisibility());
toggleStatusBar(d->statusBarVisibility());
emit viewModeChanged();
Q_EMIT viewModeChanged();
}
void MainWindow::slotThumbnailViewIndexActivated(const QModelIndex &index)
......
......@@ -331,17 +331,17 @@ void SaveBar::triggerAction(const QString &action)
{
QList<QUrl> lst = DocumentFactory::instance()->modifiedDocumentList();
if (action == QLatin1String("first")) {
emit goToUrl(lst[0]);
Q_EMIT goToUrl(lst[0]);
} else if (action == QLatin1String("previous")) {
int pos = lst.indexOf(d->mCurrentUrl);
--pos;
Q_ASSERT(pos >= 0);
emit goToUrl(lst[pos]);
Q_EMIT goToUrl(lst[pos]);
} else if (action == QLatin1String("next")) {
int pos = lst.indexOf(d->mCurrentUrl);
++pos;
Q_ASSERT(pos < lst.size());
emit goToUrl(lst[pos]);
Q_EMIT goToUrl(lst[pos]);
} else {
qCWarning(GWENVIEW_APP_LOG) << "Unknown action: " << action;
}
......
......@@ -218,7 +218,7 @@ void StartMainPage::slotTagViewClicked(const QModelIndex &index)
}
// FIXME: Check label encoding
const QString tag = index.data().toString();
emit urlSelected(QUrl("tags:/" + tag));
Q_EMIT urlSelected(QUrl("tags:/" + tag));
#endif
}
......@@ -253,7 +253,7 @@ void StartMainPage::slotListViewActivated(const QModelIndex &index)
qCCritical(GWENVIEW_APP_LOG) << "Tried to open an invalid url";
return;
}
emit urlSelected(url);
Q_EMIT urlSelected(url);
}
void StartMainPage::showEvent(QShowEvent *event)
......@@ -324,12 +324,12 @@ void StartMainPage::showContextMenu(const QPoint &pos)
} else if (action == forgetAction) {
view->model()->removeRow(index.row());
if (d->mHistoryWidget->currentWidget() == d->mRecentFilesTab) {
emit recentFileRemoved(url);
Q_EMIT recentFileRemoved(url);
}
} else if (action == forgetAllAction) {
view->model()->removeRows(0, view->model()->rowCount());
if (d->mHistoryWidget->currentWidget() == d->mRecentFilesTab) {
emit recentFilesCleared();
Q_EMIT recentFilesCleared();
}
}
}
......
......@@ -793,23 +793,23 @@ bool ViewMainPage::eventFilter(QObject *watched, QEvent *event)
switch (ke->key()) {
case Qt::Key_Left:
if (QApplication::isRightToLeft()) {
emit nextImageRequested();
Q_EMIT nextImageRequested();
} else {
emit previousImageRequested();
Q_EMIT previousImageRequested();
}
return true;
case Qt::Key_Up:
emit previousImageRequested();
Q_EMIT previousImageRequested();
return true;
case Qt::Key_Right:
if (QApplication::isRightToLeft()) {
emit previousImageRequested();
Q_EMIT previousImageRequested();
} else {
emit nextImageRequested();
Q_EMIT nextImageRequested();
}
return true;
case Qt::Key_Down:
emit nextImageRequested();
Q_EMIT nextImageRequested();
return true;
default:
break;
......
......@@ -103,7 +103,7 @@ void DocumentDirFinder::slotCompleted()
void DocumentDirFinder::finish(const QUrl &url, DocumentDirFinder::Status status)
{
disconnect(d->mDirLister, nullptr, this, nullptr);
emit done(url, status);
Q_EMIT done(url, status);
deleteLater();
}
......
......@@ -73,7 +73,7 @@ public:
for (int i = 0; i < failedSubFolderCount; i++) {
dirs << failedSubFolders[i].toString(QUrl::PreferLocalFile);
}
emit q->showErrors(files, dirs);
Q_EMIT q->showErrors(files, dirs);
}
}
......
......@@ -77,7 +77,7 @@ struct ImporterPrivate {
KIO::Job *job = KIO::mkpath(url, QUrl(), KIO::HideProgressInfo);
KJobWidgets::setWindow(job, mAuthWindow);
if (!job->exec()) {
emit q->error(i18n("Could not create destination folder."));
Q_EMIT q->error(i18n("Could not create destination folder."));
return false;
}
......@@ -92,13 +92,13 @@ struct ImporterPrivate {
}
if (!mTempImportDir->isValid()) {
emit q->error(i18n("Could not create temporary upload folder."));
Q_EMIT q->error(i18n("Could not create temporary upload folder."));
return false;
}
mTempImportDirUrl = QUrl::fromLocalFile(mTempImportDir->path() + '/');
if (!mTempImportDirUrl.isValid()) {
emit q->error(i18n("Could not create temporary upload folder."));
Q_EMIT q->error(i18n("Could not create temporary upload folder."));
return false;
}
......@@ -208,7 +208,7 @@ void Importer::start(const QList<QUrl> &list, const QUrl &destination)
d->mJobProgress = 0;
emitProgressChanged();
emit maximumChanged(d->mUrlList.count() * 100);
Q_EMIT maximumChanged(d->mUrlList.count() * 100);
if (!d->createImportDir(destination)) {
qCWarning(GWENVIEW_IMPORTER_LOG) << "Could not create import dir";
......@@ -235,7 +235,7 @@ void Importer::slotCopyDone(KJob *_job)
void Importer::finalizeImport()
{
delete d->mTempImportDir;
emit importFinished();
Q_EMIT importFinished();
}
void Importer::advance()
......@@ -253,7 +253,7 @@ void Importer::slotPercent(KJob *, unsigned long percent)
void Importer::emitProgressChanged()
{
emit progressChanged(d->mProgress * 100 + d->mJobProgress);
Q_EMIT progressChanged(d->mProgress * 100 + d->mJobProgress);
}
QList<QUrl> Importer::importedUrlList() const
......
......@@ -318,7 +318,7 @@ void ThumbnailPage::importList(const QModelIndexList &list)
}
// FIXME: Handle dirs (do we want to import recursively?)
}
emit importRequested();
Q_EMIT importRequested();
}
void ThumbnailPage::updateImportButtons()
......
......@@ -168,7 +168,7 @@ void ContextManager::setCurrentUrl(const QUrl &currentUrl)
}
d->mSelectedFileItemListNeedsUpdate = true;
emit currentUrlChanged(currentUrl);
Q_EMIT currentUrlChanged(currentUrl);
}
KFileItemList ContextManager::selectedFileItemList() const
......@@ -190,9 +190,9 @@ void ContextManager::setCurrentDirUrl(const QUrl &_url)
d->mDirListerFinished = false;
} else {
d->mCurrentDirUrl.clear();
emit d->mDirModel->dirLister()->clear();
Q_EMIT d->mDirModel->dirLister()->clear();
}
emit currentDirUrlChanged(d->mCurrentDirUrl);
Q_EMIT currentDirUrlChanged(d->mCurrentDirUrl);
}
QUrl ContextManager::currentDirUrl() const
......@@ -270,7 +270,7 @@ void Gwenview::ContextManager::slotCurrentChanged(const QModelIndex &index)
void ContextManager::emitQueuedSignals()
{
for (ContextManagerPrivate::Signal signal : qAsConst(d->mQueuedSignals)) {
emit(this->*signal)();
Q_EMIT(this->*signal)();
}
d->mQueuedSignals.clear();
}
......
......@@ -240,7 +240,7 @@ void CropTool::setRect(const QRect &rect)
d->mRect = rect;
d->keepRectInsideImage();
if (d->mRect != oldRect) {
emit rectUpdated(d->mRect);
Q_EMIT rectUpdated(d->mRect);
}
imageView()->update();
}
......@@ -379,7 +379,7 @@ void CropTool::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
d->keepRectInsideImage();
imageView()->update();
emit rectUpdated(d->mRect);
Q_EMIT rectUpdated(d->mRect);
}
void CropTool::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
......@@ -399,7 +399,7 @@ void CropTool::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
return;
}
event->accept();
emit d->mCropWidget->findChild<QDialogButtonBox *>()->accepted();
Q_EMIT d->mCropWidget->findChild<QDialogButtonBox *>()->accepted();
}
void CropTool::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
......@@ -421,16 +421,16 @@ void CropTool::keyPressEvent(QKeyEvent *event)
switch (event->key()) {
case Qt::Key_Escape:
event->accept();
emit buttons->rejected();
Q_EMIT buttons->rejected();
break;
case Qt::Key_Return:
case Qt::Key_Enter: {
event->accept();
auto focusButton = static_cast<QPushButton *>(buttons->focusWidget());
if (focusButton && buttons->buttonRole(focusButton) == QDialogButtonBox::RejectRole) {
emit buttons->rejected();
Q_EMIT buttons->rejected();
} else {
emit buttons->accepted();
Q_EMIT buttons->accepted();
}
break;
}
......@@ -467,8 +467,8 @@ void CropTool::toolDeactivated()
void CropTool::slotCropRequested()
{
auto *op = new CropImageOperation(d->mRect);
emit imageOperationRequested(op);
emit done();
Q_EMIT imageOperationRequested(op);
Q_EMIT done();
}
QWidget *CropTool::widget() const
......
......@@ -450,7 +450,7 @@ void CropWidget::reset()
d->widthSpinBox->setValue(size.width());
d->topSpinBox->setValue(0);
d->heightSpinBox->setValue(size.height());
emit rectReset();
Q_EMIT rectReset();
}
void CropWidget::setCropRatioIndex(int index)
......
......@@ -66,7 +66,7 @@ struct DateWidgetPrivate {
{
mDate = mDate.addDays(delta);
updateButton();
emit q->dateChanged(mDate);
Q_EMIT q->dateChanged(mDate);
}
};
......@@ -125,7 +125,7 @@ void DateWidget::slotDatePickerModified(const QDate &date)
{
d->mDatePicker->hide();
d->mDate = date;
emit dateChanged(date);
Q_EMIT dateChanged(date);
d->updateButton();
}
......
......@@ -59,13 +59,13 @@ AnimatedDocumentLoadedImpl::~AnimatedDocumentLoadedImpl()
void AnimatedDocumentLoadedImpl::init()
{
emit isAnimatedUpdated();
Q_EMIT isAnimatedUpdated();
if (!document()->image().isNull()) {
// We may reach this point without an image if the first frame got
// downsampled by LoadingDocumentImpl (unlikely for now because the gif
// io handler does not support the QImageIOHandler::ScaledSize option)
emit imageRectUpdated(document()->image().rect());
emit loaded();
Q_EMIT imageRectUpdated(document()->image().rect());
Q_EMIT loaded();
}
}
......@@ -83,7 +83,7 @@ void AnimatedDocumentLoadedImpl::slotFrameChanged(int /*frameNumber*/)
{
QImage image = d->mMovie.currentImage();
setDocumentImage(image);
emit imageRectUpdated(image.rect());
Q_EMIT imageRectUpdated(image.rect());
}
bool AnimatedDocumentLoadedImpl::isAnimated() const
......
......@@ -130,7 +130,7 @@ void DocumentPrivate::downSampleImage(int invertedZoom)
if (mDownSampledImageMap[invertedZoom].size().isEmpty()) {
mDownSampledImageMap[invertedZoom] = mImage;
}
emit q->downSampledImageReady();
Q_EMIT q->downSampledImageReady();
}
//- DownSamplingJob ---------------------------------------
......@@ -315,7 +315,7 @@ void Document::slotSaveResult(KJob *job)
auto *saveJob = static_cast<SaveJob *>(job);
d->mUrl = saveJob->newUrl();
d->mImageMetaInfoModel.setUrl(d->mUrl);
emit saved(saveJob->oldUrl(), d->mUrl);
Q_EMIT saved(saveJob->oldUrl(), d->mUrl);
}
}
......@@ -327,7 +327,7 @@ QByteArray Document::format() const
void Document::setFormat(const QByteArray &format)
{
d->mFormat = format;
emit metaInfoUpdated();
Q_EMIT metaInfoUpdated();
}
MimeTypeUtils::Kind Document::kind() const
......@@ -338,7 +338,7 @@ MimeTypeUtils::Kind Document::kind() const
void Document::setKind(MimeTypeUtils::Kind kind)
{
d->mKind = kind;
emit kindDetermined(d->mUrl);
Q_EMIT kindDetermined(d->mUrl);
}
QSize Document::size() const
......@@ -370,7 +370,7 @@ void Document::setSize(const QSize &size)
}
d->mSize = size;
d->mImageMetaInfoModel.setImageSize(size);
emit metaInfoUpdated();
Q_EMIT metaInfoUpdated();
}
bool Document::isModified() const
......@@ -387,14 +387,14 @@ void Document::setExiv2Image(std::unique_ptr<Exiv2::Image> image)
{
d->mExiv2Image = std::move(image);
d->mImageMetaInfoModel.setExiv2Image(d->mExiv2Image.get());
emit metaInfoUpdated();
Q_EMIT metaInfoUpdated();
}
void Document::setDownSampledImage(const QImage &image, int invertedZoom)
{
Q_ASSERT(!d->mDownSampledImageMap.contains(invertedZoom));
d->mDownSampledImageMap[invertedZoom] = image;
emit downSampledImageReady();
Q_EMIT downSampledImageReady();
}
QString Document::errorString() const
......@@ -459,17 +459,17 @@ bool Document::prepareDownSampledImageForZoom(qreal zoom)
void Document::emitMetaInfoLoaded()
{
emit metaInfoLoaded(d->mUrl);
Q_EMIT metaInfoLoaded(d->mUrl);
}
void Document::emitLoaded()
{
emit loaded(d->mUrl);
Q_EMIT loaded(d->mUrl);
}
void Document::emitLoadingFailed()
{
emit loadingFailed(d->mUrl);
Q_EMIT loadingFailed(d->mUrl);
}
QUndoStack *Document::undoStack() const
......@@ -483,9 +483,9 @@ void Document::imageOperationCompleted()
// If user just undid all his changes this does not really correspond
// to a save, but it's similar enough as far as Document users are
// concerned
emit saved(d->mUrl, d->mUrl);
Q_EMIT saved(d->mUrl, d->mUrl);
} else {
emit modified(d->mUrl);
Q_EMIT modified(d->mUrl);
}
}
......@@ -520,7 +520,7 @@ void Document::enqueueJob(DocumentJob *job)
d->mCurrentJob = job;
LOG("Starting first job");
job->start();
emit busyChanged(d->mUrl, true);
Q_EMIT busyChanged(d->mUrl, true);
}
LOG_QUEUE("Job added", d);
}
......@@ -533,8 +533,8 @@ void Document::slotJobFinished(KJob *job)
if (d->mJobQueue.isEmpty()) {
LOG("All done");
d->mCurrentJob.clear();
emit busyChanged(d->mUrl, false);
emit allTasksDone();
Q_EMIT busyChanged(d->mUrl, false);
Q_EMIT allTasksDone();
} else {
LOG("Starting next job");
d->mCurrentJob = d->mJobQueue.dequeue();
......
......@@ -179,13 +179,13 @@ Document::Ptr DocumentFactory::load(const QUrl &url)
// network device is started. So start the dirlister after url is
// loaded or failed to load.
connect(doc, &Document::loaded, [this, url]() {
emit readyForDirListerStart(url);
Q_EMIT readyForDirListerStart(url);
});
connect(doc, &Document::loadingFailed, [this, url]() {
emit readyForDirListerStart(url);
Q_EMIT readyForDirListerStart(url);
});
connect(doc, &Document::downSampledImageReady, [this, url]() {
emit readyForDirListerStart(url);
Q_EMIT readyForDirListerStart(url);
});
doc->reload();
......@@ -225,8 +225,8 @@ void DocumentFactory::slotLoaded(const QUrl &url)
{
if (d->mModifiedDocumentList.contains(url)) {
d->mModifiedDocumentList.removeAll(url);
emit modifiedDocumentListChanged();
emit documentChanged(url);
Q_EMIT modifiedDocumentListChanged();
Q_EMIT documentChanged(url);
}
}
......@@ -242,13 +242,13 @@ void DocumentFactory::slotSaved(const QUrl &oldUrl, const QUrl &newUrl)
}
d->garbageCollect(d->mDocumentMap);
if (oldUrlWasModified || newUrlWasModified) {
emit modifiedDocumentListChanged();
Q_EMIT modifiedDocumentListChanged();
}
if (oldUrlWasModified) {
emit documentChanged(oldUrl);
Q_EMIT documentChanged(oldUrl);
}
if (!oldIsNew) {
emit documentChanged(newUrl);
Q_EMIT documentChanged(newUrl);
}
}
......@@ -256,14 +256,14 @@ void DocumentFactory::slotModified(const QUrl &url)
{
if (!d->mModifiedDocumentList.contains(url)) {
d->mModifiedDocumentList << url;
emit modifiedDocumentListChanged();
Q_EMIT modifiedDocumentListChanged();
}
emit documentChanged(url);
Q_EMIT documentChanged(url);
}
void DocumentFactory::slotBusyChanged(const QUrl &url, bool busy)
{
emit documentBusyStateChanged(url, busy);
Q_EMIT documentBusyStateChanged(url, busy);
}
QUndoGroup *DocumentFactory::undoGroup()
......@@ -281,7 +281,7 @@ void DocumentFactory::forget(const QUrl &url)
if (d->mModifiedDocumentList.contains(url)) {
d->mModifiedDocumentList.removeAll(url);
emit modifiedDocumentListChanged();
Q_EMIT modifiedDocumentListChanged();
}
}
......
......@@ -62,8 +62,8 @@ DocumentLoadedImpl::~DocumentLoadedImpl()
void DocumentLoadedImpl::init()
{
if (!d->mQuietInit) {
emit imageRectUpdated(document()->image().rect());
emit loaded();
Q_EMIT imageRectUpdated(document()->image().rect());
Q_EMIT loaded();
}
}
......@@ -107,7 +107,7 @@ AbstractDocumentEditor *DocumentLoadedImpl::editor()
void DocumentLoadedImpl::setImage(const QImage &image)
{
setDocumentImage(image);
emit imageRectUpdated(image.rect());
Q_EMIT imageRectUpdated(image.rect());
}
void DocumentLoadedImpl::applyTransformation(Orientation orientation)
......@@ -116,7 +116,7 @@ void DocumentLoadedImpl::applyTransformation(Orientation orientation)
QTransform matrix = ImageUtils::transformMatrix(orientation);
image = image.transformed(matrix);
setDocumentImage(image);
emit imageRectUpdated(image.rect());
Q_EMIT imageRectUpdated(image.rect());
}
QByteArray DocumentLoadedImpl::rawData() const
......
......@@ -139,7 +139,7 @@ struct LoadingDocumentImplPrivate {
default:
q->setDocumentErrorString(i18nc("@info", "Gwenview cannot display documents of type %1.", mMimeType.name()));
emit q->loadingFailed();
Q_EMIT q->loadingFailed();
q->switchToImpl(new EmptyDocumentImpl(q->document()));
return true;
}
......@@ -391,7 +391,7 @@ void LoadingDocumentImpl::init()
QFile file(url.toLocalFile());
if (!file.open(QIODevice::ReadOnly)) {
setDocumentErrorString(i18nc("@info", "Could not open file %1", url.toLocalFile()));
emit loadingFailed();
Q_EMIT loadingFailed();
switchToImpl(new EmptyDocumentImpl(document()));
return;
}
......@@ -445,7 +445,7 @@ void LoadingDocumentImpl::slotTransferFinished(KJob *job)
{
if (job->error()) {
setDocumentErrorString(job->errorString());
emit loadingFailed();
Q_EMIT loadingFailed();
switchToImpl(new EmptyDocumentImpl(document()));
return;
} else if (document()->kind() == MimeTypeUtils::KIND_UNKNOWN) {
......@@ -482,7 +482,7 @@ void LoadingDocumentImpl::slotMetaInfoLoaded()
Q_ASSERT(!d->mMetaInfoFuture.isRunning());
if (!d->mMetaInfoFuture.result()) {
setDocumentErrorString(i18nc("@info", "Loading meta information failed."));
emit loadingFailed();
Q_EMIT loadingFailed();
switchToImpl(new EmptyDocumentImpl(document()));
return;
}
......@@ -493,7 +493,7 @@ void LoadingDocumentImpl::slotMetaInfoLoaded()
setDocumentCmsProfile(d->mCmsProfile);
d->mMetaInfoLoaded = true;
emit metaInfoLoaded();
Q_EMIT metaInfoLoaded();
// Start image loading if necessary
// We test if mImageDataFuture is not already running because code connected to
......@@ -508,7 +508,7 @@ void LoadingDocumentImpl::slotImageLoaded()
LOG("");
if (d->mImage.isNull()) {
setDocumentErrorString(i18nc("@info", "Loading image failed."));
emit loadingFailed();
Q_EMIT loadingFailed();
switchToImpl(new EmptyDocumentImpl(document()));
return;
}
......