Commit 286e46a8 authored by Alexander Stippich's avatar Alexander Stippich

Remove all remnants of outdated notification system

Summary:
The notification system is not used anywhere
anymore. There is no single emit of
newNotification within Elisa.
If new notifications are added to Elisa, they
should use a PassiveNotification from Kirigami.
More ui cleanup will follow later.

Reviewers: mgallien, ngraham

Reviewed By: mgallien, ngraham

Tags: #elisa

Differential Revision: https://phabricator.kde.org/D23223
parent f9e3c546
......@@ -61,7 +61,6 @@ private Q_SLOTS:
qRegisterMetaType<QVector<qlonglong>>("QVector<qlonglong>");
qRegisterMetaType<QHash<qlonglong,int>>("QHash<qlonglong,int>");
qRegisterMetaType<QList<QUrl>>("QList<QUrl>");
qRegisterMetaType<NotificationItem>("NotificationItem");
}
void initialTestWithNoTrack()
......@@ -432,8 +431,6 @@ private Q_SLOTS:
QSignalSpy modifiedTracksListSpy(&myListing, &LocalFileListing::modifyTracksList);
QSignalSpy indexingStartedSpy(&myListing, &LocalFileListing::indexingStarted);
QSignalSpy indexingFinishedSpy(&myListing, &LocalFileListing::indexingFinished);
QSignalSpy newNotificationSpy(&myListing, &LocalFileListing::newNotification);
QSignalSpy closeNotificationSpy(&myListing, &LocalFileListing::closeNotification);
QSignalSpy askRestoredTracksSpy(&myListing, &LocalFileListing::askRestoredTracks);
QCOMPARE(tracksListSpy.count(), 0);
......@@ -441,8 +438,6 @@ private Q_SLOTS:
QCOMPARE(modifiedTracksListSpy.count(), 0);
QCOMPARE(indexingStartedSpy.count(), 0);
QCOMPARE(indexingFinishedSpy.count(), 0);
QCOMPARE(newNotificationSpy.count(), 0);
QCOMPARE(closeNotificationSpy.count(), 0);
QCOMPARE(askRestoredTracksSpy.count(), 0);
myListing.setAllRootPaths({QStringLiteral("/does/not/exists")});
......@@ -452,8 +447,6 @@ private Q_SLOTS:
QCOMPARE(modifiedTracksListSpy.count(), 0);
QCOMPARE(indexingStartedSpy.count(), 0);
QCOMPARE(indexingFinishedSpy.count(), 0);
QCOMPARE(newNotificationSpy.count(), 0);
QCOMPARE(closeNotificationSpy.count(), 0);
QCOMPARE(askRestoredTracksSpy.count(), 0);
myListing.init();
......@@ -463,8 +456,6 @@ private Q_SLOTS:
QCOMPARE(modifiedTracksListSpy.count(), 0);
QCOMPARE(indexingStartedSpy.count(), 0);
QCOMPARE(indexingFinishedSpy.count(), 0);
QCOMPARE(newNotificationSpy.count(), 0);
QCOMPARE(closeNotificationSpy.count(), 0);
QCOMPARE(askRestoredTracksSpy.count(), 1);
myListing.restoredTracks({{QUrl::fromLocalFile(QStringLiteral("/removed/files1")), QDateTime::fromMSecsSinceEpoch(1)},
......@@ -475,8 +466,6 @@ private Q_SLOTS:
QCOMPARE(modifiedTracksListSpy.count(), 0);
QCOMPARE(indexingStartedSpy.count(), 1);
QCOMPARE(indexingFinishedSpy.count(), 0);
QCOMPARE(newNotificationSpy.count(), 0);
QCOMPARE(closeNotificationSpy.count(), 0);
QCOMPARE(askRestoredTracksSpy.count(), 1);
auto removedTracksSignal = removedTracksListSpy.at(0);
......
......@@ -12,8 +12,6 @@ set(elisaLib_SOURCES
trackslistener.cpp
elisaapplication.cpp
modeldataloader.cpp
notificationitem.cpp
topnotificationmanager.cpp
elisautils.cpp
abstractfile/abstractfilelistener.cpp
abstractfile/abstractfilelisting.cpp
......@@ -358,8 +356,6 @@ if (Qt5Quick_FOUND AND Qt5Widgets_FOUND)
qml/RatingStar.qml
qml/DraggableItem.qml
qml/TopNotification.qml
qml/TopNotificationItem.qml
qml/TrackImportNotification.qml
qml/HeaderBar.qml
......
......@@ -19,7 +19,6 @@
#include "abstractfilelisting.h"
#include "databaseinterface.h"
#include "notificationitem.h"
#include <QThread>
......@@ -100,10 +99,6 @@ void AbstractFileListener::setFileListing(AbstractFileListing *fileIndexer)
this, &AbstractFileListener::indexingStarted);
connect(fileIndexer, &AbstractFileListing::indexingFinished,
this, &AbstractFileListener::indexingFinished);
connect(fileIndexer, &AbstractFileListing::newNotification,
this, &AbstractFileListener::newNotification);
connect(fileIndexer, &AbstractFileListing::closeNotification,
this, &AbstractFileListener::closeNotification);
}
AbstractFileListing *AbstractFileListener::fileListing() const
......
......@@ -18,8 +18,6 @@
#ifndef ABSTRACTFILELISTENER_H
#define ABSTRACTFILELISTENER_H
#include "notificationitem.h"
#include <QObject>
#include <QVector>
#include <QString>
......@@ -63,10 +61,6 @@ Q_SIGNALS:
void clearDatabase();
void newNotification(NotificationItem notification);
void closeNotification(QString notificationId);
public Q_SLOTS:
void setDatabaseInterface(DatabaseInterface* databaseInterface);
......@@ -81,8 +75,6 @@ protected:
void setFileListing(AbstractFileListing *fileIndexer);
NotificationItem& currentNotification();
private:
std::unique_ptr<AbstractFileListenerPrivate> d;
......
......@@ -22,7 +22,6 @@
#include "abstractfile/indexercommon.h"
#include "musicaudiotrack.h"
#include "notificationitem.h"
#include "filescanner.h"
#include <QThread>
......@@ -64,8 +63,6 @@ public:
int mImportedTracksCount = 0;
int mNotificationUpdateInterval = 1;
int mNewFilesEmitInterval = 1;
bool mHandleNewFiles = true;
......@@ -231,9 +228,6 @@ void AbstractFileListing::scanDirectory(QList<MusicAudioTrack> &newFiles, const
newFiles.push_back(newTrack);
++d->mImportedTracksCount;
if (d->mImportedTracksCount % d->mNotificationUpdateInterval == 0) {
d->mNotificationUpdateInterval = std::min(50, 1 + d->mNotificationUpdateInterval * 2);
}
if (newFiles.size() > d->mNewFilesEmitInterval && d->mStopRequest == 0) {
d->mNewFilesEmitInterval = std::min(50, 1 + d->mNewFilesEmitInterval * d->mNewFilesEmitInterval);
......
......@@ -20,8 +20,6 @@
#include "elisaLib_export.h"
#include "notificationitem.h"
#include <QObject>
#include <QString>
#include <QUrl>
......@@ -33,7 +31,6 @@
class AbstractFileListingPrivate;
class MusicAudioTrack;
class NotificationItem;
class FileScanner;
class QFileInfo;
class QMimeDatabase;
......@@ -65,10 +62,6 @@ Q_SIGNALS:
void indexingFinished();
void newNotification(NotificationItem notification);
void closeNotification(QString notificationId);
void askRestoredTracks();
void errorWatchingFileSystemChanges();
......
......@@ -20,8 +20,6 @@
#ifndef ANDROIDMUSICLISTENER_H
#define ANDROIDMUSICLISTENER_H
#include "notificationitem.h"
#include <QObject>
#include <QList>
#include <QHash>
......@@ -78,10 +76,6 @@ Q_SIGNALS:
void clearDatabase(const QString &listenerName);
void newNotification(NotificationItem notification);
void closeNotification(QString notificationId);
void tracksList(const QList<MusicAudioTrack> &tracks, const QHash<QString, QUrl> &covers, const QString &musicSource);
void removedTracksList(const QList<QUrl> &removedTracks);
......
......@@ -20,7 +20,6 @@
#include "baloo/baloocommon.h"
#include "musicaudiotrack.h"
#include "notificationitem.h"
#include "elisa_settings.h"
#include "elisautils.h"
......@@ -117,7 +116,6 @@ LocalBalooFileListing::LocalBalooFileListing(QObject *parent)
LocalBalooFileListing::~LocalBalooFileListing()
{
Q_EMIT closeNotification(QStringLiteral("balooInvalidConfiguration"));
}
void LocalBalooFileListing::applicationAboutToQuit()
......
......@@ -37,7 +37,6 @@ int main(int argc, char *argv[])
qRegisterMetaType<QVector<qulonglong>>("QVector<qulonglong>");
qRegisterMetaType<QHash<qulonglong,int>>("QHash<qulonglong,int>");
qRegisterMetaType<QMap<QString, int>>();
qRegisterMetaType<NotificationItem>("NotificationItem");
qRegisterMetaType<QMap<QString,int>>("QMap<QString,int>");
QCommandLineParser parser;
......
......@@ -63,8 +63,6 @@
#endif
#include "audiowrapper.h"
#include "notificationitem.h"
#include "topnotificationmanager.h"
#if defined Qt5DBus_FOUND && Qt5DBus_FOUND
#include "mpris2/mpris2.h"
......@@ -133,7 +131,6 @@ void ElisaQmlTestPlugin::registerTypes(const char *uri)
#endif
qmlRegisterType<AudioWrapper>(uri, 1, 0, "AudioWrapper");
qmlRegisterType<TopNotificationManager>(uri, 1, 0, "TopNotificationManager");
qmlRegisterUncreatableType<DatabaseInterface>(uri, 1, 0, "DatabaseInterface", QStringLiteral("Only created in c++"));
#if defined Qt5DBus_FOUND && Qt5DBus_FOUND
......@@ -160,7 +157,6 @@ void ElisaQmlTestPlugin::registerTypes(const char *uri)
qRegisterMetaType<TracksListener::ListTrackDataType>("TracksListener::ListTrackDataType");
qRegisterMetaType<QMap<QString, int>>();
qRegisterMetaType<QAction*>();
qRegisterMetaType<NotificationItem>("NotificationItem");
qRegisterMetaType<QMap<QString,int>>("QMap<QString,int>");
qRegisterMetaType<ElisaUtils::PlayListEnqueueMode>("ElisaUtils::PlayListEnqueueMode");
qRegisterMetaType<ElisaUtils::PlayListEnqueueTriggerPlay>("ElisaUtils::PlayListEnqueueTriggerPlay");
......
......@@ -39,7 +39,6 @@
#include "file/filelistener.h"
#include "file/localfilelisting.h"
#include "trackslistener.h"
#include "notificationitem.h"
#include "elisaapplication.h"
#include "elisa_settings.h"
#include "modeldataloader.h"
......@@ -336,10 +335,6 @@ void MusicListenersManager::configChanged()
this, &MusicListenersManager::monitorEndingListeners);
connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::clearDatabase,
&d->mDatabaseInterface, &DatabaseInterface::removeAllTracksFromSource);
connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::newNotification,
this, &MusicListenersManager::newNotification);
connect(d->mAndroidMusicListener.get(), &AndroidMusicListener::closeNotification,
this, &MusicListenersManager::closeNotification);
}
#endif
}
......@@ -348,10 +343,6 @@ void MusicListenersManager::increaseImportedTracksCount(const DatabaseInterface:
{
d->mImportedTracksCount += allTracks.size();
//if (d->mImportedTracksCount >= 4) {
Q_EMIT closeNotification(QStringLiteral("notEnoughTracks"));
//}
Q_EMIT importedTracksCountChanged();
}
......@@ -370,24 +361,6 @@ void MusicListenersManager::monitorStartingListeners()
void MusicListenersManager::monitorEndingListeners()
{
/*if (d->mImportedTracksCount < 4 && d->mElisaApplication) {
NotificationItem notEnoughTracks;
notEnoughTracks.setNotificationId(QStringLiteral("notEnoughTracks"));
notEnoughTracks.setTargetObject(this);
notEnoughTracks.setMessage(i18nc("No track found message", "No track have been found"));
auto configureAction = d->mElisaApplication->action(QStringLiteral("options_configure"));
notEnoughTracks.setMainButtonText(configureAction->text());
notEnoughTracks.setMainButtonIconName(configureAction->icon().name());
notEnoughTracks.setMainButtonMethodName(QStringLiteral("showConfiguration"));
Q_EMIT newNotification(notEnoughTracks);
}*/
d->mIndexerBusy = false;
Q_EMIT indexerBusyChanged();
}
......@@ -449,10 +422,6 @@ void MusicListenersManager::startLocalFileSystemIndexing()
this, &MusicListenersManager::monitorStartingListeners);
connect(&d->mFileListener, &FileListener::indexingFinished,
this, &MusicListenersManager::monitorEndingListeners);
connect(&d->mFileListener, &FileListener::newNotification,
this, &MusicListenersManager::newNotification);
connect(&d->mFileListener, &FileListener::closeNotification,
this, &MusicListenersManager::closeNotification);
QMetaObject::invokeMethod(d->mFileListener.fileListing(), "init", Qt::QueuedConnection);
......@@ -475,10 +444,6 @@ void MusicListenersManager::startBalooIndexing()
this, &MusicListenersManager::monitorEndingListeners);
connect(&d->mBalooListener, &BalooListener::clearDatabase,
&d->mDatabaseInterface, &DatabaseInterface::clearData);
connect(&d->mBalooListener, &BalooListener::newNotification,
this, &MusicListenersManager::newNotification);
connect(&d->mBalooListener, &BalooListener::closeNotification,
this, &MusicListenersManager::closeNotification);
QMetaObject::invokeMethod(d->mBalooListener.fileListing(), "init", Qt::QueuedConnection);
......
......@@ -20,7 +20,6 @@
#include "elisaLib_export.h"
#include "notificationitem.h"
#include "databaseinterface.h"
#include <QObject>
......@@ -30,7 +29,6 @@
class MusicListenersManagerPrivate;
class MediaPlayList;
class NotificationItem;
class ElisaApplication;
class ModelDataLoader;
......@@ -110,10 +108,6 @@ Q_SIGNALS:
void importedTracksCountChanged();
void newNotification(NotificationItem notification);
void closeNotification(QString notificationId);
void elisaApplicationChanged();
void removeTracksInError(QList<QUrl> tracks);
......
/*
* Copyright 2017 Matthieu Gallien <matthieu_gallien@yahoo.fr>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "notificationitem.h"
#include <QObject>
class NotificationItemPrivate {
public:
QString mNotificationId;
QString mMessage;
QString mMainButtonText;
QString mMainButtonIconName;
QString mSecondaryButtonText;
QString mSecondaryButtonIconName;
QObject *mTarget = nullptr;
QString mMainButtonMethodName;
QString mSecondaryButtonMethodName;
};
NotificationItem::NotificationItem() : d(std::make_unique<NotificationItemPrivate>())
{
}
NotificationItem::NotificationItem(const NotificationItem &other) : d(std::make_unique<NotificationItemPrivate>(*other.d))
{
}
NotificationItem::NotificationItem(NotificationItem &&other)
{
other.d.swap(d);
}
NotificationItem& NotificationItem::operator=(const NotificationItem &other)
{
if (&other != this) {
*d = *(other.d);
}
return *this;
}
NotificationItem::~NotificationItem()
= default;
const QString& NotificationItem::notificationId() const
{
return d->mNotificationId;
}
const QString& NotificationItem::message() const
{
return d->mMessage;
}
const QString& NotificationItem::mainButtonText() const
{
return d->mMainButtonText;
}
const QString& NotificationItem::secondaryButtonText() const
{
return d->mSecondaryButtonText;
}
const QString& NotificationItem::secondaryButtonIconName() const
{
return d->mSecondaryButtonIconName;
}
void NotificationItem::setNotificationId(QString notificationId)
{
if (d->mNotificationId == notificationId) {
return;
}
d->mNotificationId = std::move(notificationId);
}
const QString& NotificationItem::mainButtonIconName() const
{
return d->mMainButtonIconName;
}
void NotificationItem::setMessage(QString message)
{
if (d->mMessage == message) {
return;
}
d->mMessage = std::move(message);
}
void NotificationItem::setMainButtonText(QString mainButtonText)
{
if (d->mMainButtonText == mainButtonText) {
return;
}
d->mMainButtonText = std::move(mainButtonText);
}
void NotificationItem::setSecondaryButtonText(QString secondaryButtonText)
{
if (d->mSecondaryButtonText == secondaryButtonText) {
return;
}
d->mSecondaryButtonText = std::move(secondaryButtonText);
}
void NotificationItem::setSecondaryButtonIconName(QString secondaryButtonIconName)
{
if (d->mSecondaryButtonIconName == secondaryButtonIconName) {
return;
}
d->mSecondaryButtonIconName = std::move(secondaryButtonIconName);
}
void NotificationItem::setTargetObject(QObject *target)
{
d->mTarget = target;
}
void NotificationItem::setMainButtonMethodName(QString methodName)
{
d->mMainButtonMethodName = std::move(methodName);
}
void NotificationItem::setSecondaryButtonMethodName(QString methodName)
{
d->mSecondaryButtonMethodName = std::move(methodName);
}
void NotificationItem::triggerMainButton() const
{
if (!d->mTarget) {
return;
}
QMetaObject::invokeMethod(d->mTarget, d->mMainButtonMethodName.toLatin1().data(), Qt::QueuedConnection);
}
void NotificationItem::triggerSecondaryButton() const
{
if (!d->mTarget) {
return;
}
QMetaObject::invokeMethod(d->mTarget, d->mSecondaryButtonMethodName.toLatin1().data(), Qt::QueuedConnection);
}
void NotificationItem::setMainButtonIconName(QString mainButtonIconName)
{
if (d->mMainButtonIconName == mainButtonIconName) {
return;
}
d->mMainButtonIconName = std::move(mainButtonIconName);
}
/*
* Copyright 2017 Matthieu Gallien <matthieu_gallien@yahoo.fr>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef NOTIFICATIONITEM_H
#define NOTIFICATIONITEM_H
#include "elisaLib_export.h"
#include <QString>
#include <memory>
class NotificationItemPrivate;
class QObject;
class ELISALIB_EXPORT NotificationItem
{
public:
NotificationItem();
NotificationItem(const NotificationItem &other);
NotificationItem(NotificationItem &&other);
NotificationItem& operator=(const NotificationItem &other);
NotificationItem& operator=(NotificationItem &&other);
~NotificationItem();
const QString& notificationId() const;
const QString& message() const;
const QString& mainButtonText() const;
const QString& mainButtonIconName() const;
const QString& secondaryButtonText() const;
const QString& secondaryButtonIconName() const;
void setNotificationId(QString notificationId);
void setMessage(QString message);
void setMainButtonText(QString mainButtonText);
void setMainButtonIconName(QString mainButtonIconName);
void setSecondaryButtonText(QString secondaryButtonText);
void setSecondaryButtonIconName(QString secondaryButtonIconName);
void setTargetObject(QObject *target);
void setMainButtonMethodName(QString methodName);
void setSecondaryButtonMethodName(QString methodName);
void triggerMainButton() const;
void triggerSecondaryButton() const;
private:
std::unique_ptr<NotificationItemPrivate> d;
};
#endif // NOTIFICATIONITEM_H
......@@ -178,16 +178,6 @@ RowLayout {
spacing: 0
TopNotification {
id: invalidBalooConfiguration
Layout.fillWidth: true