diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,6 @@ notificationitem.cpp topnotificationmanager.cpp elisautils.cpp - datatype.cpp abstractfile/abstractfilelistener.cpp abstractfile/abstractfilelisting.cpp filescanner.cpp @@ -281,7 +280,6 @@ set(elisaqmlplugin_SOURCES elisaqmlplugin.cpp - datatype.cpp elisautils.cpp ) diff --git a/src/databaseinterface.h b/src/databaseinterface.h --- a/src/databaseinterface.h +++ b/src/databaseinterface.h @@ -20,7 +20,6 @@ #include "elisaLib_export.h" -#include "datatype.h" #include "elisautils.h" #include @@ -502,8 +501,6 @@ void reloadExistingDatabase(); - qulonglong initialId(DataUtils::DataType aType); - qulonglong genericInitialId(QSqlQuery &request); void insertTrackOrigin(const QUrl &fileNameURI, const QDateTime &fileModifiedTime, const QDateTime &importDate); diff --git a/src/databaseinterface.cpp b/src/databaseinterface.cpp --- a/src/databaseinterface.cpp +++ b/src/databaseinterface.cpp @@ -6297,34 +6297,12 @@ { qCDebug(orgKdeElisaDatabase) << "DatabaseInterface::reloadExistingDatabase"; - d->mArtistId = initialId(DataUtils::DataType::AllArtists); - d->mComposerId = initialId(DataUtils::DataType::AllComposers); - d->mLyricistId = initialId(DataUtils::DataType::AllLyricists); - d->mAlbumId = initialId(DataUtils::DataType::AllAlbums); - d->mTrackId = initialId(DataUtils::DataType::AllTracks); - d->mGenreId = initialId(DataUtils::DataType::AllGenres);; -} - -qulonglong DatabaseInterface::initialId(DataUtils::DataType aType) -{ - switch (aType) - { - case DataUtils::DataType::AllAlbums: - return genericInitialId(d->mQueryMaximumAlbumIdQuery); - case DataUtils::DataType::AllArtists: - return genericInitialId(d->mQueryMaximumArtistIdQuery); - case DataUtils::DataType::AllComposers: - return genericInitialId(d->mQueryMaximumComposerIdQuery); - case DataUtils::DataType::AllGenres: - return genericInitialId(d->mQueryMaximumGenreIdQuery); - case DataUtils::DataType::AllLyricists: - return genericInitialId(d->mQueryMaximumLyricistIdQuery); - case DataUtils::DataType::AllTracks: - return genericInitialId(d->mQueryMaximumTrackIdQuery); - case DataUtils::DataType::UnknownType: - break; - } - return 1; + d->mArtistId = genericInitialId(d->mQueryMaximumArtistIdQuery); + d->mComposerId = genericInitialId(d->mQueryMaximumComposerIdQuery); + d->mLyricistId = genericInitialId(d->mQueryMaximumLyricistIdQuery); + d->mAlbumId = genericInitialId(d->mQueryMaximumAlbumIdQuery); + d->mTrackId = genericInitialId(d->mQueryMaximumTrackIdQuery); + d->mGenreId = genericInitialId(d->mQueryMaximumGenreIdQuery); } qulonglong DatabaseInterface::genericInitialId(QSqlQuery &request) diff --git a/src/datatype.h b/src/datatype.h deleted file mode 100644 --- a/src/datatype.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2018 Matthieu Gallien - * - * 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 . - */ - -#ifndef DATATYPE_H -#define DATATYPE_H - -#include "elisaLib_export.h" - -#include - -namespace DataUtils { - -Q_NAMESPACE - -enum class DataType { - AllArtists, - AllAlbums, - AllTracks, - AllGenres, - AllComposers, - AllLyricists, - UnknownType, -}; - -Q_ENUM_NS(DataType) - -} - -#endif // DATATYPE_H diff --git a/src/datatype.cpp b/src/datatype.cpp deleted file mode 100644 --- a/src/datatype.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2018 Matthieu Gallien - * - * 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 . - */ - -#include "datatype.h" - - -#include "moc_datatype.cpp" diff --git a/src/elisaqmlplugin.cpp b/src/elisaqmlplugin.cpp --- a/src/elisaqmlplugin.cpp +++ b/src/elisaqmlplugin.cpp @@ -66,7 +66,6 @@ #include "notificationitem.h" #include "topnotificationmanager.h" #include "elisautils.h" -#include "datatype.h" #if defined Qt5DBus_FOUND && Qt5DBus_FOUND #include "mpris2/mpris2.h" @@ -113,7 +112,6 @@ qRegisterMetaType(); qRegisterMetaType(); #endif - qRegisterMetaType("DataUtils::DataType"); qmlRegisterType(uri, 1, 0, "MediaPlayList"); qmlRegisterType(uri, 1, 0, "ManageMediaPlayerControl"); @@ -137,7 +135,6 @@ qmlRegisterType(uri, 1, 0, "AudioWrapper"); qmlRegisterType(uri, 1, 0, "TopNotificationManager"); - qmlRegisterUncreatableMetaObject(DataUtils::staticMetaObject, uri, 1, 0, "DataUtils", QStringLiteral("Only enums")); qmlRegisterUncreatableType(uri, 1, 0, "DatabaseInterface", QStringLiteral("Only created in c++")); #if defined Qt5DBus_FOUND && Qt5DBus_FOUND